repo_name stringlengths 5 100 | ref stringlengths 12 67 | path stringlengths 4 244 | copies stringlengths 1 8 | content stringlengths 0 1.05M ⌀ |
|---|---|---|---|---|
nazeehshoura/crawler | refs/heads/master | env/lib/python2.7/site-packages/django/core/management/sql.py | 49 | from __future__ import unicode_literals
import codecs
import os
import re
import warnings
from django.apps import apps
from django.conf import settings
from django.core.management.base import CommandError
from django.db import models, router
from django.utils.deprecation import RemovedInDjango19Warning
def check_fo... |
wasade/picrust | refs/heads/master | tests/test_predict_metagenomes.py | 1 | #!/usr/bin/env python
# File created on 22 Feb 2012
from __future__ import division
__author__ = "Greg Caporaso"
__copyright__ = "Copyright 2011-2013, The PICRUSt Project"
__credits__ = ["Greg Caporaso","Jesse Zaneveld"]
__license__ = "GPL"
__version__ = "1.0.0-dev"
__maintainer__ = "Greg Caporaso"
__email__ = "gregca... |
LumaPictures/rez | refs/heads/pull_requests | src/rez/tests/data/solver/packages/bahish/2/package.py | 8 | name = "bahish"
version = "2"
requires = ["pybah-5"]
# Copyright 2013-2016 Allan Johns.
#
# This library is free software: you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation, either
# version 3 of the License, or (at your... |
fangcode/shadowsocks | refs/heads/master | shadowsocks/crypto/util.py | 1032 | #!/usr/bin/env python
#
# 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 by applicable law or ... |
slurdge/shadowsocks | refs/heads/master | shadowsocks/shell.py | 652 | #!/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... |
lablup/sorna-client | refs/heads/master | tests/test_load.py | 1 | '''
A standalone script to generate some loads to the public API server.
It assumes that you have already configured the access key and secret key
as environment variables.
'''
import logging
import multiprocessing
from statistics import mean, median, stdev
import time
import pytest
from ai.backend.client.compat imp... |
kerkeslager/don | refs/heads/master | test_tags.py | 1 | import collections
import unittest
from ton import tags
class AutoTagTests(unittest.TestCase):
def test_autotags_void(self):
self.assertEqual(
tags.autotag(None),
tags.TaggedObject(tag = tags.VOID, value = None),
)
def test_autotags_true(self):
self.assertEqual... |
jmcorgan/gnuradio | refs/heads/master | gr-vocoder/python/vocoder/qa_ulaw_vocoder.py | 57 | #!/usr/bin/env python
#
# Copyright 2011,2013 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 optio... |
mr3bn/DAT210x | refs/heads/master | Module2/module2Notes.py | 1 | # -*- coding: utf-8 -*-
"""
Created on Sun Jun 04 14:30:05 2017
@author: Mark
"""
import pandas as pd
from sqlalchemy import create_engine
engine = create_engine('sqlite:///:memory:')
# some import examples
#df = pd.read_sql_table('my_table', engine, columns = ['ColA', 'ColB'])
#df = pd.read_excel('my_dataset.xlsx'... |
wolverineav/neutron | refs/heads/master | neutron/tests/unit/agent/test_rpc.py | 9 | # Copyright (c) 2012 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... |
un33k/robotframework | refs/heads/master | src/robot/variables/finders.py | 11 | # Copyright 2008-2015 Nokia Solutions and Networks
#
# 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 l... |
talk-to/PjSip-Repo | refs/heads/master | tests/pjsua/scripts-sendto/201_ice_mismatch_1.py | 42 | # $Id$
import inc_sip as sip
import inc_sdp as sdp
sdp = \
"""
v=0
o=- 0 0 IN IP4 127.0.0.1
s=pjmedia
c=IN IP4 127.0.0.1
t=0 0
m=audio 4000 RTP/AVP 0 101
a=ice-ufrag:1234
a=ice-pwd:5678
a=rtpmap:0 PCMU/8000
a=sendrecv
a=rtpmap:101 telephone-event/8000
a=fmtp:101 0-15
a=candidate:XX 1 UDP 1 1.1.1.1 2222 typ host
"""
a... |
chaostrigger/rl-library | refs/heads/master | system/common/libs/mwclient/simplejson/tests/test_attacks.py | 4 | def test_script_close_attack():
import simplejson
res = simplejson.dumps('</script>')
assert '</script>' not in res
res = simplejson.dumps(simplejson.loads('"</script>"'))
assert '</script>' not in res
|
Rodolfoarv/Mars-Explorer-AI-with-Python- | refs/heads/master | env/lib/python2.7/site-packages/pip/commands/hash.py | 514 | from __future__ import absolute_import
import hashlib
import logging
import sys
from pip.basecommand import Command
from pip.status_codes import ERROR
from pip.utils import read_chunks
from pip.utils.hashes import FAVORITE_HASH, STRONG_HASHES
logger = logging.getLogger(__name__)
class HashCommand(Command):
""... |
weka511/bioinformatics | refs/heads/master | PAR3.py | 1 | # Copyright (C) 2017 Greenweaves Software Pty Ltd
# This is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
# This software is distribut... |
kouaw/CouchPotatoServer | refs/heads/develop | libs/chardet/hebrewprober.py | 2928 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Shy Shalom
# Portions created by the Initial Developer are Copyright (C) 2005
# the Initial Developer. All Rights Reserved.
#... |
mistercrunch/panoramix | refs/heads/master | superset/connectors/sqla/__init__.py | 7 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... |
proliming/zulip | refs/heads/master | zerver/management/commands/expunge_logs.py | 116 | from __future__ import absolute_import
import os
import sys
import datetime
import tempfile
import traceback
import ujson
from django.core.management.base import BaseCommand
from zerver.retention_policy import should_expunge_from_log
now = datetime.datetime.now()
def copy_retained_messages(infile, outfile):
... |
bloomark/python-bitcoinlib | refs/heads/master | bitcoin/wallet.py | 11 | # 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... |
twister/twister.github.io | refs/heads/master | demo/testsuite-python/test_pexpect_ssh.py | 1 |
# version: 2.001
import time
import pexpect
#
# <title>Test pExpect SSH</title>
# <description>This test is connecting to a SSH server, using pExpect.</description>
#
def test():
testName = 'test_pexpect_ssh.py'
logMsg('logTest', "\nTestCase:%s starting\n" % testName)
error_code = "PASS"
print '=== Connectin... |
Nihn/Diamond-1 | refs/heads/master | src/collectors/ups/ups.py | 68 | # coding=utf-8
"""
This class collects data from NUT, a UPS interface for linux.
#### Dependencies
* nut/upsc to be installed, configured and running.
"""
import diamond.collector
import os
import subprocess
from diamond.collector import str_to_bool
class UPSCollector(diamond.collector.Collector):
def get_... |
jehine-MSFT/azure-storage-python | refs/heads/master | azure/storage/queue/queueservice.py | 1 | #-------------------------------------------------------------------------
# Copyright (c) Microsoft. 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.apa... |
Accelerite/cinder | refs/heads/master | tools/colorizer.py | 19 | #!/usr/bin/env python
# Copyright (c) 2013, Nebula, Inc.
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file exce... |
synologix/enigma2 | refs/heads/master | lib/python/Components/HTMLComponent.py | 66 | # some helper classes first:
class HTMLComponent:
def __init__(self):
pass
def produceHTML(self):
return ""
|
mjhea0/feedzilla | refs/heads/master | feedzilla/tests.py | 2 | # -*- coding: utf-8 -*-
# Copyright: 2011, Grigoriy Petukhov
# Author: Grigoriy Petukhov (http://lorien.name)
# License: BSD
from datetime import datetime
import os.path
from django.test import TestCase
from feedzilla.util.parse import guess_date, parse_feed
ROOT = os.path.dirname(os.path.realpath(__file__))
DATA_DI... |
wenjiezhang2013/My-Ghost-blog | refs/heads/master | node_modules/sqlite3/deps/extract.py | 775 | import sys
import tarfile
import os
tarball = os.path.abspath(sys.argv[1])
dirname = os.path.abspath(sys.argv[2])
tfile = tarfile.open(tarball,'r:gz');
tfile.extractall(dirname)
sys.exit(0)
|
youknowone/hangul-romanize | refs/heads/master | hangul_romanize/core.py | 1 | # -*- coding: utf-8 -*-
try:
unicode(0)
except NameError:
# py3
unicode = str
unichr = chr
class Syllable(object):
"""Hangul syllable interface"""
MIN = ord(u'가')
MAX = ord(u'힣')
def __init__(self, char=None, code=None):
if char is None and code is None:
raise Ty... |
alephu5/Soundbyte | refs/heads/master | environment/lib/python3.3/site-packages/nose/selector.py | 5 | """
Test Selection
--------------
Test selection is handled by a Selector. The test loader calls the
appropriate selector method for each object it encounters that it
thinks may be a test.
"""
import logging
import os
import unittest
from nose.config import Config
from nose.util import split_test_name, src, getfilenam... |
gustavoanatoly/hbase | refs/heads/master | dev-support/findHangingTests.py | 3 | #!/usr/bin/env python
##
# 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
# ... |
phracek/rebase-helper | refs/heads/master | rebasehelper/spec_hooks/paths_to_rpm_macros.py | 1 | # -*- coding: utf-8 -*-
#
# This tool helps you to rebase package to the latest version
# Copyright (C) 2013-2014 Red Hat, Inc.
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2... |
garnertb/geonode | refs/heads/master | geonode/people/utils.py | 33 | #########################################################################
#
# Copyright (C) 2012 OpenPlans
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
#... |
tsdmgz/ansible | refs/heads/devel | lib/ansible/modules/network/cloudengine/ce_config.py | 27 | #!/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... |
robobrobro/ballin-octo-shame | refs/heads/master | lib/Python-3.4.3/Lib/keyword.py | 162 | #! /usr/bin/env python3
"""Keywords (from "graminit.c")
This file is automatically generated; please don't muck it up!
To update the symbols in this file, 'cd' to the top directory of
the python source tree after building the interpreter and run:
./python Lib/keyword.py
"""
__all__ = ["iskeyword", "kwlist"]
k... |
adore-hrzz/nao-sound-classification | refs/heads/master | scripts/cross_validation.py | 2 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt
import csv
import os
import sys
import itertools
from sklearn import svm, datasets
from sklearn.metrics import confusion_matrix
def plot_confusion_matrix(cm, classes, data_type, normalize=True, title='Confusion matrix',... |
kidsfm/cms | refs/heads/master | videos/apps.py | 6 | from django.apps import AppConfig
class VideosConfig(AppConfig):
name = 'videos'
|
rossant/podoc | refs/heads/master | setup.py | 2 | # -*- coding: utf-8 -*-
# flake8: noqa
"""Installation script."""
#-------------------------------------------------------------------------------------------------
# Imports
#-------------------------------------------------------------------------------------------------
import os
import os.path as op
import re
... |
40223110/2015cd_midterm- | refs/heads/master | static/Brython3.1.1-20150328-091302/Lib/_weakrefset.py | 766 | # Access WeakSet through the weakref module.
# This code is separated-out because it is needed
# by abc.py to load everything else at startup.
from _weakref import ref
__all__ = ['WeakSet']
class _IterationGuard:
# This context manager registers itself in the current iterators of the
# weak container, such ... |
xaviercobain88/framework-python | refs/heads/master | openerp/addons/document_page/wizard/document_page_show_diff.py | 59 | # -*- 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... |
sarakha63/persomov | refs/heads/master | couchpotato/core/media/movie/providers/trailer/youtube_dl/extractor/discovery.py | 18 | from __future__ import unicode_literals
import re
import json
from .common import InfoExtractor
class DiscoveryIE(InfoExtractor):
_VALID_URL = r'http://www\.discovery\.com\/[a-zA-Z0-9\-]*/[a-zA-Z0-9\-]*/videos/(?P<id>[a-zA-Z0-9\-]*)(.htm)?'
_TEST = {
'url': 'http://www.discovery.com/tv-shows/mythbus... |
ormnv/os_final_project | refs/heads/master | django/middleware/transaction.py | 143 | from django.db import transaction
class TransactionMiddleware(object):
"""
Transaction middleware. If this is enabled, each view function will be run
with commit_on_response activated - that way a save() doesn't do a direct
commit, the commit is done when a successful response is created. If an
exc... |
brendandburns/tensorflow | refs/heads/master | tensorflow/models/rnn/ptb/ptb_word_lm.py | 3 | """Example / benchmark for building a PTB LSTM model.
Trains the model described in:
(Zaremba, et. al.) Recurrent Neural Network Regularization
http://arxiv.org/abs/1409.2329
The data required for this example is in the data/ dir of the
PTB dataset from Tomas Mikolov's webpage:
http://www.fit.vutbr.cz/~imikolov/rnnl... |
rbramwell/pulp | refs/heads/master | nodes/extensions/admin/pulp_node/__init__.py | 56 | # Copyright (c) 2013 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public
# License as published by the Free Software Foundation; either version
# 2 of the License (GPLv2) or (at your option) any later version.
# There is NO WARRANTY for this software, express or implied,
# including the impl... |
xkcd1253/SocialNetworkforTwo | refs/heads/master | flask/lib/python2.7/site-packages/wtforms/ext/csrf/session.py | 68 | """
A provided CSRF implementation which puts CSRF data in a session.
This can be used fairly comfortably with many `request.session` type
objects, including the Werkzeug/Flask session store, Django sessions, and
potentially other similar objects which use a dict-like API for storing
session keys.
The basic concept i... |
adsorensen/girder | refs/heads/master | girder/api/v1/group.py | 1 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
###############################################################################
# Copyright 2013 Kitware Inc.
#
# Licensed under the Apache License, Version 2.0 ( the "License" );
# you may not use this file except in compliance with the License.
# You may obtain a cop... |
JanHendrikDolling/configvalidator | refs/heads/master | test/test_context_data.py | 1 | # -*- coding: utf-8 -*-
"""
:copyright: (c) 2015 by Jan-Hendrik Dolling.
:license: Apache 2.0, see LICENSE for more details.
"""
import os
try:
import unittest2 as unittest
except ImportError:
import unittest
import testutils
from configvalidator import ConfigValidator, ParserException
from configvalidator.too... |
andykimpe/chromium-test-npapi | refs/heads/master | tools/metrics/histograms/validate_format.py | 63 | #!/usr/bin/env python
# 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.
"""Verifies that the histograms XML file is well-formatted."""
import extract_histograms
import os.path
def main():
# This will ra... |
anielsen001/scipy | refs/heads/master | benchmarks/benchmarks/cluster.py | 36 | import numpy as np
from .common import Benchmark
try:
from scipy.cluster.hierarchy import linkage
except ImportError:
pass
class HierarchyLinkage(Benchmark):
params = ['single', 'complete', 'average', 'weighted', 'centroid',
'median', 'ward']
param_names = ['method']
def __init__(... |
fragaria/suds | refs/heads/master | suds/transport/options.py | 201 | # This program is free software; you can redistribute it and/or modify
# it under the terms of the (LGPL) GNU Lesser General Public License as
# published by the Free Software Foundation; either version 3 of the
# License, or (at your option) any later version.
#
# This program is distributed in the hope that it will ... |
echodaemon/Empire | refs/heads/master | lib/modules/powershell/management/mailraider/disable_security.py | 10 | from lib.common import helpers
class Module:
def __init__(self, mainMenu, params=[]):
self.info = {
'Name': 'Disable-SecuritySettings',
'Author': ['@xorrior'],
'Description': ("This function checks for the ObjectModelGuard, PromptOOMSend, and AdminSecurityMode regist... |
DistributedSystemsGroup/sysadmin-dsp | refs/heads/master | openstackdns/novaqueue.py | 1 | import sys
import os
import pika
import json
import logging
import cPickle
# attach to our global logger
logger = logging.getLogger("novadns")
def load_cache(file):
if os.path.exists(file):
return cPickle.load(open(file, "r"))
else:
return {}
def write_cache(file, cache):
cPickle.dump(cache, ope... |
SlimRoms/android_external_chromium_org | refs/heads/lp5.0 | chrome/common/extensions/docs/server2/datastore_models.py | 86 | # 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 cPickle
import traceback
from appengine_wrappers import db
# A collection of the data store models used throughout the server.
# These values are gl... |
ihsanudin/odoo | refs/heads/8.0 | addons/survey/wizard/__init__.py | 385 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-TODAY OpenERP S.A. <http://www.openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms... |
ujenmr/ansible | refs/heads/devel | lib/ansible/modules/network/fortios/fortios_wireless_controller_utm_profile.py | 19 | #!/usr/bin/python
from __future__ import (absolute_import, division, print_function)
# Copyright 2019 Fortinet, Inc.
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... |
crmccreary/openerp_server | refs/heads/master | openerp/addons/web_process/__openerp__.py | 2 | {
"name" : "Process",
"version": "2.0",
"description":
"""
OpenERP Web process view.
""",
"depends" : ["web"],
"js": [
"static/src/js/process.js"
],
"css": [
"static/src/css/process.css"
],
'qweb': [
"static/src/xml/*.xml"
],
'... |
2014c2g19/2014c2g19 | refs/heads/master | exts/w2/static/Brython2.0.0-20140209-164925/Lib/sre_parse.py | 111 | #
# Secret Labs' Regular Expression Engine
#
# convert re-style regular expression to sre pattern
#
# Copyright (c) 1998-2001 by Secret Labs AB. All rights reserved.
#
# See the sre.py file for information on usage and redistribution.
#
"""Internal support module for sre"""
# XXX: show string offset and offending ch... |
bolkedebruin/airflow | refs/heads/master | airflow/contrib/hooks/sqoop_hook.py | 1 | # -*- coding: utf-8 -*-
#
# 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
#... |
partofthething/home-assistant | refs/heads/dev | tests/components/advantage_air/test_cover.py | 9 | """Test the Advantage Air Cover Platform."""
from json import loads
from homeassistant.components.advantage_air.const import (
ADVANTAGE_AIR_STATE_CLOSE,
ADVANTAGE_AIR_STATE_OPEN,
)
from homeassistant.components.cover import (
ATTR_POSITION,
DEVICE_CLASS_DAMPER,
DOMAIN as COVER_DOMAIN,
SERVICE... |
sammerry/ansible | refs/heads/devel | test/units/plugins/filter/__init__.py | 7690 | # (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) an... |
harry-7/addons-server | refs/heads/master | src/olympia/constants/base.py | 1 | import re
from collections import namedtuple
from django.utils.translation import ugettext_lazy as _
# Add-on and File statuses.
STATUS_NULL = 0 # No review type chosen yet, add-on is incomplete.
STATUS_AWAITING_REVIEW = 1 # File waiting for review.
STATUS_PENDING = 2 # Personas (lightweight themes) waiting for r... |
jdramani/servo | refs/heads/master | tests/wpt/web-platform-tests/html/infrastructure/urls/resolving-urls/query-encoding/resources/manifest.py | 253 | def main(request, response):
id = request.GET['id']
mode = request.GET['mode']
fallback_url = ""
if mode == "FALLBACK":
fallback_url = "fallback-namespace/"
manifest = u"""CACHE MANIFEST
%s:
%s stash.py?q=\u00E5&id=%s&action=put
""" % (mode, fallback_url, id)
return [("Content-Type", "t... |
dharmabumstead/ansible | refs/heads/devel | lib/ansible/modules/network/routing/net_static_route.py | 65 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, 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',
... |
GdZ/scriptfile | refs/heads/master | software/googleAppEngine/lib/django_1_4/tests/regressiontests/i18n/forms.py | 95 | from __future__ import absolute_import
from django import forms
from django.forms.extras import SelectDateWidget
from .models import Company
class I18nForm(forms.Form):
decimal_field = forms.DecimalField(localize=True)
float_field = forms.FloatField(localize=True)
date_field = forms.DateField(localize=T... |
Tinysymphony/shadowsocks | refs/heads/master | tests/graceful_cli.py | 977 | #!/usr/bin/python
import socks
import time
SERVER_IP = '127.0.0.1'
SERVER_PORT = 8001
if __name__ == '__main__':
s = socks.socksocket()
s.set_proxy(socks.SOCKS5, SERVER_IP, 1081)
s.connect((SERVER_IP, SERVER_PORT))
s.send(b'test')
time.sleep(30)
s.close()
|
nnethercote/servo | refs/heads/master | components/script/dom/bindings/codegen/parser/tests/test_constructor_no_interface_object.py | 4 | def WebIDLTest(parser, harness):
threw = False
try:
parser.parse("""
[Constructor, NoInterfaceObject]
interface TestConstructorNoInterfaceObject {
};
""")
results = parser.finish()
except:
threw = True
harness.ok(threw, "Should have t... |
maxcountryman/cryptotrade | refs/heads/master | cryptotrade/public_api.py | 1 | class MtGoxPublic(object):
'''Public API methods for mtgox.com; provides various metrics about the
market status.
'''
def _set_url(self, path='data/'):
url = self.url_base + path
return url
def ticker(self):
return self.api_request(self._set_url() + 'ticker.php')
... |
czpython/django-cms | refs/heads/develop | cms/tests/test_placeholder_operation_signals.py | 4 | # -*- coding: utf-8 -*-
from cms.api import add_plugin
from cms.models import Page, Placeholder, UserSettings
from cms.operations import (
ADD_PLUGIN,
ADD_PLUGINS_FROM_PLACEHOLDER,
CLEAR_PLACEHOLDER,
CHANGE_PLUGIN,
DELETE_PLUGIN,
CUT_PLUGIN,
MOVE_PLUGIN,
PASTE_PLUGIN,
PASTE_PLACEHOLD... |
gloaec/trifle | refs/heads/master | src/trifle/raft/client.py | 1 | from __future__ import print_function
import uuid
import msgpack
import trifle.raft.tcp as tcp
class NoConnection(Exception):
pass
class RaftClient(object):
def __init__(self, server):
self.tcp = tcp.TCP(0, 'client')
self.tcp.start()
self.msgs = {}
self.tcp.connect(server)
... |
StephenWeber/ansible | refs/heads/devel | lib/ansible/modules/network/eos/eos_command.py | 6 | #!/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... |
ACS-Community/ACS | refs/heads/master | LGPL/CommonSoftware/acspy/test/acspytestImpl/PyTestNestedModule.py | 4 | import acspytest__POA
from Acspy.Servants.ContainerServices import ContainerServices
from Acspy.Servants.ComponentLifecycle import ComponentLifecycle
from Acspy.Servants.ACSComponent import ACSComponent
from CORBA import TRUE, FALSE
#*******************************************************************************... |
mylog00/flink | refs/heads/master | flink-libraries/flink-streaming-python/src/test/python/org/apache/flink/streaming/python/api/test_map.py | 4 | ################################################################################
# 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... |
nick41496/Beatnik | refs/heads/master | manage.py | 1 | #!/usr/bin/env python
import os
import sys
if __name__ == "__main__":
os.environ.setdefault("DJANGO_SETTINGS_MODULE", "beatnik.settings")
try:
from django.core.management import execute_from_command_line
except ImportError:
# The above import may fail for some other reason. Ensure that the
... |
marcopompili/django-emarcs-utils | refs/heads/master | emarcs/utils/loremipsum.py | 1 | '''
Created on 26/dic/2013
@author: Marco Pompili
'''
def heading():
return 'heading'
def long_paragraph():
return 'Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Vestibulum tortor quam, feugiat vitae, ultricies eget, tempor sit amet, ante. Donec eu li... |
ldoktor/autotest | refs/heads/master | client/virt/tests/watchdog.py | 2 | import logging, time, shutil
from autotest.client.shared import error
from autotest.client.virt import virt_utils
def run_watchdog(test, params, env):
"""
Configure watchdog, crash the guest and check if watchdog_action occurs.
@param test: kvm test object.
@param params: Dictionary with test paramete... |
UCHIC/h2outility | refs/heads/master | src/GuiComponents/__init__.py | 1 |
__all__ = ['HydroShareAccountDialog', 'VisualH20MainWindow', 'UIController.py']
|
ppries/tensorflow | refs/heads/master | tensorflow/contrib/labeled_tensor/python/ops/nn_test.py | 11 | # 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... |
xuxiao19910803/edx | refs/heads/master | cms/djangoapps/contentstore/views/tests/test_videos.py | 83 | #-*- coding: utf-8 -*-
"""
Unit tests for video-related REST APIs.
"""
# pylint: disable=attribute-defined-outside-init
import csv
import json
import dateutil.parser
import re
from StringIO import StringIO
from django.conf import settings
from django.test.utils import override_settings
from mock import Mock, patch
fr... |
rouge8/pip | refs/heads/develop | tests/data/packages/LocalExtras-0.0.2/setup.py | 6 | import os
from setuptools import find_packages, setup
def path_to_url(path):
"""
Convert a path to URI. The path will be made absolute and
will not have quoted path parts.
"""
path = os.path.normpath(os.path.abspath(path))
drive, path = os.path.splitdrive(path)
filepath = path.split(os.pa... |
EraYaN/CouchPotatoServer | refs/heads/master | couchpotato/core/media/movie/providers/torrent/hdbits.py | 81 | from couchpotato.core.logger import CPLog
from couchpotato.core.media._base.providers.torrent.hdbits import Base
from couchpotato.core.media.movie.providers.base import MovieProvider
log = CPLog(__name__)
autoload = 'HDBits'
class HDBits(MovieProvider, Base):
pass
|
mvo5/snapcraft | refs/heads/master | tests/fixture_setup/os_release.py | 3 | # -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2018 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 the h... |
nacl-webkit/chrome_deps | refs/heads/master | tools/generate_shim_headers/generate_shim_headers.py | 3 | #!/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.
"""
Generates shim headers that mirror the directory structure of bundled headers,
but just forward to the system ones.
This allow... |
Maethorin/concept2 | refs/heads/master | migrations/versions/9f0fa98ec79d_.py | 1 | """empty message
Revision ID: 9f0fa98ec79d
Revises: 5e873c9ec136
Create Date: 2016-03-08 00:15:10.934364
"""
# revision identifiers, used by Alembic.
revision = '9f0fa98ec79d'
down_revision = '5e873c9ec136'
from alembic import op
import app
import sqlalchemy as sa
def upgrade():
### commands auto generated by... |
AOSPU/external_chromium_org_tools_gyp | refs/heads/android-5.0/py3 | test/relative/gyptest-default.py | 336 | #!/usr/bin/env python
# Copyright (c) 2011 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.
"""
Verifies simplest-possible build of a "Hello, world!" program
using the default build target.
"""
import TestGyp
test = TestGyp.TestGy... |
annayqho/TheCannon | refs/heads/master | code/lamost/mass_age/apokasc_validate.py | 1 | import numpy as np
import pyfits
from mass_age_functions import asteroseismic_mass
from mass_age_functions import calc_mass_2
# load data
ref_id = np.load("ref_id.npz")['arr_0']
ref_label = np.load("ref_label.npz")['arr_0']
teff = ref_label[:,0]
mh = ref_label[:,2]
logg =ref_label[:,1]
cm = ref_label[:,3]
nm = ref_la... |
CubicERP/odoo | refs/heads/8.1 | addons/sale_stock/sale_stock.py | 10 | # -*- 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... |
rixrix/servo | refs/heads/master | tests/wpt/web-platform-tests/tools/html5lib/html5lib/filters/lint.py | 979 | from __future__ import absolute_import, division, unicode_literals
from gettext import gettext
_ = gettext
from . import _base
from ..constants import cdataElements, rcdataElements, voidElements
from ..constants import spaceCharacters
spaceCharacters = "".join(spaceCharacters)
class LintError(Exception):
pass
... |
HoracioAlvarado/fwd | refs/heads/master | venv/Lib/site-packages/pkg_resources/__init__.py | 6 | """
Package resource API
--------------------
A resource is a logical file contained within a package, or a logical
subdirectory thereof. The package resource API expects resource names
to have their path parts separated with ``/``, *not* whatever the local
path separator is. Do not use os.path operations to manipul... |
saisaizhang/Food | refs/heads/master | flask/lib/python2.7/site-packages/werkzeug/testsuite/wsgi.py | 146 | # -*- coding: utf-8 -*-
"""
werkzeug.testsuite.wsgi
~~~~~~~~~~~~~~~~~~~~~~~
Tests the WSGI utilities.
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import unittest
from os import path
from contextlib import closing
from werkzeug.testsuite import Werkzeug... |
roboime/pyroboime | refs/heads/master | roboime/core/skills/drivetoball.py | 1 | #
# Copyright (C) 2013-2015 RoboIME
#
# 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, or (at your option) any later version.
#
# This program is distrib... |
rawg/levis | refs/heads/master | examples/knapsack01.py | 1 | """
Genetic solution to the 0/1 Knapsack Problem.
usage: knapsack01.py [-h] [--data-file DATA_FILE]
[--population-size POPULATION_SIZE]
[--iterations MAX_ITERATIONS] [--mutation MUTATION_PROB]
[--crossover CROSSOVER_PROB] [--seed SEED]
... |
lindycoder/fake-switches | refs/heads/master | fake_switches/brocade/command_processor/config_vrf.py | 4 | # Copyright 2015 Internap.
#
# 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, so... |
tailorian/Sick-Beard | refs/heads/ThePirateBay | lib/unidecode/x04f.py | 252 | data = (
'Zhong ', # 0x00
'Qi ', # 0x01
'Pei ', # 0x02
'Yu ', # 0x03
'Diao ', # 0x04
'Dun ', # 0x05
'Wen ', # 0x06
'Yi ', # 0x07
'Xin ', # 0x08
'Kang ', # 0x09
'Yi ', # 0x0a
'Ji ', # 0x0b
'Ai ', # 0x0c
'Wu ', # 0x0d
'Ji ', # 0x0e
'Fu ', # 0x0f
'Fa ', # 0x10
'Xiu ', ... |
vast-io/vast | refs/heads/master | aux/lz4/tests/test-lz4-versions.py | 12 | #!/usr/bin/env python3
"""Test LZ4 interoperability between versions"""
#
# Copyright (C) 2011-present, Takayuki Matsuoka
# All rights reserved.
# GPL v2 License
#
import glob
import subprocess
import filecmp
import os
import shutil
import sys
import hashlib
repo_url = 'https://github.com/lz4/lz4.git'
tmp_dir_name =... |
ex0hunt/redrat | refs/heads/master | common/connector.py | 1 | import configparser
import os
from redmine import Redmine
def redmine():
rootdir = os.path.abspath(os.path.join(os.path.dirname(__file__), '..'))
config_path = os.path.join(rootdir, 'settings.conf')
config = configparser.ConfigParser()
config.read(config_path)
host = config.get('RedmineServer', 'h... |
OmkarPathak/Python-Programs | refs/heads/master | OOP/P05_FirstProgramusingOOP.py | 1 | #Author: OMKAR PATHAK
#In this assignment we would see the use of OOP
class MaxSizeList(object):
def __init__(self, value):
self.myList = []
self.value = value
def push(self, String):
try:
String = str(String)
self.myList.append(String)
except ValueError... |
csunny/blog_project | refs/heads/master | source/libs/analysis/src/8_箱形图/homework-lesson8.py | 2 | import numpy as np
import matplotlib.pyplot as plt
np.random.seed(100)
data = np.random.normal(size=(100, 5), loc=0.0, scale=1.0)
labels = ['A','B','C','D','E']
plt.boxplot(data, labels=labels,sym='o',whis=1.25)
plt.show()
|
stevenmizuno/QGIS | refs/heads/master | tests/src/python/test_qgsconditionalstyle.py | 24 |
# -*- coding: utf-8 -*-
"""QGIS Unit tests for the memory layer provider.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later ver... |
janhahne/nest-simulator | refs/heads/master | pynest/nest/tests/test_sp/test_sp_manager.py | 6 | # -*- coding: utf-8 -*-
#
# test_sp_manager.py
#
# This file is part of NEST.
#
# Copyright (C) 2004 The NEST Initiative
#
# NEST 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... |
flar2/ville-bulletproof | refs/heads/master | scripts/build-all.py | 1250 | #! /usr/bin/env python
# Copyright (c) 2009-2011, Code Aurora Forum. 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
# n... |
elemel/drillion | refs/heads/master | drillion/shader.py | 1 | #
# Copyright Tristam Macdonald 2008.
#
# Distributed under the Boost Software License, Version 1.0
# (see http://www.boost.org/LICENSE_1_0.txt)
#
from ctypes import *
from pyglet.gl import *
class Shader:
# vert, frag and geom take arrays of source strings
# the arrays will be concattenated into one string... |
michelts/lettuce | refs/heads/master | tests/integration/lib/Django-1.3/django/contrib/sitemaps/models.py | 914 | # This file intentionally left blank |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.