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 |
|---|---|---|---|---|---|
openstack/vitrage | doc/source/conf.py | 1 | 2952 | # 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 |
sammcveety/incubator-beam | sdks/python/apache_beam/examples/complete/juliaset/juliaset/juliaset.py | 8 | 4457 | #
# 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 |
akrzos/cfme_tests | cfme/tests/cloud_infra_common/test_tag_objects.py | 2 | 3171 | # -*- coding: utf-8 -*-
"""This module tests tagging of objects in different locations."""
import diaper
import pytest
from cfme.web_ui import Quadicon, mixins, toolbar as tb
from utils import providers
from utils.version import current_version
@pytest.fixture(scope="module")
def setup_first_provider():
provider... | gpl-2.0 |
slowsoul/NewTictactoe | bottle.py | 71 | 129141 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Bottle is a fast and simple micro-framework for small web applications. It
offers request dispatching (Routes) with url parameter support, templates,
a built-in HTTP Server and adapters for many third party WSGI/HTTP-server and
template engines - all in a single file an... | apache-2.0 |
tropp/acq4 | acq4/util/Canvas/items/CanvasItem.py | 2 | 1826 | from acq4.pyqtgraph.canvas.CanvasItem import CanvasItem as OrigCanvasItem
class CanvasItem(OrigCanvasItem):
## extent canvasitem to have support for filehandles
def __init__(self, *args, **kargs):
OrigCanvasItem.__init__(self, *args, **kargs)
if 'handle' not in self.opts:
... | mit |
AndroidOpenDevelopment/android_external_chromium_org | third_party/tlslite/tlslite/utils/openssl_tripledes.py | 202 | 1788 | # Author: Trevor Perrin
# See the LICENSE file for legal information regarding use of this file.
"""OpenSSL/M2Crypto 3DES implementation."""
from .cryptomath import *
from .tripledes import *
if m2cryptoLoaded:
def new(key, mode, IV):
return OpenSSL_TripleDES(key, mode, IV)
class OpenSSL_TripleDES(... | bsd-3-clause |
thanhphat11/Kernel-Stock-A900-SLK | tools/perf/scripts/python/syscall-counts-by-pid.py | 11180 | 1927 | # system call counts, by pid
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Displays system-wide system call totals, broken down by syscall.
# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
import os, sys
sys.path.append(os.env... | gpl-2.0 |
jessstrap/servotk | tests/wpt/web-platform-tests/tools/pywebsocket/src/test/mock.py | 465 | 6715 | # Copyright 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... | mpl-2.0 |
Yuudachimoe/HikariChun-RedBot | lib/youtube_dl/extractor/videomega.py | 47 | 1987 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
decode_packed_codes,
sanitized_Request,
)
class VideoMegaIE(InfoExtractor):
_VALID_URL = r'(?:videomega:|https?://(?:www\.)?videomega\.tv/(?:(?:view|iframe|cdn)\.php)?\?ref=)(?P<id>[... | gpl-3.0 |
debsankha/networkx | networkx/generators/small.py | 30 | 12862 | # -*- coding: utf-8 -*-
"""
Various small and named graphs, together with some compact generators.
"""
__author__ ="""Aric Hagberg (hagberg@lanl.gov)\nPieter Swart (swart@lanl.gov)"""
# Copyright (C) 2004-2015 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@la... | bsd-3-clause |
mbayon/TFG-MachineLearning | venv/lib/python3.6/site-packages/django/utils/translation/trans_real.py | 51 | 19808 | """Translation helper functions."""
from __future__ import unicode_literals
import gettext as gettext_module
import os
import re
import sys
import warnings
from collections import OrderedDict
from threading import local
from django.apps import apps
from django.conf import settings
from django.conf.locale import LANG_... | mit |
gph03n1x/Hurricane | engine/parser.py | 2 | 1786 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import re
# Third party libraries
from bs4 import BeautifulSoup
from nltk.corpus import stopwords
import nltk
# Engine libraries
from engine.nltk_wrappers import detect_language
class PageParser(object):
def __init__(self, logger, options):
self.logger = logge... | mit |
donutmonger/youtube-dl | youtube_dl/downloader/common.py | 95 | 13848 | from __future__ import division, unicode_literals
import os
import re
import sys
import time
from ..compat import compat_str
from ..utils import (
encodeFilename,
decodeArgument,
format_bytes,
timeconvert,
)
class FileDownloader(object):
"""File Downloader class.
File downloader objects are... | unlicense |
gilles-duboscq/jvb | scripts/gen-idea-configs.py | 1 | 3766 | #!/usr/bin/env python
# <configuration default="false" name="pong" type="Application" factoryName="Application">
# <option name="MAIN_CLASS_NAME" value="gd.twohundred.jvb.Main" />
# <option name="VM_PARAMETERS" value="" />
# <option name="PROGRAM_PARAMETERS" value=""$PROJECT_DIR$/../vb-roms/all-roms/pong.vb... | mit |
intelligent-agent/redeem | tests/gcode/test_M83.py | 1 | 1638 | from __future__ import absolute_import
from .MockPrinter import MockPrinter
from redeem.Path import Path
class M83_Tests(MockPrinter):
def test_gcodes_M83_from_absolute(self):
""" set state as it should be after a G90, all axes absolute """
self.printer.axes_absolute = ["X", "Y", "Z", "E", "H", "A", "B", "... | gpl-3.0 |
equialgo/scikit-learn | examples/linear_model/plot_lasso_and_elasticnet.py | 73 | 2074 | """
========================================
Lasso and Elastic Net for Sparse Signals
========================================
Estimates Lasso and Elastic-Net regression models on a manually generated
sparse signal corrupted with an additive noise. Estimated coefficients are
compared with the ground-truth.
"""
print(... | bsd-3-clause |
suiyuan2009/tensorflow | tensorflow/python/framework/tensor_shape.py | 12 | 27791 | # 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 |
stack-of-tasks/rbdlpy | tutorial/lib/python2.7/site-packages/FontTools/fontTools/ttLib/tables/_g_a_s_p.py | 2 | 1598 | import DefaultTable
import struct
from fontTools.misc.textTools import safeEval
GASP_SYMMETRIC_GRIDFIT = 0x0008
GASP_SYMMETRIC_SMOOTHING = 0x0004
GASP_DOGRAY = 0x0002
GASP_GRIDFIT = 0x0001
class table__g_a_s_p(DefaultTable.DefaultTable):
def decompile(self, data, ttFont):
self.version, numRanges = struct.unpack... | lgpl-3.0 |
jamesob/bitcoin | test/functional/mining_basic.py | 31 | 12215 | #!/usr/bin/env python3
# Copyright (c) 2014-2020 The Bitcoin Core developers
# Distributed under the MIT software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
"""Test mining RPCs
- getmininginfo
- getblocktemplate proposal mode
- submitblock"""
import copy
from d... | mit |
mcasti/django-calaccess-raw-data | example/project/settings.py | 28 | 1539 | import os
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
REPO_DIR = os.path.join(BASE_DIR, os.pardir)
SECRET_KEY = 'w11nbg_3n4+e@qk^b55qgo5qygesn^3=&s1kwtlbpkai$(1jv3'
DEBUG = False
TEMPLATE_DEBUG = True
ALLOWED_HOSTS = [
'localhost',
'127.0.0.1',
]
STATIC_ROOT = os.path.join(BASE_DIR, ".static")
INSTAL... | mit |
xindus40223115/2015cda_g1 | static/Brython3.1.3-20150514-095342/Lib/unittest/test/test_result.py | 788 | 19069 | import io
import sys
import textwrap
from test import support
import traceback
import unittest
class Test_TestResult(unittest.TestCase):
# Note: there are not separate tests for TestResult.wasSuccessful(),
# TestResult.errors, TestResult.failures, TestResult.testsRun or
# TestResult.shouldStop because t... | gpl-3.0 |
alibarkatali/module_web | venv/lib/python2.7/site-packages/pip/req/req_file.py | 343 | 11926 | """
Requirements file parsing
"""
from __future__ import absolute_import
import os
import re
import shlex
import sys
import optparse
import warnings
from pip._vendor.six.moves.urllib import parse as urllib_parse
from pip._vendor.six.moves import filterfalse
import pip
from pip.download import get_file_content
from ... | mit |
jayvdb/travis_log_fetch | tests/test_github.py | 1 | 1132 | """Test Github resolution."""
from __future__ import absolute_import, unicode_literals
from travis_log_fetch.config import (
_get_github,
get_options,
)
from travis_log_fetch.get import (
get_forks,
)
import pytest
# Note 'foo' is a real Github user, but they do not
# have repos bar or baz
class TestFor... | mit |
solintegra/addons | survey_crm/survey.py | 385 | 2051 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2011 OpenERP S.A (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | agpl-3.0 |
jreut/Switcharoo | scraper/manage/config.py | 2 | 1343 | # Copyright 2015 Adam Greenstein <adamgreenstein@comcast.net>
#
# Switcharoo 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.
#
# Switc... | gpl-3.0 |
benthomasson/ansible | lib/ansible/plugins/action/dellos6.py | 12 | 4341 | # 2016 Red Hat Inc.
#
# 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 distrib... | gpl-3.0 |
Jumpscale/jumpscale_core8 | tests/tools/cuisine/TestJSCuisine.py | 1 | 4718 | """
Test JSCuisine (core)
"""
import unittest
from unittest import mock
from JumpScale import j
from JumpScale.tools.cuisine.JSCuisine import JSCuisine
import JumpScale
from JumpScale.tools.cuisine.ProcessManagerFactory import ProcessManagerFactory
class TestJSCuisine(unittest.TestCase):
def setUp(self):
... | apache-2.0 |
Mitchkoens/sympy | sympy/utilities/iterables.py | 46 | 60419 | from __future__ import print_function, division
from collections import defaultdict
from itertools import combinations, permutations, product, product as cartes
import random
from operator import gt
from sympy.core.decorators import deprecated
from sympy.core import Basic
# this is the logical location of these func... | bsd-3-clause |
emonty/deb-vhd-util | tools/python/xen/util/xspolicy.py | 49 | 2126 | #============================================================================
# This library is free software; you can redistribute it and/or
# modify it under the terms of version 2.1 of the GNU Lesser General Public
# License as published by the Free Software Foundation.
#
# This library is distributed in the hope th... | gpl-2.0 |
jacobajit/ion | intranet/apps/events/views.py | 1 | 11092 | # -*- coding: utf-8 -*-
import datetime
import logging
import bleach
from django import http
from django.contrib import messages
from django.contrib.auth.decorators import login_required
from django.core import exceptions
from django.shortcuts import get_object_or_404, redirect, render
from .forms import AdminEvent... | gpl-2.0 |
adieu/authentic2 | authentic2/saml/migrations/0019_auto__chg_field_libertysession_provider_id__chg_field_libertysession_n.py | 3 | 21361 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
from authentic2.compat import user_model_label
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'LibertySession.provider_id'
db.alter_col... | agpl-3.0 |
TheVirtualLtd/bda.plone.shop | src/bda/plone/shop/vocabularies.py | 1 | 6162 | # -*- coding: utf-8 -*-
from bda.plone.checkout.vocabularies import country_vocabulary
from bda.plone.checkout.vocabularies import gender_vocabulary
from bda.plone.payment import Payments
from bda.plone.shipping import Shippings
from bda.plone.shop import message_factory as _
from bda.plone.shop.utils import get_shop_a... | bsd-3-clause |
foss-transportationmodeling/rettina-server | .env/local/lib/python2.7/site-packages/pip-1.1-py2.7.egg/pip/_pkgutil.py | 93 | 20099 | """Utilities to support packages."""
# NOTE: This module must remain compatible with Python 2.3, as it is shared
# by setuptools for distribution with Python 2.3 and up.
import os
import sys
import imp
import os.path
from types import ModuleType
__all__ = [
'get_importer', 'iter_importers', 'get_loader', 'find_l... | apache-2.0 |
wwj718/murp-edx | common/djangoapps/student/management/commands/6002exportusers.py | 68 | 1840 | ##
## One-off script to export 6.002x users into the edX framework
##
## Could be modified to be general by:
## * Changing user_keys and up_keys to handle dates more cleanly
## * Providing a generic set of tables, rather than just users and user profiles
## * Handling certificates and grades
## * Handling merge/forks o... | agpl-3.0 |
newfies-dialer/newfies-dialer | newfies/dialer_contact/admin.py | 4 | 8768 | #
# Newfies-Dialer License
# http://www.newfies-dialer.org
#
# 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/.
#
# Copyright (C) 2011-2015 Star2Billing S.L.
#
# The primar... | mpl-2.0 |
Tejas-Subramanya/RYU_MEC | ryu/contrib/ncclient/xml_.py | 64 | 4413 | # Copyright 2009 Shikhar Bhushan
# Copyright 2011 Leonidas Poulopoulos
#
# 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 |
NorfairKing/sus-depot | shared/shared/vim/dotvim/bundle/YouCompleteMe/third_party/retries/retries.py | 54 | 3413 | #!/usr/bin/env python
#
# Copyright 2012 by Jeff Laughlin Consulting LLC
#
# 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 us... | gpl-2.0 |
mmcdermo/helpinghand | server/venv/lib/python2.7/site-packages/django/contrib/auth/tests/urls.py | 105 | 4961 | from django.conf.urls import patterns, url
from django.contrib.auth import context_processors
from django.contrib.auth.forms import AuthenticationForm
from django.contrib.auth.urls import urlpatterns
from django.contrib.auth.views import password_reset, login
from django.contrib.auth.decorators import login_required
fr... | mit |
elaske/mufund | tests.py | 1 | 3839 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
# @Author: Evan Laske
# @Date: 2014-03-01 21:45:31
# @Last Modified by: Evan Laske
# @Last Modified time: 2015-09-15 23:51:12
import urllib
import urllib2
from bs4 import BeautifulSoup
import html5lib
import re
from StockQuote import StockQuote
from MutualFundData impo... | gpl-3.0 |
HiSPARC/station-software | user/python/Lib/test/test_normalization.py | 36 | 3131 | from test.test_support import run_unittest, open_urlresource
import unittest
from httplib import HTTPException
import sys
import os
from unicodedata import normalize, unidata_version
TESTDATAFILE = "NormalizationTest.txt"
TESTDATAURL = "http://www.pythontest.net/unicode/" + unidata_version + "/" + TESTDATAFILE
def c... | gpl-3.0 |
faywong/FFPlayer | project/jni/python/src/Lib/idlelib/macosxSupport.py | 47 | 4602 | """
A number of function that enhance IDLE on MacOSX when it used as a normal
GUI application (as opposed to an X11 application).
"""
import sys
import Tkinter
def runningAsOSXApp():
"""
Returns True if Python is running from within an app on OSX.
If so, assume that Python was built with Aqua Tcl/Tk rather... | lgpl-2.1 |
gooddata/openstack-nova | nova/tests/functional/regressions/test_bug_1780373.py | 1 | 5391 | # 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 |
komarudin02/Public | packages/custom/mail-templates/node_modules/node-sass/node_modules/node-gyp/gyp/pylib/gyp/generator/make.py | 388 | 91069 | # Copyright (c) 2013 Google Inc. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# Notes:
#
# This is all roughly based on the Makefile system used by the Linux
# kernel, but is a non-recursive make -- we put the entire dependency
# graph in fr... | mit |
aidanlister/django | django/template/response.py | 233 | 8906 | import warnings
from django.http import HttpResponse
from django.utils import six
from django.utils.deprecation import RemovedInDjango110Warning
from .backends.django import Template as BackendTemplate
from .base import Template
from .context import Context, RequestContext, _current_app_undefined
from .loader import ... | bsd-3-clause |
kenshay/ImageScripter | ProgramData/SystemFiles/Python/Lib/site-packages/OpenGL/__init__.py | 9 | 10659 | """ctypes-based OpenGL wrapper for Python
This is the PyOpenGL 3.x tree, it attempts to provide
a largely compatible API for code written with the
PyOpenGL 2.x series using the ctypes foreign function
interface system.
Configuration Variables:
There are a few configuration variables in this top-level
module. Applic... | gpl-3.0 |
massmutual/scikit-learn | examples/plot_kernel_approximation.py | 262 | 8004 | """
==================================================
Explicit feature map approximation for RBF kernels
==================================================
An example illustrating the approximation of the feature map
of an RBF kernel.
.. currentmodule:: sklearn.kernel_approximation
It shows how to use :class:`RBFSa... | bsd-3-clause |
P1start/rust | src/etc/gdb_rust_pretty_printing.py | 4 | 6940 | # Copyright 2013-2014 The Rust Project Developers. See the COPYRIGHT
# file at the top-level directory of this distribution and at
# http://rust-lang.org/COPYRIGHT.
#
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
# <LICENSE-MIT or ht... | apache-2.0 |
jvrsantacruz/XlsxWriter | xlsxwriter/test/comparison/test_image03.py | 8 | 1096 | ###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013-2015, John McNamara, jmcnamara@cpan.org
#
from ..excel_comparsion_test import ExcelComparisonTest
from ...workbook import Workbook
class TestCompareXLSXFiles(ExcelComparisonTest):
"""... | bsd-2-clause |
sgraham/nope | third_party/WebKit/Tools/Scripts/webkitpy/common/system/outputcapture.py | 39 | 5120 | # Copyright (c) 2009, Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the... | bsd-3-clause |
bprodoehl/phantomjs | src/qt/qtwebkit/Tools/QueueStatusServer/handlers/syncqueuelogs.py | 122 | 2008 | # Copyright (C) 2013 Google Inc. All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the ... | bsd-3-clause |
Foldblade/EORS | Mypackage/back_to_yesterday.py | 1 | 3091 | # encoding:utf-8
'''
————————————————————————————————
back_to_yesterday.py
对备份文件的回档,所谓‘回到昨天’功能。
实现原理:删除源文件。解压备份的zip,自动覆盖。
————————————————————————————————
'''
import os
import zipfile
import shutil
import time
def back_to_yesterday():
where_script = os.path.split(os.path.realpath(__file__))[0]
# print(where_... | gpl-3.0 |
opensim-org/three.js | utils/exporters/blender/addons/io_three/exporter/api/texture.py | 97 | 3680 | from bpy import data, types
from .. import constants, logger
from .constants import IMAGE, MAG_FILTER, MIN_FILTER, MAPPING
from . import image
def _texture(func):
"""
:param func:
"""
def inner(name, *args, **kwargs):
"""
:param name:
:param *args:
:param **kwargs:
... | mit |
mingit/mstcpV0.89.4_linux | tools/perf/scripts/python/netdev-times.py | 11271 | 15048 | # Display a process of packets and processed time.
# It helps us to investigate networking or network device.
#
# options
# tx: show only tx chart
# rx: show only rx chart
# dev=: show only thing related to specified device
# debug: work with debug mode. It shows buffer status.
import os
import sys
sys.path.append(os... | gpl-2.0 |
Stane1983/odroidc-linux | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Core.py | 11088 | 3246 | # Core.py - Python extension for perf script, core functions
#
# Copyright (C) 2010 by Tom Zanussi <tzanussi@gmail.com>
#
# This software may be distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Free Software
# Foundation.
from collections import defaultdict
def aut... | gpl-2.0 |
nitzmahone/ansible | lib/ansible/plugins/connection/zone.py | 7 | 8030 | # Based on local.py (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
# and chroot.py (c) 2013, Maykel Moya <mmoya@speedyrails.com>
# and jail.py (c) 2013, Michael Scherer <misc@zarb.org>
# (c) 2015, Dagobert Michelsen <dam@baltic-online.de>
# (c) 2015, Toshio Kuratomi <tkuratomi@ansible.com>
# Copyright (c... | gpl-3.0 |
Kazade/NeHe-Website | google_appengine/lib/django_1_2/tests/modeltests/one_to_one/tests.py | 92 | 5714 | from django.test import TestCase
from django.db import transaction, IntegrityError
from models import Place, Restaurant, Waiter, ManualPrimaryKey, RelatedModel, MultiModel
class OneToOneTests(TestCase):
def setUp(self):
self.p1 = Place(name='Demon Dogs', address='944 W. Fullerton')
self.p1.save()
... | bsd-3-clause |
aurora-pro/apex-sigma | sigma/core/plugin.py | 2 | 2966 | import os
import yaml
from itertools import dropwhile
from .command import Command
from .event import Event
from .logger import create_logger
class PluginNotEnabled(RuntimeError):
pass
class Plugin(object):
def __init__(self, bot, path):
self.loaded = False
self.help = 'No help available, s... | gpl-3.0 |
XiMuYouZi/PythonDemo | Crawler/Zhihu/zhihuuser/spiders/zhihu_user.py | 1 | 4440 | # -*- coding: utf-8 -*-
# 爬取知乎全站的用户信息
import json
from scrapy import Spider, Request
from Crawler.Zhihu.zhihuuser.items import UserItem
class ZhihuSpider(Spider):
#忽略301,302重定向请求
# handle_httpstatus_list = [301, 302]
name = "zhihu_user"
allowed_domains = ["www.zhihu.com"]
user_url = 'https://... | mit |
vitmod/enigma2 | lib/python/Screens/InstallWizard.py | 18 | 5657 | from Screens.Screen import Screen
from Components.ConfigList import ConfigListScreen
from Components.Sources.StaticText import StaticText
from Components.config import config, ConfigSubsection, ConfigBoolean, getConfigListEntry, ConfigSelection, ConfigYesNo, ConfigIP
from Components.Network import iNetwork
from Compone... | gpl-2.0 |
fspaolo/scikit-learn | sklearn/utils/extmath.py | 3 | 18665 | """
Extended math utilities.
"""
# Authors: G. Varoquaux, A. Gramfort, A. Passos, O. Grisel
# License: BSD 3 clause
import warnings
import numpy as np
from scipy import linalg
from scipy.sparse import issparse
from distutils.version import LooseVersion
from . import check_random_state
from .fixes import qr_economic
f... | bsd-3-clause |
invisiblek/python-for-android | python3-alpha/python3-src/Tools/freeze/parsesetup.py | 100 | 3008 | # Parse Makefiles and Python Setup(.in) files.
import re
# Extract variable definitions from a Makefile.
# Return a dictionary mapping names to values.
# May raise IOError.
makevardef = re.compile('^([a-zA-Z0-9_]+)[ \t]*=(.*)')
def getmakevars(filename):
variables = {}
fp = open(filename)
pendingline =... | apache-2.0 |
wisechengyi/pants | src/python/pants/testutil/pants_run_integration_test.py | 2 | 28465 | # Copyright 2019 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
import glob
import os
import re
import shutil
import subprocess
import sys
import unittest
from contextlib import contextmanager
from dataclasses import dataclass
from operator import eq, ... | apache-2.0 |
kennethlove/django | django/utils/unittest/signals.py | 571 | 1684 | import signal
import weakref
from django.utils.unittest.compatibility import wraps
__unittest = True
class _InterruptHandler(object):
def __init__(self, default_handler):
self.called = False
self.default_handler = default_handler
def __call__(self, signum, frame):
installed_handler ... | bsd-3-clause |
johankaito/fufuka | microblog/old-flask/lib/python2.7/site-packages/jinja2/visitor.py | 1401 | 3316 | # -*- coding: utf-8 -*-
"""
jinja2.visitor
~~~~~~~~~~~~~~
This module implements a visitor for the nodes.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD.
"""
from jinja2.nodes import Node
class NodeVisitor(object):
"""Walks the abstract syntax tree and call visitor functions for every... | apache-2.0 |
benoitsteiner/tensorflow-opencl | 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 |
thruflo/dogpile.cache | tests/cache/test_memcached_backend.py | 1 | 6526 | from ._fixtures import _GenericBackendTest, _GenericMutexTest
from . import eq_, winsleep
from unittest import TestCase
from threading import Thread
import time
from nose import SkipTest
from dogpile.cache import compat
class _TestMemcachedConn(object):
@classmethod
def _check_backend_available(cls, backend):... | bsd-3-clause |
snnn/tensorflow | tensorflow/examples/learn/iris.py | 20 | 3983 | # 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 appl... | apache-2.0 |
saada/ansible | lib/ansible/plugins/lookup/url.py | 30 | 2024 | # (c) 2015, Brian Coca <bcoca@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 version.... | gpl-3.0 |
Vishruit/DDP_models | tf1/lib/python2.7/site-packages/pip/_vendor/requests/packages/chardet/jisfreq.py | 3131 | 47315 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client 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 R... | gpl-3.0 |
xiaoshaozi52/ansible | lib/ansible/plugins/lookup/fileglob.py | 176 | 1345 | # (c) 2012, Michael DeHaan <michael.dehaan@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any lat... | gpl-3.0 |
vipins/ccccms | env/Lib/site-packages/django/template/defaulttags.py | 50 | 48005 | """Default tags used by the template system, available to all templates."""
import sys
import re
from datetime import datetime
from itertools import groupby, cycle as itertools_cycle
from django.conf import settings
from django.template.base import (Node, NodeList, Template, Library,
TemplateSyntaxError, Variable... | bsd-3-clause |
duoduo369/python-social-auth | social/strategies/webpy_strategy.py | 11 | 2068 | import web
from social.strategies.base import BaseStrategy, BaseTemplateStrategy
class WebpyTemplateStrategy(BaseTemplateStrategy):
def render_template(self, tpl, context):
return web.template.render(tpl)(**context)
def render_string(self, html, context):
return web.template.Template(html)(*... | bsd-3-clause |
sgzwiz/brython | tests/console.py | 1 | 2190 | import sys
import time
import random
#this sucks.. cannot find dis since "root" path is blah/test
#we might need to create a variable we pass via the brython function
# to state what the root path is.
# For now, we'll hardcode a relative path. :(
sys.path.append("../Lib")
import dis
_rand=random.random()
editor=... | bsd-3-clause |
asiersarasua/QGIS | python/plugins/processing/gui/wrappers_map_theme.py | 30 | 1829 | # -*- coding: utf-8 -*-
"""
***************************************************************************
wrappers_map_theme.py - Map theme widget wrappers
---------------------
Date : August 2017
Copyright : (C) 2017 by OPENGIS.ch
Email : mario@opengis.ch
**... | gpl-2.0 |
chrish42/pylearn | pylearn2/scripts/icml_2013_wrepl/multimodal/extract_layer_2_kmeans_features.py | 44 | 2762 | from __future__ import print_function
import numpy as np
import os
import sys
from pylearn2.utils import serial
from pylearn2.utils import sharedX
from pylearn2.utils.string_utils import preprocess
def usage():
print("""
Run
python extract_layer_2_kmeans_features.py public_test
to extract features for the ICML 2... | bsd-3-clause |
camptocamp/odoo | addons/web_graph/controllers/main.py | 97 | 3556 | from openerp import http
import simplejson
from openerp.http import request, serialize_exception as _serialize_exception
from cStringIO import StringIO
from collections import deque
try:
import xlwt
except ImportError:
xlwt = None
class TableExporter(http.Controller):
@http.route('/web_graph/check_xlwt',... | agpl-3.0 |
dex4er/django | tests/multiple_database/tests.py | 49 | 90108 | from __future__ import absolute_import, unicode_literals
import datetime
import pickle
from operator import attrgetter
import warnings
from django.conf import settings
from django.contrib.auth.models import User
from django.contrib.contenttypes.models import ContentType
from django.core import management
from django.... | bsd-3-clause |
rytaft/h-store | third_party/python/boto/ec2/connection.py | 9 | 98856 | # Copyright (c) 2006-2010 Mitch Garnaat http://garnaat.org/
# Copyright (c) 2010, Eucalyptus Systems, 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
# w... | gpl-3.0 |
vvv1559/intellij-community | python/helpers/pydev/tests_pydevd_python/performance_check.py | 8 | 8254 | import debugger_unittest
import sys
import re
import os
CHECK_BASELINE, CHECK_REGULAR, CHECK_CYTHON = 'baseline', 'regular', 'cython'
class PerformanceWriterThread(debugger_unittest.AbstractWriterThread):
CHECK = None
debugger_unittest.AbstractWriterThread.get_environ # overrides
def get_environ(self):
... | apache-2.0 |
edx-solutions/edx-platform | common/djangoapps/track/views/tests/test_views.py | 3 | 11445 | import ddt
import six
from django.contrib.auth.models import User
from django.test.client import RequestFactory
from django.test.utils import override_settings
from mock import patch, sentinel
from openedx.core.lib.tests.assertions.events import assert_event_matches
from track import views
from track.middleware import... | agpl-3.0 |
devs1991/test_edx_docmode | venv/lib/python2.7/site-packages/ratelimitbackend/backends.py | 1 | 2730 | import logging
import warnings
from datetime import datetime, timedelta
from django.contrib.auth.backends import ModelBackend
from django.core.cache import cache
from .exceptions import RateLimitException
logger = logging.getLogger('ratelimitbackend')
class RateLimitMixin(object):
"""
A mixin to enable ra... | agpl-3.0 |
Inspirati/freeMixer | Tools/MAVLink/mavlink/pymavlink/fgFDM.py | 20 | 9572 | #!/usr/bin/env python
# parse and construct FlightGear NET FDM packets
# Andrew Tridgell, November 2011
# released under GNU GPL version 2 or later
import struct, math
class fgFDMError(Exception):
'''fgFDM error class'''
def __init__(self, msg):
Exception.__init__(self, msg)
self.message = 'fg... | gpl-3.0 |
pedrobaeza/odoo | addons/account_analytic_default/__init__.py | 445 | 1087 | # -*- 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... | agpl-3.0 |
jlmadurga/django-oscar | tests/unit/address/model_tests.py | 29 | 7088 | # -*- coding: utf-8 -*-
import pytest
from django.test import TestCase
from django.core import exceptions
from oscar.apps.order.models import ShippingAddress
from oscar.core.compat import get_user_model
from oscar.apps.address import models
from oscar.test import factories
User = get_user_model()
class TestUserAdd... | bsd-3-clause |
napalm-automation/napalm-yang | napalm_yang/models/openconfig/network_instances/network_instance/protocols/protocol/isis/levels/level/link_state_database/lsp/tlvs/tlv/ipv6_reachability/prefixes/prefixes_/subTLVs/subTLVs_/state/__init__.py | 1 | 524547 | # -*- coding: utf-8 -*-
from operator import attrgetter
from pyangbind.lib.yangtypes import RestrictedPrecisionDecimalType
from pyangbind.lib.yangtypes import RestrictedClassType
from pyangbind.lib.yangtypes import TypedListType
from pyangbind.lib.yangtypes import YANGBool
from pyangbind.lib.yangtypes import YANGListTy... | apache-2.0 |
adykstra/mne-python | mne/externals/jdcal.py | 39 | 3364 | # -*- coding: utf-8 -*-
"""Functions for converting between Julian dates and calendar dates.
A function for converting Gregorian calendar dates to Julian dates, and
another function for converting Julian calendar dates to Julian dates
are defined. Two functions for the reverse calculations are also
defined.
Different... | bsd-3-clause |
otherness-space/myProject002 | my_project_002/lib/python2.7/site-packages/django/contrib/localflavor/uy/forms.py | 109 | 2160 | # -*- coding: utf-8 -*-
"""
UY-specific form helpers.
"""
from __future__ import absolute_import, unicode_literals
from django.core.validators import EMPTY_VALUES
from django.forms.fields import Select, RegexField
from django.forms import ValidationError
from django.utils.translation import ugettext_lazy as _
from dj... | mit |
xunmengfeng/engine | build/android/pylib/device/shared_prefs_test.py | 36 | 6291 | #!/usr/bin/env python
# Copyright 2015 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.
"""
Unit tests for the contents of shared_prefs.py (mostly SharedPrefs).
"""
import logging
import os
import sys
import unittest
from... | bsd-3-clause |
linglung/ytdl | youtube_dl/extractor/rbmaradio.py | 7 | 2316 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_str
from ..utils import (
clean_html,
int_or_none,
unified_timestamp,
update_url_query,
)
class RBMARadioIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?rbmaradio\.com/shows/(?P<s... | unlicense |
fangcode/annotated_flask_source | tests/test_reqctx.py | 140 | 5262 | # -*- coding: utf-8 -*-
"""
tests.reqctx
~~~~~~~~~~~~
Tests the request context.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
import pytest
import flask
try:
from greenlet import greenlet
except ImportError:
greenlet = None
def test_teardown... | bsd-3-clause |
joetsoi/moonstone | python/main.py | 1 | 1239 | from collections import namedtuple
from struct import unpack, unpack_from
Segment = namedtuple('Segment', 'offset length')
ViewportDimension = namedtuple('ViewportDimension', 'right left')
class MainExe(object):
def __init__(self, file_path):
data_segment = Segment(0x138a0, 0xf460)
with open(fil... | agpl-3.0 |
albertomurillo/ansible | lib/ansible/modules/network/dellos10/dellos10_config.py | 42 | 13211 | #!/usr/bin/python
#
# (c) 2015 Peter Sprygada, <psprygada@ansible.com>
# Copyright (c) 2017 Dell 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_vers... | gpl-3.0 |
mlorbetske/PTVS | Python/Tests/TestData/VirtualEnv/env/Lib/posixpath.py | 18 | 14022 | """Common operations on Posix pathnames.
Instead of importing this module directly, import os and refer to
this module as os.path. The "os.path" name is an alias for this
module on Posix systems; on other systems (e.g. Mac, Windows),
os.path provides the same operations in a manner specific to that
platform, an... | apache-2.0 |
MariaSolovyeva/inasafe | safe_extras/raven/utils/serializer/manager.py | 25 | 2566 | """
raven.utils.serializer.manager
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
:copyright: (c) 2010 by the Sentry Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import logging
__all__ = ('register', 'transform')
logger = logging.getLogger('sentry.errors.serializer')
class SerializationMana... | gpl-3.0 |
billwanjohi/ansible | plugins/inventory/nova.py | 23 | 7096 | #!/usr/bin/env python
# (c) 2012, Marco Vito Moscaritolo <marco@agavee.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
# ... | gpl-3.0 |
fongandrew/TypeScript-Sublime-JSX-Plugin | typescript/libs/reference.py | 7 | 4416 | from .global_vars import *
class Ref:
"""Reference item in the 'Find All Reference' view
A reference to a source file, line, offset; next and prev refer to the
next and previous reference in a view containing references
"""
def __init__(self, filename, line, offset, prev_line):
self.fil... | apache-2.0 |
jimi-c/ansible | lib/ansible/modules/cloud/amazon/ec2_tag.py | 11 | 5508 | #!/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... | gpl-3.0 |
shrikrishnaholla/zulip | provision.py | 65 | 4968 | import os
import sys
import logging
import platform
try:
import sh
except ImportError:
import pbs as sh
SUPPORTED_PLATFORMS = {
"Ubuntu": [
"trusty",
],
}
APT_DEPENDENCIES = {
"trusty": [
"closure-compiler",
"libffi-dev",
"memcached",
"rabbitmq-server",
... | apache-2.0 |
spodkowinski/cassandra-dtest | jmx_auth_test.py | 4 | 3162 | from distutils.version import LooseVersion
from ccmlib.node import ToolError
from dtest import Tester
from tools.decorators import since
from tools.jmxutils import apply_jmx_authentication
@since('3.6')
class TestJMXAuth(Tester):
def basic_auth_test(self):
"""
Some basic smoke testing of JMX au... | apache-2.0 |
meabsence/python-for-android | python3-alpha/python3-src/Tools/scripts/ndiff.py | 49 | 3825 | #! /usr/bin/env python3
# Module ndiff version 1.7.0
# Released to the public domain 08-Dec-2000,
# by Tim Peters (tim.one@home.com).
# Provided as-is; use at your own risk; no warranty; no promises; enjoy!
# ndiff.py is now simply a front-end to the difflib.ndiff() function.
# Originally, it contained the difflib.S... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.