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 |
|---|---|---|---|---|---|
maftieu/CouchPotatoServer | libs/cache/posixemulation.py | 193 | 3541 | # -*- coding: utf-8 -*-
r"""
werkzeug.posixemulation
~~~~~~~~~~~~~~~~~~~~~~~
Provides a POSIX emulation for some features that are relevant to
web applications. The main purpose is to simplify support for
systems such as Windows NT that are not 100% POSIX compatible.
Currently this only imple... | gpl-3.0 |
fmacias64/Dato-Core | src/unity/python/graphlab/deps/__init__.py | 13 | 1294 | '''
Copyright (C) 2015 Dato, Inc.
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the DATO-PYTHON-LICENSE file for details.
'''
from distutils.version import StrictVersion
import logging
def __get_version(version):
if 'dev' in str(version):
versi... | agpl-3.0 |
justin0406/MiRaGe-GEE | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/SchedGui.py | 12980 | 5411 | # SchedGui.py - Python extension for perf script, basic GUI code for
# traces drawing and overview.
#
# Copyright (C) 2010 by Frederic Weisbecker <fweisbec@gmail.com>
#
# This software is distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
... | gpl-2.0 |
waynehuge/shadowsocks | shadowsocks/daemon.py | 694 | 5602 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2014-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 requi... | apache-2.0 |
Chad0989/Vigor-Incredikernel | tools/perf/scripts/python/syscall-counts.py | 944 | 1429 | # system call counts
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Displays system-wide system call totals, broken down by syscall.
# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
import os
import sys
sys.path.append(os.envir... | gpl-2.0 |
imitrichev/cantera | interfaces/cython/cantera/examples/reactors/sensitivity1.py | 4 | 2165 | """
Constant-pressure, adiabatic kinetics simulation with sensitivity analysis
"""
import sys
import numpy as np
import cantera as ct
gri3 = ct.Solution('gri30.xml')
temp = 1500.0
pres = ct.one_atm
gri3.TPX = temp, pres, 'CH4:0.1, O2:2, N2:7.52'
r = ct.IdealGasConstPressureReactor(gri3, name='R1')
sim = ct.ReactorN... | bsd-3-clause |
projectshift/shift-boiler | boiler/routes/lazy_views.py | 1 | 1700 | from werkzeug.utils import import_string, cached_property
class LazyView:
"""
Lazy view
Callable class that provides loading views on-demand as soon as they
are hit. This reduces startup times and improves general performance.
See flask docs for more:
http://flask.pocoo.org/docs/0.10/patterns... | mit |
rsivapr/scikit-learn | examples/cross_decomposition/plot_compare_cross_decomposition.py | 8 | 4706 | """
===================================
Compare cross decomposition methods
===================================
Simple usage of various cross decomposition algorithms:
- PLSCanonical
- PLSRegression, with multivariate response, a.k.a. PLS2
- PLSRegression, with univariate response, a.k.a. PLS1
- CCA
Given 2 multivari... | bsd-3-clause |
Lekanich/intellij-community | python/helpers/docutils/parsers/rst/directives/images.py | 51 | 6348 | # $Id: images.py 5952 2009-05-19 08:45:27Z milde $
# Author: David Goodger <goodger@python.org>
# Copyright: This module has been placed in the public domain.
"""
Directives for figures and simple images.
"""
__docformat__ = 'reStructuredText'
import sys
from docutils import nodes, utils
from docutils.parsers.rst i... | apache-2.0 |
Huyuwei/tvm | topi/python/topi/nn/util.py | 2 | 3185 | # 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 |
cognitiveclass/edx-platform | common/lib/capa/capa/safe_exec/safe_exec.py | 179 | 4876 | """Capa's specialized use of codejail.safe_exec."""
from codejail.safe_exec import safe_exec as codejail_safe_exec
from codejail.safe_exec import not_safe_exec as codejail_not_safe_exec
from codejail.safe_exec import json_safe, SafeExecException
from . import lazymod
from dogapi import dog_stats_api
import hashlib
#... | agpl-3.0 |
TangXT/edx-platform | lms/djangoapps/certificates/migrations/0012_auto__add_field_generatedcertificate_name__add_field_generatedcertific.py | 188 | 6384 | # -*- 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 field 'GeneratedCertificate.name'
db.add_column('certificates_generatedcertificate', 'name',
... | agpl-3.0 |
dgladkov/django | django/contrib/messages/storage/cookie.py | 471 | 6545 | import json
from django.conf import settings
from django.contrib.messages.storage.base import BaseStorage, Message
from django.http import SimpleCookie
from django.utils import six
from django.utils.crypto import constant_time_compare, salted_hmac
from django.utils.safestring import SafeData, mark_safe
class Message... | bsd-3-clause |
jayceyxc/hue | desktop/core/ext-py/boto-2.42.0/boto/directconnect/exceptions.py | 148 | 1239 | # Copyright (c) 2013 Amazon.com, Inc. or its affiliates. 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 restriction, including
# without limitation the rights ... | apache-2.0 |
dwightgunning/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 |
ttsda/beets | test/test_the.py | 25 | 2759 | """Tests for the 'the' plugin"""
from __future__ import (division, absolute_import, print_function,
unicode_literals)
from test._common import unittest
from test import _common
from beets import config
from beetsplug.the import ThePlugin, PATTERN_A, PATTERN_THE, FORMAT
class ThePluginTest(_c... | mit |
nebril/fuel-web | fuel_upgrade_system/fuel_upgrade/fuel_upgrade/pre_upgrade_hooks/from_any_to_6_1_recreate_containers.py | 4 | 3834 | # -*- coding: utf-8 -*-
# Copyright 2015 Mirantis, 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 requi... | apache-2.0 |
jvoegele/picard | picard/coverart/utils.py | 2 | 1570 | # -*- coding: utf-8 -*-
#
# Picard, the next-generation MusicBrainz tagger
# Copyright (C) 2013 Laurent Monin
#
# 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 the License,... | gpl-2.0 |
Carmezim/tensorflow | tensorflow/contrib/slim/python/slim/data/tfexample_decoder_test.py | 9 | 30768 | # 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 |
SEMAFORInformatik/femagtools | femagtools/forcedens.py | 1 | 6880 | # -*- coding: utf-8 -*-
"""
femagtools.forcedens
~~~~~~~~~~~~~~~~~~~~
Read Force Density Plot Files
"""
import os
import re
import glob
import numpy as np
import logging
logger = logging.getLogger('femagtools.forcedens')
filename_pat = re.compile(r'^(\w+)_(\d{3}).PLT(\d+)')
num_pat = re.compile(r'([+-]... | bsd-2-clause |
MiltosD/CEFELRC | lib/python2.7/site-packages/django/utils/simplejson/scanner.py | 928 | 2227 | """JSON token scanner
"""
import re
try:
from simplejson._speedups import make_scanner as c_make_scanner
except ImportError:
c_make_scanner = None
__all__ = ['make_scanner']
NUMBER_RE = re.compile(
r'(-?(?:0|[1-9]\d*))(\.\d+)?([eE][-+]?\d+)?',
(re.VERBOSE | re.MULTILINE | re.DOTALL))
def py_make_scan... | bsd-3-clause |
jmakov/ggrc-core | src/ggrc/migrations/versions/20130723200044_d3af6d071ef_ensure_that_slugs_ar.py | 7 | 1687 | # Copyright (C) 2013 Google Inc., authors, and contributors <see AUTHORS file>
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
# Created By: dan@reciprocitylabs.com
# Maintained By: dan@reciprocitylabs.com
"""Ensure that slugs are unique
Revision ID: d3af6d071ef
Revises: 2b709b655bf
Cre... | apache-2.0 |
kowall116/roadTrip | packages/custom/mail-templates/node_modules/node-sass/node_modules/node-gyp/gyp/tools/pretty_gyp.py | 2618 | 4756 | #!/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.
"""Pretty-prints the contents of a GYP file."""
import sys
import re
# Regex to remove comments when we're counting braces.
COMMENT_RE = ... | mit |
realsaiko/odoo | addons/website_blog/tests/common.py | 279 | 1476 | # -*- coding: utf-8 -*-
from openerp.tests import common
class TestWebsiteBlogCommon(common.TransactionCase):
def setUp(self):
super(TestWebsiteBlogCommon, self).setUp()
Users = self.env['res.users']
group_blog_manager_id = self.ref('base.group_document_user')
group_employee_id =... | agpl-3.0 |
kylerbrown/scikit-learn | sklearn/externals/joblib/logger.py | 359 | 5135 | """
Helpers for logging.
This module needs much love to become useful.
"""
# Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org>
# Copyright (c) 2008 Gael Varoquaux
# License: BSD Style, 3 clauses.
from __future__ import print_function
import time
import sys
import os
import shutil
import logging
impo... | bsd-3-clause |
nvoron23/scikit-learn | sklearn/linear_model/tests/test_sparse_coordinate_descent.py | 244 | 9986 | import numpy as np
import scipy.sparse as sp
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_true
from sklearn.utils.t... | bsd-3-clause |
wainersm/buildbot | master/buildbot/test/unit/test_wamp_connector.py | 10 | 3319 | # This file is part of Buildbot. Buildbot 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, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | gpl-2.0 |
commtrack/commtrack-core | apps/user_registration/tests/models.py | 3 | 9775 | import datetime
import re
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.sites.models import Site
from django.core import mail
from django.core import management
from django.test import TestCase
from django.utils.hashcompat import sha_constructor
from user_registratio... | bsd-3-clause |
Android-AOSP/external_skia | gm/rebaseline_server/download_actuals.py | 66 | 5949 | #!/usr/bin/python
"""
Copyright 2014 Google Inc.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
Download actual GM results for a particular builder.
"""
# System-level imports
import optparse
import os
import posixpath
import re
import urllib2
# Imports from withi... | bsd-3-clause |
xzturn/caffe2 | caffe2/python/core_gradients_test.py | 1 | 34409 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
from __future__ import unicode_literals
from future.utils import bytes_to_native_str
from hypothesis import given
import hypothesis.strategies as st
import unittest
from caffe2.proto import caffe2_pb2
from caf... | apache-2.0 |
Yukinoshita47/Yuki-Chan-The-Auto-Pentest | Module/metagoofil/parser.py | 24 | 2957 | import string
import re
class parser:
def __init__(self,results,word,file):
self.results=results
self.word=word
self.temp=[]
self.file=file
def genericClean(self):
self.results = re.sub('<em>', '', self.results)
self.results = re.sub('<b>', '', self.results)
self.results = re.sub('</b>', '', self.re... | mit |
chenss/ChatRoom | 14.5 已经能运行(虽然有很多Warning)的Django-nonrel框架/django/views/decorators/cache.py | 229 | 3639 | try:
from functools import wraps
except ImportError:
from django.utils.functional import wraps # Python 2.4 fallback.
from django.utils.decorators import decorator_from_middleware_with_args, available_attrs
from django.utils.cache import patch_cache_control, add_never_cache_headers
from django.middleware.cach... | gpl-2.0 |
majorcs/fail2ban | config/action.d/badips.py | 4 | 10504 | # emacs: -*- mode: python; py-indent-offset: 4; indent-tabs-mode: t -*-
# vi: set ft=python sts=4 ts=4 sw=4 noet :
# This file is part of Fail2Ban.
#
# Fail2Ban 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;... | gpl-2.0 |
agconti/njode | env/lib/python2.7/site-packages/allauth/socialaccount/providers/github/views.py | 67 | 1028 | import requests
from allauth.socialaccount.providers.oauth2.views import (OAuth2Adapter,
OAuth2LoginView,
OAuth2CallbackView)
from .provider import GitHubProvider
class GitHubOAuth2Adapter(OAuth2Adapte... | bsd-3-clause |
stanlyxiang/incubator-hawq | tools/bin/pythonSrc/unittest2-0.5.1/unittest2/test/test_new_tests.py | 122 | 1695 | from cStringIO import StringIO
import unittest
import unittest2
from unittest2.test.support import resultFactory
class TestUnittest(unittest2.TestCase):
def assertIsSubclass(self, actual, klass):
self.assertTrue(issubclass(actual, klass), "Not a subclass.")
def testInheritance(self):
... | apache-2.0 |
Towellang/Fabric | towel.py | 1 | 3116 | #!/usr/bin/env python2
import sys
import random
from string import join
STACK = []
LOOPS = [] # Loops are stacks too
PNT = 0
BREAK = False # Break mode
ENV = {
"[": lambda: LOOPS.append(PNT),
"]": lambda: loop(),
"drop": lambda: STACK.pop(),
"dup": lambda: push(str(STACK[-1])) if STACK != [] else panic("Tried d... | gpl-3.0 |
l-hedgehog/bedrock | bedrock/firefox/tests/test_firefox_details.py | 2 | 14100 | # -*- coding: utf-8 -*-
# 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
from urlparse import parse_qsl, urlparse
from django.conf import settings
from django.... | mpl-2.0 |
dd00/commandergenius | project/jni/python/src/Lib/test/test_coercion.py | 56 | 11270 | import copy
import warnings
import unittest
from test.test_support import run_unittest, TestFailed
# Fake a number that implements numeric methods through __coerce__
class CoerceNumber:
def __init__(self, arg):
self.arg = arg
def __repr__(self):
return '<CoerceNumber %s>' % repr(self.arg)
... | lgpl-2.1 |
ryanjmccall/nupic | nupic/support/features_list.py | 7 | 2735 | #! /usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions... | gpl-3.0 |
mrunge/openstack_horizon | openstack_horizon/dashboards/project/data_processing/job_executions/tables.py | 1 | 4946 | # 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 the... | apache-2.0 |
Pablo126/SSBW | Tarea3/tarea3/lib/python3.5/site-packages/mongoengine/base/document.py | 2 | 41762 | import copy
import numbers
from collections import Hashable
from functools import partial
from bson import ObjectId, json_util
from bson.dbref import DBRef
from bson.son import SON
import pymongo
import six
from mongoengine import signals
from mongoengine.base.common import get_document
from mongoengine.base.datastru... | gpl-3.0 |
kvar/ansible | lib/ansible/modules/network/check_point/cp_mgmt_assign_global_assignment.py | 20 | 2701 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage Check Point Firewall (c) 2019
#
# 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 o... | gpl-3.0 |
W4TCH0UT/zz_lettuce | tools/perf/scripts/python/failed-syscalls-by-pid.py | 11180 | 2058 | # failed system call counts, by pid
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Displays system-wide failed system call totals, broken down by pid.
# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
import os
import sys
sys.pa... | gpl-2.0 |
AndroidOpenDevelopment/android_external_chromium_org | tools/telemetry/telemetry/core/backends/chrome/inspector_page_unittest.py | 9 | 1365 | # 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.
from telemetry.unittest import tab_test_case
class InspectorPageTest(tab_test_case.TabTestCase):
def __init__(self, *args):
super(InspectorPageTest, ... | bsd-3-clause |
mikewesner-wf/glasshouse | appengine/lib/flaskext/wtf/recaptcha/validators.py | 27 | 2281 | import urllib2
from flask import request, current_app
from wtforms import ValidationError
from werkzeug import url_encode
RECAPTCHA_VERIFY_SERVER = 'http://api-verify.recaptcha.net/verify'
__all__ = ["Recaptcha"]
class Recaptcha(object):
"""Validates a ReCaptcha."""
_error_codes = {
'invalid-site-... | apache-2.0 |
Diti24/python-ivi | ivi/agilent/agilent8156A.py | 1 | 8762 | """
Python Interchangeable Virtual Instrument Library
Copyright (c) 2014-2016 Alex Forencich
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... | mit |
spektom/incubator-airflow | airflow/providers/amazon/aws/operators/sns.py | 4 | 2088 | #
# 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... | apache-2.0 |
cwgreene/Nanostructure-Simulator | kdtree_c.py | 1 | 3883 | import ctypes
import time #test only
#init
kdtree = ctypes.cdll.LoadLibrary("c_optimized/kdtree.so")
kdtree3 = ctypes.cdll.LoadLibrary("c_optimized/kdtree3.so")
kdtree.call_this()
#types
vector2 = ctypes.c_double*2
vector2p = ctypes.c_double*3
vector3 = ctypes.c_double*3
vector3p = ctypes.c_double*4
kdtree_p = ctypes... | mit |
proxysh/Safejumper-for-Mac | buildmac/Resources/env/lib/python2.7/site-packages/cryptography/hazmat/primitives/kdf/concatkdf.py | 58 | 4109 | # This file is dual licensed under the terms of the Apache License, Version
# 2.0, and the BSD License. See the LICENSE file in the root of this repository
# for complete details.
from __future__ import absolute_import, division, print_function
import struct
from cryptography import utils
from cryptography.exception... | gpl-2.0 |
libvirt/autotest | client/virt/tests/nfs_corrupt.py | 1 | 8531 | import logging, os, re
from autotest_lib.client.common_lib import error
from autotest_lib.client.bin import utils, os_dep
from autotest_lib.client.virt import virt_utils
from autotest_lib.client.virt import virt_env_process
class NFSCorruptConfig(object):
"""
This class sets up nfs_corrupt test environment.
... | gpl-2.0 |
martinggww/lucasenlights | ETF/lucas/bin/2getQuantCode.py | 2 | 3085 | import sys, os
sys.path.append(os.path.dirname(os.path.dirname(os.path.abspath(__file__))))
import my_config as config
import logging
from src.getDf import readCsvFiles, addFundPerf, readStatics, getFeatureDf, dropOff, dropOffTrade
from src.calStatics import calStatics
from src.getQuantDf import getQuantDf
from src.ca... | cc0-1.0 |
justyns/home-assistant | homeassistant/remote.py | 4 | 15563 | """
Support for an interface to work with a remote instance of Home Assistant.
If a connection error occurs while communicating with the API a
HomeAssistantError will be raised.
For more details about the Python API, please refer to the documentation at
https://home-assistant.io/developers/python_api/
"""
import enum... | mit |
GEMScienceTools/oq-subduction | openquake/sub/grid3d.py | 1 | 6450 | """
:module:
"""
import rtree
import numpy as np
from pyproj import Proj
from scipy.interpolate import griddata
from shapely.geometry import Point
from openquake.sub.misc.alpha_shape import alpha_shape
def generator_function(mesh):
"""
Generator function for quick loading of a 3D spatial index
:param ... | agpl-3.0 |
Lujeni/ansible | test/units/modules/network/fortimanager/test_fmgr_fwpol_package.py | 38 | 4044 | # Copyright 2018 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 License, or
# (at your option) any later version.
#
# This program is distributed in the... | gpl-3.0 |
Lujeni/ansible | lib/ansible/plugins/action/exos.py | 4 | 1722 | #
# Copyright 2015 Peter Sprygada <psprygada@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 License, or
# (at your option) any... | gpl-3.0 |
kazupon/libuv-lua | tools/gyp/test/mac/gyptest-framework.py | 102 | 1459 | #!/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.
"""
Verifies that app bundles are built correctly.
"""
import TestGyp
import sys
if sys.platform == 'darwin':
test = TestGyp.TestGyp(fo... | apache-2.0 |
tbabej/astropy | astropy/io/ascii/tests/test_read.py | 2 | 46300 | # Licensed under a 3-clause BSD style license - see LICENSE.rst
# TEST_UNICODE_LITERALS
import re
from io import BytesIO
from collections import OrderedDict
import locale
import numpy as np
import platform
from ....extern.six.moves import zip, cStringIO as StringIO
from ....tests.helper import pytest
from ... impor... | bsd-3-clause |
rcomer/iris | lib/iris/tests/test_pp_module.py | 5 | 15525 | # Copyright Iris contributors
#
# This file is part of Iris and is released under the LGPL license.
# See COPYING and COPYING.LESSER in the root of the repository for full
# licensing details.
# import iris tests first so that some things can be initialised before importing anything else
import iris.tests as tests
fr... | lgpl-3.0 |
inveniosoftware/invenio-collections | tests/test_record_signals.py | 3 | 3879 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015, 2016 CERN.
#
# Invenio 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... | gpl-2.0 |
sindrig/django-guardian | guardian/testapp/tests/orphans_test.py | 14 | 3759 | from __future__ import unicode_literals
# Try the new app settings (Django 1.7) and fall back to the old system
try:
from django.apps import apps as django_apps
auth_app = django_apps.get_app_config("auth")
except ImportError:
from django.contrib.auth import models as auth_app
from django.contrib.contentty... | bsd-2-clause |
0jpq0/kbengine | kbe/src/lib/python/Lib/tkinter/test/test_tkinter/test_loadtk.py | 162 | 1503 | import os
import sys
import unittest
import test.support as test_support
from tkinter import Tcl, TclError
test_support.requires('gui')
class TkLoadTest(unittest.TestCase):
@unittest.skipIf('DISPLAY' not in os.environ, 'No $DISPLAY set.')
def testLoadTk(self):
tcl = Tcl()
self.assertRaises(Tc... | lgpl-3.0 |
IRI-Research/django | django/db/migrations/operations/base.py | 12 | 3888 | class Operation(object):
"""
Base class for migration operations.
It's responsible for both mutating the in-memory model state
(see db/migrations/state.py) to represent what it performs, as well
as actually performing it against a live database.
Note that some operations won't modify memory st... | bsd-3-clause |
whereismyjetpack/ansible | test/units/modules/network/eos/test_eos_eapi.py | 8 | 5459 | #!/usr/bin/env python
#
# (c) 2016 Red Hat Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later ver... | gpl-3.0 |
hurricup/intellij-community | python/lib/Lib/site-packages/django/core/files/images.py | 324 | 1733 | """
Utility functions for handling images.
Requires PIL, as you might imagine.
"""
from django.core.files import File
class ImageFile(File):
"""
A mixin for use alongside django.core.files.base.File, which provides
additional features for dealing with images.
"""
def _get_width(self):
ret... | apache-2.0 |
andres-root/veritas | node_modules/gulp-sass/node_modules/node-sass/node_modules/pangyp/gyp/pylib/gyp/MSVSUserFile.py | 2710 | 5094 | # 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 user preferences file writer."""
import os
import re
import socket # for gethostname
import gyp.common
import gyp.easy_xml as easy_xml
#------... | mit |
aneeshusa/servo | tests/wpt/web-platform-tests/tools/pywebsocket/src/example/echo_noext_wsh.py | 465 | 2404 | # Copyright 2013, 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... | mpl-2.0 |
YangYangTL/oiio | testsuite/tiff-suite/run.py | 4 | 4082 | #!/usr/bin/env python
imagedir = parent + "/libtiffpic"
# caspian.tif 279x220 64-bit floating point (deflate) Caspian Sea from space
# I can't get this to work with OIIO, but I can't get it to read with
# ImageMagick or OSX preview, either.
# FIXME?
# cramps.tif 800x607 8-bit b&w (packbits) "cramps poster"
... | bsd-3-clause |
jeffmcnd/tfrs | APISpec/gen/models/FuelSupplierType.py | 2 | 1385 | """
REST API Documentation for the NRS TFRS Credit Trading Application
The Transportation Fuels Reporting System is being designed to streamline compliance reporting for transportation fuel suppliers in accordance with the Renewable & Low Carbon Fuel Requirements Regulation.
OpenAPI spec version: v1
... | apache-2.0 |
UHBiocomputation/pelican-plugins | liquid_tags/test_notebook.py | 4 | 3144 | import re
import pytest
pytest.skip("Test is currently broken, see pelican pr #1618", allow_module_level=True)
from pelican.tests.support import unittest
from . import notebook
class TestNotebookTagRegex(unittest.TestCase):
def get_argdict(self, markup):
match = notebook.FORMAT.search(markup)
... | agpl-3.0 |
luther07/dak | dak/examine_package.py | 2 | 23247 | #!/usr/bin/env python
"""
Script to automate some parts of checking NEW packages
Most functions are written in a functional programming style. They
return a string avoiding the side effect of directly printing the string
to stdout. Those functions can be used in multithreaded parts of dak.
@contact: Debian FTP Maste... | gpl-2.0 |
Intel-Corporation/tensorflow | tensorflow/python/autograph/utils/type_check.py | 22 | 1168 | # 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 |
Techcable/TechBot | plugins/metacritic.py | 31 | 3973 | import re
import requests
from lxml import html
from cloudbot import hook
from cloudbot.util import web
@hook.command("metacritic", "mc")
def metacritic(text):
"""[all|movie|tv|album|x360|ps3|pc|gba|ds|3ds|wii|vita|wiiu|xone|ps4] <title> - gets rating for <title> from
metacritic on the specified medium"""
... | gpl-3.0 |
synasius/django | tests/extra_regress/models.py | 281 | 1401 | from __future__ import unicode_literals
import copy
import datetime
from django.contrib.auth.models import User
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class RevisionableModel(models.Model):
base = models.ForeignKey('self', models.S... | bsd-3-clause |
newerthcom/savagerebirth | libs/python-2.72/Lib/bsddb/dbtables.py | 52 | 30879 | #-----------------------------------------------------------------------
#
# Copyright (C) 2000, 2001 by Autonomous Zone Industries
# Copyright (C) 2002 Gregory P. Smith
#
# License: This is free software. You may use this software for any
# purpose including modification/redistribution, so long as
... | gpl-2.0 |
njr0/fdb | flags.py | 2 | 8396 | # flags.py
#
# Copyright (c) Nicholas J. Radcliffe 2009.
# Licence terms in LICENCE.
import sys
class FlagError (Exception): pass
def Plural(n, s, pl=None, str=False, justTheWord=False):
"""Returns a string like '23 fields' or '1 field' where the
number is n, the stem is s and the plura... | mit |
thinkopensolutions/geraldo | site/newsite/django_1_0/tests/modeltests/properties/models.py | 30 | 1029 | """
22. Using properties on models
Use properties on models just like on any other Python object.
"""
from django.db import models
class Person(models.Model):
first_name = models.CharField(max_length=30)
last_name = models.CharField(max_length=30)
def _get_full_name(self):
return "%s %s" % (self... | lgpl-3.0 |
realslimkarthik/PL-Results | utils/utils.py | 2 | 3000 | from datetime import datetime
from utils import cleaning_methods
from utils.mongo_credentials import credentials
user_agent_list = [
"Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.1 (KHTML, like Gecko) Chrome/22.0.1207.1 Safari/537.1"
"Mozilla/5.0 (X11; CrOS i686 2268.111.0) AppleWebKit/536.11 (KHTML, li... | mit |
netsamir/dotfiles | files/vim/bundle/YouCompleteMe/third_party/ycmd/third_party/bottle/test/test_config.py | 14 | 1353 | import unittest
from bottle import ConfigDict
class TestConfDict(unittest.TestCase):
def test_write(self):
c = ConfigDict()
c['key'] = 'value'
self.assertEqual(c['key'], 'value')
self.assertTrue('key' in c)
c['key'] = 'value2'
self.assertEqual(c['key'], 'value2')
... | unlicense |
yanboliang/spark | examples/src/main/python/sql/hive.py | 28 | 3305 | #
# 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 |
jstoxrocky/statsmodels | statsmodels/examples/ex_kernel_regression2.py | 34 | 1511 | # -*- coding: utf-8 -*-
"""
Created on Wed Jan 02 13:43:44 2013
Author: Josef Perktold
"""
from __future__ import print_function
import numpy as np
import numpy.testing as npt
import statsmodels.nonparametric.api as nparam
if __name__ == '__main__':
np.random.seed(500)
nobs = [250, 1000][0]
sig_fac = 1... | bsd-3-clause |
andersonresende/django | django/contrib/flatpages/tests/test_csrf.py | 40 | 3493 | import os
from django.contrib.auth.models import User
from django.contrib.auth.tests.utils import skipIfCustomUser
from django.test import TestCase, Client
from django.test import override_settings
@override_settings(
LOGIN_URL='/accounts/login/',
MIDDLEWARE_CLASSES=(
'django.middleware.common.CommonM... | bsd-3-clause |
sserrot/champion_relationships | venv/Lib/site-packages/packaging/_typing.py | 38 | 1812 | """For neatly implementing static typing in packaging.
`mypy` - the static type analysis tool we use - uses the `typing` module, which
provides core functionality fundamental to mypy's functioning.
Generally, `typing` would be imported at runtime and used in that fashion -
it acts as a no-op at runtime and does not h... | mit |
miguelparaiso/PracticaOdoo | addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/actions.py | 382 | 3763 | ##########################################################################
#
# Copyright (c) 2003-2004 Danny Brewer d29583@groovegarden.com
# Copyright (C) 2004-2010 OpenERP SA (<http://openerp.com>).
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser Gener... | agpl-3.0 |
Laurawly/tvm-1 | python/tvm/relay/param_dict.py | 2 | 2213 | # 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 |
cedriclaunay/gaffer | python/GafferArnoldTest/ArnoldShaderTest.py | 2 | 10618 | ##########################################################################
#
# Copyright (c) 2012, John Haddon. All rights reserved.
# Copyright (c) 2013, Image Engine Design Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that ... | bsd-3-clause |
DommertTech/flask-turboduck | flask_turboduck/rest.py | 4 | 17269 | import functools
import operator
try:
import simplejson as json
except ImportError:
import json
from flask import Blueprint
from flask import Response
from flask import abort
from flask import g
from flask import redirect
from flask import request
from flask import session
from flask import url_for
from peewee... | mit |
tremblerz/breach-detection-system | dashboard/bds/views.py | 1 | 2233 | from django.shortcuts import render,redirect
import random,json
from django.http import HttpResponse
from django.contrib.auth import authenticate,logout,login
from bds.models import Packet
# Create your views here.
"""
def send_data(request):
"""
def login_v(request):
message = ""
if request.method == "POST":
use... | gpl-3.0 |
ct-23/home-assistant | homeassistant/components/binary_sensor/zwave.py | 13 | 3310 | """
Interfaces with Z-Wave sensors.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/binary_sensor.zwave/
"""
import logging
import datetime
import homeassistant.util.dt as dt_util
from homeassistant.helpers.event import track_point_in_time
from homeassistant... | apache-2.0 |
benchisell/photostream-bc | flask/lib/python2.7/site-packages/whoosh/support/relativedelta.py | 116 | 17347 | """
Copyright (c) 2003-2010 Gustavo Niemeyer <gustavo@niemeyer.net>
This module offers extensions to the standard python 2.3+
datetime module.
"""
__author__ = "Gustavo Niemeyer <gustavo@niemeyer.net>"
__license__ = "PSF License"
import datetime
import calendar
__all__ = ["relativedelta", "MO", "TU", "WE", "TH", "F... | bsd-3-clause |
chrischoy/3D-R2N2 | lib/blender_renderer.py | 1 | 10773 | #!/usr/bin/env python3
import _init_paths
import time
import os
import contextlib
from math import radians
import numpy as np
from PIL import Image
from tempfile import TemporaryFile
from lib.utils import stdout_redirected
from lib.config import cfg
import bpy
def voxel2mesh(voxels):
cube_verts = [[0, 0, 0],
... | mit |
Noviat/account-invoicing | account_invoice_shipping_address/tests/test_invoice_shipping_test.py | 30 | 2274 | # -*- coding: utf-8 -*-
##############################################################################
# This file is part of account_invoice_shipping_address, an Odoo module.
#
# Copyright (c) 2015 ACSONE SA/NV (<http://acsone.eu>)
#
# account_invoice_line_sort is free software: you can redistribute it
# ... | agpl-3.0 |
handspring/bite-project | deps/gdata-python-client/samples/oauth/oauth_on_appengine/main_rsa.py | 126 | 7137 | #!/usr/bin/python
#
# Copyright (C) 2009 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 appli... | apache-2.0 |
DelvarWorld/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 |
whitequark/foundry | vendor/lit/lit/TestRunner.py | 2 | 19269 | from __future__ import absolute_import
import os, signal, subprocess, sys
import re
import platform
import tempfile
import lit.ShUtil as ShUtil
import lit.Test as Test
import lit.util
class InternalShellError(Exception):
def __init__(self, command, message):
self.command = command
self.message = m... | mit |
simonwydooghe/ansible | lib/ansible/modules/network/fortios/fortios_system_ftm_push.py | 7 | 9104 | #!/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 |
franosincic/edx-platform | common/djangoapps/microsite_configuration/admin.py | 41 | 2691 | """
Django admin page for microsite models
"""
from django.contrib import admin
from django import forms
from .models import (
Microsite,
MicrositeHistory,
MicrositeOrganizationMapping,
MicrositeTemplate
)
from util.organizations_helpers import get_organizations
class MicrositeAdmin(admin.ModelAdmin)... | agpl-3.0 |
fbossy/SickRage | sickbeard/notifiers/plex.py | 12 | 12147 | # Author: Nic Wolfe <nic@wolfeden.ca>
# URL: http://code.google.com/p/sickbeard/
#
# 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 License,... | gpl-3.0 |
JonnyWong16/plexpy | lib/dateutil/tz.py | 108 | 34097 | # -*- coding: utf-8 -*-
"""
This module offers timezone implementations subclassing the abstract
:py:`datetime.tzinfo` type. There are classes to handle tzfile format files
(usually are in :file:`/etc/localtime`, :file:`/usr/share/zoneinfo`, etc), TZ
environment string (in all known formats), given ranges (with help fr... | gpl-3.0 |
ganeshnalawade/ansible-modules-core | network/dellos6/dellos6_config.py | 30 | 9798 | #!/usr/bin/python
#
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
#
# Copyright (c) 2016 Dell Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either versi... | gpl-3.0 |
RP7/R7-OCM | src/python/spectrum.py | 2 | 1152 | import web
import os
import axi2s_u
import AD9361_c
import adscripts
import axi2s_c
import json
urls = ('/','index','/data','data','/freq','freq')
class index:
def GET(self):
web.redirect('static/index.html')
class data:
def GET(self):
ocm = axi2s_u.axi2s_u()
r = ocm.rfdata()
ocm.deinit()
... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.