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 |
|---|---|---|---|---|---|
ocefpaf/paegan-transport | tests/test_capability.py | 2 | 1860 | import unittest
from paegan.transport.models.behaviors.capability import Capability
import os
import json
class CapabilityTest(unittest.TestCase):
def test_from_json(self):
data = open(os.path.normpath(os.path.join(os.path.dirname(__file__), "./resources/files/capability_behavior.json"))).read()
... | gpl-3.0 |
BlaisProteomics/mzStudio | mzStudio/Filter_management.py | 1 | 11580 | __author__ = 'Scott Ficarro, William Max Alexander'
__version__ = '1.0'
#Filter management
import re
def Onms1(filter_dict, id):
filter_dict["mode"]="ms1"
filter_dict["analyzer"]=id.groups()[0]
filter_dict["data"]= "+cent" if id.groups()[1]== "c" else "+prof"
filter_dict["mr"]='[' + id.groups()[2]+'-... | gpl-3.0 |
jalr/privacyidea | privacyidea/webui/login.py | 1 | 3977 | # -*- coding: utf-8 -*-
#
# http://www.privacyidea.org
# (c) cornelius kölbel, privacyidea.org
#
# 2016-01-07 Cornelius Kölbel <cornelius@privacyidea.org>
# Add password reset
# 2015-11-04 Cornelius Kölbel <cornelius@privacyidea.org>
# Add REMOTE_USER check
# 2014-12-22 Cornelius Kölbel, <corneliu... | agpl-3.0 |
yunity/yunity-core | karrot/activities/stats.py | 1 | 2443 | from influxdb_metrics.loader import write_points
from karrot.groups.stats import group_tags
def activity_tags(activity):
tags = group_tags(activity.place.group)
tags.update({
'place': str(activity.place.id),
'type': str(activity.activity_type.id),
'type_name': activity.activity_type.n... | agpl-3.0 |
JoshRosen/hyde | tests/test_htaccess.py | 58 | 1455 | """
Tests of .htaccess file generation.
For now, this just checks whether the demo site's generated .htaccess file
matches a known good file.
"""
import os
import sys
from django.conf import settings
TEST_ROOT = os.path.dirname(os.path.abspath(__file__))
ROOT = os.path.abspath(TEST_ROOT + "/..")
sys.path = [ROOT]... | mit |
BosNaufal/statistika | src/vendor/ionicons/builder/scripts/generate_font.py | 348 | 5381 | # Font generation script from FontCustom
# https://github.com/FontCustom/fontcustom/
# http://fontcustom.com/
import fontforge
import os
import md5
import subprocess
import tempfile
import json
import copy
SCRIPT_PATH = os.path.dirname(os.path.abspath(__file__))
INPUT_SVG_DIR = os.path.join(SCRIPT_PATH, '..', '..', '... | mit |
blackzw/openwrt_sdk_dev1 | staging_dir/host/lib/python2.7/distutils/sysconfig.py | 24 | 22287 | """Provide access to Python's configuration information. The specific
configuration variables available depend heavily on the platform and
configuration. The values may be retrieved using
get_config_var(name), and the list of variables is available via
get_config_vars().keys(). Additional convenience functions are a... | gpl-2.0 |
richardcs/ansible | lib/ansible/modules/windows/win_find.py | 52 | 9498 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2016, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# this is a windows documentation stub. actual code lives in the .ps1
# file of the same name
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
Vimos/scikit-learn | examples/svm/plot_separating_hyperplane_unbalanced.py | 25 | 1866 | """
=================================================
SVM: Separating hyperplane for unbalanced classes
=================================================
Find the optimal separating hyperplane using an SVC for classes that
are unbalanced.
We first find the separating plane with a plain SVC and then plot
(dashed) the ... | bsd-3-clause |
ssomenzi/silence | node_modules/laravel-elixir/node_modules/gulp-sass/node_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/ordered_dict.py | 2354 | 10366 | # Unmodified from http://code.activestate.com/recipes/576693/
# other than to add MIT license header (as specified on page, but not in code).
# Linked from Python documentation here:
# http://docs.python.org/2/library/collections.html#collections.OrderedDict
#
# This should be deleted once Py2.7 is available on all bot... | agpl-3.0 |
snakeleon/YouCompleteMe-x86 | python/ycm/vimsupport.py | 1 | 38641 | # Copyright (C) 2011-2012 Google Inc.
# 2016 YouCompleteMe contributors
#
# This file is part of YouCompleteMe.
#
# YouCompleteMe 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 versi... | gpl-3.0 |
bdupharm/sqlalchemy | test/ext/test_mutable.py | 4 | 28657 | from sqlalchemy import Integer, ForeignKey, String
from sqlalchemy.types import PickleType, TypeDecorator, VARCHAR
from sqlalchemy.orm import mapper, Session, composite
from sqlalchemy.orm.mapper import Mapper
from sqlalchemy.orm.instrumentation import ClassManager
from sqlalchemy.testing.schema import Table, Column
fr... | mit |
accomac/namebench | nb_third_party/dns/inet.py | 248 | 3236 | # Copyright (C) 2003-2007, 2009, 2010 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 ... | apache-2.0 |
szopu/django | django/contrib/gis/gdal/srs.py | 15 | 12001 | """
The Spatial Reference class, represents OGR Spatial Reference objects.
Example:
>>> from django.contrib.gis.gdal import SpatialReference
>>> srs = SpatialReference('WGS84')
>>> print(srs)
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORITY... | bsd-3-clause |
Workday/OpenFrame | tools/telemetry/third_party/gsutilz/third_party/boto/boto/sqs/__init__.py | 129 | 1705 | # Copyright (c) 2006-2012 Mitch Garnaat http://garnaat.org/
#
# 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 rights to use, copy, modi... | bsd-3-clause |
darktears/chromium-crosswalk | tools/perf/page_sets/login_helpers/login_utils.py | 25 | 2047 | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import json
import os
DEFAULT_CREDENTIAL_PATH = os.path.join(
os.path.dirname(__file__), os.path.pardir, 'data', 'credentials.json')
def GetAccountNa... | bsd-3-clause |
tgarc/rideagg | requests/packages/urllib3/contrib/ntlmpool.py | 714 | 4741 | # urllib3/contrib/ntlmpool.py
# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
#
# This module is part of urllib3 and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
NTLM authenticating pool, contributed by erikcederstran
Issue #10, see: http://co... | apache-2.0 |
bkg/django-spillway | spillway/fields.py | 1 | 2068 | """Serializer fields"""
from __future__ import absolute_import
import collections
from django.contrib.gis import geos, forms
from django.db.models.query import QuerySet
from rest_framework import renderers
from rest_framework.fields import Field, FileField
from spillway.compat import json
from spillway.forms import f... | bsd-3-clause |
godfather1103/WeiboRobot | python27/1.0/lib/ctypes/test/test_python_api.py | 35 | 2955 | from ctypes import *
import unittest, sys
from ctypes.test import requires
################################################################
# This section should be moved into ctypes\__init__.py, when it's ready.
from _ctypes import PyObj_FromPtr
################################################################
from... | gpl-3.0 |
tlakshman26/cinder-https-changes | cinder/volume/flows/api/manage_existing.py | 17 | 6017 | # 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 |
3dfxsoftware/cbss-addons | poi_pos_cashier_lock/__init__.py | 3 | 1093 | # -*- 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... | gpl-2.0 |
joeythesaint/yocto-autobuilder | lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/test/test_threads.py | 5 | 13048 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Test methods in twisted.internet.threads and reactor thread APIs.
"""
import sys, os, time
from twisted.trial import unittest
from twisted.internet import reactor, defer, interfaces, threads, protocol, error
from twisted.python import fail... | gpl-2.0 |
harrisonfeng/pip | pip/_vendor/distlib/resources.py | 224 | 10615 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Vinay Sajip.
# Licensed to the Python Software Foundation under a contributor agreement.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
from __future__ import unicode_literals
import bisect
import io
import logging
import os
import pkgutil
import shutil
import sys
import types... | mit |
thenenadx/forseti-security | google/cloud/security/notifier/pipelines/email_violations_pipeline.py | 2 | 5623 |
# Copyright 2017 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, ... | apache-2.0 |
mpurzynski/MozDef | tests/alerts/geomodel/test_factors.py | 1 | 2514 | from datetime import datetime
import alerts.geomodel.alert as alert
import alerts.geomodel.factors as factors
class MockMMDB:
'''Mocks a MaxMind database connection with a dictionary of records mapping
IP adresses to dictionaries containing information about ASNs.
'''
def __init__(self, records):
... | mpl-2.0 |
Captain-Coder/tribler | Tribler/Core/Modules/channel/channel.py | 1 | 5233 | import codecs
import collections
import logging
import os
from binascii import hexlify
from twisted.internet import reactor
from twisted.internet.defer import DeferredList
from Tribler.Core.Modules.channel.channel_rss import ChannelRssParser
import Tribler.Core.Utilities.json_util as json
from Tribler.Core.simpledefs ... | lgpl-3.0 |
rayrrr/luigi | test/contrib/hadoop_test.py | 5 | 18230 | # -*- coding: utf-8 -*-
#
# Copyright 2012-2015 Spotify AB
#
# 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... | apache-2.0 |
vkscool/nupic | tests/unit/nupic/data/functionsource_test.py | 9 | 3242 | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2015, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | gpl-3.0 |
PopCap/GameIdea | Engine/Source/ThirdParty/HTML5/emsdk/emscripten/1.30.0/third_party/ply/test/lex_hedit.py | 174 | 1141 | # -----------------------------------------------------------------------------
# hedit.py
#
# Paring of Fortran H Edit descriptions (Contributed by Pearu Peterson)
#
# These tokens can't be easily tokenized because they are of the following
# form:
#
# nHc1...cn
#
# where n is a positive integer and c1 ... cn are ch... | bsd-2-clause |
denny820909/builder | lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/python/test/test_hashlib.py | 27 | 3308 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.python.hashlib}
"""
from twisted.trial.unittest import TestCase
from twisted.python.hashlib import md5, sha1
class HashObjectTests(TestCase):
"""
Tests for the hash object APIs presented by L{hashlib}, C{md5} an... | mit |
TripleDogDare/RadioWCSpy | backend/env/lib/python2.7/site-packages/setuptools/archive_util.py | 520 | 6609 | """Utilities for extracting common archive formats"""
__all__ = [
"unpack_archive", "unpack_zipfile", "unpack_tarfile", "default_filter",
"UnrecognizedFormat", "extraction_drivers", "unpack_directory",
]
import zipfile
import tarfile
import os
import shutil
import posixpath
import contextlib
from pkg_resourc... | mit |
bharath2020/SmartHome | temperature-sensor/temperature_sensor.py | 1 | 1403 | import Adafruit_DHT
import time
import json
import httplib
import sys
URL='bb-smart-home.herokuapp.com'
DEVICE_NAME ='raspberry'
def temperature_humidity(sensor,pin):
humidity, temperature = Adafruit_DHT.read_retry(sensor,pin)
if humidity is not None and temperature is not None:
return [temperature,humidity]
els... | apache-2.0 |
boundarydevices/android_external_chromium_org | build/android/gyp/get_device_configuration.py | 103 | 2134 | #!/usr/bin/env python
#
# Copyright 2013 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""Gets and writes the configurations of the attached devices.
This configuration is used by later build steps to determine which de... | bsd-3-clause |
Ale-/civics | apps/api/urls.py | 1 | 1342 | from django.conf.urls import url, include
from apps.models.models import Initiative
from . import views
urlpatterns = [
url(r'^initiative$', views.initiative_service, name='get_initiative'),
url(r'^initiatives$', views.initiatives_service, name='get_initiatives'),
url(r'^initiatives_featured$', views.initi... | gpl-3.0 |
dol-sen/gentoo-keys | gkeys/log.py | 1 | 2035 | #
#-*- coding:utf-8 -*-
"""
Gentoo-Keys - Log.py
Logging module, placeholder for our site-wide logging module
@copyright: 2012 by Brian Dolbec <dol-sen> <dol-sen@users.sourceforge.net>
@license: GNU GPL2, see COPYING for details.
"""
import logging
import time
import os
NAMESPACE = 'gentoo-keys'
l... | gpl-2.0 |
ljbade/libswiftnav | python/tests/test_lambda.py | 1 | 4184 | #!/usr/bin/env python
# Copyright (C) 2015 Swift Navigation Inc.
# Copyright (C) 2007-2008 by T.TAKASU, All rights reserved.
# Contact: Bhaskar Mookerji <mookerji@swiftnav.com>
#
# This source is subject to the license found in the file 'LICENSE' which must
# be be distributed together with this source. All other right... | lgpl-3.0 |
thumbor-community/shortener | tc_shortener/handlers/shortener.py | 1 | 3214 | # -*- coding: utf-8 -*-
# Copyright (c) 2016, thumbor-community
# Use of this source code is governed by the MIT license that can be
# found in the LICENSE file.
import os.path
import tornado.gen as gen
import tornado.web
import urlparse
import json
from thumbor.handlers.imaging import ImagingHandler
from thumbor.ut... | mit |
gannetson/django | django/middleware/security.py | 510 | 1753 | import re
from django.conf import settings
from django.http import HttpResponsePermanentRedirect
class SecurityMiddleware(object):
def __init__(self):
self.sts_seconds = settings.SECURE_HSTS_SECONDS
self.sts_include_subdomains = settings.SECURE_HSTS_INCLUDE_SUBDOMAINS
self.content_type_no... | bsd-3-clause |
Lujeni/ansible | lib/ansible/modules/network/fortios/fortios_system_proxy_arp.py | 13 | 9662 | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, 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 the Lic... | gpl-3.0 |
Lujeni/ansible | test/units/modules/cloud/amazon/test_aws_api_gateway.py | 13 | 1943 | #
# (c) 2016 Michael De La Rue
#
# This file is part of Ansible
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import sys
import pytest
from ansible.mo... | gpl-3.0 |
lorentey/swift | utils/build_swift/argparse/__init__.py | 23 | 1658 | # This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.txt for license information
# See https://swift.org/CONTRIBUTORS.txt for the list o... | apache-2.0 |
acshi/osf.io | addons/github/tests/utils.py | 16 | 9354 | import mock
import github3
from addons.github.api import GitHubClient
from github3.repos.branch import Branch
from addons.base.tests.base import OAuthAddonTestCaseMixin, AddonTestCase
from addons.github.models import GitHubProvider
from addons.github.tests.factories import GitHubAccountFactory
class GitHubAddonTestC... | apache-2.0 |
bonitadecker77/python-for-android | python-build/python-libs/gdata/build/lib/gdata/tlslite/utils/cipherfactory.py | 357 | 3177 | """Factory functions for symmetric cryptography."""
import os
import Python_AES
import Python_RC4
import cryptomath
tripleDESPresent = False
if cryptomath.m2cryptoLoaded:
import OpenSSL_AES
import OpenSSL_RC4
import OpenSSL_TripleDES
tripleDESPresent = True
if cryptomath.cryptlibpyLoaded:
impo... | apache-2.0 |
dennisss/sympy | sympy/mpmath/libmp/libmpi.py | 18 | 27592 | """
Computational functions for interval arithmetic.
"""
from .backend import xrange
from .libmpf import (
ComplexResult,
round_down, round_up, round_floor, round_ceiling, round_nearest,
prec_to_dps, repr_dps, dps_to_prec,
bitcount,
from_float,
fnan, finf, fninf, fzero, fhalf, fone, fnone,
... | bsd-3-clause |
jckarter/swift | test/SourceKit/Inputs/sourcekitd_path_sanitize.py | 20 | 1315 | #!/usr/bin/env python
# sourcekitd_path_sanitize.py - Cleans up paths from sourcekitd-test output
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2019 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://s... | apache-2.0 |
rajadhva/servo | tests/wpt/harness/wptrunner/browsers/b2g.py | 117 | 8016 | # 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/.
import os
import tempfile
import shutil
import subprocess
import fxos_appgen
import gaiatest
import mozdevice
import mo... | mpl-2.0 |
javiplx/debian-devel | cobbler/config.py | 3 | 7320 | """
Config.py is a repository of the Cobbler object model
Copyright 2006-2008, Red Hat, Inc
Michael DeHaan <mdehaan@redhat.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 2 of th... | gpl-2.0 |
Javantea/satispy | satispy/cnf.py | 1 | 5607 | cnfClass = None
class Variable(object):
def __init__(self, name, inverted=False):
self.name = name
self.inverted = inverted
def __neg__(self):
v = Variable(self.name)
v.inverted = not self.inverted
return v
def __and__(self, other):
c = cnfClass.create_from... | bsd-3-clause |
RouxRC/weboob | modules/happn/module.py | 4 | 12367 | # -*- coding: utf-8 -*-
# Copyright(C) 2014 Roger Philibert
#
# This file is part of weboob.
#
# weboob 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 yo... | agpl-3.0 |
geminy/aidear | oss/qt/qt-everywhere-opensource-src-5.9.0/qtwebengine/src/3rdparty/chromium/tools/auto_bisect/ttest_test.py | 58 | 4977 | # 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.
"""Unit tests for ttest module."""
import unittest
import ttest
# This test case accesses private functions of the ttest module.
# pylint: disable=W0212
... | gpl-3.0 |
popcornmix/xbmc | lib/gtest/test/gtest_xml_test_utils.py | 1815 | 8876 | #!/usr/bin/env python
#
# Copyright 2006, 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... | gpl-2.0 |
mrunge/horizon | openstack_dashboard/dashboards/admin/hypervisors/tabs.py | 59 | 1512 | # 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 th... | apache-2.0 |
garretlh/nimbus | nimbus-drivers/src/main/python/nimbusdrivers/wmr9x8.py | 3 | 25529 | #
# Copyright (c) 2012 Will Page <compenguy@gmail.com>
# See the file LICENSE.txt for your full rights.
#
# Derivative of vantage.py and wmr100.py, credit to Tom Keffer
"""Classes and functions for interfacing with Oregon Scientific WM-918, WMR9x8 and WMR-968 weather stations
See http://wx200.planetfall.com/wx200... | gpl-3.0 |
lmyrefelt/CouchPotatoServer | libs/requests/packages/charade/sbcsgroupprober.py | 2936 | 3291 | ######################## 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... | gpl-3.0 |
yitian134/chromium | media/tools/layout_tests/layouttest_analyzer_runner.py | 27 | 8716 | #!/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.
"""Main function to run the layout test analyzer.
The purpose of this script is to run the layout test analyzer for various
teams ... | bsd-3-clause |
adamlwgriffiths/Pyglet | doc/ext/autosummary/__init__.py | 5 | 17735 | # -*- coding: utf-8 -*-
"""
sphinx.ext.autosummary
~~~~~~~~~~~~~~~~~~~~~~
Sphinx extension that adds an autosummary:: directive, which can be
used to generate function/method/attribute/etc. summary lists, similar
to those output eg. by Epydoc and other API doc generation tools.
An :autolink: r... | bsd-3-clause |
tmxdyf/CouchPotatoServer | libs/pyutil/cache.py | 106 | 27000 | # Copyright (c) 2002-2010 Zooko "Zooko" Wilcox-O'Hearn
"""
This module offers three implementations of an LRUCache, which is a dict that
drops items according to a Least-Recently-Used policy if the dict exceeds a
fixed maximum size.
Warning: if -O optimizations are not turned on then LRUCache performs
extensive self... | gpl-3.0 |
lihui7115/ChromiumGStreamerBackend | components/test/data/password_manager/automated_tests/environment.py | 33 | 11064 | # 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.
"""The testing Environment class.
It holds the WebsiteTest instances, provides them with credentials,
provides clean browser environment, runs the tests, an... | bsd-3-clause |
dklyle/trove-dashboard | trove_dashboard/content/database_clusters/panel.py | 4 | 1044 | # Copyright (c) 2014 eBay Software Foundation
# Copyright 2015 HP Software, LLC
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.o... | apache-2.0 |
classgrade/classgrade | classgrade/gradapp/tasks.py | 1 | 8924 | # coding=utf-8
import csv
import logging
from random import shuffle
from django.core.mail import send_mail
from django.core.exceptions import ObjectDoesNotExist
from django.contrib.auth.models import User
from xkcdpass import xkcd_password as xp
from unidecode import unidecode
from classgrade import settings
from grada... | mit |
linearregression/phoenix-1 | bin/phoenix_utils.py | 9 | 6567 | #!/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 A... | apache-2.0 |
hehongliang/tensorflow | tensorflow/python/data/experimental/kernel_tests/serialization/csv_dataset_serialization_test.py | 21 | 2558 | # Copyright 2018 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 |
glatard/nipype | nipype/interfaces/slicer/tests/test_auto_OrientScalarVolume.py | 9 | 1165 | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from nipype.testing import assert_equal
from nipype.interfaces.slicer.converters import OrientScalarVolume
def test_OrientScalarVolume_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_... | bsd-3-clause |
A-HostMobile/MobileApp | node_modules/node-gyp/gyp/pylib/gyp/__init__.py | 1524 | 22178 | #!/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.
import copy
import gyp.input
import optparse
import os.path
import re
import shlex
import sys
import traceback
from gyp.common import GypErr... | apache-2.0 |
jzoldak/edx-platform | common/djangoapps/student/tests/test_auto_auth.py | 9 | 11047 | from django.test import TestCase
from django.test.client import Client
from django.contrib.auth.models import User
from django.conf import settings
from django_comment_common.models import (
Role, FORUM_ROLE_ADMINISTRATOR, FORUM_ROLE_MODERATOR, FORUM_ROLE_STUDENT)
from django_comment_common.utils import seed_permis... | agpl-3.0 |
drhee/toxoMine | intermine/python/tests/test_templates.py | 2 | 7133 | import unittest
from test import WebserviceTest
from intermine.webservice import *
from intermine.query import Template
from intermine.constraints import TemplateConstraint
class TestTemplates(WebserviceTest): # pragma: no cover
def setUp(self):
self.service = Service(self.get_test_root())
def testG... | lgpl-2.1 |
abloomston/sympy | sympy/matrices/expressions/matadd.py | 65 | 3328 | from __future__ import print_function, division
from sympy.core.compatibility import reduce
from operator import add
from sympy.core import Add, Basic, sympify
from sympy.functions import adjoint
from sympy.matrices.matrices import MatrixBase
from sympy.matrices.expressions.transpose import transpose
from sympy.strat... | bsd-3-clause |
CapOM/ChromiumGStreamerBackend | tools/telemetry/third_party/webpagereplay/third_party/dns/reversename.py | 248 | 2931 | # Copyright (C) 2006, 2007, 2009, 2010 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... | bsd-3-clause |
spbguru/repo1 | external/linux32/lib/python2.6/site-packages/matplotlib/backends/backend_emf.py | 69 | 22336 | """
Enhanced Metafile backend. See http://pyemf.sourceforge.net for the EMF
driver library.
"""
from __future__ import division
try:
import pyemf
except ImportError:
raise ImportError('You must first install pyemf from http://pyemf.sf.net')
import os,sys,math,re
from matplotlib import verbose, __version__,... | gpl-3.0 |
CTSRD-SOAAP/chromium-42.0.2311.135 | third_party/yasm/source/patched-yasm/modules/arch/x86/gen_x86_insn.py | 18 | 292359 | #! /usr/bin/env python
# x86 instructions and prefixes data and code generation
#
# Copyright (C) 2002-2007 Peter Johnson
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
# 1. Redistributions of source code must reta... | bsd-3-clause |
miguelfervi/SSBW-Restaurantes | restaurantes/lib/python2.7/site-packages/django/utils/_os.py | 502 | 3581 | from __future__ import unicode_literals
import os
import sys
import tempfile
from os.path import abspath, dirname, isabs, join, normcase, normpath, sep
from django.core.exceptions import SuspiciousFileOperation
from django.utils import six
from django.utils.encoding import force_text
if six.PY2:
fs_encoding = sy... | gpl-3.0 |
ufkapano/py-quats | src/qtools.py | 1 | 1769 | #!/usr/bin/python
import math
import random
from quats import Quat
# Rotates a vector with respect to a quat.
# The vector is from R^3, the result is from R^3, rot_quat is a unit quat.
def rotate1(vector, unit_quat):
"""Return the rotated vector (rot_quat used)."""
# From a vector to a quaternion.
vec_qua... | bsd-3-clause |
Learningtribes/edx-platform | common/djangoapps/terrain/stubs/http.py | 28 | 8643 | """
Stub implementation of an HTTP service.
"""
from BaseHTTPServer import HTTPServer, BaseHTTPRequestHandler
import urllib
import urlparse
import threading
import json
from functools import wraps
from lazy import lazy
from logging import getLogger
LOGGER = getLogger(__name__)
def require_params(method, *required_k... | agpl-3.0 |
ToBaer94/PygameTowerDefense | level.py | 1 | 4685 | import pygame as pg
import tilerenderer
from tower import Tower, CannonTower, ExplosiveTower, FireTower, SlowTower, MultiTower, LaserTower, CrescentTower
from trap import Mine
from creep import Creep, Worm, Behemoth, SwiftWalker
from os import path, pardir
import random
Vector = pg.math.Vector2
CREEP = 0
WORM = 1
B... | lgpl-3.0 |
eul-721/The-Perfect-Pokemon-Team-Balancer | libs/env/Lib/distutils/__init__.py | 1211 | 3983 | import os
import sys
import warnings
import imp
import opcode # opcode is not a virtualenv module, so we can use it to find the stdlib
# Important! To work on pypy, this must be a module that resides in the
# lib-python/modified-x.y.z directory
dirname = os.path.dirname
distutils_path = o... | gpl-2.0 |
AlanCoding/tower-cli | tower_cli/utils/__init__.py | 2 | 1424 | # Copyright 2015, Ansible, Inc.
# Luke Sneeringer <lsneeringer@ansible.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/LICENSE-2.0
#
# Unless requi... | apache-2.0 |
sssemil/cjdns | node_build/dependencies/libuv/build/gyp/test/no-cpp/gyptest-no-cpp.py | 47 | 1500 | #!/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.
"""
Checks that C-only targets aren't linked against libstdc++.
"""
import TestGyp
import re
import subprocess
import sys
# set |match| t... | gpl-3.0 |
cntnboys/410Lab6 | build/django/build/lib.linux-x86_64-2.7/django/db/migrations/questioner.py | 119 | 7690 | from __future__ import print_function, unicode_literals
import importlib
import os
import sys
from django.apps import apps
from django.db.models.fields import NOT_PROVIDED
from django.utils import datetime_safe, six, timezone
from django.utils.six.moves import input
from .loader import MIGRATIONS_MODULE_NAME
class... | apache-2.0 |
Sidney84/pa-chromium | remoting/tools/zip2msi.py | 76 | 8258 | #!/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.
"""Generates .msi from a .zip archive or an unpacked directory.
The structure of the input archive or directory should look like t... | bsd-3-clause |
seales/PHINet | PHINetCloud/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/input.py | 292 | 114315 | # Copyright (c) 2012 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from compiler.ast import Const
from compiler.ast import Dict
from compiler.ast import Discard
from compiler.ast import List
from compiler.ast import Module
from co... | mit |
ATIX-AG/foreman-ansible-modules | plugins/modules/setting.py | 1 | 3129 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2018 Matthias M Dellweg (ATIX AG)
#
# 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 lat... | gpl-3.0 |
2014c2g23/2015cda | static/Brython3.1.1-20150328-091302/Lib/unittest/test/test_skipping.py | 744 | 5173 | import unittest
from .support import LoggingResult
class Test_TestSkipping(unittest.TestCase):
def test_skipping(self):
class Foo(unittest.TestCase):
def test_skip_me(self):
self.skipTest("skip")
events = []
result = LoggingResult(events)
test = Foo("t... | gpl-3.0 |
Bitl/RBXLegacy-src | Cut/RBXLegacyDiscordBot/lib/requests/cookies.py | 109 | 18208 | # -*- coding: utf-8 -*-
"""
requests.cookies
~~~~~~~~~~~~~~~~
Compatibility code to be able to use `cookielib.CookieJar` with requests.
requests.utils imports from here, so be careful with imports.
"""
import copy
import time
import calendar
import collections
from ._internal_utils import to_native_string
from .co... | gpl-3.0 |
Carreau/pytest | testing/test_recwarn.py | 3 | 2465 | import py, pytest
from _pytest.recwarn import WarningsRecorder
def test_WarningRecorder(recwarn):
showwarning = py.std.warnings.showwarning
rec = WarningsRecorder()
assert py.std.warnings.showwarning != showwarning
assert not rec.list
py.std.warnings.warn_explicit("hello", UserWarning, "xyz", 13)
... | mit |
0111001101111010/open-health-inspection-api | venv/lib/python2.7/site-packages/flask/logging.py | 838 | 1398 | # -*- coding: utf-8 -*-
"""
flask.logging
~~~~~~~~~~~~~
Implements the logging support for Flask.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from logging import getLogger, StreamHandler, Formatter, getLoggerClas... | gpl-2.0 |
xhchrn/gegan | model/utils.py | 1 | 3045 | # -*- coding: utf-8 -*-
from __future__ import print_function
from __future__ import absolute_import
import os
import glob
import math
import imageio
import scipy.misc as misc
import numpy as np
from PIL import Image
def pad_seq(seq, batch_size):
# pad the sequence to be the multiples of batch_size
seq_len ... | apache-2.0 |
Ninjakow/TrueSkill | lib/numpy/core/tests/test_dtype.py | 30 | 25540 | from __future__ import division, absolute_import, print_function
import sys
import numpy as np
from numpy.core.test_rational import rational
from numpy.testing import (
TestCase, run_module_suite, assert_, assert_equal, assert_raises,
dec
)
def assert_dtype_equal(a, b):
assert_equal(a, b)
assert_equa... | gpl-3.0 |
naparuba/opsbro | opsbro/misc/internalcherrypy/cherrypy/lib/cpstats.py | 49 | 22770 | """CPStats, a package for collecting and reporting on program statistics.
Overview
========
Statistics about program operation are an invaluable monitoring and debugging
tool. Unfortunately, the gathering and reporting of these critical values is
usually ad-hoc. This package aims to add a centralized place for gather... | mit |
darkryder/django | django/template/context_processors.py | 55 | 2497 | """
A set of request processors that return dictionaries to be merged into a
template context. Each function takes the request object as its only parameter
and returns a dictionary to add to the context.
These are referenced from the 'context_processors' option of the configuration
of a DjangoTemplates backend and use... | bsd-3-clause |
ewindisch/nova | nova/api/ec2/ec2utils.py | 13 | 13554 | # 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 except in compliance with the License. You may obtain
# a ... | apache-2.0 |
Kraymer/keroaek | keroaek/vlc.py | 1 | 292112 | #! /usr/bin/python
# Python ctypes bindings for VLC
#
# Copyright (C) 2009-2012 the VideoLAN team
# $Id: $
#
# Authors: Olivier Aubert <contact at olivieraubert.net>
# Jean Brouwers <MrJean1 at gmail.com>
# Geoff Salmon <geoff.salmon at gmail.com>
#
# This library is free software; you can redistribu... | mit |
pombredanne/pants | src/python/pants/backend/jvm/subsystems/zinc_language_mixin.py | 10 | 1890 | # coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
class ZincLanguageM... | apache-2.0 |
Nihn/Diamond-1 | src/diamond/handler/sentry.py | 28 | 10750 | # coding=utf-8
"""
Diamond handler that check if values are too high or too low, if so send an
alert to a Sentry server
This handler requires the Python module Raven:
http://raven.readthedocs.org/en/latest/index.html
To work this handler need a similar configuration:
[[SentryHandler]]
# Create a new project in Sen... | mit |
richardbeare/ITK | Wrapping/Generators/Doc/doxy2swig.py | 2 | 11932 | #!/usr/bin/env python
"""Doxygen XML to SWIG docstring converter.
Converts Doxygen generated XML files into a file containing docstrings
that can be used by SWIG-1.3.x. Note that you need to get SWIG
version > 1.3.23 or use Robin Dunn's docstring patch to be able to use
the resulting output.
Usage:
doxy2swig.py i... | apache-2.0 |
styx0x6/gremlins | lib/thirdparty/requests/sessions.py | 115 | 26216 | # -*- coding: utf-8 -*-
"""
requests.session
~~~~~~~~~~~~~~~~
This module provides a Session object to manage and persist settings across
requests (cookies, auth, proxies).
"""
import os
from collections import Mapping
from datetime import datetime
from .auth import _basic_auth_str
from .compat import cookielib, Ord... | agpl-3.0 |
NicolasLM/sauna | sauna/plugins/ext/memcached.py | 2 | 3980 | import re
import socket
from sauna.plugins import (Plugin, bytes_to_human, human_to_bytes,
PluginRegister)
my_plugin = PluginRegister('Memcached')
@my_plugin.plugin()
class Memcached(Plugin):
def __init__(self, config):
super().__init__(config)
self.config = {
... | bsd-2-clause |
dablak/boto | boto/iam/connection.py | 7 | 53721 | # Copyright (c) 2010-2011 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2010-2011, Eucalyptus Systems, Inc.
#
# 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, includin... | mit |
kelseyoo14/Wander | venv_2_7/lib/python2.7/site-packages/setuptools/command/develop.py | 450 | 6610 | from distutils.util import convert_path
from distutils import log
from distutils.errors import DistutilsError, DistutilsOptionError
import os
import glob
from pkg_resources import Distribution, PathMetadata, normalize_path
from setuptools.command.easy_install import easy_install
from setuptools.compat import PY3
impor... | artistic-2.0 |
shakamunyi/sahara | sahara/service/api/v2/job_binaries.py | 1 | 2190 | # Copyright (c) 2016 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 agreed to in writ... | apache-2.0 |
camptocamp/mapproxy | mapproxy/seed/script.py | 6 | 15430 | # This file is part of the MapProxy project.
# Copyright (C) 2010 Omniscale <http://omniscale.de>
#
# 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... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.