repo_name stringlengths 5 100 | path stringlengths 4 294 | copies stringclasses 990
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
hobit26/h3_linux | Documentation/target/tcm_mod_builder.py | 4981 | 41422 | #!/usr/bin/python
# The TCM v4 multi-protocol fabric module generation script for drivers/target/$NEW_MOD
#
# Copyright (c) 2010 Rising Tide Systems
# Copyright (c) 2010 Linux-iSCSI.org
#
# Author: nab@kernel.org
#
import os, sys
import subprocess as sub
import string
import re
import optparse
tcm_dir = ""
fabric_ops... | gpl-2.0 |
MegaByte875/redis-py | tests/test_lock.py | 48 | 5520 | from __future__ import with_statement
import pytest
import time
from redis.exceptions import LockError, ResponseError
from redis.lock import Lock, LuaLock
class TestLock(object):
lock_class = Lock
def get_lock(self, redis, *args, **kwargs):
kwargs['lock_class'] = self.lock_class
return redis... | mit |
grischa/django-filer | setup.py | 11 | 1202 | from setuptools import setup, find_packages
import os
version = __import__('filer').__version__
def read(fname):
# read the contents of a text file
return open(os.path.join(os.path.dirname(__file__), fname)).read()
install_requires = [
'setuptools',
'easy-thumbnails>=1.0-alpha-17',
'django-mptt>=... | bsd-3-clause |
tangfeixiong/nova | nova/api/openstack/compute/plugins/v3/flavors_extraspecs.py | 10 | 6435 | # Copyright 2010 OpenStack Foundation
# 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 requ... | apache-2.0 |
Nick-OpusVL/odoo | addons/l10n_fr/__openerp__.py | 260 | 3479 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2008 JAILLET Simon - CrysaLEAD - www.crysalead.fr
#
# WARNING: This program as such is intended to be used by professional
# programmers who take the whole responsability of assessing all potential
#... | agpl-3.0 |
amith01994/intellij-community | python/lib/Lib/urllib.py | 80 | 54977 | """Open an arbitrary URL.
See the following document for more info on URLs:
"Names and Addresses, URIs, URLs, URNs, URCs", at
http://www.w3.org/pub/WWW/Addressing/Overview.html
See also the HTTP spec (from which the error codes are derived):
"HTTP - Hypertext Transfer Protocol", at
http://www.w3.org/pub/WWW/Protocols... | apache-2.0 |
mozilla-services/tecken | tecken/boto_extra.py | 1 | 1360 | # This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, you can obtain one at http://mozilla.org/MPL/2.0/.
from botocore.exceptions import EndpointConnectionError, ClientError
class OwnEndpointConnectionError(EndpointConnecti... | mpl-2.0 |
sergeykolychev/mxnet | tests/python/unittest/test_loss.py | 3 | 11225 | # 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 |
gxx/lettuce | tests/integration/lib/Django-1.2.5/django/contrib/flatpages/tests/csrf.py | 47 | 3425 | import os
from django.conf import settings
from django.test import TestCase, Client
class FlatpageCSRFTests(TestCase):
fixtures = ['sample_flatpages']
urls = 'django.contrib.flatpages.tests.urls'
def setUp(self):
self.client = Client(enforce_csrf_checks=True)
self.old_MIDDLEWARE_CLASSES = ... | gpl-3.0 |
electrumalt/electrum-ixc | gui/qt/console.py | 1 | 10134 | # source: http://stackoverflow.com/questions/2758159/how-to-embed-a-python-interpreter-in-a-pyqt-widget
import sys, os, re
import traceback, platform
from PyQt4 import QtCore
from PyQt4 import QtGui
from electrum_ixc import util
if platform.system() == 'Windows':
MONOSPACE_FONT = 'Lucida Console'
elif platform.s... | gpl-3.0 |
jayflo/scikit-learn | sklearn/tests/test_qda.py | 155 | 3481 | import numpy as np
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_raises
from sklearn.utils.testing import ignore_war... | bsd-3-clause |
idem2lyon/persomov | couchpotato/core/media/movie/providers/trailer/youtube_dl/extractor/pornhub.py | 20 | 3812 | from __future__ import unicode_literals
import os
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse,
compat_urllib_parse_urlparse,
compat_urllib_request,
)
from ..utils import (
str_to_int,
)
from ..aes import (
aes_decrypt_text
)
class PornHubIE(InfoExtracto... | gpl-3.0 |
Srisai85/scikit-learn | sklearn/externals/joblib/numpy_pickle.py | 194 | 19716 | """
Utilities for fast persistence of big data, with optional compression.
"""
# Author: Gael Varoquaux <gael dot varoquaux at normalesup dot org>
# Copyright (c) 2009 Gael Varoquaux
# License: BSD Style, 3 clauses.
import pickle
import traceback
import sys
import os
import zlib
import warnings
import struct
import c... | bsd-3-clause |
jzthree/GraphBoard | node_modules/accessibility-developer-tools/lib/closure-library/closure/bin/calcdeps.py | 42 | 18576 | #!/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
... | apache-2.0 |
low-sky/pyspeckit | pyspeckit/spectrum/models/lte_molecule.py | 2 | 15794 | """
LTE Molecule Modeling Tool
==========================
Uses astroquery & vamdclib to obtain molecular parameters.
http://astroquery.readthedocs.io/en/latest/splatalogue/splatalogue.html
Equations are based on Mangum & Shirley 2015 (2015PASP..127..266M)
Module API
^^^^^^^^^^
"""
from __future__ import print_functi... | mit |
Matthew-Griffith/senior-design-monte-carlo | velocity_analysis.py | 1 | 4341 | import numpy as np
from math import sin, cos, pi, sqrt
# here we create a var for how many times we want to in the model
samples = 1000
# we need to keep track of time for each the cubesats
timeStep = 60 # secs
timeFinal = 60*60*24*14 # this is two weeks in seconds
timeArray = np.arange(0, ... | apache-2.0 |
aakash-cr7/zulip | zerver/migrations/0060_move_avatars_to_be_uid_based.py | 18 | 4545 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.5 on 2017-02-27 17:03
from __future__ import unicode_literals
from django.db import migrations
from django.db.backends.postgresql_psycopg2.schema import DatabaseSchemaEditor
from django.db.migrations.state import StateApps
from django.core.files.uploadedfile import Si... | apache-2.0 |
yingzha/keras | keras/layers/embeddings.py | 67 | 4853 | from __future__ import absolute_import
import theano
import theano.tensor as T
from .. import activations, initializations, regularizers, constraints
from ..layers.core import Layer, MaskedLayer
from ..utils.theano_utils import sharedX
from ..constraints import unitnorm
class Embedding(Layer):
'''
Turn ... | mit |
turbokongen/home-assistant | tests/components/config/test_auth_provider_homeassistant.py | 7 | 11590 | """Test config entries API."""
import pytest
from homeassistant.auth.providers import homeassistant as prov_ha
from homeassistant.components.config import auth_provider_homeassistant as auth_ha
from tests.common import CLIENT_ID, MockUser
@pytest.fixture(autouse=True)
async def setup_config(hass, local_auth):
"... | apache-2.0 |
turbulenz/gyp | test/make_global_settings/ld/gyptest-make_global_settings_ld.py | 12 | 4164 | #!/usr/bin/env python
# Copyright (c) 2014 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 'LD' in make_global_settings.
"""
import os
import sys
import TestGyp
def resolve_path(test, path):
if path is None:
re... | bsd-3-clause |
admire93/youtube-dl | youtube_dl/extractor/thisav.py | 164 | 1595 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import determine_ext
class ThisAVIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?thisav\.com/video/(?P<id>[0-9]+)/.*'
_TEST = {
'url': 'http://www.thisav.com/video/47734/%98%26sup1%3... | unlicense |
juancanuto/estrutura-de-dados | huffman.py | 1 | 6299 | from unittest import TestCase
def calcular_frequencias(s):
dct = {}
for char in s:
dct[char] = dct.get(char, 0) + 1
return dct
def gerar_arvore_de_huffman(s):
dct = calcular_frequencias(s)
folhas = []
for folha in dct:
folhas.append(Folha(folha, dct[folha]))
folhas.sort(k... | mit |
MechCoder/scikit-learn | sklearn/feature_selection/tests/test_from_model.py | 5 | 7177 | import numpy as np
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_false
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_less
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_array_almost_equal
from ... | bsd-3-clause |
ssut/PushBank2 | _pushbank/plugins/email.py | 1 | 2788 | import asyncio
import os
import smtplib
import traceback
from email.mime.text import MIMEText
from email.header import Header
from jinja2 import Environment, FileSystemLoader
from _pushbank.classes import Plugin
from _pushbank.logger import logger
class EmailPlugin(Plugin):
def __init__(self, **kwargs):
... | apache-2.0 |
teichopsia-/take_brake | lib/python2.7/site-packages/pip/commands/show.py | 318 | 4974 | from __future__ import absolute_import
from email.parser import FeedParser
import logging
import os
from pip.basecommand import Command
from pip.status_codes import SUCCESS, ERROR
from pip._vendor import pkg_resources
logger = logging.getLogger(__name__)
class ShowCommand(Command):
"""Show information about o... | mpl-2.0 |
zdary/intellij-community | python/helpers/pydev/third_party/isort_container/isort/settings.py | 28 | 13818 | """isort/settings.py.
Defines how the default settings for isort should be loaded
(First from the default setting dictionary at the top of the file, then overridden by any settings
in ~/.isort.cfg if there are any)
Copyright (C) 2013 Timothy Edmund Crosley
Permission is hereby granted, free of charge, to any pers... | apache-2.0 |
wikimedia/operations-debs-linux | tools/perf/scripts/python/failed-syscalls-by-pid.py | 1996 | 2233 | # failed system call counts, by pid
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Displays system-wide failed system call totals, broken down by pid.
# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
import os
import sys
sys.pa... | gpl-2.0 |
jhawkesworth/ansible | contrib/inventory/fleet.py | 79 | 3017 | #!/usr/bin/env python
"""
fleetctl base external inventory script. Automatically finds the IPs of the booted coreos instances and
returns it under the host group 'coreos'
"""
# Copyright (C) 2014 Andrew Rothstein <andrew.rothstein at gmail.com>
#
# This program is free software: you can redistribute it and/or modify
... | gpl-3.0 |
40223243/40223243w17 | static/Brython3.1.1-20150328-091302/Lib/unittest/test/testmock/testpatch.py | 739 | 53126 | # 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/
import os
import sys
import unittest
from unittest.test.testmock import support
from unittest.test.testmock.support import SomeClass, is_instance
from unittest.mock import... | gpl-3.0 |
ephes/scikit-learn | sklearn/linear_model/tests/test_logistic.py | 105 | 26588 | import numpy as np
import scipy.sparse as sp
from scipy import linalg, optimize, sparse
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_equal
from sklearn.util... | bsd-3-clause |
2014c2g9/c2g9 | exts/wsgi/static/Brython2.1.0-20140419-113919/Lib/unittest/case.py | 743 | 48873 | """Test case implementation"""
import sys
import functools
import difflib
import pprint
import re
import warnings
import collections
from . import result
from .util import (strclass, safe_repr, _count_diff_all_purpose,
_count_diff_hashable)
__unittest = True
DIFF_OMITTED = ('\nDiff is %s charact... | gpl-2.0 |
ingenioustechie/zamboni | mkt/translations/transformer.py | 19 | 3089 | from django.conf import settings
from django.db import connections, models, router
from django.utils import translation
from mkt.translations.models import Translation
isnull = """IF(!ISNULL({t1}.localized_string), {t1}.{col}, {t2}.{col})
AS {name}_{col}"""
join = """LEFT OUTER JOIN translations {t}
... | bsd-3-clause |
MattDevo/edk2 | AppPkg/Applications/Python/Python-2.7.2/Lib/test/test_dbm.py | 13 | 1308 | from test import test_support
import unittest
dbm = test_support.import_module('dbm')
class DbmTestCase(unittest.TestCase):
def setUp(self):
self.filename = test_support.TESTFN
self.d = dbm.open(self.filename, 'c')
self.d.close()
def tearDown(self):
for suffix in [... | bsd-2-clause |
damiencalloway/djtut | mysite/env/lib/python2.7/site-packages/django/utils/unittest/__init__.py | 571 | 3069 | """
unittest2
unittest2 is a backport of the new features added to the unittest testing
framework in Python 2.7. It is tested to run on Python 2.4 - 2.6.
To use unittest2 instead of unittest simply replace ``import unittest`` with
``import unittest2``.
Copyright (c) 1999-2003 Steve Purcell
Copyright (c) 2003-2010 P... | mit |
NickelMedia/phantomjs | src/qt/qtwebkit/Tools/Scripts/webkitpy/tool/commands/upload.py | 121 | 22928 | # Copyright (c) 2009, 2010 Google Inc. All rights reserved.
# Copyright (c) 2009 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:
#
# * Redistributions of source code must retain th... | bsd-3-clause |
itcropper/tanks | bzagents/dumbagent.py | 2 | 5585 | #!/usr/bin/python -tt
# An incredibly simple agent. All we do is find the closest enemy tank, drive
# towards it, and shoot. Note that if friendly fire is allowed, you will very
# often kill your own tanks with this code.
#################################################################
# NOTE TO STUDENTS
# This is... | gpl-3.0 |
ville-k/tensorflow | tensorflow/contrib/distributions/python/ops/operator_pd_cholesky.py | 81 | 6810 | # 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 |
kiritoe/pokeapi | pokemon/migrations/0001_initial.py | 12 | 11634 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import imagekit.models.fields
import pokemon.utils
class Migration(migrations.Migration):
dependencies = [
]
operations = [
migrations.CreateModel(
name='Ability',
fi... | bsd-3-clause |
rsmith-nl/scripts | old.py | 1 | 1370 | #!/usr/bin/env python
# file: old.py
# vim:fileencoding=utf-8:fdm=marker:ft=python
#
# Copyright © 2014-2017 R.F. Smith <rsmith@xs4all.nl>.
# SPDX-License-Identifier: MIT
# Created: 2014-02-10T22:02:02+01:00
# Last modified: 2020-12-16T00:25:56+0100
"""
Renames a directory by prefixing the name with 'old-'.
If the dir... | mit |
BMJHayward/django | django/utils/dates.py | 590 | 2296 | "Commonly-used date structures"
from django.utils.translation import pgettext_lazy, ugettext_lazy as _
WEEKDAYS = {
0: _('Monday'), 1: _('Tuesday'), 2: _('Wednesday'), 3: _('Thursday'), 4: _('Friday'),
5: _('Saturday'), 6: _('Sunday')
}
WEEKDAYS_ABBR = {
0: _('Mon'), 1: _('Tue'), 2: _('Wed'), 3: _('Thu'),... | bsd-3-clause |
quinot/ansible | lib/ansible/module_utils/openstack.py | 76 | 4519 | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | gpl-3.0 |
igor-toga/local-snat | neutron/plugins/hyperv/agent/security_groups_driver.py | 7 | 1369 | #Copyright 2014 Cloudbase Solutions SRL
#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 req... | apache-2.0 |
tlatzko/spmcluster | .tox/docs/lib/python2.7/site-packages/pip/_vendor/html5lib/treebuilders/__init__.py | 1730 | 3405 | """A collection of modules for building different kinds of tree from
HTML documents.
To create a treebuilder for a new type of tree, you need to do
implement several things:
1) A set of classes for various types of elements: Document, Doctype,
Comment, Element. These must implement the interface of
_base.treebuilders... | bsd-2-clause |
espadrine/opera | chromium/src/third_party/python_26/Lib/test/test_cProfile.py | 51 | 7028 | """Test suite for the cProfile module."""
import sys
from test.test_support import run_unittest, TESTFN, unlink
# rip off all interesting stuff from test_profile
import cProfile
from test.test_profile import ProfileTest, regenerate_expected_output
class CProfileTest(ProfileTest):
profilerclass = cProfile.Profile... | bsd-3-clause |
pombredanne/drf-generators | drf_generators/generators.py | 2 | 4075 |
from django.template import Template, Context
import os.path
from drf_generators.templates.serializer import SERIALIZER
from drf_generators.templates.apiview import API_URL, API_VIEW
from drf_generators.templates.viewset import VIEW_SET_URL, VIEW_SET_VIEW
from drf_generators.templates.function import FUNCTION_URL, FU... | mit |
petewarden/tensorflow | tensorflow/python/eager/cancellation_test.py | 23 | 1168 | # Copyright 2019 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 |
c0defreak/python-for-android | python3-alpha/extra_modules/pyxmpp2/cache.py | 46 | 32885 | #
# (C) Copyright 2005-2010 Jacek Konieczny <jajcus@jajcus.net>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU Lesser General Public License Version
# 2.1 as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be u... | apache-2.0 |
takeflight/django | django/contrib/gis/db/backends/spatialite/schema.py | 35 | 6882 | from django.db.utils import DatabaseError
from django.db.backends.sqlite3.schema import DatabaseSchemaEditor
class SpatialiteSchemaEditor(DatabaseSchemaEditor):
sql_add_geometry_column = (
"SELECT AddGeometryColumn(%(table)s, %(column)s, %(srid)s, "
"%(geom_type)s, %(dim)s, %(null)s)"
)
sq... | bsd-3-clause |
aitatanit/metatlas | metatlas/mzml_loader.py | 1 | 7895 | from __future__ import print_function
import argparse
import os
import pwd
import datetime
import sys
import traceback
import tables
import pymzml
from metatlas import __version__
DEBUG = False
FORMAT_VERSION = 5
# time.time() when the latest version of the format was created
VERSION_TIMESTAMP = 1451062032
class ... | bsd-3-clause |
MinFu/youtube-dl | youtube_dl/extractor/m6.py | 147 | 1952 | # encoding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class M6IE(InfoExtractor):
IE_NAME = 'm6'
_VALID_URL = r'http://(?:www\.)?m6\.fr/[^/]+/videos/(?P<id>\d+)-[^\.]+\.html'
_TEST = {
'url': 'http://www.m6.fr/emission-les_reines_du_shopping/videos... | unlicense |
SummitKwan/python-neo | neo/io/brainwaredamio.py | 6 | 9084 | # -*- coding: utf-8 -*-
'''
Class for reading from Brainware DAM files
DAM files are binary files for holding raw data. They are broken up into
sequence of Segments, each containing a single raw trace and parameters.
The DAM file does NOT contain a sampling rate, nor can it be reliably
calculated from any of the par... | bsd-3-clause |
py-geek/City-Air | venv/lib/python2.7/site-packages/gunicorn/http/body.py | 153 | 7355 | # -*- coding: utf-8 -
#
# This file is part of gunicorn released under the MIT license.
# See the NOTICE for more information.
from gunicorn.http.errors import (NoMoreData, ChunkMissingTerminator,
InvalidChunkSize)
from gunicorn import six
class ChunkedReader(object):
def __init__(self, req, unreader):
... | mit |
Shuyinsama/Titanium.paint-Module-expansion | build.py | 1 | 5750 | #!/usr/bin/env python
#
# Appcelerator Titanium Module Packager
#
#
import os, sys, glob, string
import zipfile
cwd = os.path.abspath(os.path.dirname(sys._getframe(0).f_code.co_filename))
required_module_keys = ['name','version','moduleid','description','copyright','license','copyright','platform','minsdk']
module_def... | apache-2.0 |
Achilles-96/dtella | tests/test_common_ipv4.py | 4 | 5113 | #!/usr/bin/env python
# Tests for dtella/common/ipv4.py
import fix_path
import unittest
from dtella.common.ipv4 import CidrNumToMask
from dtella.common.ipv4 import CidrStringToIPMask
from dtella.common.ipv4 import IsSubsetOf
from dtella.common.ipv4 import MaskToCidrNum
from dtella.common.ipv4 import SubnetMatcher
cl... | gpl-2.0 |
simonwydooghe/ansible | lib/ansible/module_utils/network/nxos/config/hsrp_interfaces/hsrp_interfaces.py | 13 | 8937 | #
# -*- coding: utf-8 -*-
# Copyright 2019 Cisco and/or its affiliates.
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
"""
The nxos hsrp_interfaces class
This class creates a command set to bring the current device configuration
to a desired end-state. The command set is ... | gpl-3.0 |
kinooo/Sick-Beard | sickbeard/clients/requests/packages/charade/latin1prober.py | 151 | 5380 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer.... | gpl-3.0 |
chirpradio/chirpradio-volunteers | site-packages/django/utils/dateformat.py | 9 | 8565 | """
PHP date() style date formatting
See http://www.php.net/date for format strings
Usage:
>>> import datetime
>>> d = datetime.datetime.now()
>>> df = DateFormat(d)
>>> print df.format('jS F Y H:i')
7th October 2003 11:39
>>>
"""
import re
import time
import calendar
from django.utils.dates import MONTHS, MONTHS_3, ... | mit |
lucdom/xCrawler | tests/http/urls/test_url_formatter.py | 2 | 1117 |
import unittest
import mock
from xcrawler.http.urls.url_formatter import UrlFormatter
from xcrawler.http.urls.url_validator import UrlValidator
class TestUrlFormatter(unittest.TestCase):
def setUp(self):
url_validator = mock.create_autospec(UrlValidator).return_value
self.url_formatter = UrlFor... | gpl-2.0 |
chrislyon/dj_ds1 | static/Brython3.2.0-20150701-214155/Lib/encodings/cp775.py | 37 | 35173 | """ Python Character Mapping Codec cp775 generated from 'VENDORS/MICSFT/PC/CP775.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_map)
def decode(self,input,e... | gpl-2.0 |
azakhary/libgdx | extensions/gdx-freetype/jni/freetype-2.4.10/src/tools/docmaker/tohtml.py | 395 | 18731 | # ToHTML (c) 2002, 2003, 2005, 2006, 2007, 2008
# David Turner <david@freetype.org>
from sources import *
from content import *
from formatter import *
import time
# The following defines the HTML header used by all generated pages.
html_header_1 = """\
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional/... | apache-2.0 |
2014c2g14/cda0519 | static/Brython3.1.1-20150328-091302/Lib/site-packages/pygame/pkgdata.py | 603 | 2146 | """pkgdata is a simple, extensible way for a package to acquire data file
resources.
The getResource function is equivalent to the standard idioms, such as
the following minimal implementation::
import sys, os
def getResource(identifier, pkgname=__name__):
pkgpath = os.path.dirname(sys.modules[p... | agpl-3.0 |
roatienza/Deep-Learning-Experiments | Experiments/Tensorflow/Word2Vec/word2vec.py | 1 | 11074 | # 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 |
shuttl-io/shuttl | shuttl/tests/test_views/test_organizationsignup.py | 1 | 2637 | from unittest import mock
from shuttl.Models.User import User
from shuttl.Forms.OrganizationSignupForm import OrganizationSignupForm
import shuttl.Views.organization as view
from shuttl.Models.organization import Organization
from shuttl.tests import testbase
class OrganizationSignupTest(testbase.BaseTest):
def ... | mit |
iwschris/ezodf2 | tests/test_xml_properties.py | 1 | 4905 | #!/usr/bin/env python
#coding:utf-8
# Purpose: test xml properties
# Created: 15.02.2011
# Copyright (C) 2011, Manfred Moitzi
# License: MIT
from __future__ import unicode_literals, print_function, division
__author__ = "mozman <mozman@gmx.at>"
import unittest
from ezodf2.xmlns import etree
from ezodf2.pr... | mit |
openfisca/openfisca-france-indirect-taxation | openfisca_france_indirect_taxation/examples/all_consumptions/plot_logement_decile.py | 4 | 2329 | # -*- coding: utf-8 -*-
"""
Created on Wed Apr 29 11:00:08 2015
@author: Etienne
"""
# OpenFisca -- A versatile microsimulation software
# By: OpenFisca Team <contact@openfisca.fr>
#
# Copyright (C) 2011, 2012, 2013, 2014 OpenFisca Team
# https://github.com/openfisca
#
# This file is part of OpenFisca.
#
# OpenFisca ... | agpl-3.0 |
alexvanboxel/airflow | airflow/operators/redshift_to_s3_operator.py | 9 | 4096 | # -*- 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 |
weevergh/android_kernel_lenovo_kiton | 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 |
lumig242/Hue-Integration-with-CDAP | desktop/core/ext-py/Django-1.6.10/django/core/checks/compatibility/django_1_6_0.py | 47 | 2309 | from __future__ import unicode_literals
from django.db import models
def check_test_runner():
"""
Checks if the user has *not* overridden the ``TEST_RUNNER`` setting &
warns them about the default behavior changes.
If the user has overridden that setting, we presume they know what they're
doing &... | apache-2.0 |
matburt/ansible | lib/ansible/module_utils/cloudstack.py | 11 | 15795 | # -*- coding: utf-8 -*-
#
# (c) 2015, René Moser <mail@renemoser.net>
#
# This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the aut... | gpl-3.0 |
throwable-one/lettuce | tests/integration/lib/Django-1.3/django/contrib/sessions/middleware.py | 323 | 1888 | import time
from django.conf import settings
from django.utils.cache import patch_vary_headers
from django.utils.http import cookie_date
from django.utils.importlib import import_module
class SessionMiddleware(object):
def process_request(self, request):
engine = import_module(settings.SESSION_ENGINE)
... | gpl-3.0 |
catchmrbharath/servo | tests/wpt/web-platform-tests/2dcontext/tools/gentest.py | 132 | 29897 | # Copyright (c) 2010 Philip Taylor
# Released under the BSD license and W3C Test Suite License: see LICENSE.txt
# Current code status:
#
# This was originally written for use at
# http://philip.html5.org/tests/canvas/suite/tests/
#
# It has been adapted for use with the Web Platform Test Suite suite at
# https://githu... | mpl-2.0 |
huiren/ece511 | src/mem/slicc/ast/LocalVariableAST.py | 28 | 2924 | #
# Copyright (c) 2013 Advanced Micro Devices, Inc.
# Copyright (c) 2011 Mark D. Hill and David A. Wood
# 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... | bsd-3-clause |
TechRunner2/i3-gaps-rice | .config/i3/bar/bumblebee/modules/disk.py | 1 | 1607 | # pylint: disable=C0111,R0903
"""Shows free diskspace, total diskspace and the percentage of free disk space.
Parameters:
* disk.warning: Warning threshold in % of disk space (defaults to 80%)
* disk.critical: Critical threshold in % of disk space (defaults ot 90%)
* disk.path: Path to calculate disk usag... | gpl-2.0 |
jounex/hue | desktop/core/ext-py/python-ldap-2.3.13/Lib/ldap/cidict.py | 46 | 2705 | """
This is a convenience wrapper for dictionaries
returned from LDAP servers containing attribute
names of variable case.
See http://www.python-ldap.org/ for details.
$Id: cidict.py,v 1.13 2009/04/17 14:34:34 stroeder Exp $
"""
__version__ = """$Revision: 1.13 $"""
from UserDict import UserDict
from string import ... | apache-2.0 |
rruebner/odoo | addons/website/tests/test_converter.py | 61 | 9019 | # -*- coding: utf-8 -*-
import textwrap
import unittest2
from lxml import etree, html
from lxml.builder import E
from openerp.tests import common
from openerp.addons.base.ir import ir_qweb
from openerp.addons.website.models.ir_qweb import html_to_text
from openerp.addons.website.models.website import slugify, unslug
... | agpl-3.0 |
mabushadi/dpxdt | dpxdt/server/api.py | 1 | 26148 | #!/usr/bin/env python
# Copyright 2013 Brett Slatkin
#
# 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 o... | apache-2.0 |
dashee87/cluster-flag | setup.py | 1 | 1138 | from setuptools import setup
import clusterflag
setup(name='cluster-flag',
version=clusterflag.__version__,
url='https://github.com/dashee87/cluster-flag',
author='David Sheehan',
author_email='davidfsheehan87@gamil.com',
description='Generate country flags with numpy and pand... | mit |
balloob/home-assistant | homeassistant/components/zoneminder/__init__.py | 20 | 2775 | """Support for ZoneMinder."""
import logging
import voluptuous as vol
from zoneminder.zm import ZoneMinder
from homeassistant.const import (
ATTR_ID,
ATTR_NAME,
CONF_HOST,
CONF_PASSWORD,
CONF_PATH,
CONF_SSL,
CONF_USERNAME,
CONF_VERIFY_SSL,
)
import homeassistant.helpers.config_validati... | apache-2.0 |
Kami/munin_exchange | munin_exchange/lib/bitly.py | 1 | 7194 | #!/usr/bin/python2.4
#
# Copyright 2009 Empeeric LTD. 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... | bsd-3-clause |
elit3ge/SickRage | lib/hachoir_core/field/parser.py | 74 | 1472 | from hachoir_core.endian import BIG_ENDIAN, LITTLE_ENDIAN, MIDDLE_ENDIAN
from hachoir_core.field import GenericFieldSet
from hachoir_core.log import Logger
import hachoir_core.config as config
class Parser(GenericFieldSet):
"""
A parser is the root of all other fields. It create first level of fields
and h... | gpl-3.0 |
damocles972/Sick-Beard | cherrypy/_cpdispatch.py | 35 | 22348 | """CherryPy dispatchers.
A 'dispatcher' is the object which looks up the 'page handler' callable
and collects config for the current request based on the path_info, other
request attributes, and the application architecture. The core calls the
dispatcher as early as possible, passing it a 'path_info' argument.
... | gpl-3.0 |
cfossace/test | crits/screenshots/api.py | 21 | 3965 | from django.core.urlresolvers import reverse
from tastypie import authorization
from tastypie.authentication import MultiAuthentication
from tastypie.exceptions import BadRequest
from crits.core.api import CRITsApiKeyAuthentication, CRITsSessionAuthentication
from crits.core.api import CRITsSerializer, CRITsAPIResourc... | mit |
shifter/grr | lib/serialize.py | 10 | 1851 | #!/usr/bin/env python
"""This module serializes AFF4 objects in various ways."""
import yaml
from grr.lib import aff4
from grr.lib import rdfvalue
def YamlDumper(aff4object):
"""Dumps the given aff4object into a yaml representation."""
aff4object.Flush()
result = {}
for attribute, values in aff4object.sync... | apache-2.0 |
markslwong/tensorflow | tensorflow/contrib/keras/python/keras/models_test.py | 29 | 6256 | # 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 |
Kriechi/mitmproxy | test/mitmproxy/addons/test_onboarding.py | 2 | 1416 | import pytest
from mitmproxy.addons import onboarding
from mitmproxy.test import taddons
@pytest.fixture
def client():
with onboarding.app.test_client() as client:
yield client
class TestApp:
def addons(self):
return [onboarding.Onboarding()]
@pytest.mark.asyncio
async def test_bas... | mit |
yawnosnorous/python-for-android | python-modules/twisted/twisted/test/test_strcred.py | 56 | 21750 | # Copyright (c) 2007-2010 Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Tests for L{twisted.cred.strcred}.
"""
import os
import StringIO
from twisted import plugin
from twisted.trial import unittest
from twisted.cred import credentials, checkers, error, strcred
from twisted.plugins import cred_file, cr... | apache-2.0 |
ajgallegog/gem5_arm | src/arch/x86/isa/insts/general_purpose/data_transfer/stack_operations.py | 75 | 7026 | # Copyright (c) 2007-2008 The Hewlett-Packard Development Company
# All rights reserved.
#
# The license below extends only to copyright in the software and shall
# not be construed as granting a license to any other intellectual
# property including but not limited to intellectual property relating
# to a hardware imp... | bsd-3-clause |
abstract-open-solutions/OCB | addons/sale_mrp/__init__.py | 445 | 1062 | # -*- 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 |
yulin724/rt-thread-comment | bsp/lm3s/rtconfig.py | 1 | 1864 | # toolchains options
ARCH='arm'
CPU='lm3s'
CROSS_TOOL = 'gcc'
if CROSS_TOOL == 'gcc':
PLATFORM = 'gcc'
EXEC_PATH = 'E:/Program Files/CodeSourcery/Sourcery G++ Lite/bin'
elif CROSS_TOOL == 'keil':
PLATFORM = 'armcc'
EXEC_PATH = 'E:/Keil'
BUILD = 'debug'
if PLATFORM == 'gcc':
# toolchains
... | gpl-2.0 |
VanirAOSP/external_chromium_org | third_party/protobuf/protobuf_lite_java_parse_pom.py | 88 | 1834 | #!/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.
"""Parses the Maven pom.xml file for which files to include in a lite build.
Usage:
protobuf_lite_java_parse_pom.py {path to p... | bsd-3-clause |
SebastianMH/OpenNI2 | ThirdParty/PSCommon/RedistSystem/redist_base.py | 36 | 42342 | #/****************************************************************************
#* *
#* PrimeSense PSCommon Library *
#* Copyright (C) 2012 PrimeSense Ltd. *
#* ... | apache-2.0 |
koomik/CouchPotatoServer | libs/pyutil/test/current/test_iputil.py | 106 | 1287 | #!/usr/bin/env python
try:
from twisted.trial import unittest
unittest # http://divmod.org/trac/ticket/1499
except ImportError, le:
print "Skipping test_iputil since it requires Twisted and Twisted could not be imported: %s" % (le,)
else:
from pyutil import iputil, testutil
import re
DOTTED_QU... | gpl-3.0 |
w1stler/volontulo | backend/apps/volontulo/tests/views/api/offers/test_read.py | 3 | 5617 | """
.. module:: test_read
"""
from rest_framework import status
from rest_framework.test import APITestCase
from apps.volontulo.factories import OfferFactory
from apps.volontulo.factories import OrganizationFactory
from apps.volontulo.factories import UserFactory
from apps.volontulo.tests import common
class TestAd... | mit |
tdyas/pants | src/python/pants/backend/python/tasks/python_bundle.py | 2 | 4024 | # Copyright 2018 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import os
from pants.backend.python.targets.python_app import PythonApp
from pants.base.build_environment import get_buildroot
from pants.base.exceptions import TaskError
from pants.build... | apache-2.0 |
Hybrid-Cloud/badam | fs_patches_of_hybrid_cloud/cherry_for_B038/cinder_cascaded_aws/cinder/volume/drivers/ec2/ec2volume.py | 10 | 3823 | """
Volume Drivers for aws storage arrays.
"""
from py4j.java_gateway import JavaGateway, GatewayClient
import time
from cinder.i18n import _
from cinder import exception
from cinder.openstack.common import log as logging
from cinder.volume import driver
from py4j.java_gateway import JavaGateway
LOG = logging.getLogg... | apache-2.0 |
TeXitoi/navitia | source/jormungandr/jormungandr/realtime_schedule/realtime_proxy.py | 1 | 1503 | # coding=utf-8
# Copyright (c) 2001-2014, 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 |
vipulkanade/EventbriteDjango | lib/python2.7/site-packages/django/template/backends/django.py | 240 | 5574 | # Since this package contains a "django" module, this is required on Python 2.
from __future__ import absolute_import
import sys
import warnings
from importlib import import_module
from pkgutil import walk_packages
from django.apps import apps
from django.conf import settings
from django.template import TemplateDoesN... | mit |
michaelkourlas/gini | backend/src/gloader/xml/dom/minidom.py | 10 | 66015 | """\
minidom.py -- a lightweight DOM implementation.
parse("foo.xml")
parseString("<foo><bar/></foo>")
Todo:
=====
* convenience methods for getting elements and text.
* more testing
* bring some of the writer and linearizer code into conformance with this
interface
* SAX 2 namespaces
"""
import xml.dom... | mit |
simonwydooghe/ansible | lib/ansible/compat/__init__.py | 241 | 1087 | # (c) 2014, Toshio Kuratomi <tkuratomi@ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later... | gpl-3.0 |
SoftwareMaven/django | tests/str/models.py | 409 | 1300 | # -*- coding: utf-8 -*-
"""
Adding __str__() or __unicode__() to models
Although it's not a strict requirement, each model should have a
``_str__()`` or ``__unicode__()`` method to return a "human-readable"
representation of the object. Do this not only for your own sanity when dealing
with the interactive prompt, but... | bsd-3-clause |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.