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 |
|---|---|---|---|---|---|
pallets/jinja2 | src/jinja2/tests.py | 3 | 4616 | """Built-in template tests used with the ``is`` operator."""
import operator
import re
from collections import abc
from numbers import Number
from .runtime import Undefined
number_re = re.compile(r"^-?\d+(\.\d+)?$")
regex_type = type(number_re)
test_callable = callable
def test_odd(value):
"""Return true if the... | bsd-3-clause |
mauriceling/dose | ez_setup.py | 13 | 8815 | #!python
"""Bootstrap setuptools installation
If you want to use setuptools in your package's setup.py, just include this
file in the same directory with it, and add this to the top of your setup.py::
from ez_setup import use_setuptools
use_setuptools()
If you want to require a specific version of setuptools... | gpl-3.0 |
geishatokyo-lightning/lightning | lightning_core/vg/cssanim.py | 1 | 14273 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (c) 2011 Geisha Tokyo Entertainment, Inc.
#
# 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 withou... | mit |
rplauche/plugin.video.netflixbmc | resources/lib/pyOpenSSL/pyOpenSSL-0.13-py2.7-win32/OpenSSL/test/test_rand.py | 88 | 5802 | # Copyright (c) Frederick Dean
# See LICENSE for details.
"""
Unit tests for L{OpenSSL.rand}.
"""
from unittest import main
import os
import stat
from OpenSSL.test.util import TestCase, b
from OpenSSL import rand
class RandTests(TestCase):
def test_bytes_wrong_args(self):
"""
L{OpenSSL.rand.byt... | gpl-2.0 |
Chilledheart/chromium | third_party/ply/__init__.py | 108 | 1797 | # PLY package
# Author: David Beazley (dave@dabeaz.com)
# -----------------------------------------------------------------------------
# ply: yacc.py
#
# Copyright (C) 2001-2011,
# David M. Beazley (Dabeaz LLC)
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification... | bsd-3-clause |
etos/django | tests/utils_tests/test_duration.py | 73 | 3332 | import datetime
import unittest
from django.utils.dateparse import parse_duration
from django.utils.duration import duration_iso_string, duration_string
class TestDurationString(unittest.TestCase):
def test_simple(self):
duration = datetime.timedelta(hours=1, minutes=3, seconds=5)
self.assertEqu... | bsd-3-clause |
tethysplatform/tethys | tests/unit_tests/test_tethys_apps/test_base/test_permissions.py | 2 | 3248 | import unittest
import tethys_apps.base.permissions as tethys_permission
from unittest import mock
from django.test import RequestFactory
from ... import UserFactory
class TestPermission(unittest.TestCase):
def setUp(self):
self.name = 'test_name'
self.description = 'test_description'
sel... | bsd-2-clause |
privateip/ansible | lib/ansible/playbook/role/definition.py | 22 | 9037 | # (c) 2014 Michael DeHaan, <michael@ansible.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 ve... | gpl-3.0 |
mxOBS/deb-pkg_trusty_chromium-browser | third_party/trace-viewer/third_party/tvcm/third_party/closure_linter/closure_linter/gjslint.py | 135 | 7991 | #!/usr/bin/env python
# python2.6 for command-line runs using p4lib. pylint: disable-msg=C6301
#
# Copyright 2007 The Closure Linter Authors. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a co... | bsd-3-clause |
FusionSP/android_external_chromium_org | PRESUBMIT_test.py | 26 | 27530 | #!/usr/bin/env python
# Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import glob
import json
import os
import re
import subprocess
import sys
import unittest
import PRESUBMIT
_TEST_DATA_DIR = 'base... | bsd-3-clause |
hectord/lettuce | tests/integration/lib/Django-1.2.5/django/contrib/formtools/wizard.py | 44 | 10889 | """
FormWizard class -- implements a multi-page form, validating between each
step and storing the form's state as HTML hidden fields so that no state is
stored on the server side.
"""
import cPickle as pickle
from django import forms
from django.conf import settings
from django.http import Http404
from django.shortc... | gpl-3.0 |
elkingtonmcb/pattern | test/test_es.py | 21 | 11903 | # -*- coding: utf-8 -*-
import os, sys; sys.path.insert(0, os.path.join(os.path.dirname(__file__), ".."))
import unittest
import subprocess
from pattern import es
try:
PATH = os.path.dirname(os.path.realpath(__file__))
except:
PATH = ""
#-----------------------------------------------------------------------... | bsd-3-clause |
jayantk/jklol | scripts/sequence/generate_emission_features.py | 1 | 1090 | #!/usr/local/lib/python2.6
import re
import sys
filename = sys.argv[1]
def generate_string_features(word, label):
dict = {}
'''
patterns = ['\d$', '\d\d$', '\d\d\d+$', '\d?\d?:\d\d$',
'[0-9:]+$', '[A-Z]', '[A-Z]$', '[A-Z][A-Z]$',
'[A-Z]+$', '[^0-9A-Za-z]+$', '[^0-9]+$'... | bsd-2-clause |
cdepman/falcon_api | site-packages/pip/_vendor/requests/packages/chardet/mbcssm.py | 1783 | 19590 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... | mit |
doomsterinc/odoo | addons/analytic/analytic.py | 48 | 18671 | # -*- 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 |
linyiqun/minos | supervisor/superlance/process_exit_monitor.py | 5 | 2353 | #!/usr/bin/env python -u
##############################################################################
#
# This script is subject to the execution of the post script when some process
# has entered the stopped or exited state.
#
##############################################################################
import Co... | apache-2.0 |
praba230890/PYPOWER | pypower/t/t_case_ext.py | 2 | 4105 | # Copyright (c) 1996-2015 PSERC. All rights reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
"""Case data in external format.
"""
from numpy import array, ones, arange, r_
def t_case_ext():
"""Case data in external format used to test C{ext2int} and... | bsd-3-clause |
vnsofthe/odoo-dev | addons/stock/tests/test_resupply.py | 214 | 2457 | # -*- coding: utf-8 -*-
from openerp.addons.stock.tests.common import TestStockCommon
from openerp.tools import mute_logger, float_round
class TestResupply(TestStockCommon):
def setUp(self):
super(TestResupply, self).setUp()
self.Warehouse = self.env['stock.warehouse']
# create 2 WH, BIG ... | agpl-3.0 |
kaboramb/PortDog | portdog.py | 4 | 12016 | #!/usr/bin/env python
import socket,sys
import time
from struct import *
from collections import OrderedDict
import os
import commands
import signal
import optparse
#define ETH_P_ALL 0x0003
class bgcolors:
HEADER = '\033[95m'
OKBLUE = '\033[94m'
OKGREEN = '\033[92m'
WARNING = '\033[93m'
FAIL = '\033[91m'
EN... | gpl-2.0 |
Emergya/icm-openedx-educamadrid-platform-basic | common/djangoapps/student/roles.py | 45 | 11648 | """
Classes used to model the roles used in the courseware. Each role is responsible for checking membership,
adding users, removing users, and listing members
"""
from abc import ABCMeta, abstractmethod
from django.contrib.auth.models import User
import logging
from student.models import CourseAccessRole
from xmodu... | agpl-3.0 |
siosio/intellij-community | plugins/hg4idea/testData/bin/mercurial/context.py | 90 | 45249 | # context.py - changeset and file context objects for mercurial
#
# Copyright 2006, 2007 Matt Mackall <mpm@selenic.com>
#
# This software may be used and distributed according to the terms of the
# GNU General Public License version 2 or any later version.
from node import nullid, nullrev, short, hex, bin
from i18n im... | apache-2.0 |
plotly/plotly.py | packages/python/plotly/plotly/graph_objs/scatter/unselected/_textfont.py | 2 | 5197 | from plotly.basedatatypes import BaseTraceHierarchyType as _BaseTraceHierarchyType
import copy as _copy
class Textfont(_BaseTraceHierarchyType):
# class properties
# --------------------
_parent_path_str = "scatter.unselected"
_path_str = "scatter.unselected.textfont"
_valid_props = {"color"}
... | mit |
Xion/taipan | tests/test_functional/test_functions.py | 1 | 11928 | """
Tests for the .functional.functions module.
"""
from collections import namedtuple
from contextlib import contextmanager
from taipan.testing import TestCase
import taipan.functional.functions as __unit__
# Constant functions
class _ConstantFunction(TestCase):
EMPTY_TUPLE = ()
EMPTY_LIST = []
DIFFE... | bsd-2-clause |
jammerful/buildbot | www/codeparameter/setup.py | 10 | 1595 | #!/usr/bin/env python
#
# 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
# A... | gpl-2.0 |
ellmetha/django-machina | machina/core/loading.py | 1 | 3900 | import sys
import traceback
from django.conf import settings
class AppNotFoundError(Exception):
pass
class ClassNotFoundError(Exception):
pass
def get_class(module_label, classname):
return get_classes(module_label, [classname, ])[0]
def get_classes(module_label, classnames):
""" Imports a set ... | bsd-3-clause |
kenshay/ImageScript | ProgramData/SystemFiles/Python/Lib/site-packages/pandas/core/ops.py | 7 | 54105 | """
Arithmetic operations for PandasObjects
This is not a public API.
"""
# necessary to enforce truediv in Python 2.X
from __future__ import division
import operator
import warnings
import numpy as np
import pandas as pd
import datetime
from pandas import compat, lib, tslib
import pandas.index as _index
from pandas.u... | gpl-3.0 |
yqm/sl4a | python/gdata/tests/gdata_tests/apps/service_test.py | 128 | 18741 | #!/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 |
ericdill/PyXRF | pyxrf/model/guessparam.py | 1 | 27631 | # ######################################################################
# Copyright (c) 2014, Brookhaven Science Associates, Brookhaven #
# National Laboratory. All rights reserved. #
# #
# Redistribution and use in ... | bsd-3-clause |
zycdragonball/tensorflow | tensorflow/python/kernel_tests/conv1d_test.py | 97 | 2169 | # 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 |
mSenyor/sl4a | python/src/Lib/idlelib/WindowList.py | 194 | 2473 | from Tkinter import *
class WindowList:
def __init__(self):
self.dict = {}
self.callbacks = []
def add(self, window):
window.after_idle(self.call_callbacks)
self.dict[str(window)] = window
def delete(self, window):
try:
del self.dict[str(window)]
... | apache-2.0 |
ewindisch/nova | nova/virt/xenapi/host.py | 10 | 14405 | # Copyright (c) 2012 Citrix Systems, Inc.
# Copyright 2010 OpenStack Foundation
#
# 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... | apache-2.0 |
aznashwan/heat2arm | heat2arm/translators/networking/secgroups/ec2_secgroup.py | 1 | 3254 | # Copyright 2015 Cloudbase Solutions Srl
# 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 r... | apache-2.0 |
dims/ironic | ironic/drivers/modules/amt/power.py | 4 | 9566 | #
# 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... | apache-2.0 |
cboling/SDNdbg | docs/old-stuff/pydzcvr/doc/neutron/tests/unit/test_l3_schedulers.py | 2 | 53905 | # Copyright (c) 2013 OpenStack Foundation
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless ... | apache-2.0 |
mobiuscoin/p2pool-mobi | p2pool/bitcoin/getwork.py | 267 | 2912 | '''
Representation of a getwork request/reply
'''
from __future__ import division
from . import data as bitcoin_data
from . import sha256
from p2pool.util import pack
def _swap4(s):
if len(s) % 4:
raise ValueError()
return ''.join(s[x:x+4][::-1] for x in xrange(0, len(s), 4))
class BlockAttempt(obje... | gpl-3.0 |
corakwue/ftrace | ftrace/parsers/sched_load_avg_cpu.py | 1 | 2005 | #!/usr/bin/python
# Copyright 2015 Huawei Devices USA 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 r... | apache-2.0 |
pdehaye/theming-edx-platform | cms/djangoapps/contentstore/tests/test_crud.py | 2 | 12670 | import unittest
from xmodule import templates
from xmodule.modulestore.tests import persistent_factories
from xmodule.course_module import CourseDescriptor
from xmodule.modulestore.django import modulestore
from xmodule.seq_module import SequenceDescriptor
from xmodule.capa_module import CapaDescriptor
from xmodule.mod... | agpl-3.0 |
nickster5001/ctracker | flask/lib/python3.4/site-packages/sqlalchemy/event/legacy.py | 33 | 5818 | # event/legacy.py
# Copyright (C) 2005-2014 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
"""Routines to handle adaption of legacy call signatures,
generation of deprecation ... | mit |
tomncooper/heron | heron/shell/src/python/handlers/filestatshandler.py | 4 | 2385 | #!/usr/bin/env python
# -*- encoding: 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... | apache-2.0 |
lodemo/CATANA | src/face_recognition/youtube_dl/extractor/streamango.py | 22 | 2337 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
determine_ext,
int_or_none,
js_to_json,
)
class StreamangoIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?streamango\.com/(?:f|embed)/(?P<id>[^/?#&]+)'
_TESTS = [{
... | mit |
grepme/cmput410-project | api/urls.py | 1 | 1779 | from django.conf.urls import patterns, include, url
guid_regex = "[0-9a-fA-F]{8}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{4}-[0-9a-fA-F]{12}"
sha1_regex = "[a-zA-Z0-9]+"
id_regex = "(({guid})|({sha1}))".format(guid=guid_regex,sha1=sha1_regex)
urlpatterns = patterns('api.views',
# get posts ... | apache-2.0 |
coxmediagroup/googleads-python-lib | examples/adwords/v201506/campaign_management/set_criterion_bid_modifier.py | 3 | 2536 | #!/usr/bin/python
#
# Copyright 2015 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 |
tesidroni/mp | Lib/site-packages/numpy/f2py/rules.py | 51 | 52904 | #!"C:\Users\hog\Documents\Visual Studio 2010\Projects\ArdupilotMega\ArdupilotMega\bin\Debug\ipy.exe"
"""
Rules for building C/API module with f2py2e.
Here is a skeleton of a new wrapper function (13Dec2001):
wrapper_function(args)
declarations
get_python_arguments, say, `a' and `b'
get_a_from_python
if (suc... | gpl-3.0 |
JackDanger/sentry | src/sentry/api/endpoints/filechange.py | 3 | 1634 | from __future__ import absolute_import
from rest_framework.exceptions import PermissionDenied
from sentry.api.base import DocSection
from sentry.api.bases.organization import OrganizationReleasesBaseEndpoint
from sentry.api.exceptions import ResourceDoesNotExist
from sentry.api.serializers import serialize
from sentr... | bsd-3-clause |
algebrology/ghost | node_modules/pygmentize-bundled/vendor/pygments/build-3.3/pygments/lexers/parsers.py | 363 | 25835 | # -*- coding: utf-8 -*-
"""
pygments.lexers.parsers
~~~~~~~~~~~~~~~~~~~~~~~
Lexers for parser generators.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, DelegatingLexer, \
include... | mit |
kcpawan/django | tests/template_tests/filter_tests/test_cut.py | 521 | 2269 | from django.template.defaultfilters import cut
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class CutTests(SimpleTestCase):
@setup({'cut01': '{% autoescape off %}{{ a|cut:"x" }} {{ b|cut:"x" }}{% endautoescape %}'})
def test_cut01(self):
... | bsd-3-clause |
bxshi/nghttp2 | tests/end_to_end.py | 23 | 2830 | #!/usr/bin/env python
"""End to end tests for the utility programs.
This test assumes the utilities inside src directory have already been
built.
At the moment top_buiddir is not in the environment, but top_builddir would be
more reliable than '..', so it's worth trying to pull it from the environment.
"""
__author_... | mit |
tmfksoft/FreeNC | modules/modpython/znc_core.py | 1 | 256410 | # This file was automatically generated by SWIG (http://www.swig.org).
# Version 2.0.8
#
# Do not make changes to this file unless you know what you are doing--modify
# the SWIG interface file instead.
from sys import version_info
if version_info >= (2,6,0):
def swig_import_helper():
from os.path import ... | gpl-2.0 |
soldag/home-assistant | tests/testing_config/custom_components/test/device_tracker.py | 20 | 2110 | """Provide a mock device scanner."""
from homeassistant.components.device_tracker import DeviceScanner
from homeassistant.components.device_tracker.config_entry import ScannerEntity
from homeassistant.components.device_tracker.const import SOURCE_TYPE_ROUTER
def get_scanner(hass, config):
"""Return a mock scanne... | apache-2.0 |
jspilker/visilens | examples/Ex1_get_data_continuum.py | 1 | 4773 | """
Example 1, to be run within CASA. This script serves as a guideline
for how to get data out of a CASA ms and into a format which
visilens can use. We really don't need all that much information,
so we keep only the columns we need.
To keep the number of visibilities low, we first average the data
a bit. In this p... | mit |
bbondy/brianbondy.gae | libs/sx/pisa3/pisa_tables.py | 1 | 13877 | # -*- coding: ISO-8859-1 -*-
# Copyright 2010 Dirk Holtwick, holtwick.it
#
# 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
#
# Unl... | mit |
grilo/ansible-1 | lib/ansible/modules/storage/netapp/netapp_e_volume.py | 12 | 23522 | #!/usr/bin/python
# (c) 2016, NetApp, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['preview'],
... | gpl-3.0 |
darcy0511/Dato-Core | src/unity/python/graphlab/test/test_io.py | 13 | 15881 | '''
Copyright (C) 2015 Dato, Inc.
All rights reserved.
This software may be modified and distributed under the terms
of the BSD license. See the DATO-PYTHON-LICENSE file for details.
'''
import commands
import json
import logging
import os
import re
import tempfile
import unittest
import pandas
import graphlab
import... | agpl-3.0 |
pabloborrego93/edx-platform | openedx/core/djangoapps/content/course_structures/models.py | 20 | 3164 | """
Django ORM model specifications for the Course Structures sub-application
"""
import json
import logging
from collections import OrderedDict
from model_utils.models import TimeStampedModel
from util.models import CompressedTextField
from openedx.core.djangoapps.xmodule_django.models import CourseKeyField, UsageKe... | agpl-3.0 |
fossilet/ansible | samples/multi_queues.py | 37 | 4885 | #!/usr/bin/env python
import sys
import time
import Queue
import traceback
import multiprocessing
from ansible.inventory import Inventory
from ansible.inventory.host import Host
from ansible.playbook.play import Play
from ansible.playbook.play_context import PlayContext
from ansible.playbook.task import Task
from ans... | gpl-3.0 |
timevortexproject/timevortex | weather/utils/globals.py | 1 | 1404 | #!/usr/bin/python3
# -*- coding: utf8 -*-
# -*- Mode: Python; py-indent-offset: 4 -*-
"""Globals for weather app"""
from datetime import datetime, timedelta
from django.conf import settings
KEY_METEAR_NO_SITE_ID = "metear_no_site_id"
KEY_METEAR_BAD_URL = "metear_bad_url"
KEY_METEAR_PROBLEM_WS = "metear_problem_ws"
K... | mit |
uclouvain/osis | reference/api/serializers/study_domain.py | 1 | 1550 | ##############################################################################
#
# OSIS stands for Open Student Information System. It's an application
# designed to manage the core business of higher education institutions,
# such as universities, faculties, institutes and professional schools.
# The core ... | agpl-3.0 |
meghana1995/sympy | sympy/conftest.py | 20 | 2267 | from __future__ import print_function, division
import sys
sys._running_pytest = True
import pytest
from sympy.core.cache import clear_cache
import re
sp = re.compile(r'([0-9]+)/([1-9][0-9]*)')
def process_split(session, config, items):
split = config.getoption("--split")
if not split:
return
m ... | bsd-3-clause |
rholy/dnf | tests/plugins/lucky.py | 13 | 1185 | # Copyright (C) 2013 Red Hat, Inc.
#
# This copyrighted material is made available to anyone wishing to use,
# modify, copy, or redistribute it subject to the terms and conditions of
# the GNU General Public License v.2, or (at your option) any later version.
# This program is distributed in the hope that it will be u... | gpl-2.0 |
matthewjwoodruff/language-of-choice | dd.py | 2 | 3833 | "BDDs; actually multiway and multiterminal DDs."
from utils import memoize
optimize = True
class Node(object):
"A decision-diagram node."
__invert__ = lambda self: self(lit1, lit0)
__and__ = lambda self, other: self(lit0, other)
__or__ = lambda self, other: self(other, lit1)
__xor__... | gpl-3.0 |
sdcooke/django | tests/aggregation/tests.py | 108 | 45704 | from __future__ import unicode_literals
import datetime
import re
from decimal import Decimal
from django.core.exceptions import FieldError
from django.db import connection
from django.db.models import (
F, Aggregate, Avg, Count, DecimalField, DurationField, FloatField, Func,
IntegerField, Max, Min, Sum, Valu... | bsd-3-clause |
lmmsoft/LeetCode | LeetCode-Algorithm/1292. Maximum Side Length of a Square with Sum Less than or Equal to Threshold/1292.py | 1 | 211159 | from typing import List
class Solution:
def maxSideLength(self, mat: List[List[int]], threshold: int) -> int:
x = len(mat)
y = len(mat[0])
sz = min(x, y)
pre = [[0 for _ in range(y)] for _ in range(x)]
for i in range(x):
s = 0
for j in range(y):
... | gpl-2.0 |
fortyninemaps/karta | tests/gpx_tests.py | 1 | 2736 | import unittest
import os
from test_helper import TESTDATA
import numpy as np
import karta
import karta.vector as vector
from karta.vector.geometry import Point, Multipoint, Line, Polygon
class GPXTests(unittest.TestCase):
def setUp(self):
self.points = [vector.gpx.Point((np.random.random(), np.random.ra... | mit |
cryptapus/electrum-myr | lib/jsonrpc.py | 1 | 3726 | #!/usr/bin/env python3
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2018 Thomas Voegtlin
#
# 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 withou... | mit |
idrogeno/FusionOE | lib/python/Components/Renderer/RollerCharLCDLong.py | 43 | 1756 | from Components.config import config
from Renderer import Renderer
from enigma import eLabel, eTimer
from Components.VariableText import VariableText
class RollerCharLCDLong(VariableText, Renderer):
def __init__(self):
Renderer.__init__(self)
VariableText.__init__(self)
self.stringlength = 36
GUI_WIDGET = eL... | gpl-2.0 |
raajitr/django_hangman | env/lib/python2.7/site-packages/rest_framework/negotiation.py | 33 | 4084 | """
Content negotiation deals with selecting an appropriate renderer given the
incoming request. Typically this will be based on the request's Accept header.
"""
from __future__ import unicode_literals
from django.http import Http404
from rest_framework import HTTP_HEADER_ENCODING, exceptions
from rest_framework.set... | mit |
ryfeus/lambda-packs | Tensorflow_OpenCV_Nightly/source/tensorflow/python/framework/graph_util_impl.py | 21 | 11090 | # 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... | mit |
RO-ny9/python-for-android | python3-alpha/python3-src/Lib/idlelib/EditorWindow.py | 45 | 62349 | import sys
import os
import re
import string
import imp
from tkinter import *
import tkinter.simpledialog as tkSimpleDialog
import tkinter.messagebox as tkMessageBox
import traceback
import webbrowser
from idlelib.MultiCall import MultiCallCreator
from idlelib import idlever
from idlelib import WindowList
from idlelib... | apache-2.0 |
benhylau/cjdns | contrib/python/cjdnsadmin/cli.py | 18 | 2003 | #!/usr/bin/env python2
# You may redistribute this program 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 hope that it will be useful,
# bu... | gpl-3.0 |
ThedaWaln/sorting | quicksort.py | 2 | 1210 | import random
from sorter import Sorter
from console import ConsolePrinter
class QuickSort(Sorter):
def sort(self):
self._quicksort(0, len(self.data) - 1)
self.notify(self.data)
def _partition(self, left, right, pivot):
pivotValue = self.data[pivot]
self._swap(right, pivot)
... | mit |
qwefi/nova | nova/db/sqlalchemy/migrate_repo/versions/193_cinder_cleanup.py | 3 | 5902 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (c) 2013 Svetlana Shturm (sshturm@mirantis.com).
# 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
#
# ... | apache-2.0 |
OpenState-SDN/ryu | ryu/hooks.py | 43 | 2575 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# 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://... | apache-2.0 |
google-research/google-research | ipagnn/adapters/gat_adapters.py | 1 | 2892 | # coding=utf-8
# Copyright 2021 The Google Research 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 applicab... | apache-2.0 |
RichardLitt/wyrd-django-dev | tests/regressiontests/localflavor/si/tests.py | 14 | 23489 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from datetime import date
from django.contrib.localflavor.si.forms import (SIEMSOField, SITaxNumberField,
SIPhoneNumberField, SIPostalCodeField, SIPostalCodeSelect)
from django.test import SimpleTestCase
class SILocalFlavorTests(SimpleTestCase):
... | bsd-3-clause |
e-gob/plataforma-kioscos-autoatencion | scripts/ansible-play/.venv/lib/python2.7/site-packages/ansible/modules/cloud/amazon/ec2_vpc_nacl.py | 29 | 19862 | #!/usr/bin/python
# Copyright: 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__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterf... | bsd-3-clause |
googleapis/python-workflows | google/cloud/workflows_v1beta/services/workflows/pagers.py | 1 | 5782 | # -*- 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 |
betterlife/psi | psi/app/views/inventory_transaction.py | 2 | 6267 | from datetime import datetime
from flask_admin.contrib.sqla.ajax import QueryAjaxModelLoader
from flask_admin.model.fields import AjaxSelectField
from psi.app.models import Product
from psi.app import service
from psi.app.models import InventoryTransactionLine, InventoryTransaction
from psi.app.utils import security_... | mit |
sakthivigneshr/homeauto | src/control/rpi/rpi_gpio_slave.py | 1 | 1752 | import pika
import RPi.GPIO as GPIO
import paho.mqtt.client as mqtt
from threading import Thread
USER = "test"
PASS = "test123"
VHOST = "/cloudlynk"
HOST = "mohawk.link"
KEY = "solfeta"
XCHANGE = "home"
OUTPUT_PIN = 7
def callback(ch, method, properties, body):
level = int(body)
print("received msg: " + repr(level)... | mit |
mozilla/mozilla-ignite | vendor-local/lib/python/markdown/util.py | 7 | 3462 | # -*- coding: utf-8 -*-
import re
from logging import CRITICAL
import etree_loader
"""
CONSTANTS
=============================================================================
"""
"""
Constants you might want to modify
-----------------------------------------------------------------------------
"""
BLOCK_LEVEL_ELE... | bsd-3-clause |
rhattersley/iris | lib/iris/tests/unit/plot/__init__.py | 9 | 4522 | # (C) British Crown Copyright 2014 - 2016, Met Office
#
# This file is part of Iris.
#
# Iris is free software: you can redistribute it and/or modify it under
# the terms of the GNU Lesser General Public License as published by the
# Free Software Foundation, either version 3 of the License, or
# (at your option) any l... | lgpl-3.0 |
persandstrom/home-assistant | tests/components/light/test_init.py | 1 | 17099 | """The tests for the Light component."""
# pylint: disable=protected-access
import unittest
import unittest.mock as mock
import os
from io import StringIO
from homeassistant import core, loader
from homeassistant.setup import setup_component, async_setup_component
from homeassistant.const import (
ATTR_ENTITY_ID, ... | apache-2.0 |
CUCWD/edx-platform | cms/envs/acceptance.py | 8 | 4991 | """
This config file extends the test environment configuration
so that we can run the lettuce acceptance tests.
"""
# We intentionally define lots of variables that aren't used, and
# want to import all variables from base settings files
# pylint: disable=wildcard-import, unused-wildcard-import
from .test import *
... | agpl-3.0 |
marcoantoniooliveira/labweb | oscar/lib/python2.7/site-packages/werkzeug/testsuite/debug.py | 146 | 7859 | # -*- coding: utf-8 -*-
"""
werkzeug.testsuite.debug
~~~~~~~~~~~~~~~~~~~~~~~~
Tests some debug utilities.
:copyright: (c) 2014 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import unittest
import sys
import re
from werkzeug.testsuite import WerkzeugTestCase
from werkzeug.deb... | bsd-3-clause |
noxora/flask-base | flask/lib/python3.4/site-packages/pbr/tests/test_wsgi.py | 32 | 5708 | # Copyright (c) 2015 Hewlett-Packard Development Company, L.P. (HP)
#
# 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 ... | mit |
HEG-Arc/gelato | gelato/paypal/standard/pdt/tests/test_pdt.py | 23 | 5308 | """
run this with ./manage.py test website
see http://www.djangoproject.com/documentation/testing/ for details
"""
import os
from django.conf import settings
from django.shortcuts import render_to_response
from django.test import TestCase
from paypal.standard.pdt.models import PayPalPDT
from paypal.standard.pdt.signals... | gpl-3.0 |
nadeemat/namebench | nb_third_party/dns/zone.py | 215 | 31930 | # Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED ... | apache-2.0 |
liveblog/liveblog | server/liveblog/syndication/tasks.py | 2 | 5254 | import logging
from flask import current_app as app
from superdesk import get_resource_service
from superdesk.celery_app import celery
from superdesk.metadata.item import CONTENT_TYPE, ITEM_TYPE
from superdesk.notification import push_notification
from .exceptions import APIConnectionError
from settings import SYNDIC... | agpl-3.0 |
jakublipinski/i2Gmail-Backup-macOS-Messages-To-Gmail | contacts.py | 1 | 2674 | import gdata.data
import gdata.contacts.client
import gdata.contacts.data
import string
import config
class Contacts:
def __init__(self, credentials):
auth2token = gdata.gauth.OAuth2Token(client_id=credentials.client_id,
client_secret=credentials.client_secret,
scope='https://www.google.c... | mit |
bmswgnp/sdk | python/test.py | 1 | 5131 | #
# Simple test program for the Python Motion SDK.
#
# @file tools/sdk/python/test.py
# @author Luke Tokheim, luke@motionnode.com
# @version 2.2
#
# Copyright (c) 2015, Motion Workshop
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provide... | bsd-2-clause |
bop/foundation | lib/python2.7/site-packages/staticfiles/urls.py | 1 | 1283 | import re
from django.conf import settings
from django.conf.urls.defaults import patterns, url
from django.core.exceptions import ImproperlyConfigured
urlpatterns = []
def static(prefix, view='django.views.static.serve', **kwargs):
"""
Helper function to return a URL pattern for serving files in debug mode.
... | gpl-2.0 |
zding5/Microblog-Flask | flask/lib/python2.7/site-packages/sqlalchemy/testing/config.py | 21 | 2136 | # testing/config.py
# Copyright (C) 2005-2015 the SQLAlchemy authors and contributors
# <see AUTHORS file>
#
# This module is part of SQLAlchemy and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
import collections
requirements = None
db = None
db_url = None
db_opts = None
fil... | mit |
boneyao/sentry | tests/sentry/web/frontend/tests.py | 11 | 4800 | # -*- coding: utf-8 -*-
from __future__ import absolute_import
from django.core.urlresolvers import reverse
from exam import fixture
from sentry.constants import MEMBER_USER
from sentry.models import User
from sentry.testutils import TestCase
class ReplayTest(TestCase):
@fixture
def path(self):
ret... | bsd-3-clause |
peter-jang/ansible | lib/ansible/plugins/action/net_config.py | 7 | 3875 | #
# Copyright 2015 Peter Sprygada <psprygada@ansible.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... | gpl-3.0 |
SKIRT/PTS | core/tools/stringify.py | 1 | 41185 | #!/usr/bin/env python
# -*- coding: utf8 -*-
# *****************************************************************
# ** PTS -- Python Toolkit for working with SKIRT **
# ** © Astronomical Observatory, Ghent University **
# *****************************************************************
##... | agpl-3.0 |
Grumpy-Mike/Mikes-Pi-Bakery | Simon_safecrack/Software/ky040.py | 4 | 2288 | #!/usr/bin/env python
# Class to decode mechanical rotary encoder pulses.
# by Mike Cook
import pigpio
class Ky040 :
sw_debounce = 25000 # switch debounce time
rot_debounce = 1000 # rotary debounce
def __init__(self, clk = None, dt = None, cbrot=None, sw = None, cbr = None, cbf = None):
if not clk or n... | gpl-2.0 |
imdaveho/impromptu | impromptu/fields/_choices.py | 1 | 11268 | from platform import system
from ._base import Question
class ChoiceSelect(Question):
def __init__(self, name, query, choices=None, size=7,
default="", color=None, colormap=None):
super().__init__(name, query, default, color, colormap)
self._keys_in_use = [
"Enter", "A... | mit |
msteghofer/CSnake | src/csnGUIOptions.py | 2 | 5877 | ## @package csnGUIOptions
# Definition of Options class.
import ConfigParser
from csnListener import ChangeEvent
import logging
import shutil
from ConfigParser import ParsingError
latestFileFormatVersion = 1.1
class Options:
""" CSnake GUI options. """
def __init__(self):
# options
self.__con... | bsd-3-clause |
nburn42/tensorflow | tensorflow/contrib/distributions/python/ops/bijectors/exp.py | 3 | 1926 | # 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 |
MostafaGazar/tensorflow | tensorflow/python/training/slot_creator_test.py | 16 | 3225 | # 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 |
pauliacomi/pyGAPS | tests/characterisation/test_hk_models.py | 1 | 1365 | """
Tests relating to Horvath-Kawazoe model validation.
All functions in /calculations/models_hk.py are tested here.
The purposes are:
- testing that the "function getter" is performing as expected.
"""
import pytest
import pygaps.characterisation.models_hk as hk
import pygaps.utilities.exceptions as pgEx
@p... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.