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 |
|---|---|---|---|---|---|
HHS/CoECI-CMS-Healthcare-Fraud-Prevention | partnerclient/hfppnetwork/partner/conversion/test/test_entities.py | 3 | 3134 | ##
# Copyright (C) 2013 TopCoder Inc., All Rights Reserved.
##
__author__ = 'Easyhard'
__version__ = '1.0'
import entities
from schema import entity
import unittest
from datetime import date
from exception import ConfigurationException
class TestEntities(unittest.TestCase):
"""Testcases for entities.py"""
de... | apache-2.0 |
chunywang/crosswalk-test-suite | stability/stability-iterative-android-tests/iterative/Pause_Resume_Webapp_Repeatedly.py | 18 | 2868 | #!/usr/bin/env python
# coding=utf-8
#
# Copyright (c) 2015 Intel Corporation.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# * Redistributions of works must retain the original copyright notice, this
# list of c... | bsd-3-clause |
jostep/tensorflow | tensorflow/contrib/specs/python/params_ops.py | 186 | 3104 | # 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 applicable ... | apache-2.0 |
MartinDelzant/scikit-learn | sklearn/utils/tests/test_random.py | 230 | 7344 | from __future__ import division
import numpy as np
import scipy.sparse as sp
from scipy.misc import comb as combinations
from numpy.testing import assert_array_almost_equal
from sklearn.utils.random import sample_without_replacement
from sklearn.utils.random import random_choice_csc
from sklearn.utils.testing import ... | bsd-3-clause |
ufieeehw/IEEE2017 | ieee2017_tf_broadcaster/nodes/tf_broadcaster.py | 1 | 3127 | #!/usr/bin/env python
'''
TF Broadcaster: Keeps track of the various coordinate frames on the vehicle in
relation to the map and each other.
'''
from __future__ import division
import rospy
import tf
from nav_msgs.msg import Odometry
from std_msgs.msg import Float64
__author__ = "Anthony Olive"
__maintainer__ = "... | mit |
mozillazg/Unidecode | unidecode/x014.py | 252 | 4300 | data = (
'[?]', # 0x00
'e', # 0x01
'aai', # 0x02
'i', # 0x03
'ii', # 0x04
'o', # 0x05
'oo', # 0x06
'oo', # 0x07
'ee', # 0x08
'i', # 0x09
'a', # 0x0a
'aa', # 0x0b
'we', # 0x0c
'we', # 0x0d
'wi', # 0x0e
'wi', # 0x0f
'wii', # 0x10
'wii', # 0x11
'wo', # 0x12
'wo', ... | gpl-2.0 |
Changaco/oh-mainline | vendor/packages/gdata/tests/atom_tests/mock_client_test.py | 128 | 2421 | #!/usr/bin/python
#
# Copyright (C) 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | agpl-3.0 |
muzili/repo | main.py | 18 | 6629 | #!/bin/sh
#
# Copyright (C) 2008 The Android Open Source Project
#
# 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 app... | apache-2.0 |
juanshishido/okcupid | utils/permutation.py | 1 | 2439 | import numpy as np
from scipy.stats import ttest_ind
from sklearn.metrics import accuracy_score
def _diff_means(m, arr):
"""Calculate the difference-in-means statistic.
This is based on an input array, `arr`, where the first
`m` observations correspond to a particular class.
Parameters
----------... | mit |
geligaoli/shadowsocks-1 | shadowsocks/common.py | 9 | 10391 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 2013-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 |
Juniper/nova | nova/tests/functional/wsgi/test_flavor_manage.py | 4 | 9812 | # Copyright 2015 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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unl... | apache-2.0 |
willharris/django | django/core/serializers/__init__.py | 121 | 8167 | """
Interfaces for serializing Django objects.
Usage::
from django.core import serializers
json = serializers.serialize("json", some_queryset)
objects = list(serializers.deserialize("json", json))
To add your own serializers, use the SERIALIZATION_MODULES setting::
SERIALIZATION_MODULES = {
... | bsd-3-clause |
cruzegoodin/TSC-ShippingDetails | flask/lib/python2.7/site-packages/pbr/git.py | 25 | 9311 | # Copyright 2011 OpenStack LLC.
# Copyright 2012-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 copy of the License at
#
# htt... | bsd-3-clause |
NexusIS/libcloud | libcloud/test/storage/test_atmos.py | 46 | 32319 | # 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 use ... | apache-2.0 |
BogusCurry/BlocksCAD | closure-library/closure/bin/calcdeps.py | 223 | 18544 | #!/usr/bin/env python
#
# Copyright 2006 The Closure Library 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
... | gpl-3.0 |
rikiji/gnome-wsname-applet | wsname.py | 1 | 6204 | #!/usr/bin/env python
import pygtk
pygtk.require('2.0')
import gtk
import gnomeapplet
import gobject
import wnck
import sys
import codecs
import random
# debugging
# import os
# new_stdout = open ("/tmp/debug.stdout", "w")
# new_stderr = open ("/tmp/debug.stderr", "w")
# os.dup2(new_stdout.fileno(), sys.stdout.filen... | gpl-2.0 |
robin900/sqlalchemy | test/ext/test_indexable.py | 2 | 10585 | from sqlalchemy.testing import assert_raises
import sqlalchemy as sa
from sqlalchemy import testing
from sqlalchemy import Integer, Text
from sqlalchemy.sql.sqltypes import ARRAY, JSON
from sqlalchemy.testing.schema import Column
from sqlalchemy.orm import Session
from sqlalchemy.testing import fixtures
from sqlalchemy... | mit |
brianwoo/django-tutorial | build/Django/django/contrib/auth/forms.py | 93 | 13799 | from __future__ import unicode_literals
from collections import OrderedDict
from django import forms
from django.contrib.auth import authenticate, get_user_model
from django.contrib.auth.hashers import (
UNUSABLE_PASSWORD_PREFIX, identify_hasher,
)
from django.contrib.auth.models import User
from django.contrib.a... | gpl-3.0 |
smalls257/VRvisu | Library/External.LCA_RESTRICTED/Languages/CPython/27/Lib/ctypes/test/test_struct_fields.py | 264 | 1503 | import unittest
from ctypes import *
class StructFieldsTestCase(unittest.TestCase):
# Structure/Union classes must get 'finalized' sooner or
# later, when one of these things happen:
#
# 1. _fields_ is set.
# 2. An instance is created.
# 3. The type is used as field of another Structure/Union.
... | gpl-3.0 |
dimroc/tensorflow-mnist-tutorial | lib/python3.6/site-packages/tensorflow/contrib/labeled_tensor/python/ops/_typecheck.py | 52 | 10165 | # 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 |
python-ning/blog | blogchen/blog/migrations/0006_auto_20150831_2257.py | 1 | 1727 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
('blog', '0005_auto_20150830_2306'),
]
operations = [
migrations.AddField(
model_... | mpl-2.0 |
alisw/AliPhysics | PWGMM/MC/aligenqa/aligenqa/utils.py | 37 | 7697 | import os
import random
import string
import subprocess
import re
from rootpy import asrootpy
from rootpy.plotting import Graph
def gen_random_name():
"""Generate a random name for temp hists"""
return ''.join(random.choice(string.ascii_letters + string.digits) for _ in range(25))
def get_est_dirs(sums, co... | bsd-3-clause |
lancezlin/ml_template_py | lib/python2.7/site-packages/zmq/tests/test_future.py | 9 | 7520 | # coding: utf-8
# Copyright (c) PyZMQ Developers
# Distributed under the terms of the Modified BSD License.
from datetime import timedelta
import os
import pytest
gen = pytest.importorskip('tornado.gen')
import zmq
from zmq.eventloop import future
from zmq.eventloop.ioloop import IOLoop
from zmq.utils.strtypes impor... | mit |
jiezhu2007/scrapy | tests/test_utils_deprecate.py | 140 | 10526 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import inspect
import unittest
import warnings
from scrapy.exceptions import ScrapyDeprecationWarning
from scrapy.utils.deprecate import create_deprecated_class, update_classpath
from tests import mock
class MyWarning(UserWarning):
pass
class SomeB... | bsd-3-clause |
nguyenfilip/subscription-manager | src/subscription_manager/isodate.py | 3 | 1113 | #
# find a reasonable iso8601 date parser
#
# Copyright (c) 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR P... | gpl-2.0 |
Crystalnix/BitPop | chrome/test/functional/chromeos_browser.py | 76 | 1981 | #!/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.
import pyauto_functional # pyauto_functional must come before pyauto.
import pyauto
import test_utils
class ChromeosBrowserTest(p... | bsd-3-clause |
sebmarchand/syzygy | third_party/numpy/files/numpy/core/tests/test_arrayprint.py | 22 | 2816 | import numpy as np
from numpy.testing import *
class TestArrayRepr(object):
def test_nan_inf(self):
x = np.array([np.nan, np.inf])
assert_equal(repr(x), 'array([ nan, inf])')
class TestComplexArray(TestCase):
def test_str(self):
rvals = [0, 1, -1, np.inf, -np.inf, np.nan]
cval... | apache-2.0 |
Bismarrck/tensorflow | tensorflow/python/data/experimental/kernel_tests/dense_to_sparse_batch_test.py | 17 | 4431 | # 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 |
jrbourbeau/cr-composition | processing/legacy/anisotropy/random_trials/process_kstest.py | 2 | 7627 | #!/usr/bin/env python
import os
import argparse
import numpy as np
import pandas as pd
import pycondor
import comptools as comp
if __name__ == "__main__":
p = argparse.ArgumentParser(
description='Extracts and saves desired information from simulation/data .i3 files')
p.add_argument('-c', '--config... | mit |
ar45/django | django/core/files/utils.py | 395 | 1338 | from django.utils import six
class FileProxyMixin(object):
"""
A mixin class used to forward file methods to an underlaying file
object. The internal file object has to be called "file"::
class FileProxy(FileProxyMixin):
def __init__(self, file):
self.file = file
... | bsd-3-clause |
chacoroot/planetary | addons/crm_partner_assign/__openerp__.py | 244 | 2369 | # -*- 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 |
tadebayo/myedge | myvenv/Lib/site-packages/django/dispatch/dispatcher.py | 55 | 11693 | import sys
import threading
import warnings
import weakref
from django.utils import six
from django.utils.deprecation import RemovedInDjango20Warning
from django.utils.inspect import func_accepts_kwargs
from django.utils.six.moves import range
if six.PY2:
from .weakref_backports import WeakMethod
else:
from w... | mit |
hitsthings/node-gyp | gyp/test/mac/gyptest-rebuild.py | 299 | 1260 | #!/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 rebuilt correctly.
"""
import TestGyp
import sys
if sys.platform == 'darwin':
test = TestGyp.TestGyp(... | mit |
tobes/raspberry-DMX | dmx2.py | 1 | 2777 | # -*- coding: utf-8 -*-
# http://www.jonshouse.co.uk/rpidmx512.cgi
from twisted.internet import protocol, reactor, endpoints
from pigpio import pi, pulse as pig_pulse, OUTPUT
PORT = 50007
# pins
PIN_DI = 18 # Driver Input
PIN_DE = 23 # Driver output enable (high to enable)
PIN_RE = 24 # Receive output enable (... | gpl-2.0 |
rest-of/the-deck | lambda/lib/python2.7/site-packages/pip/_vendor/cachecontrol/filewrapper.py | 619 | 2168 | from io import BytesIO
class CallbackFileWrapper(object):
"""
Small wrapper around a fp object which will tee everything read into a
buffer, and when that file is closed it will execute a callback with the
contents of that buffer.
All attributes are proxied to the underlying file object.
Thi... | mit |
paulfurley/festival-weather | festivalweather/parser.py | 1 | 3354 | from __future__ import unicode_literals
import datetime
import pytz
import lxml.etree
from .two_hourly_forecast import TwoHourlyForecast
"""
The Norwegian weather service API 1.9 returns a pretty cool data format, albeit
encoded in XML. It contains two types of forecasts:
1. point-in-time (from="2014-08-03T19... | mit |
dask-image/dask-ndfourier | dask_ndfourier/_compat.py | 1 | 1574 | # -*- coding: utf-8 -*-
"""
Content here is borrowed from our contributions to Dask.
"""
import numpy
import dask.array
def _fftfreq_block(i, n, d):
r = i.copy()
r[i >= (n + 1) // 2] -= n
r /= n * d
return r
def _fftfreq(n, d=1.0, chunks=None):
"""
Return the Discrete Fourier Transform s... | bsd-3-clause |
nkgilley/home-assistant | homeassistant/components/anthemav/media_player.py | 21 | 5438 | """Support for Anthem Network Receivers and Processors."""
import logging
import anthemav
import voluptuous as vol
from homeassistant.components.media_player import PLATFORM_SCHEMA, MediaPlayerEntity
from homeassistant.components.media_player.const import (
SUPPORT_SELECT_SOURCE,
SUPPORT_TURN_OFF,
SUPPORT... | apache-2.0 |
katiecheng/Bombolone | env/lib/python2.7/site-packages/Crypto/Cipher/blockalgo.py | 133 | 12596 | # -*- coding: utf-8 -*-
#
# Cipher/blockalgo.py
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyone is granted a worldwide, perpetual, royalty-free,
# ... | bsd-3-clause |
betoesquivel/fil2014 | filenv/lib/python2.7/site-packages/south/management/commands/syncdb.py | 119 | 4643 | """
Overridden syncdb command
"""
from __future__ import print_function
import sys
from optparse import make_option
from django.core.management.base import NoArgsCommand, BaseCommand
from django.core.management.color import no_style
from django.utils.datastructures import SortedDict
from django.core.management.comm... | mit |
RobertABT/heightmap | build/scipy/scipy/misc/tests/test_common.py | 9 | 2908 | from __future__ import division, print_function, absolute_import
import numpy as np
from numpy.testing import assert_array_equal, assert_almost_equal, \
assert_array_almost_equal, assert_equal
from scipy.misc import pade, logsumexp, face, ascent
def test_pade_trivial():
nump, denomp = ... | mit |
ambikeshwar1991/gnuradio-3.7.4 | gr-atsc/python/atsc/__init__.py | 57 | 1161 | #
# Copyright 2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# any later version.
#
#... | gpl-3.0 |
skoppisetty/secret-bugfixes | lib/cherrypy/lib/caching.py | 88 | 17413 | """
CherryPy implements a simple caching system as a pluggable Tool. This tool tries
to be an (in-process) HTTP/1.1-compliant cache. It's not quite there yet, but
it's probably good enough for most sites.
In general, GET responses are cached (along with selecting headers) and, if
another request arrives for the same r... | gpl-3.0 |
sekaiamber/thefuck | thefuck/rules/ssh_known_hosts.py | 11 | 1044 | import re
patterns = [
r'WARNING: REMOTE HOST IDENTIFICATION HAS CHANGED!',
r'WARNING: POSSIBLE DNS SPOOFING DETECTED!',
r"Warning: the \S+ host key for '([^']+)' differs from the key for the IP address '([^']+)'",
]
offending_pattern = re.compile(
r'(?:Offending (?:key for IP|\S+ key)|Matching host ke... | mit |
opps/opps | opps/api/__init__.py | 4 | 4177 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.http import HttpResponse
from django.contrib.auth import authenticate
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from piston.handler import BaseHandler as Handler
from piston.emitters import JSONEmitter, Emitter
from opps.api.mode... | mit |
ShalY/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers | ExamplesFromChapters/Chapter3/ClusteringWithGaussians.py | 90 | 1034 | import numpy as np
import pymc as pm
data = np.loadtxt("../../Chapter3_MCMC/data/mixture_data.csv", delimiter=",")
p = pm.Uniform("p", 0, 1)
assignment = pm.Categorical("assignment", [p, 1 - p], size=data.shape[0])
taus = 1.0 / pm.Uniform("stds", 0, 100, size=2) ** 2 # notice the size!
centers = pm.Normal("cent... | mit |
googleapis/python-container | google/cloud/container_v1beta1/services/cluster_manager/transports/__init__.py | 2 | 1194 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | apache-2.0 |
lepistone/stock-logistics-warehouse | __unported__/stock_reserve_sale/model/stock_reserve.py | 4 | 1887 | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | agpl-3.0 |
rhjdjong/SlipLib | src/sliplib/slipsocket.py | 2 | 10133 | # Copyright (c) 2020. Ruud de Jong
# This file is part of the SlipLib project which is released under the MIT license.
# See https://github.com/rhjdjong/SlipLib for details.
"""
SlipSocket
----------
.. autoclass:: SlipSocket(sock)
:show-inheritance:
Class :class:`SlipSocket` offers the following methods in... | mit |
SublimeLinter/SublimeLinter3 | tests/test_loose_lintmatch.py | 1 | 5173 | from unittesting import DeferrableTestCase
from SublimeLinter.lint.linter import LintMatch
class TestLooseLintMatch(DeferrableTestCase):
def test_attribute_access(self):
m = object()
match = {
"match": m,
"line": 1,
"col": 2,
"error": "error_txt",
... | mit |
williamsjj/twisted_cql | examples/session_client_example.py | 1 | 1142 | # -*- coding: utf-8-*-
# ###################################################################
# FILENAME: examples/session_client_example.py
# PROJECT:
# DESCRIPTION: Cassandra session wrappers.
#
# ###################################################################
# (C)2015 DigiTar, All Rights Reserved
# ############... | bsd-2-clause |
overtherain/scriptfile | software/googleAppEngine/lib/django_1_4/tests/regressiontests/multiple_database/models.py | 43 | 2251 | from __future__ import absolute_import
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.contrib.contenttypes import generic
from django.db import models
class Review(models.Model):
source = models.CharField(max_length=100)
content_type = model... | mit |
CEG-FYP-OpenStack/scheduler | nova/tests/unit/api/openstack/compute/test_attach_interfaces.py | 8 | 21320 | # Copyright 2012 SINA Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by app... | apache-2.0 |
marcelveldt/plugin.video.flix2kodi | lib/keyring/http.py | 13 | 1255 | """
urllib2.HTTPPasswordMgr object using the keyring, for use with the
urllib2.HTTPBasicAuthHandler.
usage:
import urllib2
handlers = [urllib2.HTTPBasicAuthHandler(PasswordMgr())]
urllib2.install_opener(handlers)
urllib2.urlopen(...)
This will prompt for a password if one is required and isn't already... | gpl-2.0 |
jmighion/ansible | lib/ansible/modules/network/nxos/nxos_static_route.py | 23 | 8490 | #!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | gpl-3.0 |
golismero/golismero | thirdparty_libs/geopy/format.py | 84 | 2758 | from geopy import units
# Unicode characters for symbols that appear in coordinate strings.
DEGREE = unichr(176)
PRIME = unichr(8242)
DOUBLE_PRIME = unichr(8243)
ASCII_DEGREE = ''
ASCII_PRIME = "'"
ASCII_DOUBLE_PRIME = '"'
LATIN1_DEGREE = chr(176)
HTML_DEGREE = '°'
HTML_PRIME = '′'
HTML_DOUBLE_PRIME = '&Prim... | gpl-2.0 |
matmutant/sl4a | python/src/Demo/xml/roundtrip.py | 37 | 1201 | """
A simple demo that reads in an XML document and spits out an equivalent,
but not necessarily identical, document.
"""
import sys, string
from xml.sax import saxutils, handler, make_parser
# --- The ContentHandler
class ContentGenerator(handler.ContentHandler):
def __init__(self, out = sys.stdout):
... | apache-2.0 |
mobify/python-driver | cassandra/decoder.py | 10 | 1632 | # Copyright 2013-2015 DataStax, 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 writi... | apache-2.0 |
jmesteve/openerp | openerp/addons/base_report_designer/wizard/__init__.py | 421 | 1081 | # -*- 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 |
abhijitbangera/ecommerce | src/products/models.py | 1 | 4589 | from django.db import models
from django.core.urlresolvers import reverse
from django.db.models.signals import post_save
from django.utils.text import slugify
from django.utils.safestring import mark_safe
# Create your models here.
class ProductQuerySet(models.query.QuerySet):
def active(self):
return self.filter(a... | mit |
elijah513/django | django/core/serializers/pyyaml.py | 439 | 2843 | """
YAML serializer.
Requires PyYaml (http://pyyaml.org/), but that's checked for in __init__.
"""
import collections
import decimal
import sys
from io import StringIO
import yaml
from django.core.serializers.base import DeserializationError
from django.core.serializers.python import (
Deserializer as PythonDes... | bsd-3-clause |
suiyuan2009/tensorflow | tensorflow/python/debug/examples/debug_errors.py | 150 | 2655 | # 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 |
batermj/algorithm-challenger | code-analysis/programming_anguage/python/source_codes/Python3.8.0/Python-3.8.0/Lib/shelve.py | 34 | 8527 | """Manage shelves of pickled objects.
A "shelf" is a persistent, dictionary-like object. The difference
with dbm databases is that the values (not the keys!) in a shelf can
be essentially arbitrary Python objects -- anything that the "pickle"
module can handle. This includes most class instances, recursive data
type... | apache-2.0 |
837468220/python-for-android | python-modules/twisted/twisted/test/test_doc.py | 99 | 3683 | from twisted.trial import unittest
import inspect, glob, os
from os import path
from twisted.python import reflect
import twisted
def errorInFile(f, line=17, name=''):
"""Return a filename formatted so emacs will recognize it as an error point
@param line: Line number in file. Defaults to 17 because that's... | apache-2.0 |
tencrance/profiling | profiling/viewer.py | 5 | 20846 | # -*- coding: utf-8 -*-
"""
profiling.viewer
~~~~~~~~~~~~~~~~
A text user interface application which inspects statistics. To run it
easily do:
.. sourcecode:: console
$ python -m profiling view SOURCE
::
viewer = StatisticsViewer()
loop = viewer.loop()
loop.run... | bsd-3-clause |
bradleyhd/netsim | nodes_vs_routing_speed.py | 1 | 2878 | import matplotlib.pyplot as plt
import numpy as np
import math
from scipy.optimize import curve_fit
def linear(x, a, b):
return a * x + b
def quadratic(x, a, b, c):
return a * x**2 + b * x + c
def exponential(x, a, b, c):
return a * x**b + c
fig = plt.figure(num=None, figsize=(12, 8), dpi=300, facecolor='k', ... | gpl-3.0 |
esc/dask | dask/dataframe/shuffle.py | 4 | 2967 | from itertools import count
from collections import Iterator
from math import ceil
from toolz import merge, accumulate, merge_sorted
import toolz
from operator import getitem, setitem
import pandas as pd
import numpy as np
from pframe import pframe
from .. import threaded
from .core import DataFrame, Series, get, name... | bsd-3-clause |
marcydoty/geraldo | site/newsite/site-geraldo/appengine_django/serializer/python.py | 20 | 4799 | #!/usr/bin/python2.4
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | lgpl-3.0 |
nnikhilsingh/terrence | tao/caching.py | 1 | 20893 | # -*- coding: utf-8 -*-
import os
import time
import hashlib
import gzip
import bz2
import re
from sqlalchemy.orm.exc import NoResultFound
from tao.database import SearchEngineResultsPage
from tao.parsing import parse_serp
from tao.outputconverter import store_serp_result
import logging
"""
GoogleScrap... | gpl-3.0 |
Shaps/ansible | test/lib/ansible_test/_internal/test.py | 11 | 14612 | """Classes for storing and processing test results."""
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import datetime
import re
from . import types as t
from .util import (
display,
get_ansible_version,
)
from .util_common import (
write_text_test_results,
wr... | gpl-3.0 |
npuichigo/ttsflow | third_party/tensorflow/tensorflow/python/debug/wrappers/hooks.py | 32 | 13374 | # 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 |
KarelJakubec/pip | pip/_vendor/cachecontrol/adapter.py | 469 | 4196 | import functools
from pip._vendor.requests.adapters import HTTPAdapter
from .controller import CacheController
from .cache import DictCache
from .filewrapper import CallbackFileWrapper
class CacheControlAdapter(HTTPAdapter):
invalidating_methods = set(['PUT', 'DELETE'])
def __init__(self, cache=None,
... | mit |
cribster/cribster.github.io | bower_components/bootstrap/test-infra/s3_cache.py | 1700 | 3523 | #!/usr/bin/env python2.7
from __future__ import absolute_import, unicode_literals, print_function, division
from sys import argv
from os import environ, stat, remove as _delete_file
from os.path import isfile, dirname, basename, abspath
from hashlib import sha256
from subprocess import check_call as run
from boto.s3.... | mit |
afandria/sky_engine | third_party/android_testrunner/errors.py | 171 | 1340 | #!/usr/bin/python2.4
#
#
# Copyright 2008, The Android Open Source Project
#
# 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 requir... | bsd-3-clause |
ahmedjabbar/uor | tg/tg-test.py | 199 | 1450 | import tgl
import pprint
from functools import partial
our_id = 0
pp = pprint.PrettyPrinter(indent=4)
binlog_done = False;
def on_binlog_replay_end():
binlog_done = True;
def on_get_difference_end():
pass
def on_our_id(id):
our_id = id
return "Set ID: " + str(our_id)
def msg_cb(success, msg):
... | gpl-2.0 |
syci/OCB | addons/sale/tests/test_sale_order.py | 40 | 7670 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
from openerp.exceptions import UserError, AccessError
from test_sale_common import TestSale
class TestSaleOrder(TestSale):
def test_sale_order(self):
""" Test the sale order flow (invoicing and quantity upd... | agpl-3.0 |
kartikp1995/gnuradio | gnuradio-runtime/python/pmt/qa_pmt_to_python.py | 48 | 1554 | #!/usr/bin/env python
#
# Copyright 2013 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# GNU Radio 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, or (at your option)
# ... | gpl-3.0 |
da1z/intellij-community | python/helpers/profiler/thriftpy/_compat.py | 20 | 3953 | # -*- coding: utf-8 -*-
"""
thriftpy._compat
~~~~~~~~~~~~~
py2/py3 compatibility support.
"""
from __future__ import absolute_import
import platform
import sys
import types
PY3 = sys.version_info[0] == 3
PYPY = "__pypy__" in sys.modules
UNIX = platform.system() in ("Linux", "Darwin")
CYTHON = False #... | apache-2.0 |
gangadhar-kadam/sapphire_app | hr/report/monthly_salary_register/monthly_salary_register.py | 2 | 4044 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd.
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import webnotes
from webnotes.utils import flt, cstr
from webnotes import msgprint, _
def execute(filters=None):
if not filters: filters = {}
salary_slips = get_... | agpl-3.0 |
goldenbull/grpc | src/python/grpcio/tests/unit/framework/interfaces/face/_3069_test_constant.py | 25 | 1848 | # Copyright 2015, Google Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the f... | bsd-3-clause |
rruebner/odoo | addons/hw_escpos/escpos/escpos.py | 66 | 31141 | # -*- coding: utf-8 -*-
'''
@author: Manuel F Martinez <manpaz@bashlinux.com>
@organization: Bashlinux
@copyright: Copyright (c) 2012 Bashlinux
@license: GPL
'''
try:
import qrcode
except ImportError:
qrcode = None
import time
import copy
import io
import base64
import math
import md5
import re
import traceb... | agpl-3.0 |
capriele/crazyflie-clients-python-move | lib/cflib/crtp/debugdriver.py | 9 | 35152 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# || ____ _ __
# +------+ / __ )(_) /_______________ _____ ___
# | 0xBC | / __ / / __/ ___/ ___/ __ `/_ / / _ \
# +------+ / /_/ / / /_/ /__/ / / /_/ / / /_/ __/
# || || /_____/_/\__/\___/_/ \__,_/ /___/\___/
#
# Copyright (C) 20... | gpl-2.0 |
ehashman/oh-mainline | vendor/packages/gdata/samples/apps/adminsettings_example.py | 41 | 5677 | #!/usr/bin/python
#
# Copyright 2009 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required b... | agpl-3.0 |
waynesun09/virt-test | virttest/remote.py | 1 | 44950 | """
Functions and classes used for logging into guests and transferring files.
"""
import logging
import time
import re
import os
import shutil
import tempfile
import aexpect
import utils_misc
import rss_client
import base64
from remote_commander import remote_master
from remote_commander import messenger
from autote... | gpl-2.0 |
jgoclawski/django | django/test/utils.py | 14 | 20900 | import logging
import re
import sys
import time
import warnings
from contextlib import contextmanager
from functools import wraps
from unittest import skipIf, skipUnless
from xml.dom.minidom import Node, parseString
from django.apps import apps
from django.conf import UserSettingsHolder, settings
from django.core impo... | bsd-3-clause |
culots/meld | meld/undo.py | 5 | 8280 | # Copyright (C) 2002-2006 Stephen Kennedy <stevek@gnome.org>
# Copyright (C) 2010-2011 Kai Willadsen <kai.willadsen@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 2 ... | gpl-2.0 |
hehongliang/tensorflow | tensorflow/tools/common/public_api.py | 24 | 4920 | # 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 |
c-o-m-m-a-n-d-e-r/CouchPotatoServer | libs/pyutil/hashexpand.py | 106 | 2890 | # Copyright (c) 2002-2012 Zooko Wilcox-O'Hearn
# This file is part of pyutil; see README.rst for licensing terms.
import warnings
"""
Cryptographically strong pseudo-random number generator based on SHA256.
"""
class SHA256Expander:
"""
Provide a cryptographically strong pseudo-random number generator base... | gpl-3.0 |
BartoszCichecki/onlinepython | onlinepython/pypy-2.4.0-win32/lib-python/2.7/test/test_code.py | 8 | 3307 | """This module includes tests of the code object representation.
>>> def f(x):
... def g(y):
... return x + y
... return g
...
>>> dump(f.func_code)
name: f
argcount: 1
names: ()
varnames: ('x', 'g')
cellvars: ('x',)
freevars: ()
nlocals: 2
flags: 3
consts: ('None', '<code object g>')
>>> dump(f(4).f... | gpl-2.0 |
fdecourcelle/meanfde | node_modules/meanio/node_modules/mean-cli/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/common.py | 497 | 17406 | # 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 __future__ import with_statement
import errno
import filecmp
import os.path
import re
import tempfile
import sys
# A minimal memoizing decorator. It'll blo... | mit |
GoogleCloudPlatform/dataflow-sample-applications | timeseries-streaming/timeseries-python-applications/ml_pipeline/timeseries/encoder_decoder/transforms/process_encdec_inf_rtn.py | 1 | 9368 | #
# 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 |
jonyachen/hearboi | record_2.py | 1 | 1234 | """
PyAudio exmple: Record a few seconds of audio and save to a WAVE
file.
"""
import pyaudio
import wave
import sys
from dejavu import Dejavu
CHUNK = 8192
FORMAT = pyaudio.paInt16
CHANNELS = 1L
RATE = 48000
RECORD_SECONDS = 5
WAVE_OUTPUT_FILENAME = "/sounds/output.wav"
if sys.platform == 'darwin':
CHANNELS = 1
... | mit |
benoitc/dj-revproxy | revproxy/store.py | 1 | 4409 | # -*- coding: utf-8 -
#
# This file is part of dj-revproxy released under the MIT license.
# See the NOTICE for more information.
import os
import types
import uuid
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.conf import settings
from restkit.tee import Te... | mit |
addition-it-solutions/project-all | addons/mrp/wizard/change_production_qty.py | 7 | 4789 | # -*- 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 |
rohitwaghchaure/erpnext_develop | erpnext/shopping_cart/test_shopping_cart.py | 2 | 6744 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import unittest
import frappe
from frappe.utils import nowdate, add_months
from erpnext.shopping_cart.cart import _get_cart_quotation, update_cart, get_... | gpl-3.0 |
mavit/ansible | lib/ansible/modules/network/avi/avi_vrfcontext.py | 20 | 4674 | #!/usr/bin/python
#
# @author: Gaurav Rastogi (grastogi@avinetworks.com)
# Eric Anderson (eanderson@avinetworks.com)
# module_check: supported
# Avi Version: 17.1.2
#
# Copyright: (c) 2017 Gaurav Rastogi, <grastogi@avinetworks.com>
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses... | gpl-3.0 |
ZhuangER/robot_path_planning | gui/pyqtgraph/python2_3.py | 4 | 1727 | """
Helper functions which smooth out the differences between python 2 and 3.
"""
import sys
def asUnicode(x):
if sys.version_info[0] == 2:
if isinstance(x, unicode):
return x
elif isinstance(x, str):
return x.decode('UTF-8')
else:
return unicode(x)
e... | mit |
jmighion/ansible | lib/ansible/modules/cloud/amazon/elasticache.py | 26 | 20767 | #!/usr/bin/python
#
# Copyright (c) 2017 Ansible Project
#
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
'supported_by': 'community'}
DOCUMENTATION = """
---
mod... | gpl-3.0 |
t3dev/odoo | addons/website_sale_digital/controllers/main.py | 5 | 4569 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import base64
import io
from werkzeug.utils import redirect
from odoo import http
from odoo.http import request
from odoo.addons.sale.controllers.portal import CustomerPortal
from odoo.addons.website_sale.controllers.ma... | gpl-3.0 |
doheekim/chuizonetest | lib/sqlalchemy/dialects/sqlite/pysqlite.py | 10 | 13249 | # sqlite/pysqlite.py
# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""
.. dialect:: sqlite+pysqlite
:name: pysqlite
:dbapi: sqlite3
:con... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.