repo_name stringlengths 6 100 | path stringlengths 4 294 | copies stringlengths 1 5 | size stringlengths 4 6 | content stringlengths 606 896k | license stringclasses 15
values |
|---|---|---|---|---|---|
xhqu1981/custodian | custodian/qchem/handlers.py | 1 | 25246 | # coding: utf-8
from __future__ import unicode_literals, division
import shutil
import time
"""
This module implements error handlers for QChem runs. Currently tested only
for B3LYP DFT jobs.
"""
import copy
import glob
import json
import logging
import os
import re
import tarfile
from pymatgen.core.structure impor... | mit |
mnick/offlineimap | offlineimap/ui/debuglock.py | 17 | 1752 | # Locking debugging code -- temporary
# Copyright (C) 2003 John Goerzen
# <jgoerzen@complete.org>
#
# 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
#... | gpl-2.0 |
petertodd/checklocktimeverify-demos | lib/python-bitcoinlib/bitcoin/core/scripteval.py | 3 | 23930 | # Copyright (C) 2012-2014 The python-bitcoinlib developers
#
# This file is part of python-bitcoinlib.
#
# It is subject to the license terms in the LICENSE file found in the top-level
# directory of this distribution.
#
# No part of python-bitcoinlib, including this file, may be copied, modified,
# propagated, or dist... | gpl-3.0 |
TurBoss/HostilPlanet | lib/spiner.py | 2 | 1194 | import pygame
from cnst import *
import sprite
import player
def init(g, r, n, vx, *params):
s = sprite.Sprite3(g, r, 'spiner/left-0', (0, 0, 16, 16))
# s.rect.bottom = r.bottom
s.rect.centery = r.centery
s.rect.centerx = r.centerx
s.groups.add('solid')
s.groups.add('enemy')
s... | gpl-2.0 |
sergeneren/anima | anima/env/mayaEnv/plugins/closestPointOnCurve.py | 1 | 8872 | # -*- coding: utf-8 -*-
# Copyright (c) 2012-2015, Anima Istanbul
#
# This module is part of anima-tools and is released under the BSD 2
# License: http://www.opensource.org/licenses/BSD-2-Clause
import sys
import maya.OpenMaya as OpenMaya
import maya.OpenMayaMPx as OpenMayaMPx
kPluginNodeTypeName = "spClosestPointO... | bsd-2-clause |
gyang/nova | nova/api/openstack/compute/contrib/multinic.py | 5 | 3426 | # Copyright 2011 OpenStack LLC.
# 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 b... | apache-2.0 |
odoousers2014/odoo_addons-2 | clv_file/history/__init__.py | 2 | 1428 | # -*- encoding: utf-8 -*-
################################################################################
# #
# Copyright (C) 2013-Today Carlos Eduardo Vercelino - CLVsol #
# ... | agpl-3.0 |
andmos/ansible | lib/ansible/modules/network/f5/bigip_profile_http2.py | 14 | 21772 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright: (c) 2018, 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 |
pombredanne/numba | numba/tests/test_fancy_indexing.py | 3 | 6126 | from __future__ import print_function
import itertools
import numpy as np
import numba.unittest_support as unittest
from numba import types, jit, typeof
from .support import MemoryLeakMixin, TestCase
def getitem_usecase(a, b):
return a[b]
def setitem_usecase(a, idx, b):
a[idx] = b
class TestFancyIndexin... | bsd-2-clause |
ministryofjustice/manchester_traffic_offences_pleas | apps/result/tests.py | 1 | 14800 | # -*- coding: utf-8 -*-
import datetime as dt
import os
from mock import patch
from decimal import Decimal
from io import StringIO
from django.core import mail
from django.test import TestCase
from apps.plea.models import Court, Case, CaseOffenceFilter
from .models import Result, ResultOffenceData, ResultOffence
fr... | mit |
AlexDoul/PyQt4 | examples/designer/plugins/python/analogclockplugin.py | 20 | 5568 | #!/usr/bin/env python
"""
analogclockplugin.py
An analog clock custom widget plugin for Qt Designer.
Copyright (C) 2006 David Boddie <david@boddie.org.uk>
Copyright (C) 2005-2006 Trolltech ASA. All rights reserved.
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU Ge... | gpl-2.0 |
zecruel/dxf_le | arq_dxf.py | 2 | 9335 | class ponto:
def __init__(self, x = 0.0, y = 0.0, z = 0.0):
self.x = x
self.y = y
self.z = z
def ini_dxf(blocos=''):
buffer = ''
buffer += '999\n'
buffer += 'Criado por ZeCruel\n'
#------------ Cabecalho -------------------
buffer += '999\n'
buffer += '----------------- Cabecalho -------------... | gpl-3.0 |
iamutkarshtiwari/kivy | kivy/lib/mtdev.py | 50 | 6826 | '''
python-mtdev - Python binding to the mtdev library (MIT license)
The mtdev library transforms all variants of kernel MT events to the
slotted type B protocol. The events put into mtdev may be from any MT
device, specifically type A without contact tracking, type A with
contact tracking, or type B with contact trac... | mit |
appknox/vendor | ak_vendor/report_sample.py | 1 | 1164 | import json
from os.path import dirname, abspath
from django import template
from django.conf import settings
from django.template import Template, Context
from django.template.engine import Engine
from django.core.wsgi import get_wsgi_application
from ak_vendor.report import Report
settings.configure()
application = ... | mit |
pajlada/pajbot | pajbot/modules/chat_alerts/cheeralert.py | 1 | 12111 | import logging
import math
from pajbot.managers.handler import HandlerManager
from pajbot.modules import BaseModule
from pajbot.modules import ModuleSetting
from pajbot.modules.chat_alerts import ChatAlertModule
log = logging.getLogger(__name__)
class CheerAlertModule(BaseModule):
ID = __name__.split(".")[-1]
... | mit |
harlowja/networkx | networkx/tests/test_relabel.py | 29 | 6842 | #!/usr/bin/env python
from nose.tools import *
from networkx import *
from networkx.convert import *
from networkx.algorithms.operators import *
from networkx.generators.classic import barbell_graph,cycle_graph
from networkx.testing import *
class TestRelabel():
def test_convert_node_labels_to_integers(self):
... | bsd-3-clause |
BT-astauder/odoo | addons/report_webkit/convert.py | 322 | 2581 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com)
# All Right Reserved
#
# Author : Nicolas Bessi (Camptocamp)
#
# WARNING: This program as such is intended to be used by professional
# programmers who ... | agpl-3.0 |
artemharutyunyan/copilot | src/copilot-dashboard/copilot_dashboard/dashboard/views.py | 1 | 3545 | import httplib2
import datetime
from urllib import urlencode
from random import random
from django.http import HttpRequest, HttpResponse
from django.core.serializers.json import DjangoJSONEncoder
from django.utils import simplejson
from django.conf import settings
import bson.json_util
from bson.objectid import Object... | bsd-3-clause |
tzaffi/git-in-practice-repo | book/lib/python2.7/site-packages/django/contrib/gis/db/backends/base.py | 112 | 11144 | """
Base/mixin classes for the spatial backend database operations and the
`SpatialRefSys` model the backend.
"""
import re
from django.contrib.gis import gdal
from django.utils import six
from django.utils.encoding import python_2_unicode_compatible
class BaseSpatialOperations(object):
"""
This module holds... | mit |
vmax-feihu/hue | desktop/core/ext-py/django-extensions-1.5.0/django_extensions/templatetags/indent_text.py | 71 | 1743 | from django import template
register = template.Library()
class IndentByNode(template.Node):
def __init__(self, nodelist, indent_level, if_statement):
self.nodelist = nodelist
self.indent_level = template.Variable(indent_level)
if if_statement:
self.if_statement = template.Var... | apache-2.0 |
liefdiy/bite-project | deps/gdata-python-client/samples/oauth/2_legged_oauth.py | 128 | 2463 | #!/usr/bin/python
#
# Copyright (C) 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law ... | apache-2.0 |
petr-devaikin/dancee | helpers/extractor.py | 1 | 5790 | # Cut the experiment session in small fragments
# Input: ../bin/data/records/{session}/body.csv and skeletok.csv
# Output: fragments/{fragment_number}.json and fragments/log.csv
import os
import numpy
import json
DELAY = 15
LENGTH = 30
OVERLAP = 0.719999
FREQUENCY = 60
MARGIN = 5
FREQUENCY = 60
CUTOFF_FREQUENCY = 1... | gpl-3.0 |
baggioss/hadoop-cdh3u5 | contrib/hod/hodlib/Common/threads.py | 182 | 12248 | #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 thi... | apache-2.0 |
quantumgraph/qgprofiler | qgprofiler/qg_profile_aggregator.py | 1 | 4240 | from node import Node, NodeList
from .qg_profiler import QGProfiler
from .helper import get_real_file_path, get_file_type, xml_scanner, read_attributes_from_xml, merge_attributes
import glob
import json
class QGProfileAggregator(object):
def __init__(self, in_file_path, out_file_path):
self.root_node = Nod... | mit |
163gal/Time-Line | timelinelib/wxgui/dialogs/fieldselection/view.py | 2 | 2098 | # Copyright (C) 2009, 2010, 2011, 2012, 2013, 2014, 2015 Rickard Lindberg, Roger Lindberg
#
# This file is part of Timeline.
#
# Timeline 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 th... | gpl-3.0 |
wangjun/pyspider | tests/test_scheduler.py | 2 | 28356 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2014-02-08 22:37:13
import os
import time
import shutil
import unittest
import logging
import logging.config
logging.config.fileConfig("pyspider/logging.co... | apache-2.0 |
vertcoin/electrum-vtc | gui/qt/seed_dialog.py | 4 | 7225 | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2013 ecdsa@github
#
# 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 li... | mit |
codevlabs/grab | grab/spider/cache_backend/postgresql.py | 12 | 6155 | """
CacheItem interface:
'_id': string,
'url': string,
'response_url': string,
'body': string,
'head': string,
'response_code': int,
'cookies': None,#grab.response.cookies,
"""
from hashlib import sha1
import zlib
import logging
import marshal
import time
from weblib.encoding import make_str
from grab.response import ... | mit |
LumiGuide/nixops | nixops/util.py | 6 | 10854 | # -*- coding: utf-8 -*-
import os
import sys
import time
import json
import copy
import fcntl
import base64
import select
import socket
import struct
import shutil
import tempfile
import subprocess
import logging
import atexit
from StringIO import StringIO
devnull = open(os.devnull, 'rw')
def check_wait(test, initi... | lgpl-3.0 |
zhoupeng/spice4xen | tools/python/xen/xend/server/blkif.py | 43 | 8202 | #============================================================================
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope th... | gpl-2.0 |
henriquebastos/django-decouple | tests/test_env.py | 1 | 1790 | # coding: utf-8
import os
import sys
from mock import patch
import pytest
from decouple import Config, RepositoryEnv, UndefinedValueError
# Useful for very coarse version differentiation.
PY3 = sys.version_info[0] == 3
if PY3:
from io import StringIO
else:
from StringIO import StringIO
ENVFILE = '''
KeyTru... | mit |
apollo13/ansible | test/lib/ansible_test/_data/sanity/code-smell/no-illegal-filenames.py | 68 | 1726 | #!/usr/bin/env python
# a script to check for illegal filenames on various Operating Systems. The
# main rules are derived from restrictions on Windows
# https://msdn.microsoft.com/en-us/library/aa365247#naming_conventions
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import ... | gpl-3.0 |
MSusik/invenio | invenio/modules/search/washers.py | 4 | 3738 | ## This file is part of Invenio.
## Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2012, 2013 CERN.
##
## Invenio is free software; you can redistribute it and/or
## modify it under the terms of the GNU General Public License as
## published by the Free Software Foundation; either version 2 of the
## License, or (at... | gpl-2.0 |
sw-irou/flasktest | lib/gridfs/errors.py | 16 | 1602 | # Copyright 2009-2012 10gen, 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 agreed to in writing,... | bsd-3-clause |
googleinterns/learnbase | learnbase/src/main/webapp/WEB-INF/Lib/doctest.py | 28 | 104759 | # Module doctest.
# Released to the public domain 16-Jan-2001, by Tim Peters (tim@python.org).
# Major enhancements and refactoring by:
# Jim Fulton
# Edward Loper
# Provided as-is; use at your own risk; no warranty; no promises; enjoy!
r"""Module doctest -- a framework for running examples in docstrings.
In... | apache-2.0 |
macmanes-lab/MCBS913 | code/Junhong Chen/generateProtineSeq.py | 1 | 4902 | """
Author: Junhong Chen
"""
from Bio.Alphabet import IUPAC
from Bio.Seq import Seq
from Bio import SeqIO
from sys import argv
import os
path = argv[1]
class CDS:
def __init__(self,gff):
self.data = dict()
self.fname = gff
def parse(self):
file = open(sel... | mit |
jbedorf/tensorflow | tensorflow/python/tools/saved_model_utils_test.py | 20 | 4886 | # 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 |
todaychi/hue | desktop/core/ext-py/django-openid-auth-0.5/example_consumer/views.py | 47 | 2283 | # django-openid-auth - OpenID integration for django.contrib.auth
#
# Copyright (C) 2007 Simon Willison
# Copyright (C) 2008-2013 Canonical Ltd.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions o... | apache-2.0 |
EmanueleCannizzaro/scons | test/Scanner/Scanner.py | 1 | 7353 | #!/usr/bin/env python
#
# Copyright (c) 2001 - 2016 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
# without limitation the rights to us... | mit |
marqueedev/django | tests/template_tests/test_smartif.py | 580 | 2178 | import unittest
from django.template.smartif import IfParser
class SmartIfTests(unittest.TestCase):
def assertCalcEqual(self, expected, tokens):
self.assertEqual(expected, IfParser(tokens).parse().eval({}))
# We only test things here that are difficult to test elsewhere
# Many other tests are f... | bsd-3-clause |
openre/openre | openre/agent/domain/__init__.py | 1 | 1623 | # -*- coding: utf-8 -*-
"""
Домен. Создает один процесс для одного домена openre. Получает и передает
спайки (pub), получает команды от сервера (req-rep) и пересылает результат
выполнения команды.
"""
from openre.agent.decorators import daemonize
from openre.agent.helpers import daemon_stop
import logging
import signal... | mit |
nimbis/django-allauth | allauth/socialaccount/providers/vk/tests.py | 11 | 1215 | from __future__ import absolute_import
from allauth.socialaccount.tests import OAuth2TestsMixin
from allauth.tests import MockedResponse, TestCase
from .provider import VKProvider
class VKTests(OAuth2TestsMixin, TestCase):
provider_id = VKProvider.id
def get_mocked_response(self, verified_email=True):
... | mit |
mou4e/zirconium | net/tools/build_hpack_constants.py | 60 | 18724 | #!/usr/bin/env python
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""This script builds a table that has to be manully inserted into
net/spdy/hpack_constants.cc. It also contains data that potentially... | bsd-3-clause |
M4sse/chromium.src | third_party/typ/tools/cov.py | 35 | 4607 | #!/usr/bin/python
# Copyright 2014 Google Inc. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ap... | bsd-3-clause |
HiroIshikawa/21playground | voting/venv/lib/python3.5/site-packages/pip/_vendor/requests/packages/chardet/gb2312freq.py | 3132 | 36011 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights R... | mit |
ttm/pingosom | pingosom2.py | 1 | 50613 | #-*- coding: utf-8 -*-
import numpy as n, random, os, sys, time
from scipy.io import wavfile as w
tfoo=time.time()
H=n.hstack
V=n.vstack
f_a = 44100. # Hz, frequência de amostragem
############## 2.2.1 Tabela de busca (LUT)
Lambda_tilde=Lt=1024.*16
# Senoide
fooXY=n.linspace(0,2*n.pi,Lt,endpoint=False)
S_i=n.sin(foo... | unlicense |
mattclay/ansible | test/units/modules/test_yum.py | 35 | 9941 | # -*- coding: utf-8 -*-
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat import unittest
from ansible.modules.yum import YumModule
yum_plugin_load_error = """
Plugin "product-id" can't be imported
Plugin "search-disabled-repos" can't be imported
Plugin "subsc... | gpl-3.0 |
marcoantoniooliveira/labweb | oscar/lib/python2.7/site-packages/whoosh/lang/isri.py | 95 | 17041 | # -*- coding: utf-8 -*-
#
# Natural Language Toolkit: The ISRI Arabic Stemmer
#
# Copyright (C) 2001-2012 NLTK Proejct
# Algorithm: Kazem Taghva, Rania Elkhoury, and Jeffrey Coombs (2005)
# Author: Hosam Algasaier <hosam_hme@yahoo.com>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
ISRI A... | bsd-3-clause |
AkihikoITOH/capybara | capybara/capybara.py | 1 | 1091 | #!/bin/python
# -*- coding: utf-8 -*-
import os
from amazon_wrapper import AmazonWrapper
from rakuten_wrapper import RakutenWrapper
class Capybara:
def __init__(self, config_dir=None, tokens_dir=None):
self.wrappers = {}
self.wrappers['amazon'] = AmazonWrapper()
self.wrappers['rakuten'] = ... | mit |
Microsoft/PTVS | Python/Product/Miniconda/Miniconda3-x64/Lib/site-packages/pip/_vendor/lockfile/mkdirlockfile.py | 536 | 3096 | from __future__ import absolute_import, division
import time
import os
import sys
import errno
from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout,
AlreadyLocked)
class MkdirLockFile(LockBase):
"""Lock file by creating a directory."""
def __init__(self, path, threaded=True,... | apache-2.0 |
jimcunderwood/MissionPlanner | Lib/xdrlib.py | 55 | 5794 | """Implements (a subset of) Sun XDR -- eXternal Data Representation.
See: RFC 1014
"""
import struct
try:
from cStringIO import StringIO as _StringIO
except ImportError:
from StringIO import StringIO as _StringIO
__all__ = ["Error", "Packer", "Unpacker", "ConversionError"]
# exceptions
class... | gpl-3.0 |
vegetableman/phantomjs | src/qt/qtwebkit/Tools/Scripts/webkitpy/tool/steps/abstractstep.py | 129 | 3437 | # Copyright (C) 2010 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 th... | bsd-3-clause |
dmwyatt/django-rest-framework | tests/test_relations_generic.py | 12 | 3228 | from __future__ import unicode_literals
from django.contrib.contenttypes.fields import (
GenericForeignKey, GenericRelation
)
from django.contrib.contenttypes.models import ContentType
from django.db import models
from django.test import TestCase
from django.utils.encoding import python_2_unicode_compatible
from ... | bsd-2-clause |
Wapaul1/ray | python/ray/rllib/dqn/dqn.py | 1 | 14408 | from __future__ import absolute_import
from __future__ import division
from __future__ import print_function
import time
import numpy as np
import pickle
import os
import tensorflow as tf
import ray
from ray.rllib.common import Agent, TrainingResult
from ray.rllib.dqn import logger, models
from ray.rllib.dqn.common.... | apache-2.0 |
starrify/scrapy | tests/test_utils_sitemap.py | 6 | 8170 | import unittest
from scrapy.utils.sitemap import Sitemap, sitemap_urls_from_robots
class SitemapTest(unittest.TestCase):
def test_sitemap(self):
s = Sitemap(b"""<?xml version="1.0" encoding="UTF-8"?>
<urlset xmlns="http://www.google.com/schemas/sitemap/0.84">
<url>
<loc>http://www.example.com/</lo... | bsd-3-clause |
Fusion-Rom/android_external_chromium_org | tools/telemetry/telemetry/core/platform/profiler/java_heap_profiler.py | 35 | 3199 | # Copyright 2013 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 os
import subprocess
import threading
from telemetry.core import util
from telemetry.core.backends.chrome import android_browser_finder
from telemetr... | bsd-3-clause |
switchkiller/ProjDjanko | lib/python2.7/site-packages/django/db/backends/oracle/introspection.py | 517 | 11463 | import cx_Oracle
from django.db.backends.base.introspection import (
BaseDatabaseIntrospection, FieldInfo, TableInfo,
)
from django.utils.encoding import force_text
class DatabaseIntrospection(BaseDatabaseIntrospection):
# Maps type objects to Django Field types.
data_types_reverse = {
cx_Oracle.... | gpl-2.0 |
strint/tensorflow | tensorflow/python/util/nest.py | 24 | 17585 | # 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 |
eoinof/stem | test/unit/exit_policy/rule.py | 1 | 10901 | """
Unit tests for the stem.exit_policy.ExitPolicyRule class.
"""
import unittest
from stem.exit_policy import AddressType, ExitPolicyRule
class TestExitPolicyRule(unittest.TestCase):
def test_accept_or_reject(self):
self.assertTrue(ExitPolicyRule("accept *:*").is_accept)
self.assertFalse(ExitPolicyRule("r... | lgpl-3.0 |
Pirata-Repository/Pirata | plugin.video.SportsDevil/lib/utils/github/InputGitAuthor.py | 8 | 1116 | # -*- coding: utf-8 -*-
# Copyright 2012 Vincent Jacques
# vincent@vincent-jacques.net
# This file is part of PyGithub. http://vincent-jacques.net/PyGithub
# PyGithub 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 Softwar... | gpl-2.0 |
yongshengwang/hue | build/env/lib/python2.7/site-packages/tablib-0.10.0-py2.7.egg/tablib/packages/xlwt3/Formatting.py | 46 | 8616 | #!/usr/bin/env python
'''
The XF record is able to store explicit cell formatting attributes or the
attributes of a cell style. Explicit formatting includes the reference to
a cell style XF record. This allows to extend a defined cell style with
some explicit attributes. The formatting attributes are... | apache-2.0 |
yuruidong/rb | tests/test_promise.py | 7 | 2171 | from rb.promise import Promise
def test_resolved_promise():
p = Promise.resolved(42)
assert p.is_resolved
assert not p.is_pending
assert not p.is_rejected
assert p.value == 42
def test_rejected_promise():
err = RuntimeError('So fail')
p = Promise.rejected(err)
assert not p.is_resolve... | apache-2.0 |
zahodi/ansible | lib/ansible/modules/network/nxos/nxos_ospf_vrf.py | 8 | 20454 | #!/usr/bin/python
#
# 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 distribut... | gpl-3.0 |
tuxology/bcc | tests/python/test_percpu.py | 2 | 4141 | #!/usr/bin/env python
# Copyright (c) PLUMgrid, Inc.
# Licensed under the Apache License, Version 2.0 (the "License")
import os
import unittest
from bcc import BPF
import multiprocessing
class TestPercpu(unittest.TestCase):
def setUp(self):
try:
b = BPF(text='BPF_TABLE("percpu_array", u32, u3... | apache-2.0 |
Moriadry/tensorflow | tensorflow/python/debug/cli/readline_ui_test.py | 81 | 5646 | # 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 |
mskwark/PconsC3 | extra/arne/MSA/find-intradom.py | 1 | 1381 | #!/usr/bin/env perl
# Find all contacts beween domains..
import sys, os, re, string
import argparse
from os.path import expanduser
home = expanduser("~")
sys.path.append(home + '/bioinfo-toolbox/parsing')
sys.path.append(home + '/git/bioinfo-toolbox/parsing')
import parse_contacts
import numpy as np
import matplotl... | gpl-2.0 |
mpattyn/fumiste | prototypePython/steamapi/requests/packages/urllib3/packages/six.py | 2375 | 11628 | """Utilities for writing code that runs on Python 2 and 3"""
#Copyright (c) 2010-2011 Benjamin Peterson
#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 l... | mit |
zubie7a/CPP | LeetCode/leet_364.py | 2 | 2079 | # https://leetcode.com/problems/nested-list-weight-sum-ii/
# """
# This is the interface that allows for creating nested lists.
# You should not implement it, or speculate about its implementation
# """
#class NestedInteger(object):
#
# def isInteger(self):
# """
# @return True if this NestedInteger ho... | mit |
soroushmehr/sampleRNN_ICLR2017 | models/three_tier/three_tier.py | 1 | 35718 | """
RNN Audio Generation Model
Three-tier model, Quantized input
For more info:
$ python three_tier.py -h
How-to-run example:
sampleRNN$ pwd
/u/mehris/sampleRNN
sampleRNN$ \
THEANO_FLAGS=mode=FAST_RUN,device=gpu,floatX=float32 python -u \
models/three_tier/three_tier.py --exp AXIS1 --seq_len 512 --big_frame_size 8 ... | mit |
evanthebouncy/nnhmm | battleship_lstm_policy/data.py | 2 | 5764 | import numpy as np
from draw import *
# total number of observations
OBS_SIZE = 20
# length of the field i.e. LxL field
N_BATCH = 50
RAND_HIT = 0.4
# L = 5
# S1DIM = (1,4)
# S2DIM = (2,2)
L = 10
S1DIM = (2,5)
S2DIM = (1,8)
# ------------------------------------------------------------------ helpers
# turn a coord... | mit |
mmnelemane/nova | nova/virt/vmwareapi/read_write_util.py | 73 | 2238 | # Copyright (c) 2011 Citrix Systems, Inc.
# Copyright 2011 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0... | apache-2.0 |
robbwagoner/ansible-modules-core | files/file.py | 8 | 16236 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2012, 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... | gpl-3.0 |
johndpope/tensorflow | tensorflow/contrib/keras/python/keras/layers/recurrent.py | 19 | 48812 | # 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 |
daniel-muthukrishna/GiantStarFormingRegions | Input_Galaxy_Region_Information/profile_info_NGC6845_Region7NewDisp.py | 1 | 10190 | from collections import OrderedDict
import numpy as np
inf = np.inf
class RegionParameters(object):
regionName = "NGC6845-7NewDisp"
blueSpecFile = 'NGC6845_7BNewDisp.fc.fits' #'NGC6845_7B_SPEC1.wc.fits'
redSpecFile = 'NGC6845_7RNewDisp.fc.fits' #'NGC6845_7R_SPEC1.wc.fits'
blu... | mit |
RosesTheN00b/BudgetButlerWeb | butler_offline/views/einzelbuchungen/uebersicht_monat.py | 1 | 8451 | from butler_offline.viewcore.state import persisted_state
from butler_offline.core import time
from butler_offline.viewcore import request_handler
from butler_offline.viewcore import viewcore
from butler_offline.core.report import ReportGenerator
from butler_offline.viewcore.converter import datum_to_string
def _hand... | agpl-3.0 |
Allianzcortex/scrapy | scrapy/commands/bench.py | 151 | 1640 | import sys
import time
import subprocess
from six.moves.urllib.parse import urlencode
import scrapy
from scrapy.commands import ScrapyCommand
from scrapy.linkextractors import LinkExtractor
class Command(ScrapyCommand):
default_settings = {
'LOG_LEVEL': 'INFO',
'LOGSTATS_INTERVAL': 1,
'... | bsd-3-clause |
sodafree/backend | django/db/models/query_utils.py | 92 | 5703 | """
Various data structures used in query construction.
Factored out from django.db.models.query to avoid making the main module very
large and/or so that they can be used by other modules without getting into
circular import difficulties.
"""
import weakref
from django.db.backends import util
from django.utils impo... | bsd-3-clause |
adamtiger/tensorflow | tensorflow/compiler/tests/dynamic_stitch_test.py | 123 | 3401 | # Copyright 2017 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 |
alexlo03/ansible | test/units/modules/network/onyx/test_onyx_lldp_interface.py | 68 | 3143 | #
# Copyright: Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# Make coding more python3-ish
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from units.compat.mock import patch
from ansible.modules.network.onyx impor... | gpl-3.0 |
sometallgit/AutoUploader | Python27/Lib/codeop.py | 306 | 5999 | r"""Utilities to compile possibly incomplete Python source code.
This module provides two interfaces, broadly similar to the builtin
function compile(), which take program text, a filename and a 'mode'
and:
- Return code object if the command is complete and valid
- Return None if the command is incomplete
- Raise Sy... | mit |
mfraezz/osf.io | api_tests/preprints/views/test_preprint_list_mixin.py | 4 | 12606 | import mock
import pytest
from django.utils import timezone
from api_tests import utils as test_utils
from osf_tests.factories import (
PreprintFactory,
AuthUserFactory,
SubjectFactory,
)
from osf.utils.permissions import WRITE
from osf.utils.workflows import DefaultStates
@pytest.mark.django_db
class Pr... | apache-2.0 |
kenshay/ImageScripter | ProgramData/SystemFiles/Python/Lib/site-packages/rope/contrib/changestack.py | 115 | 1392 | """For performing many refactorings as a single command
`changestack` module can be used to perform many refactorings on top
of each other as one bigger command. It can be used like::
stack = ChangeStack(project, 'my big command')
#..
stack.push(refactoring1.get_changes())
#..
stack.push(refactoring2.get_... | gpl-3.0 |
spendb/babbage | babbage/validation.py | 2 | 1801 | import os
import json
from jsonschema import Draft4Validator, FormatChecker
from babbage.util import SCHEMA_PATH
checker = FormatChecker()
@checker.checks('attribute_exists')
def check_attribute_exists(instance):
""" Additional check for the dimension model, to ensure that attributes
given as the key and la... | mit |
azureplus/hue | desktop/core/ext-py/django-openid-auth-0.5/example_consumer/settings.py | 42 | 5475 | # django-openid-auth - OpenID integration for django.contrib.auth
#
# Copyright (C) 2007 Simon Willison
# Copyright (C) 2008-2013 Canonical Ltd.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# * Redistributions o... | apache-2.0 |
Elchi3/kuma | kuma/core/tests/test_checks.py | 2 | 2071 | import json
import os
from unittest import mock
from django.core.checks import Error, Warning
from kuma.core import checks
def test_react_i18n_check(tmpdir, settings):
settings.ACCEPTED_LOCALES = ["sv-SE", "en-US"]
settings.BASE_DIR = base_dir = str(tmpdir)
os.makedirs(os.path.join(base_dir, "static", "... | mpl-2.0 |
cliqz/socorro | webapp-django/crashstats/crashstats/decorators.py | 9 | 2132 | import functools
from django.http import HttpResponseBadRequest, Http404
from django.shortcuts import redirect
from django.core.urlresolvers import reverse
from . import utils
_marker = object()
# XXX: we could break out 'days' here as a configurable parameter instead
def check_days_parameter(possible_days, defaul... | mpl-2.0 |
antonioUnina/neutron | neutron/extensions/routerservicetype.py | 34 | 1565 | # Copyright 2013 VMware, 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 a... | apache-2.0 |
MFoster/breeze | tests/regressiontests/signed_cookies_tests/tests.py | 123 | 2465 | from __future__ import unicode_literals
import time
from django.core import signing
from django.http import HttpRequest, HttpResponse
from django.test import TestCase
class SignedCookieTest(TestCase):
def test_can_set_and_read_signed_cookies(self):
response = HttpResponse()
response.set_signed_... | bsd-3-clause |
Aplopio/document-converter | converters/tests/test_html_txt.py | 1 | 1301 | import sys
sys.path.append('..')
sys.path.append('../..')
import unittest
from html_txt import HtmlTxt
from file_manager import FileManager
class HtmlTxtTests(unittest.TestCase):
def test2_htmltxt1(self):
file1 = FileManager('test_files/test1.html')
file2 = FileManager('test_files/test2.html')
... | mit |
gennad/Django-nonrel-stub-for-Google-App-Engine | django/db/models/fields/related.py | 82 | 54635 | from django.conf import settings
from django.db import connection, router, transaction, connections
from django.db.backends import util
from django.db.models import signals, get_model
from django.db.models.fields import (AutoField, Field, IntegerField,
PositiveIntegerField, PositiveSmallIntegerField, FieldDoesNotEx... | bsd-3-clause |
stanleygu/sbml2matlab | bindings/python/doc-converter/rewrite_pydoc.py | 4 | 25641 | #!/usr/bin/env python
##
## @file rewrite_pydoc.py
## @brief Convert libSBML Python doc file to something readable as docstrings
## @author Mike Hucka
##
## Purpose:
##
## The comments in the libSBML source code use Doxygen mark-up; this
## content is read by Doxygen and Javadoc, in combination with other
## scr... | bsd-3-clause |
schmodd/forecast.py | forecast.py | 1 | 4251 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# todo: add alerts, colors
import requests
import json
import datetime
import argparse
import sys
from prettytable import PrettyTable
# surf to https://developer.forecast.io/ for an api key
# use http://dbsgeo.com/latlon/ to get coordinates for your location
API_KEY=''
L... | mit |
hifly/OpenUpgrade | addons/stock/tests/test_stock_flow.py | 219 | 74767 | # -*- coding: utf-8 -*-
from openerp.addons.stock.tests.common import TestStockCommon
from openerp.tools import mute_logger, float_round
class TestStockFlow(TestStockCommon):
@mute_logger('openerp.addons.base.ir.ir_model', 'openerp.models')
def test_00_picking_create_and_transfer_quantity(self):
"""... | agpl-3.0 |
diggzhang/shadowsocks | shadowsocks/shell.py | 270 | 12676 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright 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 required b... | apache-2.0 |
Lightmatter/django-inlineformfield | .tox/py27/lib/python2.7/site-packages/IPython/lib/backgroundjobs.py | 21 | 17794 | # -*- coding: utf-8 -*-
"""Manage background (threaded) jobs conveniently from an interactive shell.
This module provides a BackgroundJobManager class. This is the main class
meant for public usage, it implements an object which can create and manage
new background jobs.
It also provides the actual job classes manag... | mit |
myerssr/volatility | volatility/plugins/addrspaces/macho.py | 44 | 6621 | # Volatility
#
# Authors:
# Mike Auty
#
# This file is part of Volatility.
#
# Volatility 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 versio... | gpl-2.0 |
repotvsupertuga/tvsupertuga.repository | script.module.python.koding.aio/lib/koding/tutorials.py | 1 | 7420 | # -*- coding: utf-8 -*-
# script.module.python.koding.aio
# Python Koding AIO (c) by TOTALREVOLUTION LTD (support@trmc.freshdesk.com)
# Python Koding AIO is licensed under a
# Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 International License.
# You should have received a copy of the license along w... | gpl-2.0 |
shivanikhosa/browserscope | base/admin_rankers.py | 9 | 4415 | #!/usr/bin/python2.5
#
# Copyright 2009 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the 'License')
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or ... | apache-2.0 |
duythanhphan/googletest | test/gtest_help_test.py | 2968 | 5856 | #!/usr/bin/env python
#
# Copyright 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... | bsd-3-clause |
awkspace/ansible | contrib/inventory/scaleway.py | 42 | 7175 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
'''
External inventory script for Scaleway
====================================
Shamelessly copied from an existing inventory script.
This script generates an inventory that Ansible can understand by making API requests to Scaleway API
Requires some python libraries, en... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.