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 |
|---|---|---|---|---|---|
"""
Generating and counting primes.
"""
from __future__ import print_function, division
import random
from bisect import bisect
# Using arrays for sieving instead of lists greatly reduces
# memory consumption
from array import array as _array
from sympy import Function, S
from sympy.core.compatibility import as_int,... | kaushik94/sympy | sympy/ntheory/generate.py | Python | bsd-3-clause | 28,626 |
import base64
import logging
import string
import warnings
from datetime import datetime, timedelta
from django.conf import settings
from django.contrib.sessions.exceptions import SuspiciousSession
from django.core import signing
from django.core.exceptions import SuspiciousOperation
from django.utils import timezone
... | wkschwartz/django | django/contrib/sessions/backends/base.py | Python | bsd-3-clause | 13,900 |
# -*- coding: utf-8 -*-
import os
CODE_DIR = os.path.dirname(os.path.dirname(os.path.realpath(__file__)))
def get_permdir():
return os.path.join(CODE_DIR, 'permdir')
def get_repo_root():
return get_permdir()
def get_tmpdir():
return os.path.join(CODE_DIR, 'tmpdir')
def init_permdir():
path = ge... | douban/code | vilya/libs/permdir.py | Python | bsd-3-clause | 407 |
from social_core.backends.upwork import UpworkOAuth
| cjltsod/python-social-auth | social/backends/upwork.py | Python | bsd-3-clause | 52 |
"""
This module collects helper functions and classes that "span" multiple levels
of MVC. In other words, these functions/classes introduce controlled coupling
for convenience's sake.
"""
import warnings
from django.template import loader, RequestContext
from django.template.context import _current_app_undefined
from... | doismellburning/django | django/shortcuts.py | Python | bsd-3-clause | 7,865 |
from settings import *
DATABASES = {
'default': {
'ENGINE': 'django.db.backends.mysql',
'NAME': 'denorm',
'HOST': 'localhost',
'USER': 'denorm',
'PASSWORD': 'denorm1',
}
}
| mjtamlyn/django-denorm | test_project/settings_mysql.py | Python | bsd-3-clause | 221 |
#!/usr/bin/env python
import argparse
import time
from pytx import ThreatIndicator
from pytx.vocabulary import ThreatExchange as te
from pytx.vocabulary import ThreatType as tt
from pytx.vocabulary import Types as t
def get_results(options):
'''
Builds a query string based on the specified options and runs ... | arirubinstein/ThreatExchange | scripts/get_compromised_credentials.py | Python | bsd-3-clause | 2,285 |
"""
kombu.transport.pyamqp
======================
pure python amqp transport.
"""
from __future__ import absolute_import
import amqp
from kombu.five import items
from kombu.utils.amq_manager import get_manager
from kombu.utils.text import version_string_as_tuple
from . import base
DEFAULT_PORT = 5672
DEFAULT_SSL_... | sunze/py_flask | venv/lib/python3.4/site-packages/kombu/transport/pyamqp.py | Python | mit | 5,008 |
#------------------------------------------------------------------------------
# pycparser: c_generator.py
#
# C code generator from pycparser AST nodes.
#
# Copyright (C) 2008-2012, Eli Bendersky
# License: BSD
#------------------------------------------------------------------------------
from . import c_ast
class... | bussiere/pypyjs | website/demo/home/rfk/repos/pypy/lib_pypy/cffi/_pycparser/c_generator.py | Python | mit | 13,798 |
# postgresql/pypostgresql.py
# Copyright (C) 2005-2020 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: postgresql+pypostgresql
:name: py-postgresql
:dba... | gltn/stdm | stdm/third_party/sqlalchemy/dialects/postgresql/pypostgresql.py | Python | gpl-2.0 | 2,915 |
# Copyright (C) 2007, One Laptop Per Child
#
# 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 version 3 of the License, or
# (at your option) any later version.
#
# This program is distrib... | AbrahmAB/sugar | src/jarabe/journal/__init__.py | Python | gpl-3.0 | 679 |
#!/usr/bin/python
# Copyright (c) 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.
"""Certificate chain with 1 intermediate and a non-self-signed trust anchor.
Verification should succeed, it doesn't matter that the ro... | geminy/aidear | oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/net/data/verify_certificate_chain_unittest/generate-unconstrained-non-self-signed-root.py | Python | gpl-3.0 | 1,019 |
"""
WSGI config for OIPA project.
This module contains the WSGI application used by Django's development server
and any production WSGI deployments. It should expose a module-level variable
named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover
this application via the ``WSGI_APPLICATION`` set... | schlos/OIPA-V2.1 | OIPA/OIPA/wsgi.py | Python | agpl-3.0 | 1,413 |
##############################################################################
# Copyright (c) 2013-2018, 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... | EmreAtes/spack | var/spack/repos/builtin/packages/psi4/package.py | Python | lgpl-2.1 | 4,596 |
#
# 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 us... | mrchristine/spark-examples-dbc | src/main/python/ml/index_to_string_example.py | Python | apache-2.0 | 1,615 |
# coding: utf-8
from __future__ import print_function, unicode_literals
import os
from boxsdk import Client
from boxsdk.exception import BoxAPIException
from boxsdk.object.collaboration import CollaborationRole
from auth import authenticate
def run_user_example(client):
# 'me' is a handy value to get info on the... | lkabongoVC/box-python-sdk | demo/example.py | Python | apache-2.0 | 10,222 |
"""
GeoJSON example using addItem
Python 2/3
ArcREST version 3.5.0
"""
from __future__ import print_function
import arcrest
if __name__ == "__main__":
username = ""
password = ""
geojsonFile = r""
sh = arcrest.AGOLTokenSecurityHandler(username, password)
admin = arcrest.manageorg.Administ... | Esri/ArcREST | samples/publishingGeoJSON.py | Python | apache-2.0 | 864 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('event_mapper', '0005_user_is_confirmed'),
]
operations = [
migrations.AlterField(
model_name='event',
... | MariaSolovyeva/watchkeeper | django_project/event_mapper/migrations/0006_auto_20150505_0922.py | Python | bsd-2-clause | 789 |
import datetime
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db import models
from django.http import Http404
from django.utils import timezone
from django.utils.functional import cached_property
from django.utils.translation import gettext as _
from django.views... | shacker/django | django/views/generic/dates.py | Python | bsd-3-clause | 25,251 |
from __future__ import absolute_import, print_function
import inspect
import logging
import raven
import sentry
from django.conf import settings
from django.db.utils import DatabaseError
from raven.contrib.django.client import DjangoClient
from . import metrics
UNSAFE_FILES = (
'sentry/event_manager.py',
's... | hongliang5623/sentry | src/sentry/utils/raven.py | Python | bsd-3-clause | 3,051 |
# Copyright 2012, Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can
# be found in the LICENSE file.
import os
import shlex
from subprocess import Popen, PIPE
import time
import unittest
import utils
class TestCase(unittest.TestCase):
@classmethod
def setenv(cl... | anusornc/vitess | test/framework.py | Python | bsd-3-clause | 2,552 |
# 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.
import os
import sys
import json
from command_executor import CommandExecutor
_THIS_DIR = os.path.abspath(os.path.dirname(__file__))
_PARENT_DIR = os.path.j... | chromium/chromium | chrome/test/chromedriver/client/websocket_connection.py | Python | bsd-3-clause | 1,471 |
from __future__ import absolute_import
import numpy
import chainer
from chainer import _backend
from chainer.backends import _cpu
from chainer.configuration import config
_ideep_version = None
_error = None
try:
import ideep4py as ideep # NOQA
from ideep4py import mdarray # type: ignore # NOQA
_ideep... | pfnet/chainer | chainer/backends/intel64.py | Python | mit | 5,920 |
""" color scheme source data """
schemes = {'classic': [(255, 237, 237),
(255, 224, 224),
(255, 209, 209),
(255, 193, 193),
(255, 176, 176),
(255, 159, 159),
(255, 142, 142),
(255, 126, 126),
(255, 110, 110),
... | ashmastaflash/IDCOAS | integration/heatmaps/heatmap/colorschemes.py | Python | gpl-2.0 | 33,688 |
#!/usr/bin/python
#
# GEOMTERY.OUT to OpenDX
#
# Created: April 2009 (AVK)
# Modified: February 2012 (AVK)
#
import math
import sys
def r3minv(a, b):
t1 = a[0][2] * (a[1][0] * a[2][1] - a[1][1] * a[2][0]) + \
a[0][1] * (a[1][2] * a[2][0] - a[1][0] * a[2][2]) + \
a[0][0] * (a[1][1] * a[2][2]... | rgvanwesep/exciting-plus-rgvw-mod | utilities/geometry2dx__mtrx.py | Python | gpl-3.0 | 20,319 |
#Copyright (C) 2014 Marc Herndon
#
#This program is free software; you can redistribute it and/or
#modify it under the terms of the GNU General Public License,
#version 2, as published by the Free Software Foundation.
#
#This program is distributed in the hope that it will be useful,
#but WITHOUT ANY WARRANTY; without ... | scith/htpc-manager_ynh | sources/libs/pySMART/attribute.py | Python | gpl-3.0 | 3,070 |
from .main import Sabnzbd
def start():
return Sabnzbd()
config = [{
'name': 'sabnzbd',
'groups': [
{
'tab': 'downloaders',
'list': 'download_providers',
'name': 'sabnzbd',
'label': 'Sabnzbd',
'description': 'Use <a href="http://sabnzbd.or... | jerbob92/CouchPotatoServer | couchpotato/core/downloaders/sabnzbd/__init__.py | Python | gpl-3.0 | 2,548 |
# -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2012 OpenERP S.A (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | poiesisconsulting/openerp-restaurant | portal/__openerp__.py | Python | agpl-3.0 | 2,288 |
"""
Unit tests for the asset upload endpoint.
"""
from datetime import datetime
from io import BytesIO
from pytz import UTC
import json
from django.conf import settings
from contentstore.tests.utils import CourseTestCase
from contentstore.views import assets
from contentstore.utils import reverse_course_url
from xmodul... | beni55/edx-platform | cms/djangoapps/contentstore/views/tests/test_assets.py | Python | agpl-3.0 | 15,204 |
# Copyright 2013 OpenStack Foundation.
# 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 req... | pnavarro/neutron | neutron/tests/unit/test_wsgi.py | Python | apache-2.0 | 26,842 |
# Copyright 2014, Rackspace, US, 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 w... | BiznetGIO/horizon | openstack_dashboard/api/rest/urls.py | Python | apache-2.0 | 1,231 |
# Copyright 2016 The TensorFlow 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 of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | hfp/tensorflow-xsmm | tensorflow/python/kernel_tests/conv_ops_3d_test.py | Python | apache-2.0 | 27,016 |
# Copyright 2014-2015 Canonical Limited.
#
# 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 ... | CanonicalBootStack/charm-hacluster | tests/charmhelpers/__init__.py | Python | apache-2.0 | 1,285 |
# 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 pathlib
import re
import shutil
import struct
import tempfil... | chromium/chromium | tools/binary_size/libsupersize/zip_util.py | Python | bsd-3-clause | 5,188 |
"""Individual test"""
import datetime
from django.test import TransactionTestCase
from django.contrib.auth.models import User
from apps.managers.player_mgr.models import Profile
from apps.utils import test_utils
from apps.managers.challenge_mgr.models import RoundSetting
class OverallPrizeTest(TransactionTestCase):... | vijayanandau/KnowledgeShare | makahiki/apps/widgets/prizes/tests/individual_prize_tests.py | Python | mit | 5,225 |
import requests
from django.utils.translation import ugettext as _
from allauth.socialaccount.providers.oauth2.views import (
OAuth2Adapter,
OAuth2CallbackView,
OAuth2LoginView,
)
from ..base import ProviderException
from .provider import DoubanProvider
class DoubanOAuth2Adapter(OAuth2Adapter):
pro... | okwow123/djangol2 | example/env/lib/python2.7/site-packages/allauth/socialaccount/providers/douban/views.py | Python | mit | 1,354 |
# Copyright (c) 2016--2017 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a cop... | ogajduse/spacewalk | backend/cdn_tools/manifest.py | Python | gpl-2.0 | 13,620 |
# ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 version 2
# of the License, or (at your option) any later version.
#
# This program is distrib... | Microvellum/Fluid-Designer | win64-vc/2.78/scripts/freestyle/styles/long_anisotropically_dense.py | Python | gpl-3.0 | 3,125 |
#!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible 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 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | hryamzik/ansible | lib/ansible/modules/network/nxos/nxos_install_os.py | Python | gpl-3.0 | 19,714 |
#
# Copyright (C) 1997-2016 JDE Developers Team
#
# 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 version 3 of the License, or
# (at your option) any later version.
#
# This program... | fqez/JdeRobot | src/libs/comm_py/comm/ice/navdataIceClient.py | Python | gpl-3.0 | 4,847 |
# -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from odoo import models, _
class EventRegistration(models.Model):
_inherit = 'event.registration'
def _get_lead_description_registration(self, prefix='', line_suffix=''):
"""Add the questions and answe... | ygol/odoo | addons/website_event_crm_questions/models/event_registration.py | Python | agpl-3.0 | 1,282 |
"""Support for monitoring the state of UpCloud servers."""
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import (
PLATFORM_SCHEMA, BinarySensorDevice)
import homeassistant.helpers.config_validation as cv
from . import CONF_SERVERS, DATA_UPCLOUD, UpCloudServerEntity
_LOGGER ... | molobrakos/home-assistant | homeassistant/components/upcloud/binary_sensor.py | Python | apache-2.0 | 896 |
# -*- coding: utf-8 -*-
#
# 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
#... | malmiron/incubator-airflow | airflow/contrib/operators/sagemaker_tuning_operator.py | Python | apache-2.0 | 4,191 |
"""Support for binary sensor using the PiFace Digital I/O module on a RPi."""
import logging
import voluptuous as vol
from homeassistant.components.binary_sensor import (
PLATFORM_SCHEMA, BinarySensorDevice)
from homeassistant.components import rpi_pfio
from homeassistant.const import CONF_NAME, DEVICE_DEFAULT_NA... | MartinHjelmare/home-assistant | homeassistant/components/rpi_pfio/binary_sensor.py | Python | apache-2.0 | 2,581 |
import sys
import os
from doctest import DocTestSuite, ELLIPSIS, NORMALIZE_WHITESPACE
SKIP_DIRS = (
# Skip modules which import and initialize stuff that require QApplication
'Orange/widgets',
'Orange/canvas',
# Skip because we don't want Orange.datasets as a module (yet)
'Orange/datasets/'
)
if ... | cheral/orange3 | Orange/tests/test_doctest.py | Python | bsd-2-clause | 2,448 |
#!/usr/bin/python2.4
# Copyright (c) 2006-2008 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.
'''Gatherer for administrative template files.
'''
import re
import types
from grit.gather import regexp
from grit import exc... | meego-tablet-ux/meego-app-browser | tools/grit/grit/gather/admin_template.py | Python | bsd-3-clause | 2,488 |
# class generated by DeVIDE::createDeVIDEModuleFromVTKObject
from module_kits.vtk_kit.mixins import SimpleVTKClassModuleBase
import vtk
class vtkSynchronizedTemplatesCutter3D(SimpleVTKClassModuleBase):
def __init__(self, module_manager):
SimpleVTKClassModuleBase.__init__(
self, module_manager,
... | nagyistoce/devide | modules/vtk_basic/vtkSynchronizedTemplatesCutter3D.py | Python | bsd-3-clause | 520 |
# Status: ported, except for --out-xml
# Base revision: 64488
#
# Copyright 2005 Dave Abrahams
# Copyright 2002, 2003, 2004, 2005, 2010 Vladimir Prus
# Distributed under the Boost Software License, Version 1.0.
# (See accompanying file LICENSE_1_0.txt or http://www.boost.org/LICENSE_1_0.txt)
# This module implements r... | m039/Void | third-party/void-boost/tools/build/src/tools/testing.py | Python | mit | 15,330 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.agent import agent
from lib.core.common import arrayizeValue
from lib.core.common import Backend
from lib.core.common import filterPairValues
from lib.core.commo... | golismero/golismero | tools/sqlmap/plugins/generic/search.py | Python | gpl-2.0 | 26,113 |
#!/usr/bin/env python
"""
Copyright (c) 2006-2013 sqlmap developers (http://sqlmap.org/)
See the file 'doc/COPYING' for copying permission
"""
from lib.core.enums import PRIORITY
__priority__ = PRIORITY.LOWEST
def dependencies():
pass
def tamper(payload, **kwargs):
"""
Replaces apostrophe character wit... | golismero/golismero | tools/sqlmap/tamper/apostrophenullencode.py | Python | gpl-2.0 | 503 |
# -*- coding: utf-8 -*-
"""
This script initializes the plugin, making it known to QGIS.
"""
def classFactory(iface):
from HelloWorld import HelloWorld
return HelloWorld(iface)
| qgis/QGIS-Django | qgis-app/plugins/tests/HelloWorld/2.3-full-changed-repository/HelloWorld/__init__.py | Python | gpl-2.0 | 183 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | anryko/ansible | lib/ansible/modules/cloud/google/gcp_redis_instance_info.py | Python | gpl-3.0 | 9,179 |
# coding=utf-8
"""Test for GIS utilities functions."""
import unittest
# noinspection PyUnresolvedReferences
import qgis # pylint: disable=unused-import
from qgis.core import QgsRectangle
from safe.definitions.constants import INASAFE_TEST
from safe.utilities.gis import (
is_polygon_layer,
is_raster_y_inve... | AIFDR/inasafe | safe/utilities/test/test_gis.py | Python | gpl-3.0 | 4,837 |
"""
Component-level Specification
This module is called component to mirror organization of storm package.
"""
from ..storm.component import Component
class Specification(object):
def __init__(self, component_cls, name=None, parallelism=1):
if not issubclass(component_cls, Component):
raise ... | hodgesds/streamparse | streamparse/dsl/component.py | Python | apache-2.0 | 976 |
# Copyright 2013 Josh Durgin
# Copyright 2013 Red Hat, 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-... | ntt-sic/nova | nova/tests/api/openstack/compute/contrib/test_volumes.py | Python | apache-2.0 | 32,169 |
# Copyright 2012 Nebula, 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 agree... | newrocknj/horizon | openstack_dashboard/dashboards/identity/projects/tests.py | Python | apache-2.0 | 82,571 |
# -*- coding: utf-8 -*-
#
# scikit-learn documentation build configuration file, created by
# sphinx-quickstart on Fri Jan 8 09:13:42 2010.
#
# This file is execfile()d with the current directory set to its containing
# dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
... | nhejazi/scikit-learn | doc/conf.py | Python | bsd-3-clause | 9,924 |
# Copyright 2021 The TensorFlow 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 of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | chromium/chromium | third_party/tflite_support/src/tensorflow_lite_support/python/task/core/task_utils.py | Python | bsd-3-clause | 1,839 |
# Copyright 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.
import base64
import hashlib
import os
import string
import win32api
import win32file
import win32com.client
from win32com.shell import shell, shellcon
impor... | ric2b/Vivaldi-browser | chromium/chrome/test/mini_installer/variable_expander.py | Python | bsd-3-clause | 17,079 |
"""
tests.components.automation.test_location
±±±~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Tests location automation.
"""
import unittest
from homeassistant.components import automation, zone
from tests.common import get_test_home_assistant
class TestAutomationZone(unittest.TestCase):
""" Test the event automatio... | toddeye/home-assistant | tests/components/automation/test_zone.py | Python | mit | 5,342 |
# Copyright (C) Ivan Kravets <me@ikravets.com>
# See LICENSE for details.
import argparse
import zipfile
from os import getcwd, listdir, makedirs, mkdir, rename
from os.path import isdir, isfile, join
from shutil import move, rmtree
from sys import exit as sys_exit
from sys import path
path.append("..")
from platfor... | mseroczynski/platformio | scripts/mbed_to_package.py | Python | mit | 3,667 |
'''tzinfo timezone information for GMT_minus_0.'''
from pytz.tzinfo import StaticTzInfo
from pytz.tzinfo import memorized_timedelta as timedelta
class GMT_minus_0(StaticTzInfo):
'''GMT_minus_0 timezone definition. See datetime.tzinfo for details'''
zone = 'GMT_minus_0'
_utcoffset = timedelta(seconds=0)
... | newvem/pytz | pytz/zoneinfo/GMT_minus_0.py | Python | mit | 367 |
# --------------------------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# --------------------------------------------------------------------... | yugangw-msft/azure-cli | src/azure-cli/azure/cli/command_modules/cdn/tests/latest/test_nodes_scenarios.py | Python | mit | 543 |
#!/usr/bin/python
#
# Copyright 2010, 2011 wkhtmltopdf authors
#
# This file is part of wkhtmltopdf.
#
# wkhtmltopdf 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, either version 3 of the License, or
#... | anouschka42/starktheatreprod | sites/all/libraries/wkhtmltopdf-0.12.0/scripts/sourcefix.py | Python | gpl-2.0 | 4,292 |
from __future__ import print_function, unicode_literals
from praw.internal import _to_reddit_list
from .helper import PRAWTest, betamax
class InternalTest(PRAWTest):
def test__to_reddit_list(self):
output = _to_reddit_list('hello')
self.assertEqual('hello', output)
def test__to_reddit_list_wi... | dmarx/praw | tests/test_internal.py | Python | gpl-3.0 | 1,261 |
"""
Telstra API platform for notify component.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/notify.telstra/
"""
import logging
import requests
import voluptuous as vol
from homeassistant.components.notify import (
BaseNotificationService, ATTR_TI... | MungoRae/home-assistant | homeassistant/components/notify/telstra.py | Python | apache-2.0 | 3,404 |
binomial_fit.coef() | madmax983/h2o-3 | h2o-docs/src/booklets/v2_2015/source/GLM_Vignette_code_examples/glm_model_output_20.py | Python | apache-2.0 | 19 |
#!/usr/bin/env python
import os
import sys
from macholib.MachOStandalone import MachOStandalone
from macholib.util import strip_files
def standaloneApp(path):
if not os.path.isdir(path) and os.path.exists(
os.path.join(path, 'Contents')):
raise SystemExit('%s: %s does not look like an app bun... | timeyyy/PyUpdater | pyupdater/vendor/PyInstaller/lib/macholib/macho_standalone.py | Python | bsd-2-clause | 718 |
# -*- coding: utf-8 -*-
# Unit tests for cache framework
# Uses whatever cache backend is set in the test settings file.
from __future__ import unicode_literals
import copy
import os
import re
import shutil
import tempfile
import threading
import time
import unittest
import warnings
from django.conf import settings
... | weiawe/django | tests/cache/tests.py | Python | bsd-3-clause | 85,300 |
from __future__ import absolute_import
from ..model import Model
from ..core.properties import (Any, Dict, String)
class ImageSource(Model):
""" A base class for all image source types. """
_args = ('url', 'extra_url_vars')
url = String(default="", help="""
tile service url (example: http://c.tile.op... | phobson/bokeh | bokeh/models/images.py | Python | bsd-3-clause | 617 |
#######################################################################
#
# Author: Malte Helmert (helmert@informatik.uni-freiburg.de)
# (C) Copyright 2003-2004 Malte Helmert
#
# This file is part of LAMA.
#
# LAMA is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public Li... | PlanTool/plantool | wrappingPlanners/Deterministic/LAMA/seq-sat-lama/lama/translate/pddl/pretty_print.py | Python | gpl-2.0 | 2,178 |
#!/usr/bin/env python
""" turtle-example-suite:
xtx_lindenmayer_indian.py
Each morning women in Tamil Nadu, in southern
India, place designs, created by using rice
flour and known as kolam on the thresholds of
their homes.
These can be described by Lindenmayer systems,
which can easily be implemented w... | teeple/pns_server | work/install/Python-2.7.4/Demo/turtle/tdemo_lindenmayer_indian.py | Python | gpl-2.0 | 2,432 |
# encoding: utf-8
import datetime
from south.db import db
from south.v2 import DataMigration
from django.db import models
class Migration(DataMigration):
def forwards(self, orm):
objs = orm.ProjectApplication.objects
apps = objs.filter(chain__chained_project=None).order_by(
'chain', '-... | grnet/synnefo | snf-astakos-app/astakos/im/migrations/old/0043_uninitialized_projects.py | Python | gpl-3.0 | 25,194 |
#!/usr/bin/python
# This file is part of Ansible
#
# Ansible 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 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... | wimnat/ansible-modules-core | cloud/amazon/ec2.py | Python | gpl-3.0 | 61,472 |
# Copyright (C) 2006-2013 Music Technology Group - Universitat Pompeu Fabra
#
# This file is part of Essentia
#
# Essentia is free software: you can redistribute it and/or modify it under
# the terms of the GNU Affero General Public License as published by the Free
# Software Foundation (FSF), either version 3 of the ... | GiantSteps/essentia | src/examples/python/streaming_extractor/level.py | Python | agpl-3.0 | 4,852 |
# 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 agreed to in... | HybridF5/nova | nova/tests/unit/virt/test_block_device.py | Python | apache-2.0 | 45,741 |
# Copyright (c) 2014 VMware, 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 requir... | zhimin711/nova | nova/tests/unit/virt/vmwareapi/test_network_util.py | Python | apache-2.0 | 9,191 |
#!/usr/bin/env python
"""
@package ion.agents.platform.rsn.simulator.oms_values
@file ion/agents/platform/rsn/simulator/oms_values.py
@author Carlos Rueda
@brief Platform attribute value generators for the RSN OMS simulator.
"""
__author__ = 'Carlos Rueda'
__license__ = 'Apache 2.0'
import time
import ntplib
... | janeen666/mi-instrument | mi/platform/rsn/simulator/oms_values.py | Python | bsd-2-clause | 7,128 |
# Copyright 2019 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... | scheib/chromium | third_party/pyjson5/src/tests/host_test.py | Python | bsd-3-clause | 1,346 |
from django.db.backends.ddl_references import Statement, Table
from django.db.models import F, Q
from django.db.models.constraints import BaseConstraint
from django.db.models.sql import Query
__all__ = ['ExclusionConstraint']
class ExclusionConstraint(BaseConstraint):
template = 'CONSTRAINT %(name)s EXCLUDE USIN... | kaedroho/django | django/contrib/postgres/constraints.py | Python | bsd-3-clause | 4,221 |
from __future__ import absolute_import
import time
class KafkaMetric(object):
# NOTE java constructor takes a lock instance
def __init__(self, metric_name, measurable, config):
if not metric_name:
raise ValueError('metric_name must be non-empty')
if not measurable:
rai... | OpenBankProject/OBP-Kafka-Python | lib/kafka/metrics/kafka_metric.py | Python | agpl-3.0 | 933 |
"""
Help has buttons and menu items to open help, blog and forum pages in your primary browser.
"""
from __future__ import absolute_import
#Init has to be imported first because it has code to workaround the python bug where relative imports don't work if the module is imported as a main module.
import __init__
from... | nophead/Skeinforge50plus | skeinforge_application/skeinforge_utilities/skeinforge_help.py | Python | agpl-3.0 | 3,508 |
#!/usr/bin/env python
# Copyright (c) 2006-2007 XenSource, Inc.
#
# Permission to use, copy, modify, and distribute this software for any
# purpose with or without fee is hereby granted, provided that the above
# copyright notice and this permission notice appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND ... | anoobs/xen-api | scripts/examples/python/vm_start_async.py | Python | lgpl-2.1 | 2,335 |
#!/usr/bin/python
# Copyright (c)2011-2014 the Boeing Company.
# See the LICENSE file included in this distribution.
#
# author: Jeff Ahrenholz <jeffrey.m.ahrenholz@boeing.com>
#
'''
wlanemanetests.py - This script tests the performance of the WLAN device in
CORE by measuring various metrics:
- delay experienced w... | D3f0/coreemu | daemon/examples/netns/wlanemanetests.py | Python | bsd-2-clause | 33,033 |
"""Testing the pytest fixtures themselves which are declared in conftest.py."""
import pytest
import responses
import requests
from requests.exceptions import ConnectionError
from olympia.access.models import Group
def test_admin_group(admin_group):
assert Group.objects.count() == 1
admin_group = Group.obje... | aviarypl/mozilla-l10n-addons-server | src/olympia/amo/tests/test_pytest_fixtures.py | Python | bsd-3-clause | 955 |
#!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | anryko/ansible | lib/ansible/modules/cloud/google/gcp_sql_user_info.py | Python | gpl-3.0 | 6,527 |
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | tux-00/ansible | lib/ansible/module_utils/netconf.py | Python | gpl-3.0 | 3,772 |
# -*- coding: utf-8 -*-
##################################################################################
#
# Copyright (c) 2005-2006 Axelor SARL. (http://www.axelor.com)
# and 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# $Id: hr.py 4656 2006-11-24 09:58:42Z Cyp $
#
# This program is free software: you can redistri... | ncliam/serverpos | openerp/addons/hr_holidays/hr_holidays.py | Python | agpl-3.0 | 34,256 |
# Copyright (c) 2017 Keith Ito
""" from https://github.com/keithito/tacotron """
'''
Defines the set of symbols used in text input to the model.
The default is a set of ASCII characters that works well for English or text that has been run through Unidecode. For other data, you can modify _characters. See TRAINING_DA... | mlperf/inference_results_v0.7 | open/Inspur/code/rnnt/tensorrt/preprocessing/parts/text/symbols.py | Python | apache-2.0 | 749 |
# Copyright 2014 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.
# pylint: disable=W0401,W0614
from telemetry import story
from telemetry.page import page as page_module
from telemetry.page import shared_page_state
clas... | HalCanary/skia-hc | tools/skp/page_sets/skia_espn_desktop.py | Python | bsd-3-clause | 1,170 |
import dataclasses
from typing import ClassVar, Dict, List, Set, Tuple, Type
from collections import OrderedDict
@dataclasses.dataclass
class A:
a: List[int] = <error descr="Mutable default '[]' is not allowed. Use 'default_factory'">[]</error>
b: List[int] = <error descr="Mutable default 'list()' is not allo... | siosio/intellij-community | python/testData/inspections/PyDataclassInspection/defaultFieldValue.py | Python | apache-2.0 | 1,215 |
# Copyright 2014 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.
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class BigJsPageSet(page_set_module.PageSet):
""" Sit... | markYoungH/chromium.src | tools/perf/page_sets/big_js.py | Python | bsd-3-clause | 935 |
# coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | annatisch/autorest | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/BodyFormData/autorestswaggerbatformdataservice/operations/formdata_operations.py | Python | mit | 5,590 |
# testing/mock.py
# Copyright (C) 2005-2016 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Import stub for mock library.
NOTE: copied/adapted from SQLAlchemy master f... | pcu4dros/pandora-core | workspace/lib/python3.5/site-packages/alembic/testing/mock.py | Python | mit | 791 |
# -*- coding: utf-8 -*-
#
# Copyright (C) 2007-2010 Edgewall Software
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution. The terms
# are also available at http://genshi.edgewall.org/wiki/License.
#
# This software consist... | mitchellrj/genshi | genshi/filters/tests/i18n.py | Python | bsd-3-clause | 89,114 |
# Import the SlideSet base class
import math
from ..slidesets import RemarkSlideSet
##
# A special set of slides for creating cover page and contents
class MergeCoverSet(RemarkSlideSet):
##
# Extract the valid parameters for this object
@staticmethod
def validParams():
params = RemarkSlideSet.validParams(... | danielru/moose | python/PresentationBuilder/slidesets/MergeCoverSet.py | Python | lgpl-2.1 | 1,395 |
#!/usr/bin/python
# This script generates a list of testsuites that should be run as part of
# the Samba 4 test suite.
# The output of this script is parsed by selftest.pl, which then decides
# which of the tests to actually run. It will, for example, skip all tests
# listed in selftest/skip or only run a subset durin... | Zentyal/samba | selftest/selftesthelpers.py | Python | gpl-3.0 | 6,229 |
# Copyright (c) 2006-2010 LOGILAB S.A. (Paris, FRANCE).
# http://www.logilab.fr/ -- mailto:contact@logilab.fr
#
# 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 version 2 of the License, o... | michalliu/chromium-depot_tools | third_party/pylint/checkers/typecheck.py | Python | bsd-3-clause | 16,288 |
# -*- coding: utf-8 -*-
""" Python API for language and translation management. """
from collections import namedtuple
from django.conf import settings
from django.utils.translation import ugettext as _
from dark_lang.models import DarkLangConfig
# Named tuples can be referenced using object-like variable
# deferen... | louyihua/edx-platform | common/djangoapps/lang_pref/api.py | Python | agpl-3.0 | 1,986 |
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at https://mozilla.org/MPL/2.0/.
import os
from wptrunner.update.base import Step, StepRunner
from wptrunner.update.update import LoadConfig, SyncFromU... | UK992/servo | tests/wpt/update/update.py | Python | mpl-2.0 | 1,349 |