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
pombredanne/django-rest-framework
rest_framework/routers.py
3
13221
""" Routers provide a convenient and consistent way of automatically determining the URL conf for your API. They are used by simply instantiating a Router class, and then registering all the required ViewSets with that router. For example, you might have a `urls.py` that looks something like this: router = route...
bsd-2-clause
puzan/ansible
lib/ansible/modules/cloud/digital_ocean/digital_ocean_block_storage.py
50
11503
#!/usr/bin/python # -*- coding: utf-8 -*- # 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
beernarrd/gramps
gramps/gen/datehandler/_date_de.py
2
11563
# -*- coding: utf-8 -*- # # Gramps - a GTK+/GNOME based genealogy program # # Copyright (C) 2004-2006 Donald N. Allingham # # 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 t...
gpl-2.0
Event38/MissionPlanner
Lib/site-packages/scipy/linalg/tests/test_special_matrices.py
55
8317
"""Tests for functions in special_matrices.py.""" from numpy import arange, add, array, eye, copy from numpy.testing import TestCase, run_module_suite, assert_raises, \ assert_equal, assert_array_equal from scipy.linalg import toeplitz, hankel, circulant, hadamard, leslie, \ companion,...
gpl-3.0
littlstar/chromium.src
tools/usb_gadget/hid_gadget_test.py
54
8516
#!/usr/bin/python # Copyright 2014 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. import unittest import mock import hid_constants import hid_descriptors import hid_gadget import usb_constants report_desc = hid_descri...
bsd-3-clause
jinnykoo/wuyisj
src/oscar/apps/promotions/models.py
9
11554
from django.db import models from django.conf import settings from django.utils.encoding import python_2_unicode_compatible from django.utils.translation import ugettext_lazy as _, pgettext_lazy from django.core.urlresolvers import reverse from django.contrib.contenttypes.models import ContentType from django.contrib.c...
bsd-3-clause
getsentry/zeus
tests/zeus/api/resources/test_repository_hooks.py
1
2745
from zeus.models import Hook def test_repo_hook_list( client, default_login, default_hook, default_repo, default_repo_access ): resp = client.get("/api/repos/{}/hooks".format(default_repo.get_full_name())) assert resp.status_code == 200 data = resp.json() assert len(data) == 1 assert data[0]["...
apache-2.0
canavandl/bokeh
examples/embed/animated.py
43
1561
# The bokeh-server must be running to see this example from __future__ import print_function from bokeh.plotting import cursession, figure, output_server, show, push from bokeh.models import GlyphRenderer import bokeh.embed as embed import time from numpy import pi, cos, sin, linspace, roll N = 50 + 1 r_base = 8 th...
bsd-3-clause
yukoba/sympy
sympy/physics/quantum/cartesian.py
98
8766
"""Operators and states for 1D cartesian position and momentum. TODO: * Add 3D classes to mappings in operatorset.py """ from __future__ import print_function, division from sympy import DiracDelta, exp, I, Interval, pi, S, sqrt from sympy.core.compatibility import range from sympy.physics.quantum.constants impor...
bsd-3-clause
asrie/phantomjs
src/qt/qtwebkit/Tools/Scripts/webkitpy/performance_tests/perftest_unittest.py
115
19639
# Copyright (C) 2012 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list of conditions and the ...
bsd-3-clause
gavioto/fiware-orion
scripts/managedb/list-entities.py
13
4483
#!/usr/bin/python # -*- coding: latin-1 -*- # Copyright 2014 Telefonica Investigacion y Desarrollo, S.A.U # # This file is part of Orion Context Broker. # # Orion Context Broker 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 Fr...
agpl-3.0
Danielweber7624/pybuilder
src/main/python/pybuilder/ci_server_interaction.py
8
2207
# -*- coding: utf-8 -*- # # This file is part of PyBuilder # # Copyright 2011-2015 PyBuilder Team # # 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/l...
apache-2.0
Prototanium/Pr
qa/rpc-tests/rest.py
12
4824
#!/usr/bin/env python2 # Copyright (c) 2014 The Bitcoin Core developers # Distributed under the MIT software license, see the accompanying # file COPYING or http://www.opensource.org/licenses/mit-license.php. # # Test REST interface # from test_framework import BitcoinTestFramework from util import * import json try...
mit
anthonydillon/horizon
openstack_dashboard/contrib/sahara/content/data_processing/cluster_templates/workflows/create.py
12
12872
# 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 the...
apache-2.0
mihu/redis-rdb-tools
rdbtools/cli/rdb.py
1
3417
#!/usr/bin/env python import os import sys from optparse import OptionParser from rdbtools import RdbParser, JSONCallback, DiffCallback, MemoryCallback, ProtocolCallback, PrintAllKeys, KeysOnlyCallback, KeyValsOnlyCallback VALID_TYPES = ("hash", "set", "string", "list", "sortedset") def main(): usage = """usage: %...
mit
Nitaco/ansible
lib/ansible/plugins/callback/foreman.py
27
8807
# -*- coding: utf-8 -*- # (c) 2015, 2016 Daniel Lobato <elobatocs@gmail.com> # (c) 2016 Guido Günther <agx@sigxcpu.org> # (c) 2017 Ansible Project # 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_...
gpl-3.0
raysteam/zeppelin
interpreter/lib/python/backend_zinline.py
61
11831
# Licensed to the Apache Software Foundation (ASF) under one or more # contributor license agreements. See the NOTICE file distributed with # this work for additional information regarding copyright ownership. # The ASF licenses this file to You under the Apache License, Version 2.0 # (the "License"); you may not use ...
apache-2.0
migueldvb/piernik
bin/validate.py
1
3504
#!/usr/bin/env python # @todo # get rid of paths # sanitize # problem_name is de facto var passed directly to setup, so it can be # anything, make it configurable import sys sys.path.append("python/") import os import json import tempfile import hashlib import argparse import time import base64, getpass from Di...
gpl-3.0
spacecaker/android_kernel_acer_swing_msm8960
tools/perf/scripts/python/check-perf-trace.py
11214
2503
# perf script event handlers, generated by perf script -g python # (c) 2010, Tom Zanussi <tzanussi@gmail.com> # Licensed under the terms of the GNU GPL License version 2 # # This script tests basic functionality such as flag and symbol # strings, common_xxx() calls back into perf, begin, end, unhandled # events, etc. ...
gpl-2.0
urschrei/sublime-rust
rust/cargo_config.py
1
36441
"""Sublime commands for configuring Cargo execution. See `cargo_settings` for more details on how settings work. """ import getpass import os import re import sublime import sublime_plugin from .cargo_settings import CargoSettings, CARGO_COMMANDS from .util import index_with, get_cargo_metadata from . import rust_pro...
mit
geerlingguy/ansible
test/lib/ansible_test/_data/sanity/code-smell/action-plugin-docs.py
66
1812
#!/usr/bin/env python """Test to verify action plugins have an associated module to provide documentation.""" from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os import sys def main(): """Main entry point.""" paths = sys.argv[1:] or sys.stdin.read().splitlines() ...
gpl-3.0
sander76/home-assistant
tests/components/wemo/conftest.py
5
2436
"""Fixtures for pywemo.""" import asyncio from unittest.mock import create_autospec, patch import pytest import pywemo from homeassistant.components.wemo import CONF_DISCOVERY, CONF_STATIC from homeassistant.components.wemo.const import DOMAIN from homeassistant.helpers import entity_registry as er from homeassistant...
apache-2.0
Shashikanth-Huawei/bmp
tools/test/topos/solar.py
26
3383
#!/usr/bin/env python from mininet.cli import CLI from mininet.net import Mininet from mininet.node import RemoteController, OVSKernelSwitch MAC = 12 DPID = 16 class CustomCLI(CLI): """Custom CLI to allow us to add our own commands.""" def __init__ (self, net): """Init method for our custom CLI.""" ...
apache-2.0
minhphung171093/OpenERP_V8
openerp/addons/base/module/__init__.py
462
1088
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2009 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
sudheesh001/coala
coalib/output/ConfWriter.py
20
4015
from itertools import chain from pyprint.ClosableObject import ClosableObject from coalib.parsing.StringProcessing import escape from coalib.settings.Section import Section class ConfWriter(ClosableObject): def __init__(self, file_name, key_value_delimiters=('=',), ...
agpl-3.0
balloob/home-assistant
homeassistant/components/griddy/sensor.py
8
1430
"""Support for August sensors.""" from homeassistant.const import CURRENCY_CENT, ENERGY_KILO_WATT_HOUR from homeassistant.helpers.update_coordinator import CoordinatorEntity from .const import CONF_LOADZONE, DOMAIN async def async_setup_entry(hass, config_entry, async_add_entities): """Set up the August sensors....
apache-2.0
hpsilva/profitpy
profit/models/__init__.py
18
3063
#!/usr/bin/env python # -*- coding: utf-8 -*- # Copyright 2007 Troy Melhase <troy@gci.net> # Distributed under the terms of the GNU General Public License v2 # Author: Troy Melhase <troy@gci.net> from PyQt4.QtCore import Qt, QModelIndex, QObject, QVariant, QAbstractItemModel class BasicItem(object): """ ""...
gpl-2.0
Alexander-M-Waldman/local_currency_site
lib/python2.7/site-packages/django/contrib/auth/checks.py
374
2098
# -*- coding: utf-8 -*- from __future__ import unicode_literals from django.apps import apps from django.conf import settings from django.core import checks def check_user_model(**kwargs): errors = [] cls = apps.get_model(settings.AUTH_USER_MODEL) # Check that REQUIRED_FIELDS is a list if not isins...
gpl-3.0
voer-platform/vp.repo
vpr/vpr_api/decorators.py
1
2507
from rest_framework.response import Response from django.conf import settings from django.http import HttpRequest, Http404 from datetime import datetime from django.utils.log import getLogger from vpr_api.views import validateToken from vpr_api.models import APIRecord from vpr_api.signals import after_apicall from vpr...
agpl-3.0
quait/madcow
madcow/include/chardet/langhebrewmodel.py
235
11340
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Universal charset detector code. # # The Initial Developer of the Original Code is # Simon Montagu # Portions created by the Initial Developer are Copyright (C) 2005 # the Initial Developer. All Rights Reserved...
gpl-3.0
mikemow/youtube-dl
youtube_dl/extractor/rtlnl.py
102
5637
# coding: utf-8 from __future__ import unicode_literals from .common import InfoExtractor from ..utils import ( int_or_none, parse_duration, ) class RtlNlIE(InfoExtractor): IE_NAME = 'rtl.nl' IE_DESC = 'rtl.nl and rtlxl.nl' _VALID_URL = r'''(?x) https?://(?:www\.)? (?: ...
unlicense
johren/RackHD
test/tests/api-cit/v2_0/nodes_tests.py
9
18541
''' Copyright (c) 2016-2017 Dell Inc. or its subsidiaries. All Rights Reserved. Author(s): ''' import fit_path # NOQA: unused import import json import fit_common import flogging from on_http_api2_0 import ApiApi as Api from on_http_api2_0.rest import ApiException from config.api2_0_config import config from datetim...
apache-2.0
drnextgis/QGIS
python/plugins/GdalTools/tools/doProjection.py
5
7356
# -*- coding: utf-8 -*- """ *************************************************************************** doProjection.py --------------------- Date : June 2010 Copyright : (C) 2010 by Giuseppe Sucameli Email : brush dot tyler at gmail dot com ***************...
gpl-2.0
yufengg/tensorflow
tensorflow/contrib/learn/python/learn/estimators/estimator.py
9
55718
# 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
owlabs/incubator-airflow
airflow/models/user.py
1
1302
# -*- 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 #...
apache-2.0
kbaseIncubator/KBaseRNASeq
lib/biokbase/RNASeq/TophatSample.py
2
9051
import simplejson, sys, shutil, os, ast , re from mpipe import OrderedStage , Pipeline import glob, json, uuid, logging , time ,datetime import subprocess, threading,traceback from collections import OrderedDict from pprint import pprint , pformat import parallel_tools as parallel from mpipe import OrderedStage , Pip...
mit
chromium2014/src
build/android/pylib/gtest/setup.py
10
12862
# 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. """Generates test runner factory and tests for GTests.""" # pylint: disable=W0212 import fnmatch import glob import logging import os import shutil import s...
bsd-3-clause
Shrhawk/edx-platform
common/lib/xmodule/xmodule/modulestore/tests/utils.py
24
5882
""" Helper classes and methods for running modulestore tests without Django. """ from importlib import import_module from opaque_keys.edx.keys import UsageKey from unittest import TestCase from xblock.fields import XBlockMixin from xmodule.x_module import XModuleMixin from xmodule.modulestore import ModuleStoreEnum fro...
agpl-3.0
varunarya10/boto
boto/rds/event.py
220
1876
# Copyright (c) 2006-2009 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
mit
erkanay/django
django/contrib/auth/tests/test_basic.py
32
4744
from __future__ import unicode_literals from django.apps import apps from django.contrib.auth import get_user_model from django.contrib.auth.models import User, AnonymousUser from django.contrib.auth.tests.custom_user import CustomUser from django.contrib.auth.tests.utils import skipIfCustomUser from django.core.excep...
bsd-3-clause
rnehra01/tanner
tanner/utils/logger.py
1
1602
import logging import logging.handlers from tanner.config import TannerConfig class LevelFilter(logging.Filter): '''Filters (lets through) all messages with level < LEVEL''' def __init__(self, level): self.level = level def filter(self, record): return record.levelno < self.level # "<" ins...
gpl-3.0
hsaputra/tensorflow
tensorflow/contrib/distributions/python/kernel_tests/mixture_test.py
21
35561
# 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
abaiskiy/darvis
app.py
1
11330
#!/usr/bin/env python from __future__ import print_function from future.standard_library import install_aliases install_aliases() from urllib.parse import urlparse, urlencode from urllib.request import urlopen, Request from urllib.error import HTTPError import json import os import requests import codecs...
apache-2.0
didzis/AMRParsing
stanfordnlp/unidecode/x083.py
252
4643
data = ( 'Fu ', # 0x00 'Zhuo ', # 0x01 'Mao ', # 0x02 'Fan ', # 0x03 'Qie ', # 0x04 'Mao ', # 0x05 'Mao ', # 0x06 'Ba ', # 0x07 'Zi ', # 0x08 'Mo ', # 0x09 'Zi ', # 0x0a 'Di ', # 0x0b 'Chi ', # 0x0c 'Ji ', # 0x0d 'Jing ', # 0x0e 'Long ', # 0x0f '[?] ', # 0x10 'Niao ', ...
gpl-2.0
GbalsaC/bitnamiP
venv/lib/python2.7/site-packages/nltk/book.py
12
3289
# Natural Language Toolkit: Some texts for exploration in chapter 1 of the book # # Copyright (C) 2001-2012 NLTK Project # Author: Steven Bird <sb@csse.unimelb.edu.au> # # URL: <http://www.nltk.org/> # For license information, see LICENSE.TXT from nltk.corpus import gutenberg, genesis, inaugural,\ nps_chat, web...
agpl-3.0
pinterb/st2
tools/purge_executions.py
2
5009
#!/usr/bin/env python # Licensed to the StackStorm, Inc ('StackStorm') 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...
apache-2.0
xiangke/pycopia
mibs/pycopia/mibs/PARALLEL_MIB_OID.py
1
1084
# python # This file is generated by a program (mib2py). import PARALLEL_MIB OIDMAP = { '1.3.6.1.2.1.10.34': PARALLEL_MIB.para, '1.3.6.1.2.1.10.34.5': PARALLEL_MIB.paraConformance, '1.3.6.1.2.1.10.34.5.1': PARALLEL_MIB.paraGroups, '1.3.6.1.2.1.10.34.5.2': PARALLEL_MIB.paraCompliances, '1.3.6.1.2.1.10.34.1': PARALLEL...
lgpl-2.1
JIoJIaJIu/servo
tests/wpt/web-platform-tests/tools/wptserve/wptserve/stash.py
136
5284
import base64 import json import os import uuid from multiprocessing import Process from multiprocessing.managers import BaseManager, DictProxy class ServerDictManager(BaseManager): shared_data = {} def _get_shared(): return ServerDictManager.shared_data ServerDictManager.register("get_dict", ...
mpl-2.0
enthought/pikos
pikos/_internal/function_set.py
1
3154
# -*- coding: utf-8 -*- #------------------------------------------------------------------------------ # Package: Pikos toolkit # File: _internal/function_set.py # License: LICENSE.TXT # # Copyright (c) 2012, Enthought, Inc. # All rights reserved. #-----------------------------------------------------------------...
bsd-3-clause
niceandcoolusername/cosmos
code/data_structures/b_tree/b_tree.py
3
3465
class BTreeNode(object): """A B-Tree Node. attributes ===================== leaf : boolean, determines whether this node is a leaf. keys : list, a list of keys internal to this node c : list, a list of children of this node """ def __init__(self, leaf=False): self.leaf = le...
gpl-3.0
jasontlam/snorkel
tutorials/workshop/lib/util.py
1
3232
import pandas as pd from snorkel.models import StableLabel from snorkel.db_helpers import reload_annotator_labels FPATH = 'data/gold_labels.tsv' def number_of_people(sentence): active_sequence = False count = 0 for tag in sentence.ner_tags: if tag == 'PERSON' and not active_sequence: a...
apache-2.0
v1bri/gnuradio
gr-digital/python/digital/qa_chunks_to_symbols.py
38
7425
#!/usr/bin/env python # # Copyright 2012,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...
gpl-3.0
billy-wang/smdkc110-Gingerbread-kernel
tools/perf/scripts/python/check-perf-trace.py
948
2501
# perf trace event handlers, generated by perf trace -g python # (c) 2010, Tom Zanussi <tzanussi@gmail.com> # Licensed under the terms of the GNU GPL License version 2 # # This script tests basic functionality such as flag and symbol # strings, common_xxx() calls back into perf, begin, end, unhandled # events, etc. Ba...
gpl-2.0
B-MOOC/edx-platform
lms/djangoapps/instructor/enrollment.py
37
16362
""" Enrollment operations for use by instructor APIs. Does not include any access control, be sure to check access before calling. """ import json import logging from django.contrib.auth.models import User from django.conf import settings from django.core.urlresolvers import reverse from django.core.mail import send_...
agpl-3.0
lasote/conan
conans/test/command/copy_packages_test.py
1
1678
import unittest from conans.test.utils.tools import TestClient import os from conans.model.ref import ConanFileReference class CopyPackagesTest(unittest.TestCase): def test_copy_command(self): client = TestClient() conanfile = """from conans import ConanFile class Pkg(ConanFile): settings = "...
mit
0hoo/libearth
libearth/sanitizer.py
2
4480
""":mod:`libearth.sanitizer` --- Sanitize HTML tags ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ """ import cgi try: import htmlentitydefs import HTMLParser except ImportError: from html import entities as htmlentitydefs, parser as HTMLParser import re from .compat import unichr __all__ = 'HtmlSan...
gpl-2.0
ouihelp/yesaide
tests/test_worker.py
1
1460
import unittest from yesaide import worker class FakeDbSession(object): def __init__(self): self.has_been_committed = False def commit(self): self.has_been_committed = True class FakeForeman(object): def __init__(self): self._dbsession = FakeDbSession() class FakeMapping(obje...
mit
caioserra/apiAdwords
examples/adspygoogle/dfa/v1_19/get_advertisers.py
3
2199
#!/usr/bin/python # # Copyright 2012 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
apache-2.0
agry/NGECore2
scripts/mobiles/dathomir/outbreak_afflicted_rancor.py
2
1534
import sys from services.spawn import MobileTemplate from services.spawn import WeaponTemplate from resources.datatables import WeaponType from resources.datatables import Difficulty from resources.datatables import Options from java.util import Vector def addTemplate(core): mobileTemplate = MobileTemplate() mobil...
lgpl-3.0
FranMachio/Plugin.video.Machio.
servers/magnovideo.py
41
3582
# -*- coding: utf-8 -*- #------------------------------------------------------------ # pelisalacarta - XBMC Plugin # Conector para magnovideo # http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/ #------------------------------------------------------------ import urlparse,urllib2,urllib,re import os from core im...
gpl-2.0
cricketclubucd/davisdragons
platform-tools/systrace/catapult/telemetry/third_party/web-page-replay/certutils.py
5
9260
# Copyright 2014 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or ...
mit
gojira/tensorflow
tensorflow/contrib/framework/python/ops/arg_scope.py
14
6899
# 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
grehujt/SmallPythonProjects
profile_examples/main.py
1
4230
from profilehooks import profile # Basic example ======================================================================== @profile def fib_ver1(n): if n < 0: raise RuntimeError elif n <= 2: return 1 else: return fib_ver1(n - 1) + fib_ver1(n - 2) print fib_ver1(10) # 55 # *** PR...
mit
fernandojunior/searching-techniques
python/lib/python3.4/site-packages/pip/_vendor/lockfile/symlinklockfile.py
487
2613
from __future__ import absolute_import import time import os from . import (LockBase, LockFailed, NotLocked, NotMyLock, LockTimeout, AlreadyLocked) class SymlinkLockFile(LockBase): """Lock access to a file using symlink(2).""" def __init__(self, path, threaded=True, timeout=None): # s...
mit
ya7lelkom/googleads-python-lib
examples/adxbuyer/v201502/basic_operations/get_third_party_redirect_ads.py
3
2512
#!/usr/bin/python # # Copyright 2013 Google Inc. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required b...
apache-2.0
omerucn/or-tools
examples/python/subset_sum.py
32
2971
# Copyright 2010 Hakan Kjellerstrand hakank@bonetmail.com # # 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
hkariti/ansible
lib/ansible/modules/notification/say.py
26
2338
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2013, Michael DeHaan <michael@ansible.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
longjon/numpy
setup.py
1
6692
#!/usr/bin/env python """NumPy: array processing for numbers, strings, records, and objects. NumPy is a general-purpose array-processing package designed to efficiently manipulate large multi-dimensional arrays of arbitrary records without sacrificing too much speed for small multi-dimensional arrays. NumPy is built ...
bsd-3-clause
itsjeyd/edx-platform
common/lib/xmodule/xmodule/modulestore/tests/test_split_w_old_mongo.py
45
6040
import datetime import random import unittest import uuid from nose.plugins.attrib import attr import mock from opaque_keys.edx.locator import CourseLocator, BlockUsageLocator from xmodule.modulestore import ModuleStoreEnum from xmodule.x_module import XModuleMixin from xmodule.modulestore.inheritance import Inherita...
agpl-3.0
kkdd/arangodb
3rdParty/V8-4.3.61/third_party/python_26/Lib/test/test_strftime.py
56
6967
""" Unittest for time.strftime """ import calendar import sys import os import re from test import test_support import time import unittest # helper functions def fixasctime(s): if s[8] == ' ': s = s[:8] + '0' + s[9:] return s def escapestr(text, ampm): """ Escape text to deal with possible ...
apache-2.0
pcu4dros/pandora-core
workspace/lib/python3.5/site-packages/psycopg2/tests/test_transaction.py
10
9223
#!/usr/bin/env python # test_transaction - unit test on transaction behaviour # # Copyright (C) 2007-2011 Federico Di Gregorio <fog@debian.org> # # psycopg2 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 Foundat...
mit
mspark93/VTK
Filters/General/Testing/Python/Canny.py
20
2855
#!/usr/bin/env python import vtk from vtk.test import Testing from vtk.util.misc import vtkGetDataRoot VTK_DATA_ROOT = vtkGetDataRoot() # Create the RenderWindow, Renderer and both Actors ren1 = vtk.vtkRenderer() renWin = vtk.vtkRenderWindow() renWin.SetMultiSamples(0) renWin.AddRenderer(ren1) iren = vtk.vtkRenderWind...
bsd-3-clause
MarcosCommunity/odoo
addons/note/note.py
223
8893
# -*- 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
tumbl3w33d/ansible
lib/ansible/modules/storage/netapp/na_elementsw_cluster_config.py
21
12777
#!/usr/bin/python # (c) 2018, NetApp, Inc # GNU General Public License v3.0+ (see COPYING or # https://www.gnu.org/licenses/gpl-3.0.txt) ''' Element Software Configure cluster ''' from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', ...
gpl-3.0
goyalankit/po-compiler
object_files/networkx-1.8.1/build/lib.linux-i686-2.7/networkx/algorithms/isomorphism/tests/test_isomorphism.py
99
1183
#!/usr/bin/env python from nose.tools import * import networkx as nx from networkx.algorithms import isomorphism as iso class TestIsomorph: def setUp(self): self.G1=nx.Graph() self.G2=nx.Graph() self.G3=nx.Graph() self.G4=nx.Graph() self.G1.add_edges_from([ [1,2],[1,3],[1,5...
apache-2.0
jbedorf/tensorflow
tensorflow/python/saved_model/save_test.py
4
16609
# Copyright 2018 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
ziaa/pelican-plugins
liquid_tags/vimeo.py
288
1808
""" Vimeo Tag --------- This implements a Liquid-style vimeo tag for Pelican, based on the youtube tag which is in turn based on the jekyll / octopress youtube tag [1]_ Syntax ------ {% vimeo id [width height] %} Example ------- {% vimeo 10739054 640 480 %} Output ------ <div style="width:640px; height:480px;"> ...
agpl-3.0
yongshengwang/hue
build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/contrib/flatpages/models.py
119
1487
from __future__ import unicode_literals from django.db import models from django.contrib.sites.models import Site from django.core.urlresolvers import get_script_prefix from django.utils.translation import ugettext_lazy as _ from django.utils.encoding import iri_to_uri, python_2_unicode_compatible @python_2_unicode_c...
apache-2.0
anryko/ansible
lib/ansible/modules/windows/win_region.py
37
3306
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2016, Ansible, inc # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} DOCUMEN...
gpl-3.0
pombredanne/pulp
server/pulp/server/managers/content/catalog.py
11
6365
# 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...
gpl-2.0
darchons/android-systemtap
scripts/kprobes_test/is_probed.py
15
1757
#!/usr/bin/python # Copyright (C) 2008, 2010 Red Hat Inc. # # This file is part of systemtap, and is free software. You can # redistribute it and/or modify it under the terms of the GNU General # Public License (GPL); either version 2, or (at your option) any # later version. import re import sys import os from con...
gpl-2.0
plusbeauxjours/nomadgram
nomadgram/images/serializers.py
1
2483
from rest_framework import serializers from . import models from nomadgram.users import models as user_models from taggit_serializer.serializers import TagListSerializerField from taggit_serializer.serializers import TaggitSerializer class SmallImageSerializer(serializers.ModelSerializer): """ Used for the notif...
mit
Netuitive/Diamond
src/collectors/nfacct/nfacct.py
60
2275
# coding=utf-8 """ Collect counters from Netfilter accounting #### Dependencies * [nfacct](http://www.netfilter.org/projects/nfacct/) """ import diamond.collector from subprocess import Popen, PIPE import re from diamond.collector import str_to_bool class NetfilterAccountingCollector(diamond.collector.Collecto...
mit
NachiketNamjoshi/BlackReactor_onyx
tools/perf/python/twatch.py
7370
1334
#! /usr/bin/python # -*- python -*- # -*- coding: utf-8 -*- # twatch - Experimental use of the perf python interface # Copyright (C) 2011 Arnaldo Carvalho de Melo <acme@redhat.com> # # This application is free software; you can redistribute it and/or # modify it under the terms of the GNU General Public License...
gpl-2.0
mcgee/ns-3
bindings/python/rad_util.py
212
26013
# Copyright (c) 2007 RADLogic # # Permission is hereby granted, free of charge, to any person obtaining a copy # of this software and associated documentation files (the "Software"), to deal # in the Software without restriction, including without limitation the rights # to use, copy, modify, merge, publish, distribut...
gpl-2.0
sachinkum/Bal-Aveksha
WebServer/BalAvekshaEnv/lib/python3.5/site-packages/pip/commands/install.py
323
17412
from __future__ import absolute_import import logging import operator import os import tempfile import shutil import warnings try: import wheel except ImportError: wheel = None from pip.req import RequirementSet from pip.basecommand import RequirementCommand from pip.locations import virtualenv_no_global, dis...
gpl-3.0
dgzurita/odoo
addons/base_report_designer/base_report_designer.py
314
3433
# -*- 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
CivicTechTO/open-cabinet
venv/lib/python2.7/site-packages/django/views/i18n.py
264
12156
import gettext as gettext_module import importlib import json import os from django import http from django.apps import apps from django.conf import settings from django.core.urlresolvers import translate_url from django.template import Context, Engine from django.utils import six from django.utils._os import upath fr...
mit
MarcosCommunity/odoo
comunity_modules/account_financial_report_webkit/report/general_ledger.py
27
10478
# -*- encoding: utf-8 -*- ############################################################################## # # Author: Nicolas Bessi, Guewen Baconnier # Copyright Camptocamp SA 2011 # # This program is free software: you can redistribute it and/or modify # it under the terms of the GNU Affero General Public L...
agpl-3.0
realsobek/freeipa
ipapython/certdb.py
2
21297
# Authors: Rob Crittenden <rcritten@redhat.com> # # Copyright (C) 2009 Red Hat # see file 'COPYING' for use and warranty information # # 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 v...
gpl-3.0
dushu1203/chromium.src
net/tools/testserver/echo_message.py
187
13195
# Copyright (c) 2011 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. """Provides utility functions for TCP/UDP echo servers and clients. This program has classes and functions to encode, decode, calculate checksum and ver...
bsd-3-clause
raysguy/HTPC-Manager
libs/sqlobject/sqlbuilder.py
6
45107
""" sqlobject.sqlbuilder -------------------- :author: Ian Bicking <ianb@colorstudy.com> Builds SQL expressions from normal Python expressions. Disclaimer ---------- This program 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 F...
mit
lizan/envoy
tools/github/sync_assignable.py
6
1749
# Sync envoyproxy organization users to envoyproxy/assignable team. # # This can be used for bulk cleanups if envoyproxy/assignable is not consistent # with organization membership. In general, prefer to add new members by editing # the envoyproxy/assignable in the GitHub UI, which will also cause an # organization inv...
apache-2.0
smartforceplus/SmartForceplus
openerp/addons/test_new_api/models.py
74
7032
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2013-2014 OpenERP (<http://www.openerp.com>). # # This program is free software: you can redistribute it and/or modify # it under the terms of t...
agpl-3.0
kivatu/kivy_old
doc/sources/sphinxext/kivy_pygments_theme.py
76
4901
# kivy pygments style based on flask/tango style from pygments.style import Style from pygments.token import Keyword, Name, Comment, String, Error, \ Number, Operator, Generic, Whitespace, Punctuation, Other, Literal class KivyStyle(Style): # The background color is set in kivystyle.sty background_color ...
mit
naslanidis/ansible
lib/ansible/modules/cloud/openstack/os_nova_host_aggregate.py
21
6727
#!/usr/bin/python # Copyright 2016 Jakub Jursa <jakub.jursa1@gmail.com> # # This module 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
abinashmeher999/pymediawiki
pymediawiki/wikipage.py
1
5005
from pprint import pprint import re import sys import json import helpers with open('metadata.json') as data_file: data = json.load(data_file) class WikiPage: def __init__(self, **reference_to_pages): self.base_url = "https://en.wikipedia.org/w/api.php" self.payload = { 'action':...
mit
hjanime/VisTrails
vistrails/db/versions/v1_0_1/persistence/xml/auto_gen.py
1
139932
############################################################################### ## ## Copyright (C) 2014-2015, New York University. ## Copyright (C) 2011-2014, NYU-Poly. ## Copyright (C) 2006-2011, University of Utah. ## All rights reserved. ## Contact: contact@vistrails.org ## ## This file is part of VisTrails. ## ## ...
bsd-3-clause
cryptspirit/mysql-cluster-test
multimaster.py
1
1087
import unittest from generic import Test from uuid import uuid4 from time import sleep, time class Test1(Test): def test_competition(self): ''' Test of competition many master-servers ''' for i in xrange(10): u = uuid4() s1 = '''INSERT INTO %s (uuid, write_from) VA...
gpl-3.0
bxshi/nghttp2
doc/bash_completion/make_bash_completion.py
19
1878
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import unicode_literals from __future__ import print_function import subprocess import io import re import sys import os.path class Option: def __init__(self, long_opt, short_opt): self.long_opt = long_opt self.short_opt = short_opt de...
mit