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
nhippenmeyer/django
tests/extra_regress/models.py
281
1401
from __future__ import unicode_literals import copy import datetime from django.contrib.auth.models import User from django.db import models from django.utils.encoding import python_2_unicode_compatible @python_2_unicode_compatible class RevisionableModel(models.Model): base = models.ForeignKey('self', models.S...
bsd-3-clause
0Chencc/CTFCrackTools
Lib/test/test_wave.py
141
1151
from test.test_support import TESTFN, run_unittest import os import wave import unittest nchannels = 2 sampwidth = 2 framerate = 8000 nframes = 100 class TestWave(unittest.TestCase): def setUp(self): self.f = None def tearDown(self): if self.f is not None: self.f.close() ...
gpl-3.0
tsiktsiris/falcon
Documentation/networking/cxacru-cf.py
14668
1626
#!/usr/bin/env python # Copyright 2009 Simon Arlott # # 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 program i...
gpl-2.0
sursum/buckanjaren
buckanjaren/lib/python3.5/site-packages/django/contrib/auth/context_processors.py
189
1939
# PermWrapper and PermLookupDict proxy the permissions system into objects that # the template system can understand. class PermLookupDict(object): def __init__(self, user, app_label): self.user, self.app_label = user, app_label def __repr__(self): return str(self.user.get_all_permissions()) ...
mit
eduNEXT/edunext-platform
openedx/core/djangoapps/content/block_structure/transformer_registry.py
4
2387
""" Block Structure Transformer Registry implemented using the platform's PluginManager. """ from base64 import b64encode from hashlib import sha1 import six from openedx.core.lib.cache_utils import process_cached from openedx.core.lib.plugins import PluginManager class TransformerRegistry(PluginManager): """...
agpl-3.0
UNINETT/nav
python/nav/ipdevpoll/plugins/psuwatch.py
1
4821
# # Copyright (C) 2019 Uninett AS # # This file is part of Network Administration Visualized (NAV). # # NAV is free software: you can redistribute it and/or modify it under # the terms of the GNU General Public License version 3 as published by # the Free Software Foundation. # # This program is distributed in the hope...
gpl-2.0
kineticgar/mecanum
avr_controller/scripts/voltage.py
4
1549
#!/usr/bin/env python import sys import serial import time print('Opening port') arduino = serial.Serial('/dev/ttyACM0', 115200, timeout=1, dsrdtr=False) time.sleep(3) print('Flushing the buffer') arduino.readline() def a2s(arr): """ Array of integer byte values --> binary string """ return ''.join(chr(b...
gpl-2.0
marty331/jakesclock
flask/lib/python2.7/site-packages/setuptools/extension.py
192
1821
import sys import re import functools import distutils.core import distutils.errors import distutils.extension from .dist import _get_unpatched from . import msvc9_support _Extension = _get_unpatched(distutils.core.Extension) msvc9_support.patch_for_specialized_compiler() def have_pyrex(): """ Return True i...
gpl-2.0
Vector35/binaryninja-api
python/lineardisassembly.py
2
15064
# Copyright (c) 2015-2021 Vector 35 Inc # # 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
3dfxmadscientist/odoo_vi
addons/mass_mailing/controllers/main.py
21
3953
import werkzeug from openerp import http, SUPERUSER_ID from openerp.http import request class MassMailController(http.Controller): @http.route('/mail/track/<int:mail_id>/blank.gif', type='http', auth='none') def track_mail_open(self, mail_id, **post): """ Email tracking. """ mail_mail_stats...
agpl-3.0
EnviroCentre/jython-upgrade
jython/lib/test/test_unicode_file.py
122
8491
# Test some Unicode file name semantics # We dont test many operations on files other than # that their names can be used with Unicode characters. import os, glob, time, shutil import unicodedata import unittest from test.test_support import run_unittest, TESTFN_UNICODE from test.test_support import TESTFN_ENCODING, T...
mit
AndroidOpenDevelopment/android_external_chromium_org
chrome/browser/metrics/variations/generate_resources_map.py
9
5382
#!/usr/bin/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. import collections import hashlib import operator import os import re import sys RESOURCE_EXTRACT_REGEX = re.compile('^#define (\S*) (\d*...
bsd-3-clause
ialmetwally/android-resource-remover
setup.py
10
1065
import os import sys from setuptools import setup, find_packages version = '0.1.5' def read(f): return open(os.path.join(os.path.dirname(__file__), f)).read().strip() setup(name='android-resource-remover', version=version, description=('Android resource remover'), long_description='\n\n'.join...
apache-2.0
denim2x/Vintageous
tests/commands/test__vi_dollar.py
6
4202
import unittest from collections import namedtuple from Vintageous.vi.utils import modes from Vintageous.tests import set_text from Vintageous.tests import add_sel from Vintageous.tests import get_sel from Vintageous.tests import first_sel from Vintageous.tests import ViewTest def get_text(test): return test.vi...
mit
eadgarchen/tensorflow
tensorflow/contrib/training/python/training/training.py
33
20450
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable ...
apache-2.0
piratos/ctfbulletin
blog/views.py
1
1846
from django.shortcuts import render, Http404 from blog.models import * from django.contrib.auth.decorators import login_required def user_or_challenger(request): user_id = request.user.id chexist = False uexist = False try: user = User.objects.get(id=user_id) uexist = True try:...
mit
gnuhub/intellij-community
python/helpers/docutils/parsers/rst/directives/tables.py
49
19736
# $Id: tables.py 6107 2009-08-31 02:29:08Z goodger $ # Authors: David Goodger <goodger@python.org>; David Priest # Copyright: This module has been placed in the public domain. """ Directives for table elements. """ __docformat__ = 'reStructuredText' import sys import os.path import csv from docutils import io, nod...
apache-2.0
rdkls/gps-tracker-server
rest_api/rest_api.py
1
6919
#!/usr/bin/env python import json import config import sys import re from flask_cors import CORS from gevent.pywsgi import WSGIServer from flask import Flask, request from werkzeug.exceptions import NotFound, Unauthorized, BadRequest from models import * app = Flask(__name__) app.debug = True app.config['CORS_HEADERS'...
gpl-3.0
lesthack/azucar
src/player.py
1
27194
#!/usr/bin/python # -*- coding: utf-8 -*- import gobject import gtk import pango import re import os import keybinder import logging import time import pynotify import ConfigParser import multiprocessing import cover import config UI_FILE = "data/player.ui" class player: def __init__(self, xmms): se...
gpl-3.0
BenediktS/three.js
utils/exporters/blender/addons/io_three/logger.py
176
1423
import os import logging import tempfile from . import constants LOG_FILE = None LOGGER = None LEVELS = { constants.DEBUG: logging.DEBUG, constants.INFO: logging.INFO, constants.WARNING: logging.WARNING, constants.ERROR: logging.ERROR, constants.CRITICAL: logging.CRITICAL } def init(filename, l...
mit
Sancus/bedrock
bedrock/press/views.py
20
3927
# 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 django.core.mail import EmailMessage from django.template.loader import render_to_string from django.utils.decorato...
mpl-2.0
amenonsen/ansible
lib/ansible/plugins/action/dellos6.py
38
4085
# # (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
ondrokrc/gramps
gramps/gen/utils/cast.py
1
2885
# # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2000-2007 Donald N. Allingham # Copyright (C) 2009 Gary Burton # Copyright (C) 2011 Tim G L Lyons # # This program is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published ...
gpl-2.0
qiankunshe/sky_engine
sky/tools/webkitpy/common/system/crashlogs_unittest.py
58
6058
# Copyright (C) 2011 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: # # 1. Redistributions of source code must retain the above copyright # notice, this list of conditions and th...
bsd-3-clause
centrumholdings/buildbot
buildbot/scripts/logwatcher.py
2
3195
import os from twisted.python.failure import Failure from twisted.internet import defer, reactor, protocol, error from twisted.protocols.basic import LineOnlyReceiver class FakeTransport: disconnecting = False class BuildmasterTimeoutError(Exception): pass class BuildslaveTimeoutError(Exception): pass cl...
gpl-2.0
DailyActie/Surrogate-Model
01-codes/scikit-learn-master/sklearn/preprocessing/data.py
1
67256
# Authors: Alexandre Gramfort <alexandre.gramfort@inria.fr> # Mathieu Blondel <mathieu@mblondel.org> # Olivier Grisel <olivier.grisel@ensta.org> # Andreas Mueller <amueller@ais.uni-bonn.de> # Eric Martin <eric@ericmart.in> # Giorgio Patrini <giorgio.patrini@anu.edu.au> # Lic...
mit
b-deng/mailinabox
tools/mail.py
8
4562
#!/usr/bin/python3 import sys, getpass, urllib.request, urllib.error, json, re def mgmt(cmd, data=None, is_json=False): # The base URL for the management daemon. (Listens on IPv4 only.) mgmt_uri = 'http://127.0.0.1:10222' setup_key_auth(mgmt_uri) req = urllib.request.Request(mgmt_uri + cmd, urllib.parse.urlenco...
cc0-1.0
MarcJoan/django
django/utils/translation/trans_null.py
467
1408
# These are versions of the functions in django.utils.translation.trans_real # that don't actually do anything. This is purely for performance, so that # settings.USE_I18N = False can use this module rather than trans_real.py. from django.conf import settings from django.utils.encoding import force_text def ngettext...
bsd-3-clause
devs1991/test_edx_docmode
venv/lib/python2.7/site-packages/networkx/algorithms/link_analysis/tests/test_hits.py
10
2367
#!/usr/bin/env python from nose.tools import * from nose import SkipTest from nose.plugins.attrib import attr import networkx # Example from # A. Langville and C. Meyer, "A survey of eigenvector methods of web # information retrieval." http://citeseer.ist.psu.edu/713792.html class TestHITS: def setUp(self): ...
agpl-3.0
DiMartinoX/plugin.video.kinopoisk.ru
script.myshows/kinopoisk/LOGGER.py
1
1115
# -*- coding: utf-8 -*- # try: import xbmcaddon __settings__ = xbmcaddon.Addon("script.myshows") __myshows__ = xbmcaddon.Addon("plugin.video.myshows") try: debug = __myshows__.getSetting("debug") except: debug = __settings__.getSetting("debug") except: debug='true' def Log(msg,...
gpl-3.0
sathnaga/virt-test
qemu/tests/timedrift_with_stop.py
2
5153
import logging, time, os, signal from autotest.client.shared import error from virttest import utils_test def run_timedrift_with_stop(test, params, env): """ Time drift test with stop/continue the guest: 1) Log into a guest. 2) Take a time reading from the guest and host. 3) Stop the running of t...
gpl-2.0
RJRandell79/RJRStudios
node_modules/node-gyp/gyp/pylib/gyp/generator/android.py
542
45270
# Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. # Notes: # # This generates makefiles suitable for inclusion into the Android build system # via an Android.mk file. It is based on make.py, the standard makefile ...
gpl-2.0
appsembler/edx-platform
common/test/acceptance/pages/studio/settings_advanced.py
8
8274
""" Course Advanced Settings page """ from bok_choy.promise import EmptyPromise from common.test.acceptance.pages.studio.course_page import CoursePage from common.test.acceptance.pages.studio.utils import ( get_codemirror_value, press_the_notification_button, type_in_codemirror ) KEY_CSS = '.key h3.title...
agpl-3.0
BioXiao/chimerascan
chimerascan/deprecated/old_nominate_chimeras.py
6
8393
''' Created on Jun 4, 2011 @author: mkiyer chimerascan: chimeric transcript discovery using RNA-seq Copyright (C) 2011 Matthew Iyer 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 ...
gpl-3.0
inclement/vispy
vispy/visuals/collections/collection.py
20
8684
# -*- coding: utf-8 -*- # ----------------------------------------------------------------------------- # Copyright (c) 2014, Nicolas P. Rougier # Distributed under the (new) BSD License. See LICENSE.txt for more info. # ----------------------------------------------------------------------------- """ A collection is a...
bsd-3-clause
HuanglabPurdue/NCS
cuda/pyCUDANCS/profile.py
1
2785
#!/usr/bin/env python # # Used for quickly measuring how long the solver takes to run. # # Hazen 08/19 # import numpy import pycuda.autoinit import pycuda.driver as drv from pycuda.compiler import SourceModule import time # python3 and C NCS reference version. import pyCNCS.ncs_c as ncsC # OpenCL version (for the OTF...
gpl-3.0
pokemon4ik2008/py-airfoil
scons-local-2.2.0/SCons/Script/SConsOptions.py
14
37624
# # 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 # "Software"), to deal in the Software without restriction, including ...
gpl-3.0
lasote/conan
conans/test/functional/disk_search_test.py
4
3498
import os import unittest from conans.paths import (BUILD_FOLDER, PACKAGES_FOLDER, EXPORT_FOLDER, SimplePaths, CONANINFO) from conans.model.ref import ConanFileReference from conans.test.utils.test_files import temp_folder from conans.search.search import DiskSearchManager, DiskSearchAdapter from conans.util.files impo...
mit
HiSPARC/station-software
user/python/Lib/test/test_ordered_dict.py
4
13429
import copy import pickle from random import shuffle import unittest from collections import OrderedDict from collections import MutableMapping from test import mapping_tests, test_support class TestOrderedDict(unittest.TestCase): def test_init(self): with self.assertRaises(TypeError): Ordere...
gpl-3.0
wagjo/closure-library
closure/bin/build/depstree.py
455
6375
# Copyright 2009 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 # # Unless required by a...
apache-2.0
safwanrahman/readthedocs.org
readthedocs/restapi/permissions.py
2
2876
"""Defines access permissions for the API.""" from __future__ import absolute_import from rest_framework import permissions from readthedocs.core.permissions import AdminPermission class IsOwner(permissions.BasePermission): """Custom permission to only allow owners of an object to edit it.""" def has_obj...
mit
igemsoftware/SYSU-Software2013
project/Python27/Tools/scripts/xxci.py
94
2798
#! /usr/bin/env python # xxci # # check in files for which rcsdiff returns nonzero exit status import sys import os from stat import * import fnmatch EXECMAGIC = '\001\140\000\010' MAXSIZE = 200*1024 # Files this big must be binaries and are skipped. def getargs(): args = sys.argv[1:] if args: retu...
mit
smasala/phantomjs
src/qt/qtwebkit/Tools/Scripts/webkitpy/common/net/buildbot/buildbot_unittest.py
124
21459
# Copyright (C) 2009 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the f...
bsd-3-clause
zqzhang/crosswalk-test-suite
webapi/tct-csp-w3c-tests/csp-py/csp_img-src_asterisk_allowed_int-manual.py
30
2469
def main(request, response): import simplejson as json f = file('config.json') source = f.read() s = json.JSONDecoder().decode(source) url1 = "http://" + s['host'] + ":" + str(s['ports']['http'][1]) url2 = "http://" + s['host'] + ":" + str(s['ports']['http'][0]) response.headers.set("Content...
bsd-3-clause
2014cdag10/2014cdag10
wsgi/programs/cdag1/remsub6.py
9
18749
import cherrypy # 這是 MAN 類別的定義 ''' # 在 application 中導入子模組 import programs.cdag1.remsub6 as cdag1_remsub6 # 加入 cdag1 模組下的 remsub6.py 且以子模組 remsub6 對應其 remsub6() 類別 root.cdag1.remsub6 = cdag1_remsub6.remsub6() # 完成設定後, 可以利用 /cdag1/remsub6 # 呼叫 man.py 中 MAN 類別的 assembly 方法 ''' class remsub6(object): # 各組利用 index 引...
gpl-2.0
huguesv/PTVS
Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/win32/lib/win32timezone.py
6
31716
# -*- coding: UTF-8 -*- """ win32timezone: Module for handling datetime.tzinfo time zones using the windows registry for time zone information. The time zone names are dependent on the registry entries defined by the operating system. This module may be tested using the doctest module. Written by Jason R. Coombs...
apache-2.0
wummel/linkchecker
linkcheck/logger/graph.py
9
3382
# -*- coding: iso-8859-1 -*- # Copyright (C) 2000-2014 Bastian Kleineidam # # 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 versi...
gpl-2.0
Celedhrim/persomov
libs/dateutil/zoneinfo/__init__.py
144
2773
# -*- coding: utf-8 -*- """ Copyright (c) 2003-2005 Gustavo Niemeyer <gustavo@niemeyer.net> This module offers extensions to the standard Python datetime module. """ from dateutil.tz import tzfile from tarfile import TarFile import os __author__ = "Tomi Pieviläinen <tomi.pievilainen@iki.fi>" __license__ = "Simplifie...
gpl-3.0
mrphs/TorCtl
PathSupport.py
1
81359
#!/usr/bin/python # Copyright 2007-2010 Mike Perry. See LICENSE file. """ Support classes for path construction The PathSupport package builds on top of TorCtl.TorCtl. It provides a number of interfaces that make path construction easier. The inheritance diagram for event handling is as follows: TorCtl.EventHandler ...
bsd-3-clause
dhocker/athomepowerlineserver
commands/group_off.py
1
1500
# -*- coding: utf-8 -*- # # Group off # Copyright © 2020 Dave Hocker # # 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, version 3 of the License. # # See the LICENSE file for more details. # fr...
gpl-3.0
Impactstory/total-impact-webapp
totalimpact/providers/bibtex_lookup.py
4
75780
# from https://gist.github.com/jalavik/976294 # original XML at http://www.w3.org/Math/characters/unicode.xml # XSL for conversion: https://gist.github.com/798546 unicode_to_latex = { u"\u0020": "\\space ", u"\u0023": "\\#", u"\u0024": "\\textdollar ", u"\u0025": "\\%", u"\u0026": "\\&amp;", u...
mit
nagyistoce/devide.johannes
extra/soappy-cvp/tests/largeDataTest.py
6
1091
#!/usr/bin/env python # Copyright (c) 2001 actzero, inc. All rights reserved. import sys sys.path.insert(1, "..") from SOAPpy import * from SOAPpy import Parser # Uncomment to see outgoing HTTP headers and SOAP and incoming #Config.debug = 1 if len(sys.argv) > 1 and sys.argv[1] == '-s': server = SOAPProxy("ht...
bsd-3-clause
pilou-/ansible
lib/ansible/modules/network/f5/bigip_device_httpd.py
14
22262
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright: (c) 2017, F5 Networks Inc. # GNU General Public License v3.0 (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
gpl-3.0
lxl1140989/6291-xl
uboot/u-boot-dm6291-new/tools/patman/project.py
38
1415
# Copyright (c) 2012 The Chromium OS Authors. # # See file CREDITS for list of people who contributed to this # project. # # 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 # t...
gpl-2.0
openstack/nova
nova/api/openstack/urlmap.py
3
11598
# Copyright 2011 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
ikalnytskyi/sphinxcontrib-openapi
sphinxcontrib/openapi/renderers/_httpdomain_old.py
1
2292
"""Here lies still breathing and only renderer implementation.""" from docutils.parsers.rst import directives from . import abc from .. import openapi20, openapi30, utils class HttpdomainOldRenderer(abc.RestructuredTextRenderer): option_spec = { # A list of endpoints to be rendered. Endpoints must be w...
bsd-2-clause
wbrefvem/openshift-ansible
roles/lib_openshift/src/class/oc_process.py
45
6679
# pylint: skip-file # flake8: noqa # pylint: disable=too-many-instance-attributes class OCProcess(OpenShiftCLI): ''' Class to wrap the oc command line tools ''' # pylint allows 5. we need 6 # pylint: disable=too-many-arguments def __init__(self, namespace, tname=None...
apache-2.0
louishust/mysql5.6.14_tokudb
storage/tokudb/mysql-test/suite/tokudb/t/change_column_char.py
54
1339
#!/usr/bin/env python import sys def gen_test(n): print "CREATE TABLE t (a CHAR(%d));" % (n) for v in [ 'hi', 'there', 'people' ]: print "INSERT INTO t VALUES ('%s');" % (v) for i in range(2,256): if i < n: print "--replace_regex /MariaDB/XYZ/ /MySQL/XYZ/" print "--e...
gpl-2.0
shipci/sympy
sympy/mpmath/functions/expintegrals.py
47
11452
from .functions import defun, defun_wrapped @defun_wrapped def _erf_complex(ctx, z): z2 = ctx.square_exp_arg(z, -1) #z2 = -z**2 v = (2/ctx.sqrt(ctx.pi))*z * ctx.hyp1f1((1,2),(3,2), z2) if not ctx._re(z): v = ctx._im(v)*ctx.j return v @defun_wrapped def _erfc_complex(ctx, z): if ctx.re(...
bsd-3-clause
dyoung418/tensorflow
tensorflow/python/keras/_impl/keras/layers/gru_test.py
13
7074
# 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
jxs/servo
tests/wpt/css-tests/tools/pywebsocket/src/setup.py
434
2863
#!/usr/bin/env python # # Copyright 2012, 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...
mpl-2.0
rocky4570/moto
tests/test_ec2/test_general.py
8
1322
from __future__ import unicode_literals # Ensure 'assert_raises' context manager support for Python 2.6 import tests.backport_assert_raises from nose.tools import assert_raises import boto import boto3 from boto.exception import EC2ResponseError import sure # noqa from moto import mock_ec2_deprecated, mock_ec2 @mo...
apache-2.0
hofmannedv/training-python
commandline/fileinfo.py
1
1527
#!/usr/bin/python # ----------------------------------------------------------- # demonstrates how to work with commandline arguments using # docopt (http://docopt.org/) # # example fileinfo program # based my blog post here: # http://www.stackabuse.com/python-list-files-in-a-directory/ #o # (C) 2017 Frank Hofmann, B...
gpl-2.0
bennojoy/ansible
v1/ansible/utils/display_functions.py
147
2184
# (c) 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) any lat...
gpl-3.0
ryanvarley/ExoData
exodata/astroclasses.py
1
42589
""" Contains structural classes ie binary, star, planet etc which mimic the xml structure with objects """ import sys import math from pkg_resources import resource_stream import logging import numpy as np import astropy.coordinates import astropy.units as u from . import equations as eq from . import astroquantities...
mit
racker/cloud-init-debian-pkg
doc/rtd/conf.py
6
2327
import os import sys # If extensions (or modules to document with autodoc) are in another directory, # add these directories to sys.path here. If the directory is relative to the # documentation root, use os.path.abspath to make it absolute, like shown here. sys.path.insert(0, os.path.abspath('../../')) sys.path.inser...
gpl-3.0
4Kaylum/SkyBot
cogs/shitpost_generator.py
1
17584
import random import voxelbotutils as utils arr1 = ["it is dangerous to","cries bc i","do you think shrek would","there is no ethical consumption when you","i must","do NOT","this is a warning: do not","why would you","tfw you","im just small and i","i long for the day when i can finally","why doesnt tumblr allow yo...
gpl-3.0
linjoahow/lego_Automatic-assembly
static/Brython3.1.0-20150301-090019/Lib/unittest/util.py
794
4157
"""Various utility functions.""" from collections import namedtuple, OrderedDict __unittest = True _MAX_LENGTH = 80 def safe_repr(obj, short=False): try: result = repr(obj) except Exception: result = object.__repr__(obj) if not short or len(result) < _MAX_LENGTH: return result ...
gpl-3.0
xyuanmu/XX-Net
python3.8.2/Lib/unittest/test/test_case.py
6
73098
import contextlib import difflib import pprint import pickle import re import sys import logging import warnings import weakref import inspect from copy import deepcopy from test import support import unittest from unittest.test.support import ( TestEquality, TestHashing, LoggingResult, LegacyLoggingResult, ...
bsd-2-clause
EdDev/vdsm
vdsm_hooks/vmfex/before_vm_migrate_destination.py
1
4071
#!/usr/bin/python2 import os import sys import traceback import fcntl from xml.dom import minidom try: # 3.0 compat import libvirtconnection libvirtconnection except ImportError: # 3.1 compat from vdsm import libvirtconnection ''' Placed in before_vm_migrate_destination vmfex hook on migration de...
gpl-2.0
Shanec132006/Lab4
lib/flask/testsuite/__init__.py
564
7022
# -*- coding: utf-8 -*- """ flask.testsuite ~~~~~~~~~~~~~~~ Tests Flask itself. The majority of Flask is already tested as part of Werkzeug. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ from __future__ import print_function import os import sys im...
apache-2.0
Bad-ptr/parser.py
utils.py
1
2870
#!/usr/bin/env python # coding UTF-8 # Copyright 2013 Constantin Kulikov # # Author: Constantin Kulikov (Bad_ptr) <zxnotdead@gmail.com> # Date: 2013/06/21 11:21:11 # License: GPL either version 2 or any later version import sys def SetRecursionLimit(n=5000): sys.setrecursionlimit(n) def _or(smth, defv): i...
gpl-2.0
nickpack/django-oscar
tests/integration/auth_tests.py
48
2558
import unittest from django.test import TestCase from django.contrib.auth import authenticate from django.core import mail from oscar.core.compat import get_user_model User = get_user_model() class TestEmailAuthBackend(TestCase): def test_authenticates_multiple_users(self): password = 'lookmanohands' ...
bsd-3-clause
kjs73/pele
pele/systems/ljcluster.py
3
4106
import tempfile from pele.systems import AtomicCluster from pele.potentials import LJ from pele.utils.xyz import write_xyz __all__ = ["LJCluster"] class LJCluster(AtomicCluster): """ define the System class for a Lennard-Jones cluster Parameters ---------- natoms : int See Also ...
gpl-3.0
abhattad4/Digi-Menu
digimenu2/tests/template_tests/filter_tests/test_floatformat.py
345
4480
# -*- coding: utf-8 -*- from __future__ import unicode_literals from decimal import Decimal, localcontext from unittest import expectedFailure from django.template.defaultfilters import floatformat from django.test import SimpleTestCase from django.utils import six from django.utils.safestring import mark_safe from ...
bsd-3-clause
Matthie456/Bon_DenDuijn
SpatialDecision/external/networkx/drawing/layout.py
11
18390
""" ****** Layout ****** Node positioning algorithms for graph drawing. """ # Copyright (C) 2004-2015 by # Aric Hagberg <hagberg@lanl.gov> # Dan Schult <dschult@colgate.edu> # Pieter Swart <swart@lanl.gov> # All rights reserved. # BSD license. import collections import networkx as nx __author__ = """...
gpl-2.0
Crystalnix/house-of-life-chromium
third_party/mesa/MesaLib/src/gallium/tests/python/retrace/model.py
32
5631
#!/usr/bin/env python ########################################################################## # # Copyright 2008 Tungsten Graphics, Inc., Cedar Park, Texas. # All Rights Reserved. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files ...
bsd-3-clause
XuQiufeng/kernel_msm
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
kifcaliph/odoo
openerp/report/render/rml2pdf/__init__.py
381
1101
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). # # This program is free software: you can redistribute it and/or modify # it under the terms of the...
agpl-3.0
zefie/kernel_moto_shamu
tools/perf/scripts/python/check-perf-trace.py
11214
2503
# perf script event handlers, generated by perf script -g python # (c) 2010, Tom Zanussi <tzanussi@gmail.com> # Licensed under the terms of the GNU GPL License version 2 # # This script tests basic functionality such as flag and symbol # strings, common_xxx() calls back into perf, begin, end, unhandled # events, etc. ...
gpl-2.0
shaistaansari/django
django/db/backends/oracle/features.py
356
2345
from django.db.backends.base.features import BaseDatabaseFeatures from django.db.utils import InterfaceError try: import pytz except ImportError: pytz = None class DatabaseFeatures(BaseDatabaseFeatures): empty_fetchmany_value = () interprets_empty_strings_as_nulls = True uses_savepoints = True ...
bsd-3-clause
hernandito/SickRage
lib/hachoir_parser/misc/msoffice.py
74
31094
""" Parsers for the different streams and fragments found in an OLE2 file. Documents: - goffice source code - Microsoft Office PowerPoint 97-2007 Binary File Format (.ppt) Specification http://download.microsoft.com/download/0/B/E/0BE8BDD7-E5E8-422A-ABFD-4342ED7AD886/PowerPoint97-2007BinaryFileFormat(ppt)Specifi...
gpl-3.0
rhdedgar/openshift-tools
scripts/monitoring/cron-send-create-app.py
5
12893
#!/usr/bin/env python """ Create application check for v3 """ # We just want to see any exception that happens # don't want the script to die under any cicumstances # script must try to clean itself up # pylint: disable=broad-except # main() function has a lot of setup and error handling # pylint: disable=too-many-st...
apache-2.0
Ichag/odoo
openerp/addons/base/tests/test_misc.py
393
1111
import unittest2 from openerp.tools import misc class test_countingstream(unittest2.TestCase): def test_empty_stream(self): s = misc.CountingStream(iter([])) self.assertEqual(s.index, -1) self.assertIsNone(next(s, None)) self.assertEqual(s.index, 0) def test_single(self): ...
agpl-3.0
toshywoshy/ansible
lib/ansible/modules/cloud/rackspace/rax_files.py
57
11783
#!/usr/bin/python # (c) 2013, Paul Durivage <paul.durivage@rackspace.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
gpl-3.0
ema/conpaas
conpaas-services/contrib/libcloud/compute/drivers/ktucloud.py
5
3393
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
bsd-3-clause
Huyuwei/tvm
tests/python/contrib/test_sort.py
2
3267
# 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
liaorubei/depot_tools
third_party/pylint/pyreverse/main.py
67
5143
# # Copyright (c) 2000-2013 LOGILAB S.A. (Paris, FRANCE). # http://www.logilab.fr/ -- mailto:contact@logilab.fr # # 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,...
bsd-3-clause
hobarrera/django
django/core/checks/security/base.py
45
6645
from django.conf import settings from .. import Tags, Warning, register from ..utils import patch_middleware_message SECRET_KEY_MIN_LENGTH = 50 SECRET_KEY_MIN_UNIQUE_CHARACTERS = 5 W001 = Warning( "You do not have 'django.middleware.security.SecurityMiddleware' " "in your MIDDLEWARE so the SECURE_HSTS_SECOND...
bsd-3-clause
mmardini/django
django/contrib/messages/storage/base.py
113
6286
from __future__ import unicode_literals from django.conf import settings from django.utils.encoding import force_text, python_2_unicode_compatible from django.contrib.messages import constants, utils LEVEL_TAGS = utils.get_level_tags() @python_2_unicode_compatible class Message(object): """ Represents an a...
bsd-3-clause
andrecunha/idd3
idd3/rules/universal/misc_rulesets.py
1
10997
# -*- coding: utf-8 -*- # IDD3 - Propositional Idea Density from Dependency Trees # Copyright (C) 2014-2015 Andre Luiz Verucci da Cunha # # 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 ...
gpl-3.0
Gamebasis/3DGamebasisServer
GameData/blender-2.71-windows64/2.71/scripts/modules/bl_i18n_utils/merge_po.py
1
6180
#!/usr/bin/env python3 # ***** BEGIN GPL LICENSE BLOCK ***** # # 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-3.0
saurabh6790/-aimobilize-lib
core/page/permission_manager/permission_manager.py
32
3461
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import webnotes import webnotes.defaults @webnotes.whitelist() def get_roles_and_doctypes(): webnotes.only_for(("System Manager", "Administrator")) return { "doctypes": [d...
mit
apache/airflow
tests/providers/odbc/hooks/test_odbc.py
2
7642
# # 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...
apache-2.0
psaavedra/matrix-bot
matrixbot/plugins/wkbotsfeeder.py
1
9174
import json import logging import os import pytz import requests import sys import urllib.request, urllib.parse, urllib.error import time if os.path.dirname(__file__) == "matrixbot/plugins": sys.path.append(os.path.abspath(".")) from matrixbot import utils pp, puts, set_property = utils.pp, utils.puts, utils.set...
mit
PaulcyMboungou/django-messaging
django_messaging/models.py
1
2827
from django.core.exceptions import ObjectDoesNotExist from django.db import models from django.contrib.auth.models import User class DmUser(models.Model): user=models.ForeignKey(User,unique=True,related_name='dm_user') last_activity=models.DateTimeField(auto_now_add=True) contacts=models.ManyToManyField(User,rel...
bsd-3-clause
sodexis/odoo
openerp/addons/base/ir/ir_model.py
4
61629
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Business Applications # Copyright (C) 2004-2014 OpenERP S.A. (<http://openerp.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms ...
agpl-3.0
TOC-Shard/moul-scripts
Python/system/encodings/cp037.py
593
13377
""" Python Character Mapping Codec cp037 generated from 'MAPPINGS/VENDORS/MICSFT/EBCDIC/CP037.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_table) def decode(self,input...
gpl-3.0
jmckaskill/subversion
tools/buildbot/master/Feeder.py
5
16341
# # # 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 n...
apache-2.0
nathania/networkx
examples/algorithms/blockmodel.py
32
3009
#!/usr/bin/env python # encoding: utf-8 """ Example of creating a block model using the blockmodel function in NX. Data used is the Hartford, CT drug users network: @article{, title = {Social Networks of Drug Users in {High-Risk} Sites: Finding the Connections}, volume = {6}, shorttitle = {Social Networks of Drug ...
bsd-3-clause