repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringclasses 981
values | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
ryfeus/lambda-packs | Tensorflow/source/tensorflow/python/ops/nn_impl.py | 5 | 51951 | # 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... | mit |
niklasf/python-prompt-toolkit | prompt_toolkit/layout/utils.py | 1 | 2590 | from __future__ import unicode_literals
from prompt_toolkit.utils import get_cwidth
__all__ = (
'token_list_len',
'token_list_width',
'token_list_to_text',
'explode_tokens',
'find_window_for_buffer_name',
)
def token_list_len(tokenlist):
"""
Return the amount of characters in this token ... | bsd-3-clause |
Daniex/horizon | horizon/utils/urlresolvers.py | 67 | 1162 | # Copyright 2012 Nebula, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | apache-2.0 |
bltb/mitmproxy | test/test_proxy.py | 4 | 4679 | import argparse
from libmproxy import cmdline
from libmproxy.proxy import ProxyConfig, process_proxy_options
from libmproxy.proxy.connection import ServerConnection
from libmproxy.proxy.primitives import ProxyError
from libmproxy.proxy.server import DummyServer, ProxyServer, ConnectionHandler
import tutils
from libpath... | mit |
UdK-VPT/Open_eQuarter | mole/stat_corr/building_owner_distribution_by_population_density_correlation.py | 1 | 2864 | # OeQ autogenerated correlation for 'Building Owner Distribution in Correlation to the population density'
import math
import numpy as np
import oeqCorrelation as oeq
def get(*xin):
# OeQ autogenerated correlation for 'Buildings with housing owned by assiciations'
BLD_OWNER_ASSOC= oeq.correlation(
const= ... | gpl-2.0 |
devbitstudio/portfolio | settings.py | 1 | 5950 | # Django settings for devbitstudio project.
import os
DEBUG = True
TEMPLATE_DEBUG = DEBUG
DOMAIN = 'devbitstudio.com'
EMAIL_HOST = 'localhost'
EMAIL_PORT = 25
#~ DEFAULT_FROM_EMAIL = 'contact@devbitstudio.com'
SERVER_EMAIL = 'contact@devbitstudio.com'
EMAIL_SUBJECT_PREFIX = 'DevBitStudio - '
CURRENT_PATH = os.path... | mit |
lesina/Hack70 | env/lib/python3.5/site-packages/django/utils/translation/trans_null.py | 75 | 1468 | # These are versions of the functions in django.utils.translation.trans_real
# that don't actually do anything. This is purely for performance, so that
# settings.USE_I18N = False can use this module rather than trans_real.py.
from django.conf import settings
from django.utils.encoding import force_text
def ngettext... | gpl-3.0 |
michelangelo13/bigcouch | couchjs/scons/scons-local-2.0.1/SCons/Tool/CVS.py | 61 | 2912 | """SCons.Tool.CVS.py
Tool-specific initialization for CVS.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#
# ... | apache-2.0 |
SaschaMester/delicium | third_party/cython/src/Tools/site_scons/site_tools/cython.py | 125 | 1721 | """
Tool to run Cython files (.pyx) into .c and .cpp.
TODO:
- Add support for dynamically selecting in-process Cython
through CYTHONINPROCESS variable.
- Have a CYTHONCPP option which turns on C++ in flags and
changes output extension at the same time
VARIABLES:
- CYTHON - The path to the "cython" command li... | bsd-3-clause |
jumpstarter-io/neutron | neutron/db/migration/alembic_migrations/versions/2a6d0b51f4bb_cisco_plugin_cleanup.py | 8 | 3044 | # Copyright 2013 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | apache-2.0 |
eliangidoni/rethinkdb | test/scenarios/restart.py | 12 | 1600 | #!/usr/bin/env python
# Copyright 2010-2016 RethinkDB, all rights reserved.
import os, sys
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.path.pardir, 'common')))
import rdb_unittest, scenario_common, utils, vcoptparse, workload_runner
op = vcoptparse.OptParser()
scenario_common.prepare_o... | agpl-3.0 |
antamb/google-personal-assistant | tests/test_speak_time.py | 5 | 1998 | # 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 |
akopytov/sysbench | third_party/cram/cram/_process.py | 9 | 1805 | """Utilities for running subprocesses"""
import os
import signal
import subprocess
import sys
from cram._encoding import fsdecode
__all__ = ['PIPE', 'STDOUT', 'execute']
PIPE = subprocess.PIPE
STDOUT = subprocess.STDOUT
def _makeresetsigpipe():
"""Make a function to reset SIGPIPE to SIG_DFL (for use in subproc... | gpl-2.0 |
ChromeDevTools/devtools-frontend | scripts/deps/roll_deps.py | 2 | 2410 | #!/usr/bin/env vpython
#
# Copyright 2019 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.
"""
Update manually maintained dependencies from Chromium.
"""
import argparse
import os
import shutil
import subprocess
import sys
... | bsd-3-clause |
valkjsaaa/sl4a | python/src/Lib/test/test_builtin.py | 51 | 54825 | # Python test set -- built-in functions
import test.test_support, unittest
from test.test_support import fcmp, have_unicode, TESTFN, unlink, \
run_unittest, run_with_locale
from operator import neg
import sys, warnings, cStringIO, random, fractions, UserDict
warnings.filterwarnings("igno... | apache-2.0 |
google/makani | avionics/motor/motor_client.py | 1 | 50178 | #!/usr/bin/python
# Copyright 2020 Makani Technologies LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicabl... | apache-2.0 |
yun3195/android_kernel_ZTE_Z5S | tools/perf/scripts/python/netdev-times.py | 11271 | 15048 | # Display a process of packets and processed time.
# It helps us to investigate networking or network device.
#
# options
# tx: show only tx chart
# rx: show only rx chart
# dev=: show only thing related to specified device
# debug: work with debug mode. It shows buffer status.
import os
import sys
sys.path.append(os... | gpl-2.0 |
KhronosGroup/COLLADA-CTS | StandardDataSets/1_5/collada/library_animations/animation/source/1animation/1animation.py | 2 | 8115 |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit |
rklabs/scrapy | tests/test_middleware.py | 129 | 2743 | from twisted.trial import unittest
from scrapy.settings import Settings
from scrapy.exceptions import NotConfigured
from scrapy.middleware import MiddlewareManager
import six
class M1(object):
def open_spider(self, spider):
pass
def close_spider(self, spider):
pass
def process(self, res... | bsd-3-clause |
SurfasJones/djcmsrc3 | venv/lib/python2.7/site-packages/cms/migrations/0019_public_table_renames.py | 525 | 20033 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
try:
from django.contrib.auth import get_user_model
except ImportError: # django < 1.5
from django.contrib.auth.models import User
else:
User = get_user_model()
user_orm_label... | mit |
mbr0wn/gnuradio | gr-blocks/python/blocks/qa_ctrlport_probes.py | 5 | 8079 | #!/usr/bin/env python
#
# Copyright 2013,2015 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
import sys
import time
import random
import numpy
from gnuradio import gr, gr_unittest, blocks
import os
import struct
import re
from gnuradio.ctrlport.GNU... | gpl-3.0 |
pubnative/redash | tests/test_utils.py | 12 | 2552 | from redash.utils import build_url, collect_query_parameters, collect_parameters_from_request
from collections import namedtuple
from unittest import TestCase
DummyRequest = namedtuple('DummyRequest', ['host', 'scheme'])
class TestBuildUrl(TestCase):
def test_simple_case(self):
self.assertEqual("http://e... | bsd-2-clause |
JarbasAI/JarbasAI | jarbas_models/tf_tacotron/models/modules.py | 1 | 3455 | import tensorflow as tf
from tensorflow.contrib.rnn import GRUCell
def prenet(inputs, is_training, layer_sizes=[256, 128], scope=None):
x = inputs
drop_rate = 0.5 if is_training else 0.0
with tf.variable_scope(scope or 'prenet'):
for i, size in enumerate(layer_sizes):
dense = tf.layers... | gpl-3.0 |
ssh1/stbgui | lib/python/Components/Input.py | 32 | 6944 | from HTMLComponent import HTMLComponent
from GUIComponent import GUIComponent
from VariableText import VariableText
from enigma import eLabel
from Tools.NumericalTextInput import NumericalTextInput
class Input(VariableText, HTMLComponent, GUIComponent, NumericalTextInput):
TEXT = 0
PIN = 1
NUMBER = 2
def __init... | gpl-2.0 |
zhangg/trove | trove/guestagent/datastore/mysql/service.py | 1 | 3685 | # Copyright 2013 OpenStack Foundation
# Copyright 2013 Rackspace Hosting
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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 co... | apache-2.0 |
tmerrick1/spack | var/spack/repos/builtin/packages/r-mlr/package.py | 4 | 2806 | ##############################################################################
# Copyright (c) 2013-2018, Lawrence Livermore National Security, LLC.
# Produced at the Lawrence Livermore National Laboratory.
#
# This file is part of Spack.
# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
# LLNL-CODE-64... | lgpl-2.1 |
LethusTI/supportcenter | vendor/django/tests/regressiontests/admin_util/models.py | 40 | 1082 | from django.db import models
class Article(models.Model):
"""
A simple Article model for testing
"""
site = models.ForeignKey('sites.Site', related_name="admin_articles")
title = models.CharField(max_length=100)
title2 = models.CharField(max_length=100, verbose_name="another name")
created... | gpl-3.0 |
gnieboer/tensorflow | tensorflow/contrib/layers/python/layers/initializers_test.py | 111 | 7640 | # 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 |
abdulbaqi/quranf | venv/lib/python2.7/site-packages/pip/_vendor/html5lib/sanitizer.py | 805 | 16428 | from __future__ import absolute_import, division, unicode_literals
import re
from xml.sax.saxutils import escape, unescape
from .tokenizer import HTMLTokenizer
from .constants import tokenTypes
class HTMLSanitizerMixin(object):
""" sanitization of XHTML+MathML+SVG and of inline style attributes."""
accepta... | mit |
devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/networkx/algorithms/approximation/matching.py | 10 | 1159 | # -*- coding: utf-8 -*-
"""
**************
Graph Matching
**************
Given a graph G = (V,E), a matching M in G is a set of pairwise non-adjacent
edges; that is, no two edges share a common vertex.
http://en.wikipedia.org/wiki/Matching_(graph_theory)
"""
# Copyright (C) 2011-2012 by
# Nicholas Mancuso <nick.m... | agpl-3.0 |
mdomke/signaling | tests/test_signals.py | 1 | 3866 | import mock
import pytest
from signaling.exceptions import InvalidEmit
from signaling.exceptions import InvalidSlot
from signaling import Signal
class Receiver(object):
def __init__(self):
self.m = mock.Mock()
def slot(self):
self.m()
class TestSignalSlot(object):
def setup_method(se... | mit |
Akrog/cinder | cinder/api/extensions.py | 4 | 12939 | # Copyright 2011 OpenStack Foundation
# Copyright 2011 Justin Santa Barbara
# 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/l... | apache-2.0 |
mikemintz/neutron | modules/iq.py | 1 | 4752 | # -*- coding: koi8-r -*-
## OJAB iq module
## Copyright (C) Boris Kotov <admin@avoozl.ru>
##
## 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, or
## (at your op... | gpl-2.0 |
xfournet/intellij-community | plugins/hg4idea/testData/bin/mercurial/lock.py | 92 | 4921 | # lock.py - simple advisory locking scheme for mercurial
#
# Copyright 2005, 2006 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
import util, error
import errno, os, socket, time
import warnings
cl... | apache-2.0 |
samatdav/zulip | zerver/webhooks/mention/view.py | 26 | 1389 | # Webhooks for external integrations.
from __future__ import absolute_import
from django.utils.translation import ugettext as _
from zerver.lib.actions import check_send_message
from zerver.lib.response import json_success, json_error
from zerver.decorator import REQ, has_request_variables, api_key_only_webhook_view
fr... | apache-2.0 |
smurfix/pybble | pybble/cache/__init__.py | 1 | 1978 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, print_function, division, unicode_literals
##
## This is part of Pybble, a WMS (Whatever Management System) based on
## Jinja2/Haml, Werkzeug, Flask, and Optimism.
##
## Pybble is Copyright © 2009-2014 by Matthias Urlichs <matthias@urlichs.de>,
## it is li... | gpl-3.0 |
joker946/nova | nova/servicegroup/drivers/db.py | 8 | 3798 | # Copyright 2012 IBM Corp.
#
# 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, sof... | apache-2.0 |
MrLoick/python-for-android | python3-alpha/python3-src/Lib/unittest/test/test_runner.py | 785 | 10718 | import io
import os
import sys
import pickle
import subprocess
import unittest
from .support import LoggingResult, ResultWithNoStartTestRunStopTestRun
class TestCleanUp(unittest.TestCase):
def testCleanUp(self):
class TestableTest(unittest.TestCase):
def testNothing(self):
p... | apache-2.0 |
wuxianghou/phantomjs | src/qt/qtwebkit/Tools/Scripts/webkitpy/common/system/platforminfo.py | 122 | 6974 | # Copyright (c) 2011 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 ... | bsd-3-clause |
rgeleta/odoo | addons/crm/wizard/crm_phonecall_to_phonecall.py | 337 | 4535 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
alextruberg/custom_django | tests/commands_sql/tests.py | 58 | 2445 | from __future__ import unicode_literals
from django.core.management.color import no_style
from django.core.management.sql import (sql_create, sql_delete, sql_indexes,
sql_destroy_indexes, sql_all)
from django.db import connections, DEFAULT_DB_ALIAS, models
from django.test import TestCase
from django.utils import ... | bsd-3-clause |
mancoast/CPythonPyc_test | cpython/272_loosing_mro_ref.py | 151 | 1079 | """
There is a way to put keys of any type in a type's dictionary.
I think this allows various kinds of crashes, but so far I have only
found a convoluted attack of _PyType_Lookup(), which uses the mro of the
type without holding a strong reference to it. Probably works with
super.__getattribute__() too, which uses th... | gpl-3.0 |
khagler/boto | boto/ec2/autoscale/limits.py | 152 | 1958 | # 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 ... | mit |
sasmita/upm | examples/python/scam.py | 7 | 2202 | #!/usr/bin/python
#
# Author: Jon Trulson <jtrulson@ics.com>
# Copyright (c) 2015 Intel Corporation.
#
# 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... | mit |
natj/bender | paper/figs/fig9.py | 1 | 4141 | import numpy as np
import math
from pylab import *
from palettable.wesanderson import Zissou_5 as wsZ
import matplotlib.ticker as mtick
from scipy.interpolate import interp1d
from scipy.interpolate import griddata
from scipy.signal import savgol_filter
def smooth(xx, yy):
yy = savgol_filter(yy, 7, 2)
np.cl... | mit |
johankaito/fufuka | microblog/flask/venv/lib/python2.7/site-packages/flask/ctx.py | 776 | 14266 | # -*- coding: utf-8 -*-
"""
flask.ctx
~~~~~~~~~
Implements the objects required to keep the context.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from __future__ import with_statement
import sys
from functools import update_wrapper
from werkzeug.excep... | apache-2.0 |
jmontleon/fusor_ovirt | bin/ovirt_get_ip_of_vm.py | 4 | 2742 | #! /usr/bin/env python
import logging
import sys
import time
from optparse import OptionParser
try:
from ovirtsdk.api import API
except:
print "Please re-run after you have installed 'ovirt-engine-sdk-python'"
print "Example: easy_install ovirt-engine-sdk-python"
sys.exit()
DEFAULT_API_USER = "admin... | gpl-2.0 |
Nexenta/s3-tests | virtualenv/lib/python2.7/site-packages/boto/kinesis/layer1.py | 18 | 33202 | # 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 ... | mit |
syhost/android_kernel_xiaomi_armani | tools/perf/scripts/python/futex-contention.py | 11261 | 1486 | # futex contention
# (c) 2010, Arnaldo Carvalho de Melo <acme@redhat.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Translation of:
#
# http://sourceware.org/systemtap/wiki/WSFutexContention
#
# to perf python scripting.
#
# Measures futex contention
import os, sys
sys.path.append(os.environ['PER... | gpl-2.0 |
bzbarsky/servo | tests/wpt/css-tests/tools/py/py/_code/_py2traceback.py | 275 | 2765 | # copied from python-2.7.3's traceback.py
# CHANGES:
# - some_str is replaced, trying to create unicode strings
#
import types
def format_exception_only(etype, value):
"""Format the exception part of a traceback.
The arguments are the exception type and value such as given by
sys.last_type and sys.last_va... | mpl-2.0 |
practicing01/Urho3D-Blender | io_mesh_urho/decompose.py | 2 | 90333 |
#
# This script is licensed as public domain.
# Based on "Export Inter-Quake Model (.iqm/.iqe)" by Lee Salzman
#
# http://www.blender.org/documentation/blender_python_api_2_63_2/info_best_practice.html
# http://www.blender.org/documentation/blender_python_api_2_63_2/info_gotcha.html
# Blender types:
# http://www.b... | unlicense |
mydongistiny/external_chromium_org | tools/chrome_proxy/integration_tests/network_metrics_unittest.py | 42 | 6433 | # 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.
import base64
import unittest
from integration_tests import network_metrics
from metrics import test_page_test_results
from telemetry.timeline import event
... | bsd-3-clause |
flavour/tldrmp | private/templates/RGIMS/controllers.py | 3 | 7814 | # -*- coding: utf-8 -*-
from os import path
from gluon import current
from gluon.html import *
from s3.s3utils import s3_register_validation
# =============================================================================
class index():
""" Custom Home Page """
def __call__(self):
T = current.T
... | mit |
jerrybai2009/WhereHows-1 | metadata-etl/src/main/resources/jython/requests/__init__.py | 149 | 2215 | # -*- coding: utf-8 -*-
# __
# /__) _ _ _ _ _/ _
# / ( (- (/ (/ (- _) / _)
# /
"""
Requests HTTP library
~~~~~~~~~~~~~~~~~~~~~
Requests is an HTTP library, written in Python, for human beings. Basic GET
usage:
>>> import requests
>>> r = requests.get('https://www.python.org')
>>> ... | apache-2.0 |
gaborvecsei/Color-Tracker | examples/tracking.py | 1 | 2306 | import argparse
from functools import partial
import cv2
import color_tracker
# You can determine these values with the HSVColorRangeDetector()
HSV_LOWER_VALUE = [155, 103, 82]
HSV_UPPER_VALUE = [178, 255, 255]
def get_args():
parser = argparse.ArgumentParser()
parser.add_argument("-low", "--low", nargs=3,... | mit |
wakatime/wakatime | wakatime/packages/py26/pygments/scanner.py | 31 | 3123 | # -*- coding: utf-8 -*-
"""
pygments.scanner
~~~~~~~~~~~~~~~~
This library implements a regex based scanner. Some languages
like Pascal are easy to parse but have some keywords that
depend on the context. Because of this it's impossible to lex
that just by using a regular expression lexer like ... | bsd-3-clause |
dimtruck/magnum | magnum/tests/functional/api/v1/clients/baymodel_client.py | 2 | 3764 | # 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 Li... | apache-2.0 |
yufengg/tensorflow | tensorflow/contrib/slim/python/slim/summaries.py | 63 | 7497 | # Copyright 2017 The TensorFlow Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applica... | apache-2.0 |
dosiecki/NewsBlur | apps/rss_feeds/management/shells.py | 20 | 2149 |
class ObjectImportError(Exception):
pass
def import_objects(options, style):
# XXX: (Temporary) workaround for ticket #1796: force early loading of all
# models from installed apps. (this is fixed by now, but leaving it here
# for people using 0.96 or older trunk (pre [5919]) versions.
from djan... | mit |
rayNymous/nupic | src/nupic/encoders/multi.py | 18 | 7681 | # ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2013, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions apply:
#
# This progra... | agpl-3.0 |
stuarth/pixie | pixie/vm/test/test_compile.py | 9 | 8085 | from pixie.vm.reader import read_inner, StringReader, eof
from pixie.vm.object import Type
from pixie.vm.cons import Cons
from pixie.vm.numbers import Integer
from pixie.vm.symbol import Symbol
from pixie.vm.compiler import compile, with_ns
from pixie.vm.interpreter import interpret
from pixie.vm.code import Code, Var
... | gpl-3.0 |
jefftc/changlab | Betsy/Betsy/modules/convert_simplevariantfile_to_matrix.py | 1 | 8224 | from Module import AbstractModule
class Module(AbstractModule):
def __init__(self):
AbstractModule.__init__(self)
def run(
self, network, in_data, out_attributes, user_options, num_cores,
out_filename):
from genomicode import filelib
from genomicode import SimpleVariant... | mit |
hyperized/ansible | test/units/modules/network/fortios/test_fortios_firewall_ipmacbinding_table.py | 21 | 8901 | # 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 License, or
# (at your option) any later version.
#
# This program is distributed in the... | gpl-3.0 |
oVirt/vdsm | tests/virt/devicexml_test.py | 2 | 50377 | #
# Copyright 2017-2020 Red Hat, 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 2 of the License, or
# (at your option) any later version.
#
# This program is distributed ... | gpl-2.0 |
tlatzko/spmcluster | .tox/clean/lib/python2.7/site-packages/pip/_vendor/requests/utils.py | 618 | 21334 | # -*- coding: utf-8 -*-
"""
requests.utils
~~~~~~~~~~~~~~
This module provides utility functions that are used within Requests
that are also useful for external consumption.
"""
import cgi
import codecs
import collections
import io
import os
import platform
import re
import sys
import socket
import struct
import wa... | bsd-2-clause |
mathemage/h2o-3 | h2o-py/tests/testdir_algos/glrm/pyunit_NOFEATURE_glrm_long_runtime_large.py | 5 | 3155 | from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
from h2o.estimators.glrm import H2OGeneralizedLowRankEstimator
# This test is just to take a large dataset, perform GLRM on it and figure
# out the performance time. This test should not be run ... | apache-2.0 |
js0701/chromium-crosswalk | third_party/cython/src/Cython/Compiler/Tests/TestMemView.py | 127 | 2516 | from Cython.TestUtils import CythonTest
import Cython.Compiler.Errors as Errors
from Cython.Compiler.Nodes import *
from Cython.Compiler.ParseTreeTransforms import *
from Cython.Compiler.Buffer import *
class TestMemviewParsing(CythonTest):
def parse(self, s):
return self.should_not_fail(lambda: self.fra... | bsd-3-clause |
Eureka22/ASM_xf | PythonD/site_python/mx/DateTime/LazyModule.py | 8 | 2570 | """ Helper to enable simple lazy module import.
'Lazy' means the actual import is deferred until an attribute is
requested from the module's namespace. This has the advantage of
allowing all imports to be done at the top of a script (in a
prominent and visible place) without having a great impact
... | gpl-2.0 |
skirsdeda/django | django/contrib/gis/gdal/prototypes/generation.py | 100 | 3976 | """
This module contains functions that generate ctypes prototypes for the
GDAL routines.
"""
from ctypes import c_char_p, c_double, c_int, c_void_p
from django.contrib.gis.gdal.prototypes.errcheck import (
check_arg_errcode, check_errcode, check_geom, check_geom_offset,
check_pointer, check_srs, check_str_a... | bsd-3-clause |
pianomania/scikit-learn | sklearn/linear_model/stochastic_gradient.py | 16 | 50617 | # Authors: Peter Prettenhofer <peter.prettenhofer@gmail.com> (main author)
# Mathieu Blondel (partial_fit support)
#
# License: BSD 3 clause
"""Classification and regression using Stochastic Gradient Descent (SGD)."""
import numpy as np
from abc import ABCMeta, abstractmethod
from ..externals.joblib import ... | bsd-3-clause |
ojengwa/talk | venv/lib/python2.7/site-packages/pip/_vendor/html5lib/trie/datrie.py | 1301 | 1178 | from __future__ import absolute_import, division, unicode_literals
from datrie import Trie as DATrie
from pip._vendor.six import text_type
from ._base import Trie as ABCTrie
class Trie(ABCTrie):
def __init__(self, data):
chars = set()
for key in data.keys():
if not isinstance(key, te... | mit |
anandbhoraskar/Diamond | src/collectors/xen_collector/xen_collector.py | 53 | 2217 | # coding=utf-8
"""
The XENCollector grabs usage/allocation metrics using libvirt
#### Dependencies
* python-libvirt
"""
from diamond.collector import Collector
import os
try:
import libvirt
except ImportError:
libvirt = None
class XENCollector(Collector):
def get_default_config_help(self):
... | mit |
mhue/scikit-learn | examples/text/document_classification_20newsgroups.py | 222 | 10500 | """
======================================================
Classification of text documents using sparse features
======================================================
This is an example showing how scikit-learn can be used to classify documents
by topics using a bag-of-words approach. This example uses a scipy.spars... | bsd-3-clause |
ttm/oscEmRede | venv/lib/python2.7/site-packages/networkx/algorithms/chordal/tests/test_chordal.py | 75 | 2377 | #!/usr/bin/env python
from nose.tools import *
import networkx as nx
class TestMCS:
def setUp(self):
# simple graph
connected_chordal_G=nx.Graph()
connected_chordal_G.add_edges_from([(1,2),(1,3),(2,3),(2,4),(3,4),
(3,5),(3,6),(4,5),(4,6),(5,6)])
... | gpl-3.0 |
jschneier/cmsplugin-filer | cmsplugin_filer_teaser/cms_plugins.py | 9 | 3734 | from cms.plugin_pool import plugin_pool
from cms.plugin_base import CMSPluginBase
from django.utils.translation import ugettext_lazy as _
from django.template.loader import select_template
from . import models
from .conf import settings
class FilerTeaserPlugin(CMSPluginBase):
"""
TODO: this plugin is becoming... | bsd-3-clause |
SOKP/external_chromium_org | third_party/jinja2/parser.py | 637 | 35186 | # -*- coding: utf-8 -*-
"""
jinja2.parser
~~~~~~~~~~~~~
Implements the template parser.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
from jinja2 import nodes
from jinja2.exceptions import TemplateSyntaxError, TemplateAssertionError
from jinja2.lexer impo... | bsd-3-clause |
CanalTP/navitia | source/jormungandr/jormungandr/transient_socket.py | 2 | 5712 | # coding=utf-8
# Copyright (c) 2001-2020, Canal TP and/or its affiliates. All rights reserved.
#
# This file is part of Navitia,
# the software to build cool stuff with public transport.
#
# Hope you'll enjoy and contribute to this project,
# powered by Canal TP (www.canaltp.fr).
# Help us simplify mobility an... | agpl-3.0 |
kytvi2p/Sigil | 3rdparty/python/Lib/tkinter/commondialog.py | 153 | 1412 | # base class for tk common dialogues
#
# this module provides a base class for accessing the common
# dialogues available in Tk 4.2 and newer. use filedialog,
# colorchooser, and messagebox to access the individual
# dialogs.
#
# written by Fredrik Lundh, May 1997
#
from tkinter import *
class Dialog:
command ... | gpl-3.0 |
Lab603/PicEncyclopedias | jni-build/jni/include/tensorflow/python/kernel_tests/cwise_ops_test.py | 4 | 71457 | # 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... | mit |
karan1276/servo | tests/wpt/web-platform-tests/tools/wptserve/tests/functional/test_pipes.py | 109 | 3167 | import os
import unittest
import time
from .base import TestUsingServer, doc_root
class TestStatus(TestUsingServer):
def test_status(self):
resp = self.request("/document.txt", query="pipe=status(202)")
self.assertEqual(resp.getcode(), 202)
class TestHeader(TestUsingServer):
def test_not_set(... | mpl-2.0 |
wrenchzc/photomanager | tests/test_command_update.py | 1 | 1307 | from tests.utils import remove_file
from photomanager.lib.pmconst import PMDBNAME
from photomanager.commands.index import CommandIndex
from photomanager.commands.update import CommandUpdate
from photomanager.db.dbutils import get_db_session, close_db_session
from photomanager.db.models import ImageMeta
cmd_inx_test_ro... | mit |
fenglu-g/incubator-airflow | tests/contrib/operators/test_oracle_to_oracle_transfer.py | 13 | 3067 | # -*- coding: utf-8 -*-
#
# Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
#... | apache-2.0 |
cortedeltimo/SickRage | lib/unidecode/x064.py | 252 | 4655 | data = (
'Chan ', # 0x00
'Ge ', # 0x01
'Lou ', # 0x02
'Zong ', # 0x03
'Geng ', # 0x04
'Jiao ', # 0x05
'Gou ', # 0x06
'Qin ', # 0x07
'Yong ', # 0x08
'Que ', # 0x09
'Chou ', # 0x0a
'Chi ', # 0x0b
'Zhan ', # 0x0c
'Sun ', # 0x0d
'Sun ', # 0x0e
'Bo ', # 0x0f
'Chu ', # 0x10
... | gpl-3.0 |
mancoast/CPythonPyc_test | fail/333_test_abc_loader.py | 34 | 32554 | import importlib
from importlib import abc
from .. import abc as testing_abc
from .. import util
from . import util as source_util
import imp
import inspect
import io
import marshal
import os
import sys
import types
import unittest
import warnings
class SourceOnlyLoaderMock(abc.SourceLoader):
# Globals that sh... | gpl-3.0 |
MenZil/kuma | vendor/packages/translate/misc/autoencode.py | 25 | 2334 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2006 Zuza Software Foundation
#
# This file is part of translate.
#
# translate 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 t... | mpl-2.0 |
khaeusler/website | website_sale_order_company/models/website.py | 33 | 1518 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2015 Agile Business Group sagl (<http://www.agilebg.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public Licen... | agpl-3.0 |
dzorlu/sdc-segmentation | train.py | 1 | 4118 | import sys
import tensorflow as tf
from tensorflow.python.ops import math_ops
sys.path.append("slim/")
slim = tf.contrib.slim
TRAIN_DIR = "/tmp/tf"
class Trainer(object):
def __init__(self, nb_classes, optimizer, learning_rate):
self.nb_classes = nb_classes
# learning rate can be a placeholder tensor
... | mit |
rtucker-mozilla/inventory | libs/jinja_extensions.py | 3 | 1372 | from jinja2 import nodes
from jinja2.ext import Extension
from django.utils.safestring import mark_safe
import traceback
class CsrfExtension(Extension):
# a set of names that trigger the extension.
tags = set(['csrf_token'])
def __init__(self, environment):
self.environment = environment
def ... | bsd-3-clause |
janusnic/wagtail | wagtail/contrib/wagtailapi/tests/test_documents.py | 26 | 14599 | import json
import mock
from django.test import TestCase
from django.test.utils import override_settings
from django.core.urlresolvers import reverse
from wagtail.wagtaildocs.models import Document
from wagtail.contrib.wagtailapi import signal_handlers
class TestDocumentListing(TestCase):
fixtures = ['demosite... | bsd-3-clause |
geodynamics/gale | boost/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... | gpl-2.0 |
openplans/shareabouts-demo | src/sa_web/config.py | 60 | 2400 | import yaml
import os.path
import urllib2
from contextlib import closing
from django.conf import settings
from django.utils.translation import ugettext as _
def get_shareabouts_config(path_or_url):
if path_or_url.startswith('http://') or path_or_url.startswith('https://'):
return ShareaboutsRemoteConfig(p... | gpl-3.0 |
phil65/SublimeKodi | libs/chardet/euckrfreq.py | 3121 | 45978 | ######################## 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 Rights R... | gpl-3.0 |
espadrine/opera | chromium/src/third_party/webpagereplay/third_party/dns/zone.py | 215 | 31930 | # 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 ... | bsd-3-clause |
ge0rgi/cinder | cinder/volume/drivers/dell_emc/vmax/provision_v3.py | 1 | 46116 | # Copyright (c) 2012 - 2015 EMC Corporation.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unle... | apache-2.0 |
Big-B702/python-for-android | python3-alpha/python3-src/Lib/urllib/error.py | 48 | 2264 | """Exception classes raised by urllib.
The base exception class is URLError, which inherits from IOError. It
doesn't define any behavior of its own, but is the base class for all
exceptions defined in this package.
HTTPError is an exception class that is also a valid HTTP response
instance. It behaves this way beca... | apache-2.0 |
fidomason/kbengine | kbe/res/scripts/common/Lib/site-packages/setuptools/command/setopt.py | 285 | 5068 | import distutils, os
from setuptools import Command
from distutils.util import convert_path
from distutils import log
from distutils.errors import *
__all__ = ['config_file', 'edit_config', 'option_base', 'setopt']
def config_file(kind="local"):
"""Get the filename of the distutils, local, global, or per-user co... | lgpl-3.0 |
TanguyPatte/phantomjs-packaging | src/qt/qtwebkit/Source/WebKit2/Scripts/webkit2/parser.py | 118 | 4545 | # Copyright (C) 2010, 2011 Apple 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:
# 1. Redistributions of source code must retain the above copyright
# notice, this list of conditions and... | bsd-3-clause |
Aorjoa/aiyara-ceph-dash | .tox/flake8/lib/python2.7/site-packages/flake8/formatting/default.py | 1 | 2191 | """Default formatting class for Flake8."""
from flake8.formatting import base
class SimpleFormatter(base.BaseFormatter):
"""Simple abstraction for Default and Pylint formatter commonality.
Sub-classes of this need to define an ``error_format`` attribute in order
to succeed. The ``format`` method relies o... | bsd-2-clause |
cancan101/tensorflow | tensorflow/contrib/quantization/python/array_ops.py | 178 | 1156 | # 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 |
edcast-inc/edx-platform-edcast | common/test/acceptance/pages/lms/discussion.py | 27 | 25034 | from contextlib import contextmanager
from bok_choy.javascript import wait_for_js
from bok_choy.page_object import PageObject
from bok_choy.promise import EmptyPromise, Promise
from .course_page import CoursePage
class DiscussionPageMixin(object):
def is_ajax_finished(self):
return self.browser.execute... | agpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.