repo_name
stringlengths
5
100
path
stringlengths
4
294
copies
stringclasses
990 values
size
stringlengths
4
7
content
stringlengths
666
1M
license
stringclasses
15 values
boompieman/iim_project
project_python2/lib/python2.7/site-packages/nbconvert/preprocessors/tests/test_svg2pdf.py
11
2336
"""Tests for the svg2pdf preprocessor""" # Copyright (c) IPython Development Team. # Distributed under the terms of the Modified BSD License. from ipython_genutils.testing import decorators as dec from nbformat import v4 as nbformat from .base import PreprocessorTestsBase from ..svg2pdf import SVG2PDFPreprocessor ...
gpl-3.0
Carmezim/tensorflow
tensorflow/python/ops/nn_grad.py
12
25896
# 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
broferek/ansible
lib/ansible/modules/cloud/amazon/ec2_vol_info.py
3
5062
#!/usr/bin/python # Copyright: Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], ...
gpl-3.0
geometalab/OSM-Crosswalk-Detection
src/base/bbox.py
2
1756
from src.base.node import Node class Bbox: def __init__(self, left=None, bottom=None, right=None, top=None): self.left = left self.bottom = bottom self.right = right self.top = top @classmethod def from_nodes(cls, node_left_down=None, node_right_up=None): bbox = cl...
mit
KanagiMiss/cl-auto-reply
gae/lib/flask/testsuite/reqctx.py
557
5960
# -*- coding: utf-8 -*- """ flask.testsuite.reqctx ~~~~~~~~~~~~~~~~~~~~~~ Tests the request context. :copyright: (c) 2012 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import flask import unittest try: from greenlet import greenlet except ImportError: greenlet = None...
mit
saurabh6790/med_new_lib
core/doctype/report/report.py
34
1669
# Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals import webnotes from webnotes import conf, _ class DocType: def __init__(self, doc, doclist): self.doc, self.doclist = doc, doclist def validate(self): """only admini...
mit
mkeller0815/py65
py65/memory.py
2
2382
from collections import defaultdict class ObservableMemory: def __init__(self, subject=None, addrWidth=16): self.physMask = 0xffff if addrWidth > 16: # even with 32-bit address space, model only 256k memory self.physMask = 0x3ffff if subject is None: su...
bsd-3-clause
groutr/numpy
numpy/lib/arrayterator.py
9
7201
""" A buffered iterator for big arrays. This module solves the problem of iterating over a big file-based array without having to read it into memory. The `Arrayterator` class wraps an array object, and when iterated it will return sub-arrays with at most a user-specified number of elements. """ from __future__ impor...
bsd-3-clause
samuelclay/NewsBlur
utils/monitor_newsletter_delivery.py
1
1612
#!/usr/local/bin/python3 import sys sys.path.append('/srv/newsblur') import requests from newsblur_web import settings import socket def main(): hostname = socket.gethostname() admin_email = settings.ADMINS[0][1] r = requests.get("https://api.mailgun.net/v3/newsletters.newsblur.com/stats/total", ...
mit
tomduijf/home-assistant
tests/components/automation/test_numeric_state.py
10
9357
""" tests.components.automation.test_numeric_state ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Tests numeric state automation. """ import unittest import homeassistant.core as ha import homeassistant.components.automation as automation class TestAutomationNumericState(unittest.TestCase): """ Test the event a...
mit
imcom/password-mixer
python-apm/apm_base.py
3
1945
#!/usr/bin/python #------------------------------------------------------------------------------------------------- # The apm_base of the Python binding # Copyright (C) 2011 Antiy Labs # This file is part of free software: you can redistribute it and/or mod...
gpl-2.0
samueldotj/TeeRISC-Simulator
src/dev/x86/SouthBridge.py
16
4917
# Copyright (c) 2008 The Regents of The University of Michigan # 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
ofir123/CouchPotatoServer
couchpotato/core/downloaders/pneumatic.py
15
4439
from __future__ import with_statement import os import traceback from couchpotato.core._base.downloader.main import DownloaderBase from couchpotato.core.helpers.encoding import sp from couchpotato.core.logger import CPLog log = CPLog(__name__) autoload = 'Pneumatic' class Pneumatic(DownloaderBase): protocol ...
gpl-3.0
CentComOp/Everest_Main_Branch
bot/C_sarcasticball.py
67
1479
from random import choice as fsample sarcastic_responses = ["Yeah right","What do I look like to you?","Are you kidding me?",#UsF "As much as you","You don't believe that yourself","When pigs fly",#UsF "Like your grandma","You would like to know, wouldn't you?", #UsF ...
agpl-3.0
isyippee/nova
nova/tests/unit/virt/xenapi/test_volume_utils.py
46
9010
# Copyright 2013 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
heiher/ModemManager
test/mm-test.py
6
15258
#!/usr/bin/python # -*- Mode: python; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- # # 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 ...
gpl-2.0
omerucn/or-tools
examples/python/nonogram_default_search.py
34
5673
# Copyright 2010 Hakan Kjellerstrand hakank@bonetmail.com, lperron@google.com # # Licensed under the Apache License, Version 2.0 (the 'License'); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless req...
apache-2.0
Tatsh-ansible/ansible
lib/ansible/modules/web_infrastructure/ansible_tower/tower_project.py
9
7686
#!/usr/bin/python # coding: utf-8 -*- # (c) 2017, Wayne Witzel III <wayne@riotousliving.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.0...
gpl-3.0
synergeticsedx/deployment-wipro
lms/djangoapps/survey/tests/test_utils.py
102
3969
""" Python tests for the Survey models """ from collections import OrderedDict from django.test.client import Client from django.contrib.auth.models import User from survey.models import SurveyForm from xmodule.modulestore.tests.factories import CourseFactory from xmodule.modulestore.tests.django_utils import Modul...
agpl-3.0
2014c2g12/c2g12
wsgi/w2/static/Brython2.0.0-20140209-164925/Lib/linecache.py
785
3864
"""Cache lines from files. This is intended to read lines from modules imported -- hence if a filename is not found, it will look down the module search path for a file by that name. """ import sys import os import tokenize __all__ = ["getline", "clearcache", "checkcache"] def getline(filename, lineno, module_globa...
gpl-2.0
anirudhjayaraman/scikit-learn
examples/covariance/plot_robust_vs_empirical_covariance.py
248
6359
r""" ======================================= Robust vs Empirical covariance estimate ======================================= The usual covariance maximum likelihood estimate is very sensitive to the presence of outliers in the data set. In such a case, it would be better to use a robust estimator of covariance to guar...
bsd-3-clause
niktto/dontstarve_camp_status
character/migrations/0001_initial.py
1
3650
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.db import models, migrations class Migration(migrations.Migration): dependencies = [ ] operations = [ migrations.CreateModel( name='CharacterSheet', fields=[ ('id', models.AutoFie...
apache-2.0
ppanczyk/ansible
lib/ansible/modules/cloud/docker/docker_container.py
11
79886
#!/usr/bin/python # # Copyright 2016 Red Hat | Ansible # 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': ['prev...
gpl-3.0
eonpatapon/nova
nova/tests/unit/scheduler/test_rpcapi.py
59
3659
# Copyright 2013 Red Hat, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agre...
apache-2.0
samfpetersen/gnuradio
gr-digital/python/digital/utils/gray_code.py
75
2163
#!/usr/bin/env python # # Copyright 2011 Free Software Foundation, Inc. # # This file is part of GNU Radio # # GNU Radio is free software; you can redistribute it and/or modify # it under the terms of the GNU General Public License as published by # the Free Software Foundation; either version 3, or (at your option) ...
gpl-3.0
NICTA/dora
setup.py
1
1537
""" Setup utility for the dora package. """ from setuptools import setup, find_packages # from setuptools.command.test import test as TestCommand setup( name='dora', version='0.1', description='Active sampling using a non-parametric regression model.', url='http://github.com/nicta/dora', ...
apache-2.0
Baumelbi/IntroPython2016
Solutions/Session07/step_4/test_html_render.py
3
7875
""" test code for html_render.py includes step 4 """ import io from html_render import (Element, Html, Body, P, TextWrapper, Head, Title, ) # ...
unlicense
WASPACDC/hmdsm.repository
plugin.video.loganaddon/Images/resources/lib/libraries/gui_utils.py
25
4990
import xbmcgui import time import os import xbmcaddon #from utilities import notification, setSetting, getString #import traktapi import logging import control from trakt_api2 import TraktAPI2 #__addon__ = xbmcaddon.Addon("script.trakt") def get_pin(): AUTH_BUTTON = 200 LATER_BUTTON = 201 NEVER_BUTTON = 2...
gpl-2.0
plaes/libsigrokdecode
decoders/uart/pd.py
2
13450
## ## This file is part of the libsigrokdecode project. ## ## Copyright (C) 2011-2014 Uwe Hermann <uwe@hermann-uwe.de> ## ## 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-3.0
mishfit/ZeroNet
src/lib/pybitcointools/bitcoin/deterministic.py
24
6607
from .main import * import hmac import hashlib from binascii import hexlify # Electrum wallets def electrum_stretch(seed): return slowsha(seed) # Accepts seed or stretched seed, returns master public key def electrum_mpk(seed): if len(seed) == 32: seed = electrum_stretch(seed) return privkey_to...
gpl-2.0
AtkinsChang/slick
slick/src/sphinx/exts/apilinks.py
21
1383
""" Based on sphinx.ext.extlinks, :copyright: Copyright 2007-2011 by the Sphinx team, see AUTHORS. :license: BSD, see LICENSE for details. """ from docutils import nodes, utils from sphinx.util.nodes import split_explicit_title def make_link_role(base_url): def role(typ, rawtext, text, lineno, inlin...
bsd-2-clause
wilvk/ansible
lib/ansible/modules/cloud/ovirt/ovirt_storage_domains.py
8
25011
#!/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
miguelparaiso/OdooAccessible
addons/mail/res_config.py
301
2233
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2012-Today OpenERP SA (<http://www.openerp.com>) # # This program is free software: you can redistribute it and/or modify # it under the terms o...
agpl-3.0
eg-zhang/h2o-2
py/testdir_multi_jvm/test_exec2_slicing.py
9
3326
import unittest, random, sys, time, os sys.path.extend(['.','..','../..','py']) import h2o, h2o_cmd, h2o_glm, h2o_browse as h2b, h2o_import as h2i, h2o_exec as h2e def write_syn_dataset(csvPathname, rowCount, colCount, SEED): r1 = random.Random(SEED) dsf = open(csvPathname, "w+") for i in range(rowCount):...
apache-2.0
italomaia/turtle-linux
games/BubbleKing/lib/pgu/gui/button.py
8
10103
""" """ from pygame.locals import * from const import * import widget, surface import basic class _button(widget.Widget): def __init__(self,**params): widget.Widget.__init__(self,**params) self.state = 0 def event(self,e): if e.type == ENTER: self.repaint() elif e.type ==...
gpl-3.0
eljrax/rax-autoscaler
raxas/colouredconsolehandler.py
3
3057
# -*- coding: utf-8 -*- # vim: tabstop=4 shiftwidth=4 softtabstop=4 # # this file is part of 'RAX-AutoScaler' # # Copyright 2014 Rackspace US, 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 Licen...
apache-2.0
gannetson/sportschooldeopenlucht
env/lib/python2.7/site-packages/django/contrib/gis/tests/utils.py
102
1378
from django.conf import settings from django.db import DEFAULT_DB_ALIAS # function that will pass a test. def pass_test(*args): return def no_backend(test_func, backend): "Use this decorator to disable test on specified backend." if settings.DATABASES[DEFAULT_DB_ALIAS]['ENGINE'].rsplit('.')[-1] == backend: ...
bsd-3-clause
tdyas/pants
src/python/pants/option/options_bootstrapper.py
1
9939
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). import itertools import os import sys from dataclasses import dataclass from pathlib import Path from typing import Dict, Iterable, List, Mapping, Optional, Sequence, Set, Tuple, Type fro...
apache-2.0
dbrattli/RxPY
rx/linq/observable/catch.py
1
3909
from rx.observable import Observable from rx.anonymousobservable import AnonymousObservable from rx.disposables import Disposable, SingleAssignmentDisposable, \ CompositeDisposable, SerialDisposable from rx.concurrency import immediate_scheduler from rx.internal import Enumerable from rx.internal import extensionme...
apache-2.0
r-mibu/ceilometer
ceilometer/publisher/file.py
10
3877
# # Copyright 2013 IBM Corp # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
apache-2.0
windowsyuli/cross_domain
neuralnet/cross_bi_lstm.py
1
9119
import tensorflow as tf import numpy as np from neuralnet.ops import highway, last_relevant class cross_bi_lstm(object): def __init__(self, target_vec_dic, sequence_length, num_classes, vocab_size, embedding_size, filter_sizes, num_filters, d...
apache-2.0
Salat-Cx65/python-for-android
python3-alpha/python3-src/Lib/lib2to3/fixes/fix_throw.py
203
1582
"""Fixer for generator.throw(E, V, T). g.throw(E) -> g.throw(E) g.throw(E, V) -> g.throw(E(V)) g.throw(E, V, T) -> g.throw(E(V).with_traceback(T)) g.throw("foo"[, V[, T]]) will warn about string exceptions.""" # Author: Collin Winter # Local imports from .. import pytree from ..pgen2 import token from .. im...
apache-2.0
vrv/tensorflow
tensorflow/contrib/distributions/python/ops/operator_pd_cholesky.py
81
6810
# Copyright 2016 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
sergei-maertens/django
tests/prefetch_related/test_uuid.py
48
4763
from __future__ import unicode_literals from django.test import TestCase from .models import Flea, House, Person, Pet, Room class UUIDPrefetchRelated(TestCase): def test_prefetch_related_from_uuid_model(self): Pet.objects.create(name='Fifi').people.add( Person.objects.create(name='Ellen'), ...
bsd-3-clause
tdtrask/ansible
lib/ansible/modules/cloud/vultr/vr_startup_script.py
39
7106
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (c) 2018, René Moser <mail@renemoser.net> # 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
adam139/WeRobot
werobot/pay.py
3
5704
# -*- coding:utf-8 -*- from hashlib import sha1, md5 from urllib import urlencode import time from werobot.client import Client from werobot.utils import pay_sign_dict, generate_token from functools import partial NATIVE_BASE_URL = 'weixin://wxpay/bizpayurl?' class WeixinPayClient(Client): """ 简化微信支付API操作 ...
mit
40223211/logo-toys
static/Brython3.1.1-20150328-091302/Lib/unittest/signals.py
1016
2403
import signal import weakref from functools import wraps __unittest = True class _InterruptHandler(object): def __init__(self, default_handler): self.called = False self.original_handler = default_handler if isinstance(default_handler, int): if default_handler == signal.SIG_D...
agpl-3.0
HiSPARC/topaz
150722_interaction_altitudes/interaction_altitudes.py
1
3093
from numpy import arange, histogram, histogram2d, linspace, logspace, median, percentile from artist import Plot from sapphire import CorsikaQuery # proton = 14 # iron = 5626 OVERVIEW = '/Users/arne/Datastore/CORSIKA/corsika_overview.h5' def plot_interaction_height(cq): plot = Plot() p = 'proton' for...
gpl-3.0
baris/fullerite
src/diamond/collectors/uptime/uptime.py
59
1175
# coding=utf-8 """ Collect Uptime metrics #### Dependencies * /proc/uptime """ from diamond.collector import Collector from diamond import convertor import os class UptimeCollector(Collector): PROC = '/proc/uptime' def get_default_config(self): config = super(UptimeCollector, self).get_defa...
apache-2.0
dferguso/IGT4SAR
AreaNameDomain.py
1
3065
#------------------------------------------------------------------------------- # Name: AreaNameDomain.py # Purpose: Updates the list of names for search areas. Values obtained from # Hasty Points, Hasty Lines, Hasty Segments and Search Segments # # Author: Don Ferguson # # Created: 01/25/2012 # ...
gpl-3.0
nordri/check_domains
lib/python2.7/site-packages/django/core/servers/fastcgi.py
23
6630
""" FastCGI (or SCGI, or AJP1.3 ...) server that implements the WSGI protocol. Uses the flup python package: http://www.saddi.com/software/flup/ This is a adaptation of the flup package to add FastCGI server support to run Django apps from Web servers that support the FastCGI protocol. This module can be run standalo...
gpl-3.0
Scille/autobahn-sync
tests/test_rpc.py
1
5680
import pytest from autobahn_sync import AutobahnSync from autobahn.wamp.exception import ApplicationError from fixtures import crossbar, wamp, wamp2 class CounterHelper(object): def __init__(self): self.counter = 0 def __call__(self): self.counter += 1 return self.counter class Te...
mit
pgagne/robottelo
tests/foreman/ui/test_computeprofiles.py
2
2049
"""Test class for Compute Profile UI :Requirement: Computeprofile :CaseAutomation: Automated :CaseLevel: Acceptance :CaseComponent: ComputeResources :TestType: Functional :CaseImportance: High :Upstream: No """ from fauxfactory import gen_string from nailgun import entities from robottelo.decorators import tier...
gpl-3.0
zchking/odoo
addons/base_report_designer/plugin/openerp_report_designer/bin/script/ConvertBracesToField.py
384
12556
######################################################################### # # Copyright (c) 2003-2004 Danny Brewer d29583@groovegarden.com # Copyright (C) 2004-2010 OpenERP SA (<http://openerp.com>). # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Lesser Gene...
agpl-3.0
protochron/aurora
src/main/python/apache/aurora/client/cli/client.py
2
4326
# # 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 under ...
apache-2.0
mjtamlyn/django
django/db/migrations/graph.py
26
15905
import warnings from collections import deque from functools import total_ordering from django.db.migrations.state import ProjectState from django.utils.datastructures import OrderedSet from .exceptions import CircularDependencyError, NodeNotFoundError RECURSION_DEPTH_WARNING = ( "Maximum recursion depth exceede...
bsd-3-clause
wbyne/QGIS
python/plugins/processing/algs/otb/OTBUtils.py
3
10077
# -*- coding: utf-8 -*- """ *************************************************************************** OTBUtils.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya (C) 2013 by CS Systemes d'information (CS SI) Email...
gpl-2.0
sepehr125/pybrain
docs/code2tut.py
27
2275
#!/bin/env python """ Utility script to convert Python source code into tutorials. Synopsis: code2tut.py basename Output: Will convert tutorials/basename.py into sphinx/basename.txt Conventions: 1. All textual comments must be enclosed in triple quotation marks. 2. First line of file is ignored, second li...
bsd-3-clause
hurricup/intellij-community
python/lib/Lib/site-packages/django/contrib/gis/geos/tests/test_geos.py
76
43164
import ctypes, random, unittest, sys from django.contrib.gis.geos import * from django.contrib.gis.geos.base import gdal, numpy, GEOSBase from django.contrib.gis.geos.libgeos import GEOS_PREPARE from django.contrib.gis.geometry.test_data import TestDataMixin class GEOSTest(unittest.TestCase, TestDataMixin): @prop...
apache-2.0
dneg/cortex
python/IECoreMaya/PresetsOnlyParameterUI.py
12
3700
########################################################################## # # Copyright (c) 2010, Image Engine Design 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: # # * Redistribu...
bsd-3-clause
dstrockis/outlook-autocategories
lib/oauth2client/contrib/devshell.py
20
4895
# Copyright 2015 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 ...
apache-2.0
varigit/kernel-VAR-SOM-AMxx
tools/perf/scripts/python/failed-syscalls-by-pid.py
11180
2058
# failed system call counts, by pid # (c) 2010, Tom Zanussi <tzanussi@gmail.com> # Licensed under the terms of the GNU GPL License version 2 # # Displays system-wide failed system call totals, broken down by pid. # If a [comm] arg is specified, only syscalls called by [comm] are displayed. import os import sys sys.pa...
gpl-2.0
hortonworks/hortonworks-sandbox
desktop/core/ext-py/Twisted/twisted/test/test_pbfailure.py
61
13619
# Copyright (c) 2001-2008 Twisted Matrix Laboratories. # See LICENSE for details. """ Tests for error handling in PB. """ from twisted.trial import unittest from twisted.spread import pb, flavors, jelly from twisted.internet import reactor, defer from twisted.python import log ## # test exceptions ## class Asynchro...
apache-2.0
skevy/django
django/views/debug.py
1
32491
import datetime import os import re import sys import types from django.conf import settings from django.http import HttpResponse, HttpResponseServerError, HttpResponseNotFound from django.template import (Template, Context, TemplateDoesNotExist, TemplateSyntaxError) from django.template.defaultfilters import forc...
bsd-3-clause
rock-planning/planning-lama
lama/translate/build_model.py
1
13282
#! /usr/bin/env python # -*- coding: utf-8 -*- import sys import itertools import pddl import tools import timers from functools import reduce def convert_rules(prog): RULE_TYPES = { "join": JoinRule, "product": ProductRule, "project": ProjectRule, } result = [] for rule...
gpl-3.0
Kast0rTr0y/ansible
contrib/vault/vault-keyring.py
119
3430
#!/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 Fre...
gpl-3.0
nevir/plexability
extern/depot_tools/third_party/boto/sts/credentials.py
55
7559
# Copyright (c) 2011 Mitch Garnaat http://garnaat.org/ # Copyright (c) 2011, Eucalyptus Systems, 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 # withou...
gpl-2.0
RazvanDH/PRESENTATION-CSSunderControl
node_modules/grunt-sass/node_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/xcode_ninja.py
1789
10585
# Copyright (c) 2014 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Xcode-ninja wrapper project file generator. This updates the data structures passed to the Xcode gyp generator to build with ninja instead. The Xcode project i...
mit
josepht/snapcraft
snaps_tests/demos_tests/test_gradle.py
2
1260
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright (C) 2016-2017 Canonical Ltd # # This program 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 ...
gpl-3.0
sjfloat/youtube-dl
youtube_dl/extractor/hark.py
167
1344
# -*- coding: utf-8 -*- from __future__ import unicode_literals from .common import InfoExtractor class HarkIE(InfoExtractor): _VALID_URL = r'https?://www\.hark\.com/clips/(?P<id>.+?)-.+' _TEST = { 'url': 'http://www.hark.com/clips/mmbzyhkgny-obama-beyond-the-afghan-theater-we-only-target-al-qaeda-on...
unlicense
youkochan/shadowsocks-analysis
shadowsocks/daemon.py
1
5649
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright 2014-2015 clowwindy # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requi...
apache-2.0
pekeler/arangodb
3rdParty/V8-4.3.61/third_party/python_26/Lib/test/test_sundry.py
51
3194
"""Do a minimal test of all the modules that aren't otherwise tested.""" from test import test_support import sys import unittest import warnings class TestUntestedModules(unittest.TestCase): def test_at_least_import_untested_modules(self): with warnings.catch_warnings(): import CGIHTTPServer...
apache-2.0
radlab/sparrow
deploy/third_party/boto-2.1.1/boto/ec2/elb/instancestate.py
26
2077
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # 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, modi...
apache-2.0
DeskGen/dgcli
dgcli/inventory.py
1
2921
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Functions for working with the Inventory service """ from __future__ import division from __future__ import absolute_import from __future__ import unicode_literals import logging import os import re from marshmallow import Schema, fields import requests import dgpars...
gpl-2.0
mkl-/scioncc
src/scripts/generate_interfaces.py
3
3941
#!/usr/bin/env python """Utility for generating Python interfaces from object and services definitions""" __author__ = 'Adam R. Smith, Thomas Lennan, Stephen Henrie, Dave Foster <dfoster@asascience.com>' import fnmatch import os import sys import argparse from pyon.core.interfaces.object_model_generator import Obje...
bsd-2-clause
kumar303/addons-server
settings_test.py
2
2586
# -*- coding: utf-8 -*- from settings import * # noqa # Make sure the apps needed to test translations and core are present. INSTALLED_APPS += ( 'olympia.translations.tests.testapp', 'olympia.core.tests.db_tests_testapp', ) # Make sure the debug toolbar isn't used during the tests. INSTALLED_APPS = [app for a...
bsd-3-clause
geodynamics/gale
gLucifer/config/SConfig/packages/PETSc.py
6
4449
import os, re import SConfig class PETSc(SConfig.Package): def __init__(self, scons_env, scons_opts, required=False): SConfig.Package.__init__(self, scons_env, scons_opts, required) self.dependency(SConfig.packages.MPI) self.base_patterns = ['petsc*', 'PETSC*', 'PETSc*'] self.header...
gpl-2.0
bala4901/odoo
addons/l10n_in_hr_payroll/report/report_payslip_details.py
374
1791
#-*- coding:utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2011 OpenERP SA (<http://openerp.com>). All Rights Reserved # # This program is free software: you can redistribute it and/or modify # it under th...
agpl-3.0
Intel-tensorflow/tensorflow
tensorflow/python/data/experimental/kernel_tests/optimization/filter_fusion_test.py
18
4395
# Copyright 2018 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
Vector2000/bitcoin
qa/rpc-tests/rpcbind_test.py
120
5610
#!/usr/bin/env python2 # Copyright (c) 2014 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # Test for -rpcbind, as well as -rpcallowip and -rpcconnect # Add python-bitcoinrpc to module search path: im...
mit
evilhero/mylar
lib/pytz/exceptions.py
657
1333
''' Custom exceptions raised by pytz. ''' __all__ = [ 'UnknownTimeZoneError', 'InvalidTimeError', 'AmbiguousTimeError', 'NonExistentTimeError', ] class UnknownTimeZoneError(KeyError): '''Exception raised when pytz is passed an unknown timezone. >>> isinstance(UnknownTimeZoneError(), LookupError)...
gpl-3.0
cgstudiomap/cgstudiomap
main/eggs/simplejson-3.8.1-py2.7-linux-x86_64.egg/simplejson/decoder.py
132
14721
"""Implementation of JSONDecoder """ from __future__ import absolute_import import re import sys import struct from .compat import fromhex, b, u, text_type, binary_type, PY3, unichr from .scanner import make_scanner, JSONDecodeError def _import_c_scanstring(): try: from ._speedups import scanstring ...
agpl-3.0
pelikanchik/edx-platform
common/lib/capa/capa/safe_exec/lazymod.py
68
1207
"""A module proxy for delayed importing of modules. From http://barnesc.blogspot.com/2006/06/automatic-python-imports-with-autoimp.html, in the public domain. """ import sys class LazyModule(object): """A lazy module proxy.""" def __init__(self, modname): self.__dict__['__name__'] = modname ...
agpl-3.0
dionhaefner/veros
veros/core/isoneutral/isoneutral.py
1
8938
from loguru import logger from .. import density, utilities from ... import veros_method from ...variables import allocate @veros_method def isoneutral_diffusion_pre(vs): """ Isopycnal diffusion for tracer following functional formulation by Griffies et al Code adopted from MOM2.1 """ epsln =...
mit
Johnzero/erp
openerp/addons/auction/report/report_auction.py
9
9071
# -*- 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
taxpon/sverchok
node_scripts/templates/nikitron/attractor.py
4
1310
from sverchok.data_structure import Vector_generate, Vector_degenerate #from mathutils import geometry as G def sv_main(verts=[], polygons=[], ver=3, hor=3): in_sockets = [ ['v', 'verts', verts], ['s', 'polygons', polygons], ['s', 'vertical', ver], ['s', 'horisontal', hor]] ve...
gpl-3.0
orangeduck/PyAutoC
Python27/Lib/lib-tk/test/test_ttk/test_extensions.py
88
9186
import sys import unittest import Tkinter import ttk from test.test_support import requires, run_unittest import support requires('gui') class LabeledScaleTest(unittest.TestCase): def setUp(self): support.root_deiconify() def tearDown(self): support.root_withdraw() def test_widget_des...
bsd-2-clause
omerzu/larvae_project
scripts/simple_coverage_calculator.py
1
3160
""" This Code replaces usage of another pipeline that was also detected SNPs between the referrnce COI to sequncing data. For backward-compatibility it outputs few NA columns """ from Bio.SeqIO import parse from optparse import OptionParser def Main(): parser = OptionParser() parser.add_option("--db_file", ...
mit
lino2014/marioai
src/amico/python/agents/forwardjumpingagent.py
21
2794
# -*- coding: utf-8 -*- __author__ = "Sergey Karakovskiy, sergey at idsia fullstop ch" __date__ = "$August 26, 2010 1:33:34 PM$" from marioagent import MarioAgent class ForwardJumpingAgent(MarioAgent): """ In fact the Python twin of the corresponding Java ForwardJumpingAgent. """ action = None ...
bsd-3-clause
jmesteve/openerp
openerp/report/preprocess.py
443
4700
# -*- 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 GNU...
agpl-3.0
ressu/SickGear
lib/hachoir_core/tools.py
90
17259
# -*- coding: utf-8 -*- """ Various utilities. """ from lib.hachoir_core.i18n import _, ngettext import re import stat from datetime import datetime, timedelta, MAXYEAR from warnings import warn def deprecated(comment=None): """ This is a decorator which can be used to mark functions as deprecated. It wi...
gpl-3.0
mims2707/bite-project
deps/gdata-python-client/src/gdata/tlslite/utils/rijndael.py
359
11341
""" A pure python (slow) implementation of rijndael with a decent interface To include - from rijndael import rijndael To do a key setup - r = rijndael(key, block_size = 16) key must be a string of length 16, 24, or 32 blocksize must be 16, 24, or 32. Default is 16 To use - ciphertext = r.encrypt(plaintext) plai...
apache-2.0
CloudBoltSoftware/cloudbolt-forge
ui_extensions/sample_report_extensions/views.py
1
7964
""" Module contains all views for this extension package. """ import datetime from django.core.exceptions import PermissionDenied from django.shortcuts import render from accounts.models import Group from common.methods import last_month_day_info, get_rh_html_display from extensions.views import report_extension from...
apache-2.0
suiyuan2009/tensorflow
tensorflow/contrib/tensor_forest/hybrid/python/models/forest_to_data_then_nn_test.py
159
3275
# 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
Dark-Hacker/horizon
openstack_dashboard/test/integration_tests/helpers.py
43
4752
# 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 under the Li...
apache-2.0
Bysmyyr/chromium-crosswalk
native_client_sdk/src/build_tools/tests/parse_dsc_test.py
31
2508
#!/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. import copy import datetime import os import posixpath import subprocess import sys import unittest SCRIPT_DIR = os.path.dirname(o...
bsd-3-clause
HRClab/SimInterace
SimInterface/System.py
2
13623
""" The fundamental objects of the SimInterface are systems. """ try: import graphviz as gv graphviz = True except ImportError: graphviz = False import pandas as pd import numpy as np import collections as col import Variable as Var import inspect as ins def castToTuple(Vars): if Vars is None: ...
mit
mazaclub/python-trezor
tests/test_msg_cipherkeyvalue.py
3
3969
import unittest import common import binascii from trezorlib.client import CallException class TestMsgCipherkeyvalue(common.TrezorTest): def test_encrypt(self): self.setup_mnemonic_nopin_nopassphrase() # different ask values res = self.client.encrypt_keyvalue([0, 1, 2], "test", "testing ...
lgpl-3.0
nekulin/arangodb
3rdParty/V8-4.3.61/third_party/python_26/Lib/site-packages/win32com/server/localserver.py
46
1153
# LocalServer .EXE support for Python. # # This is designed to be used as a _script_ file by pythonw.exe # # In some cases, you could also use Python.exe, which will create # a console window useful for debugging. # # NOTE: When NOT running in any sort of debugging mode, # 'print' statements may fail, as sys.stdout is ...
apache-2.0
LevinJ/ud730-Deep-Learning
A1_notmnistdataset/logisticsregresstionsmaple.py
1
1313
print(__doc__) import numpy as np import matplotlib.pyplot as plt from sklearn import linear_model, decomposition, datasets from sklearn.pipeline import Pipeline from sklearn.grid_search import GridSearchCV logistic = linear_model.LogisticRegression() pca = decomposition.PCA() pipe = Pipeline(steps=[('pca', pca), (...
gpl-2.0