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
djbaldey/django
tests/utils_tests/test_duration.py
364
1677
import datetime import unittest from django.utils.dateparse import parse_duration from django.utils.duration import duration_string class TestDurationString(unittest.TestCase): def test_simple(self): duration = datetime.timedelta(hours=1, minutes=3, seconds=5) self.assertEqual(duration_string(du...
bsd-3-clause
rbdavid/Wat_diffusion
long_traj.wat_analysis.py
1
8233
#!/mnt/lustre_fs/users/mjmcc/apps/python2.7/bin/python # ---------------------------------------- # USAGE: # ---------------------------------------- # PREAMBLE: import numpy as np from numpy.linalg import * import MDAnalysis from MDAnalysis.analysis.align import * from MDAnalysis.analysis.rms import * import sys imp...
gpl-3.0
markokoleznik/gas-prices
GasPrices.py
1
11085
import urllib.request import json import sqlite3 from datetime import datetime DATE_FORMAT = '%Y-%m-%d' class GasPrices(): def __init__(self, json_dict, type_of_gas, normal = True): self.normal_higher = "normal" if normal else "higher" self.type_of_gas = type_of_gas self.tax_co2 = json_dic...
gpl-2.0
rgommers/statsmodels
statsmodels/distributions/mixture_rvs.py
27
9592
from statsmodels.compat.python import range import numpy as np def _make_index(prob,size): """ Returns a boolean index for given probabilities. Notes --------- prob = [.75,.25] means that there is a 75% chance of the first column being True and a 25% chance of the second column being True. The...
bsd-3-clause
vertoe/p2pool-drk
p2pool/util/switchprotocol.py
280
1194
from twisted.internet import protocol class FirstByteSwitchProtocol(protocol.Protocol): p = None def dataReceived(self, data): if self.p is None: if not data: return serverfactory = self.factory.first_byte_to_serverfactory.get(data[0], self.factory.default_serverfactory) ...
gpl-3.0
pschmitt/home-assistant
homeassistant/components/dynalite/bridge.py
5
3602
"""Code to handle a Dynalite bridge.""" from typing import Any, Callable, Dict, List, Optional from dynalite_devices_lib.dynalite_devices import DynaliteBaseDevice, DynaliteDevices from homeassistant.const import CONF_HOST from homeassistant.core import HomeAssistant, callback from homeassistant.helpers.dispatcher i...
apache-2.0
HuaweiSwitch/ansible
contrib/inventory/rudder.py
195
10674
#!/usr/bin/env python # Copyright (c) 2015, Normation SAS # # Inspired by the EC2 inventory plugin: # https://github.com/ansible/ansible/blob/devel/contrib/inventory/ec2.py # # 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 Publ...
gpl-3.0
waynecoulson/TV-Show-Downloader
cherrypy/_cplogging.py
39
9243
"""CherryPy logging.""" import datetime import logging # Silence the no-handlers "warning" (stderr write!) in stdlib logging logging.Logger.manager.emittedNoHandlerWarning = 1 logfmt = logging.Formatter("%(message)s") import os import sys import cherrypy from cherrypy import _cperror class LogManager(object): ...
gpl-3.0
peterlauri/django
django/contrib/gis/shortcuts.py
66
1227
import zipfile from io import BytesIO from django.conf import settings from django.http import HttpResponse from django.template import loader # NumPy supported? try: import numpy except ImportError: numpy = False def compress_kml(kml): "Returns compressed KMZ from the given KML string." kmz = Bytes...
bsd-3-clause
Chilledheart/chromium
tools/telemetry/third_party/pyserial/serial/serialutil.py
143
20191
#! python # Python Serial Port Extension for Win32, Linux, BSD, Jython # see __init__.py # # (C) 2001-2010 Chris Liechti <cliechti@gmx.net> # this is distributed under a free software license, see license.txt # compatibility for older Python < 2.6 try: bytes bytearray except (NameError, AttributeError): # ...
bsd-3-clause
spartonia/django-oscar
src/oscar/apps/dashboard/orders/forms.py
36
5756
import datetime from django import forms from django.http import QueryDict from django.utils.translation import ugettext_lazy as _ from django.utils.translation import pgettext_lazy from oscar.apps.address.forms import AbstractAddressForm from oscar.core.loading import get_model from oscar.forms.widgets import DatePi...
bsd-3-clause
Godiyos/python-for-android
python3-alpha/python3-src/Doc/includes/test.py
139
3744
"""Test module for the noddy examples Noddy 1: >>> import noddy >>> n1 = noddy.Noddy() >>> n2 = noddy.Noddy() >>> del n1 >>> del n2 Noddy 2 >>> import noddy2 >>> n1 = noddy2.Noddy('jim', 'fulton', 42) >>> n1.first 'jim' >>> n1.last 'fulton' >>> n1.number 42 >>> n1.name() 'jim fulton' >>> n1.first = 'will' >>> n1.n...
apache-2.0
soarpenguin/ansible
contrib/inventory/packet_net.py
42
18166
#!/usr/bin/env python ''' Packet.net external inventory script ================================= Generates inventory that Ansible can understand by making API request to Packet.net using the Packet library. NOTE: This script assumes Ansible is being executed where the environment variable needed for Packet API Token...
gpl-3.0
GDGLima/contentbox
third_party/modeltranslation/settings.py
5
2880
# -*- coding: utf-8 -*- from django.conf import settings from django.core.exceptions import ImproperlyConfigured TRANSLATION_FILES = tuple(getattr(settings, 'MODELTRANSLATION_TRANSLATION_FILES', ())) AVAILABLE_LANGUAGES = getattr(settings, 'MODELTRANSLATION_LANGUAGES', [l[0] for l in se...
apache-2.0
TansyArron/pants
tests/python/pants_test/tasks/test_list_goals.py
12
4084
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (absolute_import, division, generators, nested_scopes, print_function, unicode_literals, with_statement) import pytest from ...
apache-2.0
jandersson/website
lib/werkzeug/urls.py
48
36704
# -*- coding: utf-8 -*- """ werkzeug.urls ~~~~~~~~~~~~~ ``werkzeug.urls`` used to provide several wrapper functions for Python 2 urlparse, whose main purpose were to work around the behavior of the Py2 stdlib and its lack of unicode support. While this was already a somewhat inconvenient situat...
apache-2.0
mdworks2016/work_development
Python/05_FirstPython/Chapter9_WebApp/fppython_develop/lib/python3.7/site-packages/pip/_vendor/html5lib/treebuilders/base.py
56
14579
from __future__ import absolute_import, division, unicode_literals from pip._vendor.six import text_type from ..constants import scopingElements, tableInsertModeElements, namespaces # The scope markers are inserted when entering object elements, # marquees, table cells, and table captions, and are used to prevent for...
apache-2.0
jptrosclair/webpush
src/sync.py
1
3572
import os import sys import hashlib class SyncFolder: def get_hash_path(self, file): if file[0:2] == "./": return os.path.join(self.app.HASH_DIR, file[2:]) return os.path.join(self.app.HASH_DIR, file) def get_hash(self, file): hash = hashlib.sha256() with open(fil...
unlicense
izonder/intellij-community
python/lib/Lib/site-packages/django/db/models/sql/subqueries.py
230
8070
""" Query subclasses which provide extra functionality beyond simple data retrieval. """ from django.core.exceptions import FieldError from django.db import connections from django.db.models.fields import DateField, FieldDoesNotExist from django.db.models.sql.constants import * from django.db.models.sql.datastructures...
apache-2.0
ISIFoundation/influenzanet-website
apps/reminder/management/commands/ensure_reminder_sendable.py
3
1267
from datetime import datetime from optparse import make_option from django.core.management.base import BaseCommand from django.core.mail import send_mail from ...models import get_prev_reminder, get_settings class Command(BaseCommand): help = "Ensure that it's possible to send a reminder, and remind specific peo...
agpl-3.0
scality/cinder
cinder/volume/drivers/netapp/eseries/iscsi_driver.py
4
3747
# Copyright (c) 2014 NetApp, Inc. All Rights Reserved. # Copyright (c) 2015 Alex Meade. All Rights Reserved. # Copyright (c) 2015 Rushil Chugh. All Rights Reserved. # Copyright (c) 2015 Navneet Singh. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use th...
apache-2.0
Ymaril/three.js
utils/converters/fbx/convert_to_threejs.py
213
77684
# @author zfedoran / http://github.com/zfedoran import os import sys import math import operator import re import json import types import shutil # ##################################################### # Globals # ##################################################### option_triangulate = True option_textures = True o...
mit
ForgottenKahz/CloudOPC
venv/Lib/os.py
83
33763
r"""OS routines for NT or Posix depending on what system we're on. This exports: - all functions from posix, nt or ce, e.g. unlink, stat, etc. - os.path is either posixpath or ntpath - os.name is either 'posix', 'nt' or 'ce'. - os.curdir is a string representing the current directory ('.' or ':') - os.pardir...
mit
MinnowBoard/minnow-maker
examples/ip_time.py
2
2405
# Copyright (c) Intel Corporation # All rights reserved # Author: Evan Steele # # 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 # ...
mit
mne-tools/mne-python
mne/viz/tests/test_ica.py
4
15646
# Authors: Denis Engemann <denis.engemann@gmail.com> # Alexandre Gramfort <alexandre.gramfort@inria.fr> # # License: Simplified BSD import os.path as op import numpy as np from numpy.testing import assert_equal, assert_array_equal import pytest import matplotlib.pyplot as plt from mne import (read_events, E...
bsd-3-clause
jvalleroy/plinth-debian
plinth/modules/names/tests/test_names.py
9
3829
# # This file is part of Plinth. # # 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 distribute...
agpl-3.0
ieldib/scaley
scaley/scaley/module/db.py
1
1583
import sys from flask import Flask from flask.ext.sqlalchemy import SQLAlchemy sys.path.insert(0, "../../") from scaley import app app.config['SQLALCHEMY_DATABASE_URI'] = 'sqlite:////scaley/scaley/db/scaley.db' db = SQLAlchemy(app) class CloudConfig(db.Model): uid = db.Column(db.Integer, primary_key=True) a...
gpl-2.0
h4r5h1t/django-hauthy
docs/_ext/ticket_role.py
401
1183
""" An interpreted text role to link docs to Trac tickets. To use: :ticket:`XXXXX` Based on code from psycopg2 by Daniele Varrazzo. """ from docutils import nodes, utils from docutils.parsers.rst import roles def ticket_role(name, rawtext, text, lineno, inliner, options=None, content=None): if options is None: ...
bsd-3-clause
astropy/astropy
astropy/convolution/tests/test_convolve_fft.py
2
32366
# Licensed under a 3-clause BSD style license - see LICENSE.rst import itertools import pytest import numpy as np from numpy.testing import assert_allclose, assert_array_equal, assert_array_almost_equal_nulp from astropy.convolution.convolve import convolve_fft, convolve from astropy.utils.exceptions import AstropyU...
bsd-3-clause
thinkersailor/dshield
srv/www/bin/db_builder.py
1
9071
#!/usr/bin/env python # linked to schema for web.py from xml.etree import ElementTree import os import sqlite3 requests = '..' + os.path.sep + "/etc/signatures.xml" config = '..' + os.path.sep + 'DB' + os.path.sep + 'webserver.sqlite' # honeydb builder - can get database name - so be careful what you name it honeydb...
gpl-2.0
idiom/yatp
tnefparse/util.py
1
1434
"""utility functions """ import logging logger = logging.getLogger("tnef-decode") def bytes_to_int(bytes=None): "transform multi-byte values into integers" n = num = 0 for b in bytes: num += ( ord(b) << n) n += 8 return num def checksum(data): "calculate a checksum for the T...
lgpl-3.0
nycholas/ask-undrgz
src/ask-undrgz/django/contrib/gis/db/models/sql/where.py
309
3938
from django.db.models.fields import Field, FieldDoesNotExist from django.db.models.sql.constants import LOOKUP_SEP from django.db.models.sql.expressions import SQLEvaluator from django.db.models.sql.where import Constraint, WhereNode from django.contrib.gis.db.models.fields import GeometryField class GeoConstraint(Con...
bsd-3-clause
AsgerPetersen/QGIS
python/ext-libs/future/libpasteurize/fixes/fix_raise_.py
70
1225
u"""Fixer for raise E(V).with_traceback(T) to: from future.utils import raise_ ... raise_(E, V, T) TODO: FIXME!! """ from lib2to3 import fixer_base from lib2to3.fixer_util import Comma, Node, Leaf, token, syms class FixRaise(fixer_base.BaseFix): PATTE...
gpl-2.0
cstipkovic/spidermonkey-research
testing/mozbase/mozrunner/mozrunner/devices/emulator_screen.py
5
3566
# This Source Code Form is subject to the terms of the Mozilla Public # License, v. 2.0. If a copy of the MPL was not distributed with this # file, You can obtain one at http://mozilla.org/MPL/2.0/. class EmulatorScreen(object): """Class for screen related emulator commands.""" SO_PORTRAIT_PRIMARY = 'portrait...
mpl-2.0
gauribhoite/personfinder
env/google_appengine/lib/django-1.3/django/contrib/gis/db/backends/spatialite/introspection.py
401
2112
from django.contrib.gis.gdal import OGRGeomType from django.db.backends.sqlite3.introspection import DatabaseIntrospection, FlexibleFieldLookupDict class GeoFlexibleFieldLookupDict(FlexibleFieldLookupDict): """ Sublcass that includes updates the `base_data_types_reverse` dict for geometry field types. ...
apache-2.0
leighpauls/k2cro4
third_party/trace-viewer/third_party/closure_linter/closure_linter/checker.py
135
4808
#!/usr/bin/env python # # Copyright 2007 The Closure Linter 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 #...
bsd-3-clause
sunshinelover/chanlun
vn.trader/ctaAlgo/ctaBacktesting.py
1
34592
# encoding: UTF-8 ''' 本文件中包含的是CTA模块的回测引擎,回测引擎的API和CTA引擎一致, 可以使用和实盘相同的代码进行回测。 ''' from __future__ import division from datetime import datetime, timedelta from collections import OrderedDict from itertools import product import pymongo from ctaBase import * from ctaSetting import * from vtConstant import * from vtGa...
mit
ZhangXinNan/tensorflow
tensorflow/python/estimator/keras_test.py
3
26667
# 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
happyleavesaoc/home-assistant
homeassistant/components/frontend/__init__.py
3
9919
"""Handle the frontend for Home Assistant.""" import asyncio import hashlib import json import logging import os from aiohttp import web from homeassistant.core import callback from homeassistant.const import HTTP_NOT_FOUND from homeassistant.components import api, group from homeassistant.components.http import Home...
apache-2.0
DelazJ/QGIS
scripts/parse_dash_results.py
26
18450
#!/usr/bin/env python3 # -*- coding: utf-8 -*- """ *************************************************************************** parse_dash_results.py --------------------- Date : October 2016 Copyright : (C) 2016 by Nyall Dawson Email : nyall dot dawson at g...
gpl-2.0
affo/nova
nova/api/openstack/compute/contrib/server_diagnostics.py
10
2429
# Copyright 2011 OpenStack Foundation # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless requ...
apache-2.0
tectronics/wifite
wifite.py
56
98589
#!/usr/bin/python # -*- coding: utf-8 -*- """ wifite author: derv82 at gmail Licensed under the GNU General Public License Version 2 (GNU GPL v2), available at: http://www.gnu.org/licenses/gpl-2.0.txt (C) 2011 Derv Merkler ----------------- TODO: ignore root check when -cracked (afterward) (nee...
gpl-2.0
ampax/edx-platform
lms/djangoapps/course_wiki/tests/test_middleware.py
134
1508
""" Tests for wiki middleware. """ from django.test.client import Client from nose.plugins.attrib import attr from wiki.models import URLPath from xmodule.modulestore.tests.django_utils import ModuleStoreTestCase from xmodule.modulestore.tests.factories import CourseFactory from courseware.tests.factories import Ins...
agpl-3.0
XianliangJ/collections
Jellyfish/pox/pox/messenger/messenger.py
5
10702
# Copyright 2011 James McCauley # # This file is part of POX. # # POX 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. # # POX is distri...
gpl-3.0
Ilyes-Hammadi/awesome-app
config/wsgi.py
1
1938
""" WSGI config for awesome-app project. This module contains the WSGI application used by Django's development server and any production WSGI deployments. It should expose a module-level variable named ``application``. Django's ``runserver`` and ``runfcgi`` commands discover this application via the ``WSGI_APPLICATIO...
mit
dstanek/keystone
keystone/tests/unit/backend/core_sql.py
10
1897
# Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under t...
apache-2.0
nareshgundla/HiBench
bin/functions/test_load_config.py
6
16084
import unittest import os import load_config import mock import fnmatch import re import glob def print_hint_seperator(hint): print("\n" + hint) print("--------------------------------") def run_test(test_case): suite = unittest.TestLoader().loadTestsFromTestCase(test_case) unittest.TextTestRunner(v...
apache-2.0
FireballDWF/cloud-custodian
tools/c7n_mailer/tests/test_ldap.py
5
7118
# Copyright 2017 Capital One Services, 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 agreed to in...
apache-2.0
ljnutal6/media-recommend
app/virtualenvs/recommedia/lib/python2.7/site-packages/flask/templating.py
783
4707
# -*- coding: utf-8 -*- """ flask.templating ~~~~~~~~~~~~~~~~ Implements the bridge to Jinja2. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import posixpath from jinja2 import BaseLoader, Environment as BaseEnvironment, \ TemplateNotFound from .glo...
gpl-2.0
cfg2015/EPT-2015-2
addons/l10n_multilang/__init__.py
438
1082
# -*- 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
johankaito/fufuka
microblog/flask/venv/lib/python2.7/site-packages/scipy/signal/tests/test_peak_finding.py
108
10955
from __future__ import division, print_function, absolute_import import copy import numpy as np from numpy.testing import (TestCase, run_module_suite, assert_equal, assert_array_equal, assert_) from scipy.signal._peak_finding import (argrelmax, argrelmin, find_peaks_cwt, _identify_ridge_lines) from scipy._lib...
apache-2.0
matt-42/vpp
evaluation/semi_dense_optical_flow/pareto_KITTI.py
2
1945
import sys import numpy as np import gpof from gpof.strategies import GradientDescentConfig from gpof.strategies import Runner from gpof.runset import RunSet from gpof.strategies import RV # For each given FAST9 detection, look for the pareto front for the two objectives : # computational time and percentage of error...
mit
LeroViten/LerNex-Ancora-Kernel
tools/perf/scripts/python/netdev-times.py
11271
15048
# Display a process of packets and processed time. # It helps us to investigate networking or network device. # # options # tx: show only tx chart # rx: show only rx chart # dev=: show only thing related to specified device # debug: work with debug mode. It shows buffer status. import os import sys sys.path.append(os...
gpl-2.0
HydraChain/hydrachain
hydrachain/consensus/manager.py
2
25852
# Copyright (c) 2015 Heiko Hees import sys import rlp from .base import LockSet, Vote, VoteBlock, VoteNil, Signed, Ready from .base import BlockProposal, VotingInstruction, DoubleVotingError, InvalidVoteError from .base import Block, Proposal, HDCBlockHeader, InvalidProposalError from .protocol import HDCProtocol from ...
mit
StrellaGroup/erpnext
erpnext/templates/pages/rfq.py
8
2722
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe from frappe import _ from frappe.utils import formatdate from erpnext.controllers.website_list_for_contact import get_customers_suppliers ...
gpl-3.0
LChristakis/chalice-hunter
lib/python3.4/site-packages/scss/compiler.py
1
59440
from __future__ import absolute_import from __future__ import print_function from __future__ import unicode_literals from __future__ import division from collections import defaultdict from enum import Enum import logging from pathlib import Path import re import sys import warnings try: from collections import O...
mit
OndrejSlamecka/mincuts
tools/graph6_to_csv.py
1
2363
#!/usr/bin/env python3 import sys """ Parsing graph6 format """ # Graph6 parser is from the NetworkX project which is governed by the # BSD license For full license info see # https://networkx.github.io/documentation/latest/reference/legal.html # https://networkx.github.io/documentation/latest/_modules/networkx/readwr...
mit
gdm/easyengine
ee/core/aptget.py
5
8127
"""EasyEngine package installation using apt-get module.""" import apt import apt_pkg import sys import subprocess from ee.core.logging import Log from ee.core.apt_repo import EERepo from sh import apt_get from sh import ErrorReturnCode class EEAptGet(): """Generic apt-get intialisation""" def update(self): ...
mit
Deepakkothandan/ansible
lib/ansible/modules/cloud/vmware/vmware_dvs_host.py
29
8384
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2015, Joseph Callen <jcallen () csc.com> # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
gpl-3.0
foss-transportationmodeling/rettina-server
flask/local/lib/python2.7/site-packages/flask/testsuite/subclassing.py
563
1214
# -*- coding: utf-8 -*- """ flask.testsuite.subclassing ~~~~~~~~~~~~~~~~~~~~~~~~~~~ Test that certain behavior of flask can be customized by subclasses. :copyright: (c) 2011 by Armin Ronacher. :license: BSD, see LICENSE for more details. """ import flask import unittest from logging import Str...
apache-2.0
romankagan/DDBWorkbench
python/lib/Lib/site-packages/django/contrib/sites/managers.py
491
1985
from django.conf import settings from django.db import models from django.db.models.fields import FieldDoesNotExist class CurrentSiteManager(models.Manager): "Use this to limit objects to those associated with the current site." def __init__(self, field_name=None): super(CurrentSiteManager, self).__ini...
apache-2.0
wolverine2k/Secure-Deluge
deluge/plugins/label/label/test.py
14
2425
#!/usr/bin/env python # -*- coding: utf-8 -*- # # Copyright (C) Martijn Voncken 2008 <mvoncken@gmail.com> # # 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, or (at your option) ...
gpl-3.0
kogotko/carburetor
openstack_dashboard/dashboards/identity/mappings/views.py
3
3492
# Copyright (C) 2015 Yahoo! Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law...
apache-2.0
cevaris/commons
tests/python/twitter/common/dirutil/lock_test.py
15
3043
# ================================================================================================== # Copyright 2012 Twitter, Inc. # -------------------------------------------------------------------------------------------------- # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use thi...
apache-2.0
akabos/python-django-djapian
src/djapian/tests/common.py
2
2572
import os from djapian import Field from djapian.tests.utils import BaseTestCase, BaseIndexerTest, Entry, Person from djapian.models import Change from django.utils.encoding import force_unicode class IndexerTest(BaseTestCase): def test_fields_count(self): self.assertEqual(len(Entry.indexer.fields), 1) ...
bsd-3-clause
CyanogenMod/android_external_chromium_org
components/test/data/password_manager/environment.py
8
11615
# 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. """The testing Environment class.""" import logging import shutil import time from selenium import webdriver from selenium.common.exceptions import NoSuchE...
bsd-3-clause
mdublin/Brightcove-Dynamic-Ingest-App
ENV/lib/python2.7/site-packages/requests/packages/charade/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...
mit
f0rki/cb-multios
original-challenges/CableGrindLlama/support/pov/machine.py
1
5444
#!/usr/bin/env python # # Copyright (C) 2014 # Brian Caswell <bmc@lungetech.com> # Narf Industries <info@narfindustries.com> # # 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 res...
mit
UQComputingSociety/codegolf
codegolf/user/views.py
1
2567
""" Views for the User model. """ import functools from flask import Blueprint, render_template, url_for, redirect from flask_oauthlib.client import OAuth from flask_oauthlib.contrib.apps import github from flask_login import login_required, current_user, login_user, logout_user from codegolf import login_manager, app ...
mit
ricardaw/pismdev
examples/ross/prognostic/preprocess_prog.py
5
7797
#!/usr/bin/env python # Import all necessary modules here so that if it fails, it fails early. try: import netCDF4 as NC except: import netCDF3 as NC import subprocess import numpy as np import os smb_name = "climatic_mass_balance" temp_name = "ice_surface_temp" def run(commands): """Run a list of comm...
gpl-2.0
kernel-sanders/arsenic-mobile
Dependencies/Twisted-13.0.0/doc/core/examples/ptyserv.py
1
1240
# Copyright (c) Twisted Matrix Laboratories # See LICENSE for details """ A PTY server that spawns a shell upon connection. Run this example by typing in: > python ptyserv.py Telnet to the server once you start it by typing in: > telnet localhost 5823 """ from twisted.internet import reactor, protocol class FakeT...
gpl-3.0
DMSC-Instrument-Data/lewis
test/test_control_server.py
2
11033
# -*- coding: utf-8 -*- # ********************************************************************* # lewis - a library for creating hardware device simulators # Copyright (C) 2016-2017 European Spallation Source ERIC # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU G...
gpl-3.0
szhu/SublimePythonIDE
server/lib/python3/rope/base/resources.py
32
6220
import os import re import rope.base.change import rope.base.fscommands from rope.base import exceptions class Resource(object): """Represents files and folders in a project""" def __init__(self, project, path): self.project = project self._path = path def move(self, new_location): ...
gpl-2.0
pbmanis/acq4
acq4/pyqtgraph/graphicsItems/GraphicsLayout.py
42
6495
from ..Qt import QtGui, QtCore from .. import functions as fn from .GraphicsWidget import GraphicsWidget ## Must be imported at the end to avoid cyclic-dependency hell: from .ViewBox import ViewBox from .PlotItem import PlotItem from .LabelItem import LabelItem __all__ = ['GraphicsLayout'] class GraphicsLayout(Graphic...
mit
eyohansa/django
django/contrib/postgres/forms/array.py
258
6743
import copy from django import forms from django.contrib.postgres.validators import ( ArrayMaxLengthValidator, ArrayMinLengthValidator, ) from django.core.exceptions import ValidationError from django.utils import six from django.utils.safestring import mark_safe from django.utils.translation import string_concat,...
bsd-3-clause
arnaud-morvan/QGIS
tests/src/python/test_qgshighlight.py
21
2969
# -*- coding: utf-8 -*- """QGIS Unit tests for QgsHighlight. .. 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 version. """ __au...
gpl-2.0
ycaihua/kbengine
kbe/res/scripts/common/Lib/test/test_http_cookiejar.py
84
71684
"""Tests for http/cookiejar.py.""" import os import re import test.support import time import unittest import urllib.request from http.cookiejar import (time2isoz, http2time, iso2time, time2netscape, parse_ns_headers, join_header_words, split_header_words, Cookie, CookieJar, DefaultCookiePolicy, LWPCookieJa...
lgpl-3.0
mou4e/zirconium
third_party/typ/typ/tests/printer_test.py
84
1900
# Copyright 2014 Dirk Pranke. All rights reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or a...
bsd-3-clause
brion/ffmpeg2theora
scons-tools/crossmingw.py
3
6191
# # Copyright (c) 2001, 2002, 2003, 2004 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 use, copy, mo...
gpl-2.0
BartoszCichecki/onlinepython
onlinepython/pypy-2.4.0-win32/lib-python/2.7/test/crashers/nasty_eq_vs_dict.py
168
1046
# from http://mail.python.org/pipermail/python-dev/2001-June/015239.html # if you keep changing a dictionary while looking up a key, you can # provoke an infinite recursion in C # At the time neither Tim nor Michael could be bothered to think of a # way to fix it. class Yuck: def __init__(self): self.i =...
gpl-2.0
belokop/indico_bare
indico/modules/oauth/provider.py
2
4681
# This file is part of Indico. # Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN). # # Indico 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 (a...
gpl-3.0
osm-fr/osmose-backend
modules/OsmOsisManager.py
3
21793
#-*- coding: utf-8 -*- ########################################################################### ## ## ## Copyrights Etienne Chové <chove@crans.org> 2009 ## ## ...
gpl-3.0
aruizramon/alec_erpnext
erpnext/selling/doctype/sales_order/sales_order.py
3
21957
# Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors # License: GNU General Public License v3. See license.txt from __future__ import unicode_literals import frappe import json import frappe.utils from frappe.utils import cstr, flt, getdate, comma_and, cint from frappe import _ from frappe.model.mapper...
agpl-3.0
alikins/ansible
lib/ansible/module_utils/k8s/scale.py
30
8921
# # Copyright 2018 Red Hat | Ansible # # 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. # # ...
gpl-3.0
carletes/libcloud
libcloud/test/common/test_aws.py
26
11176
import sys import unittest from datetime import datetime import mock from libcloud.common.aws import SignedAWSConnection from libcloud.common.aws import AWSRequestSignerAlgorithmV4 from libcloud.test import LibcloudTestCase class EC2MockDriver(object): region_name = 'my_region' class AWSRequestSignerAlgorithm...
apache-2.0
aguijarro/DataSciencePython
DataWrangling/extracting_data_xml.py
1
2197
#!/usr/bin/env python # Your task here is to extract data from xml on authors of an article # and add it to a list, one item for an author. # See the provided data structure for the expected format. # The tags for first name, surname and email should map directly # to the dictionary keys import xml.etree.ElementTree as...
mit
marionleborgne/nupic.research
htmresearch/data/sm_sequences.py
19
14830
#! /usr/bin/env python # ---------------------------------------------------------------------- # Copyright (C) 2010, Numenta Inc. All rights reserved. # # The information and source code contained herein is the # exclusive property of Numenta Inc. No part of this software # may be used, reproduced, stored or distr...
agpl-3.0
benschmaus/catapult
third_party/gsutil/third_party/pyasn1-modules/pyasn1_modules/rfc5208.py
132
1300
# # PKCS#8 syntax # # ASN.1 source from: # http://tools.ietf.org/html/rfc5208 # # Sample captures could be obtained with "openssl pkcs8 -topk8" command # from pyasn1.type import tag, namedtype, namedval, univ, constraint from pyasn1_modules.rfc2459 import * from pyasn1_modules import rfc2251 class KeyEncryptionAlgorit...
bsd-3-clause
ljwolf/spvcm
spvcm/tests/test_trace.py
1
5417
import numpy as np import pandas as pd from spvcm.abstracts import Hashmap, Trace import unittest as ut from spvcm._constants import RTOL, ATOL import os FULL_PATH = os.path.dirname(os.path.abspath(__file__)) class Test_Trace(ut.TestCase): def setUp(self): self.a = {chr(i+97):list(range(10)) for i in ran...
mit
nejads/carreg
carreg_app/views.py
2
2642
from django.http import HttpResponse from rest_framework import generics, permissions, status, response, views from rest_framework.authtoken.models import Token from rest_framework.views import APIView from rest_framework.response import Response from rest_framework.response import Response import djoser from djoser i...
mit
ydm/fablocks
container/settings.py
1
2247
""" Django settings for container project. For more information on this file, see https://docs.djangoproject.com/en/1.7/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.7/ref/settings/ """ # Build paths inside the project like this: os.path.join(BASE_DIR, ...) ...
lgpl-3.0
franziz/arcrawler
lib/proxy_switcher.py
1
1920
from selenium import webdriver from pymongo import MongoClient from subprocess import call import selenium import random import time import arrow class ProxySwitcher(object): def get_proxy(self): conn = MongoClient("mongodb://mongo:27017/proxies") db = conn["proxies"] success = False while not success: ...
gpl-3.0
eHealthAfrica/rapidpro
temba/contacts/migrations/0052_baseexporttask_2.py
3
1490
# -*- coding: utf-8 -*- # Generated by Django 1.10.5 on 2017-02-15 06:57 from __future__ import unicode_literals from django.db import migrations, models from django.db.models import Case, Value, When from temba.utils.models import generate_uuid def populate_export_status(apps, schema_editor): ExportContactsTask...
agpl-3.0
coursemdetw/2014c2
exts/wsgi/static/Brython2.1.0-20140419-113919/Lib/_dummy_thread.py
742
4769
"""Drop-in replacement for the thread module. Meant to be used as a brain-dead substitute so that threaded code does not need to be rewritten for when the thread module is not present. Suggested usage is:: try: import _thread except ImportError: import _dummy_thread as _thread """ # Exports ...
gpl-2.0
angelapper/edx-platform
common/test/acceptance/tests/lms/test_bookmarks.py
6
23402
# -*- coding: utf-8 -*- """ End-to-end tests for the courseware unit bookmarks. """ import json import requests from nose.plugins.attrib import attr from common.test.acceptance.fixtures.course import CourseFixture, XBlockFixtureDesc from common.test.acceptance.pages.common import BASE_URL from common.test.acceptance....
agpl-3.0
OCA/vertical-medical
medical_medication/models/medical_medication_dosage.py
1
1459
# -*- coding: utf-8 -*- # ############################################################################# # # Copyright 2008 Luis Falcon <lfalcon@gnusolidario.org> # # 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...
gpl-3.0
mattstep/ansible
v1/tests/TestModuleUtilsBasic.py
103
13009
import os import tempfile import unittest from nose.tools import raises from nose.tools import timed from ansible import errors from ansible.module_common import ModuleReplacer from ansible.module_utils.basic import heuristic_log_sanitize from ansible.utils import checksum as utils_checksum TEST_MODULE_DATA = """ fr...
gpl-3.0
bikash/h2o-dev
py2/testdir_single_jvm/test_summary2_NY0.py
21
4587
import unittest, time, sys, random, math, getpass sys.path.extend(['.','..','../..','py']) import h2o2 as h2o import h2o_cmd, h2o_import as h2i, h2o_util, h2o_print as h2p def write_syn_dataset(csvPathname, rowCount, colCount, SEED, choices): r1 = random.Random(SEED) dsf = open(csvPathname, "w+") naCnt = ...
apache-2.0
jnewland/home-assistant
tests/components/nuheat/test_climate.py
7
8422
"""The test for the NuHeat thermostat module.""" import unittest from unittest.mock import Mock, patch from tests.common import get_test_home_assistant from homeassistant.components.climate.const import ( SUPPORT_HOLD_MODE, SUPPORT_OPERATION_MODE, SUPPORT_TARGET_TEMPERATURE, STATE_HEAT, STATE_IDLE)...
apache-2.0
pdellaert/ansible
test/units/modules/network/netvisor/test_pn_stp_port.py
23
1904
# Copyright: (c) 2018, Pluribus Networks # 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 from units.compat.mock import patch from ansible.modules.network.netvisor import pn_stp_port fro...
gpl-3.0