repo_name stringlengths 5 100 | path stringlengths 4 375 | copies stringclasses 991
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
koehlermichael/olympia | apps/devhub/urls.py | 11 | 9343 | from django.conf.urls import include, patterns, url
from django.shortcuts import redirect
from lib.misc.urlconf_decorator import decorate
from addons.urls import ADDON_ID
from amo.decorators import write
from amo.utils import partial
from . import views
PACKAGE_NAME = '(?P<package_name>[_\w]+)'
# These will all s... | bsd-3-clause |
UNINETT/nav | python/nav/mibs/alcatel_ind1_port_mib.py | 2 | 3059 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2019 Pär Stolpe, Linköpings universitet
#
# 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 Foundat... | gpl-2.0 |
ceibal-tatu/sugar-toolkit | examples/toolbar.py | 2 | 1296 | import gtk
from sugar.graphics.toolbutton import ToolButton
from sugar.graphics.toolbarbox import ToolbarBox, ToolbarButton
from sugar.graphics import style
window = gtk.Window()
box = gtk.VBox()
window.add(box)
toolbar = ToolbarBox()
box.pack_start(toolbar, False)
tollbarbutton_1 = ToolbarButton(
page=gtk... | lgpl-2.1 |
weiwei02/Technical--Documentation | python/src/algrothm/sort/HeapSort.py | 1 | 5210 | #!/usr/bin/env python3
"""选择排序—堆排序(Heap Sort) 时间复杂度 O(nlogn)
堆排序是一种树形选择排序,是对直接选择排序的有效改进。
基本思想:
堆的定义如下:具有n个元素的序列(k1,k2,...,kn),当且仅当满足
最小堆:Ki <= K2i and Ki <= K(2i+1)
最大堆:Ki >= K2i and Ki >= K(2i+1)
时称之为堆。由堆的定义可以看出,堆顶元素(即第一个元素)必为最小项(小顶堆)。
若以一维数组存储一个堆,则堆对应一棵完全二叉树,且所有非叶结点的值... | apache-2.0 |
Distrotech/yum-utils | plugins/tmprepo/tmprepo.py | 5 | 10208 | #!/usr/bin/python
# 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.
#
# This program is distributed in the hope that it w... | gpl-2.0 |
monikagrabowska/osf.io | addons/github/apps.py | 4 | 1558 | import os
from addons.base.apps import BaseAddonAppConfig
from addons.github.views import github_hgrid_data
HERE = os.path.dirname(os.path.abspath(__file__))
NODE_SETTINGS_TEMPLATE = os.path.join(
HERE,
'templates',
'github_node_settings.mako',
)
class GitHubAddonConfig(BaseAddonAppConfig):
name = '... | apache-2.0 |
xuegang/gpdb | gpMgmt/bin/gppylib/db/test/test_dbconn.py | 54 | 2573 | #!/usr/bin/env python
#
# Copyright (c) Greenplum Inc 2008. All Rights Reserved.
#
""" Unittesting for dbconn module
"""
import unittest
from gppylib.db.dbconn import *
class TestDbURL(unittest.TestCase):
"""UnitTest class for DbURL class"""
def setUp(self):
self._environ = dict(os.environ)
... | apache-2.0 |
zacps/zulip | zerver/views/webhooks/trello/board_actions.py | 16 | 3975 | from typing import Mapping, Any, Tuple, Optional, MutableMapping, Text
from .exceptions import UnknownUpdateBoardAction
from .templates import TRELLO_SUBJECT_TEMPLATE, TRELLO_MESSAGE_TEMPLATE
SUPPORTED_BOARD_ACTIONS = [
u'removeMemberFromBoard',
u'addMemberToBoard',
u'createList',
u'updateBoard',
]
RE... | apache-2.0 |
balbinot/superharris | catalogue/migrations/0006_auto_20170815_1519.py | 1 | 1267 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.3 on 2017-08-15 15:19
from __future__ import unicode_literals
from django.db import migrations
class Migration(migrations.Migration):
dependencies = [
('catalogue', '0005_auto_20170815_1416'),
]
operations = [
migrations.RemoveField(
... | mit |
CTSRD-SOAAP/chromium-42.0.2311.135 | tools/telemetry/telemetry/core/platform/power_monitor/sysfs_power_monitor_unittest.py | 13 | 7712 | # 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
from telemetry.core.platform.power_monitor import sysfs_power_monitor
from telemetry.core.platform import android_platform_backend
class S... | bsd-3-clause |
chrisseto/tornado | demos/benchmark/benchmark.py | 15 | 2387 | #!/usr/bin/env python
#
# A simple benchmark of tornado's HTTP stack.
# Requires 'ab' to be installed.
#
# Running without profiling:
# demos/benchmark/benchmark.py
# demos/benchmark/benchmark.py --quiet --num_runs=5|grep "Requests per second"
#
# Running with profiling:
#
# python -m cProfile -o /tmp/prof demos/benchm... | apache-2.0 |
CHBMB/LazyLibrarian | lazylibrarian/classes.py | 1 | 1832 | # This file is part of LazyLibrarian.
#
# LazyLibrarian 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.
#
# LazyLibrarian is dist... | gpl-3.0 |
hastexo/edx-platform | openedx/core/djangoapps/theming/tests/test_storage.py | 26 | 2751 | """
Tests for comprehensive theme static files storage classes.
"""
import ddt
import re
from mock import patch
from django.test import TestCase, override_settings
from django.conf import settings
from openedx.core.djangoapps.theming.helpers import get_theme_base_dirs, Theme, get_theme_base_dir
from openedx.core.dja... | agpl-3.0 |
fqul/scrapy | scrapy/utils/python.py | 41 | 10182 | """
This module contains essential stuff that should've come with Python itself ;)
"""
import os
import re
import inspect
import weakref
import errno
import six
from functools import partial, wraps
from scrapy.utils.decorators import deprecated
def flatten(x):
"""flatten(sequence) -> list
Returns a single, ... | bsd-3-clause |
CubicERP/geraldo | site/newsite/django_1_0/django/core/management/commands/createcachetable.py | 33 | 1810 | from django.core.management.base import LabelCommand
class Command(LabelCommand):
help = "Creates the table needed to use the SQL cache backend."
args = "<tablename>"
label = 'tablename'
requires_model_validation = False
def handle_label(self, tablename, **options):
from django.db import ... | lgpl-3.0 |
dmacvicar/spacewalk | backend/server/test/TestRedhat.py | 2 | 3529 | #
# Copyright (c) 2008--2010 Red Hat, Inc.
#
# This software is licensed to you under the GNU General Public License,
# version 2 (GPLv2). There is NO WARRANTY for this software, express or
# implied, including the implied warranties of MERCHANTABILITY or FITNESS
# FOR A PARTICULAR PURPOSE. You should have received a c... | gpl-2.0 |
ChawalitK/odoo | addons/account/wizard/account_invoice_state.py | 47 | 1679 | # -*- coding: utf-8 -*-
from openerp import models, api, _
from openerp.exceptions import UserError
class AccountInvoiceConfirm(models.TransientModel):
"""
This wizard will confirm the all the selected draft invoices
"""
_name = "account.invoice.confirm"
_description = "Confirm the selected invoi... | gpl-3.0 |
SlimRoms/kernel_sony_apq8064 | 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 |
pioneer/guess-language | guess_language/blocks.py | 65 | 2079 | ''' Categorize unicode characters by the code block in which they are found.
Copyright (c) 2008, Kent S Johnson
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
ver... | lgpl-2.1 |
py-chemist/web_apps | mol2chemfig/atom.py | 3 | 6364 | import math, string
import chemfig_mappings as cfm
from common import debug
# some atoms should carry their hydrogens to the left, rather than
# to the right. This is applied to solitary atoms, but not to bonded
# functional groups that contain those elements.
hydrogen_lefties = "O S Se Te F Cl Br I At".split() # I... | gpl-3.0 |
MobileCloudNetworking/icnaas | mcn-icn-so/wsgi/icnaas/monitor.py | 1 | 4448 | # Copyright (c) 2013-2015, University of Bern, Switzerland.
#
# 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 |
openhatch/oh-mainline | vendor/packages/celery/celery/concurrency/base.py | 18 | 3964 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
import logging
import os
import sys
import time
import traceback
from functools import partial
from .. import log
from ..datastructures import ExceptionInfo
from ..utils import timer2
from ..utils.encoding import safe_repr
def apply_target(target, args... | agpl-3.0 |
xxxhycl2010/powerline | tests/lib/__init__.py | 18 | 7870 | # vim:fileencoding=utf-8:noet
from __future__ import (unicode_literals, division, absolute_import, print_function)
import imp
import sys
class Pl(object):
def __init__(self):
self.exceptions = []
self.errors = []
self.warns = []
self.debugs = []
self.infos = []
self.prefix = None
self.use_daemon_threa... | mit |
lucernae/geonode | geonode/views.py | 2 | 5518 | # -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... | gpl-3.0 |
iglpdc/nipype | nipype/interfaces/camino/tests/test_auto_Conmat.py | 10 | 1480 | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ....testing import assert_equal
from ..connectivity import Conmat
def test_Conmat_inputs():
input_map = dict(args=dict(argstr='%s',
),
environ=dict(nohash=True,
usedefault=True,
),
ignore_exception=dict(nohash=True,
usedefault=True... | bsd-3-clause |
varunagrawal/azure-services | varunagrawal/site-packages/django/contrib/gis/tests/geo3d/tests.py | 94 | 11317 | from __future__ import absolute_import
import os
import re
from django.utils.unittest import TestCase
from django.contrib.gis.db.models import Union, Extent3D
from django.contrib.gis.geos import GEOSGeometry, Point, Polygon
from django.contrib.gis.utils import LayerMapping, LayerMapError
from .models import (City3D,... | gpl-2.0 |
BayanGroup/sentry | src/sentry/cache/redis.py | 7 | 1436 | """
sentry.cache.redis
~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010-2014 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
from __future__ import absolute_import
from django.conf import settings
from rb import Cluster
from sentry.utils import json
from .base import BaseC... | bsd-3-clause |
veroc/Bika-LIMS | bika/lims/tools/bika_ar_export.py | 5 | 9933 | from DateTime import DateTime
from AccessControl import ClassSecurityInfo
from App.class_init import InitializeClass
from OFS.SimpleItem import SimpleItem
from Products.CMFCore import permissions
from Products.CMFCore.utils import UniqueObject, getToolByName
from bika.lims.config import ManageAnalysisRequests
from bika... | agpl-3.0 |
acshan/odoo | addons/website/models/website.py | 53 | 35327 | # -*- coding: utf-8 -*-
import cStringIO
import contextlib
import datetime
import hashlib
import inspect
import logging
import math
import mimetypes
import unicodedata
import os
import re
import time
import urlparse
from PIL import Image
from sys import maxint
import werkzeug
# optional python-slugify import (https:/... | agpl-3.0 |
jeffmarcom/checkbox | plainbox/plainbox/impl/test_rfc822.py | 1 | 8809 | # This file is part of Checkbox.
#
# Copyright 2012 Canonical Ltd.
# Written by:
# Zygmunt Krynicki <zygmunt.krynicki@canonical.com>
#
# Checkbox 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 versio... | gpl-3.0 |
RudoCris/horizon | openstack_dashboard/dashboards/project/data_processing/clusters/tables.py | 10 | 5388 | # 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 |
chrisglass/ufoai | contrib/scripts/ui/checkNodeAttributeUsage.py | 1 | 1746 | #!/usr/bin/python
#
# @brief check the usage of menuNode_s attributes into all menu file (call it from the root of the trunk)
# @license Public domain
# @return an XHTML page into stdout
# @todo reading "attributes" from the nodes.h file
#
import os, os.path, sys
# path where exists ufo binary
UFOAI_ROOT = os.path.r... | gpl-2.0 |
klmitch/nova | nova/scheduler/driver.py | 1 | 2689 | # Copyright (c) 2010 OpenStack Foundation
# Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in complianc... | apache-2.0 |
Edraak/edraak-platform | common/test/acceptance/tests/lms/test_lms_user_preview.py | 9 | 17924 | # -*- coding: utf-8 -*-
"""
Tests the "preview" selector in the LMS that allows changing between Staff, Learner, and Content Groups.
"""
from textwrap import dedent
from nose.plugins.attrib import attr
from common.test.acceptance.fixtures.course import CourseFixture, XBlockFixtureDesc
from common.test.acceptance.pa... | agpl-3.0 |
cosmo-ethz/hope | test/test_operators.py | 1 | 3939 | # Copyright (C) 2014 ETH Zurich, Institute for Astronomy
"""
Test operators for `hope` module.
"""
from __future__ import print_function, division, absolute_import, unicode_literals
import numpy as np
import hope, itertools, pytest, sys, sysconfig, os, shutil
from test.utilities import random, check, make_test, JENK... | gpl-3.0 |
ofekd/servo | tests/wpt/harness/wptrunner/wptmanifest/tests/test_tokenizer.py | 195 | 11355 | # 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 sys
import os
import unittest
sys.path.insert(0, os.path.abspath(".."))
from cStringIO import StringIO
from .. ... | mpl-2.0 |
silenceli/nova | nova/db/sqlalchemy/migrate_repo/versions/232_drop_dump_tables.py | 47 | 1090 | # Copyright 2014, Red Hat, 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 agr... | apache-2.0 |
galaxys-cm7miui-kernel/ICS-kernel-SGS | tools/perf/scripts/python/failed-syscalls-by-pid.py | 11180 | 2058 | # failed 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 failed system call totals, broken down by pid.
# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
import os
import sys
sys.pa... | gpl-2.0 |
jlegendary/pybrain | examples/rl/environments/flexcube/flexcube_pgpe.py | 30 | 2997 | #!/usr/bin/env python
#########################################################################
# Reinforcement Learning with PGPE on the FlexCube Environment
#
# The FlexCube Environment is a Mass-Spring-System composed of 8 mass points.
# These resemble a cube with flexible edges.
#
# Control/Actions:
# The agent ca... | bsd-3-clause |
rohit21122012/ASC-GMM | 2SVMClassify/libsvm-3.20/tools/easy.py | 152 | 2699 | #!/usr/bin/env python
import sys
import os
from subprocess import *
if len(sys.argv) <= 1:
print('Usage: {0} training_file [testing_file]'.format(sys.argv[0]))
raise SystemExit
# svm, grid, and gnuplot executable files
is_win32 = (sys.platform == 'win32')
if not is_win32:
svmscale_exe = "../svm-scale"
svmtrain_... | mit |
shaform/disconnectator | disconnectator/settings.py | 1 | 2166 | """
Django settings for disconnectator 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 |
piece601/Openkore | src/scons-local-2.0.1/SCons/Tool/dvips.py | 61 | 3454 | """SCons.Tool.dvips
Tool-specific initialization for dvips.
There normally shouldn't be any need to import this module directly.
It will usually be imported through the generic SCons.Tool.Tool()
selection method.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010 The SCons Foundation
#... | gpl-2.0 |
defzzd/UserDataBase-Heroku | venv/Lib/site-packages/pip/commands/uninstall.py | 395 | 2203 | from pip.req import InstallRequirement, RequirementSet, parse_requirements
from pip.basecommand import Command
from pip.exceptions import InstallationError
class UninstallCommand(Command):
"""
Uninstall packages.
pip is able to uninstall most installed packages. Known exceptions are:
- Pure distutil... | mit |
tjsavage/djangononrel-starter | django/contrib/admin/templatetags/log.py | 310 | 2270 | from django import template
from django.contrib.admin.models import LogEntry
register = template.Library()
class AdminLogNode(template.Node):
def __init__(self, limit, varname, user):
self.limit, self.varname, self.user = limit, varname, user
def __repr__(self):
return "<GetAdminLog Node>"
... | bsd-3-clause |
wonjohnchoi/EE122-Project3 | pox/dumb_l2_switch/dumb_l2_switch.py | 1 | 3696 | # 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 |
Andr3iC/courtlistener | cl/people_db/migrations/0005_auto_20160318_1806.py | 2 | 1776 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('people_db', '0004_load_races'),
]
operations = [
migrations.AddField(
model_name='person',
name='rel... | agpl-3.0 |
rob-smallshire/asq | asq/test/test_last_or_default.py | 1 | 2437 | import unittest
from asq.queryables import Queryable
__author__ = "Sixty North"
class TestLastOrDefault(unittest.TestCase):
def test_last_or_default(self):
a = [42, 45, 23, 12]
b = Queryable(a).last_or_default(37)
self.assertEqual(b, 12)
def test_last_or_default_non_sequence(self):
... | mit |
scrollback/kuma | vendor/packages/pyparsing/docs/examples/simpleArith.py | 16 | 2319 | #
# simpleArith.py
#
# Example of defining an arithmetic expression parser using
# the operatorPrecedence helper method in pyparsing.
#
# Copyright 2006, by Paul McGuire
#
from pyparsing import *
integer = Word(nums).setParseAction(lambda t:int(t[0]))
variable = Word(alphas,exact=1)
operand = integer | v... | mpl-2.0 |
toobaz/pandas | pandas/tests/io/excel/test_xlsxwriter.py | 2 | 1980 | import warnings
import pytest
from pandas import DataFrame
from pandas.util.testing import ensure_clean
from pandas.io.excel import ExcelWriter
xlsxwriter = pytest.importorskip("xlsxwriter")
pytestmark = pytest.mark.parametrize("ext", [".xlsx"])
def test_column_format(ext):
# Test that column formats are app... | bsd-3-clause |
chen0510566/MissionPlanner | Lib/xdrlib.py | 55 | 5794 | """Implements (a subset of) Sun XDR -- eXternal Data Representation.
See: RFC 1014
"""
import struct
try:
from cStringIO import StringIO as _StringIO
except ImportError:
from StringIO import StringIO as _StringIO
__all__ = ["Error", "Packer", "Unpacker", "ConversionError"]
# exceptions
class... | gpl-3.0 |
doguitar/crossword | cherrypy/tutorial/tut05_derived_objects.py | 22 | 2266 | """
Tutorial - Object inheritance
You are free to derive your request handler classes from any base
class you wish. In most real-world applications, you will probably
want to create a central base class used for all your pages, which takes
care of things like printing a common page header and footer.
"""
import cherr... | mit |
Azure/azure-sdk-for-python | sdk/network/azure-mgmt-network/azure/mgmt/network/v2019_02_01/operations/_web_application_firewall_policies_operations.py | 1 | 20786 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for license information.
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes may ... | mit |
sebgoa/client-python | kubernetes/client/models/extensions_v1beta1_deployment_condition.py | 2 | 7599 | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... | apache-2.0 |
googleapis/googleapis-gen | google/cloud/websecurityscanner/v1beta/websecurityscanner-v1beta-py/google/cloud/websecurityscanner_v1beta/__init__.py | 2 | 3295 | # -*- coding: utf-8 -*-
# Copyright 2020 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or... | apache-2.0 |
metalshark/lesscss-python | test/test_lessc.py | 1 | 2006 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# This file is part of lesscss-python.
#
# lesscss-python 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)... | gpl-3.0 |
wd5/jangr | _django/core/management/commands/startapp.py | 321 | 1909 | import os
from django.core.management.base import copy_helper, CommandError, LabelCommand
from django.utils.importlib import import_module
class Command(LabelCommand):
help = "Creates a Django app directory structure for the given app name in the current directory."
args = "[appname]"
label = 'application... | bsd-3-clause |
inmcm/Simon_Speck_Ciphers | Python/simonspeckciphers/simon/simon.py | 1 | 13367 | from __future__ import print_function
from collections import deque
__author__ = 'inmcm'
class SimonCipher(object):
"""Simon Block Cipher Object"""
# Z Arrays (stored bit reversed for easier usage)
z0 = 0b01100111000011010100100010111110110011100001101010010001011111
z1 = 0b0101101000011001001111101... | mit |
saisaizhang/Food | flask/lib/python2.7/site-packages/wtforms/ext/django/orm.py | 177 | 6096 | """
Tools for generating forms based on Django models.
"""
from wtforms import fields as f
from wtforms import Form
from wtforms import validators
from wtforms.compat import iteritems
from wtforms.ext.django.fields import ModelSelectField
__all__ = (
'model_fields', 'model_form',
)
class ModelConverterBase(obje... | bsd-3-clause |
bakerlover/project4 | lib/flask/blueprints.py | 773 | 16320 | # -*- coding: utf-8 -*-
"""
flask.blueprints
~~~~~~~~~~~~~~~~
Blueprints are the recommended way to implement larger or more
pluggable applications in Flask 0.7 and later.
:copyright: (c) 2011 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from functools import update_wrap... | apache-2.0 |
sxjscience/tvm | apps/topi_recipe/rnn/lstm.py | 4 | 7638 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
rohit12/opencog | opencog/python/spatiotemporal/temporal_events/composition/depth_first_search_composition.py | 33 | 7461 | from copy import deepcopy
from math import fabs, sqrt
from spatiotemporal.temporal_events.composition.railway_framework import RailwaySystem, EPSILON
from spatiotemporal.temporal_events.trapezium import TemporalEventTrapezium
from utility.functions import almost_equals
def unpack(relation, start_reference=0, length_r... | agpl-3.0 |
dsacre/mididings | mididings/util.py | 2 | 10818 | # -*- coding: utf-8 -*-
#
# mididings
#
# Copyright (C) 2008-2014 Dominic Sacré <dominic.sacre@gmx.de>
#
# 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
# (... | gpl-2.0 |
AndKe/ardupilot | Tools/LogAnalyzer/tests/TestAutotune.py | 21 | 4797 | from LogAnalyzer import Test, TestResult
import DataflashLog
from VehicleType import VehicleType
# from ArduCopter/defines.h
AUTOTUNE_INITIALISED = 30
AUTOTUNE_OFF = 31
AUTOTUNE_RESTART = 32
AUTOTUNE_SUCCESS = 33
AUTOTUNE_FAILED = 34
AUTOTUNE_REACHED_LIMIT = 35
AU... | gpl-3.0 |
nanolearningllc/edx-platform-cypress-2 | common/test/acceptance/tests/lms/test_lms_acid_xblock.py | 122 | 5837 | # -*- coding: utf-8 -*-
"""
End-to-end tests for the LMS.
"""
from unittest import expectedFailure
from ..helpers import UniqueCourseTest
from ...pages.lms.auto_auth import AutoAuthPage
from ...pages.lms.course_info import CourseInfoPage
from ...pages.lms.tab_nav import TabNavPage
from ...pages.xblock.acid import Aci... | agpl-3.0 |
themiken/mtasa-blue | vendor/google-breakpad/src/third_party/protobuf/protobuf/gtest/test/gtest_nc_test.py | 277 | 3758 | #!/usr/bin/env python
#
# Copyright 2007, 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... | gpl-3.0 |
noironetworks/neutron | neutron/common/profiler.py | 5 | 1934 | # 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
# d... | apache-2.0 |
inmcm/Simon_Speck_Ciphers | Python/simonspeckciphers/speck/speck.py | 1 | 10094 | from __future__ import print_function
class SpeckCipher(object):
"""Speck Block Cipher Object"""
# valid cipher configurations stored:
# block_size:{key_size:number_rounds}
__valid_setups = {32: {64: 22},
48: {72: 22, 96: 23},
64: {96: 26, 128: 27},
... | mit |
keelhaule/alfanous | src/alfanous/Support/whoosh/lang/porter2.py | 11 | 9418 | # Copyright (c) 2008 Michael Dirolf (mike at dirolf dot 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
# restriction, including without limitation the rights to use,
# copy, m... | agpl-3.0 |
neerajvashistha/pa-dude | lib/python2.7/site-packages/sphinx/builders/xml.py | 3 | 3007 | # -*- coding: utf-8 -*-
"""
sphinx.builders.xml
~~~~~~~~~~~~~~~~~~~
Docutils-native XML and pseudo-XML builders.
:copyright: Copyright 2007-2016 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import codecs
from os import path
from docutils import nodes
from docutils... | mit |
technologiescollege/s2a_fr | s2a/Python/Lib/bsddb/test/test_compare.py | 72 | 15142 | """
TestCases for python DB duplicate and Btree key comparison function.
"""
import sys, os, re
import test_all
from cStringIO import StringIO
import unittest
from test_all import db, dbshelve, test_support, \
get_new_environment_path, get_new_database_path
# Needed for python 3. "cmp" vanished in 3.0.1
de... | gpl-3.0 |
fuselock/odoo | addons/hr_expense/tests/test_journal_entries.py | 251 | 2923 | from openerp.tests.common import TransactionCase
from openerp import netsvc, workflow
class TestCheckJournalEntry(TransactionCase):
"""
Check journal entries when the expense product is having tax which is tax included.
"""
def setUp(self):
super(TestCheckJournalEntry, self).setUp()
... | agpl-3.0 |
pinterb/st2incubator | packs/st2cd/actions/action_run.py | 1 | 1636 | #!/usr/bin/env python
import os
import sys
import time
import json
import argparse
from st2client import models
from st2client.client import Client
END_STATES = ['succeeded', 'failed']
ST2HOST = 'localhost'
parser = argparse.ArgumentParser()
parser.add_argument('--name', action="store", dest="name", required=True)
... | apache-2.0 |
pyKy/kivy-doc-ja | kivy/tests/test_uix_boxlayout.py | 78 | 2666 | '''
Box layout unit test
====================
Order matter.
On the screen, most of example must have the red->blue->green order.
'''
from kivy.tests.common import GraphicUnitTest
class UIXBoxLayoutTestcase(GraphicUnitTest):
def box(self, r, g, b):
from kivy.uix.widget import Widget
from kivy.gr... | mit |
viewfinderco/viewfinder | backend/www/view.py | 13 | 1821 | # Copyright 2011 Viewfinder Inc. All Rights Reserved.
"""Handlers for rendering views, or streams of images.
Views are searches over the image database in the context of a
particular logged in user, browser-reported location, and current
time.
ViewHandler: Returns JSON data containing image locations based
... | apache-2.0 |
powerjg/gem5-ci-test | ext/pybind11/tools/mkdoc.py | 13 | 10474 | #!/usr/bin/env python3
#
# Syntax: mkdoc.py [-I<path> ..] [.. a list of header files ..]
#
# Extract documentation from C++ header files to use it in Python bindings
#
import os
import sys
import platform
import re
import textwrap
from clang import cindex
from clang.cindex import CursorKind
from collections import ... | bsd-3-clause |
nexiles/odoo | addons/l10n_fr/l10n_fr.py | 336 | 2089 | # -*- 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 |
yyny1789/WinObjC | deps/3rdparty/icu/icu/source/tools/icu-svnprops-check.py | 388 | 9251 | #! /usr/bin/python
# Copyright (C) 2009-2011, International Business Machines Corporation, Google and Others.
# All rights reserved.
#
# Script to check and fix svn property settings for ICU source files.
# Also check for the correct line endings on files with svn:eol-style = native
#
# THIS SCRIPT DOES NOT WORK O... | mit |
pandeyop/rally | tests/hacking/checks.py | 3 | 12536 | # 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 |
amarian12/p2pool-adaptive-drk | fpconst.py | 310 | 5754 | """Utilities for handling IEEE 754 floating point special values
This python module implements constants and functions for working with
IEEE754 double-precision special values. It provides constants for
Not-a-Number (NaN), Positive Infinity (PosInf), and Negative Infinity
(NegInf), as well as functions to test for th... | gpl-3.0 |
anthraxx/fips | mod/tools/git.py | 2 | 7644 | """wrapper for some git commands"""
import re
import subprocess
from mod import log
name = 'git'
platforms = ['linux', 'osx', 'win']
optional = False
not_found = "git not found in path, can't happen(?)"
# default git clone depth
clone_depth = 10
#---------------------------------------------------------------------... | mit |
mxamin/youtube-dl | youtube_dl/extractor/ustream.py | 1 | 5485 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urlparse,
)
from ..utils import (
ExtractorError,
int_or_none,
float_or_none,
)
class UstreamIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?ustream\.tv/(?P<type>recorded|embed|... | unlicense |
ThibaultReuille/graphiti | Scripts/console/graph.py | 1 | 6448 | import script
from script import *
class Topology(script.Script):
def neighbors(self, args):
new_neighbors = list()
if 'nodes' in self.console.query:
graph = std.load_nx_graph()
for nid in self.console.query['nodes']:
for neighbor in graph.neighbors(nid):
if neighbor not in self.console.query['nod... | bsd-2-clause |
elbeardmorez/quodlibet | quodlibet/tests/quality/util.py | 1 | 1751 | # -*- coding: utf-8 -*-
# Copyright 2017 Christoph Reiter
#
# 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.
import os
f... | gpl-2.0 |
erwin00776/comment_label_worm | bow/comment_download_cut.py | 1 | 10195 | __author__ = 'erwin'
#coding=utf-8
import codecs
import urllib2
import re
import threading
import time
import os
import jieba
query_done_set = {}
def cut_line(line):
seg_list = jieba.cut(line, cut_all=False)
return " ".join(seg_list)
def cut_words(src, dst):
fin = codecs.open(src, 'r', 'utf-8')
f... | mit |
oihane/odoo | addons/l10n_it/__init__.py | 447 | 1161 | ##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2010
# OpenERP Italian Community (<http://www.openerp-italia.org>)
# Servabit srl
# Agile Business Group sagl
# Domsense srl
# Albatos srl
#
# Copyright (C)... | agpl-3.0 |
Eric89GXL/vispy | vispy/geometry/curves.py | 21 | 13145 | #
# Anti-Grain Geometry - Version 2.4
# Copyright (C) 2002-2005 Maxim Shemanarev (McSeem)
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
# 1. Redistributions of source code must retain the above copyright
# ... | bsd-3-clause |
DBCDK/OpenSearch-webservice | script/analyze-timings.py | 1 | 10413 | #!/usr/bin/env python3
# This script reads a json file with timing information from OpenSearch, and
# checks that the timing information from all log lines "adds up", that is,
# that non-overlapping measurements covers more than 99% of the time spent in Total.
import argparse
import sys
import traceback
import json
... | agpl-3.0 |
lumig242/Hue-Integration-with-CDAP | desktop/core/ext-py/elementtree/elementtree/HTMLTreeBuilder.py | 103 | 7826 | #
# ElementTree
# $Id: HTMLTreeBuilder.py 2325 2005-03-16 15:50:43Z fredrik $
#
# a simple tree builder, for HTML input
#
# history:
# 2002-04-06 fl created
# 2002-04-07 fl ignore IMG and HR end tags
# 2002-04-07 fl added support for 1.5.2 and later
# 2003-04-13 fl added HTMLTreeBuilder alias
# 2004-12-02 fl ... | apache-2.0 |
pexip/os-python-colorama | colorama/tests/initialise_test.py | 3 | 4244 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import os
import sys
from unittest import TestCase, main, skipUnless
try:
from unittest.mock import patch
except ImportError:
from mock import patch
from ..ansitowin32 import StreamWrapper
from ..initialise import init
from .utils impo... | bsd-3-clause |
etos/django | tests/annotations/tests.py | 6 | 21667 | import datetime
from decimal import Decimal
from django.core.exceptions import FieldDoesNotExist, FieldError
from django.db.models import (
BooleanField, CharField, Count, DateTimeField, ExpressionWrapper, F, Func,
IntegerField, NullBooleanField, Q, Sum, Value,
)
from django.db.models.functions import Length, ... | bsd-3-clause |
McNetic/CouchPotatoServer-de | libs/CodernityDB/rr_cache.py | 82 | 3673 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright 2011-2013 Codernity (http://codernity.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/L... | gpl-3.0 |
ClifHouck/desperado | desperado/currency.py | 1 | 1299 | import re
class InvalidCurrencyFormat(Exception):
def __init__(self, reason, data):
self.reason = reason
self.data = data
# XXX
# FIXME: We're entering dangerous territory here... test thoroughly before doing anything significant.
# Or maybe replace entirely.
# XXX
class Dollars(object):
def... | bsd-3-clause |
flutter/engine | build/copy_info_plist.py | 14 | 1271 | #!/usr/bin/env python
#
# Copyright 2013 The Flutter Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
"""
Copies the Info.plist and adds extra fields to it like the git hash of the
engine.
Precondition: $CWD/../../flutter is the path t... | bsd-3-clause |
MichaelCoughlinAN/Odds-N-Ends | Python/Python Modules/lxml-4.2.0/doc/docstructure.py | 19 | 1107 |
import os
if os.path.exists(os.path.join(os.path.dirname(__file__), '..', 'funding.txt')):
funding = ('../funding.txt',)
else:
funding = ()
SITE_STRUCTURE = [
('lxml', ('main.txt', 'intro.txt', '../INSTALL.txt', # 'lxml2.txt',
'performance.txt', 'compatibility.txt', 'FAQ.txt') + funding),
... | gpl-3.0 |
beeverycreative/BeePanel | Settings.py | 1 | 5473 | #!/usr/bin/env python3
"""
* Copyright (c) 2015 BEEVC - Electronic Systems This file is part of BEESOFT
* 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... | gpl-2.0 |
popazerty/beyonwiz-sh4 | lib/python/Components/Renderer/PositionGauge.py | 132 | 1892 | from Renderer import Renderer
from enigma import ePositionGauge
class PositionGauge(Renderer):
def __init__(self):
Renderer.__init__(self)
self.__position = 0
self.__seek_position = 0
self.__length = 0
self.__seek_enable = 0
self.__cutlist = [ ]
GUI_WIDGET = ePositionGauge
def postWidgetCreate(self, i... | gpl-2.0 |
eemirtekin/edx-platform | common/lib/xmodule/xmodule/tests/test_progress.py | 56 | 5073 | """Module progress tests"""
import unittest
from mock import Mock
from xblock.field_data import DictFieldData
from xmodule.progress import Progress
from xmodule import x_module
from . import get_test_system
class ProgressTest(unittest.TestCase):
''' Test that basic Progress objects work. A Progress represent... | agpl-3.0 |
marratj/ansible | lib/ansible/modules/network/nxos/nxos_pim_rp_address.py | 17 | 6358 | #!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | gpl-3.0 |
apache/incubator-airflow | airflow/api_connexion/schemas/task_schema.py | 10 | 2992 | # Licensed to the Apache Software Foundation (ASF) under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. The ASF licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you may not u... | apache-2.0 |
ThomasMiconi/htmresearch | projects/capybara/sandbox/classification/run_htm_network.py | 9 | 13195 | #!/usr/bin/env python
# ----------------------------------------------------------------------
# Numenta Platform for Intelligent Computing (NuPIC)
# Copyright (C) 2016, Numenta, Inc. Unless you have an agreement
# with Numenta, Inc., for a separate license for this software code, the
# following terms and conditions ... | agpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.