code stringlengths 6 947k | repo_name stringlengths 5 100 | path stringlengths 4 226 | language stringclasses 1
value | license stringclasses 15
values | size int64 6 947k |
|---|---|---|---|---|---|
# -*- coding: utf-8 -*-
from cms.models.placeholdermodel import Placeholder
from cms.plugin_processors import (plugin_meta_context_processor,
mark_safe_plugin_processor)
from cms.utils import get_language_from_request
from cms.utils.django_load import iterload_objects
from cms.utils.placeholder import (get_page_fr... | driesdesmet/django-cms | cms/plugin_rendering.py | Python | bsd-3-clause | 6,339 |
import json
import unicodedata
from requests.exceptions import ConnectionError, Timeout
from six import iteritems
from datadog_checks.base import AgentCheck
from datadog_checks.base.errors import CheckException
class RiakReplCheck(AgentCheck):
REPL_STATS = {
"server_bytes_sent",
"server_bytes_r... | DataDog/integrations-extras | riak_repl/datadog_checks/riak_repl/riak_repl.py | Python | bsd-3-clause | 5,738 |
'''
Classes to generate the Example.com sitemap based on django.contrib.sitemaps.
'''
from django.contrib.sitemaps import Sitemap
from django.utils.datetime_safe import datetime
from canvas.models import Category, Visibility, Comment
from django.core import urlresolvers
from django.conf import settings
import urlparse
... | canvasnetworks/canvas | website/canvas/sitemaps.py | Python | bsd-3-clause | 2,140 |
# -*- coding: utf-8 -*-
"""
Django settings for {{cookiecutter.project_name}} project.
For more information on this file, see
https://docs.djangoproject.com/en/dev/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/dev/ref/settings/
"""
# Build paths inside the pro... | benregn/cookiecutter-django-ansible | {{cookiecutter.repo_name}}/{{cookiecutter.repo_name}}/config/settings.py | Python | bsd-3-clause | 15,037 |
# -*- 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 model 'Feedback'
db.create_table('feedback_form_feedback', (
... | bashu/django-feedback-form | feedback_form/south_migrations/0001_initial.py | Python | bsd-3-clause | 4,849 |
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 = "MovingAverage", cycle_length = 12, transform = "RelativeDifference", sigma = 0.0, exog_count = 0, ar_order = 0); | antoinecarme/pyaf | tests/artificial/transf_RelativeDifference/trend_MovingAverage/cycle_12/ar_/test_artificial_1024_RelativeDifference_MovingAverage_12__0.py | Python | bsd-3-clause | 278 |
from __future__ import absolute_import
import os
from itertools import count
from mock import Mock
from celery.concurrency.base import apply_target, BasePool
from celery.tests.case import AppCase
class test_BasePool(AppCase):
def test_apply_target(self):
scratch = {}
counter = count(0)
... | sivaprakashniet/push_pull | p2p/lib/python2.7/site-packages/celery/tests/concurrency/test_concurrency.py | Python | bsd-3-clause | 3,179 |
import copy
import json
import re
from django import forms
from django.conf import settings
from django.core.exceptions import ValidationError
from django.forms.fields import (
BooleanField,
CharField,
ChoiceField,
IntegerField,
)
from django.forms.forms import Form
from django.urls import reverse
from... | dimagi/commcare-hq | corehq/apps/sms/forms.py | Python | bsd-3-clause | 49,749 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
import pytest
from django.core.exceptions import ValidationError
from machina.apps.forum.signals import forum_moved
from machina.core.db.models import get_model
from machina.test.context_managers import mock_signal_receiver
from machina.test.factories i... | franga2000/django-machina | tests/unit/forum/test_models.py | Python | bsd-3-clause | 5,012 |
# -*- coding: utf-8 -*-
"""Python has a very powerful mapping type at its core: the :class:`dict`
type. While versatile and featureful, the :class:`dict` prioritizes
simplicity and performance. As a result, it does not retain the order
of item insertion [1]_, nor does it store multiple values per key. It
is a fast, uno... | neuropil/boltons | boltons/dictutils.py | Python | bsd-3-clause | 24,228 |
"""Templates module for Zinnia"""
import os
from django.template.defaultfilters import slugify
def append_position(path, position, separator=''):
"""
Concatenate a path and a position,
between the filename and the extension.
"""
filename, extension = os.path.splitext(path)
return ''.join([fil... | Fantomas42/django-blog-zinnia | zinnia/templating.py | Python | bsd-3-clause | 1,264 |
"""
Multilayer Perceptron
"""
__authors__ = "Ian Goodfellow"
__copyright__ = "Copyright 2012-2013, Universite de Montreal"
__credits__ = ["Ian Goodfellow", "David Warde-Farley"]
__license__ = "3-clause BSD"
__maintainer__ = "LISA Lab"
import logging
import math
import operator
import sys
import warnings
import numpy ... | goodfeli/pylearn2 | pylearn2/models/mlp.py | Python | bsd-3-clause | 166,284 |
# -*- coding: utf-8 -*-
'''
The model used to predict appointment duration is a decision tree.
The model is evaluated by the precentage of predicted times that are within
a threshold (5 minutes by default) of the actual duration.
The class `DurationPredictor` splits the data into testing and training, builds
the model... | gautsi/pmareport | pmareport/predictors.py | Python | bsd-3-clause | 6,290 |
##
##
# File auto-generated against equivalent DynamicSerialize Java class
#
# SOFTWARE HISTORY
#
# Date Ticket# Engineer Description
# ------------ ---------- ----------- --------------------------
# Oct 10, 2016 5916 bsteffen Generated
class GetGrid... | mjames-upc/python-awips | dynamicserialize/dstypes/com/raytheon/uf/common/dataaccess/response/GetGridLatLonResponse.py | Python | bsd-3-clause | 858 |
import sys
from os.path import join, abspath, dirname
# PATH vars
here = lambda *x: join(abspath(dirname(__file__)), *x)
PROJECT_ROOT = here("..")
root = lambda *x: join(abspath(PROJECT_ROOT), *x)
sys.path.insert(0, root('apps'))
ADMINS = (
('Maxime Lapointe', 'maxx@themaxx.ca'),
)
MANAGERS = ADMINS
SHELL_PLUS... | themaxx75/lapare-bijoux | lapare.ca/lapare/settings/base.py | Python | bsd-3-clause | 2,795 |
from scipy import stats
import numpy as np
from numpy.testing import (assert_almost_equal, assert_,
assert_array_almost_equal, assert_array_almost_equal_nulp, assert_allclose)
import pytest
from pytest import raises as assert_raises
def test_kde_1d():
#some basic tests comparing to normal distribution
np.... | aeklant/scipy | scipy/stats/tests/test_kdeoth.py | Python | bsd-3-clause | 14,694 |
#!/usr/bin/python
# $Id:$
import random
import sys
from pyglet.gl import *
from pyglet import clock
from pyglet import font
from pyglet import graphics
from pyglet import window
BARS = 100
if len(sys.argv) > 1:
BARS = int(sys.argv[1])
MIN_BAR_LENGTH = 4
MAX_BAR_LENGTH = 100
BAR_SEGMENT_HEIGHT = 10
UPDATE_PERIOD... | bitcraft/pyglet | contrib/experimental/buffer/bars.py | Python | bsd-3-clause | 2,705 |
"""normalize constraint and key names
correct keys for pre 0.5.6 naming convention
Revision ID: 438c27ec1c9
Revises: 439766f6104d
Create Date: 2015-06-13 21:16:32.358778
"""
from __future__ import unicode_literals
from alembic import op
from alembic.context import get_context
from sqlalchemy.dialects.postgresql.base... | ergo/ziggurat_foundations | ziggurat_foundations/migrations/versions/438c27ec1c9_normalize_constraint_and_key_names.py | Python | bsd-3-clause | 12,558 |
# -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
"Write your forwards methods here."
# Note: Don't use "from appname.models imp... | unclesaam/Social-Network-Harvester | SocialNetworkHarvester/snh/migrations/0001_migrate1.py | Python | bsd-3-clause | 40,915 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import, unicode_literals
"""
oauthlib.oauth1.rfc5849
~~~~~~~~~~~~~~
This module is an implementation of various logic needed
for signing and checking OAuth 1.0 RFC 5849 requests.
"""
import logging
import sys
import time
try:
import urlparse
except ImportEr... | mozilla/firefox-flicks | vendor-local/lib/python/oauthlib/oauth1/rfc5849/__init__.py | Python | bsd-3-clause | 41,842 |
# Python standard library
from os import path, listdir
from ConfigParser import ConfigParser
# Third-party libraries
from imagecraft import ImageGenerator
# Django settings
from django.conf import settings
# This module
from cleaver import ini_to_context, flatten_context
# Retrieve execution params
MEDIA_ROOT = g... | isolationism/django-cleaver | django_cleaver/imagecreator.py | Python | bsd-3-clause | 2,540 |
# =============================================================================
# Authors: PAR Government
# Organization: DARPA
#
# Copyright (c) 2016 PAR Government
# All rights reserved.
# ==============================================================================
from PIL import Image
import cv2
import numpy as ... | rwgdrummer/maskgen | maskgen/image_wrap.py | Python | bsd-3-clause | 33,777 |
"""
TwoDWalker.py is for controling the avatars in a 2D Scroller game environment.
"""
from GravityWalker import *
from panda3d.core import ConfigVariableBool
class TwoDWalker(GravityWalker):
"""
The TwoDWalker is primarily for a 2D Scroller game environment. Eg - Toon Blitz minigame.
TODO: This class is... | mgracer48/panda3d | direct/src/controls/TwoDWalker.py | Python | bsd-3-clause | 2,450 |
"""
Uses sphinx's pytest fixture to run builds
usage:
.. code-block:: python
from ipypublish.sphinx.tests import get_test_source_dir
@pytest.mark.sphinx(
buildername='html',
srcdir=get_test_source_dir('notebook'))
def test_basic(app, status, warning, get_sphinx_app_output):
app.... | chrisjsewell/ipypublish | ipypublish/sphinx/tests/conftest.py | Python | bsd-3-clause | 2,432 |
# Resource Representation reference dictionary (METS USE)
USE = {
'high_res': 1,
'thumbnail': 2,
'med_res': 3,
'ocr': 4,
'bounding_box': 5,
'transcription': 6,
'translation': 7,
'zoom': 8,
'cdx': 9,
'square': 10,
}
# View method for mimetypes
VIEW_TYPE_MIMETYPES = {
'image/p... | unt-libraries/aubreylib | aubreylib/__init__.py | Python | bsd-3-clause | 1,068 |
import os
import platform
import itertools
from setuptools import setup, find_packages
with open(os.path.join(os.path.dirname(__file__), "json_rest", "__version__.py")) as version_file:
exec(version_file.read())
_INSTALL_REQUIREMENTS = ["python-cjson", "pyforge", "sentinels"]
if platform.python_version() < '2.7':... | vmalloc/json_rest | setup.py | Python | bsd-3-clause | 918 |
import commonware.log
from datetime import datetime, timedelta
import re
from session_csrf import anonymous_csrf
from django.shortcuts import redirect, render, get_object_or_404
from django.contrib import messages
from django.utils.translation import ugettext_lazy as _
from django.views.generic.edit import CreateView, ... | softak/webfaction_demo | apps/stores/views.py | Python | bsd-3-clause | 11,025 |
from datetime import date
from mock import patch
from nose.tools import eq_
from kitsune.sumo import googleanalytics
from kitsune.sumo.tests import TestCase
from kitsune.wiki.tests import document, revision
class GoogleAnalyticsTests(TestCase):
"""Tests for the Google Analytics API helper."""
@patch.object... | dbbhattacharya/kitsune | kitsune/sumo/tests/test_googleanalytics.py | Python | bsd-3-clause | 15,153 |
import unittest
from django import test
from django.conf import settings
from model_bakery import baker
from devilry.devilry_group.models import FeedbackSet, GroupComment
from devilry.devilry_import_v2database.modelimporters.delivery_feedback_importers import DeliveryImporter
from .importer_testcase_mixin import Imp... | devilry/devilry-django | devilry/devilry_import_v2database/tests/test_modelimporters/test_deliveryimporter.py | Python | bsd-3-clause | 9,808 |
from corehq.apps.reports.util import get_INFilter_element_bindparam
from dimagi.utils.couch.database import get_db
from corehq.apps.domain.utils import DOMAIN_MODULE_KEY
import fluff
def flat_field(fn):
def getter(item):
return unicode(fn(item) or "")
return fluff.FlatField(getter)
def add_to_module... | qedsoftware/commcare-hq | custom/utils/utils.py | Python | bsd-3-clause | 1,214 |
import sys
from setuptools import setup
version = __import__('yaff').__version__
if sys.hexversion < 0x02070000:
EXTRA_INSTALL_REQUIRES = ['backport_collections']
else:
EXTRA_INSTALL_REQUIRES = []
setup(
name='yaff',
version=version,
description='Yet Another Faield Framework',
author='France... | fpischedda/yaff | setup.py | Python | bsd-3-clause | 1,425 |
#!/usr/bin/env vpython
# Copyright 2015 The Chromium Authors. 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 instrumentation.InstrumentationParser."""
import unittest
from pylib.instrumentation import instrumentation_parse... | youtube/cobalt | build/android/pylib/instrumentation/instrumentation_parser_test.py | Python | bsd-3-clause | 4,062 |
import inspect
import os
import pkgutil
import re
import shutil
import subprocess
import sys
import textwrap
from distutils import log
from distutils.cmd import DistutilsOptionError
import sphinx
from sphinx.setup_command import BuildDoc as SphinxBuildDoc
from ..utils import minversion
PY3 = sys.version_info[0] >=... | embray/astropy_helpers | astropy_helpers/commands/build_sphinx.py | Python | bsd-3-clause | 9,455 |
# Copyright (c) 2007-2008 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware imp... | liangwang/m5 | src/arch/x86/isa/insts/general_purpose/flags/push_and_pop.py | Python | bsd-3-clause | 2,420 |
from __future__ import absolute_import
from .base import * # NOQA
from .registry import RuleRegistry # NOQA
def init_registry():
from sentry.constants import _SENTRY_RULES
from sentry.plugins.base import plugins
from sentry.utils.imports import import_string
from sentry.utils.safe import safe_execu... | beeftornado/sentry | src/sentry/rules/__init__.py | Python | bsd-3-clause | 646 |
__all__ = ["GET_FIRST_CLIENT_RECT", \
"GET_LOCATION_IN_VIEW", \
"GET_PAGE_ZOOM", \
"IS_ELEMENT_CLICKABLE", \
"TOUCH_SINGLE_TAP", \
"CLEAR", \
"CLEAR_LOCAL_STORAGE", \
"CLEAR_SESSION_STORAGE", \
"CLICK", \
"EXECUTE_ASYNC_S... | PeterWangIntel/crosswalk-webdriver-python | third_party/atoms.py | Python | bsd-3-clause | 417,522 |
# Copyright (c) 2017, The MITRE Corporation. All rights reserved.
# See LICENSE.txt for complete terms.
from mixbox import entities
from mixbox import fields
import cybox.bindings.win_service_object as win_service_binding
from cybox.common import HashList
from cybox.objects.win_process_object import WinProcess
from c... | CybOXProject/python-cybox | cybox/objects/win_service_object.py | Python | bsd-3-clause | 2,132 |
def extractAlphawaveentertainmentCom(item):
'''
Parser for 'alphawaveentertainment.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('PRC', 'PRC', 'translated'),
... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractAlphawaveentertainmentCom.py | Python | bsd-3-clause | 565 |
#-*- coding: utf-8 -*-
import sys, fileinput, os
# Configuration
path_src = "../src/"
fextension = [".py"]
date_copyright = "2011"
authors = "see AUTHORS"
project_name = "ProfileExtractor"
header_file = "license_header.txt"
def pre_append(line, file_name):
fobj = fileinput.FileInput(file_name, inplace=1)
fir... | hadim/profileextractor | tools/autocopyleft.py | Python | bsd-3-clause | 1,265 |
###############################################################################
##
## Copyright (C) 2014-2016, New York University.
## Copyright (C) 2011-2014, NYU-Poly.
## Copyright (C) 2006-2011, University of Utah.
## All rights reserved.
## Contact: contact@vistrails.org
##
## This file is part of VisTrails.
##
## ... | minesense/VisTrails | vistrails/packages/spreadsheet/init.py | Python | bsd-3-clause | 8,965 |
from datetime import datetime, timedelta
import time
import unittest
from django.http import HttpRequest, HttpResponse, parse_cookie
from django.core.handlers.wsgi import WSGIRequest
from django.core.handlers.modpython import ModPythonRequest
from django.utils.http import cookie_date
class RequestsTests(unittest.Test... | alex/django-old | tests/regressiontests/requests/tests.py | Python | bsd-3-clause | 3,959 |
import numpy as np
from scipy import constants as cst
import pyfits as pf
from pyfits import Column
from time import sleep
import matplotlib as mpl
from matplotlib import pyplot as plt
#import codecs
#verifier l'organisation des cubes fits si on les ouvre en python
#faire un programme readad qui voit l'extension pour ... | b1quint/samfp | other/pyadhoc.py | Python | bsd-3-clause | 8,475 |
"""
provide a generic structure to support window functions,
similar to how we have a Groupby object
"""
from __future__ import division
import warnings
import numpy as np
from collections import defaultdict
from datetime import timedelta
from pandas.core.dtypes.generic import (
ABCSeries,
ABCDataFrame,
... | Winand/pandas | pandas/core/window.py | Python | bsd-3-clause | 68,740 |
"""
Player
The Player represents the game "account" and each login has only one
Player object. A Player is what chats on default channels but has no
other in-game-world existance. Rather the Player puppets Objects (such
as Characters) in order to actually participate in the game world.
Guest
Guest players are simpl... | vlegoff/mud | typeclasses/players.py | Python | bsd-3-clause | 4,163 |
# -*- coding: utf-8 -*-
from django import template
from django.core.exceptions import ValidationError
from django.test import TestCase
from oscar.apps.catalogue import models
from oscar.apps.catalogue.categories import create_from_breadcrumbs
class TestCategory(TestCase):
def setUp(self):
self.products... | jinnykoo/wuyisj | tests/integration/catalogue/category_tests.py | Python | bsd-3-clause | 10,192 |
from pytak.call import REST
class GetInformationAboutYourself(REST):
def fill_call_data(self):
self.uri = "/api/muad/rest/users/@me[?query_parameters]"
| zlatozar/pytak | pytak/tests/fakeapi/GetInformationAboutYourself.py | Python | bsd-3-clause | 166 |
from setuptools import setup, find_packages
setup(
name='panya-banner',
version='0.0.5',
description='Panya banner app.',
long_description = open('README.rst', 'r').read(),
author='Praekelt Foundation',
author_email='dev@praekelt.com',
license='BSD',
url='http://github.com/praekelt/pany... | praekelt/panya-banner | setup.py | Python | bsd-3-clause | 836 |
from django.contrib import admin
from django.contrib.auth.models import Group
from django.contrib.auth.admin import UserAdmin
from django.utils.translation import ugettext_lazy as _
from rest_framework.authtoken.admin import TokenAdmin
from .models import (
Colaborator, Company, Event, Invite, Link, Message, Noti... | ikcam/django-skeleton | core/admin.py | Python | bsd-3-clause | 3,475 |
from sequana import Quality
from sequana import phred
def test_quality():
q = Quality('ABC')
q.plot()
assert q.mean_quality == 33
q = phred.QualitySanger('ABC')
q = phred.QualitySolexa('ABC')
def test_ascii_to_quality():
assert phred.ascii_to_quality("!") == 0
assert phred.ascii_to_qual... | sequana/sequana | test/test_phred.py | Python | bsd-3-clause | 1,451 |
# -*- coding: utf-8 -*-
from django.db import models
from django.utils.functional import cached_property
from model_utils import Choices
from territori.models import Territorio
class BaseCodelist(models.Model):
codice = models.CharField(max_length=6, primary_key=True)
descrizione = models.CharField(max_length... | DeppSRL/open-partecipate | project/open_partecipate/models.py | Python | bsd-3-clause | 8,151 |
# coding: utf-8
from __future__ import unicode_literals
import os.path
from datetime import timedelta
from django import forms
from django.conf import settings
from django.contrib.auth import get_user_model
from django.utils import timezone
from django.utils.translation import ugettext_lazy as _
from djangobb_foru... | aldenjenkins/foobargamingwebsite | djangobb_forum/forms.py | Python | bsd-3-clause | 22,552 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2009, Roboterclub Aachen e.V.
# 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 retain the ... | chrism333/xpcc | tools/system_design/builder/cpp_postman.py | Python | bsd-3-clause | 4,175 |
import datetime
import functools
import json
from django import http
from django.conf import settings
from django.core.exceptions import PermissionDenied
from django.db import connection, transaction
import olympia.core.logger
from olympia import core
from olympia.accounts.utils import redirect_for_login
from olympia... | harikishen/addons-server | src/olympia/amo/decorators.py | Python | bsd-3-clause | 7,584 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from flask_script import Manager, Shell, Server
from flask_migrate import MigrateCommand
from app import create_app, db
from app.models import User
from app.settings import DevConfig, ProdConfig
if os.environ.get("ENV") == 'prod':
app = create_app(ProdConfi... | menglewis/roast-log | manage.py | Python | bsd-3-clause | 857 |
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.utils import simplejson
from django.core.serializers.json import DateTimeAwareJSONEncoder
from django.utils.xmlutils import SimplerXMLGenerator
from django.utils.encoding import smart_unicode
EMITTERS = {}
def g... | j2a/django-simprest | simprest/emitters.py | Python | bsd-3-clause | 1,874 |
# -*- coding: utf-8 -*-
import unittest
import trytond.tests.test_tryton
from test_invoice import TestInvoice
def suite():
"""
Define suite
"""
test_suite = trytond.tests.test_tryton.suite()
test_suite.addTests([
unittest.TestLoader().loadTestsFromTestCase(TestInvoice),
])
return... | joeirimpan/trytond-invoice-payment-gateway | tests/__init__.py | Python | bsd-3-clause | 414 |
# -*- coding: utf-8 -*-
# Licensed under a 3-clause BSD style license - see LICENSE.rst
import os
import astropy.units as u
import numpy as np
from astropy.table import Table
from astropy.utils.data import get_pkg_data_filename
from .extern.validator import (
validate_array,
validate_physical_type,
valida... | zblz/naima | src/naima/models.py | Python | bsd-3-clause | 15,997 |
from python_utils import __about__
def test_definitions():
# The setup.py requires this so we better make sure they exist :)
assert __about__.__version__
assert __about__.__author__
assert __about__.__author_email__
assert __about__.__description__
| WoLpH/python-utils | _python_utils_tests/test_python_utils.py | Python | bsd-3-clause | 272 |
# -*- coding: utf-8 -*-
#
# This file is part of Sequana software
#
# Copyright (c) 2016 - Sequana Development Team
#
# File author(s):
# Thomas Cokelaer <thomas.cokelaer@pasteur.fr>
#
# Distributed under the terms of the 3-clause BSD license.
# The full license is in the LICENSE file, distributed with this s... | sequana/sequana | sequana/viz/linkage.py | Python | bsd-3-clause | 2,122 |
def extractFaelicyTumblrCom(item):
'''
Parser for 'faelicy.tumblr.com'
'''
vol, chp, frag, postfix = extractVolChapterFragmentPostfix(item['title'])
if not (chp or vol) or "preview" in item['title'].lower():
return None
tagmap = [
('the scum villain\'s self saving system', 'the scum villain\'s self sa... | fake-name/ReadableWebProxy | WebMirror/management/rss_parser_funcs/feed_parse_extractFaelicyTumblrCom.py | Python | bsd-3-clause | 674 |
from steel.fields.base import *
from steel.fields.numbers import *
from steel.fields.strings import *
from steel.fields.compression import *
from steel.fields.compound import *
from steel.fields.integrity import *
| gulopine/steel | steel/fields/__init__.py | Python | bsd-3-clause | 214 |
"""
query or callproc Results
"""
import logging
import psycopg2
LOGGER = logging.getLogger(__name__)
class Results(object):
"""The :py:class:`Results` class contains the results returned from
:py:meth:`Session.query <queries.Session.query>` and
:py:meth:`Session.callproc <queries.Session.callproc>`. It... | gmr/queries | queries/results.py | Python | bsd-3-clause | 3,382 |
# Copyright 2019 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Logging-like module for creating artifacts.
In order to actually create artifacts, RegisterArtifactImplementation must be
called from somewhere with an a... | endlessm/chromium-browser | third_party/catapult/telemetry/telemetry/internal/results/artifact_logger.py | Python | bsd-3-clause | 2,300 |
"""
Django settings for mysite project.
Generated by 'django-admin startproject' using Django 1.11.1.
For more information on this file, see
https://docs.djangoproject.com/en/1.11/topics/settings/
For the full list of settings and their values, see
https://docs.djangoproject.com/en/1.11/ref/settings/
"""
import os
... | quietguy675/website | mysite/settings.py | Python | bsd-3-clause | 3,208 |
import sys
from plumbum import SshMachine, PuttyMachine
_WIN32 = sys.platform.startswith('win')
def RemoteMachine(*pargs, **kwargs):
'''
Remote machine constructor function. Forwards all arguments on to the
appropriate constructor for this platform. On windows this is
``plumbum.PuttyMachine`` and o... | obmarg/synchg | synchg/remote.py | Python | bsd-3-clause | 484 |
"""SoundRTS resource manager"""
import os
from lib.resource import ResourceLoader
import config
import options
from paths import MAPS_PATHS
def get_all_packages_paths():
"""return the default "maps and mods" paths followed by the paths of the active packages"""
return MAPS_PATHS # + package_manager.get_pack... | thgcode/soundrts | soundrts/res.py | Python | bsd-3-clause | 4,481 |
from local_settings import BASE_URL
import datetime
import json
import redis
import requests
import requests.exceptions
class TeaReaderConsumer(object):
def __init__(self):
self.redis = redis.StrictRedis()
def run(self):
pubsub = self.redis.pubsub(ignore_subscribe_messages=True)
pubs... | ojarva/home-info-display | tea_reader_consumer/run.py | Python | bsd-3-clause | 1,217 |
# -*- coding: utf-8 -*-
import re
from math import modf
from datetime import datetime, timedelta
## {{{ http://code.activestate.com/recipes/65215/ (r5)
EMAIL_PATTERN = re.compile('^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]' \
'+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$')
def to_unicode(text):
'''
C... | mohamedattahri/Greendizer-Python-Library | greendizer/clients/base.py | Python | bsd-3-clause | 1,742 |
# -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2017-01-10 13:29
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [("elections", "0018_election_group_type")]
operations = [
migrations.AlterField(
... | DemocracyClub/EveryElection | every_election/apps/elections/migrations/0019_auto_20170110_1329.py | Python | bsd-3-clause | 468 |
from setuptools import setup
setup(name='includer',
version='1.0.2',
description='Include and run callables',
classifiers=[
"License :: OSI Approved :: BSD License",
"Operating System :: POSIX",
"Programming Language :: Python :: 3",
"Development Status :: 5 -... | zzzsochi/includer | setup.py | Python | bsd-3-clause | 659 |
# -*- coding: utf-8 -*-
import copy
from django.core.exceptions import ImproperlyConfigured
from django.db.models.base import ModelBase
from django.db import models
from django.utils import six
from django.utils.functional import SimpleLazyObject, _super, empty
from shop import settings as shop_settings
class Deferre... | schacki/django-shop | shop/models/deferred.py | Python | bsd-3-clause | 6,502 |
#!/usr/bin/env vpython
#
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Sends a heart beat pulse to the currently online Android devices.
This heart beat lets the devices know that they are connect... | youtube/cobalt | build/android/host_heartbeat.py | Python | bsd-3-clause | 893 |
# Copyright (C) 2009, Hyves (Startphone Ltd.)
#
# This module is part of the Concurrence Framework and is released under
# the New BSD License: http://www.opensource.org/licenses/bsd-license.php
from concurrence.timer import Timeout
from concurrence.database.mysql import ProxyProtocol, PacketReader, PACKET_READ_RESULT... | concurrence/concurrence | lib/concurrence/database/mysql/proxy.py | Python | bsd-3-clause | 3,790 |
# !/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of Erebus, a web dashboard for tor relays.
#
# :copyright: (c) 2015, The Tor Project, Inc.
# (c) 2015, Damian Johnson
# (c) 2015, Cristobal Leiva
#
# :license: See LICENSE for licensing information.
import erebus
if __... | erebus/erebus | run_erebus.py | Python | bsd-3-clause | 360 |
# -*- coding: utf-8 -*-
"""
test_generate_files
-------------------
Tests formerly known from a unittest residing in test_generate.py named
TestGenerateFiles.test_generate_files_nontemplated_exception
TestGenerateFiles.test_generate_files
TestGenerateFiles.test_generate_files_with_trailing_newline
TestGenerateFiles.t... | dajose/cookiecutter | tests/test_generate_files.py | Python | bsd-3-clause | 11,704 |
import abc
class RuleLearner:
"""2D 2-person board game rule learner base class
TODO
"""
def __init__(self, board_height, board_width):
"""Initialize the rule learner
Subclasses should call this constructor.
:type board_height: positive integer
:param board_height: ... | cmdunkers/DeeperMind | RuleLearner/RuleLearner.py | Python | bsd-3-clause | 974 |
# -*- coding: utf-8 -*-
"""
(C) 2014-2019 Roman Sirokov and contributors
Licensed under BSD license
http://github.com/r0x0r/pywebview/
"""
import inspect
import json
import logging
import os
import re
import sys
import traceback
from platform import architecture
from threading import Thread
from uuid import uuid4
i... | r0x0r/pywebview | webview/util.py | Python | bsd-3-clause | 7,443 |
from bs4 import BeautifulSoup
import sys
import os
import json
def get_section(doc, section):
element = doc.find(section)
if element:
return element.get_text()
def get_description(doc):
text = get_section(doc, "refsect1")
if text:
lines = filter(lambda x: x.strip(), text.split("\n"))... | rafalcieslinski/pgspecial | scripts/docparser.py | Python | bsd-3-clause | 1,456 |
from oscar.apps.offer import models
class ChangesOwnerName(models.Benefit):
class Meta:
proxy = True
def apply(self, basket, condition, offer=None):
condition.consume_items(basket, ())
return models.PostOrderAction(
"You will have your name changed to Barry!")
def ap... | makielab/django-oscar | sites/sandbox/apps/offers.py | Python | bsd-3-clause | 584 |
#!/usr/bin/env python
import os
import sys
import glob
import argparse
from scai_utils import *
help_doc = "Convert raw DICOM images to nii format. (scai)"
# === Heuristics === #
heur = [["functionalsparse", "bold"],
["DIFFUSIONHIGHRES10Min", "diffusion"],
["AAHeadScout32", "aascout"],
["tf... | shanqing-cai/MRI_analysis | convert_dcm.py | Python | bsd-3-clause | 3,563 |
# -*- coding: utf-8 -*-
"""
Tests that NA values are properly handled during
parsing for all of the parsers defined in parsers.py
"""
import pytest
import numpy as np
from numpy import nan
import pandas.io.common as com
import pandas.util.testing as tm
from pandas import DataFrame, Index, MultiIndex
from pandas.com... | amolkahat/pandas | pandas/tests/io/parser/na_values.py | Python | bsd-3-clause | 13,968 |
#!/usr/bin/env python
'''Check a queue and get times and info for messages in q'''
import sys
import os
import logging
import json
import datetime
import boto.sqs as sqs
QUEUE_OAI_HARVEST = os.environ.get('QUEUE_OAI_HARVEST', 'OAI_harvest')
QUEUE_OAI_HARVEST_ERR = os.environ.get('QUEUE_OAI_HARVEST_ERR', 'OAI_harvest_e... | mredar/ucldc_oai_harvest | oai_harvester/read_sqs_queue.py | Python | bsd-3-clause | 1,363 |
"""Apps for bootcamp applications"""
from django.apps import AppConfig
class ApplicationConfig(AppConfig):
"""AppConfig for bootcamp applications"""
name = "applications"
def ready(self):
"""Application is ready"""
import applications.signals # pylint:disable=unused-import, unused-varia... | mitodl/bootcamp-ecommerce | applications/apps.py | Python | bsd-3-clause | 324 |
import yeti
class ModuleUno(yeti.Module):
def module_init(self):
raise Exception()
| Team4819/Yeti | tests/resources/engine/module2.py | Python | bsd-3-clause | 96 |
from gi.repository import GObject
import dbus
from blueman.Functions import *
from blueman.main.SignalTracker import SignalTracker
from blueman.plugins.AppletPlugin import AppletPlugin
from blueman.main.KillSwitchNG import KillSwitchNG, RFKillType, RFKillState
try:
import blueman.main.KillSwitch as _KillSwitch
ex... | nmercier/linux-cross-gcc | linux/lib/python2.7/dist-packages/blueman/plugins/applet/KillSwitch.py | Python | bsd-3-clause | 4,342 |
from sympy import Symbol, symbols, hypersimp, factorial, binomial, \
collect, Function, powsimp, separate, sin, exp, Rational, fraction, \
simplify, trigsimp, cos, tan, cot, log, ratsimp, Matrix, pi, integrate, \
solve, nsimplify, GoldenRatio, sqrt, E, I, sympify, atan, Derivative, \
S, ... | pernici/sympy | sympy/simplify/tests/test_simplify.py | Python | bsd-3-clause | 24,474 |
# -*- coding: utf-8 -*-
from datetime import datetime
from django.test import TestCase
from django.conf import settings
from django.utils import timezone
from .factories import UserFactory, LocationFactory
from .models import Media, User, Tag, Location
from .api import InstagramError
USER_ID = 237074561 # tnt_onli... | ramusus/django-instagram-api | instagram_api/tests.py | Python | bsd-3-clause | 14,673 |
from future import standard_library
standard_library.install_aliases()
from builtins import object
import threading
from time import time
import random
import queue
from ..common import log
class Scheduler(object):
"""
A simple scheduler which schedules the periodic or once event
"""
import sortedcon... | PaloAltoNetworks-BD/SplunkforPaloAltoNetworks | Splunk_TA_paloalto/bin/splunk_ta_paloalto/aob_py3/cloudconnectlib/splunktalib/schedule/scheduler.py | Python | isc | 4,153 |
from __future__ import absolute_import, division, print_function, unicode_literals
COPYRIGHT = '''
/*
* Copyright 2015-2019 Advanced Micro Devices, Inc.
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to dea... | michaelforney/libblit | amdgpu/makeregheader.py | Python | isc | 16,007 |
# -*- coding: utf-8 -*-
#------------------------------------------------------------------------------
# __init__.py
#------------------------------------------------------------------------------
import os
modelPath = os.path.normpath(os.path.dirname(__file__))
class Model(object):
def __init__(self):
... | knittledan/solr_lxml_Example | server/model/__init__.py | Python | mit | 855 |
# $Id: dbexts.py,v 1.5 2002/01/07 04:59:50 bzimmer Exp $
"""
This script provides platform independence by wrapping Python
Database API 2.0 compatible drivers to allow seamless database
usage across implementations.
In order to use the C version, you need mxODBC and mxDateTime.
In order to use the Java version, you n... | ai-ku/langvis | jython-2.1/Lib/dbexts.py | Python | mit | 20,664 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Proprietary and confidential.
# Copyright 2011 Perfect Search Corporation.
# All rights reserved.
#
import sys
sys.dont_write_bytecode = True
#import clientplugin
import fastbranches
import serverplugin
| perfectsearch/sandman | code/bzr-plugins/__init__.py | Python | mit | 254 |
from django.contrib import admin
from userguides.models import *
import csv
from django.http import HttpResponse
#------------- ACTIONS -----------------#
def export_user_info(modeladmin, request, queryset):
response = HttpResponse(content_type="application/csv")
response['Content-Disposition'] = 'attachment; ... | 216software/Profiles | communityprofiles/userguides/admin.py | Python | mit | 1,336 |
import codecs
import json
import re
RE_LINE_PRESERVE = re.compile(r'\r?\n', re.MULTILINE)
RE_COMMENT = re.compile(
r'''(?x)
(?P<comments>
/\*[^*]*\*+(?:[^/*][^*]*\*+)*/ # multi-line comments
| [ \t]*//(?:[^\r\n])* # single line comments
)
| (?P<code>
... | jonlabelle/SublimeJsPrettier | tests/validate_json_format.py | Python | mit | 5,940 |
# -*- coding: utf-8 -*-
"""
Dashboard stuff for admin_tools
"""
from django.core.urlresolvers import reverse
from django.utils.translation import ugettext_lazy as _
from admin_tools.dashboard import modules, Dashboard, AppIndexDashboard
from admin_tools.utils import get_admin_site_name
class CustomIndexDashboard(Dash... | emencia/emencia_paste_djangocms_3 | emencia_paste_djangocms_3/django_buildout/project/mods_available/admin_tools/dashboard.py | Python | mit | 3,336 |
from __future__ import print_function
import io
import os
import binascii
import hashlib
import socket
import shutil
import sys
import tarfile
import tempfile
import time
import zipfile
import logging
try:
import urllib.request as urllib2
except ImportError:
import urllib2
from ..source import Source
class... | bittorrent/needy | needy/sources/download.py | Python | mit | 5,420 |
from __future__ import unicode_literals
from datetime import datetime
from django.db import models
class Project(models.Model):
name = models.CharField(max_length=128, unique=True)
created_at = models.DateTimeField(default=datetime.now)
class Meta:
get_latest_by = 'created_at'
permissions... | vmalavolta/django-pieguard | tests/test_app/models.py | Python | mit | 461 |
# Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Example Shoutcast client. Run with:
python shoutcast.py localhost 8080
"""
from __future__ import print_function
import sys
from twisted.internet import protocol, reactor
from twisted.protocols.shoutcast import ShoutcastClient
class Test(S... | EricMuller/mynotes-backend | requirements/twisted/Twisted-17.1.0/docs/core/examples/shoutcast.py | Python | mit | 565 |
# -*- coding: utf-8 -*-
Y = lambda f: (lambda x: x(x))(lambda y: f(lambda *args: y(y)(*args)))
| xj9/funk | functions/_y_combinator.py | Python | mit | 96 |
from Task import Task
import os.path
import yaml
import botocore
import name_constructor
import time
import sys
class DynamoTable(Task):
"""Create or remove a table by yaml definition file"""
known_params = {
'name': 'name of the table to be created or removed',
'source': 'full name of the file with the de... | Travelport-Czech/apila | tasks/DynamoTable.py | Python | mit | 6,621 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.