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
aldian/tensorflow
tensorflow/python/kernel_tests/basic_gpu_test.py
39
10559
# 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...
apache-2.0
Curious72/sympy
sympy/physics/optics/tests/test_gaussopt.py
76
3760
from sympy import atan2, factor, Float, I, Matrix, N, oo, pi, sqrt, symbols from sympy.physics.optics import (BeamParameter, CurvedMirror, CurvedRefraction, FlatMirror, FlatRefraction, FreeSpace, GeometricRay, RayTransferMatrix, ThinLens, conjugate_gauss_beams, gaussian_conj, geometric_conj_ab, geometric_conj_af...
bsd-3-clause
BTCfork/hardfork_prototype_1_mvf-core
qa/rpc-tests/blockchain.py
13
2771
#!/usr/bin/env python2 # Copyright (c) 2014-2015 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 RPC calls related to blockchain state. Tests correspond to code in # rpcblockchain.cpp. # from ...
mit
ychen820/microblog
flask/lib/python2.7/site-packages/blinker/_saferef.py
174
9223
# extracted from Louie, http://pylouie.org/ # updated for Python 3 # # Copyright (c) 2006 Patrick K. O'Brien, Mike C. Fletcher, # Matthew R. Scott # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # #...
bsd-3-clause
rhndg/openedx
lms/djangoapps/certificates/tests/test_views.py
2
29489
"""Tests for certificates views. """ import json import ddt from uuid import uuid4 from nose.plugins.attrib import attr from mock import patch from django.conf import settings from django.core.cache import cache from django.core.urlresolvers import reverse from django.test import TestCase from django.test.client impo...
agpl-3.0
mikronac/android_kernel_htc_msm8960
tools/perf/scripts/python/net_dropmonitor.py
1258
1562
# Monitor the system for dropped packets and proudce a report of drop locations and counts import os import sys sys.path.append(os.environ['PERF_EXEC_PATH'] + \ '/scripts/python/Perf-Trace-Util/lib/Perf/Trace') from perf_trace_context import * from Core import * from Util import * drop_log = {} kallsyms = [] def...
gpl-2.0
MarcJoan/django
tests/transaction_hooks/tests.py
288
6402
from django.db import connection, transaction from django.test import TransactionTestCase, skipUnlessDBFeature from .models import Thing class ForcedError(Exception): pass class TestConnectionOnCommit(TransactionTestCase): """ Tests for transaction.on_commit(). Creation/checking of database object...
bsd-3-clause
shanglt/youtube-dl
youtube_dl/extractor/slideshare.py
126
2003
from __future__ import unicode_literals import re import json from .common import InfoExtractor from ..compat import ( compat_urlparse, ) from ..utils import ( ExtractorError, ) class SlideshareIE(InfoExtractor): _VALID_URL = r'https?://www\.slideshare\.net/[^/]+?/(?P<title>.+?)($|\?)' _TEST = { ...
unlicense
PurpleBooth/python-vm
venv/lib/python2.7/site-packages/setuptools/compat.py
456
2094
import sys import itertools PY3 = sys.version_info >= (3,) PY2 = not PY3 if PY2: basestring = basestring import __builtin__ as builtins import ConfigParser from StringIO import StringIO BytesIO = StringIO func_code = lambda o: o.func_code func_globals = lambda o: o.func_globals im_func...
mit
ikaee/bfr-attendant
facerecognitionlibrary/jni-build/jni/include/tensorflow/python/ops/batch_norm_benchmark.py
30
10818
# 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...
apache-2.0
satnam6502/kubernetes
examples/job/work-queue-2/rediswq.py
132
6169
#!/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
marcellodesales/svnedge-console
ext/solaris/pkg-toolkit/pkg/vendor-packages/pkg/pkggzip.py
4
2418
#!/usr/bin/python # # CDDL HEADER START # # The contents of this file are subject to the terms of the # Common Development and Distribution License (the "License"). # You may not use this file except in compliance with the License. # # You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE # or http://www....
agpl-3.0
hkawasaki/kawasaki-aio8-1
lms/djangoapps/bulk_email/migrations/0008_add_course_authorizations.py
60
6425
# -*- 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): # Adding model 'CourseAuthorization' db.create_table('bulk_email_courseauthorization', ( ('id', ...
agpl-3.0
jonathancrabtree/biocode
sandbox/ktretina/split_isoforms.py
2
2031
#!/usr/bin/env python3 """ split_isoforms.py - splits all GFF3 mRNA isoforms into their own gene models (adds _# to old gene ID to get new gene ID) """ import argparse import os import biocodegff import biothings import biocodeutils def main(): parser = argparse.ArgumentParser( description='Splits all GFF3 mRN...
gpl-3.0
resfi/resfi
hostapd-20131120/tests/hwsim/test_ap_dynamic.py
2
10439
#!/usr/bin/python # # Test cases for dynamic BSS changes with hostapd # Copyright (c) 2013, Qualcomm Atheros, Inc. # # This software may be distributed under the terms of the BSD license. # See README for more details. import time import subprocess import logging logger = logging.getLogger() import hwsim_utils import...
gpl-3.0
scripnichenko/nova
nova/cells/scheduler.py
46
11483
# Copyright (c) 2012 Rackspace Hosting # 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...
apache-2.0
mozilla/bramble
bramble/base/machinecounts.py
1
6831
import datetime import logging import urllib import re import anyjson as json from functools import partial from django.conf import settings from bramble.base.redis_utils import redis_client logger = logging.getLogger(__name__) def make_key(prefix, postfix): ''' makes a redis key. if postfix is not a string,...
mpl-2.0
terrameijar/oppia
core/storage/feedback/gae_models_test.py
3
9701
# coding: utf-8 # # Copyright 2014 The Oppia 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 requi...
apache-2.0
DirtyUnicorns/android_external_chromium_org
tools/telemetry/telemetry/core/extension_unittest.py
25
7718
# Copyright 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import logging import os import shutil import tempfile import unittest from telemetry.core import browser_finder from telemetry.core import extension_to_loa...
bsd-3-clause
Grumbel/dirtool
dirtools/fileview/executor.py
1
4010
# dirtool.py - diff tool for directories # Copyright (C) 2017 Ingo Ruhnke <grumbel@gmail.com> # # 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 opt...
gpl-3.0
saurabhjn76/sympy
sympy/plotting/pygletplot/plot_controller.py
120
6965
from __future__ import print_function, division from pyglet.window import key from pyglet.window.mouse import LEFT, RIGHT, MIDDLE from util import get_direction_vectors, get_basis_vectors class PlotController(object): normal_mouse_sensitivity = 4.0 modified_mouse_sensitivity = 1.0 normal_key_sensitivit...
bsd-3-clause
wangxiangyu/horizon
openstack_dashboard/dashboards/project/volumes/tabs.py
42
5694
# Copyright 2013 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...
apache-2.0
jaytheking/ptqueue
tests/test_marshalling.py
1
2910
""" unittests for ptqueue server """ import unittest from struct import pack, unpack from ptqueue.util import CommandMarshaller # pylint: disable=C0111, C0301 class MarshallerTest(unittest.TestCase): """Test case for testing marshalling our command objects""" def setUp(self): self.put_command_bytes...
apache-2.0
yencarnacion/jaikuengine
.google_appengine/lib/django-1.4/tests/regressiontests/model_fields/models.py
24
7371
import os import tempfile # Try to import PIL in either of the two ways it can end up installed. # Checking for the existence of Image is enough for CPython, but for PyPy, # you need to check for the underlying modules. try: from PIL import Image, _imaging except ImportError: try: import Image, _imagi...
apache-2.0
pchaigno/grr
parsers/fingerprint.py
10
15321
#!/usr/bin/env python # Copyright 2011 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...
apache-2.0
vaygr/ansible
lib/ansible/modules/cloud/amazon/lambda_event.py
38
14562
#!/usr/bin/python # (c) 2016, Pierre Jodouin <pjodouin@virtualcomputing.solutions> # 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
alxgu/ansible
test/units/modules/storage/netapp/test_netapp_e_iscsi_interface.py
45
11656
# (c) 2018, NetApp Inc. # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from mock import MagicMock from ansible.module_utils import basic, netapp from ansible.modules.storage.netapp import netapp_e_host from ansible.modules.storage.netapp.netapp_e_host import Host from ans...
gpl-3.0
nolanelena/MyProjectSite-
node_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py
388
91069
# Copyright (c) 2013 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. # Notes: # # This is all roughly based on the Makefile system used by the Linux # kernel, but is a non-recursive make -- we put the entire dependency # graph in fr...
mit
avilaton/transitfeed
transitfeed/gtfsobjectbase.py
2
4423
#!/usr/bin/python2.5 # Copyright (C) 2007 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 la...
apache-2.0
b0ttl3z/SickRage
sickbeard/databases/cache_db.py
5
5192
# coding=utf-8 # Author: Nic Wolfe <nic@wolfeden.ca> # URL: https://sickrage.github.io # # This file is part of SickRage. # # SickRage 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 L...
gpl-3.0
danilobellini/pyturing
test_pyturing.py
1
22634
#!/usr/bin/env py.test # -*- coding: utf-8 -*- # Created on Tue Mar 4 11:05:50 2014 # MIT Licensed. See COPYING.TXT for more information. """ Turing machine internals testing module """ from __future__ import unicode_literals, print_function import pyturing from pyturing import (TMSyntaxError, TMLocked, pre_tokenizer...
mit
avanov/django
tests/gis_tests/gis_migrations/migrations/0001_initial.py
21
1977
from django.db import migrations, models from ...models import models as gis_models class Migration(migrations.Migration): """ Used for gis.specific migration tests. """ operations = [ migrations.CreateModel( name='Neighborhood', fields=[ ('id', models....
bsd-3-clause
kennedyshead/home-assistant
tests/components/ipp/test_sensor.py
2
4277
"""Tests for the IPP sensor platform.""" from datetime import datetime from unittest.mock import patch from homeassistant.components.ipp.const import DOMAIN from homeassistant.components.sensor import DOMAIN as SENSOR_DOMAIN from homeassistant.const import ATTR_ICON, ATTR_UNIT_OF_MEASUREMENT, PERCENTAGE from homeassis...
apache-2.0
Zyell/home-assistant
homeassistant/components/sensor/netatmo.py
1
5682
""" Support for the NetAtmo Weather Service. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.netatmo/ """ import logging from datetime import timedelta from homeassistant.components.sensor import DOMAIN from homeassistant.const import ( CONF_A...
mit
rmfitzpatrick/ansible
test/sanity/validate-modules/module_args.py
76
3428
# -*- coding: utf-8 -*- # # Copyright (C) 2016 Matt Martz <matt@sivel.net> # Copyright (C) 2016 Rackspace US, Inc. # # 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 ...
gpl-3.0
svebk/DeepSentiBank_memex
workflows/fill_sha1_from_s3url/fill_sha1_from_s3url.py
1
4148
import json from pyspark import SparkContext, SparkConf def get_list_value(json_x,field_tuple): return [x["value"] for x in json_x if x["columnFamily"]==field_tuple[0] and x["qualifier"]==field_tuple[1]] def s3url_missing_sha1(data): key = data[0] try: json_x = [json.loads(x) for x in data[1].sp...
bsd-2-clause
praekeltfoundation/sideloader.db
sideloader/db/task_db.py
2
9345
import time from twisted.internet import defer from twisted.python import log from twisted.enterprise import adbapi class SideloaderDB(object): def __init__(self): self.p = adbapi.ConnectionPool('psycopg2', database='sideloader', host='localhost', user='postgres', ...
mit
mpetyx/palmdrop
venv/lib/python2.7/site-packages/django/utils/safestring.py
208
4185
""" Functions for working with "safe strings": strings that can be displayed safely without further escaping in HTML. Marking something as a "safe string" means that the producer of the string has already turned characters that should not be interpreted by the HTML engine (e.g. '<') into the appropriate entities. """ f...
apache-2.0
TheWardoctor/Wardoctors-repo
plugin.video.saltsrd.lite/scrapers/moviesplanet_scraper.py
7
7530
""" SALTS XBMC Addon Copyright (C) 2014 tknorris 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. T...
apache-2.0
haad/ansible
lib/ansible/modules/network/radware/vdirect_commit.py
22
13325
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2017 Radware LTD. # # 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...
gpl-3.0
fusionbox/satchless
satchless/product/tests/product.py
1
4237
# -*- coding: utf-8 -*- import os from django.conf import settings from django.conf.urls import patterns, include, url from django.core.urlresolvers import reverse #from django.db import connection, reset_queries from django.test import TestCase, Client from ...util.tests import ViewsTestCase from ..app import produc...
bsd-3-clause
ddmax/shadowsocks
shadowsocks/crypto/openssl.py
1038
5414
#!/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
shaileshgoogler/pyglet
pyglet/gl/glext_arb.py
30
948297
# ---------------------------------------------------------------------------- # pyglet # Copyright (c) 2006-2008 Alex Holkner # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions # are met: # # * Redistribu...
bsd-3-clause
tromey/gdb-buildbot
lib/gdbcommand.py
1
1504
# GDB .sum-fetching command. from buildbot.status.builder import SUCCESS, WARNINGS, FAILURE, EXCEPTION from buildbot.steps.shell import ShellCommand from sumfiles import DejaResults class GdbCatSumfileCommand(ShellCommand): name = 'regressions' command = ['cat', 'gdb.sum'] def __init__(self, **kwargs): ...
gpl-3.0
M4sse/chromium.src
tools/gn/bin/gn-format.py
48
2025
# 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. # # Based on clang-format.py. # # This file is a minimal gn format vim-integration. To install: # - Change 'binary' if gn is not on the path (see below). # - ...
bsd-3-clause
xNovax/SickRage
tornado/platform/posix.py
352
1859
#!/usr/bin/env python # # Copyright 2011 Facebook # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
gpl-3.0
laurent-dinh/mumbler
gradient_based.py
1
3754
import theano import theano.tensor as T import numpy as np floatX = "float32" class SGD_momentum(object): def __init__(self, params, mode): self.params = params self.mode = mode self.params_momentum = [] if hasattr(self.params, "__iter__"): for param in self.params: ...
bsd-3-clause
valentin-krasontovitsch/ansible
lib/ansible/modules/system/open_iscsi.py
52
11466
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2013, Serge van Ginderachter <serge@vanginderachter.be> # 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_ver...
gpl-3.0
guglielmino/pushetta-api-django
pushetta/www/urls.py
1
4784
# -*- coding: utf-8 -*- from __future__ import unicode_literals # Progetto: Pushetta API # Definizione delle Url per la API from django.conf.urls import url, include from django.views.generic import TemplateView from django.contrib.auth.decorators import login_required from dispatcher_view import ChannelSubscriberD...
gpl-3.0
vigilv/scikit-learn
sklearn/preprocessing/imputation.py
208
14158
# Authors: Nicolas Tresegnie <nicolas.tresegnie@gmail.com> # License: BSD 3 clause import warnings import numpy as np import numpy.ma as ma from scipy import sparse from scipy import stats from ..base import BaseEstimator, TransformerMixin from ..utils import check_array from ..utils import as_float_array from ..uti...
bsd-3-clause
googleapis/googleapis-gen
google/logging/v2/logging-v2-py/google/cloud/logging_v2/services/logging_service_v2/transports/base.py
2
11985
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # 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
tensorflow/adanet
adanet/subnetwork/generator_test.py
1
7392
"""Test AdaNet single graph subnetwork implementation. Copyright 2018 The AdaNet 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 https://www.apache.org/licenses/L...
apache-2.0
insertnamehere1/maraschino
lib/apscheduler/job.py
29
4675
""" Jobs represent scheduled tasks. """ from threading import Lock from datetime import timedelta from apscheduler.util import to_unicode, ref_to_obj, get_callable_name,\ obj_to_ref class MaxInstancesReachedError(Exception): pass class Job(object): """ Encapsulates the actual Job along with its me...
mit
mdrumond/tensorflow
tensorflow/contrib/remote_fused_graph/pylib/__init__.py
96
1290
# 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
sachinkum/Bal-Aveksha
WebServer/BalAvekshaEnv/lib/python3.5/site-packages/rest_framework/utils/mediatypes.py
19
2709
""" Handling of media types, as found in HTTP Content-Type and Accept headers. See http://www.w3.org/Protocols/rfc2616/rfc2616-sec3.html#sec3.7 """ from __future__ import unicode_literals from django.http.multipartparser import parse_header from django.utils.encoding import python_2_unicode_compatible from rest_fram...
gpl-3.0
jandom/rdkit
rdkit/Chem/Randomize.py
5
1704
# $Id$ # # Copyright (C) 2005-2006 Rational Discovery LLC # # @@ All Rights Reserved @@ # This file is part of the RDKit. # The contents are covered by the terms of the BSD license # which is included in the file license.txt, found at the root # of the RDKit source tree. # import random from rdkit.six.moves impo...
bsd-3-clause
seize-the-dave/XlsxWriter
xlsxwriter/test/comparison/test_chart_radar01.py
8
1554
############################################################################### # # Tests for XlsxWriter. # # Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org # from ..excel_comparsion_test import ExcelComparisonTest from ...workbook import Workbook class TestCompareXLSXFiles(ExcelComparisonTest): """...
bsd-2-clause
catapult-project/catapult-csm
third_party/Paste/tests/test_request.py
47
2354
# (c) 2005 Ben Bangert # This module is part of the Python Paste Project and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php from paste.fixture import * from paste.request import * from paste.wsgiwrappers import WSGIRequest import six def simpleapp(environ, start_response): ...
bsd-3-clause
cloudspokes/OpenWARP
source/NemohImproved/NemohPython/nemoh/utility.py
3
46646
#!/usr/bin/env python """ This module defines utility methods used by the application Changes in version 1.1: Added possibility to run the code with custom settings Changes in version 1.2 (Irregular Frequencies Assembly) Added require_dataset function to allow dataset to be resized automatically. ...
apache-2.0
kbc-developers/padfone2_kernel
tools/perf/scripts/python/netdev-times.py
11271
15048
# Display a process of packets and processed time. # It helps us to investigate networking or network device. # # options # tx: show only tx chart # rx: show only rx chart # dev=: show only thing related to specified device # debug: work with debug mode. It shows buffer status. import os import sys sys.path.append(os...
gpl-2.0
rubencabrera/odoo
addons/mail/tests/common.py
56
6232
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Business Applications # Copyright (c) 2012-TODAY OpenERP S.A. <http://openerp.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of ...
agpl-3.0
neerajvashistha/pa-dude
lib/python2.7/site-packages/django/contrib/postgres/fields/jsonb.py
341
2994
import json from psycopg2.extras import Json from django.contrib.postgres import forms, lookups from django.core import exceptions from django.db.models import Field, Transform from django.utils.translation import ugettext_lazy as _ __all__ = ['JSONField'] class JSONField(Field): empty_strings_allowed = False ...
mit
vganapath/rally
rally/plugins/openstack/scenarios/sahara/jobs.py
6
5223
# Copyright 2014: Mirantis 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 b...
apache-2.0
XzhengBo/shadowsocks
shadowsocks/shell.py
270
12676
#!/usr/bin/python # -*- coding: utf-8 -*- # # 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 b...
apache-2.0
oliverlee/sympy
sympy/plotting/pygletplot/plot_modes.py
119
5300
from __future__ import print_function, division from plot_curve import PlotCurve from plot_surface import PlotSurface from sympy import pi, lambdify from sympy.functions import sin, cos from math import sin as p_sin from math import cos as p_cos def float_vec3(f): def inner(*args): v = f(*args) ...
bsd-3-clause
ehealthafrica-ci/formhub
odk_viewer/tests/test_attachment_url.py
2
1707
import os from django.core.urlresolvers import reverse from django.conf import settings from main.tests.test_base import MainTestCase from odk_logger.models import Attachment from odk_viewer.views import attachment_url class TestAttachmentUrl(MainTestCase): def setUp(self): self.attachment_count = 0 ...
bsd-2-clause
josephcslater/scipy
scipy/special/basic.py
3
70421
# # Author: Travis Oliphant, 2002 # from __future__ import division, print_function, absolute_import import warnings import numpy as np import math from scipy._lib.six import xrange from numpy import (pi, asarray, floor, isscalar, iscomplex, real, imag, sqrt, where, mgrid, sin, place, issubdtype,...
bsd-3-clause
stanley-cheung/grpc
examples/python/data_transmission/demo_pb2.py
13
5424
# -*- coding: utf-8 -*- # Generated by the protocol buffer compiler. DO NOT EDIT! # source: demo.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 import...
apache-2.0
cdjones32/vertx-web
src/test/sockjs-protocol/venv/lib/python2.7/site-packages/unittest2/case.py
13
55709
"""Test case implementation""" import sys import collections import contextlib import difflib import logging import pprint import re import traceback import types import unittest import warnings import six from six.moves import range from unittest2 import result from unittest2.util import ( safe_repr, safe_str, ...
apache-2.0
LazyCodingCat/gyp
test/win/gyptest-link-defrelink.py
210
1683
#!/usr/bin/env python # Copyright (c) 2013 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. """ Make sure a relink is performed when a .def file is touched. """ import TestGyp import sys if sys.platform == 'win32': test = TestG...
bsd-3-clause
lag945/three.js
utils/exporters/blender/modules/msgpack/fallback.py
641
26403
"""Fallback pure Python implementation of msgpack""" import sys import array import struct if sys.version_info[0] == 3: PY3 = True int_types = int Unicode = str xrange = range def dict_iteritems(d): return d.items() else: PY3 = False int_types = (int, long) Unicode = unicode ...
mit
HonzaKral/django
django/conf/locale/ml/formats.py
1007
1815
# -*- 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 = 'N j, Y' TIME_FORMAT = 'P' DATETIM...
bsd-3-clause
dart-archive/dart-sdk
tools/promote.py
2
6533
#!/usr/bin/env python # # Copyright (c) 2012, the Dart project authors. Please see the AUTHORS file # for details. All rights reserved. Use of this source code is governed by a # BSD-style license that can be found in the LICENSE file. # Dart SDK promote tools. import imp import optparse import os import subprocess ...
bsd-3-clause
imhome/django-storages-redux
storages/backends/couchdb.py
12
3947
""" This is a Custom Storage System for Django with CouchDB backend. Created by Christian Klein. (c) Copyright 2009 HUDORA GmbH. All Rights Reserved. """ import os from django.conf import settings from django.core.files import File from django.core.exceptions import ImproperlyConfigured from storages.compat import ur...
bsd-3-clause
Affirm/moto
tests/test_ec2/test_vpc_peering.py
8
3182
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 boto from boto.exception import EC2ResponseError import sure # noqa from moto import mock_ec2_deprecated from tests.helpers import re...
apache-2.0
mancoast/CPythonPyc_test
cpython/260_test_modulefinder.py
2
7556
import __future__ import os import unittest import distutils.dir_util import tempfile from test import test_support try: set except NameError: from sets import Set as set import modulefinder # Note: To test modulefinder with Python 2.2, sets.py and # modulefinder.py must be available - they are not in the standard ...
gpl-3.0
tadatitam/info-flow-experiments
AdFisher/examples/test.substance.py
1
2324
import sys sys.path.append("../core") # files from the core import adfisher # adfisher wrapper function import web.pre_experiment.alexa # collecting top sites from alexa import web.google_ads # interacting with Google ads and Ad Settings import converter.reader ...
gpl-3.0
therandomcode/WikiWriter
lib/bs4/tests/test_builder_registry.py
176
5582
"""Tests of the builder registry.""" import unittest import warnings from bs4 import BeautifulSoup from bs4.builder import ( builder_registry as registry, HTMLParserTreeBuilder, TreeBuilderRegistry, ) try: from bs4.builder import HTML5TreeBuilder HTML5LIB_PRESENT = True except ImportError: HT...
apache-2.0
crobinso/virt-manager
tests/uitests/lib/app.py
2
11942
# This work is licensed under the GNU GPLv2 or later. # See the COPYING file in the top-level directory. import os import signal import subprocess import sys import time from gi.repository import Gio import dogtail.rawinput import dogtail.tree from virtinst import log import tests.utils from . import utils class V...
gpl-2.0
Hobbit71/oc-registry
node_modules/oc/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py
2736
1804
# 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. """Visual Studio project reader/writer.""" import gyp.common import gyp.easy_xml as easy_xml class Writer(object): """Visual Studio XML tool file writer.""" ...
isc
CamDavidsonPilon/lifelines
lifelines/tests/test_generate_datasets.py
1
1033
# -*- coding: utf-8 -*- import os import pytest import matplotlib.pyplot as plt from lifelines import NelsonAalenFitter, KaplanMeierFitter from lifelines.generate_datasets import exponential_survival_data def test_exponential_data_sets_correct_censor(): N = 20000 censorship = 0.2 T, C = exponential_surv...
mit
Nic30/hwtLib
hwtLib/avalon/endpoint_test.py
1
6980
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from hwt.hdl.constants import READ, WRITE from hwt.interfaces.std import BramPort_withoutClk from hwt.simulator.simTestCase import SimTestCase from hwtLib.abstract.discoverAddressSpace import AddressSpaceProbe from hwtLib.amba.axiLite_comp.endpoint_test import structTwoFi...
mit
ryanbauman/bulkioInterfaces
libsrc/testing/attic/test_foo.py
2
1265
# # This file is protected by Copyright. Please refer to the COPYRIGHT file # distributed with this source distribution. # # This file is part of REDHAWK bulkioInterfaces. # # REDHAWK bulkioInterfaces is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License a...
lgpl-3.0
sadanandb/pmt
src/dateutil/zoneinfo/__init__.py
265
2575
""" Copyright (c) 2003-2005 Gustavo Niemeyer <gustavo@niemeyer.net> This module offers extensions to the standard python 2.3+ datetime module. """ from dateutil.tz import tzfile from tarfile import TarFile import os __author__ = "Gustavo Niemeyer <gustavo@niemeyer.net>" __license__ = "PSF License" __all__ = ["setca...
epl-1.0
yuvallanger/project-euler
euler-011.py
1
1471
#!/usr/bin/env python3 import functools # loadProblem :: IO [[Int]] def loadProblem(): return [[int(n) for n in line.split(' ')] for line in open("euler-011.txt").readlines()] # getHoriz :: Int -> Int -> [[a]] -> [a] def getHoriz(row, col, xss): [a, b, c, d] = [xss[row][col + i] for i in range(4)] return [...
agpl-3.0
nagarjung/kubernetes
hack/boilerplate/boilerplate.py
3
4760
#!/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
tntnatbry/tensorflow
tensorflow/python/training/learning_rate_decay_test.py
65
11289
# 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...
apache-2.0
shastah/spacewalk
backend/common/rhn_deb.py
7
5061
# # Copyright (c) 2010--2016 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 c...
gpl-2.0
ITArray/Automotion-Python
automotion/ui_validator.py
1
6879
import time from responsive_ui_validator import ResponsiveUIValidator class UIValidator(ResponsiveUIValidator): def __init__(self, driver, element, element_name): ResponsiveUIValidator.__init__(self, driver) self.root_element = element self.root_element_name = element_name self.x_...
apache-2.0
jerryz1982/neutron
neutron/plugins/ml2/drivers/cisco/apic/apic_model.py
39
7320
# Copyright (c) 2014 Cisco Systems 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 re...
apache-2.0
Bitergia/allura
ForgeDiscussion/forgediscussion/tests/functional/test_forum.py
1
32673
# -*- coding: utf-8 -*- import random import logging from email.mime.text import MIMEText from email.mime.image import MIMEImage from email.mime.multipart import MIMEMultipart import pkg_resources import pylons pylons.c = pylons.tmpl_context pylons.g = pylons.app_globals from pylons import g, c from nose.tools import ...
apache-2.0
glovebx/odoo
addons/account_check_writing/account.py
379
2032
# -*- 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 GNU...
agpl-3.0
baris/fullerite
src/diamond/collectors/xen_collector/xen_collector.py
53
2217
# coding=utf-8 """ The XENCollector grabs usage/allocation metrics using libvirt #### Dependencies * python-libvirt """ from diamond.collector import Collector import os try: import libvirt except ImportError: libvirt = None class XENCollector(Collector): def get_default_config_help(self): ...
apache-2.0
timoschwarzer/blendworks
BlendWorks Server/python/Lib/ctypes/test/test_buffers.py
12
2230
from ctypes import * import unittest class StringBufferTestCase(unittest.TestCase): def test_buffer(self): b = create_string_buffer(32) self.assertEqual(len(b), 32) self.assertEqual(sizeof(b), 32 * sizeof(c_char)) self.assertIs(type(b[0]), bytes) b = create_string_buffer(b...
gpl-2.0
Ssawa/Diamond
src/collectors/flume/flume.py
63
3401
# coding=utf-8 """ Collect statistics from Flume #### Dependencies * urllib2 * json or simplejson """ import urllib2 import diamond.collector try: import simplejson as json except ImportError: import json class FlumeCollector(diamond.collector.Collector): # items to collect _metrics_collect =...
mit
exaile/exaile
xlgui/panel/files.py
1
19387
# Copyright (C) 2008-2010 Adam Olsen # # 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, or (at your option) # any later version. # # This program is distributed in the hope that...
gpl-2.0
SocieteCitoyenne/FranceData
setup.py
1
1267
import os from setuptools import setup, find_packages, Command def read(fname): return open(os.path.join(os.path.dirname(__file__), fname)).read() setup( name='francedata', version='0.0.1', description='Extracted data from French parliament', author='James Pic', author_email='jamespic@gmail....
gpl-3.0
mitar/django
django/utils/dictconfig.py
13
22967
# This is a copy of the Python logging.config.dictconfig module, # reproduced with permission. It is provided here for backwards # compatibility for Python versions prior to 2.7. # # Copyright 2009-2010 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # docu...
bsd-3-clause
h200863057/meteor
examples/unfinished/python-ddp-client/ddp-client.py
169
10313
#!/usr/bin/env python2.7 import sys import json import time import argparse import thread import threading import traceback from ws4py.client.threadedclient import WebSocketClient from cmd import Cmd DDP_VERSIONS = ["pre1"] def log(msg): """A shortcut to write to the standard error file descriptor""" sys.s...
mit
archf/ansible
lib/ansible/modules/network/cloudengine/ce_vrf_af.py
27
30552
#!/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...
gpl-3.0