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
dirn/ansible
lib/ansible/parsing/vault/__init__.py
18
19977
# (c) 2014, James Tanner <tanner.jc@gmail.com> # # 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 distributed i...
gpl-3.0
sestrella/ansible
lib/ansible/module_utils/network/junos/config/vlans/vlans.py
19
7322
# Copyright (C) 2019 Red Hat, Inc. # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) any later version. # # This program is distributed in...
gpl-3.0
dxmahata/InformativeTweetCollection
oauthlib/oauth2/rfc6749/clients/service_application.py
36
7081
# -*- coding: utf-8 -*- """ oauthlib.oauth2.rfc6749 ~~~~~~~~~~~~~~~~~~~~~~~ This module is an implementation of various logic needed for consuming and providing OAuth 2.0 RFC6749. """ from __future__ import absolute_import, unicode_literals import time from oauthlib.common import to_unicode from .base import Client...
apache-2.0
Beeblio/django
django/contrib/gis/db/models/proxy.py
38
2643
""" The GeometryProxy object, allows for lazy-geometries. The proxy uses Python descriptors for instantiating and setting Geometry objects corresponding to geographic model fields. Thanks to Robert Coup for providing this functionality (see #4322). """ from django.contrib.gis import memoryview from django.utils impor...
bsd-3-clause
fillest/7drl2013
enemies.py
1
2371
import util import libtcodpy as tcod import towers import items registered_enemies = [] def enemy_classes (): return [c for c in registered_enemies if c != Enemy] class EnemyMeta (type): def __init__ (class_, name, bases, attrs): super(EnemyMeta, class_).__init__(name, bases, attrs) registered_enemies.append(c...
mit
zorroz/microblog
flask/lib/python2.7/site-packages/sqlalchemy/schema.py
32
1200
# schema.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 """Compatibility namespace for sqlalchemy.sql.schema and related. """ from .sql.base imp...
bsd-3-clause
Fizzadar/pyinfra
examples/puppet/step1.py
1
3222
from pyinfra import host, inventory from pyinfra.operations import files, init, server, yum SUDO = True # update the /etc/hosts file def update_hosts_file(name, ip): files.line( name='Add hosts to /etc/hosts', path='/etc/hosts', line=r' {}.example.com '.format(name), replace='{} {...
mit
blaze33/django
django/contrib/staticfiles/finders.py
102
9658
import os from django.conf import settings from django.core.exceptions import ImproperlyConfigured from django.core.files.storage import default_storage, Storage, FileSystemStorage from django.utils.datastructures import SortedDict from django.utils.functional import empty, memoize, LazyObject from django.utils.importl...
bsd-3-clause
BeryJu/ajenti-btsync
main.py
1
2976
from BTSync import * from ajenti.api import * from ajenti.api.http import * from ajenti.ui import on from ajenti.ui.binder import Binder from ajenti.plugins.main.api import SectionPlugin from ajenti.plugins.configurator.api import ClassConfigEditor @plugin class BTSyncConfigEditor (ClassConfigEditor): title = 'Bit...
mit
mwest1066/PrairieLearn
exampleCourse/serverFilesCourse/python_autograder/pltest.py
6
3111
import unittest from unittest import TestLoader, TestSuite import json import traceback def points(points): def decorator(f): f.__dict__['points'] = points return f return decorator def name(name): def decorator(f): f.__dict__['name'] = name return f return decorator ...
agpl-3.0
seanchen/taiga-back
tests/integration/test_stars.py
13
3867
# Copyright (C) 2014 Andrey Antukh <niwi@niwi.be> # Copyright (C) 2014 Jesús Espino <jespinog@gmail.com> # Copyright (C) 2014 David Barragán <bameda@dbarragan.com> # Copyright (C) 2014 Anler Hernández <hello@anler.me> # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU...
agpl-3.0
dongjoon-hyun/tensorflow
tensorflow/python/ops/image_ops.py
29
1413
# 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
Himon-SYNCRAFT/taskplus
tests/core/actions/get_role_details/test_get_role_details_action.py
1
2317
from unittest import mock from taskplus.core.actions import GetRoleDetailsAction, GetRoleDetailsRequest from taskplus.core.domain import UserRole from taskplus.core.shared.response import ResponseFailure def test_get_role_details_action(): role = mock.Mock() role = UserRole(name='admin', id=1) roles_repo...
bsd-3-clause
openstack/senlin
senlin/events/database.py
2
2322
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed unde...
apache-2.0
HyperBaton/ansible
lib/ansible/modules/network/netvisor/pn_admin_session_timeout.py
52
3114
#!/usr/bin/python # Copyright: (c) 2018, Pluribus Networks # 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': ['...
gpl-3.0
vaygr/ansible
lib/ansible/plugins/action/win_template.py
269
1198
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.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) an...
gpl-3.0
thu-ml/zhusuan
zhusuan/framework/meta_bn.py
1
4803
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import print_function from __future__ import division import copy import tensorflow as tf from functools import wraps from zhusuan.framework.utils import Context __all__ = [ 'MetaBayesianNet', 'meta_bayesia...
mit
valkjsaaa/sl4a
python/src/Lib/test/sample_doctest.py
228
1037
"""This is a sample module that doesn't really test anything all that interesting. It simply has a few tests, some of which succeed and some of which fail. It's important that the numbers remain constant as another test is testing the running of these tests. >>> 2+2 4 """ def foo(): """ >>> 2+2 5 ...
apache-2.0
tcc-unb-fga/debile
debile/slave/runners/piuparts.py
4
2859
# Copyright (c) 2012-2013 Paul Tagliamonte <paultag@debian.org> # Copyright (c) 2013 Leo Cavaille <leo@cavaille.net> # # 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, inc...
mit
tmpkus/photivo
scons-local-2.2.0/SCons/Tool/packaging/targz.py
14
1834
"""SCons.Tool.Packaging.targz The targz SRC packager. """ # # Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011, 2012 The SCons Foundation # # Permission is hereby granted, free of charge, to any person obtaining # a copy of this software and associated documentation files (the # "Softwa...
gpl-3.0
cyberintruder/django-cms
cms/migrations/0001_initial.py
38
10402
# -*- coding: utf-8 -*- from __future__ import unicode_literals from cms.models import ACCESS_CHOICES, Page from cms.utils.conf import get_cms_setting from django.conf import settings from django.db import models, migrations import django.utils.timezone from django.utils.translation import ugettext_lazy as _ template...
bsd-3-clause
kayak/fireant
fireant/tests/dataset/test_pandas_workaround.py
2
2043
from unittest import TestCase import numpy as np import pandas as pd from fireant.queries.pandas_workaround import df_subtract class TestSubtract(TestCase): def test_subtract_partially_aligned_multi_index_dataframes_with_nans(self): df0 = pd.DataFrame( data=[ [1, 2], ...
apache-2.0
leansoft/edx-platform
common/lib/xmodule/xmodule/lti_module.py
22
37689
""" Learning Tools Interoperability (LTI) module. Resources --------- Theoretical background and detailed specifications of LTI can be found on: http://www.imsglobal.org/LTI/v1p1p1/ltiIMGv1p1p1.html This module is based on the version 1.1.1 of the LTI specifications by the IMS Global authority. For authenticat...
agpl-3.0
phoemur/blog
app/forms.py
1
6590
# -*- coding: utf-8 -*- from flask_wtf import Form, RecaptchaField from wtforms import StringField, BooleanField, PasswordField, TextAreaField from flask_pagedown.fields import PageDownField from wtforms.validators import DataRequired, Email, EqualTo, Length from .models import User class LoginForm(Form): email ...
mit
dinhxuanvu/ssm
ssmlib/problem.py
1
10297
# (C)2012 Red Hat, Inc., Lukas Czerner <lczerner@redhat.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 2 of the License, or # (at your option) any later version. # # This ...
gpl-2.0
KenV99/service.xbmc.callbacks2
default.py
1
32187
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (C) 2014 KenV99 # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation, either version 3 of the License, or # (at your option) a...
gpl-3.0
tarak/django-password-policies
password_policies/tests/test_utils.py
1
1278
from password_policies.models import PasswordChangeRequired, PasswordHistory from password_policies.utils import PasswordCheck from password_policies.tests.lib import BaseTest from password_policies.tests.lib import create_user from password_policies.tests.lib import create_password_history class PasswordPoliciesUti...
bsd-3-clause
tiagoantao/tools-iuc
tools/raxml/raxml.py
2
17222
#!/usr/bin/env python """ Runs RAxML on a sequence file. For use with RAxML version 8.2.4 """ import fnmatch import glob import optparse import os import subprocess import sys def stop_err(msg): sys.stderr.write("%s\n" % msg) sys.exit() def getint(name): basename = name.partition('RUN.') if basename...
mit
40223221/2015cd_midterm
static/Brython3.1.1-20150328-091302/Lib/xml/dom/__init__.py
873
4019
"""W3C Document Object Model implementation for Python. The Python mapping of the Document Object Model is documented in the Python Library Reference in the section on the xml.dom package. This package contains the following modules: minidom -- A simple implementation of the Level 1 DOM with namespace sup...
gpl-3.0
trozamon/hadmin
hadmin/jmx.py
1
3639
""" Apache Hadoop-specific JMX parsing ---------------------------------- Parse JMX JSON objects to get some stats """ import json import re try: from http.client import HTTPConnection except ImportError: from httplib import HTTPConnection class JMX(dict): """ Base class that does the majority of t...
mit
SpaceKatt/CSPLN
apps/scaffolding/win/web2py/gluon/contrib/pymysql/tests/test_issues.py
43
10550
import pymysql from pymysql.tests import base import unittest import sys try: import imp reload = imp.reload except AttributeError: pass import datetime # backwards compatibility: if not hasattr(unittest, "skip"): unittest.skip = lambda message: lambda f: f class TestOldIssues(base.PyMySQLTestCase)...
gpl-3.0
RiceMunk/omnifit
omnifit/utils/utils.py
1
17927
import numpy as np import matplotlib.pyplot as plt from astropy import units as u import scipy.integrate from sys import float_info import warnings class Baseliner: """ A class for interactive baseliner of spectroscopic data. The class works by being fed a spectrum and a matplotlib axis on which it should b...
bsd-3-clause
jonghyeopkim/p2pool
p2pool/data.py
38
38487
from __future__ import division import hashlib import os import random import sys import time from twisted.python import log import p2pool from p2pool.bitcoin import data as bitcoin_data, script, sha256 from p2pool.util import math, forest, pack # hashlink hash_link_type = pack.ComposedType([ ('state', pack.Fi...
gpl-3.0
kalahbrown/HueBigSQL
apps/sqoop/src/sqoop/api/link.py
32
5440
#!/usr/bin/env python # 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 ma...
apache-2.0
DanielSBrown/osf.io
scripts/migrate_github_oauth_settings.py
55
7419
#!/usr/bin/env python # -*- coding: utf-8 -*- """Script to migrate addongithubusersettings and create and attach addongithuboauthsettings. Log: Executed on production by SL on 2014-10-05 at 23:11 EST. 269 AddonGithubUserSettings records were successfully migrated. 3 records with invalidated credentials were s...
apache-2.0
adityacs/ansible
lib/ansible/modules/notification/twilio.py
38
5973
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2015, Matt Makai <matthew.makai@gmail.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 ...
gpl-3.0
Teamxrtc/webrtc-streaming-node
third_party/depot_tools/external_bin/gsutil/gsutil_4.15/gsutil/third_party/boto/boto/cloudhsm/__init__.py
111
1654
# Copyright (c) 2015 Amazon.com, Inc. or its affiliates. # All Rights Reserved # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights...
mit
xen0l/ansible
lib/ansible/module_utils/facts/hardware/freebsd.py
101
7355
# 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 distributed in the hope that ...
gpl-3.0
crosick/zhishu
ENV/lib/python2.7/site-packages/pip/vcs/subversion.py
280
10468
from __future__ import absolute_import import logging import os import re from pip._vendor.six.moves.urllib import parse as urllib_parse from pip.index import Link from pip.utils import rmtree, display_path from pip.utils.logging import indent_log from pip.vcs import vcs, VersionControl _svn_xml_url_re = re.compile...
mit
CodeNameGhost/shiva
thirdparty/scapy/layers/tls/automaton_cli.py
1
32357
## This file is part of Scapy ## Copyright (C) 2007, 2008, 2009 Arnaud Ebalard ## 2015, 2016, 2017 Maxence Tury ## This program is published under a GPLv2 license """ TLS client automaton. This makes for a primitive TLS stack. Obviously you need rights for network access. We support versions SSLv2 to TL...
mit
kioma/densenet
models/densenet121.py
2
6939
from keras.models import Model from keras.layers import Input, merge, ZeroPadding2D from keras.layers.core import Dense, Dropout, Activation from keras.layers.convolutional import Convolution2D from keras.layers.pooling import AveragePooling2D, GlobalAveragePooling2D, MaxPooling2D from keras.layers.normalization import...
mit
XiaosongWei/crosswalk-test-suite
webapi/webapi-vehicleinfo-ivi-tests/inst.xpk.py
456
6809
#!/usr/bin/env python import os import shutil import glob import time import sys import subprocess import string from optparse import OptionParser, make_option SCRIPT_DIR = os.path.dirname(os.path.abspath(__file__)) PKG_NAME = os.path.basename(SCRIPT_DIR) PARAMETERS = None #XW_ENV = "export DBUS_SESSION_BUS_ADDRESS=...
bsd-3-clause
Danielweber7624/pybuilder
src/unittest/python/cli_tests.py
7
9951
# -*- coding: utf-8 -*- # # This file is part of PyBuilder # # Copyright 2011-2015 PyBuilder Team # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/l...
apache-2.0
SurfasJones/icecream-info
icecream/lib/python2.7/site-packages/django/contrib/gis/tests/test_spatialrefsys.py
104
4758
from django.contrib.gis.gdal import HAS_GDAL from django.contrib.gis.tests.utils import (no_mysql, oracle, postgis, spatialite, HAS_SPATIALREFSYS, SpatialRefSys) from django.utils import six from django.utils import unittest test_srs = ({'srid' : 4326, 'auth_name' : ('EPSG', True), 'auth...
mit
google-research/google-research
robust_loss/util.py
1
5609
# coding=utf-8 # Copyright 2021 The Google Research Authors. # # 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 applicab...
apache-2.0
alexandretrentesaux/aws_automation
otec_aws.py
1
12192
import boto3 import collections class BranchOffice: def __init__(self, **kwargs): self.pubIp = kwargs.get('public_ip', '89.225.243.226') self.label = kwargs.get('label', 'MNGT SITE 1') self.bgpAsn = kwargs.get('asn', 65000) self.cidr = kwargs.get('cidr', '192.168.1.0/26') s...
gpl-3.0
huwenboshi/hess
misc/local_rhog_manhattan.py
1
7113
#!/usr/bin/python # (c) 2016-2021 Huwenbo Shi import numpy as np import pandas as pd import argparse, math, sys import matplotlib matplotlib.use('Agg') import matplotlib.pyplot as plt import matplotlib.ticker as mtick from matplotlib import gridspec import matplotlib.ticker as ticker from matplotlib.ticker import For...
gpl-3.0
DPaaS-Raksha/raksha
raksha/virt/libvirt/utils.py
1
1681
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # All Rights Reserved. # Copyright (c) 2010 Citrix Systems, Inc. # Copyright (c) 2011 Piston Cloud Computing, Inc # Copyrigh...
apache-2.0
mdrumond/tensorflow
tensorflow/python/keras/_impl/keras/datasets/cifar10.py
15
2118
# 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
nextgenusfs/funannotate
funannotate/aux_scripts/phobius-multiproc.py
1
3842
#!/usr/bin/env python # -*- coding: utf-8 -*- import sys import os import uuid import time import multiprocessing import argparse import shutil import funannotate.library as lib # setup menu with argparse class MyFormatter(argparse.ArgumentDefaultsHelpFormatter): def __init__(self, prog): super(MyFormat...
bsd-2-clause
neharejanjeva/techstitution
venv/lib/python2.7/site-packages/pip/__init__.py
328
11348
#!/usr/bin/env python from __future__ import absolute_import import locale import logging import os import optparse import warnings import sys import re # 2016-06-17 barry@debian.org: urllib3 1.14 added optional support for socks, # but if invoked (i.e. imported), it will issue a warning to stderr if socks # isn't a...
cc0-1.0
praaline/Praaline
dependency-builds/sv/src/sord-0.12.0/.waf-1.7.9-070f761e9f6fd5d4df451bcef126793c/waflib/Tools/xlc.py
330
1175
#! /usr/bin/env python # encoding: utf-8 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file from waflib.Tools import ccroot,ar from waflib.Configure import conf @conf def find_xlc(conf): cc=conf.find_program(['xlc_r','xlc'],var='CC') cc=conf.cmd_to_list(cc) conf.g...
gpl-3.0
viaict/viaduct
migrations/versions/2018_07_14_42930577deff_new_table_structure_for_authlib.py
1
11895
"""New table structure for authlib. Revision ID: 42930577deff Revises: c0687b086ee3 Create Date: 2018-07-14 11:09:54.346801 """ import sqlalchemy as sa from alembic import op from sqlalchemy.dialects import postgresql from sqlalchemy.ext.declarative import declarative_base from sqlalchemy.orm import sessionmaker, rel...
mit
UCL-INGI/INGInious
inginious/frontend/pages/api/authentication.py
1
1615
# -*- coding: utf-8 -*- # # This file is part of INGInious. See the LICENSE and the COPYRIGHTS files for # more information about the licensing of this file. """ Authentication """ import flask from inginious.frontend.pages.api._api_page import APIPage, APIInvalidArguments class APIAuthentication(APIPage): """...
agpl-3.0
tempbottle/servo
tests/wpt/css-tests/tools/html5lib/html5lib/treeadapters/sax.py
1835
1661
from __future__ import absolute_import, division, unicode_literals from xml.sax.xmlreader import AttributesNSImpl from ..constants import adjustForeignAttributes, unadjustForeignAttributes prefix_mapping = {} for prefix, localName, namespace in adjustForeignAttributes.values(): if prefix is not None: pre...
mpl-2.0
ktaneishi/deepchem
examples/delaney/delaney_textcnn.py
2
1177
""" Script that trains textCNN models on delaney dataset. """ from __future__ import print_function from __future__ import division from __future__ import unicode_literals import numpy as np np.random.seed(123) import tensorflow as tf tf.set_random_seed(123) import deepchem as dc # Load Delaney dataset delaney_tasks,...
mit
googleads/google-ads-python
google/ads/googleads/v7/enums/types/user_list_access_status.py
1
1155
# -*- coding: utf-8 -*- # Copyright 2020 Google LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
apache-2.0
veloutin/python-flaskext.babel
setup.py
12
1313
""" Flask-Babel ----------- Adds i18n/l10n support to Flask applications with the help of the `Babel`_ library. Links ````` * `documentation <http://packages.python.org/Flask-Babel>`_ * `development version <http://github.com/mitsuhiko/flask-babel/zipball/master#egg=Flask-Babel-dev>`_ .. _Babel: http://babel.edge...
bsd-3-clause
adsorensen/girder
girder/api/v1/group.py
1
16668
#!/usr/bin/env python # -*- coding: utf-8 -*- ############################################################################### # Copyright 2013 Kitware 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 cop...
apache-2.0
rahushen/ansible
contrib/vault/vault-keyring-client.py
40
5169
#!/usr/bin/env python # -*- coding: utf-8 -*- # (c) 2014, Matt Martz <matt@sivel.net> # (c) 2016, Justin Mayer <https://justinmayer.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 ...
gpl-3.0
rousseab/pymatgen
pymatgen/io/xyz.py
4
2657
# coding: utf-8 from __future__ import division, unicode_literals """ Module implementing an XYZ file object class. """ __author__ = "Shyue Ping Ong" __copyright__ = "Copyright 2012, The Materials Project" __version__ = "0.1" __maintainer__ = "Shyue Ping Ong" __email__ = "shyuep@gmail.com" __date__ = "Apr 17, 2012"...
mit
wangyum/tensorflow
tensorflow/python/training/momentum_test.py
74
22862
# 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
51itclub/pelican
pelican/tests/test_importer.py
24
15914
# -*- coding: utf-8 -*- from __future__ import print_function, unicode_literals import locale import os import re from codecs import open from pelican.tests.support import (mute, skipIfNoExecutable, temporary_folder, unittest) from pelican.tools.pelican_import import (build_header...
agpl-3.0
ronniebhatti/googletest
test/gtest_xml_test_utils.py
1815
8876
#!/usr/bin/env python # # Copyright 2006, Google Inc. # All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
bsd-3-clause
solos/pylons
tests/test_webapps/filestotest/functional_controller_cache_decorator.py
4
1874
import time from projectname.tests import * class TestCacheController(TestController): def test_default_cache_decorator(self): response = self.app.get(url(controller='cache', action='test_default_cache_decorator')) assert 'Counter=1' in response response = self.app.get(url(controller...
bsd-3-clause
tanyaweaver/data-structures
src/binary_heap.py
1
3042
#!/usr/bin/env python # -*- coding: utf -8 -*- from __future__ import unicode_literals, division class BinaryHeap(object): """Binary Heap data structure class object""" def __init__(self, iterable=None): """Init an instance with the option to pass in an iterable""" self._list = [] try...
mit
enddo/HatKey
Lib/web/wsgiserver/wsgiserver3.py
1
81717
"""A high-speed, production ready, thread pooled, generic HTTP server. Simplest example on how to use this module directly (without using CherryPy's application machinery):: from cherrypy import wsgiserver def my_crazy_app(environ, start_response): status = '200 OK' response_headers ...
gpl-3.0
bwhitelock/garmon-ng
scripts/elm_sim.py
1
7050
#!/usr/bin/python # # elm_sim.py # # Copyright (C) Ben Van Mechelen 2007 <me@benvm.be> # # elm_sim.py is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 2 of the License, or # (at your option) any...
gpl-3.0
elijah513/django
tests/httpwrappers/tests.py
63
27550
# -*- encoding: utf-8 -*- from __future__ import unicode_literals import copy import json import os import pickle import unittest import uuid from django.core.exceptions import SuspiciousOperation from django.core.serializers.json import DjangoJSONEncoder from django.core.signals import request_finished from django.d...
bsd-3-clause
jwalgran/otm-core
opentreemap/opentreemap/context_processors.py
4
3606
# -*- coding: utf-8 -*- from __future__ import print_function from __future__ import unicode_literals from __future__ import division import copy from datetime import datetime from django.conf import settings from django.contrib.staticfiles import finders from django.utils.timezone import now from django.utils.transl...
gpl-3.0
kcleung/pyreform
pyreform/pddl_planner.py
1
3754
''' PDDL Merge and Translator - Planner Module Author: Dr. Patricia Riddle @ 2013 Contact: pat@cs.auckland.ac.nz Functions for calling an external planner in order to validate and process the intermediary problem files ------- Copyright (C) 2013 Dr. Patricia Riddle, University of Auckland This program...
gpl-3.0
SchweizerischeBundesbahnen/cimon_controller
tests/test_collector.py
1
5893
__author__ = 'florianseidl' from collector import * from urllib.error import HTTPError from unittest import TestCase from unittest.mock import Mock, DEFAULT from types import SimpleNamespace from concurrent import futures class TestHttpClient(TestCase): json_str = '{ "foo": "bar" }' def test_ok(self): ...
apache-2.0
yongshengwang/hue
desktop/core/ext-py/Pygments-1.3.1/pygments/formatter.py
75
2790
# -*- coding: utf-8 -*- """ pygments.formatter ~~~~~~~~~~~~~~~~~~ Base formatter class. :copyright: Copyright 2006-2010 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import codecs from pygments.util import get_bool_opt from pygments.styles import get_style_by_nam...
apache-2.0
rickerbh/tictactoe_py
tictactoe/game_state.py
1
2357
from tictactoe.game_board import GameBoard from collections import Counter import functools class GameState(): def __init__(self, board): self._board = board def is_draw(self): def is_not_empty(item): return not item == "" if self.has_winner(): return F...
mit
EmadMokhtar/Django
tests/model_fields/test_imagefield.py
40
16219
import os import shutil from unittest import skipIf from django.core.exceptions import ImproperlyConfigured from django.core.files import File from django.core.files.images import ImageFile from django.test import TestCase from django.test.testcases import SerializeMixin try: from .models import Image except Impr...
mit
Danielhiversen/home-assistant
homeassistant/components/sensor/tcp.py
3
4829
""" Support for TCP socket based sensors. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.tcp/ """ import logging import socket import select import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant....
mit
ukanga/SickRage
lib/rebulk/test/rules_module.py
21
1177
#!/usr/bin/env python # -*- coding: utf-8 -*- # pylint: disable=no-self-use, pointless-statement, missing-docstring, invalid-name from ..match import Match from ..rules import Rule class Rule3(Rule): def when(self, matches, context): return context.get('when') def then(self, matches, when_response, c...
gpl-3.0
zhjunlang/kbengine
kbe/src/lib/python/Lib/mailcap.py
100
7437
"""Mailcap file handling. See RFC 1524.""" import os __all__ = ["getcaps","findmatch"] # Part 1: top-level interface. def getcaps(): """Return a dictionary containing the mailcap database. The dictionary maps a MIME type (in all lowercase, e.g. 'text/plain') to a list of dictionaries corresponding to ...
lgpl-3.0
idaholab/civet
ci/recipe/RecipeWriter.py
2
3316
# Copyright 2016 Battelle Energy Alliance, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agr...
apache-2.0
swordqiu/ASPathInference
script/inferRelation.py
1
10819
#!/usr/bin/env python import sys import string import bgplib import argparse R = 60 L = 1 g_asgraph = {} g_transfreq = {} g_prefixfreq = {} g_maxfreq = 0 g_asexit = {} def addExit(src, exitas): global g_asexit if not g_asexit.has_key(src): g_asexit[src] = {} g_asexit[src][exitas] = g_asexit[src...
gpl-2.0
anryko/ansible
lib/ansible/modules/cloud/amazon/ec2_vpc_vpn_info.py
6
7525
#!/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 = {'status': ['preview'], 'supported_by': 'community...
gpl-3.0
lidavidm/mathics-heroku
venv/lib/python2.7/site-packages/sympy/combinatorics/prufer.py
1
11827
from sympy.core import Basic from sympy.core.compatibility import iterable, as_int from sympy.utilities.iterables import flatten from collections import defaultdict class Prufer(Basic): """ The Prufer correspondence is an algorithm that describes the bijection between labeled trees and the Prufer code. A...
gpl-3.0
ininex/geofire-python
resource/lib/python2.7/site-packages/werkzeug/__init__.py
36
6920
# -*- coding: utf-8 -*- """ werkzeug ~~~~~~~~ Werkzeug is the Swiss Army knife of Python web development. It provides useful classes and functions for any WSGI application to make the life of a python web developer much easier. All of the provided classes are independent from each other so yo...
mit
virgree/odoo
openerp/addons/test_new_api/tests/test_new_fields.py
69
14924
# # test cases for new-style fields # from datetime import date, datetime from collections import defaultdict from openerp.tests import common from openerp.exceptions import except_orm class TestNewFields(common.TransactionCase): def test_00_basics(self): """ test accessing new fields """ # find...
agpl-3.0
n0trax/ansible
lib/ansible/modules/cloud/ovirt/ovirt_hosts.py
22
21713
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (c) 2016 Red Hat, Inc. # # 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 #...
gpl-3.0
raydive/kame
kame.py
1
9919
#!/usr/bin/env python # encoding: utf-8 class Kame(object): """ 道なりの亀 """ class Node(object): """ 各文字が入るノード ノードはそれぞれ上下左右の枝を持つ """ def __init__(self, value): """ nodeのコンストラクタ """ self.value = value self.top = None self...
mit
ocampocj/cloud-custodian
tests/test_health.py
6
2197
# Copyright 2017 Capital One Services, LLC # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in...
apache-2.0
pombredanne/pyjs
examples/mail/AboutDialog.py
6
2286
from pyjamas.ui.Button import Button from pyjamas.ui.DialogBox import DialogBox from pyjamas.ui.DockPanel import DockPanel from pyjamas.ui.HorizontalPanel import HorizontalPanel from pyjamas.ui.HTML import HTML from pyjamas.ui.Image import Image from pyjamas.ui import KeyboardListener from pyjamas.ui.Widget import Widg...
apache-2.0
benesch/pip
pip/_vendor/packaging/requirements.py
5
4319
# This file is dual licensed under the terms of the Apache License, Version # 2.0, and the BSD License. See the LICENSE file in the root of this repository # for complete details. from __future__ import absolute_import, division, print_function import string import re from pip._vendor.pyparsing import stringStart, st...
mit
makielab/django-oscar
oscar/apps/offer/migrations/0019_auto__del_shippingbenefit__add_field_benefit_proxy_class__chg_field_be.py
17
16530
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): # Adding field 'Benefit.proxy_class' db.add_column('offer_benefit', 'proxy_class', sel...
bsd-3-clause
sappjw/gourmet
gourmet/plugins/field_editor/fieldEditor.py
6
11240
import gtk, gobject, os.path import gourmet.gglobals as gglobals import gourmet.convert as convert from gourmet.gtk_extras import cb_extras as cb from gourmet.gtk_extras import dialog_extras as de from gettext import ngettext from gettext import gettext as _ class FieldEditor: """A generic "value" editor for mucki...
gpl-2.0
apple/swift-lldb
packages/Python/lldbsuite/test/tools/lldb-server/TestGdbRemoteKill.py
1
2105
from __future__ import print_function import gdbremote_testcase import lldbgdbserverutils from lldbsuite.test.decorators import * from lldbsuite.test.lldbtest import * from lldbsuite.test import lldbutil class TestGdbRemoteKill(gdbremote_testcase.GdbRemoteTestCaseBase): mydir = TestBase.compute_mydir(__file__)...
apache-2.0
zak-k/iris
lib/iris/tests/unit/analysis/test_COUNT.py
12
2160
# (C) British Crown Copyright 2013 - 2015, Met Office # # This file is part of Iris. # # Iris is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by the # Free Software Foundation, either version 3 of the License, or # (at your option) any l...
gpl-3.0
ales-erjavec/orange
Orange/utils/collections.py
6
4276
import bisect import array from itertools import izip class TypedDict(object): """ An space efficient dictionary like object with typed keys and values and O(log(n)) item lookup. Example :: >>> d = TypedDict({1:'a', 2:'b', 3:'c'}, keytype="i", valuetype="c") """ __slots__...
gpl-3.0
petebachant/pyqtgraph
pyqtgraph/canvas/CanvasTemplate_pyqt.py
35
5126
# -*- coding: utf-8 -*- # Form implementation generated from reading ui file 'acq4/pyqtgraph/canvas/CanvasTemplate.ui' # # Created: Thu Jan 2 11:13:07 2014 # by: PyQt4 UI code generator 4.9 # # WARNING! All changes made in this file will be lost! from PyQt4 import QtCore, QtGui try: _fromUtf8 = QtCore.QStr...
mit
zhengzhihust/tablib
tablib/packages/openpyxl3/drawing.py
55
10472
''' Copyright (c) 2010 openpyxl 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, distribute, subli...
mit
inares/edx-platform
common/lib/xmodule/xmodule/modulestore/tests/sample_courses.py
100
9544
# encoding: utf-8 """ The data type and use of it for declaratively creating test courses. """ # used to create course subtrees in ModuleStoreTestCase.create_test_course # adds to self properties w/ the given block_id which hold the UsageKey for easy retrieval. # fields is a dictionary of keys and values. sub_tree is a...
agpl-3.0
jhoenicke/python-trezor
trezorlib/tests/device_tests/test_msg_tezos_sign_tx.py
3
8381
# This file is part of the Trezor project. # # Copyright (C) 2012-2018 SatoshiLabs and contributors # # This library is free software: you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License version 3 # as published by the Free Software Foundation. # # This library is distrib...
lgpl-3.0
bbc/kamaelia
Sketches/MH/MobileReframe/RangeFilter.py
3
7339
#!/usr/bin/env python # -*- coding: 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. # # Licensed under the Apache License...
apache-2.0
tangtang2013/zerorpc-python
tests/test_reqstream.py
77
1992
# -*- coding: utf-8 -*- # Open Source Initiative OSI - The MIT License (MIT):Licensing # # The MIT License (MIT) # Copyright (c) 2012 DotCloud Inc (opensource@dotcloud.com) # # Permission is hereby granted, free of charge, to any person obtaining a copy of # this software and associated documentation files (the "Softwa...
mit