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 |
|---|---|---|---|---|---|
eshijia/SUR | magnum/tests/unit/api/controllers/v1/test_pod.py | 7 | 25660 | # 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
# distr... | apache-2.0 |
LazyOpser/recruit | yuanxin/201708/201708-07-RE-demo01.py | 1 | 1343 | #!/usr/bin/python
# encoding:utf-8
"""
@author: yuanxin
contact:
@file: 2017/8/15-RE-demo01.py
@time: 2017/8/15
"""
import re
print('01',re.findall("a..c",'aaabbccc'))
# 01 ['abbc'] , ^ 从字符串开始匹配的位置,找到所有元素,返回一个列表
print('01',re.findall("a..c",'aaabbbbbbccc'))
# 01 [] , " .. " 仅能匹配2个字符
print('02',re.findall('leon$',... | gpl-3.0 |
tschijnmo/GCMCbyGULP | GCMCbyGULP/utils.py | 1 | 1172 | """
Small utility functions
=======================
"""
import collections
def ensure_list_of_str(val, tag):
"""Ensures that the given value is a list of strings
It ensures that the given value is a list of strings and return them, or
value error will be raised. If a single string is given, a singleto... | mit |
iulian787/spack | var/spack/repos/builtin/packages/py-opt-einsum/package.py | 3 | 1209 | # Copyright 2013-2020 Lawrence Livermore National Security, LLC and other
# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
# SPDX-License-Identifier: (Apache-2.0 OR MIT)
from spack import *
class PyOptEinsum(PythonPackage):
"""Optimized Einsum: A tensor contraction order optimizer."""
... | lgpl-2.1 |
elkingtonmcb/django | tests/template_tests/test_loaders.py | 263 | 14253 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import os.path
import sys
import tempfile
import types
import unittest
from contextlib import contextmanager
from django.template import Context, TemplateDoesNotExist
from django.template.engine import Engine
from django.test import SimpleTestCase, ignor... | bsd-3-clause |
foodszhang/kbengine | kbe/res/scripts/common/Lib/idlelib/idle_test/test_rstrip.py | 143 | 1613 | import unittest
import idlelib.RstripExtension as rs
from idlelib.idle_test.mock_idle import Editor
class rstripTest(unittest.TestCase):
def test_rstrip_line(self):
editor = Editor()
text = editor.text
do_rstrip = rs.RstripExtension(editor).do_rstrip
do_rstrip()
self.asser... | lgpl-3.0 |
elfnor/sverchok | nodes/vector/variable_lacunarity.py | 3 | 3958 | # ##### BEGIN GPL LICENSE BLOCK #####
#
# 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 distrib... | gpl-3.0 |
hurrinico/server-tools | database_cleanup/model/purge_models.py | 23 | 5351 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# This module copyright (C) 2014 Therp BV (<http://therp.nl>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | agpl-3.0 |
michaelgugino/turbo-lister | sqlalchemy/ext/instrumentation.py | 4 | 14672 | """Extensible class instrumentation.
The :mod:`sqlalchemy.ext.instrumentation` package provides for alternate
systems of class instrumentation within the ORM. Class instrumentation
refers to how the ORM places attributes on the class which maintain
data and track changes to that data, as well as event hooks installed... | gpl-3.0 |
ColinIanKing/autotest | client/kernel.py | 3 | 30723 | import os, copy, pickle, re, glob, time, logging
from autotest.client import kernel_config, os_dep, kernelexpand
from autotest.client import utils
from autotest.client.shared import log, error
def tee_output_logdir_mark(fn):
def tee_logdir_mark_wrapper(self, *args, **dargs):
mark = self.__class__.__name__... | gpl-2.0 |
batxes/4Cin | Six_zebra_models/Six_zebra_models_final_output_0.1_-0.1_13000/mtx1_models/Six_zebra_models39759.py | 4 | 13921 | import _surface
import chimera
try:
import chimera.runCommand
except:
pass
from VolumePath import markerset as ms
try:
from VolumePath import Marker_Set, Link
new_marker_set=Marker_Set
except:
from VolumePath import volume_path_dialog
d= volume_path_dialog(True)
new_marker_set= d.new_marker_set
marker_set... | gpl-3.0 |
antonve/s4-project-mooc | cms/djangoapps/contentstore/management/commands/migrate_to_split.py | 185 | 2174 | """
Django management command to migrate a course from the old Mongo modulestore
to the new split-Mongo modulestore.
"""
from django.core.management.base import BaseCommand, CommandError
from django.contrib.auth.models import User
from xmodule.modulestore.django import modulestore
from xmodule.modulestore.split_migrato... | agpl-3.0 |
FCP-INDI/nipype | nipype/interfaces/freesurfer/tests/test_auto_SurfaceSmooth.py | 10 | 1440 | # AUTO-GENERATED by tools/checkspecs.py - DO NOT EDIT
from ....testing import assert_equal
from ..utils import SurfaceSmooth
def test_SurfaceSmooth_inputs():
input_map = dict(args=dict(argstr='%s',
),
cortex=dict(argstr='--cortex',
usedefault=True,
),
environ=dict(nohash=True,
usedefault=T... | bsd-3-clause |
dlutxx/memo | python/web.py | 1 | 3133 | from __future__ import print_function
from urllib2 import Request, urlopen, URLError
from urllib import urlencode
from cStringIO import StringIO
from gzip import GzipFile
import time
import sys
class Hacker(object):
url = 'http://weirenwu.weibo.com/taskv2/?c=Person.recharge'
def __init__(self, headers, data)... | mit |
ligature/ansible-modules-extras | windows/win_scheduled_task.py | 59 | 1439 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Peter Mounce <public@neverrunwithscissors.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... | gpl-3.0 |
kustodian/ansible | lib/ansible/modules/cloud/amazon/ec2_group.py | 8 | 57078 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# This file is part of Ansible
# 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 |
MoisesTedeschi/python | Scripts-Python/Modulos-Diversos/deteccao-de-faces-com-python-e-opencv/Lib/copyreg.py | 14 | 7017 | """Helper to provide extensibility for pickle.
This is only useful to add pickle support for extension types defined in
C, not for instances of user-defined classes.
"""
__all__ = ["pickle", "constructor",
"add_extension", "remove_extension", "clear_extension_cache"]
dispatch_table = {}
def pickle(ob_typ... | gpl-3.0 |
yongshengwang/hue | build/env/lib/python2.7/site-packages/pylint-0.28.0-py2.7.egg/pylint/reporters/text.py | 2 | 5074 | # Copyright (c) 2003-2013 LOGILAB S.A. (Paris, FRANCE).
# 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... | apache-2.0 |
skearnes/pylearn2 | pylearn2/sandbox/cuda_convnet/tests/test_image_acts_strided.py | 5 | 6085 | __authors__ = "Heng Luo"
from pylearn2.testing.skip import skip_if_no_gpu
skip_if_no_gpu()
import numpy as np
from theano import shared
from theano.tensor import grad, constant
from pylearn2.sandbox.cuda_convnet.filter_acts import FilterActs
from pylearn2.sandbox.cuda_convnet.filter_acts import ImageActs
from theano.... | bsd-3-clause |
MalloyPower/parsing-python | front-end/testsuite-python-lib/Python-3.6.0/Lib/test/test_bytes.py | 1 | 65065 | """Unit tests for the bytes and bytearray types.
XXX This is a mess. Common tests should be unified with string_tests.py (and
the latter should be modernized).
"""
import os
import re
import sys
import copy
import functools
import pickle
import tempfile
import unittest
import test.support
import test.string_tests
i... | mit |
dentaku65/pelisalacarta | python/main-classic/servers/veoh.py | 43 | 2852 | # -*- coding: iso-8859-1 -*-
#------------------------------------------------------------
# pelisalacarta - XBMC Plugin
# Conector para Veoh
# http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/
#------------------------------------------------------------
import os
import urlparse,urllib2,urllib,re
from core imp... | gpl-3.0 |
edlabh/SickRage | lib/github/PullRequestMergeStatus.py | 74 | 3202 | # -*- coding: utf-8 -*-
# ########################## Copyrights and license ############################
# #
# Copyright 2012 Vincent Jacques <vincent@vincent-jacques.net> #
# Copyright 2012 Zearin <zearin@gonk.net> ... | gpl-3.0 |
EricSekyere/python | neo1218/0023/web/config.py | 38 | 1075 | # -*- coding: UTF-8 -*-
# !/usr/bin/python
# 配置文件
import os
basedir = os.path.abspath(os.path.dirname(__file__))
class Config:
# 配置类
SECRET_KEY = os.environ.get('SECRET_KEY') or 'hard to guess string'
SQLALCHEMY_COMMIT_ON_TEARDOWN = True
@staticmethod
def init_app(app):
pass
class Dev... | mit |
m-ober/byceps | testfixtures/user.py | 1 | 1690 | """
testfixtures.user
~~~~~~~~~~~~~~~~~
:Copyright: 2006-2020 Jochen Kupperschmidt
:License: Modified BSD, see LICENSE for details.
"""
from datetime import date, datetime
from byceps.database import generate_uuid
from byceps.services.user.models.detail import UserDetail
from byceps.services.user import creation_ser... | bsd-3-clause |
mancoast/CPythonPyc_test | fail/310_test_descrtut.py | 56 | 11739 | # This contains most of the executable examples from Guido's descr
# tutorial, once at
#
# http://www.python.org/2.2/descrintro.html
#
# A few examples left implicit in the writeup were fleshed out, a few were
# skipped due to lack of interest (e.g., faking super() by hand isn't
# of much interest anymore), and a f... | gpl-3.0 |
2014c2g3/2015cd_midterm | static/Brython3.1.1-20150328-091302/Lib/xml/sax/_exceptions.py | 625 | 4885 | """Different kinds of SAX Exceptions"""
#in brython the 4 lines below causes an $globals['Exception'] error
#import sys
#if sys.platform[:4] == "java":
# from java.lang import Exception
#del sys
# ===== SAXEXCEPTION =====
class SAXException(Exception):
"""Encapsulate an XML error or warning. This class can con... | gpl-3.0 |
StackStorm/st2 | scripts/fixate-requirements.py | 3 | 9493 | #!/usr/bin/env python
# Copyright 2020 The StackStorm Authors.
# Copyright 2019 Extreme Networks, 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/L... | apache-2.0 |
timothycrosley/hug_explainable | hug_explainable/_version.py | 1 | 1185 | """hug_explainable/_version.py
Stores the current version for easy use accross the code-base
Copyright (C) 2016 Timothy Edmund Crosley
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 re... | mit |
westinedu/wrgroups | django/contrib/admin/models.py | 228 | 2207 | from django.db import models
from django.contrib.contenttypes.models import ContentType
from django.contrib.auth.models import User
from django.contrib.admin.util import quote
from django.utils.translation import ugettext_lazy as _
from django.utils.encoding import smart_unicode
from django.utils.safestring import mark... | bsd-3-clause |
csrocha/OpenUpgrade | openerp/addons/test_converter/tests/test_html.py | 66 | 13431 | # -*- encoding: utf-8 -*-
import json
import os
import datetime
from lxml import etree
from openerp.tests import common
from openerp.tools import html_escape as e
from openerp.addons.base.ir import ir_qweb
directory = os.path.dirname(__file__)
class TestExport(common.TransactionCase):
_model = None
def set... | agpl-3.0 |
xupit3r/askpgh | askbot/conf/license.py | 15 | 2171 | """settings that allow changing of the license
clause used in askbot instances"""
from askbot import const
from askbot.conf.settings_wrapper import settings
from askbot.conf.super_groups import CONTENT_AND_UI
from askbot.deps import livesettings
from askbot.skins import utils as skin_utils
from django.utils.translation... | gpl-3.0 |
sunils34/buffer-django-nonrel | django/contrib/gis/gdal/srs.py | 291 | 11717 | """
The Spatial Reference class, represensents OGR Spatial Reference objects.
Example:
>>> from django.contrib.gis.gdal import SpatialReference
>>> srs = SpatialReference('WGS84')
>>> print srs
GEOGCS["WGS 84",
DATUM["WGS_1984",
SPHEROID["WGS 84",6378137,298.257223563,
AUTHORI... | bsd-3-clause |
jhawkesworth/ansible | lib/ansible/modules/storage/netapp/na_elementsw_volume_pair.py | 31 | 10254 | #!/usr/bin/python
# (c) 2017, 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 |
proversity-org/edx-platform | common/djangoapps/track/contexts.py | 13 | 1431 | """Generates common contexts"""
import logging
from opaque_keys import InvalidKeyError
from opaque_keys.edx.keys import CourseKey
from six import text_type
from util.request import COURSE_REGEX
log = logging.getLogger(__name__)
def course_context_from_url(url):
"""
Extracts the course_context from the give... | agpl-3.0 |
romain-dartigues/ansible | lib/ansible/modules/cloud/cloudstack/cs_instance.py | 5 | 38896 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# (c) 2015, René Moser <mail@renemoser.net>
# 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 |
shiora/The-Perfect-Pokemon-Team-Balancer | libs/env/Lib/stat.py | 319 | 1842 | """Constants/functions for interpreting results of os.stat() and os.lstat().
Suggested usage: from stat import *
"""
# Indices for stat struct members in the tuple returned by os.stat()
ST_MODE = 0
ST_INO = 1
ST_DEV = 2
ST_NLINK = 3
ST_UID = 4
ST_GID = 5
ST_SIZE = 6
ST_ATIME = 7
ST_MTIME = 8
ST_CTIME = 9
... | gpl-2.0 |
appsembler/awstrial | awstrial/__init__.py | 5 | 1077 | # AWSTrial, A mechanism and service for offering a cloud image trial
#
# Copyright (C) 2010 Scott Moser <smoser@ubuntu.com>
# Copyright (C) 2010 Dave Walker (Daviey) <DaveWalker@ubuntu.com>
# Copyright (C) 2010 Michael Hall <mhall119@gmail.com>
# Copyright (C) 2010 Dustin Kirkland <kirkland@ubuntu.co... | agpl-3.0 |
mvaled/sentry | src/sentry/south_migrations/0421_auto__del_field_identityprovider_organization_id__del_unique_identityp.py | 1 | 106910 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
# Flag to indicate if this migration is too risky
# to run online and needs to be coordinated for offline
... | bsd-3-clause |
almeidapaulopt/erpnext | erpnext/hub_node/doctype/hub_settings/hub_settings.py | 1 | 3067 | # Copyright (c) 2015, Frappe Technologies Pvt. Ltd. and Contributors and contributors
# For license information, please see license.txt
from __future__ import unicode_literals
import frappe, requests, json
from frappe.model.document import Document
from frappe.utils import add_years, now, get_datetime, get_datetime_s... | gpl-3.0 |
arielrossanigo/fades | tests/test_multiplatform.py | 1 | 2882 | # Copyright 2016 Facundo Batista, Nicolás Demarchi
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General
# Public License version 3, as published by the Free Software Foundation.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ... | gpl-3.0 |
jjenki11/blaze-chem-rendering | build_utils/scons-2.3.0/engine/SCons/Tool/sunf95.py | 11 | 2182 | """SCons.Tool.sunf95
Tool-specific initialization for sunf95, the Sun Studio F95 compiler.
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, 20... | mit |
heke123/chromium-crosswalk | build/android/pylib/perf/test_runner.py | 11 | 15251 | # 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.
"""Runs perf tests.
Our buildbot infrastructure requires each slave to run steps serially.
This is sub-optimal for android, where these steps can run indepe... | bsd-3-clause |
abadger/ansible | test/units/modules/test_apt.py | 35 | 1540 | from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import collections
import sys
from units.compat import mock
from units.compat import unittest
try:
from ansible.modules.apt import (
expand_pkgspec_from_fnmatches,
)
except Exception:
# Need some more module_u... | gpl-3.0 |
JackpotClavin/android_kernel_samsung_venturi | Documentation/networking/cxacru-cf.py | 14668 | 1626 | #!/usr/bin/env python
# Copyright 2009 Simon Arlott
#
# 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 i... | gpl-2.0 |
pombredanne/pyotp | src/pyotp/totp.py | 2 | 2457 | from __future__ import print_function, unicode_literals, division, absolute_import
import datetime
import time
from pyotp import utils
from pyotp.otp import OTP
class TOTP(OTP):
def __init__(self, *args, **kwargs):
"""
@option options [Integer] interval (30) the time interval in seconds
... | mit |
dlebauer/plantcv | scripts/dev/vis_sv_z2500_L2_e82.py | 2 | 4539 | #!/usr/bin/python
import sys, traceback
import cv2
import numpy as np
import argparse
import string
import plantcv as pcv
### Parse command-line arguments
def options():
parser = argparse.ArgumentParser(description="Imaging processing with opencv")
parser.add_argument("-i", "--image", help="Input image file.", req... | gpl-2.0 |
darkleons/odoo | addons/purchase/res_config.py | 357 | 6198 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (C) 2004-2012 OpenERP S.A. (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | agpl-3.0 |
pombredanne/MOG | nova/scheduler/filters/core_filter.py | 27 | 4005 | # Copyright (c) 2011 OpenStack Foundation
# Copyright (c) 2012 Justin Santa Barbara
#
# 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.ap... | apache-2.0 |
yestech/gae-django-template | django/utils/version.py | 320 | 1361 | import django
import os.path
import re
def get_svn_revision(path=None):
"""
Returns the SVN revision in the form SVN-XXXX,
where XXXX is the revision number.
Returns SVN-unknown if anything goes wrong, such as an unexpected
format of internal SVN files.
If path is provided, it should be a dir... | bsd-3-clause |
scriptZilla/linux | scripts/checkkconfigsymbols.py | 371 | 11716 | #!/usr/bin/env python2
"""Find Kconfig symbols that are referenced but not defined."""
# (c) 2014-2015 Valentin Rothberg <valentinrothberg@gmail.com>
# (c) 2014 Stefan Hengelein <stefan.hengelein@fau.de>
#
# Licensed under the terms of the GNU GPL License version 2
import os
import re
import sys
from subprocess imp... | gpl-2.0 |
adaussy/eclipse-monkey-revival | plugins/python/org.eclipse.eclipsemonkey.lang.python/Lib/mimetypes.py | 111 | 20609 | """Guess the MIME type of a file.
This module defines two useful functions:
guess_type(url, strict=1) -- guess the MIME type and encoding of a URL.
guess_extension(type, strict=1) -- guess the extension for a given MIME type.
It also contains the following, for tuning the behavior:
Data:
knownfiles -- list of fil... | epl-1.0 |
kaushik94/gambit | src/python/gambit/tests/test_actions.py | 1 | 2928 | import gambit
import decimal
import fractions
from nose.tools import assert_raises
import unittest
from gambit.lib.error import UndefinedOperationError
#from nose.tools import failUnlessRaises
class TestGambitActions(unittest.TestCase):
def setUp(self):
self.extensive_game = gambit.read_game("test_games/co... | gpl-2.0 |
openprocurement/robot_tests | ez_setup.py | 4 | 12349 | #!/usr/bin/env python
"""
Setuptools bootstrapping installer.
Maintained at https://github.com/pypa/setuptools/tree/bootstrap.
Run this script to install or upgrade setuptools.
This method is DEPRECATED. Check https://github.com/pypa/setuptools/issues/581 for more details.
"""
import os
import shutil
import sys
im... | apache-2.0 |
dhalperi/beam | sdks/python/apache_beam/internal/util_test.py | 25 | 2278 | #
# 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 us... | apache-2.0 |
kubeflow/examples | financial_time_series/tensorflow_model/run_preprocess_train_deploy.py | 1 | 2019 | """Module for running the training of the machine learning model.
Scripts that performs all the steps to train the ML model.
"""
import logging
import argparse
import sys
from run_preprocess import run_preprocess
from run_train import run_training
from run_deploy import run_deploy
def parse_arguments(argv):
"""... | apache-2.0 |
enableiot/iotanalytics-rule-engine | pydeps/rules/conditions/processors/conditionProcessorFactory.py | 1 | 1494 | # Copyright (c) 2015 Intel Corporation
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in ... | apache-2.0 |
openmv/micropython | tests/basics/int_big1.py | 9 | 2935 | # to test arbitrariy precision integers
x = 1000000000000000000000000000000
xn = -1000000000000000000000000000000
y = 2000000000000000000000000000000
# printing
print(x)
print(y)
print('%#X' % (x - x)) # print prefix
print('{:#,}'.format(x)) # print with commas
# addition
print(x + 1)
print(x + y)
print(x + xn == 0)... | mit |
pczhaoyun/obtainfo | zinnia/tests/test_sitemaps.py | 4 | 4144 | """Test cases for Zinnia's sitemaps"""
from django.test import TestCase
from django.contrib.sites.models import Site
from django.contrib.auth.tests.utils import skipIfCustomUser
from zinnia.managers import PUBLISHED
from zinnia.models.entry import Entry
from zinnia.models.author import Author
from zinnia.models.catego... | apache-2.0 |
Jollytown/Garuda | server/garuda/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util/ssl_.py | 170 | 8755 | from binascii import hexlify, unhexlify
from hashlib import md5, sha1
from ..exceptions import SSLError
SSLContext = None
HAS_SNI = False
create_default_context = None
import errno
import ssl
try: # Test for SSL features
from ssl import wrap_socket, CERT_NONE, PROTOCOL_SSLv23
from ssl import HAS_SNI # Ha... | mit |
mjrulesamrat/merchant | billing/integration.py | 3 | 2402 | from django.utils.importlib import import_module
from django.conf import settings
from django.conf.urls import patterns
class IntegrationModuleNotFound(Exception):
pass
class IntegrationNotConfigured(Exception):
pass
integration_cache = {}
class Integration(object):
"""Base Integration class that nee... | bsd-3-clause |
Nikoala/CouchPotatoServer | libs/pyasn1/type/namedval.py | 200 | 1605 | # ASN.1 named integers
from pyasn1 import error
__all__ = [ 'NamedValues' ]
class NamedValues:
def __init__(self, *namedValues):
self.nameToValIdx = {}; self.valToNameIdx = {}
self.namedValues = ()
automaticVal = 1
for namedValue in namedValues:
if isinstance(na... | gpl-3.0 |
ryuunosukeyoshi/PartnerPoi-Bot | lib/youtube_dl/extractor/yinyuetai.py | 64 | 1908 | # coding: utf-8
from __future__ import unicode_literals
from .common import InfoExtractor
from ..utils import ExtractorError
class YinYueTaiIE(InfoExtractor):
IE_NAME = 'yinyuetai:video'
IE_DESC = '音悦Tai'
_VALID_URL = r'https?://v\.yinyuetai\.com/video(?:/h5)?/(?P<id>[0-9]+)'
_TESTS = [{
'url... | gpl-3.0 |
Azure/azure-sdk-for-python | sdk/servicebus/azure-servicebus/tests/mgmt_tests/mgmt_test_utilities.py | 1 | 4585 | #-------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#-------------------------------------------------------------------------
import pytest... | mit |
nlholdem/icodoom | .venv/lib/python2.7/site-packages/tensorflow/contrib/layers/ops/gen_bucketization_op.py | 4 | 2296 | """Python wrappers around Brain.
This file is MACHINE GENERATED! Do not edit.
"""
import collections as _collections
from google.protobuf import text_format as _text_format
from tensorflow.core.framework import op_def_pb2 as _op_def_pb2
# Needed to trigger the call to _set_call_cpp_shape_fn.
from tensorflow.python... | gpl-3.0 |
dpryan79/tools-iuc | tools/genetrack/genetrack_util.py | 23 | 12484 | import bisect
import math
import re
import subprocess
import sys
import tempfile
import numpy
from six import Iterator
GFF_EXT = 'gff'
SCIDX_EXT = 'scidx'
def noop(data):
return data
def zeropad_to_numeric(data):
return re.sub(r'chr0(\d)', r'chr\1', data)
def numeric_to_zeropad(data):
return re.sub(... | mit |
MrLoick/python-for-android | python-modules/twisted/twisted/trial/test/test_test_visitor.py | 90 | 2282 | from twisted.trial import unittest
from twisted.trial.runner import TestSuite, suiteVisit
pyunit = __import__('unittest')
class MockVisitor(object):
def __init__(self):
self.calls = []
def __call__(self, testCase):
self.calls.append(testCase)
class TestTestVisitor(unittest.TestCase):
... | apache-2.0 |
Richard32/git | contrib/svn-fe/svnrdump_sim.py | 328 | 2044 | #!/usr/bin/python
"""
Simulates svnrdump by replaying an existing dump from a file, taking care
of the specified revision range.
To simulate incremental imports the environment variable SVNRMAX can be set
to the highest revision that should be available.
"""
import sys
import os
if sys.hexversion < 0x02040000:
# T... | gpl-2.0 |
beck/django | django/conf/locale/ko/formats.py | 100 | 2320 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'Y년 n월 j일'
TIME_FORMAT = 'A g:i'
D... | bsd-3-clause |
hehongliang/tensorflow | tensorflow/contrib/deprecated/__init__.py | 67 | 4854 | # 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
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applic... | apache-2.0 |
sander76/home-assistant | tests/helpers/test_config_validation.py | 4 | 30076 | """Test config validators."""
from collections import OrderedDict
from datetime import date, datetime, timedelta
import enum
import os
from socket import _GLOBAL_DEFAULT_TIMEOUT
from unittest.mock import Mock, patch
import uuid
import pytest
import voluptuous as vol
import homeassistant
from homeassistant.helpers imp... | apache-2.0 |
hrh5775/LibraryManager | PythonTestClient/LibraryManagerTestClient/venv/Lib/site-packages/pip/utils/appdirs.py | 340 | 8811 | """
This code was taken from https://github.com/ActiveState/appdirs and modified
to suit our purposes.
"""
from __future__ import absolute_import
import os
import sys
from pip.compat import WINDOWS, expanduser
from pip._vendor.six import PY2, text_type
def user_cache_dir(appname):
r"""
Return full path to t... | gpl-3.0 |
j-carl/ansible | lib/ansible/utils/jsonrpc.py | 58 | 3845 | # (c) 2017, Peter Sprygada <psprygad@redhat.com>
# (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__ = type
import json
import traceback
from ansible.module_utils._text ... | gpl-3.0 |
Nic30/hwtHls | hwtHls/tests/all.py | 1 | 1472 | #!/usr/bin/env python3
# -*- coding: utf-8 -*-
from unittest import TestLoader, TextTestRunner, TestSuite
from hwtHls.examples.alapAsapDiffExample import AlapAsapDiffExample_TC
from hwtHls.examples.bitonicSort import BitonicSorterHLS_TC,\
BitonicSorterHLS_large_TC
from hwtHls.examples.hls_expr_tree3 import HlsExp... | mit |
aolieman/pyspotlight | setup.py | 1 | 1428 | #!/usr/bin/env python
# coding: utf-8
from setuptools import setup
from setuptools import find_packages
from io import open
classifiers = [
'Intended Audience :: Developers',
'Operating System :: OS Independent',
'Topic :: Software Development :: Libraries',
'Environment :: Web Environment',
'Lice... | bsd-2-clause |
40023256/2015cdag1man | static/Brython3.1.1-20150328-091302/Lib/multiprocessing/__init__.py | 693 | 6866 | #
# Package analogous to 'threading.py' but using processes
#
# multiprocessing/__init__.py
#
# This package is intended to duplicate the functionality (and much of
# the API) of threading.py but uses processes instead of threads. A
# subpackage 'multiprocessing.dummy' has the same API but is a simple
# wrapper for 't... | gpl-3.0 |
ph4r05/PJSIP | tests/pjsua/inc_cfg.py | 19 | 3296 | # $Id$
import random
import config_site
import socket
import errno
DEFAULT_ECHO = True
DEFAULT_TRACE = True
DEFAULT_START_SIP_PORT = 50000
# Shared vars
ARGS = [] # arguments containing script module & config
HAS_SND_DEV = config_site.HAS_SND_DEV
# Individual pjsua instance configuration class
class InstanceParam:
... | gpl-2.0 |
tinysun212/swift-windows | utils/swift_build_support/swift_build_support/host.py | 41 | 2856 | # swift_build_support/host.py ----------- Migrating build-script -*- python -*-
#
# This source file is part of the Swift.org open source project
#
# Copyright (c) 2014 - 2017 Apple Inc. and the Swift project authors
# Licensed under Apache License v2.0 with Runtime Library Exception
#
# See https://swift.org/LICENSE.t... | apache-2.0 |
iradul/qtwebkit | Tools/Scripts/webkitpy/common/system/filesystem_mock_unittest.py | 122 | 3391 | # Copyright (C) 2011 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 f... | gpl-2.0 |
MycChiu/tensorflow | tensorflow/tools/common/traverse_test.py | 116 | 2653 | # 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 |
jacyn/blog-site | py/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/commands/search.py | 60 | 4523 | import sys
import textwrap
import pkg_resources
import pip.download
from pip.basecommand import Command, SUCCESS
from pip.util import get_terminal_size
from pip.log import logger
from pip.backwardcompat import xmlrpclib, reduce, cmp
from pip.exceptions import CommandError
from pip.status_codes import NO_MATCHES_FOUND
f... | apache-2.0 |
OCA/sale-workflow | sale_order_line_sequence/model/sale_order.py | 1 | 2381 | # Copyright 2017 Eficent Business and IT Consulting Services S.L.
# Copyright 2017 Serpent Consulting Services Pvt. Ltd.
# License AGPL-3.0 or later (https://www.gnu.org/licenses/agpl.html).
from odoo import api, fields, models
class SaleOrder(models.Model):
_inherit = 'sale.order'
@api.multi
@api.depen... | agpl-3.0 |
derekjchow/models | research/neural_gpu/neural_gpu.py | 5 | 32528 | # 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 by applicable law or a... | apache-2.0 |
eagleamon/home-assistant | tests/components/sensor/test_darksky.py | 6 | 3197 | """The tests for the Dark Sky platform."""
import re
import unittest
from unittest.mock import MagicMock, patch
import forecastio
from requests.exceptions import HTTPError
import requests_mock
from datetime import timedelta
from homeassistant.components.sensor import darksky
from homeassistant.bootstrap import setup_... | apache-2.0 |
Maqnai2234/Gram | node_modules/node-gyp/gyp/pylib/gyp/ninja_syntax.py | 2485 | 5536 | # This file comes from
# https://github.com/martine/ninja/blob/master/misc/ninja_syntax.py
# Do not edit! Edit the upstream one instead.
"""Python module for generating .ninja files.
Note that this is emphatically not a required piece of Ninja; it's
just a helpful utility for build-file-generation systems that alr... | gpl-3.0 |
Theer108/invenio | invenio/modules/formatter/format_elements/bfe_field.py | 13 | 6269 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011 CERN.
#
# Invenio 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,... | gpl-2.0 |
sffjunkie/home-assistant | homeassistant/components/binary_sensor/demo.py | 30 | 1257 | """
Demo platform that has two fake binary sensors.
For more details about this platform, please refer to the documentation
https://home-assistant.io/components/demo/
"""
from homeassistant.components.binary_sensor import BinarySensorDevice
def setup_platform(hass, config, add_devices, discovery_info=None):
"""S... | mit |
skyddv/neutron | neutron/agent/linux/external_process.py | 16 | 10111 | # Copyright 2012 New Dream Network, LLC (DreamHost)
#
# 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 a... | apache-2.0 |
hellsgate1001/bookit | docs/env/Lib/site-packages/django/db/backends/postgresql_psycopg2/introspection.py | 105 | 5005 | from __future__ import unicode_literals
from django.db.backends import BaseDatabaseIntrospection, FieldInfo
from django.utils.encoding import force_text
class DatabaseIntrospection(BaseDatabaseIntrospection):
# Maps type codes to Django Field types.
data_types_reverse = {
16: 'BooleanField',
... | mit |
ycl2045/nova-master | nova/api/metadata/password.py | 16 | 2438 | # Copyright 2012 Nebula, 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 ... | apache-2.0 |
tysonclugg/django | tests/annotations/models.py | 90 | 2591 | from django.db import models
class Author(models.Model):
name = models.CharField(max_length=100)
age = models.IntegerField()
friends = models.ManyToManyField('self', blank=True)
def __str__(self):
return self.name
class Publisher(models.Model):
name = models.CharField(max_length=255)
... | bsd-3-clause |
stefanw/froide | froide/foirequest/tests/test_api.py | 1 | 13744 | from datetime import timedelta
import json
from urllib.parse import urlencode
from django.test import TestCase
from django.core import mail
from django.conf import settings
from django.contrib.auth import get_user_model
from django.utils import timezone
from django.urls import reverse
from oauth2_provider.models impo... | mit |
spragunr/echolocation | stereo/add_data.py | 1 | 1566 | import h5py
import os
import numpy as np
from sys import argv
from stereo_processing import align_audio, downsize
path = '/Volumes/seagate/legit_data/'
current_path = os.getcwd()+'/'
print "opening main file"
with h5py.File(current_path+argv[1], 'r') as main_data:
main_audio = main_data['audio'].value
main_depth = m... | mit |
google-research/language | language/nql/nql/util_test.py | 1 | 13749 | # coding=utf-8
# Copyright 2018 The Google AI Language Team 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 ... | apache-2.0 |
nealzhang/util | FastBitSetTest.py | 1 | 3557 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import time
from FastBitSet import FastBitSet
ISOTIMEFORMAT = '%Y-%m-%d %X'
cap = 500000
size = 64
listSize = 8
indexes = [1, 555, 687987, 73521, 53821, 1287, 36746, 2165]
print('start BitSet test.')
print()
print('cap:', cap, '; size:', size, '; bites:', cap... | lgpl-3.0 |
TheWylieStCoyote/gnuradio | gr-trellis/docs/test_tcm.py | 10 | 3656 | #!/usr/bin/env python
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
from gnuradio import gr
from gnuradio import audio
from gnuradio import trellis, digital, blocks
from gnuradio import eng_notation
import math
import sys
import random
import fsm_utils
t... | gpl-3.0 |
jaywreddy/django | django/core/serializers/python.py | 153 | 7692 | """
A Python "serializer". Doesn't do much serializing per se -- just converts to
and from basic Python data types (lists, dicts, strings, etc.). Useful as a basis for
other serializers.
"""
from __future__ import unicode_literals
from collections import OrderedDict
from django.apps import apps
from django.conf impor... | bsd-3-clause |
lnielsen/invenio | invenio/legacy/bibauthorid/cluster_set.py | 3 | 10579 | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2011 CERN.
##
## Invenio 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) a... | gpl-2.0 |
krafczyk/root | bindings/pyroot/_pythonization.py | 53 | 12056 | """ Pythonization API.
"""
# TODO: externalize this (have PythonizationScope and UserPythonizations as
# globals here and picked up from this module
# TODO: set explicit export list
# TODO: move cast to cppyy.lowlevel or some sort
# TODO: remove all need for accessing _backend
def _set_backend( backend ):
global... | lgpl-2.1 |
thomasvs/pychecker | test_input/test68.py | 11 | 2903 | 'test implicit returns'
__pychecker__ = 'implicitreturns'
def func1(x):
'should not produce a warning'
if x == 1:
return 1
return 0
def func2(x):
'should produce a warning'
if x == 1:
return 1
def func3(x):
'should not produce a warning'
while 1:
if x == 1:
... | bsd-3-clause |
100star/h2o | py/testdir_single_jvm/test_GLM2_gamma_fail1.py | 9 | 1515 | import unittest, random, sys, time
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_glm, h2o_import as h2i
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
global SEED
SEED = h2o.setup_random_seed(... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.