repo_name stringlengths 5 100 | path stringlengths 4 375 | copies stringclasses 991
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
vdloo/jobrunner | flows/builtin/tests/unit/helpers/capabilities/test_port_is_free.py | 1 | 3668 | from uuid import uuid4
from mock import Mock, call
from tests.testcase import TestCase
from flows.builtin.helpers.capabilities import port_is_free, set_cached_port_is_free, \
reset_cached_port_is_free_timestamp
class TestPortIsFree(TestCase):
def setUp(self):
self.time = self.set_up_patch(
... | apache-2.0 |
caisq/tensorflow | tensorflow/python/util/tf_inspect.py | 9 | 11486 | # Copyright 2017 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... | apache-2.0 |
QISKit/qiskit-sdk-py | test/python/transpiler/test_passmanager.py | 1 | 4748 | # -*- coding: utf-8 -*-
# This code is part of Qiskit.
#
# (C) Copyright IBM 2017, 2018.
#
# This code is licensed under the Apache License, Version 2.0. You may
# obtain a copy of this license in the LICENSE.txt file in the root directory
# of this source tree or at http://www.apache.org/licenses/LICENSE-2.0.
#
# Any... | apache-2.0 |
nagyistoce/edx-platform | common/djangoapps/student/migrations/0039_auto__del_courseregistrationcode.py | 114 | 13511 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'CourseRegistrationCode'
db.delete_table('student_courseregistrationcode')
def backwa... | agpl-3.0 |
jf-parent/brome | brome/runner/virtualbox_instance.py | 2 | 8797 | from time import sleep
import subprocess
import paramiko
import netifaces as ni
from brome.runner.base_instance import BaseInstance
class VirtualboxInstance(BaseInstance):
"""Virtual box instance
Attributes:
runner (object)
browser_config (object)
index (int)
Kwargs:
vb... | mit |
izapolsk/integration_tests | cfme/tests/containers/test_cockpit.py | 1 | 2437 | import pytest
from cfme import test_requirements
from cfme.containers.provider import ContainersProvider
from cfme.markers.env_markers.provider import providers
from cfme.utils.appliance.implementations.ui import navigate_to
from cfme.utils.providers import ProviderFilter
from cfme.utils.wait import wait_for
pytestm... | gpl-2.0 |
alazyer/oscar | frobshop/oscar/apps/customer/migrations/0003_auto__add_productalert.py | 16 | 19453 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from oscar.core.compat import AUTH_USER_MODEL, AUTH_USER_MODEL_NAME
class Migration(SchemaMigration):
depends_on = (
('catalogue', '0001_initial'),
)
def forwards(self, orm... | gpl-2.0 |
earshel/PokeyPySnipe | POGOProtos/Settings/MapSettings_pb2.py | 16 | 4773 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: POGOProtos/Settings/MapSettings.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf imp... | mit |
gushedaoren/django-rest-auth | rest_auth/django_test_urls.py | 35 | 4671 | # Moved in Django 1.8 from django to tests/auth_tests/urls.py
from django.conf.urls import include, url
from django.contrib import admin
from django.contrib.auth import views
from django.contrib.auth.decorators import login_required
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.urls... | mit |
lyndonChen/eonboard | eoncloud_web/cloud/network_task.py | 1 | 18827 | #-*-coding=utf-8-*-
import datetime
import logging
import time
from django.conf import settings
from celery import app
from cloud_utils import create_rc_by_network,\
create_rc_by_subnet, create_rc_by_router,\
create_rc_by_floating, create_rc_by_security, \
... | apache-2.0 |
NeCTAR-RC/nova | nova/db/sqlalchemy/api.py | 1 | 252255 | # Copyright (c) 2011 X.commerce, a business unit of eBay Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file... | apache-2.0 |
tkdchen/Nitrate | src/tcms/core/views/search.py | 2 | 1377 | # -*- coding: utf-8 -*-
import re
from django.urls import reverse
from django.http import HttpResponseRedirect
from django.views.decorators.http import require_GET
from django.http import Http404
from tcms.testplans.models import TestPlan
from tcms.testcases.models import TestCase
from tcms.testruns.models import Te... | gpl-2.0 |
michhar/flask-webapp-aml | env/Lib/site-packages/werkzeug/test.py | 36 | 34131 | # -*- coding: utf-8 -*-
"""
werkzeug.test
~~~~~~~~~~~~~
This module implements a client to WSGI applications for testing.
:copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import sys
import mimetypes
from time import time
from... | mit |
LIS/lis-tempest | setup.py | 334 | 1028 | # Copyright (c) 2013 Hewlett-Packard Development Company, L.P.
#
# 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... | apache-2.0 |
ojengwa/migrate | ibu/backends/messages.py | 2 | 2183 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
# Levels
DEBUG = 10
INFO = 20
WARNING = 30
ERROR = 40
CRITICAL = 50
class CheckMessage(object):
def __init__(self, level, msg, hint=None, obj=None, id=None):
assert isinstance(level, int), "The first argument should be level."
self... | mit |
MAPC/cedac | cedac/wsgi.py | 1 | 1132 | """
WSGI config for cedac 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`` se... | bsd-3-clause |
firmlyjin/brython | www/tests/unittests/test/make_ssl_certs.py | 89 | 1886 | """Make the custom certificate and private key files used by test_ssl
and friends."""
import os
import sys
import tempfile
from subprocess import *
req_template = """
[req]
distinguished_name = req_distinguished_name
x509_extensions = req_x509_extensions
prompt = no
[re... | bsd-3-clause |
oaastest/azure-linux-extensions | OSPatching/test/check.py | 8 | 1497 | #!/usr/bin/python
#
# OSPatching extension
#
# Copyright 2014 Microsoft Corporation
#
# 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 |
hahalml/newfies-dialer | newfies/dialer_gateway/models.py | 7 | 5615 | #
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# 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 http://mozilla.org/MPL/2.0/.
#
# Copyright (C) 2011-2012 Star2Billing S.L.
#
# The Init... | mpl-2.0 |
DARKPOP/external_chromium_org | native_client_sdk/src/tools/create_html.py | 52 | 5938 | #!/usr/bin/env python
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Creates simple HTML for running a NaCl module.
This script is designed to make the process of creating running
Native Client ex... | bsd-3-clause |
0x726d77/storm | storm-client/src/py/storm/DistributedRPCInvocations.py | 20 | 26118 | #!/usr/bin/env python
#
# 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
# "... | apache-2.0 |
nikhilprathapani/python-for-android | python-modules/zope/zope/interface/tests/test_sorting.py | 50 | 1398 | ##############################################################################
#
# Copyright (c) 2001, 2002 Zope Foundation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# TH... | apache-2.0 |
jkthompson/nupic | py/regions/ImageSensorFilters/GaborFilter.py | 2 | 63268 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | gpl-3.0 |
kustodian/ansible | lib/ansible/modules/network/f5/bigip_profile_http.py | 23 | 61362 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, F5 Networks Inc.
# 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',
... | gpl-3.0 |
leeseulstack/openstack | neutron/tests/unit/ml2/drivers/brocade/test_brocade_mechanism_driver.py | 8 | 3928 | # Copyright (c) 2013 OpenStack Foundation
#
# 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 ... | apache-2.0 |
jonsmirl/buildroot | support/scripts/kconfiglib.py | 87 | 137745 | # This is Kconfiglib, a Python library for scripting, debugging, and extracting
# information from Kconfig-based configuration systems. To view the
# documentation, run
#
# $ pydoc kconfiglib
#
# or, if you prefer HTML,
#
# $ pydoc -w kconfiglib
#
# The examples/ subdirectory contains examples, to be run with e.g.
#
... | gpl-2.0 |
jeffwen/self_driving_car_nd | term1/finding_lane_lines/color_region.py | 1 | 2321 | import matplotlib.pyplot as plt
import matplotlib.image as mpimg
import numpy as np
# Read in the image and print out some stats
# Note: in the previous example we were reading a .jpg
# Here we read a .png and convert to 0,255 bytescale
image = mpimg.imread('test.jpg')
# Grab the x and y size and make a copy of the ... | mit |
hainm/mdtraj | mdtraj/geometry/tests/test_drid.py | 6 | 2295 | from __future__ import print_function
import numpy as np
import mdtraj as md
from mdtraj.testing import get_fn, eq
from mdtraj.geometry import compute_drid
import scipy.special
from scipy.stats import nanmean
from scipy.spatial.distance import euclidean, pdist, squareform
def test_drid_1():
n_frames = 1
n_ato... | lgpl-2.1 |
android-ia/platform_external_chromium_org | ppapi/cpp/documentation/doxy_cleanup.py | 173 | 4455 | #!/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.
'''This utility cleans up the html files as emitted by doxygen so
that they are suitable for publication on a Google documentation ... | bsd-3-clause |
channing/gyp | test/mac/gyptest-postbuild-fail.py | 84 | 1594 | #!/usr/bin/env python
# Copyright (c) 2011 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.
"""
Verifies that a failing postbuild step lets the build fail.
"""
import TestGyp
import sys
if sys.platform == 'darwin':
# set |match... | bsd-3-clause |
nonZero/demos-python | src/examples/short/ftp/ftp_rmdir.py | 1 | 1098 | #!/usr/bin/python3
#
# imports #
#
import ftplib # for FTP
import sys # for argv
import os.path # for join
#
# parameters #
#
# want debugging?
p_debug = False
#
# functions #
#
def ftp_rmdir(ftp, folder, remove_toplevel, dontremove):
for filename, attr in ftp.mlsd(folder):
if attr['type'] == 'file'... | gpl-3.0 |
Jimmy-Morzaria/scikit-learn | benchmarks/bench_plot_ward.py | 290 | 1260 | """
Benchmark scikit-learn's Ward implement compared to SciPy's
"""
import time
import numpy as np
from scipy.cluster import hierarchy
import pylab as pl
from sklearn.cluster import AgglomerativeClustering
ward = AgglomerativeClustering(n_clusters=3, linkage='ward')
n_samples = np.logspace(.5, 3, 9)
n_features = n... | bsd-3-clause |
cpennington/edx-platform | common/djangoapps/third_party_auth/migrations/0023_auto_20190418_2033.py | 5 | 1506 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.20 on 2019-04-18 20:33
import django.db.models.deletion
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('organizations', '0006_auto_20171207_0259'),
('third_party_auth', '0022_auto_20181012_0307... | agpl-3.0 |
ygormutti/VSSP | vssp.py | 1 | 8524 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from __future__ import print_function
import struct
import socket
import os
import threading
import time
DEBUG = False
T_REQ = 0
T_END = 1 << 14
T_ETC = 2 << 14
T_DAT = 3 << 14
T_REQ_OPEN_A = T_REQ
T_REQ_OPEN_B = 1 + T_REQ
T_REQ_OK = 2 + T_REQ
T_REQ_DENIED = 3 + T_... | gpl-2.0 |
shawnadelic/shuup | shuup/admin/modules/service_providers/__init__.py | 2 | 2054 | # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
from django.utils.translation impo... | agpl-3.0 |
stamhe/bitcoin | test/functional/interface_bitcoin_cli.py | 10 | 4065 | #!/usr/bin/env python3
# Copyright (c) 2017 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test bitcoin-cli"""
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util ... | mit |
Jgarcia-IAS/SITE | addons/gamification/tests/__init__.py | 124 | 1043 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2013 OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GN... | agpl-3.0 |
BenKeyFSI/poedit | deps/boost/libs/python/test/slice.py | 40 | 1798 | # Copyright David Abrahams 2004. Distributed under the Boost
# Software License, Version 1.0. (See accompanying
# file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
"""
>>> from slice_ext import *
>>> accept_slice(slice(1, None, (1,2)))
1
>>> try:
... accept_slice(list((1,2)))
... print "test... | mit |
vmendez/DIRAC | StorageManagementSystem/DB/StorageManagementDB.py | 3 | 56401 | """ StorageManagementDB is a front end to the Stager Database.
There are five tables in the StorageManagementDB: Tasks, CacheReplicas, TaskReplicas, StageRequests.
The Tasks table is the place holder for the tasks that have requested files to be staged.
These can be from different systems and have differe... | gpl-3.0 |
splice/splice-server | dev_setup.py | 1 | 7847 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright © 2012 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this soft... | gpl-2.0 |
NikNitro/Python-iBeacon-Scan | sympy/polys/tests/test_heuristicgcd.py | 126 | 3554 | from sympy.polys.rings import ring
from sympy.polys.domains import ZZ
from sympy.polys.heuristicgcd import heugcd
def test_heugcd_univariate_integers():
R, x = ring("x", ZZ)
f = x**4 + 8*x**3 + 21*x**2 + 22*x + 8
g = x**3 + 6*x**2 + 11*x + 6
h = x**2 + 3*x + 2
cff = x**2 + 5*x + 4
cfg = x + ... | gpl-3.0 |
spasovski/zamboni | apps/devhub/tests/test_views_perf.py | 7 | 2325 | # -*- coding: utf8 -*-
import json
from mock import patch
from nose.tools import eq_
from addons.models import Addon
from amo.urlresolvers import reverse
import amo.tests
from files.models import Platform
class TestPerfViews(amo.tests.TestCase):
fixtures = ['base/apps', 'base/users', 'base/platforms',
... | bsd-3-clause |
bastik/youtube-dl | youtube_dl/extractor/nova.py | 114 | 7044 | # encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
clean_html,
unified_strdate,
)
class NovaIE(InfoExtractor):
IE_DESC = 'TN.cz, Prásk.tv, Nova.cz, Novaplus.cz, FANDA.tv, Krásná.cz and Doma.cz'
_VALID_URL = 'http://(?:[^.]+\.)?... | unlicense |
mpetyx/palmdrop | venv/lib/python2.7/site-packages/PIL/ImageCms.py | 40 | 31153 | #
# The Python Imaging Library.
# $Id$
#
# optional color managment support, based on Kevin Cazabon's PyCMS
# library.
#
# History:
# 2009-03-08 fl Added to PIL.
#
# Copyright (C) 2002-2003 Kevin Cazabon
# Copyright (c) 2009 by Fredrik Lundh
#
# See the README file for information on usage and redistribution. See
# ... | apache-2.0 |
JioCloud/neutron | neutron/tests/unit/test_ipam.py | 4 | 11422 | # 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
# d... | apache-2.0 |
DrOctogon/unwash_ecom | oscar/apps/catalogue/managers.py | 1 | 1491 | from django.db import models
class ProductQuerySet(models.query.QuerySet):
def base_queryset(self):
"""
Applies select_related and prefetch_related for commonly related
models to save on queries
"""
return self.select_related('product_class')\
.prefetch_related... | bsd-3-clause |
JoeyCodinja/INFO3180PROJECT3 | lib/werkzeug/security.py | 302 | 8407 | # -*- coding: utf-8 -*-
"""
werkzeug.security
~~~~~~~~~~~~~~~~~
Security related helpers such as secure password hashing tools.
:copyright: (c) 2013 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import os
import hmac
import hashlib
import posi... | apache-2.0 |
VitalPet/odoo | addons/crm/crm.py | 4 | 10606 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | agpl-3.0 |
Jionglun/-w16b_test | static/Brython3.1.3-20150514-095342/Lib/numbers.py | 883 | 10398 | # Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Abstract Base Classes (ABCs) for numbers, according to PEP 3141.
TODO: Fill out more detailed documentation on the operators."""
from abc import ABCMeta, abstractmethod
__all__ = ["Number", "Complex", "Real", "Rat... | agpl-3.0 |
back-to/streamlink | src/streamlink_cli/output.py | 1 | 8609 | import logging
import os
import shlex
import subprocess
import sys
from time import sleep
from streamlink.utils.encoding import get_filesystem_encoding, maybe_encode, maybe_decode
from .compat import is_win32, stdout
from .constants import DEFAULT_PLAYER_ARGUMENTS, SUPPORTED_PLAYERS
from .utils import ignored
if is_w... | bsd-2-clause |
SancharovK/_local_engine | tools/b43-tools/files/b43-fwsquash.py | 494 | 4767 | #!/usr/bin/env python
#
# b43 firmware file squasher
# Removes unnecessary firmware files
#
# Copyright (c) 2009 Michael Buesch <mb@bu3sch.de>
#
# Licensed under the GNU/GPL version 2 or (at your option) any later version.
#
import sys
import os
def usage():
print("Usage: %s PHYTYPES COREREVS /path/to/extracted/firm... | gpl-2.0 |
partofthething/home-assistant | homeassistant/components/dwd_weather_warnings/sensor.py | 11 | 6218 | """
Support for getting statistical data from a DWD Weather Warnings.
Data is fetched from DWD:
https://rcccm.dwd.de/DE/wetter/warnungen_aktuell/objekt_einbindung/objekteinbindung.html
Warnungen vor extremem Unwetter (Stufe 4)
Unwetterwarnungen (Stufe 3)
Warnungen vor markantem Wetter (Stufe 2)
Wetterwarnungen (Stufe... | mit |
axelkennedal/dissen | dissenEnv/lib/python3.5/site-packages/django/db/transaction.py | 238 | 11366 | from django.db import (
DEFAULT_DB_ALIAS, DatabaseError, Error, ProgrammingError, connections,
)
from django.utils.decorators import ContextDecorator
class TransactionManagementError(ProgrammingError):
"""
This exception is thrown when transaction management is used improperly.
"""
pass
def get_... | mit |
rpwagner/tiled-display | flapp/movie/imageMovieReader.py | 1 | 7164 | import os
import Image
import traceback
from flapp.movie.utils import GetMovieFPS, GetMovieDuration
import mmap
import resource
class ImageMovieReader:
ST_STOP = 0
ST_PLAY = 1
ST_PAUSE = 2
def __init__(self, quiet = False):
self.path = ""
self.fileLoaded = False
self.playingFram... | apache-2.0 |
chainer/chainer | chainer/functions/activation/relu.py | 3 | 4736 | import numpy
import chainer
from chainer.backends import cuda
from chainer.backends import intel64
from chainer import function_node
from chainer import utils
from chainer.utils import type_check
import chainerx
if cuda.available:
_relu_grad2_kernel = cuda.elementwise(
'T y, T gy', 'T gx',
'gx = ... | mit |
Kilhog/odoo | addons/website/models/res_config.py | 240 | 2660 |
from openerp.osv import fields, osv
class website_config_settings(osv.osv_memory):
_name = 'website.config.settings'
_inherit = 'res.config.settings'
_columns = {
'website_id': fields.many2one('website', string="website", required=True),
'website_name': fields.related('website_id', 'name'... | agpl-3.0 |
julienvaslet/beer | shell/shell.py | 1 | 16453 | # -*- coding: utf-8 -*-
import sys
import re
import os
try:
import termios
import tty
from . import keys_unix as keys
SHELL_SYSTEM = "unix"
except ImportError:
import msvcrt
from . import keys_windows as keys
SHELL_SYSTEM = "windows"
# Switch to UTF-8 output encoding
# And reset the terminal window
if... | gpl-3.0 |
qskycolor/viewfinder | backend/www/test/update_user_photo_test.py | 13 | 4568 | # Copyright 2013 Viewfinder Inc. All Rights Reserved.
"""Tests update_user_photo method.
"""
__author__ = ['ben@emailscrubbed.com (Ben Darnell)']
import time
from copy import deepcopy
from viewfinder.backend.base import util
from viewfinder.backend.db.db_client import DBKey
from viewfinder.backend.db.episode impor... | apache-2.0 |
bobcyw/django | django/contrib/postgres/fields/array.py | 186 | 8424 | import json
from django.contrib.postgres import lookups
from django.contrib.postgres.forms import SimpleArrayField
from django.contrib.postgres.validators import ArrayMaxLengthValidator
from django.core import checks, exceptions
from django.db.models import Field, IntegerField, Transform
from django.utils import six
f... | bsd-3-clause |
talishte/ctigre | env/lib/python2.7/site-packages/Crypto/Signature/__init__.py | 126 | 1202 | # -*- coding: utf-8 -*-
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyone is granted a worldwide, perpetual, royalty-free,
# non-exclusive license to e... | bsd-2-clause |
meteorcloudy/bazel | tools/jdk/proguard_whitelister_test.py | 13 | 2988 | # Lint as: python2, python3
# Copyright 2015 The Bazel 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 |
vmg/hg-stable | hgext/convert/gnuarch.py | 94 | 12716 | # gnuarch.py - GNU Arch support for the convert extension
#
# Copyright 2008, 2009 Aleix Conchillo Flaque <aleix@member.fsf.org>
# and others
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from common import NoRepo, commandline... | gpl-2.0 |
harisibrahimkv/django | tests/inline_formsets/tests.py | 131 | 8414 | from django.forms.models import ModelForm, inlineformset_factory
from django.test import TestCase, skipUnlessDBFeature
from .models import Child, Parent, Poem, Poet, School
class DeletionTests(TestCase):
def test_deletion(self):
PoemFormSet = inlineformset_factory(Poet, Poem, can_delete=True, fields="__... | bsd-3-clause |
gordon-elliott/glod | src/glod/unittests/model/test_statement_item_collection.py | 1 | 5394 | __copyright__ = 'Copyright(c) Gordon Elliott 2017'
"""
"""
from datetime import date, timedelta
from decimal import Decimal
from unittest import TestCase
from glod.model.statement_item import StatementItem
from glod.model.statement_item_collection import StatementItemCollection
from glod.model.account import Accoun... | mit |
homeworkprod/dbb-ranking-parser | dbbrankingparser/document.py | 1 | 1573 | # -*- coding: utf-8 -*-
"""
dbbrankingparser.document
~~~~~~~~~~~~~~~~~~~~~~~~~
HTML document utilities
:Copyright: 2006-2016 Jochen Kupperschmidt
:License: MIT, see LICENSE for details.
"""
from lxml.html import document_fromstring
from .conversion import convert_attributes
def parse(html):
"""Yield ranks e... | mit |
keith923/dotfiles | jupyter/jupyter_notebook_config.py | 1 | 21738 | # Configuration file for jupyter-notebook.
#------------------------------------------------------------------------------
# Application(SingletonConfigurable) configuration
#------------------------------------------------------------------------------
## This is an application.
## The date format used by logging f... | mit |
nvoron23/paragraph2vec | setup.py | 11 | 4911 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2012 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
Run with:
sudo python ./setup.py install
"""
import os
import sys
if sys.version_info[:2] < (2, 5):
raise Exception('This ver... | lgpl-3.0 |
NeurodataWithoutBorders/api-python | nwb/combine_messages.py | 1 | 9956 | import re
import pprint
pp = pprint.PrettyPrinter(indent=4)
from sys import version_info # py3, for checking type of input
def combine_messages(messages):
""" Combines messages that have one or more integers in them, such as
"trial001" "trial002", into a single message like "trial# (#=1-2)".
Thi... | bsd-3-clause |
wevote/WeVoteServer | apis_v1/tests/test_views_voter_location.py | 1 | 3410 | # -*- coding: UTF-8 -*-
from django.contrib.gis import geoip2
from django.urls import reverse
from django.test import Client, TestCase
from functools import wraps
import json
# def print_geoip_instructions_on_exc(unittest):
# @wraps(unittest)
# def wrapper(*args, **kwargs):
# try:
# unitt... | mit |
Linkid/numpy | numpy/core/code_generators/generate_numpy_api.py | 113 | 7629 | from __future__ import division, print_function
import os
import genapi
from genapi import \
TypeApi, GlobalVarApi, FunctionApi, BoolValuesApi
import numpy_api
# use annotated api when running under cpychecker
h_template = r"""
#if defined(_MULTIARRAYMODULE) || defined(WITH_CPYCHECKER_STEALS_REFERENCE_TO_AR... | bsd-3-clause |
tersmitten/ansible | lib/ansible/modules/clustering/consul_kv.py | 10 | 11558 | #!/usr/bin/python
#
# (c) 2015, Steve Gargan <steve.gargan@gmail.com>
# (c) 2018 Genome Research Ltd.
# 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_versio... | gpl-3.0 |
bowlofstew/scylla | configure.py | 12 | 31100 | #!/usr/bin/python3
#
# Copyright 2015 Cloudius Systems
#
#
# This file is part of Scylla.
#
# Scylla 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, either version 3 of the License, or
# (at your optio... | agpl-3.0 |
timberline-secondary/hackerspace | src/profile_manager/forms.py | 1 | 1126 | from django import forms
from .models import Profile
class ProfileForm(forms.ModelForm):
# this will be saved in User.email
email = forms.EmailField(required=False)
class Meta:
model = Profile
fields = ['preferred_name', 'preferred_internal_only',
'alias', 'avatar', 'g... | gpl-3.0 |
dcsg/dropman | dropman/commands/reboot.py | 1 | 2458 | # The MIT License (MIT)
# Copyright (c) 2016 Daniel Gomes <me@danielcsgomes.com>
#
# 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 righ... | mit |
akshatharaj/django | tests/delete/tests.py | 222 | 18346 | from __future__ import unicode_literals
from math import ceil
from django.db import IntegrityError, connection, models
from django.db.models.sql.constants import GET_ITERATOR_CHUNK_SIZE
from django.test import TestCase, skipIfDBFeature, skipUnlessDBFeature
from django.utils.six.moves import range
from .models import... | bsd-3-clause |
lukeiwanski/tensorflow | tensorflow/python/data/kernel_tests/concatenate_dataset_op_test.py | 42 | 5552 | # Copyright 2017 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... | apache-2.0 |
2947721120/thumbor | vows/file_storage_vows.py | 7 | 7952 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# thumbor imaging service
# https://github.com/thumbor/thumbor/wiki
# Licensed under the MIT license:
# http://www.opensource.org/licenses/mit-license
# Copyright (c) 2011 globo.com timehome@corp.globo.com
from os.path import exists, dirname, join
import random
import shutil... | mit |
littlstar/chromium.src | tools/PRESUBMIT.py | 43 | 1548 | # Copyright (c) 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Top-level presubmit script for bisect/perf trybot.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts for
details on the pre... | bsd-3-clause |
pietern/caffe2 | caffe2/python/crf.py | 4 | 15115 | # Copyright (c) 2016-present, Facebook, 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... | apache-2.0 |
nikitos/npui | netprofile_postfix/netprofile_postfix/models.py | 1 | 18458 | #!/usr/bin/env python
# -*- coding: utf-8; tab-width: 4; indent-tabs-mode: t -*-
#
# NetProfile: PowerDNS module - Models
# © Copyright 2013 Alex 'Unik' Unigovsky
#
# This file is part of NetProfile.
# NetProfile is free software: you can redistribute it and/or
# modify it under the terms of the GNU Affero General Publ... | agpl-3.0 |
mark-burnett/filament-dynamics | actin_dynamics/primitives/objectives/tau.py | 1 | 5939 | # Copyright (C) 2011 Mark Burnett
#
# 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 i... | gpl-3.0 |
beezee/GAE-Django-site | django/contrib/auth/tests/remote_user.py | 150 | 6422 | from datetime import datetime
from django.conf import settings
from django.contrib.auth.backends import RemoteUserBackend
from django.contrib.auth.models import User
from django.test import TestCase
class RemoteUserTest(TestCase):
urls = 'django.contrib.auth.tests.urls'
middleware = 'django.contrib.auth.mid... | bsd-3-clause |
thumbimigwe/echorizr | lib/python2.7/site-packages/pip/_vendor/distlib/locators.py | 129 | 50493 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012-2015 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
import gzip
from io import BytesIO
import json
import logging
import os
import posixpath
import re
try:
import threading
except Impo... | mit |
newerthcom/savagerebirth | libs/python-2.72/Lib/lib2to3/fixes/fix_renames.py | 326 | 2218 | """Fix incompatible renames
Fixes:
* sys.maxint -> sys.maxsize
"""
# Author: Christian Heimes
# based on Collin Winter's fix_import
# Local imports
from .. import fixer_base
from ..fixer_util import Name, attr_chain
MAPPING = {"sys": {"maxint" : "maxsize"},
}
LOOKUP = {}
def alternates(members):
re... | gpl-2.0 |
cloudnull/ansible-modules-core | cloud/openstack/quantum_floating_ip_associate.py | 9 | 8149 | #!/usr/bin/python
#coding: utf-8 -*-
# (c) 2013, Benno Joy <benno@ansible.com>
#
# This module 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 ... | gpl-3.0 |
philippp/civic | ingestion/record/clean_records.py | 1 | 3145 | #!/usr/bin/python
import datetime
import logging
import pprint
import json
import glob
import re
"""
Given a source file (or wildcard) for JSON-formatted records, ingest
these to the database."""
def clean(json_record_file, output_dir):
source_files = glob.glob(json_record_file)
if len(source_files) == 0:
... | mpl-2.0 |
cortext/crawtextV2 | ~/venvs/crawler/lib/python2.7/site-packages/pymongo/read_preferences.py | 17 | 6471 | # Copyright 2012-2014 MongoDB, 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... | mit |
mahak/keystone | keystone/tests/protection/v3/test_roles.py | 2 | 13262 | # 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
# d... | apache-2.0 |
mmalecki/node-gyp | gyp/test/subdirectory/gyptest-top-all.py | 240 | 1384 | #!/usr/bin/env python
# Copyright (c) 2009 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.
"""
Verifies building a target and a subsidiary dependent target from a
.gyp file in a subdirectory, without specifying an explicit output b... | mit |
paolodedios/tensorflow | tensorflow/python/data/experimental/kernel_tests/prefetch_with_slack_test.py | 6 | 4188 | # Copyright 2019 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... | apache-2.0 |
t11e/werkzeug | bench/wzbench.py | 1 | 11587 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
wzbench
~~~~~~~
A werkzeug internal benchmark module. It's used in combination with
hg bisact to find out how the Werkzeug performance of some internal
core parts changes over time.
:copyright: 2009 by the Werkzeug Team, see AUTHORS for more d... | bsd-3-clause |
braintreeps/moto | tests/test_ec2/test_internet_gateways.py | 2 | 9124 | from __future__ import unicode_literals
# Ensure 'assert_raises' context manager support for Python 2.6
import tests.backport_assert_raises
from nose.tools import assert_raises
import re
import boto
from boto.exception import EC2ResponseError, JSONResponseError
import sure # noqa
from moto import mock_ec2
VPC_CI... | apache-2.0 |
learningequality/kolibri | kolibri/plugins/hooks.py | 3 | 12517 | """
Kolibri Hooks API
-----------------
What are hooks
~~~~~~~~~~~~~~
Hooks are classes that define *something* that happens at one or more places
where the hook is looked for and applied. It means that you can
"hook into a component" in Kolibri and have it do a predefined and
parameterized *thing*. For instance, Kol... | mit |
SnakeJenny/TensorFlow | tensorflow/python/estimator/run_config.py | 7 | 1897 | # Copyright 2017 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... | apache-2.0 |
mgedmin/ansible | lib/ansible/module_utils/local.py | 1 | 3353 | #
# 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 ... | gpl-3.0 |
hynnet/openwrt-mt7620 | staging_dir/host/lib/python2.7/bsddb/test/test_basics.py | 39 | 37246 | """
Basic TestCases for BTree and hash DBs, with and without a DBEnv, with
various DB flags, etc.
"""
import os
import errno
import string
from pprint import pprint
import unittest
import time
from test_all import db, test_support, verbose, get_new_environment_path, \
get_new_database_path
DASH = '-'
#----... | gpl-2.0 |
ibc/MediaSoup | worker/deps/gyp/test/variables/commands/gyptest-commands-repeated.py | 12 | 1353 | #!/usr/bin/env python
# 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.
"""
Test variable expansion of '<!()' syntax commands where they are evaluated
more then once..
"""
from __future__ import print_function
... | isc |
benvermaercke/pyqtgraph | pyqtgraph/frozenSupport.py | 52 | 1830 | ## Definitions helpful in frozen environments (eg py2exe)
import os, sys, zipfile
def listdir(path):
"""Replacement for os.listdir that works in frozen environments."""
if not hasattr(sys, 'frozen'):
return os.listdir(path)
(zipPath, archivePath) = splitZip(path)
if archivePath is None:
... | mit |
Ashaba/rms | rmslocalenv/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/etree.py | 322 | 4684 | from __future__ import absolute_import, division, unicode_literals
try:
from collections import OrderedDict
except ImportError:
try:
from ordereddict import OrderedDict
except ImportError:
OrderedDict = dict
import re
from pip._vendor.six import string_types
from . import base
from .._ut... | mit |
renweizhukov/LearningPythonTheHardWay | projects/ex48/ex48/parser.py | 1 | 1814 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
class ParserError(Exception):
pass
class Sentence(object):
def __init__(self, subject, verb, obj):
# remember we take ('noun', 'princess') tuples and convert them
self.subject = subject[1]
self.verb = verb[1]
self.object = obj[... | lgpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.