repo_name stringlengths 5 100 | path stringlengths 4 294 | copies stringclasses 990
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
xadahiya/django | django/contrib/gis/gdal/feature.py | 439 | 4153 | from django.contrib.gis.gdal.base import GDALBase
from django.contrib.gis.gdal.error import GDALException, OGRIndexError
from django.contrib.gis.gdal.field import Field
from django.contrib.gis.gdal.geometries import OGRGeometry, OGRGeomType
from django.contrib.gis.gdal.prototypes import ds as capi, geom as geom_api
fro... | bsd-3-clause |
zinsword/p2pool | SOAPpy/Errors.py | 294 | 3002 | """
################################################################################
#
# SOAPpy - Cayce Ullman (cayce@actzero.com)
# Brian Matthews (blm@actzero.com)
# Gregory Warnes (Gregory.R.Warnes@Pfizer.com)
# Christopher Blunck (blunck@gst.com)
#
##########################... | gpl-3.0 |
MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.4/Lib/test/test_long.py | 10 | 18747 | from test.test_support import verify, verbose, TestFailed, fcmp
from string import join
from random import random, randint
# SHIFT should match the value in longintrepr.h for best testing.
SHIFT = 15
BASE = 2 ** SHIFT
MASK = BASE - 1
KARATSUBA_CUTOFF = 70 # from longobject.c
# Max number of base BASE digits to use ... | mit |
lpramuk/robottelo | tests/foreman/cli/test_gpgkey.py | 1 | 40852 | # -*- encoding: utf-8 -*-
"""Test class for GPG Key CLI
:Requirement: Gpgkey
:CaseAutomation: Automated
:CaseLevel: Component
:CaseComponent: GPGKeys
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
from tempfile import mkstemp
from fauxfactory import gen_alphanumeric
from fauxfactory import gen_ch... | gpl-3.0 |
fhoring/autorest | src/generator/AutoRest.Python.Tests/Expected/AcceptanceTests/ModelFlattening/autorestresourceflatteningtestservice/models/base_product.py | 8 | 1269 | # 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 ... | mit |
aforalee/keystone | keystone/tests/unit/common/test_ldap.py | 7 | 22334 | # -*- coding: utf-8 -*-
# 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, softwa... | apache-2.0 |
YYWen0o0/python-frame-django | tests/check_framework/tests.py | 10 | 11670 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.utils.six import StringIO
import sys
from django.apps import apps
from django.conf import settings
from django.core import checks
from django.core.checks import Error, Warning
from django.core.checks.registry import CheckRegistry
from django.... | bsd-3-clause |
hrishioa/Navo | Raspi-Code/Lib/venv/lib/python2.7/site-packages/pip/_vendor/progress/spinner.py | 404 | 1341 | # -*- coding: utf-8 -*-
# Copyright (c) 2012 Giorgos Verigakis <verigak@gmail.com>
#
# 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 P... | gpl-2.0 |
Matt-Deacalion/django | tests/model_formsets_regress/tests.py | 173 | 20725 | from __future__ import unicode_literals
from django import forms
from django.forms.formsets import DELETION_FIELD_NAME, BaseFormSet
from django.forms.models import (
BaseModelFormSet, inlineformset_factory, modelform_factory,
modelformset_factory,
)
from django.forms.utils import ErrorDict, ErrorList
from djan... | bsd-3-clause |
muellni/vupradio_os | support/scripts/gen-manual-lists.py | 65 | 20516 | ## gen-manual-lists.py
##
## This script generates the following Buildroot manual appendices:
## - the package tables (one for the target, the other for host tools);
## - the deprecated items.
##
## Author(s):
## - Samuel Martin <s.martin49@gmail.com>
##
## Copyright (C) 2013 Samuel Martin
##
## This program is free... | gpl-2.0 |
oscarolar/odoo | addons/hr_timesheet_invoice/report/report_analytic.py | 299 | 5164 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the... | agpl-3.0 |
ISeaTeL/ISeaTeL_Cup_Site | users/views.py | 1 | 1367 | from django.shortcuts import render, redirect
from users.forms import *
from django.contrib.auth import authenticate, login, logout
# Create your views here.
def create(request):
if request.method == 'POST':
user_form = UserCreationForm(request.POST)
if user_form.is_valid():
user = user... | mit |
gxx/lettuce | tests/integration/lib/Django-1.3/tests/regressiontests/many_to_one_regress/tests.py | 92 | 4466 | from django.db import models
from django.test import TestCase
from models import First, Second, Third, Parent, Child, Category, Record, Relation
class ManyToOneRegressionTests(TestCase):
def test_object_creation(self):
Third.objects.create(id='3', name='An example')
parent = Parent(name='fred')
... | gpl-3.0 |
wavemind/gcb17ml | tools/verify.py | 1 | 62911 | # Copyright 2013 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 ... | apache-2.0 |
appleseedhq/gaffer | python/GafferTest/TypedPlugTest.py | 1 | 6995 | ##########################################################################
#
# 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... | bsd-3-clause |
nomnombtc/bitcoin | qa/rpc-tests/walletbackup.py | 85 | 7304 | #!/usr/bin/env python3
# Copyright (c) 2014-2016 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""
Exercise the wallet backup code. Ported from walletbackup.sh.
Test case is:
4 nodes. 1 2 and 3 send... | mit |
tylertian/Openstack | openstack F/cinder/cinder/volume/netapp.py | 2 | 54122 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2012 NetApp, Inc.
# Copyright (c) 2012 OpenStack LLC.
# 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... | apache-2.0 |
GabrielFortin/ansible-module-f5bigip | library/f5bigip_ltm_snat.py | 2 | 5863 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2016-2018, Eric Jacob <erjac77@gmail.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENS... | apache-2.0 |
Edraak/edx-platform | common/djangoapps/util/module_utils.py | 106 | 1387 | """
Utility library containing operations used/shared by multiple courseware modules
"""
def yield_dynamic_descriptor_descendants(descriptor, user_id, module_creator): # pylint: disable=invalid-name
"""
This returns all of the descendants of a descriptor. If the descriptor
has dynamic children, the modul... | agpl-3.0 |
NazarethCollege/heweb2017-devops-presentation | sites/tweetheat/src/backend/vendor/src/github.com/youtube/vitess/test/vtgate_gateway_flavor/discoverygateway.py | 4 | 1256 | #!/usr/bin/env python
# Copyright 2017 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... | mit |
daenamkim/ansible | lib/ansible/modules/cloud/rackspace/rax_mon_notification_plan.py | 29 | 5674 | #!/usr/bin/python
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | gpl-3.0 |
MattFaus/CrowdTube-Connector | lib/gdata-2.0.18/src/atom/http_interface.py | 15 | 5182 | #!/usr/bin/python
#
# Copyright (C) 2008 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 ... | mit |
NikosAlexandris/landsat8_metadata | landsat8_metadata.py | 1 | 8942 | #!/usr/bin/python\<nl>\
# -*- coding: utf-8 -*-
"""
@author nik |
"""
import sys
from collections import namedtuple
# globals
MTLFILE = ''
DUMMY_MAPCALC_STRING_RADIANCE = 'Radiance'
DUMMY_MAPCALC_STRING_DN = 'DigitalNumber'
# helper functions
def set_mtlfile():
"""
Set user defined MTL file, if any
""... | gpl-3.0 |
xuxiao19910803/edx-platform | common/lib/xmodule/xmodule/abtest_module.py | 86 | 5331 | import random
import logging
from lxml import etree
from xmodule.x_module import XModule
from xmodule.raw_module import RawDescriptor
from xmodule.xml_module import XmlDescriptor
from xmodule.exceptions import InvalidDefinitionError
from xblock.fields import String, Scope, Dict
DEFAULT = "_DEFAULT_GROUP"
log = logg... | agpl-3.0 |
zoyahav/incubator-airflow | airflow/contrib/operators/spark_submit_operator.py | 17 | 5471 | # -*- coding: utf-8 -*-
#
# 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
... | apache-2.0 |
waltharius/NewsBlur | utils/mongo_raw_log_middleware.py | 9 | 4434 | from django.core.exceptions import MiddlewareNotUsed
from django.conf import settings
from django.db import connection
from pymongo.mongo_client import MongoClient
from pymongo.mongo_replica_set_client import MongoReplicaSetClient
from time import time
import struct
import bson
from bson.errors import InvalidBSON
clas... | mit |
dhruvsrivastava/flask | flask/json.py | 140 | 8458 | # -*- coding: utf-8 -*-
"""
flask.jsonimpl
~~~~~~~~~~~~~~
Implementation helpers for the JSON support in Flask.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import io
import uuid
from datetime import date
from .globals import current_app, request
from ._... | bsd-3-clause |
commonlisp/kubernetes | hack/lookup_pull.py | 368 | 1319 | #!/usr/bin/env python
# Copyright 2015 The Kubernetes 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
#
# Unle... | apache-2.0 |
denfromufa/PTVS | Python/Product/Django/Templates/Projects/StarterDjangoProject/app-tests.py | 17 | 1082 | """
This file demonstrates writing tests using the unittest module. These will pass
when you run "manage.py test".
"""
import django
from django.test import TestCase
# TODO: Configure your database in settings.py and sync before running tests.
class ViewTest(TestCase):
"""Tests for the application vie... | apache-2.0 |
cianfrocco-lab/cryoem-cloud-tools | awslib/awsdatatransfer.py | 2 | 3723 | import math
import subprocess
import sys
import os
from fabric.api import env,run,hide,settings
#====================
def exec_remote_cmd(cmd):
from fabric.operations import run, put
from fabric.api import hide,settings
with hide('output','running','warnings') and settings(warn_only=True):
return r... | mit |
rahushen/ansible | lib/ansible/modules/network/aci/aci_interface_policy_leaf_policy_group.py | 14 | 18369 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Bruno Calogero <brunocalogero@hotmail.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_... | gpl-3.0 |
wkerzendorf/tardis | tardis/tests/test_lte_plasma.py | 5 | 2734 | from tardis import atomic
from astropy import constants
import numpy as np
import pytest
atom_data = atomic.AtomData.from_hdf5(atomic.default_atom_h5_path)
atom_data.prepare_atom_data(selected_atomic_numbers=[14])
pytestmark = pytest.mark.skipif(True, reason='to be implemented')
@pytest.mark.xskip
class TestNormalLT... | bsd-3-clause |
agiliq/django | django/db/migrations/graph.py | 5 | 6578 | from __future__ import unicode_literals
from django.db.migrations.state import ProjectState
from django.utils.datastructures import OrderedSet
class MigrationGraph(object):
"""
Represents the digraph of all migrations in a project.
Each migration is a node, and each dependency is an edge. There are
... | bsd-3-clause |
ScreamingUdder/mantid | qt/applications/workbench/workbench/plugins/jupyterconsole.py | 1 | 2648 | # This file is part of the mantid workbench.
#
# Copyright (C) 2017 mantidproject
#
# 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 yo... | gpl-3.0 |
robovm/robovm-studio | python/lib/Lib/site-packages/django/contrib/sessions/middleware.py | 323 | 1888 | import time
from django.conf import settings
from django.utils.cache import patch_vary_headers
from django.utils.http import cookie_date
from django.utils.importlib import import_module
class SessionMiddleware(object):
def process_request(self, request):
engine = import_module(settings.SESSION_ENGINE)
... | apache-2.0 |
drawks/ansible | lib/ansible/modules/cloud/opennebula/one_image.py | 52 | 11657 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
"""
(c) 2018, Milan Ilic <milani@nordeus.com>
This file is part of Ansible
Ansible is free software: you can redistribute it and/or modify
it under the ter... | gpl-3.0 |
acsone/odoo | addons/website_sale_delivery/controllers/main.py | 124 | 1551 | # -*- coding: utf-8 -*-
import openerp
from openerp import http
from openerp.http import request
import openerp.addons.website_sale.controllers.main
class website_sale(openerp.addons.website_sale.controllers.main.website_sale):
@http.route(['/shop/payment'], type='http', auth="public", website=True)
def paym... | agpl-3.0 |
ostash/qt-creator-i18n-uk | share/qtcreator/dumper/dumper.py | 2 | 64286 | import sys
import base64
import __builtin__
import os
import tempfile
# Fails on Windows.
try:
import curses.ascii
def printableChar(ucs):
if curses.ascii.isprint(ucs):
return ucs
return '?'
except:
def printableChar(ucs):
if ucs >= 32 and ucs <= 126:
return ... | lgpl-2.1 |
arpith/zulip | analytics/management/commands/active_user_stats.py | 22 | 2987 | from __future__ import absolute_import
from __future__ import print_function
from django.core.management.base import BaseCommand
from typing import Any
from zerver.models import UserPresence, UserActivity
from zerver.lib.utils import statsd, statsd_key
from datetime import datetime, timedelta
from collections import... | apache-2.0 |
dimagi/tablib | tablib/packages/yaml/__init__.py | 112 | 9273 |
from error import *
from tokens import *
from events import *
from nodes import *
from loader import *
from dumper import *
__version__ = '3.09'
try:
from cyaml import *
__with_libyaml__ = True
except ImportError:
__with_libyaml__ = False
def scan(stream, Loader=Loader):
"""
Scan a YAML stream... | mit |
baugp/ds4drv | ds4drv/backends/hidraw.py | 3 | 5327 | import fcntl
import itertools
import os
from io import FileIO
from time import sleep
from evdev import InputDevice
from pyudev import Context, Monitor
from ..backend import Backend
from ..exceptions import DeviceError
from ..device import DS4Device
from ..utils import zero_copy_slice
IOC_RW = 3221243904
HIDIOCSFEA... | mit |
levelrf/level_basestation | gnuradio-core/src/python/gnuradio/gr/hier_block2.py | 1 | 4444 | #
# Copyright 2006,2007 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# any later version... | gpl-3.0 |
caio2k/RIDE | src/robotide/controller/tablecontrollers.py | 2 | 15236 | # Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 l... | apache-2.0 |
arne-cl/turian-parser | scripts/run-management/eda/analyze-errors.py | 1 | 7780 | #!/usr/bin/python
#
#######################################################################
#
#
# analyze-errors.py
#
# USAGE: ./analyze-errors.py devel|train < treefile.parsed
#
# Given a postprocessed treebank, create a breakdown of PARSEVAL scores
# by constituent type, sorted by those type with the largest ... | gpl-2.0 |
sjolicoeur/Annelia | annelia/monkey_staticserve.py | 1 | 3539 | # original taken from http://www.cherrypy.org/browser/trunk/cherrypy/lib/static.py?format=txt
try:
from io import UnsupportedOperation
except ImportError:
UnsupportedOperation = object()
import logging
import mimetypes
mimetypes.init()
mimetypes.types_map['.dwg']='image/x-dwg'
mimetypes.types_map['.ico']='imag... | apache-2.0 |
avoinsystems/odoo | openerp/addons/base/tests/test_res_config.py | 398 | 3532 | import unittest2
import openerp
import openerp.tests.common as common
class test_res_config(common.TransactionCase):
def setUp(self):
super(test_res_config, self).setUp()
self.res_config = self.registry('res.config.settings')
# Define the test values
self.menu_xml_id = 'base.menu... | agpl-3.0 |
mKeRix/home-assistant | homeassistant/components/ads/sensor.py | 7 | 2424 | """Support for ADS sensors."""
import logging
import voluptuous as vol
from homeassistant.components import ads
from homeassistant.components.sensor import PLATFORM_SCHEMA
from homeassistant.const import CONF_NAME, CONF_UNIT_OF_MEASUREMENT
import homeassistant.helpers.config_validation as cv
from . import CONF_ADS_F... | mit |
dfang/odoo | odoo/addons/test_new_api/tests/test_new_fields.py | 4 | 29972 | #
# test cases for new-style fields
#
from datetime import date, datetime
from odoo.exceptions import AccessError, except_orm
from odoo.tests import common
from odoo.tools import mute_logger
class TestFields(common.TransactionCase):
def test_00_basics(self):
""" test accessing new fields """
# f... | agpl-3.0 |
nijel/translate | translate/lang/test_am.py | 2 | 1119 | from translate.lang import factory
def test_punctranslate():
"""Tests that we can translate punctuation."""
language = factory.getlanguage("am")
assert language.punctranslate("") == ""
assert language.punctranslate("abc efg") == "abc efg"
assert language.punctranslate("abc efg.") == "abc efg።"
... | gpl-2.0 |
krisys/django | django/contrib/gis/forms/fields.py | 504 | 4316 | from __future__ import unicode_literals
from django import forms
from django.contrib.gis.geos import GEOSException, GEOSGeometry
from django.utils.translation import ugettext_lazy as _
from .widgets import OpenLayersWidget
class GeometryField(forms.Field):
"""
This is the basic form field for a Geometry. A... | bsd-3-clause |
ray-project/ray | python/ray/util/sgd/torch/examples/benchmarks/horovod_benchmark_apex.py | 3 | 3976 | from __future__ import print_function
import argparse
import torch.backends.cudnn as cudnn
import torch.nn.functional as F
import torch.optim as optim
import torch.utils.data.distributed
from torchvision import models
import horovod.torch as hvd
import timeit
import numpy as np
# Apex
from apex import amp
# Benchmark... | apache-2.0 |
LLNL/spack | var/spack/repos/builtin/packages/r-rtracklayer/package.py | 5 | 2885 | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class RRtracklayer(RPackage):
"""R interface to genome annotation files and the UCSC genome brow... | lgpl-2.1 |
brandonPurvis/osf.io | scripts/find_nested_projects.py | 64 | 1517 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Helper to get a list of all projects that are nested within another project."""
from website.project.model import Node
from modularodm import Q
from tests.base import OsfTestCase
from tests.factories import ProjectFactory
def find_nested_projects():
return Node.f... | apache-2.0 |
alexmorozov/django | django/core/serializers/pyyaml.py | 439 | 2843 | """
YAML serializer.
Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
"""
import collections
import decimal
import sys
from io import StringIO
import yaml
from django.core.serializers.base import DeserializationError
from django.core.serializers.python import (
Deserializer as PythonDes... | bsd-3-clause |
klusta-team/kwiklib | kwiklib/utils/logger.py | 1 | 5194 | """Logger utility classes and functions."""
# -----------------------------------------------------------------------------
# Imports
# -----------------------------------------------------------------------------
import os
import sys
import logging
import traceback
# ------------------------------------------------... | bsd-3-clause |
kawamon/hue | desktop/core/ext-py/pytest-4.6.11/testing/test_pdb.py | 3 | 38942 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import os
import sys
import six
import _pytest._code
import pytest
from _pytest.debugging import _validate_usepdb_cls
try:
breakpoint
except NameError:
SUPPORTS_BREAKPOINT_BUI... | apache-2.0 |
HiroIshikawa/21playground | payblog/blog/lib/python3.5/site-packages/pip/_vendor/requests/packages/chardet/sjisprober.py | 1777 | 3764 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... | mit |
luzheqi1987/nova-annotation | nova/tests/unit/objects/test_objects.py | 1 | 49027 | # Copyright 2013 IBM Corp.
#
# 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... | apache-2.0 |
l5h5t7/ZeroNet | src/Content/ContentDbDict.py | 2 | 4495 | import time
import os
import ContentDb
class ContentDbDict(dict):
def __init__(self, site, *args, **kwargs):
s = time.time()
self.site = site
self.cached_keys = []
self.log = self.site.log
self.db = ContentDb.getContentDb()
self.db_id = self.db.needSite(site)
... | gpl-2.0 |
giorgiop/scipy | scipy/linalg/_solvers.py | 26 | 10144 | """Matrix equation solver routines"""
# Author: Jeffrey Armstrong <jeff@approximatrix.com>
# February 24, 2012
# Modified: Chad Fulton <ChadFulton@gmail.com>
# June 19, 2014
from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.linalg import inv, LinAlgError
from .basic imp... | bsd-3-clause |
Microvellum/Fluid-Designer | win64-vc/2.78/python/lib/test/test_import/__init__.py | 4 | 42690 | # We import importlib *ASAP* in order to test #15386
import importlib
import importlib.util
from importlib._bootstrap_external import _get_sourcefile
import builtins
import marshal
import os
import platform
import py_compile
import random
import stat
import sys
import unittest
import unittest.mock as mock
import textwr... | gpl-3.0 |
anthonysandrin/kafka-utils | kafka_utils/kafka_check/commands/min_isr.py | 1 | 3568 | # -*- coding: utf-8 -*-
# Copyright 2016 Yelp 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 ... | apache-2.0 |
MaryanMorel/faker | faker/providers/address/pt_BR/__init__.py | 15 | 17254 | # coding=utf-8
from __future__ import unicode_literals
from .. import Provider as AddressProvider
class Provider(AddressProvider):
city_suffixes = (
'do Sul', 'do Norte', 'de Minas', 'do Campo', 'Grande', 'da Serra', 'do Oeste', 'de Goiás', 'Paulista',
'da Mata', 'Alegre', 'da Praia', 'das Flores'... | mit |
wuvcen/shadowsocks | shadowsocks/crypto/sodium.py | 1032 | 3778 | #!/usr/bin/env python
#
# Copyright 2015 clowwindy
#
# 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 ... | apache-2.0 |
pyannote/pyannote-generators | pyannote/generators/_version.py | 2 | 15789 |
# This file helps to compute a version number in source trees obtained from
# git-archive tarball (such as those provided by githubs download-from-tag
# feature). Distribution tarballs (built by setup.py sdist) and build
# directories (produced by setup.py build) will contain a much shorter file
# that just contains t... | mit |
yangsensen/Crawler | X500/bs4/tests/test_lxml.py | 273 | 2965 | """Tests to ensure that the lxml tree builder generates good trees."""
import re
import warnings
try:
import lxml.etree
LXML_PRESENT = True
LXML_VERSION = lxml.etree.LXML_VERSION
except ImportError, e:
LXML_PRESENT = False
LXML_VERSION = (0,)
if LXML_PRESENT:
from bs4.builder import LXMLTreeB... | gpl-2.0 |
mmatyas/servo | tests/wpt/web-platform-tests/old-tests/webdriver/command_contexts/open_and_close_window_test.py | 141 | 2529 | import os
import sys
import random
import unittest
sys.path.insert(1, os.path.abspath(os.path.join(__file__, "../..")))
import base_test
repo_root = os.path.abspath(os.path.join(__file__, "../../.."))
sys.path.insert(1, os.path.join(repo_root, "tools", "webdriver"))
from webdriver import exceptions
class OpenAndCl... | mpl-2.0 |
Anonymous-X6/django | tests/custom_lookups/tests.py | 177 | 22547 | from __future__ import unicode_literals
import contextlib
import time
import unittest
from datetime import date, datetime
from django.core.exceptions import FieldError
from django.db import connection, models
from django.test import TestCase, override_settings
from django.utils import timezone
from .models import Au... | bsd-3-clause |
valkyriesavage/gasustainability | django/contrib/auth/tests/permissions.py | 231 | 1654 | try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.contrib.auth.management import create_permissions
from django.contrib.auth import models as auth_models
from django.contrib.contenttypes import models as contenttypes_models
from django.core.management import call... | bsd-3-clause |
MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-2.5/Lib/plat-sunos5/STROPTS.py | 9 | 36364 | # Generated by h2py from /usr/include/sys/stropts.h
# Included from sys/feature_tests.h
# Included from sys/isa_defs.h
_CHAR_ALIGNMENT = 1
_SHORT_ALIGNMENT = 2
_INT_ALIGNMENT = 4
_LONG_ALIGNMENT = 8
_LONG_LONG_ALIGNMENT = 8
_DOUBLE_ALIGNMENT = 8
_LONG_DOUBLE_ALIGNMENT = 16
_POINTER_ALIGNMENT = 8
_MAX_ALIGNMENT = 16
_... | mit |
MagicDevTeam/android_external_skia | tools/svndiff.py | 18 | 13076 | #!/usr/bin/python
'''
Copyright 2012 Google Inc.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
'''
'''
Generates a visual diff of all pending changes in the local SVN (or git!)
checkout.
Launch with --help to see more information.
TODO(epoger): Now that this tool ... | bsd-3-clause |
jrichte43/ProjectEuler | Problem-0089/solutions.py | 1 | 1879 |
__problem_title__ = "Roman numerals"
__problem_url___ = "https://projecteuler.net/problem=89"
__problem_description__ = "For a number written in Roman numerals to be considered valid there " \
"are basic rules which must be followed. Even though the rules allow " \
"... | gpl-3.0 |
BruceDai/crosswalk-test-suite | webapi/tct-csp-w3c-tests/csp-py/csp_script-src_self_unsafe-inline.py | 30 | 3347 | def main(request, response):
import simplejson as json
f = file('config.json')
source = f.read()
s = json.JSONDecoder().decode(source)
url1 = "http://" + s['host'] + ":" + str(s['ports']['http'][1])
url2 = "http://" + s['host'] + ":" + str(s['ports']['http'][0])
_CSP = "script-src 'self' 'un... | bsd-3-clause |
XuanyuZhao1984/MeanJS_train1 | node_modules/gulp-sass/node_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/common.py | 1292 | 20063 | # Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from __future__ import with_statement
import collections
import errno
import filecmp
import os.path
import re
import tempfile
import sys
# A minimal memoizing d... | mit |
joannadiong/biosig | biosig/readin.py | 1 | 3033 | import os
import numpy as np
import warnings
def read_data(file, channels={}):
"""
Read in data from a data text file.
Data from each channel are stored in columns. Values are tab-separated.
The function requires a dictionary of channel keys and values to be specified.
Channel columns are zero-ind... | gpl-3.0 |
xiandiancloud/edxplaltfom-xusong | cms/djangoapps/contentstore/tests/test_import_draft_order.py | 13 | 2584 | from xmodule.modulestore.xml_importer import import_from_xml
from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase
from xmodule.modulestore.django import modulestore
# This test is in the CMS module because the test configuration to use a draft
# modulestore is dependent on django.
class DraftReorde... | agpl-3.0 |
JuanbingTeam/djangobbs | djangobbs/accounts/views.py | 1 | 3219 | #!/usr/bin/env python
#coding=utf-8
from django.shortcuts import render_to_response
from django.contrib.auth.decorators import login_required
from django.contrib.auth.models import User
from django.http import HttpResponse, HttpResponseRedirect
from django.contrib import auth
from django.core.mail import sen... | apache-2.0 |
davidsminor/cortex | test/IECore/AttributeStateTest.py | 12 | 2719 | ##########################################################################
#
# Copyright (c) 2008-2011, 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:
#
# * Redis... | bsd-3-clause |
phobson/statsmodels | statsmodels/emplike/elanova.py | 26 | 3734 | """
This script contains empirical likelihood ANOVA.
Currently the script only contains one feature that allows the user to compare
means of multiple groups
General References
------------------
Owen, A. B. (2001). Empirical Likelihood. Chapman and Hall.
"""
from __future__ import division
from statsmodels.compat.p... | bsd-3-clause |
lllucius/climacast | aniso8601/interval.py | 5 | 5596 | # -*- coding: utf-8 -*-
# Copyright (c) 2016, Brandon Nielsen
# All rights reserved.
#
# This software may be modified and distributed under the terms
# of the BSD license. See the LICENSE file for details.
from datetime import datetime
from aniso8601.duration import parse_duration
from aniso8601.time import parse_d... | agpl-3.0 |
qedi-r/home-assistant | homeassistant/components/unifi/__init__.py | 2 | 4420 | """Support for devices connected to UniFi POE."""
import voluptuous as vol
from homeassistant.const import CONF_HOST
from homeassistant.core import callback
from homeassistant.helpers.device_registry import CONNECTION_NETWORK_MAC
import homeassistant.helpers.config_validation as cv
from .config_flow import get_contr... | apache-2.0 |
Stefanos19/prpy | src/prpy/planning/openrave.py | 1 | 6066 | #!/usr/bin/env python
# Copyright (c) 2013, Carnegie Mellon University
# All rights reserved.
# Authors: Siddhartha Srinivasa <siddh@cs.cmu.edu>
# Michael Koval <mkoval@cs.cmu.edu>
# Pras Velagapudi <mkoval@cs.cmu.edu>
#
# Redistribution and use in source and binary forms, with or without
# modificat... | bsd-3-clause |
Ritsyy/fjord | vendor/src/html5lib-python/html5lib/tests/tokenizertotree.py | 4 | 1965 | from __future__ import absolute_import, division, unicode_literals
import sys
import os
import json
import re
import html5lib
from . import support
from . import test_tokenizer
p = html5lib.HTMLParser()
unnamespaceExpected = re.compile(r'^(\|\s*)<html ([^>]+)>', re.M).sub
def main(out_path):
if not os.path.ex... | bsd-3-clause |
fernandog/Sick-Beard | cherrypy/lib/caching.py | 35 | 15405 | import datetime
import threading
import time
import cherrypy
from cherrypy.lib import cptools, httputil
class Cache(object):
def get(self):
raise NotImplemented
def put(self, obj, size):
raise NotImplemented
def delete(self):
raise NotImplemented
... | gpl-3.0 |
hanks-zyh/PythonBlog | www/models.py | 1 | 1467 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
__author__ = 'Hanks'
'model 对应的数据库中的表'
import time, uuid
from orm import Model, StringField, BooleanField, FloatField, TextField
def next_id():
return '%015d%s000' % (int(time.time() * 1000), uuid.uuid4().hex)
class User(Model):
__table__ = 'users'
id = ... | apache-2.0 |
timopulkkinen/BubbleFish | build/mac/find_sdk.py | 67 | 2958 | #!/usr/bin/env python
# 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 os
import re
import subprocess
import sys
"""Prints the lowest locally available SDK version greater than or equal to a
giv... | bsd-3-clause |
trishnaguha/ansible | lib/ansible/plugins/action/net_linkagg.py | 648 | 1057 | # (c) 2017, Ansible Inc,
#
# 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 di... | gpl-3.0 |
jmesteve/openerp | openerp/addons/mrp/res_config.py | 44 | 4545 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | agpl-3.0 |
hirokiky/matcha | tests/test_make_wsgi_app.py | 1 | 1141 | import pytest
@pytest.fixture
def target():
from matcha import make_wsgi_app
return make_wsgi_app
def dummy_case(environ, start_response):
return environ, start_response
def dummy_matching(environ):
return dummy_case, 'dummy_matched_dict'
def dummy_not_matched_app(environ, start_response):
r... | mit |
jnovinger/django | django/conf/locale/ru/formats.py | 1059 | 1267 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j E Y г.'
TIME_FORMAT = 'G:i'
DAT... | bsd-3-clause |
m-chichikalov/iot-manager-demo | python/sensor/la.py | 2 | 2579 | # iotManager
# load avg sensor
import json
import threading
# import os
frame = "STEEL" # BLACK_METAL METAL SHINY_METAL BRASS STEEL CHROME GOLD ANTHRACITE TILTED_GRAY TILTED_BLACK GLOSSY_METAL
color = "RAITH" # RED GREEN BLUE ORANGE YELLOW CYAN MAGENTA WHITE GRAY BLACK RAITH GREEN_LCD JUG_GREEN
bgColor = "CARBON" #... | mit |
zubair-arbi/edx-platform | lms/djangoapps/instructor/views/api_urls.py | 4 | 7259 | """
Instructor API endpoint urls.
"""
from django.conf.urls import patterns, url
urlpatterns = patterns(
'',
url(r'^students_update_enrollment$',
'instructor.views.api.students_update_enrollment', name="students_update_enrollment"),
url(r'^register_and_enroll_students$',
'instructor.views... | agpl-3.0 |
ColdMatter/EDMSuite | EDMScripts/OldScripts/JoesLazyMapThreadLoop.py | 1 | 1075 | # MapLoop - asks ScanMaster to make a series of scans with one of the pg
# parameters incremented scan to scan
from DAQ.Environment import *
def mapLoop(numScans):
# setup
fileSystem = Environs.FileSystem
file = \
fileSystem.GetDataDirectory(\
fileSystem.Paths["scanMasterDataPath"])\
+ fileSystem.Generate... | mit |
abartlet/samba | third_party/dnspython/dns/rdtypes/nsbase.py | 100 | 2994 | # Copyright (C) 2003-2007, 2009-2011 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation 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 "... | gpl-3.0 |
wreckJ/intellij-community | python/lib/Lib/site-packages/django/core/management/commands/shell.py | 230 | 3263 | import os
from django.core.management.base import NoArgsCommand
from optparse import make_option
class Command(NoArgsCommand):
option_list = NoArgsCommand.option_list + (
make_option('--plain', action='store_true', dest='plain',
help='Tells Django to use plain Python, not IPython.'),
)
... | apache-2.0 |
vovojh/gem5 | src/arch/x86/isa/insts/system/segmentation.py | 25 | 7202 | # Copyright (c) 2007 The Hewlett-Packard Development Company
# Copyright (c) 2012-2013 AMD
# 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 rel... | bsd-3-clause |
RajatGoyal/frontera | docs/source/conf.py | 6 | 8732 | # -*- coding: utf-8 -*-
#
# frontera documentation build configuration file, created by
# sphinx-quickstart on Tue Nov 18 17:54:50 2014.
#
# 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.
#
# ... | bsd-3-clause |
fxfitz/ansible | lib/ansible/plugins/connection/__init__.py | 17 | 12283 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
# (c) 2015 Toshio Kuratomi <tkuratomi@ansible.com>
# (c) 2017, Peter Sprygada <psprygad@redhat.com>
# (c) 2017 Ansible Project
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import fcntl
import gettext
import os
import ... | gpl-3.0 |
cbentes/texta | utils/gensim_wrapper/masked_word2vec.py | 2 | 5449 | # TODO: gensim license
import numpy as np
from six import string_types
import gensim
class MaskedWord2Vec(object):
def __init__(self,word2vec_model):
self.model = word2vec_model
self.vocab = word2vec_model.wv.vocab
def most_similar(self, positive=[], negative=[], topn=10, ignored_idxes=[... | gpl-3.0 |
Weihonghao/ECM | Vpy34/lib/python3.5/site-packages/tensorflow/python/ops/rnn_cell.py | 16 | 34198 | # Copyright 2015 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... | agpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.