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 |
|---|---|---|---|---|---|
GalaxyTab4/maxicm_kernel_samsung_degaswifi | Documentation/target/tcm_mod_builder.py | 2358 | 40707 | #!/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 |
pquentin/django | django/contrib/messages/api.py | 512 | 3202 | from django.contrib.messages import constants
from django.contrib.messages.storage import default_storage
from django.http import HttpRequest
__all__ = (
'add_message', 'get_messages',
'get_level', 'set_level',
'debug', 'info', 'success', 'warning', 'error',
'MessageFailure',
)
class MessageFailure(E... | bsd-3-clause |
kingoflolz/hearthbreaker | tests/card_tests/warlock_tests.py | 6 | 34386 | import random
import unittest
from hearthbreaker.agents.basic_agents import PredictableAgent, DoNothingAgent
from tests.agents.testing_agents import OneCardPlayingAgent, EnemySpellTestingAgent, \
CardTestingAgent, EnemyMinionSpellTestingAgent, PlayAndAttackAgent, HeroPowerAndCardPlayingAgent
from hearthbreaker.con... | mit |
ashwin31/MicroSite | microsite_front/views.py | 1 | 5737 | from django.shortcuts import render
from django.http.response import HttpResponse
from django.core.paginator import Paginator, EmptyPage, PageNotAnInteger
from micro_admin.models import career
import requests
from django.conf import settings
from mimetypes import MimeTypes
from boto.s3.connection import S3Connection
im... | gpl-2.0 |
40223101/w16b_test | static/Brython3.1.1-20150328-091302/Lib/site-packages/pygame/draw.py | 603 | 6456 | from javascript import console
from browser import timer
import math
class Queue:
def __init__(self):
self._list=[]
def empty(self):
return len(self._list) == 0
def put(self, element):
self._list.append(element)
def get(self):
if len(self._list) == 0:
raise BaseError
... | agpl-3.0 |
mccheung/kbengine | kbe/res/scripts/common/Lib/curses/has_key.py | 195 | 5634 |
#
# Emulation of has_key() function for platforms that don't use ncurses
#
import _curses
# Table mapping curses keys to the terminfo capability name
_capability_names = {
_curses.KEY_A1: 'ka1',
_curses.KEY_A3: 'ka3',
_curses.KEY_B2: 'kb2',
_curses.KEY_BACKSPACE: 'kbs',
_curses.KEY_BEG: 'kbeg',
... | lgpl-3.0 |
WhireCrow/openwrt-mt7620 | staging_dir/target-mipsel_r2_uClibc-0.9.33.2/usr/lib/python2.7/test/test_exception_variations.py | 213 | 4041 |
from test.test_support import run_unittest
import unittest
class ExceptionTestCase(unittest.TestCase):
def test_try_except_else_finally(self):
hit_except = False
hit_else = False
hit_finally = False
try:
raise Exception, 'nyaa!'
except:
hit_except =... | gpl-2.0 |
asadziach/tensorflow | tensorflow/contrib/distributions/python/kernel_tests/bijectors/softplus_test.py | 22 | 4099 | # 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 |
JST9723/stj-fusion-byte1 | lib/werkzeug/contrib/testtools.py | 319 | 2449 | # -*- coding: utf-8 -*-
"""
werkzeug.contrib.testtools
~~~~~~~~~~~~~~~~~~~~~~~~~~
This module implements extended wrappers for simplified testing.
`TestResponse`
A response wrapper which adds various cached attributes for
simplified assertions on various content types.
:copyright:... | apache-2.0 |
krahman/rethinkdb | scripts/generate_join_macros.py | 1 | 3825 | #!/usr/bin/env python
# Copyright 2010-2013 RethinkDB, all rights reserved.
import sys
"""This script is used to generate the RDB_MAKE_SEMILATTICE_JOINABLE_*() macro
definitions.
This script is meant to be run as follows (assuming you are in the
"rethinkdb/src" directory):
$ ../scripts/generate_join_macros.py > rpc/... | agpl-3.0 |
BruceDai/web-testing-service | tools/wptserve/tests/functional/test_pipes.py | 299 | 3178 | import os
import unittest
import urllib2
import json
import time
import wptserve
from base import TestUsingServer, doc_root
class TestStatus(TestUsingServer):
def test_status(self):
resp = self.request("/document.txt", query="pipe=status(202)")
self.assertEquals(resp.getcode(), 202)
class TestHea... | bsd-3-clause |
pabulumm/neighbors | lib/python3.4/site-packages/django/contrib/sessions/backends/file.py | 336 | 7715 | import datetime
import errno
import logging
import os
import shutil
import tempfile
from django.conf import settings
from django.contrib.sessions.backends.base import (
VALID_KEY_CHARS, CreateError, SessionBase,
)
from django.contrib.sessions.exceptions import InvalidSessionKey
from django.core.exceptions import I... | bsd-3-clause |
openearth/PyWPS | pywps/processes/returner.py | 2 | 1394 | from pywps.Process import WPSProcess
class Process(WPSProcess):
def __init__(self):
##
# Process initialization
WPSProcess.__init__(self,
identifier = "returner",
title="Return process",
abstract="""This is demonstration ... | gpl-2.0 |
kenshay/ImageScripter | ProgramData/Android/ADB/platform-tools/systrace/catapult/telemetry/third_party/pyserial/serial/win32.py | 155 | 10120 | from ctypes import *
from ctypes.wintypes import HANDLE
from ctypes.wintypes import BOOL
from ctypes.wintypes import LPCWSTR
_stdcall_libraries = {}
_stdcall_libraries['kernel32'] = WinDLL('kernel32')
from ctypes.wintypes import DWORD
from ctypes.wintypes import WORD
from ctypes.wintypes import BYTE
INVALID_HANDLE_VAL... | gpl-3.0 |
sungjuly/pinball | tests/pinball/workflow/log_saver_test.py | 4 | 1979 | # Copyright 2015, Pinterest, 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 writ... | apache-2.0 |
hfutsuchao/Python2.6 | mysite/mysite/views - backup.py | 1 | 2131 | from django.shortcuts import render_to_response
from django.template import Context
from django.http import HttpResponse,Http404
import datetime,time
import qd
#from uvMonitor.UVPVPub import *
from urllib import unquote
def stat(request,source='',detail='',dur=''):
if source:
qd.sources = [source... | gpl-2.0 |
ant9000/yowsup | yowsup/layers/protocol_media/protocolentities/message_media.py | 62 | 7400 | from yowsup.structs import ProtocolEntity, ProtocolTreeNode
from yowsup.layers.protocol_messages.protocolentities import MessageProtocolEntity
class MediaMessageProtocolEntity(MessageProtocolEntity):
'''
<message t="{{TIME_STAMP}}" from="{{CONTACT_JID}}"
offline="{{OFFLINE}}" type="text" id="{{MESSAGE_... | gpl-3.0 |
googleapis/python-aiplatform | google/cloud/aiplatform/v1/schema/predict/instance_v1/__init__.py | 2 | 1697 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | apache-2.0 |
vurmux/heuron | src/flag.py | 2 | 1176 | #!/usr/bin/python
import json
class Flag:
"""
Implementation of simple 2-state flags.
Class attributes:
name - flag name
state - flag state: True or False
function - joint function of current flag (read Joint class description)
"""
def __init__(self, name, function):
self.na... | apache-2.0 |
angelblue05/plugin.video.emby | libraries/requests/packages/chardet/charsetprober.py | 3127 | 1902 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All R... | gpl-3.0 |
direvus/ansible | test/units/modules/network/f5/test_bigip_sys_global.py | 27 | 4447 | # -*- 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
import os
import json
import sys
from nose.plugins.skip import SkipTest
i... | gpl-3.0 |
gfreed/android_external_chromium-org | tools/vim/chromium.ycm_extra_conf.py | 47 | 6223 | # 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.
# Autocompletion config for YouCompleteMe in Chromium.
#
# USAGE:
#
# 1. Install YCM [https://github.com/Valloric/YouCompleteMe]
# (Googlers s... | bsd-3-clause |
eayunstack/nova | nova/tests/fake_utils.py | 96 | 1332 | # Copyright (c) 2013 Rackspace Hosting
#
# 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 |
huiyiqun/check_mk | tests/integration/omd/test_omd.py | 1 | 3437 | import pytest
import subprocess
def test_run_omd(site):
p = site.execute(["omd"], stdout=subprocess.PIPE, stderr=subprocess.PIPE)
stdout, stderr = p.communicate()
assert p.wait() == 1
assert stderr == ""
assert "Usage" in stdout
assert "omd COMMAND -h" in stdout
def test_run_omd_help(site):
... | gpl-2.0 |
hbgit/Map2Check | utils/map2check-wrapper.py | 1 | 3980 | #!/usr/bin/env python3
import os
import argparse
import shlex
import subprocess
tool_path = "./map2check "
# default args
extra_tool = "timeout 897s "
command_line = extra_tool + tool_path
timemapsplit = "895"
# Options
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--version", help="Prints Map2check'... | gpl-2.0 |
aabbox/kbengine | kbe/res/scripts/common/Lib/encodings/iso8859_1.py | 266 | 13176 | """ Python Character Mapping Codec iso8859_1 generated from 'MAPPINGS/ISO8859/8859-1.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,errors='... | lgpl-3.0 |
Algomorph/AMBR | ext_argparse/argument.py | 1 | 2929 | # ================================================================
# Created by Gregory Kramida on 8/9/16.
# Copyright (c) 2016 Gregory Kramida
# 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 Licens... | apache-2.0 |
josjevv/django-cms | cms/south_migrations/0070_auto__add_field_cmsplugin_path__add_field_cmsplugin_depth__add_field_c.py | 51 | 20479 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding field 'CMSPlugin.path'
db.add_column(u'cms_cmsplugin', 'path',
... | bsd-3-clause |
emd/random_data | tests/spectra_tests/higher_order_tests.py | 1 | 3794 | from nose import tools
import numpy as np
import random_data as rd
def test_Bispectrum_signal_input():
# Different length signals should fail
x = np.random.randn(np.int(50e3))
y = np.random.randn(np.int(50e3) + 1)
tools.assert_raises(ValueError, rd.spectra.Bispectrum, x, y)
# Complex signals shou... | gpl-2.0 |
teemulehtinen/a-plus | notification/migrations/0002_auto_20160912_1341.py | 2 | 1196 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
class Migration(migrations.Migration):
dependencies = [
('exercise', '0022_auto_20160906_1401'),
('notification', '0001_initial'),
]
operations = [
migrations.AddField(
... | gpl-3.0 |
Poppin-Tech/mitro | browser-ext/login/buildtools/compile_html_deps.py | 27 | 4755 | #!/usr/bin/python
from collections import defaultdict
import argparse
import json
import re
import struct
import sys
import time
import re
import subprocess
import tempfile
import os
parser = argparse.ArgumentParser(description='compiles js which is dependant on an html file')
parser.add_argument('files', nargs='+', ... | gpl-3.0 |
bliti/django-nonrel-1.5 | django/contrib/sitemaps/tests/urls/http.py | 97 | 1691 | from datetime import datetime
from django.conf.urls import patterns, url
from django.contrib.sitemaps import Sitemap, GenericSitemap, FlatPageSitemap, views
from django.contrib.auth.models import User
from django.views.decorators.cache import cache_page
from django.contrib.sitemaps.tests.base import TestModel
class ... | bsd-3-clause |
JustinTulloss/harmonize.fm | fileprocess/fileprocess/processingthread.py | 1 | 3586 | # vim:expandtab:smarttab
#A thread that allows us to process files
from __future__ import with_statement
import sys, os
import threading
from Queue import Queue
from configuration import config
fp = None
def set_fp(newfp):
global fp
fp = newfp
def get_fp():
return fp
class MsgQueue(object):
def __in... | mit |
pratikmallya/hue | desktop/core/ext-py/python-ldap-2.3.13/Demo/pyasn1/prereadcontrol.py | 40 | 1682 | #!/usr/bin/env python
"""
This sample script demonstrates the use of the pre-read control (see RFC 4527).
Originally contributed by Andreas Hasenack <ahasenack@terra.com.br>
Requires module pyasn1 (see http://pyasn1.sourceforge.net/)
"""
import ldap
from pyasn1.type import univ
from pyasn1.codec.der import encoder
f... | apache-2.0 |
wangyum/spark | examples/src/main/python/ml/word2vec_example.py | 27 | 1737 | #
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not us... | apache-2.0 |
hortonworks/hortonworks-sandbox | desktop/core/ext-py/Django-1.2.3/tests/regressiontests/test_client_regress/views.py | 46 | 3663 | from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.http import HttpResponse, HttpResponseRedirect
from django.core.exceptions import SuspiciousOperation
from django.shortcuts import render_to_response
from django.utils import simplejson
from django.utils.encoding impo... | apache-2.0 |
CloudServer/nova | nova/virt/libvirt/guest.py | 1 | 9019 | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
# Copyright (c) 2010 Citrix Systems, Inc.
# Copyright (c) 2011 Piston Cloud Computing, Inc
# Copyright (c) 2012 University Of Minho
# Copyright (c) 2013 Hewlett-Pa... | apache-2.0 |
Sup3Roque/Pancas | plugin.video.loganaddon/resources/lib/libraries/f4mproxy/f4mDownloader.py | 55 | 38147 | import xml.etree.ElementTree as etree
import base64
from struct import unpack, pack
import sys
import io
import os
import time
import itertools
import xbmcaddon
import xbmc
import urllib2,urllib
import traceback
import urlparse
import posixpath
import re
import hmac
import hashlib
import binascii
import zlib
from hash... | gpl-2.0 |
Aaron0927/xen-4.2.1 | tools/pygrub/src/GrubConf.py | 6 | 14183 | #
# GrubConf.py - Simple grub.conf parsing
#
# Copyright 2009 Citrix Systems Inc.
# Copyright 2005-2006 Red Hat, Inc.
# Jeremy Katz <katzj@redhat.com>
#
# This software may be freely redistributed under the terms of the GNU
# general public license.
#
# You should have received a copy of the GNU General Public License
... | gpl-2.0 |
vanzaj/Probabilistic-Programming-and-Bayesian-Methods-for-Hackers | Chapter2_MorePyMC/separation_plot.py | 86 | 1494 | # separation plot
# Author: Cameron Davidson-Pilon,2013
# see http://mdwardlab.com/sites/default/files/GreenhillWardSacks.pdf
import matplotlib.pyplot as plt
import numpy as np
def separation_plot( p, y, **kwargs ):
"""
This function creates a separation plot for logistic and probit classification.
Se... | mit |
mohamedhagag/community-addons | account_invoice_analytic_search/account_invoice.py | 3 | 4139 | # -*- coding: utf-8 -*-
##############################################################################
#
# Copyright (C) 2014 Eficent (<http://www.eficent.com/>)
# <contact@eficent.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero ... | agpl-3.0 |
TOCyna/tabelinha | flask/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/_base.py | 169 | 6718 | from __future__ import absolute_import, division, unicode_literals
from pip._vendor.six import text_type
import gettext
_ = gettext.gettext
from ..constants import voidElements, spaceCharacters
spaceCharacters = "".join(spaceCharacters)
class TreeWalker(object):
def __init__(self, tree):
self.tree = tre... | gpl-2.0 |
burzillibus/RobHome | venv/lib/python2.7/site-packages/Crypto/Cipher/PKCS1_v1_5.py | 123 | 9103 | # -*- coding: utf-8 -*-
#
# Cipher/PKCS1-v1_5.py : PKCS#1 v1.5
#
# ===================================================================
# The contents of this file are dedicated to the public domain. To
# the extent that dedication to the public domain is not available,
# everyone is granted a worldwide, perpetual, ro... | mit |
akretion/hr | __unported__/hr_report_turnover/report/employee_turnover.py | 2 | 4949 | #-*- coding:utf-8 -*-
#
#
# Copyrigth (C) 2013 Michael Telahun Makonnen <mmakonnen@gmail.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License... | agpl-3.0 |
derekforeman/Wox | PythonHome/Lib/site-packages/chardet/charsetgroupprober.py | 2929 | 3791 | ######################## 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 ... | mit |
keedio/hue | desktop/core/ext-py/Django-1.6.10/tests/aggregation/models.py | 114 | 1343 | # coding: utf-8
from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Author(models.Model):
name = models.CharField(max_length=100)
age = models.IntegerField()
friends = models.ManyToManyField('self', blank=True)
def __str__(self... | apache-2.0 |
tlakshman26/cinder-bug-fix-volume-conversion-full | cinder/tests/unit/volume/drivers/netapp/dataontap/test_block_7mode.py | 3 | 19985 | # Copyright (c) 2014 Alex Meade. All rights reserved.
# Copyright (c) 2014 Clinton Knight. All rights reserved.
# Copyright (c) 2015 Tom Barron. 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 ob... | apache-2.0 |
pvagner/orca | test/keystrokes/firefox/say_all_wiki.py | 1 | 12812 | #!/usr/bin/python
"""Test of sayAll."""
from macaroon.playback import *
import utils
sequence = MacroSequence()
sequence.append(utils.StartRecordingAction())
sequence.append(KeyComboAction("KP_Add"))
sequence.append(utils.AssertPresentationAction(
"1. KP_Add to do a SayAll",
["SPEECH OUTPUT: 'Home'",
"... | lgpl-2.1 |
thomasaarholt/hyperspy | hyperspy/samfire_utils/strategy.py | 4 | 18093 | # -*- coding: utf-8 -*-
# Copyright 2007-2020 The HyperSpy developers
#
# This file is part of HyperSpy.
#
# HyperSpy 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... | gpl-3.0 |
lamby/ansible-modules-core | windows/win_feature.py | 96 | 2770 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Paul Durivage <paul.durivage@rackspace.com>, Trond Hindenes <trond@hindenes.com> and others
#
# 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
#... | gpl-3.0 |
aerophile/django | django/contrib/gis/management/commands/ogrinspect.py | 111 | 5738 | import argparse
import inspect
from django.contrib.gis import gdal
from django.core.management.base import BaseCommand, CommandError
class LayerOptionAction(argparse.Action):
"""
Custom argparse action for the `ogrinspect` `layer_key` keyword option
which may be an integer or a string.
"""
def __... | bsd-3-clause |
hortont424/contrasty | src/filters/merge.py | 1 | 1077 | import math
import sys
import pyopencl as cl
import numpy
from PIL import Image
from log import logCall
@logCall
def mergeImages(images, clContext, clQueue):
if not hasattr(mergeImages, "program"):
kernelFile = open('src/kernels/mergeImages.cl', 'r')
mergeImages.program = cl.Program(clContext, ke... | bsd-2-clause |
jackkiej/SickRage | lib/hachoir_parser/audio/itunesdb.py | 72 | 20511 | """
iPod iTunesDB parser.
Documentation:
- http://ipodlinux.org/ITunesDB
Author: Romain HERAULT
Creation date: 19 august 2006
"""
from hachoir_parser import Parser
from hachoir_core.field import (FieldSet,
UInt8, UInt16, UInt32, Int32, UInt64, TimestampMac32,
String, Float32, NullBytes, Enum, RawBytes)
from ... | gpl-3.0 |
muupan/chainer | chainer/functions/loss/negative_sampling.py | 2 | 6636 | import numpy
import six
from chainer import cuda
from chainer import function
from chainer.utils import type_check
class NegativeSamplingFunction(function.Function):
def __init__(self, sampler, sample_size):
self.sampler = sampler
self.sample_size = sample_size
def _make_samples(self, t):
... | mit |
bhargav2408/python-for-android | python3-alpha/python3-src/Lib/dbm/dumb.py | 56 | 9603 | """A dumb and slow but simple dbm clone.
For database spam, spam.dir contains the index (a text file),
spam.bak *may* contain a backup of the index (also a text file),
while spam.dat contains the data (a binary file).
XXX TO DO:
- seems to contain a bug when updating...
- reclaim free space (currently, space once o... | apache-2.0 |
hmflash/Cura | cura/Settings/UserProfilesModel.py | 1 | 1775 | # Copyright (c) 2016 Ultimaker B.V.
# Cura is released under the terms of the AGPLv3 or higher.
from UM.Application import Application
from cura.QualityManager import QualityManager
from cura.Settings.ProfilesModel import ProfilesModel
from cura.Settings.ExtruderManager import ExtruderManager
## QML Model fo... | agpl-3.0 |
bootphon/tde | tde/util/printing.py | 1 | 3383 | from contextlib import contextmanager
import time
import sys
def banner(s):
l = len(s)
return '-'*l+'\n'+s+'\n'+'-'*l
def pretty_pairs(pclus_set):
strings = [('<{0} [{1:.3f},{2:.3f}] ({3})>'.format(f1.name, f1.interval.start,
f1.interval.end, ' '.joi... | gpl-3.0 |
nuxeh/keystone | keystone/tests/unit/test_cert_setup.py | 6 | 8784 | # Copyright 2012 OpenStack Foundation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in w... | apache-2.0 |
Tan0/ironic | ironic/common/pxe_utils.py | 1 | 12534 | #
# Copyright 2014 Rackspace, 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 ... | apache-2.0 |
tangyaohua/dl4mt | session2/lm/lm.py | 1 | 3617 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import logging as loggers
logging = loggers.getLogger(__name__)
from deepy.networks import NeuralNetwork
from deepy.layers import OneHotEmbedding
from deepy.utils import onehot, EPSILON
import theano.tensor as T
from cost import LMCost
class NeuralLM(... | bsd-3-clause |
nkgilley/home-assistant | homeassistant/components/spider/climate.py | 5 | 3866 | """Support for Spider thermostats."""
import logging
from homeassistant.components.climate import ClimateEntity
from homeassistant.components.climate.const import (
HVAC_MODE_COOL,
HVAC_MODE_HEAT,
HVAC_MODE_OFF,
SUPPORT_FAN_MODE,
SUPPORT_TARGET_TEMPERATURE,
)
from homeassistant.const import ATTR_T... | apache-2.0 |
JTarball/docker-django-polymer-starter-kit | docker/app/app/backend/apps/_archive/blog_old/views.py | 8 | 1882 | from django.views.generic import ListView, DetailView
from blog.models import Post
class NoPostMsgMixin(object):
no_post_message = 'Sorry, no posts found.'
def get_context_data(self, **kwargs):
""" Get the context for this view. Add No Post Message. """
context = super(NoPostMsgMixin, self).g... | isc |
Carreau/pip | pip/_vendor/__init__.py | 1 | 2865 | """
pip._vendor is for vendoring dependencies of pip to prevent needing pip to
depend on something external.
Files inside of pip._vendor should be considered immutable and should only be
updated to versions from upstream.
"""
from __future__ import absolute_import
import sys
class VendorAlias(object):
def __in... | mit |
nelango/ViralityAnalysis | model/lib/nltk/metrics/agreement.py | 8 | 14996 | # Natural Language Toolkit: Agreement Metrics
#
# Copyright (C) 2001-2015 NLTK Project
# Author: Tom Lippincott <tom@cs.columbia.edu>
# URL: <http://nltk.org/>
# For license information, see LICENSE.TXT
#
"""
Implementations of inter-annotator agreement coefficients surveyed by Artstein
and Poesio (2007), Inter-Coder ... | mit |
mattsunsjf/PythonPusherClient | pusherclient/connection.py | 1 | 9498 | from threading import Thread, Timer
import websocket
import logging
import time
try:
import simplejson as json
except ImportError:
import json
class Connection(Thread):
def __init__(self, event_handler, url, log_level=logging.INFO, daemon=True, reconnect_interval=10):
self.event_handler = event_h... | mit |
Ikarrus/-tg-station | bot/Weather.py | 36 | 2342 | # -*- coding: cp1252 -*-
import urllib,xml.sax.handler
# S10 COMPATIABLE
def message(data):
if data["type"] == "PRIVMSG":
try:
splitdata = data["content"].lower().split(" ")
if splitdata[0] == ":weather" and len(splitdata) > 1:
data = Weather(" ".join(splitdat... | agpl-3.0 |
sujithshankar/anaconda | tests/pyanaconda_tests/iutil_test.py | 2 | 30480 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in ... | gpl-2.0 |
anaoaktree/vcgen | vcgen/elsa.py | 1 | 1154 | import sys, time
from imp_parser import *
from imp_lexer import *
from imp_vcgen import *
from argparse import *
sys.path.append(".")
import z3
def find_proc(ast,name):
if proc(ast) and ast.name==name:
return ast
elif compound(ast):
y=find_proc(ast.first,name)
x=find_proc(ast.second,name)
if x:
retur... | mit |
thundernet8/WRGameVideos-Server | venv/lib/python2.7/site-packages/sqlalchemy/dialects/sybase/base.py | 25 | 28853 | # sybase/base.py
# Copyright (C) 2010-2015 the SQLAlchemy authors and contributors
# <see AUTHORS file>
# get_select_precolumns(), limit_clause() implementation
# copyright (C) 2007 Fisch Asset Management
# AG http://www.fam.ch, with coding by Alexander Houben
# alexander.houben@thor-solutions.ch
#
# This module is par... | gpl-2.0 |
Hackplayers/Empire-mod-Hackplayers | lib/modules/powershell/situational_awareness/network/powerview/process_hunter.py | 3 | 5757 | from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Invoke-ProcessHunter',
'Author': ['@harmj0y'],
'Description': ('Query the process lists of remote machines, searching for processes with a specific name or ow... | bsd-3-clause |
jonfoster/pyxb-upstream-mirror | tests/datatypes/test-integer.py | 5 | 2109 | # -*- coding: utf-8 -*-
import logging
if __name__ == '__main__':
logging.basicConfig()
_log = logging.getLogger(__name__)
from pyxb.exceptions_ import *
import unittest
import pyxb.binding.datatypes as xsd
class _TestIntegerType (object):
"""Base class for testing any datatype that descends from integer.
... | apache-2.0 |
awesomebytes/etherdream_tools | web_engine/translation_dxf.py | 1 | 2982 | #!/usr/bin/env python
#coding:utf-8
# Based on the example copydxf from mozman -- <mozman@gmx.at>
import sys
import time
from ezdxf import readfile
def translation_dxf(fromfile, tofile, x, y):
starttime = time.time()
dwg = readfile(fromfile)
#print "dwg is type:" + str(type(dwg))
translation_x_y(dw... | bsd-3-clause |
zadgroup/edx-platform | cms/djangoapps/contentstore/features/signup.py | 111 | 2821 | # pylint: disable=missing-docstring
# pylint: disable=redefined-outer-name
from lettuce import world, step
from nose.tools import assert_true, assert_false # pylint: disable=no-name-in-module
@step('I fill in the registration form$')
def i_fill_in_the_registration_form(step):
def fill_in_reg_form():
reg... | agpl-3.0 |
Zord13appdesa/python-for-android | python-build/python-libs/gdata/build/lib/gdata/tlslite/utils/hmac.py | 403 | 3286 | """HMAC (Keyed-Hashing for Message Authentication) Python module.
Implements the HMAC algorithm as described by RFC 2104.
(This file is modified from the standard library version to do faster
copying)
"""
def _strxor(s1, s2):
"""Utility method. XOR the two strings s1 and s2 (must have same length).
"""
r... | apache-2.0 |
kittiu/odoo | addons/hr_holidays/__init__.py | 442 | 1094 | # -*- 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 |
victims/victims-client | setup.py | 1 | 1857 | #!/usr/bin/env python
#
# Copyright 2010-2013
# Steve 'Ashcrow' Milner <stevem@gnulinux.net>
#
# This software may be freely redistributed under the terms of the GNU
# general public license.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Softw... | gpl-3.0 |
jaysonsantos/servo | tests/wpt/web-platform-tests/tools/manifest/utils.py | 16 | 1346 | import os
from six import BytesIO
blacklist = ["/", "/tools/", "/resources/", "/common/", "/conformance-checkers/", "_certs"]
def rel_path_to_url(rel_path, url_base="/"):
assert not os.path.isabs(rel_path)
if url_base[0] != "/":
url_base = "/" + url_base
if url_base[-1] != "/":
url_base +=... | mpl-2.0 |
nikolay-fedotov/tempest | tempest/api_schema/response/compute/v2/volumes.py | 17 | 5127 | # Copyright 2014 NEC Corporation. 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 ... | apache-2.0 |
runekaagaard/django-contrib-locking | tests/order_with_respect_to/tests.py | 11 | 3760 | from __future__ import unicode_literals
from operator import attrgetter
from django.test import TestCase
from django.db import models
from .models import Post, Question, Answer
class OrderWithRespectToTests(TestCase):
@classmethod
def setUpTestData(cls):
cls.q1 = Question.objects.create(text="Whi... | bsd-3-clause |
begeeben/shadowsocks | setup.py | 929 | 1321 | import codecs
from setuptools import setup
with codecs.open('README.rst', encoding='utf-8') as f:
long_description = f.read()
setup(
name="shadowsocks",
version="2.8.2",
license='http://www.apache.org/licenses/LICENSE-2.0',
description="A fast tunnel proxy that help you get through firewalls",
... | apache-2.0 |
weese/seqan | misc/seqan_instrumentation/py2exe/dist/classes/requests/utils.py | 23 | 13129 | # -*- coding: utf-8 -*-
"""
requests.utils
~~~~~~~~~~~~~~
This module provides utility functions that are used within Requests
that are also useful for external consumption.
"""
import cgi
import codecs
import os
import random
import re
import zlib
from netrc import netrc, NetrcParseError
from .compat import parse... | bsd-3-clause |
kopiro/titanium_mobile | support/common/simplejson/tests/test_unicode.py | 123 | 2327 | from unittest import TestCase
import simplejson as json
class TestUnicode(TestCase):
def test_encoding1(self):
encoder = json.JSONEncoder(encoding='utf-8')
u = u'\N{GREEK SMALL LETTER ALPHA}\N{GREEK CAPITAL LETTER OMEGA}'
s = u.encode('utf-8')
ju = encoder.encode(u)
js = en... | apache-2.0 |
thomas-young-2013/wherehowsX | metadata-etl/src/main/resources/jython/requests/compat.py | 1039 | 1469 | # -*- coding: utf-8 -*-
"""
pythoncompat
"""
from .packages import chardet
import sys
# -------
# Pythons
# -------
# Syntax sugar.
_ver = sys.version_info
#: Python 2.x?
is_py2 = (_ver[0] == 2)
#: Python 3.x?
is_py3 = (_ver[0] == 3)
try:
import simplejson as json
except (ImportError, SyntaxError):
# si... | apache-2.0 |
soldag/home-assistant | tests/components/rainmachine/test_config_flow.py | 4 | 3911 | """Define tests for the OpenUV config flow."""
from regenmaschine.errors import RainMachineError
from homeassistant import data_entry_flow
from homeassistant.components.rainmachine import CONF_ZONE_RUN_TIME, DOMAIN, config_flow
from homeassistant.config_entries import SOURCE_USER
from homeassistant.const import CONF_I... | apache-2.0 |
projectmallard/mallard-ducktype | mallard/__init__.py | 1 | 1111 | # Copyright (c) 2015 Shaun McCance <shaunm@gnome.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, modify, me... | mit |
unicri/edx-platform | pavelib/paver_tests/test_paver_bok_choy_cmds.py | 2 | 2656 |
import os
import unittest
from pavelib.utils.test.suites.bokchoy_suite import BokChoyTestSuite
REPO_DIR = os.getcwd()
class TestPaverBokChoyCmd(unittest.TestCase):
def setUp(self):
self.request = BokChoyTestSuite('')
def _expected_command(self, expected_text_append, expected_default_store=None):
... | agpl-3.0 |
StackStorm/st2 | st2common/st2common/util/actionalias_helpstring.py | 3 | 3057 | # Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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 ... | apache-2.0 |
cedi4155476/QGIS | python/plugins/processing/modeler/ModelerAlgorithmProvider.py | 12 | 4201 | # -*- coding: utf-8 -*-
"""
***************************************************************************
ModelerAlgorithmProvider.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
**************... | gpl-2.0 |
jeffery9/mixprint_addons | iyara/sale.py | 1 | 8850 | # -*- 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 |
waytai/odoo | addons/product_extended/wizard/__init__.py | 374 | 1078 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# $Id$
#
# This program is free software: you can redistribute it and/or modify
#... | agpl-3.0 |
heeraj123/oh-mainline | mysite/customs/management/commands/customs_daily_tasks.py | 15 | 3642 | # This file is part of OpenHatch.
# Copyright (C) 2010 Jack Grigg
# Copyright (C) 2010 OpenHatch, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as published by
# the Free Software Foundation, either version 3 of the License, o... | agpl-3.0 |
fbradyirl/home-assistant | homeassistant/components/denonavr/media_player.py | 2 | 12391 | """Support for Denon AVR receivers using their HTTP interface."""
from collections import namedtuple
import logging
import voluptuous as vol
from homeassistant.components.media_player import MediaPlayerDevice, PLATFORM_SCHEMA
from homeassistant.components.media_player.const import (
MEDIA_TYPE_CHANNEL,
MEDIA... | apache-2.0 |
bozzzzo/quark | quarkc/test/emit/expected/py/quark/quark/spi_api/__init__.py | 1 | 6082 | from quark_runtime import *
import quark.reflect
import quark
import quark_md
import quark.concurrent
class ServletProxy(object):
def _init(self):
self.servlet_impl = None
self.real_runtime = None
def __init__(self, real_runtime, servlet_impl):
self._init()
(self).real_runtim... | apache-2.0 |
tensorflow/deepmath | deepmath/deephol/io_util.py | 1 | 7735 | """Methods for reading/writing to disk used in main, and helpers.
Helper methods are to maintain invariants/assumptions about data, and do any
light-weight pre/post-processing.
"""
from __future__ import absolute_import
from __future__ import division
# Import Type Annotations
from __future__ import print_function
im... | apache-2.0 |
nvoron23/avos | openstack_dashboard/dashboards/project/access_and_security/floating_ips/forms.py | 68 | 2245 | # Copyright 2012 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Copyright 2012 Nebula, Inc.
# Copyright (c) 2012 X.commerce, a business unit of eBay Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License")... | apache-2.0 |
suncycheng/intellij-community | python/lib/Lib/encodings/iso8859_6.py | 593 | 11089 | """ Python Character Mapping Codec iso8859_6 generated from 'MAPPINGS/ISO8859/8859-6.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,errors='... | apache-2.0 |
openstax/openstax-cms | errata/migrations/0001_initial.py | 2 | 2702 | # -*- coding: utf-8 -*-
# Generated by Django 1.10.2 on 2016-11-21 20:14
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
initial = True
dependencies = [
('books', '0030_auto_20161026_1541'),
... | agpl-3.0 |
transientskp/tkp | tests/test_accessors/test_pickle.py | 1 | 1673 | """
Makes sure the accessors are pickleable
"""
from os import path
import unittest
import cPickle
from astropy.io.fits import open as open_fits
from tkp.testutil.data import DATAPATH
from tkp.accessors.fitsimage import FitsImage
from tkp.accessors.fitsimageblob import FitsImageBlob
from tkp.accessors.aartfaaccasaimag... | bsd-2-clause |
cloudaice/simple-data | misc/virtenv/share/doc/pycurl/tests/socket_open_test.py | 1 | 1158 | #! /usr/bin/env python
# -*- coding: iso-8859-1 -*-
# vi:ts=4:et
import socket
import pycurl
import unittest
try:
import urllib.parse as urllib_parse
except ImportError:
import urllib as urllib_parse
from . import appmanager
from . import util
setup_module, teardown_module = appmanager.setup(('app', 8380))
... | mit |
keedio/keedio-stacks | KEEDIO/1.3/hooks/before-INSTALL/scripts/shared_initialization.py | 1 | 5117 | """
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 this ... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.