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
# -*- coding: utf8 -*-
"""
Run all test modules in current directory.
"""
import os, sys
import unittest
import doctest
import glob
import logging
from StringIO import StringIO
try:
import fms
except ImportError:
# runnning from source, not installed, add fms source path to system path
... | jcbagneris/fms | tests/runalltests.py | Python | bsd-3-clause | 3,413 |
from configurations import values
class Email(object):
"""Email settings for SMTP."""
EMAIL_HOST = values.Value('localhost')
EMAIL_HOST_PASSWORD = values.SecretValue()
EMAIL_HOST_USER = values.Value('max@max-brauer.de')
EMAIL_PORT = values.IntegerValue(465)
EMAIL_USE_SSL = values.BooleanV... | DebVortex/max-brauer.de | maxbrauer/config/settings/email.py | Python | bsd-3-clause | 601 |
from __future__ import absolute_import, division, print_function
from glue.core.data import Data, Component
from glue.config import data_factory
from glue.core.data_factories.helpers import has_extension
__all__ = ['is_npy', 'npy_reader', 'is_npz', 'npz_reader']
# TODO: implement support for regular arrays, e.g., no... | saimn/glue | glue/core/data_factories/npy.py | Python | bsd-3-clause | 2,643 |
from datetime import timedelta
from django.core.validators import ValidationError
from django.test import SimpleTestCase
from django.utils import timezone
from glitter.publisher.validators import future_date
class TestFutureDateValidator(SimpleTestCase):
def test_valid_date(self):
next_week = timezone.n... | developersociety/django-glitter | glitter/publisher/tests/test_validators.py | Python | bsd-3-clause | 610 |
import numpy as np
import pytest
import pandas as pd
from pandas import (
Index,
MultiIndex,
date_range,
period_range,
)
import pandas._testing as tm
def test_shift(idx):
# GH8083 test the base class for shift
msg = "This method is only implemented for DatetimeIndex, PeriodIndex and "
"T... | datapythonista/pandas | pandas/tests/indexes/multi/test_analytics.py | Python | bsd-3-clause | 6,843 |
from django.conf.urls import patterns, url
from views import google_get_state_token, google_login, google_logout
urlpatterns = patterns('',
url(r'^get-state-token/(?P<action_type_id>\d+)/(?P<action_id>\d+)/$', google_get_state_token, name='google_contacts_get_state_token'),
url(r'^login/$', google_login, nam... | agiliq/fundraiser | contacts/urls.py | Python | bsd-3-clause | 424 |
#!/usr/bin/env python
# Copyright (c) 2011 Fergus Gallagher <fergus.gallagher@citeulike.org>
# 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 ... | OAButton/tricorder | plugins/python/tandf.py | Python | bsd-3-clause | 1,935 |
"""
======================================================
Classification of text documents using sparse features
======================================================
This is an example showing how scikit-learn can be used to classify documents
by topics using a bag-of-words approach. This example uses a scipy.spars... | hitszxp/scikit-learn | examples/text/document_classification_20newsgroups.py | Python | bsd-3-clause | 10,746 |
"""
Functions to operate on polynomials.
"""
__all__ = ['poly', 'roots', 'polyint', 'polyder', 'polyadd',
'polysub', 'polymul', 'polydiv', 'polyval', 'poly1d',
'polyfit', 'RankWarning']
import functools
import re
import warnings
import numpy.core.numeric as NX
from numpy.core import (isscalar, ... | pbrod/numpy | numpy/lib/polynomial.py | Python | bsd-3-clause | 43,813 |
##########################################################################
#
# Copyright (c) 2014, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistrib... | cedriclaunay/gaffer | python/GafferSceneUI/CropWindowToolUI.py | Python | bsd-3-clause | 2,447 |
import difflib
import json
import posixpath
import sys
import threading
import unittest
from collections import Counter
from contextlib import contextmanager
from copy import copy
from functools import wraps
from unittest.util import safe_repr
from urllib.parse import unquote, urljoin, urlparse, urlsplit
from urllib.re... | twz915/django | django/test/testcases.py | Python | bsd-3-clause | 55,344 |
from babelsubs.generators.base import BaseGenerator, register
class TXTGenerator(BaseGenerator):
file_type = 'txt'
MAPPINGS = dict(linebreaks="\n")
def __init__(self, subtitle_set, line_delimiter=u'\n\n', language=None):
"""
Generator is list of {'text': 'text', 'start': 'seconds', 'end':... | revdotcom/babelsubs | babelsubs/generators/txt.py | Python | bsd-3-clause | 769 |
'''
'''
from __future__ import absolute_import
import logging
log = logging.getLogger(__name__)
from ..document import Document
class Application(object):
''' An Application is a factory for Document instances.
'''
def __init__(self, *handlers):
self._handlers = list(handlers)
# TODO (hav... | htygithub/bokeh | bokeh/application/application.py | Python | bsd-3-clause | 1,422 |
from scrapy.linkextractors import LinkExtractor
from scrapy.spiders import CrawlSpider, Rule
class DmozSpider(CrawlSpider):
"""Follow categories and extract links."""
name = 'dmoz'
allowed_domains = ['dmoz-odp.org']
start_urls = ['http://www.dmoz-odp.org/']
rules = [
Rule(LinkExtractor(
... | darkrho/scrapy-redis | example-project/example/spiders/dmoz.py | Python | bsd-3-clause | 790 |
# Licensed under a 3-clause BSD style license - see LICENSE.rst
"""
Tests that relate to fitting models with quantity parameters
"""
from __future__ import (absolute_import, unicode_literals, division,
print_function)
import numpy as np
from ..models import Gaussian1D
from ... import units a... | kelle/astropy | astropy/modeling/tests/test_quantities_fitting.py | Python | bsd-3-clause | 4,268 |
import os
from random import randint
from datetime import date, datetime, timedelta
from struct import unpack
from stdnet import SessionNotAvailable, CommitException
from stdnet.utils import test, encoders, populate, ispy3k, iteritems
from stdnet.apps.columnts import ColumnTS, as_dict
from stdnet.backends import redis... | lsbardel/python-stdnet | tests/all/apps/columnts/main.py | Python | bsd-3-clause | 21,184 |
# Copyright (c) 2005-2007 The Regents of The University of Michigan
# 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 above copyright
# notice, this ... | prodromou87/gem5 | src/dev/Pci.py | Python | bsd-3-clause | 4,938 |
# -*- coding: utf-8 -*-
"""
Tests for TimedeltaIndex methods behaving like their Timedelta counterparts
"""
import numpy as np
import pytest
import pandas as pd
from pandas import Index, Series, Timedelta, TimedeltaIndex, timedelta_range
import pandas.util.testing as tm
class TestVectorizedTimedelta(object):
de... | GuessWhoSamFoo/pandas | pandas/tests/indexes/timedeltas/test_scalar_compat.py | Python | bsd-3-clause | 2,423 |
import json
from django import forms
from django.test.utils import override_settings
from django_webtest import WebTest
from . import build_test_urls
class TextareaForm(forms.Form):
test_field = forms.CharField(
min_length=5,
max_length=20,
widget=forms.Textarea(attrs={'data-test': 'Test ... | 2947721120/django-material | tests/test_widget_textarea.py | Python | bsd-3-clause | 5,002 |
"""
Utility functions for handling network ports
"""
import socket
def find_port() -> int:
sock = socket.socket()
sock.bind(("localhost", 0))
host, port = sock.getsockname()
return port
def is_port_open(ip: str, port: int) -> bool:
with socket.socket(socket.AF_INET, socket.SOCK_STREAM) as s:
... | psi4/DatenQM | qcfractal/port_util.py | Python | bsd-3-clause | 523 |
""" test positional based indexing with iloc """
import pytest
from warnings import catch_warnings, filterwarnings, simplefilter
import numpy as np
import pandas as pd
from pandas.compat import lrange, lmap
from pandas import Series, DataFrame, date_range, concat, isna
from pandas.util import testing as tm
from pand... | cython-testbed/pandas | pandas/tests/indexing/test_iloc.py | Python | bsd-3-clause | 25,666 |
from unittest import skipUnless
from django.db import connection
from django.test import TestCase
from .models import Article, ArticleTranslation, IndexTogetherSingleList
class SchemaIndexesTests(TestCase):
"""
Test index handling by the db.backends.schema infrastructure.
"""
def test_index_name_ha... | sgzsh269/django | tests/indexes/tests.py | Python | bsd-3-clause | 3,231 |
from .forest import RandomForestRegressor
from .forest import ExtraTreesRegressor
from .mondrian import MondrianForestClassifier
from .mondrian import MondrianForestRegressor
from .mondrian import MondrianTreeClassifier
from .mondrian import MondrianTreeRegressor
from .quantile import DecisionTreeQuantileRegressor
from... | MechCoder/scikit-garden | skgarden/__init__.py | Python | bsd-3-clause | 824 |
"""
Plugin for probing emc
"""
from framework.dependency_management.dependency_resolver import ServiceLocator
DESCRIPTION = " EMC Probing "
def run(PluginInfo):
resource = ServiceLocator.get_component("resource").GetResources('EmcProbeMethods')
return ServiceLocator.get_component("plugin_helper").CommandDu... | DarKnight24/owtf | plugins/network/active/ppp@PTES-005.py | Python | bsd-3-clause | 375 |
"""
Initializer for the queue_handler folder
"""
from .adapters import build_queue_adapter
from .handlers import QueueManagerHandler, ServiceQueueHandler, TaskQueueHandler, ComputeManagerHandler
from .managers import QueueManager
| psi4/DatenQM | qcfractal/queue/__init__.py | Python | bsd-3-clause | 231 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('projects', '0014_add-state-tracking'),
]
operations = [
migrations.AddField(
model_name='project',
n... | espdev/readthedocs.org | readthedocs/projects/migrations/0015_add_project_allow_promos.py | Python | mit | 519 |
import json
from flask import Flask
from flask import request, abort, redirect, url_for
app = Flask(__name__)
clients = {}
def getRequest(request):
rq = None
if request.method == 'POST':
rq = request.form
else:
rq = request.args
return rq
@app.route('/')
def index():
return 'Index... | ayebear/FriendFinder | server.py | Python | mit | 2,060 |
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | AustinRoy7/Pomodoro-timer | venv/Lib/site-packages/pyglet/image/codecs/pil.py | Python | mit | 4,522 |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from functools import wraps
import json
try:
from urllib import urlencode
except ImportError:
from urllib.parse import urlencode
import requests
from requests_toolbelt import MultipartEncoder
API_TEMPLATE = 'https://pcs.baidu.com/rest/2.0/pcs/{0}'
class Invalid... | matrixorz/justpic | justpic/vendor/baidupcs/api.py | Python | mit | 38,434 |
# encoding: utf-8
"""
Test suite for the docx.blkcntnr (block item container) module
"""
from __future__ import absolute_import, print_function, unicode_literals
import pytest
from docx.blkcntnr import BlockItemContainer
from docx.table import Table
from docx.text import Paragraph
from .unitutil.cxml import elemen... | holli-holzer/python-docx | tests/test_blkcntnr.py | Python | mit | 4,231 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.conf import settings
from django.db import models, migrations
def seed_sections(apps, schema_editor):
Section = apps.get_model("blog", "Section")
db_alias = schema_editor.connection.alias
for section in settings.PINAX_BLOG_SECTIO... | easton402/pinax-blog | pinax/blog/migrations/0003_auto_20150529_0405.py | Python | mit | 1,277 |
import json
import unreal_engine as ue
from unreal_engine.classes import Skeleton, AnimSequence, SkeletalMesh, Material, MorphTarget, AnimSequence, AnimSequenceFactory
from unreal_engine import FTransform, FVector, FRotator, FQuat, FSoftSkinVertex, FMorphTargetDelta, FRawAnimSequenceTrack
from unreal_engine.structs imp... | kitelightning/UnrealEnginePython | tutorials/SnippetsForStaticAndSkeletalMeshes_Assets/threejs_importer.py | Python | mit | 13,106 |
# -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
import numpy as np
import warnings
from scipy import fftpack
def get_image_quadrants(IM, reorient=True, symmetry_axis=None,
... | rth/PyAbel | abel/tools/symmetry.py | Python | mit | 14,042 |
"""Django app configuration for the Gold Membership app."""
from __future__ import absolute_import
from django.apps import AppConfig
class GoldAppConfig(AppConfig):
name = 'readthedocs.gold'
verbose_name = 'Gold'
def ready(self):
import readthedocs.gold.signals # noqa
| safwanrahman/readthedocs.org | readthedocs/gold/apps.py | Python | mit | 294 |
# -*- coding: UTF-8 -*-
# by Mafarricos
# email: MafaStudios@gmail.com
# This program is free software: GNU General Public License
import os,urllib
import links,search
from resources.libs import basic
def createstrm(name,imdbid,year,url):
addon_id = links.link().yify_id
addon_path = os.path.join(links.link().instal... | dannyperry571/theapprentice | script.module.addonsresolver/resources/libs/parsers/yify.py | Python | gpl-2.0 | 1,140 |
# test for xml.dom.minidom
import copy
import pickle
from test import support
import unittest
import xml.dom.minidom
from xml.dom.minidom import parse, Node, Document, parseString
from xml.dom.minidom import getDOMImplementation
tstfile = support.findfile("test.xml", subdir="xmltestdata")
sample = ("<?xml version=... | FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Lib/test/test_minidom.py | Python | gpl-2.0 | 66,881 |
"""Tests for base_events.py"""
import errno
import logging
import math
import os
import socket
import sys
import threading
import time
import unittest
from unittest import mock
import asyncio
from asyncio import base_events
from asyncio import constants
from asyncio import events
from test.test_asyncio import utils a... | FFMG/myoddweb.piger | monitor/api/python/Python-3.7.2/Lib/test/test_asyncio/test_base_events.py | Python | gpl-2.0 | 76,911 |
# -*- coding: utf-8 -*-
import datetime
import random
#from google.appengine.ext import db
from google.appengine.api import memcache
import gdata.calendar.service
"""
from django.utils import simplejson as json
from libs.BeautifulSoup import BeautifulSoup
from google.appengine.api import urlfetch
import xml.dom.mini... | freeflightsim/fg-flying-club | flying-club.appspot.com/app/fetch.py | Python | gpl-2.0 | 1,924 |
from django import template
from django.template import Node, NodeList
from django.utils.datastructures import SortedDict
register = template.Library()
#==========================
# -*- coding: utf-8 -*-
'''
A smarter {% if %} tag for django templates.
While retaining current Django functionality, it also handles e... | jantman/cobbler | web/cobbler_web/templatetags/site.py | Python | gpl-2.0 | 11,773 |
# Copyright 2002 by Andrew Dalke. All rights reserved.
# Revisions 2007-2009 copyright by Peter Cock. All rights reserved.
# Revisions 2008-2009 copyright by Cymon J. Cox. All rights reserved.
# This code is part of the Biopython distribution and governed by its
# license. Please see the LICENSE file that should ha... | updownlife/multipleK | dependencies/biopython-1.65/build/lib.linux-x86_64-2.7/BioSQL/BioSeq.py | Python | gpl-2.0 | 22,906 |
from sedot import SEDOT_BASE
import os
import time
import rfc822
class NoStatusError(Exception):
def __init__(self, package, timestamp=None):
self.value = package
self.package = package
self.timestamp = timestamp
def __str__(self):
print repr(self.value)
class SyncStatus:
def __init__(self, package, ti... | fajran/sedot | lib/python/sedot/status.py | Python | gpl-2.0 | 2,386 |
import sys
import traceback
import logging
from virttest import openvswitch
from virttest import versionable_class
from autotest.client.shared import error
from autotest.client.shared import utils
@error.context_aware
def run_load_module(test, params, env):
"""
Run basic test of OpenVSwitch driver.
"""
... | spiceqa/virt-test | openvswitch/tests/load_module.py | Python | gpl-2.0 | 1,478 |
# distbuild/proxy_event_source.py -- proxy for temporary event sources
#
# Copyright (C) 2012, 2014-2015 Codethink Limited
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; version 2 of the Li... | perryl/morph | distbuild/proxy_event_source.py | Python | gpl-2.0 | 1,324 |
## This file is part of Invenio.
## Copyright (C) 2011, 2012, 2013 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) any later versio... | Panos512/invenio | modules/webauthorlist/lib/authorlist_dblayer.py | Python | gpl-2.0 | 27,103 |
import os.path
from PyQt5.QtWidgets import QMessageBox
from PyQt5.QtGui import QIcon
from enki.core.core import core
class Plugin:
def __init__(self):
self._action = core.actionManager().addAction('mHelp/aVimTutor',
'Vim mode tutorial',
... | hlamer/enki | enki/plugins/vimtutor/__init__.py | Python | gpl-2.0 | 1,123 |
#!/usr/bin/python
import sys, os
from tools import benchmark, ipc
def main() :
if len(sys.argv) < 2 :
print >> sys.stderr, "No folder was specified!"
sys.exit(1)
if not os.path.exists( sys.argv[1] ) :
print >> sys.stderr, sys.argv[1], "not a valid path!"
sys.exit(1)
if not os.path.isdir( sys.argv[1] ... | miquelramirez/lwaptk-v2 | examples/fodet/heuristics/compute-batch.py | Python | gpl-3.0 | 1,113 |
# -*- test-case-name: mamba.test.test_decorators -*-
# Copyright (c) 2012 Oscar Campos <oscar.campos@member.fsf.org>
# See LICENSE for more details
"""
.. module:: decorators
:platform: Unix, Windows
:synopsys: Decorators
.. moduleauthor:: Oscar Campos <oscar.campos@member.fsf.org>
"""
import cPickle
import... | PyMamba/mamba-framework | mamba/core/decorators.py | Python | gpl-3.0 | 1,575 |
__author__ = 'zak'
import json
import uuid
import ast
import pprint
import datetime
from di_utils import *
from clatoolkit.models import LearningRecord,SocialRelationship
from xapi.statement.builder import socialmedia_builder, pretty_print_json
from xapi.statement.xapi_settings import xapi_settings
from xapi.oauth... | uts-cic/CLAtoolkit | clatoolkit_project/dataintegration/core/importer.py | Python | gpl-3.0 | 21,943 |
# $HeadURL$
__RCSID__ = "$Id$"
""" SystemLoggingDBCleaner erases records whose messageTime column
contains a time older than 'RemoveDate' days, where 'RemoveDate'
is an entry in the Configuration Service section of the agent.
"""
from DIRAC.Core.Base.AgentModule import AgentModule
from DIRAC import S_OK
... | marcelovilaca/DIRAC | FrameworkSystem/Agent/SystemLoggingDBCleaner.py | Python | gpl-3.0 | 1,703 |
# -*- coding: utf-8 -*-
# Resource object code
#
# Created: Thu May 2 15:49:03 2013
# by: The Resource Compiler for PyQt (Qt v5.0.2)
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore
qt_resource_data = b"\
\x00\x00\x36\xe2\
\x89\
\x50\x4e\x47\x0d\x0a\x1a\x0a\x00\x00\x00\x0d\x49\x... | baoboa/pyqt5 | examples/animation/animatedtiles/animatedtiles_rc.py | Python | gpl-3.0 | 399,281 |
# Authors:
# Rob Crittenden <rcritten@redhat.com>
#
# Copyright (C) 2010 Red Hat
# see file 'COPYING' for use and warranty information
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either... | encukou/freeipa | ipatests/test_xmlrpc/test_nesting.py | Python | gpl-3.0 | 7,396 |
from rezgui.qt import QtCore, QtGui
from rezgui.dialogs.ProcessDialog import ProcessDialog
from rezgui.objects.App import app
from rezgui.util import get_icon_widget, update_font, add_menu_action
from rez.utils.formatting import readable_time_duration
from functools import partial
import subprocess
import time
class ... | saddingtonbaynes/rez | src/rezgui/widgets/ToolWidget.py | Python | gpl-3.0 | 3,684 |
#! /usr/bin/env python
# -*- coding: utf-8 -*-
import portfolio
# NOTE: when using iterated search included, we must include the option
# "plan_counter=PLANCOUNTER"
CONFIGS = [
# alt_lazy_ff_cg
(49, ["--heuristic", "hff=ff(cost_type=H_COST_TYPE)",
"--heuristic", "hcg=cg(cost_type=H_COST_TYPE)"... | rock-planning/planning-fd_uniform | src/search/downward-seq-sat-fdss-1.py | Python | gpl-3.0 | 3,644 |
from __future__ import print_function, absolute_import
import czmq
from ._malamute_ctypes import MlmClient
try:
range = xrange
except NameError:
pass
class MalamuteError(Exception):
pass
def _list_to_zmsg(parts):
assert isinstance(parts, (list, tuple))
zmsg = czmq.Zmsg()
for p in parts:
... | lnls-dig/malamute | bindings/python/malamute/__init__.py | Python | mpl-2.0 | 2,772 |
import sys
from os.path import join, dirname
import mock
import pytest
sys.path.insert(0, join(dirname(__file__), "..", "..", ".."))
sauce = pytest.importorskip("wptrunner.browsers.sauce")
def test_sauceconnect_success():
with mock.patch.object(sauce.SauceConnect, "upload_prerun_exec"),\
mock.patch... | anthgur/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/browsers/test_sauce.py | Python | mpl-2.0 | 4,470 |
# Copyright (c) 2012 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.
import logging
import re
import os
import constants
from perf_tests_helper import PrintPerfResult
from pylib import pexpect
from test_result import Bas... | Yukarumya/Yukarum-Redfoxes | media/webrtc/trunk/build/android/pylib/test_package.py | Python | mpl-2.0 | 7,723 |
## MediaInfoDLL - All info about media files
# This software is provided 'as-is', without any express or implied
# warranty. In no event will the authors be held liable for any damages
# arising from the use of this software.
#
# Permission is granted to anyone to use this software for any purpose,
# including c... | michaelforfxhelp/master | third_party/MediaInfoLib/Source/Example/HowToUse_Dll3.py | Python | mpl-2.0 | 3,236 |
# -*- coding: utf-8 -*-
import datetime
from dateutil.relativedelta import relativedelta
from odoo import fields, tools
from odoo.addons.event.tests.common import TestEventCommon
from odoo.tools import mute_logger
class TestMailSchedule(TestEventCommon):
@mute_logger('odoo.addons.base.models.ir_model', 'odoo.m... | maxive/erp | addons/event/tests/test_mail_schedule.py | Python | agpl-3.0 | 3,876 |
# -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi, Guewen Baconnier
# Copyright 2012-2014 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Publi... | abstract-open-solutions/account-financial-tools | account_credit_control/policy.py | Python | agpl-3.0 | 17,427 |
from __future__ import unicode_literals
import json
from django.core.management.base import BaseCommand
from django.core.exceptions import ObjectDoesNotExist
from candidates.models import PartySet, OrganizationExtra
from popolo import models as popolo_models
from popolo.importers.popit import PopItImporter
from com... | mysociety/yournextmp-popit | candidates/management/commands/candidates_create_parties_from_json.py | Python | agpl-3.0 | 3,982 |
# -*- coding: utf-8 -*-
# (c) 2015 Alex Comba - Agile Business Group
# License AGPL-3 - See http://www.gnu.org/licenses/agpl-3.0.html
from openerp import models, fields
class PurchaseConfigSettings(models.TransientModel):
_inherit = 'purchase.config.settings'
group_use_product_description_per_po_line = fiel... | acsone/purchase-workflow | purchase_order_line_description/models/purchase_config_settings.py | Python | agpl-3.0 | 647 |
# -*- coding: utf-8 -*-
# Copyright 2015 Nicola Malcontenti - Agile Business Group
# Copyright 2016 Andrea Cometa - Apulia Software
# Copyright 2016 Lorenzo Battistini - Agile Business Group
# License LGPL-3.0 or later (http://www.gnu.org/licenses/lgpl.html).
from . import account_invoice, partner
| linkitspa/l10n-italy | account_invoice_report_ddt_group/models/__init__.py | Python | agpl-3.0 | 300 |
""" API v1 models. """
from itertools import groupby
import logging
from django.db import transaction
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from course_modes.models import CourseMode
log = logging.getLogger(__name__)
class Course(object):
""" Pseudo-course model use... | benpatterson/edx-platform | lms/djangoapps/commerce/api/v1/models.py | Python | agpl-3.0 | 3,535 |
import sys
from PySide2.QtCore import *
from PySide2.QtWidgets import *
class ListModel(QAbstractListModel):
def rowCount(self, parent = QModelIndex()):
return 0
app = QApplication([])
model = ListModel()
v = QListView()
v.setModel(model)
QTimer.singleShot(0, v.close)
app.exec_()
| gbaty/pyside2 | tests/QtWidgets/bug_430.py | Python | lgpl-2.1 | 295 |
##############################################################################
# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | TheTimmy/spack | var/spack/repos/builtin/packages/bash/package.py | Python | lgpl-2.1 | 1,917 |
from warnings import warn
from six import string_types, iteritems
from ..manipulation import delete_model_genes, undelete_model_genes
from ..manipulation.delete import find_gene_knockout_reactions
from ..solvers import solver_dict, get_solver_name
try:
import scipy
except ImportError:
moma = None
else:
fr... | aebrahim/cobrapy | cobra/flux_analysis/single_deletion.py | Python | lgpl-2.1 | 7,065 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2014 Mika Mäenpää <mika.j.maenpaa@tut.fi>,
# Tampere University of Technology
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License as published by
# the Free Software Foundation... | stefanklug/python-gitlab | gitlab/tests/test_gitlab.py | Python | lgpl-3.0 | 27,164 |
"""
=========================================================
Comparing different clustering algorithms on toy datasets
=========================================================
This example aims at showing characteristics of different
clustering algorithms on datasets that are "interesting"
but still in 2D. The last ... | seckcoder/lang-learn | python/sklearn/examples/cluster/plot_cluster_comparison.py | Python | unlicense | 4,259 |
#!/usr/bin/env python
"""This is a single binary demo program."""
import threading
# pylint: disable=unused-import,g-bad-import-order
from grr.lib import server_plugins
from grr.gui import admin_ui
# pylint: enable=unused-import,g-bad-import-order
from grr.client import client
from grr.gui import runtests
from grr... | MiniSEC/GRR_clone | tools/demo.py | Python | apache-2.0 | 1,990 |
from django.utils.timezone import now as timezone_now
from zerver.lib.actions import do_change_stream_invite_only, get_client
from zerver.lib.test_classes import ZulipTestCase
from zerver.models import Message, UserMessage, get_realm, get_stream
class TopicHistoryTest(ZulipTestCase):
def test_topics_history_zeph... | showell/zulip | zerver/tests/test_message_topics.py | Python | apache-2.0 | 10,110 |
# Copyright 2014 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 ag... | KaranToor/MA450 | google-cloud-sdk/lib/surface/compute/target_pools/create.py | Python | apache-2.0 | 7,175 |
import base64
import datetime
import json
import hashlib
import hmac
from urllib.parse import quote as urlencode
import jinja2
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.humanize.templatetags.humanize import intcomma
from django.contrib.staticfiles.storage import s... | Pinecast/pinecast | pinecast/jinja2_helper.py | Python | apache-2.0 | 6,927 |
# -*- coding: utf-8 -*-
import datetime as dt
import itertools
import logging
import re
import urlparse
import bson
import pytz
import itsdangerous
from modularodm import fields, Q
from modularodm.exceptions import NoResultsFound
from modularodm.exceptions import ValidationError, ValidationValueError
from modularodm.... | arpitar/osf.io | framework/auth/core.py | Python | apache-2.0 | 46,002 |
#!/usr/bin/env python
###############################################################################
# Copyright 2017 The Apollo Authors. 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 ... | msbeta/apollo | modules/tools/plot_control/plot_control.py | Python | apache-2.0 | 3,563 |
# Copyright 2016 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... | peterbraden/tensorflow | tensorflow/contrib/losses/python/losses/loss_ops.py | Python | apache-2.0 | 24,598 |
"""Support for the Environment Canada weather service."""
from datetime import datetime, timedelta
import logging
import re
from env_canada import ECData # pylint: disable=import-error
import voluptuous as vol
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import (
ATTR_ATTR... | tchellomello/home-assistant | homeassistant/components/environment_canada/sensor.py | Python | apache-2.0 | 4,749 |
"""Use serial protocol of Acer projector to obtain state of the projector."""
from __future__ import annotations
import logging
import re
from typing import Any
import serial
import voluptuous as vol
from homeassistant.components.switch import PLATFORM_SCHEMA, SwitchEntity
from homeassistant.const import (
CONF_... | jawilson/home-assistant | homeassistant/components/acer_projector/switch.py | Python | apache-2.0 | 4,513 |
# =============================================================================
# Copyright (c) 2016, Cisco Systems, Inc
# 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 sour... | kstaniek/csm | csmserver/schema/migrate_to_version_1.py | Python | apache-2.0 | 2,082 |
import threading
import pytest
from tornado import ioloop, web
from dummyserver.server import (
SocketServerThread,
run_tornado_app,
run_loop_in_thread,
DEFAULT_CERTS,
HAS_IPV6,
)
from dummyserver.handlers import TestingApp
from dummyserver.proxy import ProxyHandler
def consume_socket(sock, chun... | kawamon/hue | desktop/core/ext-py/urllib3-1.25.8/dummyserver/testcase.py | Python | apache-2.0 | 6,185 |
# 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 agreed to in writing, software
# distributed under t... | orbitfp7/horizon | openstack_dashboard/dashboards/project/data_processing/job_executions/tests.py | Python | apache-2.0 | 2,525 |
# Copyright 2014 Google Inc.
#
# 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 agreed to in writing, ... | quom/google-cloud-python | core/google/cloud/_testing.py | Python | apache-2.0 | 3,121 |
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not... | nathanielvarona/airflow | airflow/models/renderedtifields.py | Python | apache-2.0 | 7,099 |
#!/usr/bin/python2.4
#
# Copyright 2010 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 ... | groschovskiy/gsa-admin-toolkit | urlstats.py | Python | apache-2.0 | 8,994 |
import datetime
import sys
import threading
import rollbar
from django.conf import settings
from django.core.signals import request_finished
threadlocal = threading.local()
def process(queue):
if settings.DEBUG or settings.STAGING:
now = datetime.datetime.now()
print('Async tasks: {} to process'... | AlmostBetterNetwork/podmaster-host | pinecast/post_processing.py | Python | apache-2.0 | 1,349 |
# -*- coding: utf-8 -*-
from django.test import TestCase
from django.test.client import Client
from django.http import HttpRequest
from django.contrib.auth import SESSION_KEY
from tardis.tardis_portal.models import User
from tardis.tardis_portal.models import UserProfile
from tardis.tardis_portal.auth.interfaces impor... | pansapiens/mytardis | tardis/tardis_portal/tests/test_authservice.py | Python | bsd-3-clause | 6,778 |
# Copyright 2010 Google Inc.
#
# Permission is hereby granted, free of charge, to any person obtaining a
# copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish, dis-
# trib... | catapult-project/catapult | third_party/gsutil/gslib/vendored/boto/tests/integration/gs/test_resumable_downloads.py | Python | bsd-3-clause | 16,183 |
class DimensionalityError(ValueError):
"""
Raised when the number of dimensions do not match what was expected.
"""
pass
| karla3jo/menpo-old | menpo/exception.py | Python | bsd-3-clause | 137 |
from __future__ import print_function
__author__ = "John Kirkham <kirkhamj@janelia.hhmi.org>"
__date__ = "$Jul 30, 2014 19:35:11 EDT$"
import imp
import nose
import nose.plugins
import nose.plugins.attrib
import numpy
import scipy
import scipy.spatial
import scipy.spatial.distance
import scipy.stats
import nan... | DudLab/nanshe | tests/test_nanshe/test_imp/test_segment.py | Python | bsd-3-clause | 110,829 |
from itertools import chain
from nineml.user.component import Property, Component, Prototype, Definition
from nineml.exceptions import (
NineMLUsageError, NineMLNameError, name_error, NineMLUnitMismatchError)
from nineml.base import (
ContainerObject, DynamicPortsObject)
class Initial(Property):
"""
R... | INCF/lib9ML | nineml/user/dynamics.py | Python | bsd-3-clause | 10,378 |
#------------------------------------------------------------------------------
#
# Copyright (c) 2005, Enthought, Inc.
# All rights reserved.
#
# This software is provided without warranty under the terms of the BSD
# license included in enthought/LICENSE.txt and may be redistributed only
# under the conditions d... | geggo/pyface | pyface/ui/wx/action/status_bar_manager.py | Python | bsd-3-clause | 3,465 |
# Copyright 2020 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.
"""Utilities to process compresssed files."""
import contextlib
import logging
import os
import struct
import tempfile
import zipfile
@contextlib.contextm... | scheib/chromium | tools/binary_size/libsupersize/zip_util.py | Python | bsd-3-clause | 2,567 |
from __future__ import unicode_literals
from django.contrib.gis.geos import HAS_GEOS
from django.contrib.gis.tests.utils import no_oracle
from django.db import connection
from django.test import TestCase, skipUnlessDBFeature
from django.test.utils import override_settings
from django.utils import timezone
if HAS_GEOS... | sublime1809/django | django/contrib/gis/tests/relatedapp/tests.py | Python | bsd-3-clause | 15,405 |
##########################################################################
#
# Copyright (c) 2011-2012, John Haddon. All rights reserved.
# Copyright (c) 2011-2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted prov... | hradec/gaffer | python/GafferTest/ScriptNodeTest.py | Python | bsd-3-clause | 52,927 |
import os
import struct
import subprocess
import sys
from pkg_resources import resource_filename
from binascii import hexlify
from binascii import unhexlify
def find_binary(prefixes, name, args):
for prefix in prefixes:
try:
subprocess.call([os.path.join(prefix, name)] + args)
except O... | nivertech/bpftools | bpftools/utils.py | Python | bsd-3-clause | 5,334 |
from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Get-DomainComputer',
'Author': ['@harmj0y'],
'Description': ('Queries the domain for current computer objects. Part of PowerView.'),
'Background'... | bneg/Empire | lib/modules/powershell/situational_awareness/network/powerview/get_computer.py | Python | bsd-3-clause | 7,131 |
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed under the Apache License, Version 2.0 that
# can be found in the LICENSE file.
"""Manages subcommands in a script.
Each subcommand should look like this:
@usage('[pet name]')
def CMDpet(parser, args):
'''Prints a... | sgraham/nope | tools/swarming_client/third_party/depot_tools/subcommand.py | Python | bsd-3-clause | 8,534 |
"""
CI, but with that all important Docker twist
"""
| RickyCook/DockCI | dockci/__init__.py | Python | isc | 53 |
"""
Support for LimitlessLED bulbs.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/light.limitlessled/
"""
import logging
import voluptuous as vol
from homeassistant.const import (CONF_NAME, CONF_HOST, CONF_PORT, CONF_TYPE)
from homeassistant.componen... | srcLurker/home-assistant | homeassistant/components/light/limitlessled.py | Python | mit | 10,472 |
# EXAMPLE 1:
# ==============================================================================
print myreduce((lambda x, y: x * y), [1, 2, 3, 4])
print myreduce((lambda x, y: x / y), [1, 2, 3, 4])
# EXAMPLE 2:
# ==============================================================================
reduce(lambda x, y: x + y, [... | rolandovillca/python_introduction_basic | collections/reducer.py | Python | mit | 1,256 |
from asposewords import Settings
from com.aspose.words import Document
from com.aspose.words import SaveFormat
from java.io import ByteArrayOutputStream
from java.io import FileInputStream
from java.io import FileOutputStream
class LoadAndSaveToStream:
def __init__(self):
dataDir = Settings.dataDir + 'qu... | asposewords/Aspose_Words_Java | Plugins/Aspose_Words_Java_for_Jython/asposewords/quickstart/LoadAndSaveToStream.py | Python | mit | 1,194 |