repo_name
stringlengths
6
100
path
stringlengths
4
294
copies
stringlengths
1
5
size
stringlengths
4
6
content
stringlengths
606
896k
license
stringclasses
15 values
bartaelterman/marshmallow
tests/test_deserialization.py
3
43527
# -*- coding: utf-8 -*- import datetime as dt import uuid import decimal import pytest from marshmallow import fields, utils, Schema, validates from marshmallow.exceptions import ValidationError from marshmallow.compat import text_type, basestring from tests.base import ( assert_almost_equal, assert_date_equ...
mit
laperry1/android_external_chromium_org
third_party/markdown/extensions/nl2br.py
109
2625
# markdown is released under the BSD license # Copyright 2007, 2008 The Python Markdown Project (v. 1.7 and later) # Copyright 2004, 2005, 2006 Yuri Takhteyev (v. 0.2-1.6b) # Copyright 2004 Manfred Stienstra (the original version) # # All rights reserved. # # Redistribution and use in source and binary forms, with or...
bsd-3-clause
WhireCrow/openwrt-mt7620
staging_dir/host/lib/python2.7/idlelib/UndoDelegator.py
90
10277
import string from Tkinter import * from idlelib.Delegator import Delegator #$ event <<redo>> #$ win <Control-y> #$ unix <Alt-z> #$ event <<undo>> #$ win <Control-z> #$ unix <Control-z> #$ event <<dump-undo-state>> #$ win <Control-backslash> #$ unix <Control-backslash> class UndoDelegator(Delegator): max_und...
gpl-2.0
ojengwa/Bookie
bookie/tests/factory.py
1
2651
"""Provide tools for generating objects for testing purposes.""" from datetime import datetime from random import randint import random import string from bookie.models import DBSession from bookie.models import Bmark from bookie.models import Tag from bookie.models.applog import AppLog from bookie.models.auth import ...
agpl-3.0
shaistaansari/django
tests/reverse_lookup/tests.py
326
1675
from __future__ import unicode_literals from django.core.exceptions import FieldError from django.test import TestCase from .models import Choice, Poll, User class ReverseLookupTests(TestCase): def setUp(self): john = User.objects.create(name="John Doe") jim = User.objects.create(name="Jim Bo")...
bsd-3-clause
alxgu/ansible
lib/ansible/modules/notification/syslogger.py
38
4836
#!/usr/bin/python # Copyright (c) 2017 Tim Rightnour <thegarbledone@gmail.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
a9261/jieba
jieba/analyse/textrank.py
57
3491
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import, unicode_literals import sys from operator import itemgetter from collections import defaultdict import jieba.posseg from .tfidf import KeywordExtractor from .._compat import * class UndirectWeightedGraph: d = 0.85 def __in...
mit
Frenzie/youtube-dl
youtube_dl/extractor/nuvid.py
127
2665
from __future__ import unicode_literals import re from .common import InfoExtractor from ..compat import ( compat_urllib_request, ) from ..utils import ( parse_duration, unified_strdate, ) class NuvidIE(InfoExtractor): _VALID_URL = r'https?://(?:www|m)\.nuvid\.com/video/(?P<id>[0-9]+)' _TEST = {...
unlicense
yangleo/cloud-github
openstack_dashboard/dashboards/project/instances/workflows/resize_instance.py
56
4103
# Copyright 2013 CentRin Data, Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance with the License. You may obtain # a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or...
apache-2.0
Jasonmk47/OpenWPM
automation/Proxy/mitm_commands.py
1
4714
# This module parses MITM Proxy requests/responses into (command, data pairs) # This should mean that the MITMProxy code should simply pass the messages + its own data to this module from urlparse import urlparse import datetime import mmh3 import json import zlib import os def encode_to_unicode(msg): """ Tri...
gpl-3.0
boomsbloom/dtm-fmri
DTM/for_gensim/lib/python2.7/site-packages/functools32/functools32.py
23
16101
"""functools.py - Tools for working with functions and callable objects """ # Python module wrapper for _functools C module # to allow utilities written in Python to be added # to the functools module. # Written by Nick Coghlan <ncoghlan at gmail.com> # and Raymond Hettinger <python at rcn.com> # Copyright (C) 2006-2...
mit
adoosii/edx-platform
common/lib/xmodule/xmodule/split_test_module.py
57
29758
""" Module for running content split tests """ import logging import json from webob import Response from uuid import uuid4 from operator import itemgetter from xmodule.progress import Progress from xmodule.seq_module import SequenceDescriptor from xmodule.studio_editable import StudioEditableModule, StudioEditableDe...
agpl-3.0
liu602348184/django
django/core/management/commands/dumpdata.py
305
8545
from collections import OrderedDict from django.apps import apps from django.core import serializers from django.core.management.base import BaseCommand, CommandError from django.db import DEFAULT_DB_ALIAS, router class Command(BaseCommand): help = ("Output the contents of the database as a fixture of the given ...
bsd-3-clause
Sharecare/cyclops
app/httpreq.py
1
4917
import urllib import urllib2 import urlparse import socket import time import json import sys import logging logger = logging.getLogger(__name__) import pprint pp = pprint.PrettyPrinter(indent=4) # we need to make sure we don't follow redirects so build a new opener class NoRedirection(urllib2.HTTPErrorProcessor): ...
apache-2.0
blacklin/kbengine
kbe/src/lib/python/Lib/distutils/errors.py
152
3577
"""distutils.errors Provides exceptions used by the Distutils modules. Note that Distutils modules may raise standard exceptions; in particular, SystemExit is usually raised for errors that are obviously the end-user's fault (eg. bad command-line arguments). This module is safe to use in "from ... import *" mode; it...
lgpl-3.0
bastimeyer/streamlink
src/streamlink/plugins/animelab.py
4
3686
from __future__ import print_function import re from pprint import pprint from streamlink.plugin import Plugin, PluginArguments, PluginArgument from streamlink.plugin.api import validate from streamlink.stream import HTTPStream from streamlink.utils import parse_json class AnimeLab(Plugin): url_re = re.compile(r...
bsd-2-clause
jiaphuan/models
research/astronet/astronet/astro_model/astro_model.py
1
10261
# Copyright 2018 The TensorFlow Authors. # # 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 ...
apache-2.0
AnimeshSinha1309/WebsiteEdunet
WebsiteEdunet/env/Lib/site-packages/django/contrib/gis/db/backends/postgis/const.py
528
1484
""" PostGIS to GDAL conversion constant definitions """ # Lookup to convert pixel type values from GDAL to PostGIS GDAL_TO_POSTGIS = [None, 4, 6, 5, 8, 7, 10, 11, None, None, None, None] # Lookup to convert pixel type values from PostGIS to GDAL POSTGIS_TO_GDAL = [1, 1, 1, 3, 1, 3, 2, 5, 4, None, 6, 7, None, None] # ...
mit
rossburton/yocto-autobuilder
lib/python2.7/site-packages/buildbot_slave-0.8.8-py2.7.egg/buildslave/commands/utils.py
4
3936
# This file is part of Buildbot. Buildbot 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, version 2. # # This program is distributed in the hope that it will be useful, but WITHOUT # ANY WARRANTY; without eve...
gpl-2.0
gonboy/sl4a
python/gdata/tests/gdata_tests/apps/service_test_using_mock.py
87
2144
#!/usr/bin/python # # Copyright (C) 2007 SIOS Technology, 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 appli...
apache-2.0
mjgrav2001/scikit-learn
sklearn/neighbors/graph.py
208
7031
"""Nearest Neighbors graph functions""" # Author: Jake Vanderplas <vanderplas@astro.washington.edu> # # License: BSD 3 clause (C) INRIA, University of Amsterdam import warnings from .base import KNeighborsMixin, RadiusNeighborsMixin from .unsupervised import NearestNeighbors def _check_params(X, metric, p, metric_...
bsd-3-clause
polyaxon/polyaxon
sdks/python/http_client/v1/polyaxon_sdk/models/v1_k8s_resource_type.py
1
5346
#!/usr/bin/python # # Copyright 2018-2021 Polyaxon, 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 ...
apache-2.0
0x7678/youtube-dl
test/test_compat.py
24
1451
#!/usr/bin/env python # coding: utf-8 from __future__ import unicode_literals # Allow direct execution import os import sys import unittest sys.path.insert(0, os.path.dirname(os.path.dirname(os.path.abspath(__file__)))) from youtube_dl.utils import get_filesystem_encoding from youtube_dl.compat import ( compat_...
unlicense
UNINETT/nav
python/nav/web/netmap/common.py
2
4660
# # Copyright (C) 2012 Uninett AS # # This file is part of Network Administration Visualized (NAV). # # NAV 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 hope...
gpl-2.0
erickt/hue
desktop/core/ext-py/guppy-0.1.10/guppy/gsl/Gsml.py
37
2658
#._cv_part guppy.gsl.Gsml class GsmlHandler: # To be mixed in with something like HTMLParser.HTMLParser def handle_starttag(self, tag, attrs): # print 'starttag', tag, attrs self.stack.append(self.out) self.out = [] if attrs: at = [] for k, v in attrs: at.append(self.mod.node_of_taci(k, v)) ...
apache-2.0
pawelmhm/splash
splash/network_manager.py
1
17016
# -*- coding: utf-8 -*- from __future__ import absolute_import import base64 import itertools import functools from datetime import datetime import traceback from PyQt5.QtCore import QByteArray, QTimer from PyQt5.QtNetwork import ( QNetworkAccessManager, QNetworkProxyQuery, QNetworkRequest, QNetworkRe...
bsd-3-clause
haripradhan/MissionPlanner
Lib/anydbm.py
59
2748
"""Generic interface to all dbm clones. Instead of import dbm d = dbm.open(file, 'w', 0666) use import anydbm d = anydbm.open(file, 'w') The returned object is a dbhash, gdbm, dbm or dumbdbm object, dependent on the type of database being opened (determined by whichdb ...
gpl-3.0
spisneha25/django
tests/transaction_hooks/tests.py
288
6402
from django.db import connection, transaction from django.test import TransactionTestCase, skipUnlessDBFeature from .models import Thing class ForcedError(Exception): pass class TestConnectionOnCommit(TransactionTestCase): """ Tests for transaction.on_commit(). Creation/checking of database object...
bsd-3-clause
cobrab11/blacksmith-2
expansions/info/insc.py
3
1533
# coding: utf-8 if DefLANG in ("RU", "UA"): AnsBase_temp = tuple([line.decode("utf-8") for line in ( "Сегодня здесь было %s юзеров:\n%s\n+ ещё %s до сих пор здесь.", # 0 "Сегодня при мне ещё никто не выходил, все кто был, до сих пор здесь.", # 1 "При мне заходило %s юзеров:\n%s", # 2 "Здесь было %s юзеров:\n%...
apache-2.0
aam-at/tensorflow
tensorflow/python/kernel_tests/embedding_ops_test.py
5
47158
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
atosorigin/ansible
test/lib/ansible_test/_data/sanity/import/importer.py
17
19352
#!/usr/bin/env python """Import the given python module(s) and report error(s) encountered.""" from __future__ import (absolute_import, division, print_function) __metaclass__ = type def main(): """ Main program function used to isolate globals from imported code. Changes to globals in imported modules on...
gpl-3.0
imacube/python-beaver
beaver/utils.py
3
7568
# -*- coding: utf-8 -*- import argparse import glob2 import itertools import logging import platform import re import os import sys import beaver logging.basicConfig() MAGIC_BRACKETS = re.compile('({([^}]+)})') IS_GZIPPED_FILE = re.compile('.gz$') REOPEN_FILES = 'linux' not in platform.platform().lower() CAN_DAEMONI...
mit
stephendade/MAVProxy
MAVProxy/modules/lib/wxconsole.py
6
3609
#!/usr/bin/env python """ MAVProxy message console, implemented in a child process """ import threading import sys, time from MAVProxy.modules.lib.wxconsole_util import Value, Text from MAVProxy.modules.lib import textconsole from MAVProxy.modules.lib import win_layout from MAVProxy.modules.lib import multiproc cl...
gpl-3.0
nathanial/lettuce
tests/integration/lib/Django-1.3/tests/modeltests/ordering/tests.py
92
4309
from datetime import datetime from operator import attrgetter from django.test import TestCase from models import Article class OrderingTests(TestCase): def test_basic(self): a1 = Article.objects.create( headline="Article 1", pub_date=datetime(2005, 7, 26) ) a2 = Article.obje...
gpl-3.0
jesmorc/Proyecto-IV
lib/python2.7/site-packages/setuptools/depends.py
410
6221
from __future__ import generators import sys, imp, marshal from imp import PKG_DIRECTORY, PY_COMPILED, PY_SOURCE, PY_FROZEN from distutils.version import StrictVersion, LooseVersion __all__ = [ 'Require', 'find_module', 'get_module_constant', 'extract_constant' ] class Require: """A prerequisite to building o...
gpl-2.0
mirastu/google-blog-converters-appengine
src/livejournal2blogger/lj2b.py
30
18135
#!/usr/bin/python2.4 # Copyright 2008 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0.txt # # Unless required by applicable law or ...
apache-2.0
grammarly/browser-extensions
firefox/addon-sdk/python-lib/mozrunner/__init__.py
36
27264
# 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/. import os import sys import copy import tempfile import signal import commands import zipfile import optparse import kil...
bsd-3-clause
alexallah/django
django/core/files/base.py
34
4984
import os from io import BytesIO, StringIO, UnsupportedOperation from django.core.files.utils import FileProxyMixin class File(FileProxyMixin): DEFAULT_CHUNK_SIZE = 64 * 2 ** 10 def __init__(self, file, name=None): self.file = file if name is None: name = getattr(file, 'name', No...
bsd-3-clause
sdaftuar/bitcoin
contrib/devtools/symbol-check.py
113
6194
#!/usr/bin/env python # Copyright (c) 2014 Wladimir J. van der Laan # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. ''' A script to check that the (Linux) executables produced by gitian only contain allowed gcc, glibc and libstdc++...
mit
SEJeff/aurproxy
tellapart/aurproxytest/source/sources/static.py
3
1440
# Copyright 2015 TellApart, 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 writi...
apache-2.0
mefly2012/platform
src/clean_validate/zyktgg.py
1
1453
# -*- coding: utf-8 -*- import sys reload(sys) sys.setdefaultencoding('utf-8') from common import public class zyktgg(): """开庭公告""" need_check_ziduan = ['main', 'city', 'bbd_dotime', 'title' ] def check_...
apache-2.0
mm112287/2015cda-24
static/Brython3.1.1-20150328-091302/Lib/unittest/test/testmock/testmagicmethods.py
737
12145
import unittest import inspect import sys from unittest.mock import Mock, MagicMock, _magics class TestMockingMagicMethods(unittest.TestCase): def test_deleting_magic_methods(self): mock = Mock() self.assertFalse(hasattr(mock, '__getitem__')) mock.__getitem__ = Mock() self.asser...
gpl-3.0
capturePointer/scylla
configure.py
10
31160
#!/usr/bin/python3 # # Copyright 2015 Cloudius Systems # # # This file is part of Scylla. # # Scylla 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 optio...
agpl-3.0
hungtt57/matchmaker
lib/python2.7/site-packages/django/conf/urls/__init__.py
45
3340
from importlib import import_module import warnings from django.core.urlresolvers import (RegexURLPattern, RegexURLResolver, LocaleRegexURLResolver) from django.core.exceptions import ImproperlyConfigured from django.utils import six from django.utils.deprecation import RemovedInDjango110Warning __all__ = ['hand...
mit
SuminAndrew/tornado
maint/circlerefs/circlerefs.py
6
2868
#!/usr/bin/env python """Test script to find circular references. Circular references are not leaks per se, because they will eventually be GC'd. However, on CPython, they prevent the reference-counting fast path from being used and instead rely on the slower full GC. This increases memory footprint and CPU overhead, ...
apache-2.0
libvirt/libvirt-test-API
libvirttestapi/repos/domain/save.py
1
2922
# Copyright (C) 2010-2012 Red Hat, Inc. # This work is licensed under the GNU GPLv2 or later. # Save domain as a statefile import os import libvirt from libvirt import libvirtError from libvirttestapi.src import sharedmod from libvirttestapi.utils import utils required_params = ('guestname', 'filepath',) optional_p...
gpl-2.0
ovresko/erpnext
erpnext/erpnext_integrations/connectors/shopify_connection.py
8
9495
from __future__ import unicode_literals import frappe from frappe import _ import json from frappe.utils import cstr, cint, nowdate, flt from erpnext.erpnext_integrations.utils import validate_webhooks_request from erpnext.selling.doctype.sales_order.sales_order import make_delivery_note, make_sales_invoice from erpnex...
gpl-3.0
franosincic/edx-platform
common/test/acceptance/pages/lms/course_nav.py
8
7968
""" Course navigation page object """ import re from bok_choy.page_object import PageObject from bok_choy.promise import EmptyPromise class CourseNavPage(PageObject): """ Navigate sections and sequences in the courseware. """ url = None def is_browser_on_page(self): return self.q(css='d...
agpl-3.0
noelevans/sandpit
fivethiryeight/riddler_casino.py
1
1180
""" Suppose a casino invents a new game that you must pay $250 to play. The game works like this: The casino draws random numbers between 0 and 1, from a uniform distribution. It adds them together until their sum is greater than 1, at which time it stops drawing new numbers. You get a payout of $100 each time a new nu...
mit
stoku/linux-3.6.11-ab
tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/SchedGui.py
12980
5411
# SchedGui.py - Python extension for perf script, basic GUI code for # traces drawing and overview. # # Copyright (C) 2010 by Frederic Weisbecker <fweisbec@gmail.com> # # This software is distributed under the terms of the GNU General # Public License ("GPL") version 2 as published by the Free Software # Foundation. ...
gpl-2.0
ondys/three.js
utils/exporters/blender/addons/io_three/exporter/api/object.py
33
19205
import math import mathutils import bpy from bpy import data, context, types from bpy_extras.io_utils import axis_conversion from .. import constants, logger, utilities, exceptions from .constants import ( MESH, EMPTY, ARMATURE, LAMP, AREA, SPOT, SUN, POINT, HEMI, CAMERA, PER...
mit
michaelpacer/scikit-image
skimage/graph/mcp.py
46
3187
from ._mcp import MCP, MCP_Geometric, MCP_Connect, MCP_Flexible def route_through_array(array, start, end, fully_connected=True, geometric=True): """Simple example of how to use the MCP and MCP_Geometric classes. See the MCP and MCP_Geometric class documentation for explanation of the...
bsd-3-clause
matiasb/django
docs/_ext/djangodocs.py
321
12049
""" Sphinx plugins for Django documentation. """ import json import os import re from docutils import nodes from docutils.parsers.rst import directives from sphinx import __version__ as sphinx_ver, addnodes from sphinx.builders.html import StandaloneHTMLBuilder from sphinx.util.compat import Directive from sphinx.util...
bsd-3-clause
cysnake4713/odoo
addons/sale_analytic_plans/__init__.py
443
1208
# -*- 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
newmediamedicine/indivo_server_1_0
indivo/tests/unit/models/carenetdocument.py
4
1892
from indivo.tests.internal_tests import InternalTests, enable_transactions from indivo.tests.data.document import TEST_R_DOCS from indivo.tests.data.record import TEST_RECORDS from indivo.tests.data.carenet import TEST_CARENETS from indivo.models import CarenetDocument from django.db import IntegrityError, transaction ...
gpl-3.0
ETS-Robotics/ros_vision
scripts/RosVision/IO/point_cloud.py
2
1892
from io_object_stamped import IOObjectStamped import sensor_msgs.msg as m import pcl import struct class PointCloud(IOObjectStamped): TYPES = {m.PointField.INT8: 'c', m.PointField.UINT8: 'b', m.PointField.INT16: 'h', m.PointField.UINT16: 'H', m.PointField.INT32:...
gpl-3.0
ahmadshahwan/cohorte-platforms
repo/debug/api.py
2
19258
#!/usr/bin/python # -- Content-Encoding: UTF-8 -- """ Cohorte Debug REST API :authors: Bassem Debbabi :copyright: Copyright 2015, isandlaTech :license: Apache Software License 2.0 """ # iPOPO decorators from pelix.ipopo.decorators import ComponentFactory, Provides, Property, Instantiate, \ Validate, Invalidate, ...
apache-2.0
petrutlucian94/nova
nova/api/openstack/compute/plugins/v3/assisted_volume_snapshots.py
33
3882
# Copyright 2013 Red Hat, Inc. # Copyright 2014 IBM Corp. # 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....
apache-2.0
russel1237/scikit-learn
examples/plot_digits_pipe.py
250
1809
#!/usr/bin/python # -*- coding: utf-8 -*- """ ========================================================= Pipelining: chaining a PCA and a logistic regression ========================================================= The PCA does an unsupervised dimensionality reduction, while the logistic regression does the predictio...
bsd-3-clause
sunlightlabs/sarahs_inbox
mail/views.py
1
8502
from django.shortcuts import render_to_response, get_object_or_404 from django.template import RequestContext from django.core.paginator import Paginator from django.http import HttpResponse, HttpResponseRedirect from urllib import unquote from haystack.query import SearchQuerySet from mail.models import * from django....
bsd-3-clause
passiweinberger/passiweinberger.github.io
_site/presentations/HTM_Intro/node_modules/node-gyp/gyp/pylib/gyp/xml_fix.py
2767
2174
# 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. """Applies a fix to CR LF TAB handling in xml.dom. Fixes this: http://code.google.com/p/chromium/issues/detail?id=76293 Working around this: http://bugs.python.or...
apache-2.0
HybridF5/tempest_debug
tempest/tests/lib/services/compute/test_aggregates_client.py
6
6220
# Copyright 2015 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
simonwydooghe/ansible
test/units/modules/network/fortios/test_fortios_antivirus_settings.py
21
5944
# 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 License, or # (at your option) any later version. # # This program is distributed in the...
gpl-3.0
overtherain/scriptfile
software/googleAppEngine/lib/django_1_2/django/views/generic/simple.py
76
1634
from django.template import loader, RequestContext from django.http import HttpResponse, HttpResponseRedirect, HttpResponsePermanentRedirect, HttpResponseGone def direct_to_template(request, template, extra_context=None, mimetype=None, **kwargs): """ Render a given template with any extra URL parameters in the...
mit
nbeck90/city-swap
cityswap/requests/migrations/0001_initial.py
1
1445
# -*- coding: utf-8 -*- # Generated by Django 1.9.5 on 2016-04-11 16:52 from __future__ import unicode_literals import datetime from django.db import migrations, models import django.db.models.deletion class Migration(migrations.Migration): initial = True dependencies = [ ('profiles', '0001_initial...
mit
ingmarlehmann/franca-tools
franca_parser/franca_parser/franca_ast.py
1
15547
#------------------------------------------------------------------------------ # franca_parser: franca_ast.py # # AST node classes: AST node classes for Franca IDL (*.fidl). # Builds an AST to be used in other tools. # # This code is *heavlily* inspired by 'pycparser' by Eli Bendersky # (https://gi...
mpl-2.0
jss-emr/openerp-7-src
openerp/addons/procurement/company.py
56
1531
# -*- 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
whitehorse-io/encarnia
pyenv/lib/python2.7/site-packages/twisted/internet/wxsupport.py
12
1363
# Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. # """Old method of wxPython support for Twisted. twisted.internet.wxreactor is probably a better choice. To use:: | # given a wxApp instance called myWxAppInstance: | from twisted.internet import wxsupport | wxsupport.install(myWxAp...
mit
pvtodorov/indra
indra/sources/hume/visualize_causal.py
3
8915
# Visualize causal relationships amongst events import sys import json def split_long_sentence(sentence, words_per_line): """Takes a sentence and adds a newline every "words_per_line" words. Parameters ---------- sentence: str Sentene to split words_per_line: double Add a newline...
bsd-2-clause
crewrktablets/android_kernel_odys_neox_3.0.8
tools/perf/scripts/python/syscall-counts-by-pid.py
11180
1927
# system call counts, by pid # (c) 2010, Tom Zanussi <tzanussi@gmail.com> # Licensed under the terms of the GNU GPL License version 2 # # Displays system-wide system call totals, broken down by syscall. # If a [comm] arg is specified, only syscalls called by [comm] are displayed. import os, sys sys.path.append(os.env...
gpl-2.0
bgris/ODL_bgris
lib/python3.5/site-packages/pip/download.py
334
32171
from __future__ import absolute_import import cgi import email.utils import getpass import json import logging import mimetypes import os import platform import re import shutil import sys import tempfile try: import ssl # noqa HAS_TLS = True except ImportError: HAS_TLS = False from pip._vendor.six.move...
gpl-3.0
coderbone/SickRage-alt
lib/sqlalchemy/testing/provision.py
9
12934
from sqlalchemy.engine import url as sa_url from sqlalchemy import create_engine from sqlalchemy import text from sqlalchemy import exc from sqlalchemy.util import compat from . import config, engines import collections import os import time import logging log = logging.getLogger(__name__) FOLLOWER_IDENT = None clas...
gpl-3.0
seungjin/app5-seungjin-net.appspot.com
django/contrib/admindocs/utils.py
314
3796
"Misc. utility functions/classes for admin documentation generator." import re from email.Parser import HeaderParser from email.Errors import HeaderParseError from django.utils.safestring import mark_safe from django.core.urlresolvers import reverse from django.utils.encoding import smart_str try: import docutils....
bsd-3-clause
SepehrMN/nest-simulator
pynest/examples/spatial/connex_ew.py
14
2269
# -*- coding: utf-8 -*- # # connex_ew.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, or #...
gpl-2.0
Fireblend/chromium-crosswalk
tools/telemetry/telemetry/internal/actions/page_action_unittest.py
9
2993
# 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. """Tests for page_action.""" from telemetry.internal.actions import page_action from telemetry.page import action_runner from telemetry.unittest_util import...
bsd-3-clause
republic-analytics/luigi
luigi/contrib/hdfs/clients.py
19
2482
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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
nuobit/odoo-addons
connector_oxigesti/components_custom/binder.py
1
8847
# -*- coding: utf-8 -*- # Copyright 2013-2017 Camptocamp SA # License AGPL-3.0 or later (http://www.gnu.org/licenses/agpl.html) """ Binders ======= Binders are components that know how to find the external ID for an Odoo ID, how to find the Odoo ID for an external ID and how to create the binding between them. """ i...
agpl-3.0
RubenKelevra/rethinkdb
test/rql_test/connections/http_support/werkzeug/contrib/cache.py
146
23519
# -*- coding: utf-8 -*- """ werkzeug.contrib.cache ~~~~~~~~~~~~~~~~~~~~~~ The main problem with dynamic Web sites is, well, they're dynamic. Each time a user requests a page, the webserver executes a lot of code, queries the database, renders templates until the visitor gets the page he sees. ...
agpl-3.0
reedessick/event_supervisor2
pe/embright.py
2
3819
description = "a module housing checks of EM bright classification functionality" author = "reed.essick@ligo.org" #--------------------------------------------------------------------------------------------------- import eventSupervisor.eventSupervisorUtils as esUtils #-----------------------------------------...
mit
Kallaway/twitch-tv-viewer
node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py
1509
17165
# Copyright (c) 2013 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. """Handle version information related to Visual Stuio.""" import errno import os import re import subprocess import sys import gyp import glob class VisualStudi...
gpl-3.0
Morgan-Stanley/treadmill
lib/python/treadmill/cli/admin/ldap/allocation.py
2
10415
"""Implementation of treadmill admin ldap CLI allocation plugin. """ from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals from collections import defaultdict import click from treadmill.admin import exc as admin_exception...
apache-2.0
plotly/python-api
packages/python/plotly/plotly/validators/scattergl/marker/line/__init__.py
24
1251
import sys if sys.version_info < (3, 7): from ._widthsrc import WidthsrcValidator from ._width import WidthValidator from ._reversescale import ReversescaleValidator from ._colorsrc import ColorsrcValidator from ._colorscale import ColorscaleValidator from ._coloraxis import ColoraxisValidator ...
mit
bspink/django
tests/signed_cookies_tests/tests.py
288
2768
from __future__ import unicode_literals from django.core import signing from django.http import HttpRequest, HttpResponse from django.test import SimpleTestCase, override_settings from django.test.utils import freeze_time class SignedCookieTest(SimpleTestCase): def test_can_set_and_read_signed_cookies(self): ...
bsd-3-clause
Dfelker/ansible
lib/ansible/plugins/lookup/etcd.py
56
2396
# (c) 2013, Jan-Piet Mens <jpmens(at)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) any later ver...
gpl-3.0
ebpetway/couchdbkit
tests/test_resource.py
5
1637
# -*- coding: utf-8 - # # This file is part of couchdbkit released under the MIT license. # See the NOTICE for more information. # __author__ = 'benoitc@e-engura.com (Benoît Chesneau)' try: import unittest2 as unittest except ImportError: import unittest from restkit.errors import RequestFailed, RequestError...
mit
rajendrakrp/GeoMicroFormat
bs4/tests/test_lxml.py
97
2358
"""Tests to ensure that the lxml tree builder generates good trees.""" import re import warnings try: from bs4.builder import LXMLTreeBuilder, LXMLTreeBuilderForXML LXML_PRESENT = True except ImportError, e: LXML_PRESENT = False from bs4 import ( BeautifulSoup, BeautifulStoneSoup, ) from bs4....
bsd-3-clause
chrisfilda/edx_platform
common/djangoapps/third_party_auth/provider.py
29
8241
"""Third-party auth provider definitions. Loaded by Django's settings mechanism. Consequently, this module must not invoke the Django armature. """ from social.backends import google, linkedin _DEFAULT_ICON_CLASS = 'icon-signin' class BaseProvider(object): """Abstract base class for third-party auth providers....
agpl-3.0
RadioFreeAsia/RDacity
lib-src/lv2/serd/waflib/extras/autowaf.py
176
22430
#! /usr/bin/env python # encoding: utf-8 # WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file import glob import os import subprocess import sys from waflib import Configure,Context,Logs,Node,Options,Task,Utils from waflib.TaskGen import feature,before,after global g_i...
gpl-2.0
dutchiexl/constructiv
node_modules/node-gyp/gyp/pylib/gyp/MSVSUtil.py
1812
9537
# Copyright (c) 2013 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. """Utility functions shared amongst the Windows generators.""" import copy import os # A dictionary mapping supported target types to extensions. TARGET_TYPE_EX...
gpl-2.0
gribozavr/swift
utils/jobstats/jobstats.py
18
13681
#!/usr/bin/python # # ==-- jobstats - support for reading the contents of stats dirs --==# # # This source file is part of the Swift.org open source project # # Copyright (c) 2014-2017 Apple Inc. and the Swift project authors # Licensed under Apache License v2.0 with Runtime Library Exception # # See https://swift.org/...
apache-2.0
Ragowit/hearthbreaker
hearthbreaker/agents/trade/possible_play.py
8
6271
from hearthbreaker.agents.trade.util import Util from functools import reduce class PossiblePlay: def __init__(self, cards, available_mana): if len(cards) == 0: raise Exception("PossiblePlay cards is empty") self.cards = cards self.available_mana = available_mana def card...
mit
aman-iitj/scipy
scipy/spatial/distance.py
18
74291
""" ===================================================== Distance computations (:mod:`scipy.spatial.distance`) ===================================================== .. sectionauthor:: Damian Eads Function Reference ------------------ Distance matrix computation from a collection of raw observation vectors stored in...
bsd-3-clause
dpedu/prettytable
prettytable_test.py
42
20670
#!/usr/bin/env python # coding=UTF-8 from prettytable import * import sys py3k = sys.version_info[0] >= 3 try: import sqlite3 _have_sqlite = True except ImportError: _have_sqlite = False if py3k: import io as StringIO else: import StringIO from math import pi, e, sqrt import unittest class BuildE...
bsd-3-clause
Jionglun/-w16b_test
static/Brython3.1.1-20150328-091302/Lib/_random.py
518
2451
from browser import window def _randint(a, b): return int(window.Math.random()*(b-a+1)+a) def _urandom(n): """urandom(n) -> str Return n random bytes suitable for cryptographic use.""" randbytes= [_randint(0,255) for i in range(n)] return bytes(randbytes) class Random: """Random n...
agpl-3.0
alexeyum/scikit-learn
sklearn/datasets/base.py
11
23497
""" Base IO code for all datasets """ # Copyright (c) 2007 David Cournapeau <cournape@gmail.com> # 2010 Fabian Pedregosa <fabian.pedregosa@inria.fr> # 2010 Olivier Grisel <olivier.grisel@ensta.org> # License: BSD 3 clause import os import csv import sys import shutil from os import environ...
bsd-3-clause
throwable-one/lettuce
tests/integration/lib/Django-1.3/django/db/models/sql/expressions.py
323
3772
from django.core.exceptions import FieldError from django.db.models.fields import FieldDoesNotExist from django.db.models.sql.constants import LOOKUP_SEP class SQLEvaluator(object): def __init__(self, expression, query, allow_joins=True): self.expression = expression self.opts = query.get_meta() ...
gpl-3.0
cyyber/QRL
tests/core/p2p/test_p2pfactory.py
2
37623
# coding=utf-8 # Distributed under the MIT software license, see the accompanying # file LICENSE or http://www.opensource.org/licenses/mit-license.php. from collections import OrderedDict from unittest import TestCase from mock import Mock, patch from pyqrllib.pyqrllib import hstr2bin from pyqryptonight.pyqryptonight ...
mit
DNFcode/edx-platform
lms/djangoapps/dashboard/sysadmin.py
31
29023
""" This module creates a sysadmin dashboard for managing and viewing courses. """ import csv import json import logging import os import subprocess import time import StringIO from django.conf import settings from django.contrib.auth import authenticate from django.contrib.auth.decorators import login_required from d...
agpl-3.0
tdhopper/scikit-learn
sklearn/manifold/tests/test_mds.py
324
1862
import numpy as np from numpy.testing import assert_array_almost_equal from nose.tools import assert_raises from sklearn.manifold import mds def test_smacof(): # test metric smacof using the data of "Modern Multidimensional Scaling", # Borg & Groenen, p 154 sim = np.array([[0, 5, 3, 4], ...
bsd-3-clause
tibor95/phatch-python2.7
build/lib.linux-i686-2.7/phatch/actions/rename.py
4
6040
# Phatch - Photo Batch Processor # Copyright (C) 2007-2008 www.stani.be # # 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 # (at your option) any later version...
gpl-3.0