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 |
|---|---|---|---|---|---|
lahosken/pants | src/python/pants/pantsd/service/fs_event_service.py | 8 | 5869 | # coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import logging
impor... | apache-2.0 |
dpnishant/appmon | tracer/android_tracer.py | 1 | 12107 | #!/usr/bin/python
###
# Copyright (c) 2016 Nishant Das Patnaik.
#
# 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... | apache-2.0 |
fairbird/OpenPLI-BlackHole | lib/python/Screens/Rc.py | 21 | 2575 | from Components.Pixmap import MovingPixmap, MultiPixmap
from Tools.Directories import resolveFilename, SCOPE_SKIN
from xml.etree.ElementTree import ElementTree
from Components.config import config, ConfigInteger
from Components.RcModel import rc_model
config.misc.rcused = ConfigInteger(default = 1)
class Rc:
def __i... | gpl-2.0 |
devendermishrajio/nova_test_latest | nova/console/xvp.py | 40 | 7100 | # Copyright (c) 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 ... | apache-2.0 |
oroszgy/spaCy.hu | spacy/tests/regression/test_issue910.py | 1 | 3547 | from __future__ import unicode_literals
import json
import os
import random
import contextlib
import shutil
import pytest
import tempfile
from pathlib import Path
import pathlib
from ...gold import GoldParse
from ...pipeline import EntityRecognizer
from ...en import English
try:
unicode
except NameError:
uni... | mit |
cgheller/splotch | labeltool/splotchColormap.py | 4 | 5402 | #!/usr/bin/env python
# Generate overlay images in PNG format with transparancy which can be
# used to label Splotch frames. This script can be called as a
# standalone program, see below for details. To label an entire
# directory of Splotch frames, use the driver script <splotchLabelFrames.sh>.
#
# ... | gpl-2.0 |
jayvdb/pywikibot-core | tests/disambredir_tests.py | 6 | 5882 | # -*- coding: utf-8 -*-
"""
DisambigurationRedirectBot test.
These tests write to the wiki.
"""
#
# (C) Pywikibot team, 2015
#
# Distributed under the terms of the MIT license.
#
from __future__ import absolute_import, unicode_literals
import pywikibot
from scripts import disambredir
from tests.aspects import unitt... | mit |
tangyiyong/odoo | addons/survey_crm/__openerp__.py | 312 | 1593 | # -*- 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 |
sumanthha/fundafriend | django/contrib/formtools/utils.py | 80 | 1996 | try:
import cPickle as pickle
except ImportError:
import pickle
import hashlib
from django.conf import settings
from django.utils.crypto import salted_hmac
def security_hash(request, form, *args):
"""
Calculates a security hash for the given Form instance.
This creates a list of the form field n... | bsd-3-clause |
belokop/indico_bare | migrations/versions/201510221323_2f4eefa1050c_delete_old_transaction_table.py | 2 | 1389 | """Delete old transaction table
Revision ID: 2f4eefa1050c
Revises: 38641fb3afac
Create Date: 2015-10-22 13:23:42.602410
"""
import sqlalchemy as sa
from alembic import op
from sqlalchemy.dialects import postgresql
from indico.core.db.sqlalchemy import PyIntEnum
from indico.core.db.sqlalchemy import UTCDateTime
from ... | gpl-3.0 |
jackkiej/SickRage | lib/pyasn1/type/constraint.py | 382 | 7279 | #
# ASN.1 subtype constraints classes.
#
# Constraints are relatively rare, but every ASN1 object
# is doing checks all the time for whether they have any
# constraints and whether they are applicable to the object.
#
# What we're going to do is define objects/functions that
# can be called unconditionally ... | gpl-3.0 |
nitin-cherian/Webapps | SimpleIsBetterThanComplex.com/myproject/.env/lib/python3.5/site-packages/django/core/files/uploadhandler.py | 335 | 6876 | """
Base file upload handler classes, and the built-in concrete subclasses
"""
from __future__ import unicode_literals
from io import BytesIO
from django.conf import settings
from django.core.files.uploadedfile import (
InMemoryUploadedFile, TemporaryUploadedFile,
)
from django.utils.encoding import python_2_uni... | mit |
andrew-lundgren/gwpy | gwpy/cli/spectrum.py | 1 | 5127 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# Copyright (C) Joseph Areeda (2015)
#
# This file is part of GWpy.
#
# GWpy 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
#... | gpl-3.0 |
Tejeshwarabm/MADPIE | examples/tutorial/first.py | 102 | 2128 | # /*
# * This program is free software; you can redistribute it and/or modify
# * it under the terms of the GNU General Public License version 2 as
# * published by the Free Software Foundation;
# *
# * This program is distributed in the hope that it will be useful,
# * but WITHOUT ANY WARRANTY; without even the ... | gpl-2.0 |
aurofable/medhack-server | venv/lib/python2.7/site-packages/jinja2/optimizer.py | 1401 | 2302 | # -*- coding: utf-8 -*-
"""
jinja2.optimizer
~~~~~~~~~~~~~~~~
The jinja optimizer is currently trying to constant fold a few expressions
and modify the AST in place so that it should be easier to evaluate it.
Because the AST does not contain all the scoping information and the
compiler has to ... | mit |
alexthered/kienhoc-platform | lms/djangoapps/instructor/features/bulk_email.py | 116 | 6813 | """
Define steps for bulk email acceptance test.
"""
# pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
from lettuce import world, step
from lettuce.django import mail
from nose.tools import assert_in, assert_equal # pylint: disable=no-name-in-module
from django.core.management import call_co... | agpl-3.0 |
lemarcudal/sha_thedivision | test/Lib/copy_reg.py | 442 | 6800 | """Helper to provide extensibility for pickle/cPickle.
This is only useful to add pickle support for extension types defined in
C, not for instances of user-defined classes.
"""
from types import ClassType as _ClassType
__all__ = ["pickle", "constructor",
"add_extension", "remove_extension", "clear_extens... | apache-2.0 |
mancoast/CPythonPyc_test | cpython/211_test_bisect.py | 15 | 5533 | from test_support import TestFailed
import bisect
import sys
nerrors = 0
def check_bisect(func, list, elt, expected):
global nerrors
got = func(list, elt)
if got != expected:
print >> sys.stderr, \
"expected %s(%s, %s) -> %s, but got %s" % (func.__name__,
... | gpl-3.0 |
poornimakshirsagar/sos | sos/policies/debian.py | 10 | 1429 | from sos.plugins import DebianPlugin
from sos.policies import PackageManager, LinuxPolicy
import os
class DebianPolicy(LinuxPolicy):
distro = "Debian"
vendor = "the Debian project"
vendor_url = "http://www.debian.org/"
report_name = ""
ticket_number = ""
package_manager = PackageManager(
... | gpl-2.0 |
shpakoo/YAP | YAP_MiSeq.py | 1 | 29538 | ########################################################################################
## This file is a part of YAP package of scripts. https://github.com/shpakoo/YAP
## Distributed under the MIT license: http://www.opensource.org/licenses/mit-license.php
## Copyright (c) 2011-2013 Sebastian Szpakowski
#############... | mit |
adamwiggins/cocos2d | samples/multiple_layers.py | 4 | 1398 | #
# cocos2d
# http://cocos2d.org
#
# This code is so you can run the samples without installing the package
import sys
import os
sys.path.insert(0, os.path.join(os.path.dirname(__file__), '..'))
import cocos
from cocos.director import director
from pyglet import gl
# Defining a new layer type...
class Square(cocos.... | bsd-3-clause |
kustodian/ansible | lib/ansible/modules/cloud/huawei/hwc_vpc_route.py | 13 | 11740 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Huawei
# 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
#################################################################... | gpl-3.0 |
feigames/Odoo | addons/stock_account/product.py | 84 | 10799 | # -*- 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 |
pombredanne/grr | gui/api_renderers_regression_data_generate.py | 8 | 1580 | #!/usr/bin/env python
"""Generator of regression tests data for API call renderers."""
# pylint: disable=unused-import,g-bad-import-order
from grr.lib import server_plugins
from grr.gui.api_plugins import tests as tests_lib
# pylint: enable=unused-import,g-bad-import-order
import json
from grr.gui import api_test_... | apache-2.0 |
dhruvsrivastava/OJ | flask/lib/python2.7/site-packages/editor.py | 4 | 2550 | #!/usr/bin/env python
"""Tools for invoking editors programmatically."""
from __future__ import print_function
import locale
import os.path
import subprocess
import tempfile
from distutils.spawn import find_executable
__all__ = [
'edit',
'get_editor',
'EditorError',
]
__version__ = '0.4'
class Editor... | bsd-3-clause |
jquesnelle/pulp-or | examples/CGcolumnwise.py | 3 | 4581 | """
Columnwise Column Generation Functions
Authors: Antony Phillips, Dr Stuart Mitchell 2008
"""
# Import PuLP modeler functions
from pulp import *
class Pattern:
"""
Information on a specific pattern in the SpongeRoll Problem
"""
cost = 1
trimValue = 0.04
totalRollLength = 20
lenOpts =... | mit |
varlog00/Sigil | src/Resource_Files/python3lib/xmlprocessor.py | 1 | 16367 | #!/usr/bin/env python3
import sys
import os
from sigil_bs4 import BeautifulSoup
from sigil_bs4.builder._lxml import LXMLTreeBuilderForXML
import re
from urllib.parse import unquote
from urllib.parse import urlsplit
from lxml import etree
from io import BytesIO
from opf_newparser import Opf_Parser
ASCII_CHARS = set... | gpl-3.0 |
sparkslabs/kamaelia_ | Sketches/PO/KamPlanet/test/test_GeneralObjectParser.py | 3 | 2655 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#-*-*- encoding: utf-8 -*-*-
#
# Copyright 2010 British Broadcasting Corporation and Kamaelia Contributors(1)
#
# (1) Kamaelia Contributors are listed in the AUTHORS file and at
# http://www.kamaelia.org/AUTHORS - please extend this file,
# not this notice.
#
# Lic... | apache-2.0 |
nhicher/ansible | lib/ansible/plugins/action/dellos10.py | 21 | 4056 | #
# (c) 2016 Red Hat Inc.
#
# (c) 2017 Dell EMC.
#
# 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 ve... | gpl-3.0 |
TheWardoctor/Wardoctors-repo | script.module.pil/lib/PIL/ImtImagePlugin.py | 40 | 2203 | #
# The Python Imaging Library.
# $Id$
#
# IM Tools support for PIL
#
# history:
# 1996-05-27 fl Created (read 8-bit images only)
# 2001-02-17 fl Use 're' instead of 'regex' (Python 2.1) (0.2)
#
# Copyright (c) Secret Labs AB 1997-2001.
# Copyright (c) Fredrik Lundh 1996-2001.
#
# See the README file for informatio... | apache-2.0 |
rdcrt/pystarling | test/api_objects/test_Account.py | 1 | 1419 | import dateutil
import pytest
from pystarling.api_objects.Account import Account
class TestAccount(object):
test_data = {
'id': 'ee8152d7-6ff2-4f79-b9de-39861bdec427',
'number': '99999999',
'sortCode': '608371',
'iban': 'GB26SRLG60837199999999',
'bic': 'SRLGGB2L',
... | mit |
APMonitor/arduino | 2_Regression/2nd_order_MIMO/GEKKO/tclab_2nd_order_linear.py | 1 | 3283 | import numpy as np
import time
import matplotlib.pyplot as plt
import random
# get gekko package with:
# pip install gekko
from gekko import GEKKO
import pandas as pd
# import data
data = pd.read_csv('data.txt')
tm = data['Time (sec)'].values
Q1s = data[' Heater 1'].values
Q2s = data[' Heater 2'].values... | apache-2.0 |
tedder/ansible | test/runner/lib/thread.py | 29 | 1834 | """Python threading tools."""
from __future__ import absolute_import, print_function
import threading
import sys
try:
# noinspection PyPep8Naming
import Queue as queue
except ImportError:
# noinspection PyUnresolvedReferences
import queue # pylint: disable=locally-disabled, import-error
class Wrap... | gpl-3.0 |
DistrictDataLabs/yellowbrick | yellowbrick/contrib/scatter.py | 1 | 11862 | # yellowbrick.contrib.scatter
# Implements a 2d scatter plot for feature analysis.
#
# Author: Nathan Danielsen
# Created: Fri Feb 26 19:40:00 2017 -0400
#
# Copyright (C) 2017 The scikit-yb developers
# For license information, see LICENSE.txt
#
# ID: scatter.py [a89633e] benjamin@bengfort.com $
"""
Implements a 2D... | apache-2.0 |
EavesofIT/python_koans | python2/koans/about_asserts.py | 9 | 2288 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from runner.koan import *
class AboutAsserts(Koan):
def test_assert_truth(self):
"""
We shall contemplate truth by testing reality, via asserts.
"""
# Confused? This video should help:
#
# http://bit.ly/about_assert... | mit |
dichen001/Go4Jobs | JackChen/hash/18. 4Sum.py | 1 | 1449 | """
Given an array S of n integers, are there elements a, b, c, and d in S such that a + b + c + d = target? Find all unique quadruplets in the array which gives the sum of target.
Note: The solution set must not contain duplicate quadruplets.
For example, given array S = [1, 0, -1, 0, -2, 2], and target = 0.
... | gpl-3.0 |
santiago-salas-v/walas | node_images.py | 1 | 1746 | import matplotlib
import matplotlib.pyplot as plt
fig = plt.figure()
ax = fig.add_subplot(111)
patch1 = matplotlib.patches.Circle(
[0.5,0.5],0.05
)
patch2 = matplotlib.patches.Rectangle(
[0.3,0.3],0.4, 0.4, alpha=0.5,
fill=False, edgecolor='black',
linestyle = '--'
)
arrow1 = matplotlib.patches.Arrow(
... | mit |
audiohacked/pyBusPirate | src/buspirate/uart.py | 1 | 5375 | # Created by Sean Nelson on 2018-08-19.
# Copyright 2018 Sean Nelson <audiohacked@gmail.com>
#
# This file is part of pyBusPirate.
#
# pyBusPirate 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... | gpl-2.0 |
SOKP/external_chromium_org | third_party/tlslite/tlslite/utils/python_aes.py | 204 | 1986 | # Author: Trevor Perrin
# See the LICENSE file for legal information regarding use of this file.
"""Pure-Python AES implementation."""
from .cryptomath import *
from .aes import *
from .rijndael import rijndael
def new(key, mode, IV):
return Python_AES(key, mode, IV)
class Python_AES(AES):
def __init__(sel... | bsd-3-clause |
TNT-Samuel/Coding-Projects | DNS Server/Source/Lib/site-packages/dask/dataframe/io/tests/test_parquet.py | 2 | 45993 | from __future__ import (absolute_import, division, print_function,
unicode_literals)
import os
from distutils.version import LooseVersion
import numpy as np
import pandas as pd
import pandas.util.testing as tm
import pytest
import dask
import dask.multiprocessing
import dask.dataframe as dd
f... | gpl-3.0 |
Workday/OpenFrame | tools/telemetry/third_party/gsutilz/third_party/protorpc/protorpc/wsgi/service_test.py | 21 | 7056 | #!/usr/bin/env python
#
# Copyright 2011 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 o... | bsd-3-clause |
staranjeet/fjord | vendor/packages/requests-2.7.0/requests/status_codes.py | 926 | 3200 | # -*- coding: utf-8 -*-
from .structures import LookupDict
_codes = {
# Informational.
100: ('continue',),
101: ('switching_protocols',),
102: ('processing',),
103: ('checkpoint',),
122: ('uri_too_long', 'request_uri_too_long'),
200: ('ok', 'okay', 'all_ok', 'all_okay', 'all_good', '\\o/'... | bsd-3-clause |
40223233/2016fallcadp_hw | plugin/liquid_tags/giphy.py | 273 | 2433 | """
Giphy Tag
---------
This implements a Liquid-style Giphy tag for Pelican.
IMPORTANT: You have to request a production API key from giphy `here <https://api.giphy.com/submit>`.
For the first runs you could also use the public beta key you can get `here <https://github.com/giphy/GiphyAPI>`.
Syntax
------
{% giphy ... | agpl-3.0 |
Titulacion-Sistemas/PythonTitulacion-EV | Lib/site-packages/pywin32-219-py2.7-win32.egg/win32comext/axscript/client/pydumper.py | 35 | 2124 | # pydumper.py
#
# This is being worked on - it does not yet work at all, in ay way
# shape or form :-)
#
# A new script engine, derived from the standard scripting engine,
# which dumps information.
# This generally can be used to grab all sorts of useful details about
# an engine - expose bugs in it or Python, dump t... | mit |
Re4son/Kali-Pi | Menus/menu-9p.py | 1 | 2924 | #!/usr/bin/env python
import kalipi
from kalipi import *
#############################
## Local Functions ##
## Local Functions ##
#############################
#############################
## Buttons ##
# define all of the buttons
label1 = Button(labelPadding * " " + " ", originX... | gpl-3.0 |
mrquim/mrquimrepo | plugin.video.LiveTV/resources/lib/external/jsbeautifier/tests/testindentation.py | 104 | 1369 | import re
import unittest
import jsbeautifier
class TestJSBeautifierIndentation(unittest.TestCase):
def test_tabs(self):
test_fragment = self.decodesto
self.options.indent_with_tabs = 1;
test_fragment('{tabs()}', "{\n\ttabs()\n}");
def test_function_indent(self):
test_fragment... | gpl-2.0 |
jeffery-do/Vizdoombot | doom/lib/python3.5/site-packages/networkx/linalg/algebraicconnectivity.py | 10 | 17992 | # -*- coding: utf-8 -*-
"""
Algebraic connectivity and Fiedler vectors of undirected graphs.
"""
__author__ = """ysitu <ysitu@users.noreply.github.com>"""
# Copyright (C) 2014 ysitu <ysitu@users.noreply.github.com>
# All rights reserved.
# BSD license.
from functools import partial
import networkx as nx
from networkx... | mit |
CenterForOpenScience/osf.io | admin_tests/maintenance/test_views.py | 20 | 3024 | import pytest
from admin.maintenance import views
from django.utils import timezone
from django.test import RequestFactory
from django.contrib.auth.models import Permission
from django.core.exceptions import PermissionDenied
import website.maintenance as maintenance
from osf.models import MaintenanceState
from osf_t... | apache-2.0 |
achadwick/mypaint | gui/history.py | 3 | 7600 | # This file is part of MyPaint.
# Copyright (C) 2011-2016 by the MyPaint Development Team.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option... | gpl-2.0 |
mkacik/bcc | tools/zfsslower.py | 2 | 8242 | #!/usr/bin/python
# @lint-avoid-python-3-compatibility-imports
#
# zfsslower Trace slow ZFS operations.
# For Linux, uses BCC, eBPF.
#
# USAGE: zfsslower [-h] [-j] [-p PID] [min_ms]
#
# This script traces common ZFS file operations: reads, writes, opens, and
# syncs. It measures the time spent in these oper... | apache-2.0 |
lanen/youtube-dl | youtube_dl/extractor/playvid.py | 115 | 2864 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_parse_unquote,
compat_urllib_parse_unquote_plus,
)
from ..utils import (
clean_html,
ExtractorError,
)
class PlayvidIE(InfoExtractor):
_VALID_URL = r'https?://www\.playvid\.co... | unlicense |
simbha/mAngE-Gin | lib/Django 1.7/django/http/__init__.py | 57 | 1149 | from django.http.cookie import SimpleCookie, parse_cookie
from django.http.request import (HttpRequest, QueryDict,
RawPostDataException, UnreadablePostError, build_request_repr)
from django.http.response import (HttpResponse, StreamingHttpResponse,
HttpResponseRedirect, HttpResponsePermanentRedirect,
HttpRe... | mit |
JKarathiya/Lean | Algorithm.Python/InceptionDateSelectionRegressionAlgorithm.py | 1 | 2432 | # QUANTCONNECT.COM - Democratizing Finance, Empowering Individuals.
# Lean Algorithmic Trading Engine v2.0. Copyright 2014 QuantConnect Corporation.
#
# 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 Lice... | apache-2.0 |
keithlee/shakeAppPyDev | django/contrib/localflavor/uk/forms.py | 313 | 1943 | """
UK-specific Form helpers
"""
import re
from django.forms.fields import CharField, Select
from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
class UKPostcodeField(CharField):
"""
A form field that validates its input is a UK postcode.
The regular expressi... | bsd-3-clause |
kret0s/gnuhealth-live | tryton/server/trytond-3.8.3/trytond/ir/property.py | 1 | 5773 | # This file is part of Tryton. The COPYRIGHT file at the top level of
# this repository contains the full copyright notices and license terms.
from decimal import Decimal
from ..model import ModelView, ModelSQL, fields
from ..transaction import Transaction
from ..cache import Cache
from ..pool import Pool
__all__ = [... | gpl-3.0 |
iemejia/beam | sdks/python/apache_beam/testing/datatype_inference.py | 5 | 3947 | #
# 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 |
sgraham/nope | third_party/tlslite/tlslite/integration/tlssocketservermixin.py | 116 | 2290 | # Author: Trevor Perrin
# See the LICENSE file for legal information regarding use of this file.
"""TLS Lite + SocketServer."""
from tlslite.tlsconnection import TLSConnection
class TLSSocketServerMixIn:
"""
This class can be mixed in with any L{SocketServer.TCPServer} to
add TLS support.
To use thi... | bsd-3-clause |
YannThorimbert/Thorpy-1.4 | thorpy/_utils/functions.py | 3 | 5108 | """Miscellaneous functions"""
from random import random
def obtain_valid_object(obj_class, **kwargs):
"""
Try to obtain a valid instance of obj_class, using those args of kwargs that
can be given to its __init__ function.
"""
try:
obj = obj_class(**kwargs)
except TypeError:
obj ... | mit |
resmo/ansible | test/units/modules/network/check_point/test_cp_mgmt_vpn_community_star_facts.py | 19 | 2889 | # Ansible module to manage CheckPoint Firewall (c) 2019
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is dist... | gpl-3.0 |
yanheven/nova | nova/tests/unit/virt/vmwareapi/test_read_write_util.py | 6 | 1897 | # Copyright 2013 IBM Corp.
# Copyright 2011 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 ... | apache-2.0 |
lyudmildrx/lymph | lymph/cli/shell.py | 5 | 2493 | # -*- coding: utf-8 -*-
import sys
import telnetlib
import logging
from lymph.client import Client
from lymph.cli.base import Command
logger = logging.getLogger(__name__)
class ShellCommand(Command):
"""
Usage: lymph shell [options]
Options:
--remote=<name:identity-prefix> Service instance n... | apache-2.0 |
sadanandb/pmt | src/pyasm/deprecated/flash/command/frame_util.py | 6 | 3513 | ###########################################################
#
# Copyright (c) 2005, Southpaw Technology
# All Rights Reserved
#
# PROPRIETARY INFORMATION. This software is proprietary to
# Southpaw Technology, and is not to be reproduced, transmitted,
# or disclosed in any way without written permi... | epl-1.0 |
larsks/cloud-init | cloudinit/sources/DataSourceBigstep.py | 2 | 1917 | # Copyright (C) 2015-2016 Bigstep Cloud Ltd.
#
# Author: Alexandru Sirbu <alexandru.sirbu@bigstep.com>
#
# This file is part of cloud-init. See LICENSE file for license information.
import errno
import json
from cloudinit import log as logging
from cloudinit import sources
from cloudinit import url_helper
from cloudi... | gpl-3.0 |
Workday/OpenFrame | tools/grit/grit/clique_unittest.py | 25 | 10705 | #!/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.
'''Unit tests for grit.clique'''
import os
import sys
if __name__ == '__main__':
sys.path.append(os.path.join(os.path.dirname(__... | bsd-3-clause |
pcm17/tensorflow | tensorflow/contrib/learn/python/learn/tests/dataframe/example_parser_test.py | 83 | 5694 | # 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 |
iut-ibk/DynaMind-UrbanSim | 3rdparty/opus/src/urbansim/models/scheduled_events_model.py | 2 | 25791 | # Opus/UrbanSim urban simulation software.
# Copyright (C) 2005-2009 University of Washington
# See opus_core/LICENSE
from opus_core.session_configuration import SessionConfiguration
from opus_core.datasets.dataset_factory import DatasetFactory
from opus_core.datasets.dataset import DatasetSubset
from numpy imp... | gpl-2.0 |
derks/cement | tests/core/exc_tests.py | 1 | 1924 | """Tests for cement.core.exc."""
import unittest
from nose.tools import eq_, raises
from nose import SkipTest
from cement.core import exc
from cement.utils import test_helper as _t
class ExceptionTestCase(unittest.TestCase):
def setUp(self):
self.app = _t.prep()
@raises(exc.CementConfigError)
... | bsd-3-clause |
chirilo/bedrock | bedrock/security/tests/test_utils.py | 25 | 1446 | # 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 textwrap import dedent
from cStringIO import StringIO
from nose.tools import eq_
from bedrock.security.utils import... | mpl-2.0 |
silenceli/nova | nova/api/metadata/vendordata_json.py | 6 | 2139 | # Copyright 2013 Canonical 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
#
# Unless required by... | apache-2.0 |
adamwwt/chvac | venv/lib/python2.7/site-packages/pip/_vendor/html5lib/sanitizer.py | 805 | 16428 | from __future__ import absolute_import, division, unicode_literals
import re
from xml.sax.saxutils import escape, unescape
from .tokenizer import HTMLTokenizer
from .constants import tokenTypes
class HTMLSanitizerMixin(object):
""" sanitization of XHTML+MathML+SVG and of inline style attributes."""
accepta... | mit |
switchkiller/ProjDjanko | lib/python2.7/site-packages/django/db/models/fields/related.py | 20 | 114262 | from __future__ import unicode_literals
import warnings
from operator import attrgetter
from django import forms
from django.apps import apps
from django.core import checks, exceptions
from django.core.exceptions import FieldDoesNotExist
from django.db import connection, connections, router, transaction
from django.d... | gpl-2.0 |
aronsky/home-assistant | homeassistant/components/switch/knx.py | 4 | 3370 | """
Support for KNX/IP switches.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/switch.knx/
"""
import voluptuous as vol
from homeassistant.components.knx import ATTR_DISCOVER_DEVICES, DATA_KNX
from homeassistant.components.switch import PLATFORM_SCHEM... | apache-2.0 |
seismology/stfinv | doc/tools/apigen.py | 20 | 17990 | """
Attempt to generate templates for module reference with Sphinx
To include extension modules, first identify them as valid in the
``_uri2path`` method, then handle them in the ``_parse_module_with_import``
script.
Notes
-----
This parsing is based on import and introspection of modules.
Previously functions and cl... | gpl-3.0 |
azverkan/scons | test/LEX/live.py | 4 | 2713 | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
... | mit |
hrayr-artunyan/shuup | shuup/admin/modules/users/views/detail.py | 2 | 11175 | # -*- coding: utf-8 -*-
# This file is part of Shuup.
#
# Copyright (c) 2012-2016, Shoop Ltd. All rights reserved.
#
# This source code is licensed under the AGPLv3 license found in the
# LICENSE file in the root directory of this source tree.
from __future__ import unicode_literals
import random
from django import f... | agpl-3.0 |
jeeftor/alfredToday | src/lib/oauth2client/contrib/multistore_file.py | 9 | 16670 | # Copyright 2014 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 by applicable law or ... | mit |
praphull27/diskBasedLdaBenchmarkingTools | readXmlAndOutputToTxt.py | 1 | 1444 | from bs4 import BeautifulSoup
import re
import os
import multiprocessing
def read_and_tokenize (file_name):
xml_file_handle = open(file_name, 'rb')
xml_file_contents = xml_file_handle.read()
xml_file_handle.close()
xml_file_text = ''
full_text_all = BeautifulSoup(xml_file_contents).find_all(class_="full_text")
... | mit |
dc3-plaso/dfvfs | dfvfs/credentials/keychain.py | 1 | 2743 | # -*- coding: utf-8 -*-
"""The path specification key chain.
The key chain is used to manage credentials for path specifications.
E.g. BitLocker Drive Encryption (BDE) encrypted volumes can require a
credential (e.g. password) to access the unencrypted data (unlock).
"""
from dfvfs.credentials import manager
class ... | apache-2.0 |
datenbetrieb/odoo | addons/account_payment/report/payment_order.py | 378 | 2974 | # -*- 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 |
MinFu/youtube-dl | youtube_dl/extractor/azubu.py | 143 | 3350 | from __future__ import unicode_literals
import json
from .common import InfoExtractor
from ..utils import float_or_none
class AzubuIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?azubu\.tv/[^/]+#!/play/(?P<id>\d+)'
_TESTS = [
{
'url': 'http://www.azubu.tv/GSL#!/play/15575/2014-hot6-... | unlicense |
haad/ansible | lib/ansible/plugins/filter/urlsplit.py | 146 | 1136 | # Copyright (c) 2017 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'],
'supported_by':... | gpl-3.0 |
Laimiux/mydeatree | djangoappengine/boot.py | 20 | 7834 | import logging
import os
import sys
def find_project_dir():
"""
Go through the path, and look for manage.py
"""
for path in sys.path:
abs_path = os.path.join(os.path.abspath(path), "manage.py")
if os.path.exists(abs_path):
return os.path.dirname(abs_path)
raise Runt... | bsd-3-clause |
Innovahn/cybex | addons/crm/validate_email.py | 462 | 5978 | # RFC 2822 - style email validation for Python
# (c) 2012 Syrus Akbary <me@syrusakbary.com>
# Extended from (c) 2011 Noel Bush <noel@aitools.org>
# for support of mx and user check
# This code is made available to you under the GNU LGPL v3.
#
# This module provides a single method, valid_email_address(),
# which return... | agpl-3.0 |
Kazade/NeHe-Website | google_appengine/google/appengine/ext/analytics/process.py | 13 | 14654 | #!/usr/bin/env python
#
# Copyright 2007 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 o... | bsd-3-clause |
lnielsen/invenio | invenio/modules/pidstore/providers/datacite.py | 3 | 6691 | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2014 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at your option) a... | gpl-2.0 |
vincepandolfo/django | django/db/backends/oracle/schema.py | 404 | 5313 | import binascii
import copy
import datetime
import re
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
from django.db.utils import DatabaseError
from django.utils import six
from django.utils.text import force_text
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
sql_create_column = "ALT... | bsd-3-clause |
Jonekee/chromium.src | build/protoc_java.py | 78 | 2330 | #!/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.
"""Generate java source files from protobuf files.
This is a helper file for the genproto_java action in protoc_java.gypi.
It per... | bsd-3-clause |
nirmeshk/oh-mainline | vendor/packages/whoosh/src/whoosh/filedb/filereading.py | 16 | 14802 | # Copyright 2009 Matt Chaput. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
#
# 1. Redistributions of source code must retain the above copyright notice,
# this list of conditions and the... | agpl-3.0 |
cindyyu/kuma | vendor/packages/translate/storage/test_aresource.py | 23 | 15276 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from lxml import etree
from translate.storage import aresource, test_monolingual
from translate.misc.multistring import multistring
from translate.storage.base import TranslationStore
class TestAndroidResourceUnit(test_monolingual.TestMonolingualUnit):
UnitClass = a... | mpl-2.0 |
mxOBS/deb-pkg_trusty_chromium-browser | tools/metrics/histograms/update_use_counter_css.py | 63 | 2534 | #!/usr/bin/env python
# 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.
"""Scans the Chromium source of UseCounter, formats the Feature enum for
histograms.xml and merges it. This script can also generate a ... | bsd-3-clause |
amisrs/one-eighty | venv2/lib/python2.7/site-packages/sqlalchemy/event/attr.py | 33 | 12053 | # event/attr.py
# Copyright (C) 2005-2017 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
"""Attribute implementation for _Dispatch classes.
The various listener targets for a... | mit |
hbldh/skboost | skboost/stumps/decision_stump.py | 1 | 17561 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
:mod:`decision_stump`
==================
.. module:: decision_stump
:platform: Unix, Windows
:synopsis:
.. moduleauthor:: hbldh <henrik.blidh@nedomkull.com>
Created on 2014-08-31, 01:52
"""
from __future__ import division
from __future__ import print_function... | mit |
nowox/prettytable | prettytable.py | 42 | 62469 | #!/usr/bin/env python
#
# Copyright (c) 2009-2014, Luke Maurits <luke@maurits.id.au>
# All rights reserved.
# With contributions from:
# * Chris Clark
# * Klein Stephane
# * John Filleau
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following c... | bsd-3-clause |
Euphoria-OS-Devices/android_kernel_lge_msm8974 | tools/perf/scripts/python/syscall-counts-by-pid.py | 11180 | 1927 | # 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 system call totals, broken down by syscall.
# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
import os, sys
sys.path.append(os.env... | gpl-2.0 |
sheshas/HGSHM | qemu-2.3.0-rc3/scripts/tracetool/format/stap.py | 84 | 1668 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Generate .stp file (DTrace with SystemTAP only).
"""
__author__ = "Lluís Vilanova <vilanova@ac.upc.edu>"
__copyright__ = "Copyright 2012-2014, Lluís Vilanova <vilanova@ac.upc.edu>"
__license__ = "GPL version 2 or (at your option) any later version"
__maintain... | gpl-2.0 |
dencaval/swift | test/probe/test_object_async_update.py | 20 | 4760 | #!/usr/bin/python -u
# Copyright (c) 2010-2012 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 ap... | apache-2.0 |
hwuiwon/namebench | nb_third_party/dns/rdtypes/ANY/HIP.py | 248 | 4933 | # Copyright (C) 2010 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND NOMIN... | apache-2.0 |
roadmapper/ansible | lib/ansible/modules/cloud/vultr/_vultr_region_facts.py | 14 | 3631 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2018, Yanis Guenane <yanis+ansible@guenane.org>
# 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':... | gpl-3.0 |
309746069/libgdx | extensions/gdx-freetype/jni/freetype-2.5.5/src/tools/docmaker/docmaker.py | 146 | 3202 | #!/usr/bin/env python
#
# docmaker.py
#
# Convert source code markup to HTML documentation.
#
# Copyright 2002, 2004, 2008, 2013, 2014 by
# David Turner.
#
# This file is part of the FreeType project, and may only be used,
# modified, and distributed under the terms of the FreeType project
# license, LICENSE.T... | apache-2.0 |
bobwalker99/Pydev | plugins/org.python.pydev/pysrc/_pydev_imps/_pydev_BaseHTTPServer.py | 36 | 22564 | """HTTP server base class.
Note: the class in this module doesn't implement any HTTP request; see
SimpleHTTPServer for simple implementations of GET, HEAD and POST
(including CGI scripts). It does, however, optionally implement HTTP/1.1
persistent connections, as of version 0.3.
Contents:
- BaseHTTPRequestHandler: ... | epl-1.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.