repo_name
stringlengths
6
100
path
stringlengths
4
294
copies
stringlengths
1
5
size
stringlengths
4
6
content
stringlengths
606
896k
license
stringclasses
15 values
tangrams/tangram-sandbox
data/tripMaker.py
2
1736
#!/usr/bin/env python import requests, json, sys import geojson #six degrees of precision in valhalla inv = 1.0 / 1e6; #decode an encoded string def decode(encoded): decoded = [] previous = [0,0] i = 0 #for each byte while i < len(encoded): #for each coord (lat, lon) ll = [0,0] ...
mit
sdcooke/django
tests/bulk_create/tests.py
190
7570
from __future__ import unicode_literals from operator import attrgetter from django.db import connection from django.test import ( TestCase, override_settings, skipIfDBFeature, skipUnlessDBFeature, ) from .models import ( Country, Pizzeria, ProxyCountry, ProxyMultiCountry, ProxyMultiProxyCountry, ProxyPr...
bsd-3-clause
pforai/easybuild-framework
easybuild/toolchains/mpi/mvapich2.py
9
1489
## # Copyright 2012-2015 Ghent University # # This file is part of EasyBuild, # originally created by the HPC team of Ghent University (http://ugent.be/hpc/en), # with support of Ghent University (http://ugent.be/hpc), # the Flemish Supercomputer Centre (VSC) (https://vscentrum.be/nl/en), # the Hercules foundation (htt...
gpl-2.0
devs1991/test_edx_docmode
venv/lib/python2.7/site-packages/pip/_vendor/requests/packages/chardet/sbcharsetprober.py
2927
4793
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 2001 # the Initial Developer. All R...
agpl-3.0
marcelometal/Django-facebook
docs/conf.py
2
7713
# -*- coding: utf-8 -*- # # Django Facebook documentation build configuration file, created by # sphinx-quickstart on Mon Apr 11 12:43:17 2011. # # 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
QTB-HHU/ModelHeatShock
HSM_VaryParamsRMSvsData.py
1
30309
from copy import deepcopy import math #from HSM_ParametersClass import * from HSM_SimulateClass import * def GenerateRandomParametersSets(NumberOfRandomSets, FactorOf, DefaultParamSetRATES): """GENERATE SETS OF RANDOM PARAMETERS FROM A FLAT DISTRIBUTION CENTERED AROUND FIDUCIAL VALUES AND WITHIN A FACTOR OF F...
gpl-3.0
samthor/intellij-community
python/lib/Lib/site-packages/django/contrib/formtools/tests.py
89
6613
import unittest from django import forms from django.contrib.formtools import preview, wizard, utils from django import http from django.test import TestCase success_string = "Done was called!" class TestFormPreview(preview.FormPreview): def done(self, request, cleaned_data): return http.HttpResponse(suc...
apache-2.0
shenzebang/scikit-learn
examples/exercises/plot_cv_digits.py
232
1206
""" ============================================= Cross-validation on Digits Dataset Exercise ============================================= A tutorial exercise using Cross-validation with an SVM on the Digits dataset. This exercise is used in the :ref:`cv_generators_tut` part of the :ref:`model_selection_tut` section...
bsd-3-clause
ledtvavs/repository.ledtv
script.mrknow.urlresolver/lib/urlresolver9/plugins/yourupload.py
4
1797
""" urlresolver XBMC Addon Copyright (C) 2011 t0mm0 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. ...
gpl-3.0
layus/INGInious
backend/tests/TestRemoteDocker.py
1
6508
# -*- coding: utf-8 -*- # # Copyright (c) 2014-2015 Université Catholique de Louvain. # # This file is part of INGInious. # # INGInious 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 o...
agpl-3.0
JoaoVasques/aws-devtool
eb/macosx/python3/lib/aws/requests/packages/chardet2/langbulgarianmodel.py
25
13035
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client 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 Ri...
apache-2.0
marinho/geraldo
site/newsite/site-geraldo/appengine_django/management/commands/update.py
60
1636
#!/usr/bin/python2.4 # # Copyright 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 or...
lgpl-3.0
kracwarlock/neon
neon/transforms/cross_entropy.py
7
11068
# ---------------------------------------------------------------------------- # Copyright 2014 Nervana Systems 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.o...
apache-2.0
AutorestCI/azure-sdk-for-python
azure-cognitiveservices-vision-customvision/azure/cognitiveservices/vision/customvision/prediction/prediction_endpoint.py
1
14280
# 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
vaidap/zulip
zilencer/views.py
3
4479
from __future__ import absolute_import from django.utils.translation import ugettext as _ from django.utils import timezone from django.http import HttpResponse, HttpRequest from zilencer.models import Deployment, RemotePushDeviceToken, RemoteZulipServer from zerver.decorator import has_request_variables, REQ from z...
apache-2.0
igemsoftware/SYSU-Software2013
project/Python27/Tools/scripts/findlinksto.py
100
1070
#! /usr/bin/env python # findlinksto # # find symbolic links to a path matching a regular expression import os import sys import re import getopt def main(): try: opts, args = getopt.getopt(sys.argv[1:], '') if len(args) < 2: raise getopt.GetoptError('not enough arguments', None) ...
mit
jonadiazz/spamFilterApp
venv/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.py
640
2524
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. ''' This module generates ANSI character codes to printing colors to terminals. See: http://en.wikipedia.org/wiki/ANSI_escape_code ''' CSI = '\033[' OSC = '\033]' BEL = '\007' def code_to_chars(code): return CSI + str(code) + 'm' def set...
unlicense
resmo/ansible
lib/ansible/modules/cloud/digital_ocean/_digital_ocean.py
49
15648
#!/usr/bin/python # -*- coding: utf-8 -*- # # 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', ...
gpl-3.0
Strubbl/pynder
pynder.py
1
7110
#!/usr/bin/env python # -*- coding: utf-8 -*- """ This file is part of Pynder. Pynder 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 ...
gpl-3.0
ric2b/Vivaldi-browser
chromium/components/ntp_snippets/remote/fetch.py
10
6937
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2017 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. """Fetches articles from the server. Examples: $ fetch.py # unauthenticated, no exp...
bsd-3-clause
mancoast/CPythonPyc_test
cpython/254_test_httplib.py
22
5580
import httplib import StringIO import sys from unittest import TestCase from test import test_support class FakeSocket: def __init__(self, text, fileclass=StringIO.StringIO): self.text = text self.fileclass = fileclass def sendall(self, data): self.data = data def makefile(self,...
gpl-3.0
m8ttyB/socorro
socorro/unittest/external/postgresql/unittestbase.py
14
3174
# 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/. from socorro.external.postgresql.connection_context import ConnectionContext from configman import ConfigurationManager,...
mpl-2.0
StephenWeber/ansible
lib/ansible/module_utils/_text.py
62
12325
# This code is part of Ansible, but is an independent component. # This particular file snippet, and this file snippet only, is BSD licensed. # Modules you write using this snippet, which is embedded dynamically by Ansible # still belong to the author of the module, and may assign their own license # to the complete wo...
gpl-3.0
mxOBS/deb-pkg_trusty_chromium-browser
third_party/pyftpdlib/src/setup.py
5
3799
#!/usr/bin/env python # $Id$ # # pyftpdlib is released under the MIT license, reproduced below: # ====================================================================== # Copyright (C) 2007-2012 Giampaolo Rodola' <g.rodola@gmail.com> # # All Rights Reserved # # Permission is hereby granted, f...
bsd-3-clause
JioCloud/oslo.middleware
oslo_middleware/tests/test_correlation_id.py
2
1713
# Copyright (c) 2013 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
melodous/designate
designate/schema/resolvers.py
1
1348
# Copyright 2013 Hewlett-Packard Development Company, L.P. # # Author: Kiall Mac Innes <kiall@hp.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/L...
apache-2.0
kawasaki2013/python-for-android-x86
python-modules/twisted/twisted/names/root.py
52
16410
# -*- test-case-name: twisted.names.test.test_rootresolve -*- # Copyright (c) 2001-2009 Twisted Matrix Laboratories. # See LICENSE for details. """ Resolver implementation for querying successive authoritative servers to lookup a record, starting from the root nameservers. @author: Jp Calderone todo:: robustify ...
apache-2.0
EVERROCKET/mobile-data
lib/jinja2/exceptions.py
977
4428
# -*- coding: utf-8 -*- """ jinja2.exceptions ~~~~~~~~~~~~~~~~~ Jinja exceptions. :copyright: (c) 2010 by the Jinja Team. :license: BSD, see LICENSE for more details. """ from jinja2._compat import imap, text_type, PY2, implements_to_string class TemplateError(Exception): """Baseclass for al...
apache-2.0
petewarden/tensorflow
tensorflow/python/autograph/converters/call_trees_test.py
14
6541
# python3 # 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 ...
apache-2.0
huanchenz/STX-h-store
third_party/python/boto/s3/bucket.py
9
48882
# Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2010, Eucalyptus Systems, Inc. # All rights reserved. # # 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 res...
gpl-3.0
soldag/home-assistant
tests/components/ipp/test_sensor.py
7
4325
"""Tests for the IPP sensor platform.""" from datetime import datetime 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 homeassistant.core import HomeAssistant f...
apache-2.0
adlnet-archive/edx-platform
common/lib/capa/capa/tests/test_shuffle.py
196
13736
"""Tests the capa shuffle and name-masking.""" import unittest import textwrap from . import test_capa_system, new_loncapa_problem from capa.responsetypes import LoncapaProblemError class CapaShuffleTest(unittest.TestCase): """Capa problem tests for shuffling and choice-name masking.""" def setUp(self): ...
agpl-3.0
pjh/vm-analyze
analyze/oldscripts/gather_proc.py
1
3609
#! /usr/bin/env python3.3 # Virtual memory analysis scripts. # Developed 2012-2014 by Peter Hornyack, pjh@cs.washington.edu # Copyright (c) 2012-2014 Peter Hornyack and University of Washington from vm_regex import * from pjh_utils import * import vm_common as vm import errno import os import re import stat import sys...
bsd-3-clause
andreasvc/disco-dop
web/browse.py
1
12449
"""Web interface to browse a corpus with various visualizations.""" # stdlib import os import re import sys import glob import math import logging from collections import OrderedDict from functools import wraps import matplotlib matplotlib.use('AGG') import matplotlib.cm as cm import pandas # Flask & co from flask impo...
gpl-2.0
varunmc/cassandra-server
apache-cassandra-2.1.0/pylib/cqlshlib/helptopics.py
2
30977
# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # "License"); you may not u...
apache-2.0
chenc10/Spark-PAF
dist/examples/src/main/python/mllib/isotonic_regression_example.py
3
2244
# # Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not us...
apache-2.0
phassoa/openelisglobal-core
liquibase/OE2.9/testCatalogHT_Clinical/scripts/testResult.py
6
3274
#!/usr/bin/env python # -*- coding: utf-8 -*- def convert_type_to_symbole( type): if type == 'Numeric' or type == 'numeric' : return 'N' if 'Free Text' in type: return 'R' if type == 'Select list': return 'D' if type == 'multi' or type == 'Multi Select': ret...
mpl-2.0
audiokit/csound
Opcodes/py/pycall-gen.py
5
7093
#!/usr/bin/env python # Copyright (C) 2002 Maurizio Umberto Puxeddu # This file is part of Csound. # The Csound Library is free software; you can redistribute it # and/or modify it under the terms of the GNU Lesser General Public # License as published by the Free Software Foundation; either # version...
lgpl-2.1
rahul67/hue
desktop/core/ext-py/python-openid-2.2.5/openid/test/test_openidyadis.py
87
4828
import unittest from openid.consumer.discover import \ OpenIDServiceEndpoint, OPENID_1_1_TYPE, OPENID_1_0_TYPE from openid.yadis.services import applyFilter XRDS_BOILERPLATE = '''\ <?xml version="1.0" encoding="UTF-8"?> <xrds:XRDS xmlns:xrds="xri://$xrds" xmlns="xri://$xrd*($v*2.0)" xmlns:...
apache-2.0
yjfcool/picasso-graphic
tools/gyp/build/lib/gyp/SCons.py
253
5848
# 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. """ SCons generator. This contains class definitions and supporting functions for generating pieces of SCons files for the different types of GYP targets. """ im...
bsd-3-clause
ahhda/sympy
sympy/solvers/tests/test_recurr.py
81
7203
from sympy import Eq, factorial, Function, Lambda, rf, S, sqrt, symbols, I, expand_func, binomial, gamma from sympy.solvers.recurr import rsolve, rsolve_hyper, rsolve_poly, rsolve_ratio from sympy.utilities.pytest import raises from sympy.core.compatibility import range from sympy.abc import a, b, c y = Function('y') ...
bsd-3-clause
cloud-rocket/python-OBD
obd/decoders.py
1
9011
######################################################################## # # # python-OBD: A python OBD-II serial module derived from pyobd # # # # Copyright 2004 Donour Siz...
gpl-2.0
tianweizhang/nova
nova/openstack/common/systemd.py
24
3057
# Copyright 2012-2014 Red Hat, 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
catapult-project/catapult-csm
telemetry/third_party/mox3/mox3/mox.py
28
70541
# Copyright 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 or agreed to in writing,...
bsd-3-clause
uranusjr/django
tests/indexes/models.py
57
1811
from django.db import connection, models class CurrentTranslation(models.ForeignObject): """ Creates virtual relation to the translation with model cache enabled. """ # Avoid validation requires_unique_target = False def __init__(self, to, on_delete, from_fields, to_fields, **kwargs): ...
bsd-3-clause
eemirtekin/edx-platform
cms/djangoapps/contentstore/tests/test_utils.py
17
24100
""" Tests for utils. """ import collections import copy import mock from datetime import datetime, timedelta from pytz import UTC from django.test import TestCase from django.test.utils import override_settings from contentstore import utils from contentstore.tests.utils import CourseTestCase from xmodule.modulestore...
agpl-3.0
paultcochrane/bokeh
bokeh/plotting.py
10
9238
from __future__ import absolute_import, print_function import logging logger = logging.getLogger(__name__) from . import _glyph_functions as gf from .models import Axis, Grid, GridPlot, Legend, LogAxis, Plot from .plotting_helpers import ( _list_attr_splat, _get_range, _get_axis_class, _get_num_minor_ticks, _proc...
bsd-3-clause
CTSRD-SOAAP/chromium-42.0.2311.135
third_party/pywebsocket/src/example/internal_error_wsh.py
465
1738
# Copyright 2012, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
bsd-3-clause
pfalcon/micropython
tests/basics/unpack1.py
45
1802
# unpack sequences a, = 1, ; print(a) a, b = 2, 3 ; print(a, b) a, b, c = 1, 2, 3; print(a, b, c) a, = range(1); print(a) a, b = range(2); print(a, b) a, b, c = range(3); print(a, b, c) (a) = range(1); print(a) (a,) = range(1); print(a) (a, b) = range(2); print(a, b) (a, b, c) = range(3); print(a, b, c) (a, (b, ...
mit
ryneches/SuchTree
SuchTree/tests/test_SuchTree.py
1
3768
from __future__ import print_function import pytest from pytest import approx from SuchTree import SuchTree from dendropy import Tree from itertools import combinations, chain import numpy try : import networkx has_networkx = True except ImportError : has_networkx = False test_tree = 'SuchTree/tests/test...
bsd-3-clause
jylaxp/django
django/core/mail/backends/base.py
577
1573
"""Base email backend class.""" class BaseEmailBackend(object): """ Base class for email backend implementations. Subclasses must at least overwrite send_messages(). open() and close() can be called indirectly by using a backend object as a context manager: with backend as connection: ...
bsd-3-clause
degano/root
tutorials/pyroot/qtexample.py
28
1721
import sys from PyQt4.QtGui import * from PyQt4.QtCore import * import ROOT import sip class window(QMainWindow): def __init__(self): # Init the main window. QMainWindow.__init__(self) self.resize(350, 350) # Create the central widget. self.CentralWidget = QWidget(self) ...
lgpl-2.1
ravindrapanda/tensorflow
tensorflow/contrib/rnn/python/ops/rnn.py
48
10799
# 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
NixaSoftware/CVis
venv/bin/libs/python/test/numpy.py
46
2433
# 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) false = 0; true = 1; import doctest, numeric_tests def _count_failures(test_modules = (numeric_tests,)): failures = 0 for m in...
apache-2.0
teamfx/openjfx-9-dev-rt
modules/javafx.web/src/main/native/Tools/Scripts/webkitpy/tool/commands/abstractsequencedcommand.py
122
2323
# Copyright (C) 2010 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the...
gpl-2.0
PrincetonUniversity/pox
pox/log/color.py
46
5311
# Copyright 2011 James McCauley # # 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 writi...
apache-2.0
haya14busa/alc-etm-searcher
nltk-3.0a3/nltk/test/unit/test_stem.py
4
1047
# -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals import unittest from nltk.stem.snowball import SnowballStemmer class SnowballTest(unittest.TestCase): def test_russian(self): # Russian words both consisting of Cyrillic # and Roman letters can be stemmed. stem...
mit
rue89-tech/edx-platform
common/lib/xmodule/xmodule/tests/test_editing_module.py
181
2640
""" Tests for editing descriptors""" import unittest import os import logging from mock import Mock from pkg_resources import resource_string from opaque_keys.edx.locations import Location from xmodule.editing_module import TabsEditingDescriptor from xblock.field_data import DictFieldData from xblock.fields import Sco...
agpl-3.0
MERegistro/meregistro
meregistro/apps/seguridad/models/Rol.py
1
1354
# -*- coding: UTF-8 -*- from django.db import models from apps.seguridad.models import Credencial, TipoAmbito class Rol(models.Model): ROL_ADMIN_NACIONAL = 'AdminNacional' ROL_ADMIN_SEGURIDAD = 'AdminSeguridad' ROL_REFERENTE_JURISDICCIONAL = 'ReferenteJurisdiccional' ROL_REFERENTE_INSTITUCIONAL ...
bsd-3-clause
vishnu-kumar/PeformanceFramework
rally/plugins/openstack/scenarios/murano/environments.py
11
2862
# Copyright 2015: 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
illicitonion/givabit
lib/sdks/google_appengine_1.7.1/google_appengine/google/appengine/_internal/django/utils/dateformat.py
23
8904
""" PHP date() style date formatting See http://www.php.net/date for format strings Usage: >>> import datetime >>> d = datetime.datetime.now() >>> df = DateFormat(d) >>> print df.format('jS F Y H:i') 7th October 2003 11:39 >>> """ import re import time import calendar from google.appengine._internal.django.utils.date...
apache-2.0
mkoistinen/cmsplugin-sections
cmsplugin_sections/models.py
2
2298
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models from django.utils.encoding import python_2_unicode_compatible #, force_text from django.utils.translation import ugettext_lazy as _ from .unique_slugify import unique_slugify from cms.models import CMSPlugin class Abstra...
mit
andymckay/django
tests/modeltests/m2o_recursive/tests.py
150
1722
from __future__ import absolute_import from django.test import TestCase from .models import Category, Person class ManyToOneRecursiveTests(TestCase): def setUp(self): self.r = Category(id=None, name='Root category', parent=None) self.r.save() self.c = Category(id=None, name='Child categ...
bsd-3-clause
joostvdg/jenkins-job-builder
tests/parallel/test_parallel.py
5
2380
# Copyright 2015 David Caro # # 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, softw...
apache-2.0
damdam-s/OCB
openerp/tools/__init__.py
337
1447
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 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
lukauskas/scipy
benchmarks/benchmarks/linalg.py
44
2636
from __future__ import division, absolute_import, print_function import numpy.linalg as nl import numpy as np from numpy.testing import assert_ from numpy.random import rand try: import scipy.linalg as sl except ImportError: pass from .common import Benchmark def random(size): return rand(*size) cla...
bsd-3-clause
codilime/contrail-controller
src/discovery/disc_chash.py
2
2278
# Copyright http://michaelnielsen.org/blog/consistent-hashing/ # import bisect import hashlib class ConsistentHash: '''ConsistentHash(rl,nr) creates a consistent hash object for a cluster of resources rl, using nr replicas. resource_list is list of resource names. hash_tuples is a list of tuples (j,k,hash), ...
apache-2.0
MikeC84/jet-3.4.10-gdd05a11
tools/perf/util/setup.py
4998
1330
#!/usr/bin/python2 from distutils.core import setup, Extension from os import getenv from distutils.command.build_ext import build_ext as _build_ext from distutils.command.install_lib import install_lib as _install_lib class build_ext(_build_ext): def finalize_options(self): _build_ext.finalize_optio...
gpl-2.0
FuzzyHobbit/scrapy
tests/test_engine.py
3
9519
""" Scrapy engine tests This starts a testing web server (using twisted.server.Site) and then crawls it with the Scrapy crawler. To view the testing web server in a browser you can start it by running this module with the ``runserver`` argument:: python test_engine.py runserver """ from __future__ import print_...
bsd-3-clause
uclaros/QGIS
python/plugins/db_manager/sqledit.py
33
6295
# -*- coding: utf-8 -*- """ *************************************************************************** ScriptEdit.py --------------------- Date : February 2014 Copyright : (C) 2014 by Alexander Bruy Email : alexander dot bruy at gmail dot com *************...
gpl-2.0
ImageEngine/gaffer
python/GafferUI/DotUI.py
7
6501
########################################################################## # # Copyright (c) 2014, Image Engine Design Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistrib...
bsd-3-clause
hasgeek/funnel
tests/unit/models/test_user_User.py
1
15870
from datetime import timedelta import pytest from coaster.utils import utcnow import funnel.models as models def test_user(db_session): """Test for creation of user object from User model.""" user = models.User(username='hrun', fullname="Hrun the Barbarian") db_session.add(user) db_session.commit() ...
agpl-3.0
z-e-r-o/plugin.video.osn
resources/lib/dns/grange.py
7
1860
# 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
schakrava/rockstor-core
src/rockstor/cli/rock_cli.py
2
8123
""" Copyright (c) 2012-2013 RockStor, Inc. <http://rockstor.com> This file is part of RockStor. RockStor is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any la...
gpl-3.0
adityacs/ansible
lib/ansible/modules/system/svc.py
37
10102
#!/usr/bin/python # -*- coding: utf-8 -*- # # (c) 2015, Brian Coca <bcoca@ansible.com> # # 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 Licen...
gpl-3.0
salomon1184/bite-project
deps/gdata-python-client/samples/apps/marketplace_sample/gdata/tlslite/VerifierDB.py
359
3104
"""Class for storing SRP password verifiers.""" from utils.cryptomath import * from utils.compat import * import mathtls from BaseDB import BaseDB class VerifierDB(BaseDB): """This class represent an in-memory or on-disk database of SRP password verifiers. A VerifierDB can be passed to a server handshake...
apache-2.0
jtratner/sudoku-fuzzer-udacity
fuzz_solver.py
1
9025
# Use a different solved board to generate different tests. valid = [[5,3,4,6,7,8,9,1,2], [6,7,2,1,9,5,3,4,8], [1,9,8,3,4,2,5,6,7], [8,5,9,7,6,1,4,2,3], [4,2,6,8,5,3,7,9,1], [7,1,3,9,2,4,8,5,6], [9,6,1,5,3,7,2,8,4], [2,8,7,4,1,9,6,3,5], [3,4,5,2,8,...
mit
pajlada/pajbot
pajbot/emoji.py
2
66638
ALL_EMOJI = [ "😀", "😃", "😄", "😁", "😆", "😅", "🤣", "😂", "🙂", "🙃", "😉", "😊", "😇", "🥰", "😍", "🤩", "😘", "😗", "☺️", "☺", "😚", "😙", "😋", "😛", "😜", "🤪", "😝", "🤑", "🤗", "🤭", "🤫...
mit
2015fallproject/2015fallcase1
static/Brython3.2.0-20150701-214155/Lib/contextlib.py
737
8788
"""Utilities for with-statement contexts. See PEP 343.""" import sys from collections import deque from functools import wraps __all__ = ["contextmanager", "closing", "ContextDecorator", "ExitStack"] class ContextDecorator(object): "A base class or mixin that enables context managers to work as decorators." ...
agpl-3.0
eric-stanley/youtube-dl
youtube_dl/extractor/morningstar.py
220
1732
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor class MorningstarIE(InfoExtractor): IE_DESC = 'morningstar.com' _VALID_URL = r'https?://(?:www\.)?morningstar\.com/[cC]over/video[cC]enter\.aspx\?id=(?P<id>[0-9]+)' _TEST = { 'url': 'http://www.mo...
unlicense
comjoy91/SKorean-Election_result-Crawler
crawlers/electorates/local_administration.py
2
4324
#!/usr/bin/env python # -*- encoding=utf-8 -*- from crawlers.electorates.base_provincePage import * from utils import sanitize, InvalidCrawlerError def Crawler(nth, election_name, electionType, target): if target == 'local-ea': if nth == 1: raise NotImplementedError('Educational Superintendent Election was not ...
apache-2.0
wujf/rethinkdb
scripts/visualize_log_serializer.py
48
25055
#!/usr/bin/env python # Copyright 2010-2012 RethinkDB, all rights reserved. from collections import namedtuple from parse_binary import * import sys, os, traceback def escape(string): return string.replace("&", "&amp;").replace("<", "&lt;").replace(">", "&gt;") def print_anchor(obj): print """<a name="o...
agpl-3.0
bak1an/django
django/contrib/auth/migrations/0001_initial.py
21
4965
import django.contrib.auth.models from django.contrib.auth import validators from django.db import migrations, models from django.utils import timezone class Migration(migrations.Migration): dependencies = [ ('contenttypes', '__first__'), ] operations = [ migrations.CreateModel( ...
bsd-3-clause
saurabh6790/medsynaptic-app
selling/doctype/lead/test_lead.py
30
1078
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals test_records = [ [{"doctype":"Lead", "lead_name": "_Test Lead", "status":"Open", "email_id":"test_lead@example.com", "territory": "_Test Territo...
agpl-3.0
pratikmallya/hue
desktop/core/ext-py/Django-1.6.10/tests/file_storage/tests.py
40
24415
# -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import errno import os import shutil import sys import tempfile import time import zlib from datetime import datetime, timedelta from io import BytesIO try: import threading except ImportError: import dummy_threading as threading...
apache-2.0
chiragjogi/odoo
addons/lunch/lunch.py
344
23407
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the G...
agpl-3.0
osspeak/osspeak
osspeak/recognition/commands/monitor.py
1
3535
import threading import collections import log import copy import asyncio import settings import clargs from recognition.actions.library import pywindow from recognition.commands import loader from recognition.actions import perform from communication import topics, pubsub import time def create_message_subscriptions...
mit
icereval/waterbutler
waterbutler/core/streams/base.py
7
3254
import abc import asyncio class BaseStream(asyncio.StreamReader, metaclass=abc.ABCMeta): def __init__(self, *args, **kwargs): super().__init__(*args, **kwargs) self.readers = {} self.writers = {} @abc.abstractproperty def size(self): pass def add_reader(self, name, r...
apache-2.0
andreaso/ansible
lib/ansible/modules/cloud/cloudstack/cs_pod.py
39
7969
#!/usr/bin/python # -*- coding: utf-8 -*- # # (c) 2016, René Moser <mail@renemoser.net> # # 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 Lice...
gpl-3.0
Senseg/Py4A
python3-alpha/extra_modules/gdata/tlslite/TLSConnection.py
48
70329
""" MAIN CLASS FOR TLS LITE (START HERE!). """ import socket from .utils.compat import formatExceptionTrace from .TLSRecordLayer import TLSRecordLayer from .Session import Session from .constants import * from .utils.cryptomath import getRandomBytes from .errors import * from .messages import * from .mathtls import *...
apache-2.0
2ndQuadrant/ansible
lib/ansible/module_utils/aws/iam.py
74
2029
# Copyright (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) import traceback try: from botocore.exceptions import ClientError, NoCredentialsError except ImportError: pass # caught by HAS_BOTO3 from ansible.module_utils._text import to_nat...
gpl-3.0
thisisshi/cloud-custodian
tools/c7n_azure/tests_azure/tests_resources/test_event_hub.py
2
4550
# Copyright The Cloud Custodian Authors. # SPDX-License-Identifier: Apache-2.0 from ..azure_common import BaseTest, arm_template, cassette_name class EventHubTest(BaseTest): def test_event_hub_schema_validate(self): with self.sign_out_patch(): p = self.load_policy({ 'name': 't...
apache-2.0
QuLogic/iris
lib/iris/tests/unit/analysis/trajectory/test_Trajectory.py
3
2794
# (C) British Crown Copyright 2016, Met Office # # This file is part of Iris. # # Iris is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option) any later ve...
gpl-3.0
jamielennox/django-openstack-auth-websso
openstack_auth_websso/plugin.py
1
2014
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
apache-2.0
denisenkom/django-sqlserver
tests/multiple_database/routers.py
379
1927
from __future__ import unicode_literals from django.db import DEFAULT_DB_ALIAS class TestRouter(object): """ Vaguely behave like primary/replica, but the databases aren't assumed to propagate changes. """ def db_for_read(self, model, instance=None, **hints): if instance: retu...
mit
GaetanCambier/CouchPotatoServer
couchpotato/core/media/movie/providers/trailer/youtube_dl/extractor/urort.py
172
2248
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..compat import ( compat_urllib_parse, ) from ..utils import ( unified_strdate, ) class UrortIE(InfoExtractor): IE_DESC = 'NRK P3 Urørt' _VALID_URL = r'https?://(?:www\.)?urort\.p3\.no/#!/Band/(?P<id>[^/]+)...
gpl-3.0
0x0aNL/p2pool-0x0a
p2pool/bitcoin/networks/usde.py
8
1210
import os import platform from twisted.internet import defer from .. import data, helper from p2pool.util import pack P2P_PREFIX = 'd9d9f9bd'.decode('hex') #pchmessagestart P2P_PORT = 54449 ADDRESS_VERSION = 38 #pubkey_address RPC_PORT = 54448 RPC_CHECK = defer.inlineCallbacks(lambda bitcoind: defer.returnValue( ...
gpl-3.0
Tesora/tesora-horizon
openstack_dashboard/test/api_tests/network_tests.py
15
35376
# Copyright 2013 NEC 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 # # Unless required by applicable law or ag...
apache-2.0
marierm/supercollider
external_libraries/simplejson-2.3.2/encoder.py
44
20259
"""Implementation of JSONEncoder """ import re from decimal import Decimal def _import_speedups(): try: from . import _speedups return _speedups.encode_basestring_ascii, _speedups.make_encoder except ImportError: return None, None c_encode_basestring_ascii, c_make_encoder = _import_spee...
gpl-3.0
georgtroska/root
interpreter/llvm/src/tools/clang/bindings/python/tests/cindex/test_code_completion.py
93
2766
from clang.cindex import TranslationUnit def check_completion_results(cr, expected): assert cr is not None assert len(cr.diagnostics) == 0 completions = [str(c) for c in cr.results] for c in expected: assert c in completions def test_code_complete(): files = [('fake.c', """ /// Aaa. int ...
lgpl-2.1