repo_name stringlengths 5 100 | path stringlengths 4 375 | copies stringclasses 991
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
kushalbhola/MyStuff | Practice/PythonApplication/env/Lib/site-packages/pip/_vendor/html5lib/filters/optionaltags.py | 156 | 10588 | from __future__ import absolute_import, division, unicode_literals
from . import base
class Filter(base.Filter):
"""Removes optional tags from the token stream"""
def slider(self):
previous1 = previous2 = None
for token in self.source:
if previous1 is not None:
yie... | apache-2.0 |
asajeffrey/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/executors/pytestrunner/runner.py | 7 | 4885 | """
Provides interface to deal with pytest.
Usage::
session = webdriver.client.Session("127.0.0.1", "4444", "/")
harness_result = ("OK", None)
subtest_results = pytestrunner.run("/path/to/test", session.url)
return (harness_result, subtest_results)
"""
import errno
import json
import os
import shutil... | mpl-2.0 |
Denisolt/Tensorflow_Chat_Bot | local/lib/python2.7/site-packages/scipy/weave/tests/test_build_tools.py | 96 | 2480 | from __future__ import absolute_import, print_function
# still needed
# tests for MingW32Compiler
# don't know how to test gcc_exists() and msvc_exists()...
import os
import sys
import tempfile
import warnings
from numpy.testing import TestCase, assert_, run_module_suite
from scipy.weave import build_tools
# filte... | gpl-3.0 |
katsikas/gnuradio | grc/grc_gnuradio/blks2/packet.py | 1 | 8921 | # Copyright 2008, 2009 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 |
AlexProfi/django-cms | cms/test_utils/project/placeholderapp/views.py | 37 | 3569 | from django.http import HttpResponse
from django.shortcuts import render
from django.template import RequestContext
from django.template.base import Template
from django.views.generic import DetailView
from cms.test_utils.project.placeholderapp.models import (
Example1, MultilingualExample1, CharPksExample)
from cm... | bsd-3-clause |
psolbach/metadoc | setup.py | 1 | 2387 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
import os.path
import sys
import re
from subprocess import call
from setuptools import setup, find_packages
from setuptools.command.install import install as _install
from setuptools.command.sdist import sdist as _sdist
from wheel.bdist_wheel import bdist_wheel as _bdist_w... | mit |
idosekely/python-lessons | lesson_5/client.py | 1 | 1263 | import socket
import sys
__author__ = 'sekely'
class SimpleClient(object):
def __init__(self, addr='localhost', port=50000, buf=1024):
self.buf = buf
server_address = (addr, port)
# Create a TCP/IP socket
self.sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
print... | mit |
pivanof/vitess | examples/local/client.py | 13 | 2555 | #!/usr/bin/env python
# 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... | apache-2.0 |
scailer/drf-docs-from-tests | docsfromtests/collector.py | 1 | 1878 | # -*- coding: utf-8 -*-
import os
import json
import codecs
from collections import defaultdict
from django.template.loader import render_to_string
from . import conf
def json_pretty_print(data):
if not data:
return u''
if isinstance(data, (dict, list)):
return json.dumps(data, sort_keys=Tr... | mit |
GoSteven/Diary | django/contrib/gis/tests/layermap/models.py | 12 | 2245 | from django.contrib.gis.db import models
class State(models.Model):
name = models.CharField(max_length=20)
objects = models.GeoManager()
class County(models.Model):
name = models.CharField(max_length=25)
state = models.ForeignKey(State)
mpoly = models.MultiPolygonField(srid=4269) # Multip... | bsd-3-clause |
kivatu/kivy-bak | kivy/uix/sandbox.py | 9 | 5648 | '''
Sandbox
=======
.. versionadded:: 1.8.0
.. warning::
This is experimental and subject to change as long as this warning notice
is present.
This is a widget that runs itself and all of its children in a Sandbox. That
means if a child raises an Exception, it will be caught. The Sandbox
itself runs its own... | mit |
unicefuganda/uSurvey | survey/tests/forms/test_batch_form.py | 1 | 2440 | from django.test import TestCase
from survey.forms.question_set import BatchForm
from survey.models.locations import *
from survey.models import EnumerationArea
from survey.models import Interviewer
from survey.models.access_channels import *
from survey.models.batch import Batch
from survey.models.surveys import Surve... | bsd-3-clause |
aimas/TuniErp-8.0 | openerp/tools/misc.py | 62 | 45907 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>).
# Copyright (C) 2010-2014 OpenERP s.a. (<http://openerp.com>).
#
# This program is free software: you ca... | agpl-3.0 |
phenoxim/nova | nova/tests/unit/api/openstack/compute/test_server_external_events.py | 3 | 9010 | # Copyright 2014 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 |
Jorge-Rodriguez/ansible | lib/ansible/module_utils/network/ftd/configuration.py | 21 | 24087 | # Copyright (c) 2018 Cisco and/or its affiliates.
#
# 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 v... | gpl-3.0 |
miipl-naveen/optibizz | addons/base_report_designer/plugin/openerp_report_designer/bin/script/Fields.py | 384 | 12340 | #########################################################################
#
# 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 Gene... | agpl-3.0 |
fivejjs/python-linkedin | linkedin/utils.py | 7 | 2291 | # -*- coding: utf-8 -*-
import requests
from .exceptions import LinkedInError, get_exception_for_error_code
import sys
from io import StringIO
try:
import simplejson as json
except ImportError:
try:
from django.utils import simplejson as json
except ImportError:
import json
if sys.version... | mit |
brianhouse/housepy | lib/beanstalkc.py | 1 | 11489 | #!/usr/bin/env python
"""beanstalkc - A beanstalkd Client Library for Python"""
import logging
import socket
import sys
__license__ = '''
Copyright (C) 2008-2015 Andreas Bolka
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obt... | mit |
zuotingbing/spark | python/pyspark/ml/param/_shared_params_code_gen.py | 8 | 9216 | #
# 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 |
MrLoick/python-for-android | python3-alpha/python3-src/Lib/encodings/undefined.py | 860 | 1299 | """ Python 'undefined' Codec
This codec will always raise a ValueError exception when being
used. It is intended for use by the site.py file to switch off
automatic string to Unicode coercion.
Written by Marc-Andre Lemburg (mal@lemburg.com).
(c) Copyright CNRI, All Rights Reserved. NO WARRANTY.
"""
impo... | apache-2.0 |
belmiromoreira/nova | nova/cells/weights/__init__.py | 141 | 1284 | # Copyright (c) 2012-2013 Rackspace Hosting
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unles... | apache-2.0 |
scripnichenko/nova | nova/tests/functional/api_sample_tests/test_cells.py | 17 | 4818 | # Copyright 2012 Nebula, Inc.
# Copyright 2013 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... | apache-2.0 |
LabAdvComp/tukey_middleware | tukey_middleware/couch.py | 1 | 2583 | # Copyright 2013 Open Cloud Consortium
#
# 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 a... | apache-2.0 |
jonashaag/django-nonrel-nohistory | tests/regressiontests/utils/feedgenerator.py | 51 | 2526 | import datetime
from django.utils import feedgenerator, tzinfo, unittest
class FeedgeneratorTest(unittest.TestCase):
"""
Tests for the low-level syndication feed framework.
"""
def test_get_tag_uri(self):
"""
Test get_tag_uri() correctly generates TagURIs.
"""
self.ass... | bsd-3-clause |
campbe13/openhatch | vendor/packages/Django/tests/regressiontests/inline_formsets/tests.py | 51 | 6211 | from __future__ import absolute_import, unicode_literals
from django.forms.models import inlineformset_factory
from django.test import TestCase
from django.utils import six
from .models import Poet, Poem, School, Parent, Child
class DeletionTests(TestCase):
def test_deletion(self):
PoemFormSet = inline... | agpl-3.0 |
Vicente-Cheng/ceph-deploy | ceph_deploy/install.py | 1 | 19366 | import argparse
import logging
import os
from ceph_deploy import hosts
from ceph_deploy.cliutil import priority
from ceph_deploy.lib import remoto
from ceph_deploy.util.constants import default_components
from ceph_deploy.util.paths import gpg
LOG = logging.getLogger(__name__)
def sanitize_args(args):
"""
a... | mit |
Tagar/incubator-airflow | airflow/sensors/sql_sensor.py | 5 | 2072 | # -*- 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 |
weisongchen/flaskapp | venv/lib/python2.7/site-packages/click/parser.py | 199 | 15510 | # -*- coding: utf-8 -*-
"""
click.parser
~~~~~~~~~~~~
This module started out as largely a copy paste from the stdlib's
optparse module with the features removed that we do not need from
optparse because we implement them in Click on a higher level (for
instance type handling, help formatting a... | mit |
mathspace/django | tests/queryset_pickle/models.py | 281 | 1904 | import datetime
from django.db import DJANGO_VERSION_PICKLE_KEY, models
from django.utils import six
from django.utils.translation import ugettext_lazy as _
def standalone_number():
return 1
class Numbers(object):
@staticmethod
def get_static_number():
return 2
class PreviousDjangoVersionQuer... | bsd-3-clause |
hosford42/xcs | xcs/__init__.py | 1 | 6684 | # -*- coding: utf-8 -*-
# -------------------------------------------------------------------------
# xcs
# ---
# Accuracy-based Classifier Systems for Python 3
#
# http://hosford42.github.io/xcs/
#
# (c) Aaron Hosford 2015, all rights reserved
# Revised (3 Clause) BSD License
#
# Implements the XCS (Accuracy-based Cla... | bsd-3-clause |
cleverhans-lab/cleverhans | cleverhans_v3.1.0/examples/nips17_adversarial_competition/eval_infra/code/eval_lib/tests/submissions_test.py | 1 | 7953 | """Tests for eval_lib.submissions."""
from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import unittest
from six import assertCountEqual
from eval_lib import submissions
from eval_lib.tests import fake_cloud_client
ROUND_NAME = "round-name"
class Partic... | mit |
morganbengtsson/io_mos | mos/materials.py | 1 | 5751 | import bpy
import json
from shutil import copyfile
from .common import *
def copy_linked_map(input_name, directory, blender_material, node):
if not node:
return None
node_input = node.inputs.get(input_name)
if not node_input:
return None
image_path = None
texture_path = None
if... | mit |
ProkopHapala/SimpleSimulationEngine | python/pySimE/space/exp/pykep/lambert_MarsEarthDeltaV_2D.py | 1 | 2872 |
from pylab import *
from PyKEP import epoch, DAY2SEC, planet_ss, AU, MU_SUN, lambert_problem
from PyKEP.orbit_plots import plot_planet, plot_lambert
plEarth = planet_ss('earth');
plMars = planet_ss('mars');
def opt_dt(tt1,tt2):
t1 = epoch(tt1)
t2 = epoch(tt2)
#print t1
dt = (t2.mjd2000 - t1.m... | mit |
MeigaraJuma/XQS-Website-Angular | node_modules/node-gyp/gyp/PRESUBMIT.py | 1369 | 3662 | # 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.
"""Top-level presubmit script for GYP.
See http://dev.chromium.org/developers/how-tos/depottools/presubmit-scripts
for more details about the presubmit API built... | mit |
DmitryYurov/BornAgain | Examples/python/simulation/ex01_BasicParticles/TwoTypesOfCylindersWithSizeDistribution.py | 2 | 2580 | """
Mixture cylinder particles with different size distribution
"""
import bornagain as ba
from bornagain import deg, angstrom, nm
def get_sample():
"""
Returns a sample with cylinders in a homogeneous medium ("air").
The cylinders are a 95:5 mixture of two different size distributions.
"""
# defi... | gpl-3.0 |
marcoantoniooliveira/labweb | oscar/lib/python2.7/site-packages/nose/plugins/prof.py | 106 | 5357 | """This plugin will run tests using the hotshot profiler, which is part
of the standard library. To turn it on, use the ``--with-profile`` option
or set the NOSE_WITH_PROFILE environment variable. Profiler output can be
controlled with the ``--profile-sort`` and ``--profile-restrict`` options,
and the profiler output f... | bsd-3-clause |
BackupTheBerlios/espressopp | src/FixedQuadrupleList.py | 1 | 2673 | # Copyright (C) 2012,2013
# Max Planck Institute for Polymer Research
# Copyright (C) 2008,2009,2010,2011
# Max-Planck-Institute for Polymer Research & Fraunhofer SCAI
#
# This file is part of ESPResSo++.
#
# ESPResSo++ is free software: you can redistribute it and/or modify
# it under the terms of t... | gpl-3.0 |
bigswitch/nova | nova/tests/unit/test_availability_zones.py | 15 | 11973 | # Copyright 2013 Netease 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
#
# Unless requi... | apache-2.0 |
uclouvain/osis | base/models/learning_unit_enrollment.py | 1 | 3112 | ##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | agpl-3.0 |
remitamine/youtube-dl | youtube_dl/extractor/douyutv.py | 51 | 6878 | # coding: utf-8
from __future__ import unicode_literals
import time
import hashlib
import re
from .common import InfoExtractor
from ..utils import (
ExtractorError,
unescapeHTML,
unified_strdate,
urljoin,
)
class DouyuTVIE(InfoExtractor):
IE_DESC = '斗鱼'
_VALID_URL = r'https?://(?:www\.)?douy... | unlicense |
xxxIsaacPeralxxx/anim-studio-tools | grind/python/util/glWidget.py | 5 | 11356 |
import sys
import math
from pimath import *
from PyQt4 import QtCore, QtGui, QtOpenGL
from camera import Camera
import grind
#-----------------------------------------------------------------------------
from rodin import logging
log = logging.get_logger('grind.mangle.gl_widget')
try:
from OpenGL.GL import *
... | gpl-3.0 |
h2oai/h2o-3 | h2o-py/tests/testdir_algos/naivebayes/pyunit_grid_carsNB.py | 3 | 4260 | from __future__ import print_function
import sys
sys.path.insert(1,"../../../")
import h2o
from tests import pyunit_utils
import random
import copy
from h2o.estimators.naive_bayes import H2ONaiveBayesEstimator
from h2o.grid.grid_search import H2OGridSearch
def grid_cars_NB():
cars = h2o.import_file(path=pyunit_ut... | apache-2.0 |
sk413025/thug | src/DOM/W3C/HTML/HTMLElement.py | 7 | 2487 | #!/usr/bin/env python
import sys, os
sys.path.append(os.path.abspath(os.path.join(os.path.dirname(__file__), os.pardir)))
try:
from io import StringIO
except ImportError:
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
import bs4 as BeautifulSoup
impo... | gpl-2.0 |
Khroki/MCEdit-Unified | pymclevel/test/templevel.py | 13 | 1394 | import atexit
import os
from os.path import join
import shutil
import tempfile
from pymclevel import mclevel
__author__ = 'Rio'
tempdir = os.path.join(tempfile.gettempdir(), "pymclevel_test")
if not os.path.exists(tempdir):
os.mkdir(tempdir)
def mktemp(suffix):
td = tempfile.mkdtemp(suffix, dir=tempdir)
... | isc |
Eaglemania/TOL | pyglet/gl/glxext_mesa.py | 46 | 2050 | # ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistribu... | gpl-2.0 |
DirectXMan12/nova-hacking | nova/tests/api/openstack/compute/plugins/v3/test_evacuate.py | 1 | 6490 | # 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 or a... | apache-2.0 |
SaschaMester/delicium | third_party/python_gflags/gflags.py | 448 | 104236 | #!/usr/bin/env python
#
# Copyright (c) 2002, 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 ... | bsd-3-clause |
albertomurillo/ansible | lib/ansible/modules/network/onyx/onyx_mlag_ipl.py | 118 | 6779 | #!/usr/bin/python
#
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | gpl-3.0 |
shanemcd/ansible | lib/ansible/modules/network/nxos/nxos_rollback.py | 4 | 3936 | #!/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 |
bellwethers-in-se/defects | src/old/axe/sk.py | 1 | 16773 | """
## Hyptotheis Testing Stuff
### Standard Stuff
#### Standard Headers
"""
from __future__ import division
import sys
import random
import math
from functools import reduce
sys.dont_write_bytecode = True
"""
#### Standard Utils
"""
class o():
"Anonymous container"
def __init__(i, **fields):
i.overri... | mit |
wuhengzhi/chromium-crosswalk | tools/perf/page_sets/page_reload_cases.py | 22 | 1393 | # Copyright 2015 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import shared_page_state
from telemetry import story
from page_sets import top_pages
def _Reload(action_runner):
# Numbers below are ... | bsd-3-clause |
donniexyz/calligra | plugins/formulashape/scripts/DictionaryGenerator.py | 10 | 4762 | #! /usr/bin/env python
"""This file is part of the KDE project
Copyright (C) 2007 Martin Pfeiffer <hubipete@gmx.net>
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Library General Public
License as published by the Free Software Foundation; either
ver... | gpl-2.0 |
CyanogenMod/android_external_chromium_org | mojo/public/tools/bindings/pylib/mojom/parse/parser.py | 8 | 8912 | # 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.
"""Generates a syntax tree from a Mojo IDL file."""
import imp
import os.path
import sys
# Disable lint check for finding modules:
# pylint: disable=F0401
... | bsd-3-clause |
ftomassetti/intellij-community | python/helpers/coverage/__init__.py | 208 | 4505 | """Code coverage measurement for Python.
Ned Batchelder
http://nedbatchelder.com/code/coverage
"""
from coverage.version import __version__, __url__
from coverage.control import coverage, process_startup
from coverage.data import CoverageData
from coverage.cmdline import main, CoverageScript
from coverage.misc impo... | apache-2.0 |
Andygmb/python-social-auth | social/backends/github.py | 53 | 3946 | """
Github OAuth2 backend, docs at:
http://psa.matiasaguirre.net/docs/backends/github.html
"""
from requests import HTTPError
from six.moves.urllib.parse import urljoin
from social.backends.oauth import BaseOAuth2
from social.exceptions import AuthFailed
class GithubOAuth2(BaseOAuth2):
"""Github OAuth authe... | bsd-3-clause |
tomer8007/kik-bot-api-unofficial | kik_unofficial/protobuf/messagepath/v1/feature_payment_pb2.py | 1 | 3906 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: messagepath/v1/feature_payment.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _message
from google.protobuf impo... | mit |
pacoqueen/ginn | ginn/formularios/listado_productos.py | 1 | 9474 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright (C) 2005-2008 Francisco José Rodríguez Bogado, #
# Diego Muñoz Escalante. #
# (pacoqueen@users.sourceforge.ne... | gpl-2.0 |
AMOboxTV/AMOBox.LegoBuild | script.module.youtube.dl/lib/youtube_dl/extractor/udn.py | 24 | 2302 | # coding: utf-8
from __future__ import unicode_literals
import json
from .common import InfoExtractor
from ..utils import (
js_to_json,
ExtractorError,
)
from ..compat import compat_urlparse
class UDNEmbedIE(InfoExtractor):
IE_DESC = '聯合影音'
_PROTOCOL_RELATIVE_VALID_URL = r'//video\.udn\.com/(?:embed|... | gpl-2.0 |
AdamHull/namebench | nb_third_party/simplejson/ordered_dict.py | 1039 | 3370 | """Drop-in replacement for collections.OrderedDict by Raymond Hettinger
http://code.activestate.com/recipes/576693/
"""
from UserDict import DictMixin
# Modified from original to support Python 2.4, see
# http://code.google.com/p/simplejson/issues/detail?id=53
try:
all
except NameError:
def all(seq):
... | apache-2.0 |
louietsai/python-for-android | python3-alpha/python3-src/Lib/distutils/tests/test_text_file.py | 171 | 3436 | """Tests for distutils.text_file."""
import os
import unittest
from distutils.text_file import TextFile
from distutils.tests import support
from test.support import run_unittest
TEST_DATA = """# test file
line 3 \\
# intervening comment
continues on next line
"""
class TextFileTestCase(support.TempdirManager, unit... | apache-2.0 |
ztianai/INFO370-Project | code/cole/blockchain_index.py | 1 | 3061 | import time
import datetime
from blockchain.exceptions import APIException
from blockchain import blockexplorer
from dateutil.relativedelta import relativedelta
from urllib.error import HTTPError
curr_block_height = 277198
def get_transactions(height):
fail = True
while fail:
try:
block = ... | mit |
mancoast/CPythonPyc_test | fail/325_test_zipimport.py | 55 | 17221 | import sys
import os
import marshal
import imp
import struct
import time
import unittest
from test import support
from test.test_importhooks import ImportHooksBaseTestCase, test_src, test_co
# some tests can be ran even without zlib
try:
import zlib
except ImportError:
zlib = None
from zipfile import ZipFile... | gpl-3.0 |
eHealthAfrica/onadata | onadata/apps/sms_support/views.py | 9 | 2704 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# vim: ai ts=4 sts=4 et sw=4 nu
import json
from django.http import HttpResponse
from django.views.decorators.http import require_GET, require_POST
from django.views.decorators.csrf import csrf_exempt
from django.utils.translation import ugettext as _
from tools import S... | bsd-2-clause |
hassanabidpk/djangoproject.com | docs/management/commands/update_index.py | 8 | 1112 | from optparse import make_option as Option
from django.core.management.base import BaseCommand
from ...search import DocumentDocType
class Command(BaseCommand):
option_list = BaseCommand.option_list + (
Option("--using", default=None,
help='The name of the connection to use'),
Opt... | bsd-3-clause |
RedHatQE/cfme_tests | cfme/tests/configure/test_db_backup_schedule.py | 1 | 8973 | # -*- coding: utf-8 -*-
from datetime import datetime
import fauxfactory
import pytest
from dateutil.relativedelta import relativedelta
from six.moves.urllib.parse import urlparse
from cfme.utils import conf
from cfme.utils import testgen
from cfme.utils.pretty import Pretty
from cfme.utils.ssh import SSHClient
from ... | gpl-2.0 |
trishnaguha/ansible | lib/ansible/modules/cloud/amazon/lightsail.py | 40 | 15620 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
juhalindfors/bazel-patches | third_party/py/mock/tests/testmagicmethods.py | 109 | 14863 | # Copyright (C) 2007-2012 Michael Foord & the mock team
# E-mail: fuzzyman AT voidspace DOT org DOT uk
# http://www.voidspace.org.uk/python/mock/
from tests.support import unittest2, inPy3k
try:
unicode
except NameError:
# Python 3
unicode = str
long = int
import inspect
import sys
from mock import M... | apache-2.0 |
coffeemakr/torweb | torweb/api/json/encoder.py | 1 | 1539 | import datetime
import json
import txtorcon.util
from torweb.api.json import (base, circuit, minimalstream,
router)
from txtorcon.util import ipaddr as ipaddress
from txtorcon import Router, Circuit, Stream
IPADDRESSES = (ipaddress.IPv4Address,
ipaddress.IPv6Address,
... | gpl-2.0 |
ciraxwe/cherrypy-app-engine | cherrypy/_cpserver.py | 58 | 8275 | """Manage HTTP servers with CherryPy."""
import warnings
import cherrypy
from cherrypy.lib import attributes
from cherrypy._cpcompat import basestring, py3k
# We import * because we want to export check_port
# et al as attributes of this module.
from cherrypy.process.servers import *
class Server(ServerAdapter):
... | apache-2.0 |
fschulze/pytest-warnings | pytest_warnings/__init__.py | 1 | 3578 | import inspect
import os
import pytest
import warnings
_DISABLED = False
def _setoption(wmod, arg):
"""
Copy of the warning._setoption function but does not escape arguments.
"""
parts = arg.split(':')
if len(parts) > 5:
raise wmod._OptionError("too many fields (max 5): %r" % (arg,))
... | mit |
PalisadoesFoundation/switchmap-ng | switchmap/test/test_mib_if.py | 2 | 15887 | #!/usr/bin/env python3
"""Test the mib_if module."""
import os
import sys
import binascii
import unittest
from mock import Mock
# Try to create a working PYTHONPATH
TEST_DIRECTORY = os.path.dirname(os.path.realpath(__file__))
SWITCHMAP_DIRECTORY = os.path.abspath(os.path.join(TEST_DIRECTORY, os.pardir))
ROOT_DIRECTOR... | apache-2.0 |
SPACEDAC7/TrabajoFinalGrado | DynamicAnalyzer/tools/adb/mac/systrace/systrace.py | 148 | 10843 | #!/usr/bin/env python
# Copyright (c) 2011 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.
"""Android system-wide tracing utility.
This is a tool for capturing a trace that includes data from both userland and
the kernel... | gpl-3.0 |
collects/VTK | Imaging/Core/Testing/Python/TestHSVToRGB.py | 20 | 2405 | #!/usr/bin/env python
import vtk
from vtk.test import Testing
from vtk.util.misc import vtkGetDataRoot
VTK_DATA_ROOT = vtkGetDataRoot()
# Use the painter to draw using colors.
# This is not a pipeline object. It will support pipeline objects.
# Please do not use this object directly.
imageCanvas = vtk.vtkImageCanvasS... | bsd-3-clause |
prheenan/prhUtil | igor/scripts/SqlAutoGen/sqltableread.py | 1 | 6863 | # force floating point division. Can still use integer with //
from __future__ import division
# This file is used for importing the common utilities classes.
import numpy as np
import matplotlib.pyplot as plt
# need to add the utilities class. Want 'home' to be platform independent
from os.path import expanduser
home ... | gpl-2.0 |
gcd0318/django | tests/utils_tests/test_duration.py | 364 | 1677 | import datetime
import unittest
from django.utils.dateparse import parse_duration
from django.utils.duration import duration_string
class TestDurationString(unittest.TestCase):
def test_simple(self):
duration = datetime.timedelta(hours=1, minutes=3, seconds=5)
self.assertEqual(duration_string(du... | bsd-3-clause |
moijes12/oh-mainline | vendor/packages/scrapy/scrapyd/app.py | 16 | 1290 | from twisted.application.service import Application
from twisted.application.internet import TimerService, TCPServer
from twisted.web import server
from twisted.python import log
from .interfaces import IEggStorage, IPoller, ISpiderScheduler, IEnvironment
from .launcher import Launcher
from .eggstorage import Filesyst... | agpl-3.0 |
appleseedhq/gaffer | python/GafferSceneUITest/TranslateToolTest.py | 1 | 29298 | ##########################################################################
#
# Copyright (c) 2016, John Haddon. 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 so... | bsd-3-clause |
katerina7479/kadre | view/main_window.py | 1 | 4144 | from PySide import QtGui
from PySide import QtCore
from PySide.QtGui import QMainWindow
from PySide.QtGui import QAction
from utils import myjson
from pagemanager import PageManager
from dialogs.opendialog import OpenDialog
from kglobals import _PATH
class KMainWindow(QMainWindow):
def __init__(self, title):
... | mit |
yhpeng-git/mxnet | example/warpctc/lstm_model.py | 15 | 2099 |
# pylint: disable=C0111,too-many-arguments,too-many-instance-attributes,too-many-locals,redefined-outer-name,fixme
# pylint: disable=superfluous-parens, no-member, invalid-name
import sys
sys.path.insert(0, "../../python")
import numpy as np
import mxnet as mx
from lstm import LSTMState, LSTMParam, lstm, lstm_inferen... | apache-2.0 |
mrquim/repository.mrquim | repo/script.module.youtube.dl/lib/youtube_dl/extractor/scrippsnetworks.py | 33 | 2528 | # coding: utf-8
from __future__ import unicode_literals
from .adobepass import AdobePassIE
from ..utils import (
int_or_none,
smuggle_url,
update_url_query,
)
class ScrippsNetworksWatchIE(AdobePassIE):
IE_NAME = 'scrippsnetworks:watch'
_VALID_URL = r'https?://watch\.(?:hgtv|foodnetwork|travelchan... | gpl-2.0 |
whn09/tensorflow | tensorflow/contrib/metrics/python/ops/histogram_ops.py | 159 | 10459 | # 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 |
RRCKI/panda-server | pandaserver/userinterface/Client.py | 1 | 63710 | '''
client methods
'''
import os
import re
import sys
import gzip
import urllib
import commands
import tempfile
import cPickle as pickle
try:
import json
except:
import simplejson as json
# configuration
try:
baseURL = os.environ['PANDA_URL']
except:
baseURL = 'http://pandaserver.cern.ch:25080/serve... | apache-2.0 |
egoldchain/egoldchain-master | contrib/seeds/generate-seeds.py | 10 | 4342 | #!/usr/bin/env python3
# Copyright (c) 2014-2017 Wladimir J. van der Laan
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
'''
Script to generate list of seed nodes for chainparams.cpp.
This script expects two text files in the dir... | mit |
shadowsocksR-private/shadowsocksR | shadowsocks/obfsplugin/obfs_tls.py | 4 | 13578 | #!/usr/bin/env python
#
# Copyright 2015-2015 breakwa11
#
# 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 la... | apache-2.0 |
ivanhorvath/openshift-tools | ansible/roles/lib_openshift_3.2/library/oc_process.py | 6 | 37409 | #!/usr/bin/env python # pylint: disable=too-many-lines
# ___ ___ _ _ ___ ___ _ _____ ___ ___
# / __| __| \| | __| _ \ /_\_ _| __| \
# | (_ | _|| .` | _|| / / _ \| | | _|| |) |
# \___|___|_|\_|___|_|_\/_/_\_\_|_|___|___/_ _____
# | \ / _ \ | \| |/ _ \_ _| | __| \_ _|_ _|
# | |) | (_) ... | apache-2.0 |
sarantapichos/faircoop-market | addons/account_budget/report/analytic_account_budget_report.py | 360 | 7589 | # -*- 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 |
tst-ppenev/earthenterprise | earth_enterprise/src/fusion/tools/pound_server/pound.py | 4 | 3388 | #!/usr/bin/python
#
# 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 a... | apache-2.0 |
navrasio/mxnet | python/mxnet/module/base_module.py | 4 | 47155 | # 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 |
caseyching/incubator-airflow | airflow/operators/python_operator.py | 24 | 6181 | # -*- coding: utf-8 -*-
#
# 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
... | apache-2.0 |
NixaSoftware/CVis | venv/lib/python2.7/site-packages/jedi/evaluate/helpers.py | 1 | 5436 | import copy
import sys
import re
import os
from itertools import chain
from contextlib import contextmanager
from parso.python import tree
from jedi.parser_utils import get_parent_scope
def is_stdlib_path(path):
# Python standard library paths look like this:
# /usr/lib/python3.5/...
# TODO The implement... | apache-2.0 |
badloop/SickRage | lib/unidecode/x020.py | 87 | 4070 | data = (
' ', # 0x00
' ', # 0x01
' ', # 0x02
' ', # 0x03
' ', # 0x04
' ', # 0x05
' ', # 0x06
' ', # 0x07
' ', # 0x08
' ', # 0x09
' ', # 0x0a
' ', # 0x0b
'', # 0x0c
'', # 0x0d
'', # 0x0e
'', # 0x0f
'-', # 0x10
'-', # 0x11
'-', # 0x12
'-', # 0x13
'--', # 0x14... | gpl-3.0 |
jlopezmalla/spark | python/pyspark/status.py | 159 | 3756 | #
# 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 |
uclouvain/osis_louvain | reference/tests/factories/decree.py | 1 | 1713 | ##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | agpl-3.0 |
pexip/os-python-tz | pytz/reference.py | 32 | 3778 | '''
Reference tzinfo implementations from the Python docs.
Used for testing against as they are only correct for the years
1987 to 2006. Do not use these for real code.
'''
from datetime import tzinfo, timedelta, datetime
from pytz import HOUR, ZERO, UTC
__all__ = [
'FixedOffset',
'LocalTimezone',
'USTime... | mit |
hdinsight/hue | apps/spark/setup.py | 31 | 1225 | # Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not use this file ex... | apache-2.0 |
arsfeld/conduit | conduit/modules/GoogleModule/gdata/apps/service.py | 1 | 12808 | #!/usr/bin/python
#
# Copyright (C) 2007 SIOS Technology, 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... | gpl-2.0 |
orig74/DroneSimLab | demos/px4_test/unreal_proxy.py | 1 | 1957 | # vim: tabstop=8 expandtab shiftwidth=4 softtabstop=4
from Wrappers import phandlers as ph
import zmq,pickle,time,cv2
import numpy as np
import config
context = zmq.Context()
socket_sub = context.socket(zmq.SUB)
socket_sub.connect('tcp://%s:%d'%config.zmq_pub_drone_main)
socket_pub = context.socket(zmq.PUB)
socket_pub... | mit |
felix-d/boto | boto/beanstalk/layer1.py | 146 | 56259 | # Copyright (c) 2012 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2012 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... | mit |
fjbatresv/odoo | addons/website_partner/__openerp__.py | 383 | 1498 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2013-Today OpenERP SA (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | agpl-3.0 |
leeon/annotated-django | tests/deprecation/tests.py | 35 | 9237 | from __future__ import unicode_literals
import os
import unittest
import warnings
from django.test import SimpleTestCase, RequestFactory, override_settings
from django.utils import six, translation
from django.utils.deprecation import RenameMethodsBase
from django.utils.encoding import force_text
from django.utils.fu... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.