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 |
|---|---|---|---|---|---|
iAmMrinal0/HTPC-Manager | libs/cherrypy/tutorial/bonus-sqlobject.py | 54 | 5721 | '''
Bonus Tutorial: Using SQLObject
This is a silly little contacts manager application intended to
demonstrate how to use SQLObject from within a CherryPy2 project. It
also shows how to use inline Cheetah templates.
SQLObject is an Object/Relational Mapper that allows you to access
data stored in an RDBMS in a pytho... | mit |
edcomstock/werkzeug | examples/httpbasicauth.py | 44 | 1529 | # -*- coding: utf-8 -*-
"""
HTTP Basic Auth Example
~~~~~~~~~~~~~~~~~~~~~~~
Shows how you can implement HTTP basic auth support without an
additional component.
:copyright: (c) 2009 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD.
"""
from werkzeug.serving import run_simple
f... | bsd-3-clause |
podemos-info/odoo | addons/survey/wizard/survey_print.py | 9 | 2967 |
# -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-TODAY OpenERP S.A. <http://www.openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the term... | agpl-3.0 |
biswajitsahu/kuma | vendor/packages/pygments/lexers/compiled.py | 77 | 1336 | # -*- coding: utf-8 -*-
"""
pygments.lexers.compiled
~~~~~~~~~~~~~~~~~~~~~~~~
Just export lexer classes previously contained in this module.
:copyright: Copyright 2006-2014 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexers.jvm import JavaLexer, Sc... | mpl-2.0 |
nopjmp/SickRage | lib/unidecode/x0bd.py | 253 | 4752 | data = (
'bols', # 0x00
'bolt', # 0x01
'bolp', # 0x02
'bolh', # 0x03
'bom', # 0x04
'bob', # 0x05
'bobs', # 0x06
'bos', # 0x07
'boss', # 0x08
'bong', # 0x09
'boj', # 0x0a
'boc', # 0x0b
'bok', # 0x0c
'bot', # 0x0d
'bop', # 0x0e
'boh', # 0x0f
'bwa', # 0x10
'bwag', # 0x... | gpl-3.0 |
Technorip/Myntra | Django Backend/myntra/env/lib/python2.7/site-packages/django/db/backends/postgresql/schema.py | 25 | 5629 | import psycopg2
from django.db.backends.base.schema import BaseDatabaseSchemaEditor
class DatabaseSchemaEditor(BaseDatabaseSchemaEditor):
sql_alter_column_type = "ALTER COLUMN %(column)s TYPE %(type)s USING %(column)s::%(type)s"
sql_create_sequence = "CREATE SEQUENCE %(sequence)s"
sql_delete_sequence =... | gpl-2.0 |
Nicop06/ansible | lib/ansible/modules/network/netvisor/pn_vrouterif.py | 29 | 15342 | #!/usr/bin/python
""" PN-CLI vrouter-interface-add/remove/modify """
#
# 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... | gpl-3.0 |
andreparrish/python-for-android | python-build/python-libs/xmpppy/xmpp/simplexml.py | 198 | 22791 | ## simplexml.py based on Mattew Allum's xmlstream.py
##
## Copyright (C) 2003-2005 Alexey "Snake" Nezhdanov
##
## 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, or (... | apache-2.0 |
mhuwiler/rootauto | interpreter/llvm/src/utils/Target/ARM/analyze-match-table.py | 124 | 2129 | #!/usr/bin/env python
def analyze_match_table(path):
# Extract the instruction table.
data = open(path).read()
start = data.index("static const MatchEntry MatchTable")
end = data.index("\n};\n", start)
lines = data[start:end].split("\n")[1:]
# Parse the instructions.
insns = []
for ln ... | lgpl-2.1 |
goodguy/satchmo | satchmo/apps/product/migrations/__init__.py | 13 | 1684 | from django.contrib.contenttypes.models import ContentType
from south.logger import get_logger
from south.v2 import DataMigration
# Helper class for (0012|0002)_update_content_types
class UpdateContentTypeMigration(DataMigration):
_app_label = None
def __init__(self, *args, **kwargs):
super(UpdateCont... | bsd-3-clause |
daniel-dinu/rational-python | test_rational/test_rational.py | 1 | 32468 | import unittest2
from unittest2 import TestCase
from rational.rational import gcd
from rational.rational import Rational
__author__ = 'Daniel Dinu'
class TestRational(TestCase):
def setUp(self):
self.known_values = [(1, 2, 1, 2),
(-1, 2, -1, 2),
... | mit |
bakkou-badri/dataminingproject | env/lib/python2.7/site-packages/numpy/testing/nosetester.py | 11 | 15818 | """
Nose test running.
This module implements ``test()`` and ``bench()`` functions for NumPy modules.
"""
from __future__ import division, absolute_import, print_function
import os
import sys
import warnings
from numpy.compat import basestring
from numpy import ModuleDeprecationWarning
def get_package_name(filepat... | gpl-2.0 |
andrewcmyers/tensorflow | tensorflow/python/framework/device_test.py | 106 | 6735 | # 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 |
aldian/tensorflow | tensorflow/python/ops/control_flow_ops.py | 3 | 133015 | # 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 |
sebalix/OpenUpgrade | addons/l10n_ch/__init__.py | 424 | 1212 | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Nicolas Bessi. Copyright Camptocamp SA
# Financial contributors: Hasa SA, Open Net SA,
# Prisme Solutions Informatique SA, Quod SA
#
# Translation contributors: brain-te... | agpl-3.0 |
yavuzovski/playground | python/django/RESTTest/.venv/lib/python3.4/site-packages/django/contrib/messages/storage/cookie.py | 116 | 6560 | import json
from django.conf import settings
from django.contrib.messages.storage.base import BaseStorage, Message
from django.http import SimpleCookie
from django.utils import six
from django.utils.crypto import constant_time_compare, salted_hmac
from django.utils.safestring import SafeData, mark_safe
class Message... | gpl-3.0 |
Universal-Model-Converter/UMC3.0a | data/Python/x86/Lib/site-packages/numpy/testing/noseclasses.py | 15 | 14361 | # These classes implement a doctest runner plugin for nose, a "known failure"
# error class, and a customized TestProgram for NumPy.
# Because this module imports nose directly, it should not
# be used except by nosetester.py to avoid a general NumPy
# dependency on nose.
import os
import doctest
import nose
from no... | mit |
romain-dartigues/ansible | lib/ansible/modules/monitoring/sensu_check.py | 56 | 12707 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Anders Ingemann <aim@secoya.dk>
# 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 |
HiSPARC/station-software | user/python/Lib/test/test_ast.py | 45 | 24761 | import sys, itertools, unittest
from test import test_support
import ast
def to_tuple(t):
if t is None or isinstance(t, (basestring, int, long, complex)):
return t
elif isinstance(t, list):
return [to_tuple(e) for e in t]
result = [t.__class__.__name__]
if hasattr(t, 'lineno') and hasat... | gpl-3.0 |
ashhher3/seaborn | seaborn/tests/test_axisgrid.py | 11 | 41072 | import warnings
import numpy as np
import pandas as pd
from scipy import stats
import matplotlib as mpl
import matplotlib.pyplot as plt
from distutils.version import LooseVersion
import nose.tools as nt
import numpy.testing as npt
from numpy.testing.decorators import skipif
import pandas.util.testing as tm
from . im... | bsd-3-clause |
jamielennox/deluge | deluge/httpdownloader.py | 4 | 8217 | #
# httpdownloader.py
#
# Copyright (C) 2009 Andrew Resch <andrewresch@gmail.com>
#
# Deluge is free software.
#
# You may 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 late... | gpl-3.0 |
kenshay/ImageScripter | ProgramData/SystemFiles/Python/Lib/site-packages/imageio/core/fetching.py | 4 | 8842 | # -*- coding: utf-8 -*-
# Copyright (c) 2015, imageio contributors
# Based on code from the vispy project
# Distributed under the (new) BSD License. See LICENSE.txt for more info.
"""Data downloading and reading functions
"""
from __future__ import absolute_import, print_function, division
from math import log
impor... | gpl-3.0 |
attilahorvath/phantomjs | src/qt/qtwebkit/Tools/Scripts/webkitpy/tool/steps/ensurebugisopenandassigned.py | 135 | 2061 | # Copyright (C) 2010 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 |
CruiseDevice/coala | coalib/output/printers/LogPrinter.py | 34 | 6096 | import traceback
import logging
from coalib.output.printers.LOG_LEVEL import LOG_LEVEL
from coalib.processes.communication.LogMessage import LogMessage
class LogPrinterMixin:
"""
Provides access to the logging interfaces (e.g. err, warn, info) by routing
them to the log_message method, which should be im... | agpl-3.0 |
alkadis/vcv | src/adhocracy/lib/auth/instance.py | 4 | 2124 | from pylons import tmpl_context as c, app_globals as g
from authorization import has
from adhocracy.lib.auth.authorization import NOT_JOINED
from adhocracy.lib.auth.authorization import NOT_LOGGED_IN
def index(check):
check.other('is_single_instance', g.single_instance)
check.perm('instance.index')
def show... | agpl-3.0 |
camradal/ansible | lib/ansible/plugins/callback/logentries.py | 69 | 11249 | """ (c) 2015, Logentries.com, Jimmy Tang <jimmy.tang@logentries.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 o... | gpl-3.0 |
d4nielcosta/djangoembed | oembed/migrations/0001_initial.py | 4 | 7119 | # encoding: utf-8
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.conf import settings
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Adding model 'StoredOEmbed'
db.create_table('oembed_storedoembed', (
... | mit |
jalavik/invenio | invenio/modules/formatter/format_elements/bfe_authority_journal.py | 13 | 2819 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2006, 2007, 2008, 2009, 2010, 2011, 2015 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
# Li... | gpl-2.0 |
jarshwah/django | tests/migrations/test_state.py | 12 | 50743 | from django.apps.registry import Apps
from django.contrib.contenttypes.fields import GenericForeignKey
from django.db import models
from django.db.migrations.exceptions import InvalidBasesError
from django.db.migrations.operations import (
AddField, AlterField, DeleteModel, RemoveField,
)
from django.db.migrations.... | bsd-3-clause |
sudosurootdev/external_chromium_org | tools/json_schema_compiler/model_test.py | 101 | 5838 | #!/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.
from json_schema import CachedLoad
from idl_schema import Load
from model import Platforms
import model
import unittest
class Mode... | bsd-3-clause |
WaveBlocks/WaveBlocks | src/WaveBlocks/MatrixPotential1S.py | 1 | 13237 | """The WaveBlocks Project
This file contains code for the representation of potentials for a single component.
These potential are of course scalar ones.
@author: R. Bourquin
@copyright: Copyright (C) 2010, 2011 R. Bourquin
@license: Modified BSD License
"""
import sympy
import numpy
from MatrixPotential import Mat... | bsd-3-clause |
jjmachan/activityPointsApp | activitypoints/lib/python3.5/site-packages/django/core/management/commands/compilemessages.py | 115 | 5211 | from __future__ import unicode_literals
import codecs
import glob
import os
from django.core.management.base import BaseCommand, CommandError
from django.core.management.utils import find_command, popen_wrapper
from django.utils._os import npath, upath
def has_bom(fn):
with open(fn, 'rb') as f:
sample =... | mit |
sajeeshcs/nested_quota_final | nova/api/openstack/compute/schemas/v3/remote_consoles.py | 31 | 2498 | # Copyright 2014 NEC Corporation. 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 ... | apache-2.0 |
naturali/tensorflow | tensorflow/python/kernel_tests/segment_reduction_ops_test.py | 1 | 23515 | # 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 |
40323155/cadpaw2 | plugin/liquid_tags/b64img.py | 312 | 3085 | """
Image Tag
---------
This implements a Liquid-style image tag for Pelican,
based on the liquid img tag which is based on the octopress image tag [1]_
Syntax
------
{% b64img [class name(s)] [http[s]:/]/path/to/image [width [height]] [title text | "title text" ["alt text"]] %}
Examples
--------
{% b64img /images/ni... | mit |
jasonseminara/OpenSourceFinal | myvenv/lib/python3.5/site-packages/django/utils/ipv6.py | 208 | 7967 | # This code was mostly based on ipaddr-py
# Copyright 2007 Google Inc. https://github.com/google/ipaddr-py
# Licensed under the Apache License, Version 2.0 (the "License").
from django.core.exceptions import ValidationError
from django.utils.six.moves import range
from django.utils.translation import ugettext_lazy as _... | mit |
TEAM-Gummy/platform_external_chromium_org | third_party/closure_linter/closure_linter/error_check.py | 137 | 3620 | #!/usr/bin/env python
#
# Copyright 2011 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 copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#... | bsd-3-clause |
otherness-space/myProject | my_project_001/lib/python2.7/site-packages/pip/_vendor/html5lib/treewalkers/_base.py | 436 | 7014 | from __future__ import absolute_import, division, unicode_literals
from pip._vendor.six import text_type, string_types
__all__ = ["DOCUMENT", "DOCTYPE", "TEXT", "ELEMENT", "COMMENT", "ENTITY", "UNKNOWN",
"TreeWalker", "NonRecursiveTreeWalker"]
from xml.dom import Node
DOCUMENT = Node.DOCUMENT_NODE
DOCTYPE... | mit |
AsimmHirani/ISpyPi | tensorflow/contrib/tensorflow-master/tensorflow/contrib/sparsemax/python/ops/sparsemax.py | 104 | 2649 | # 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 |
manolomartinez/stagger | stagger/specs.py | 18 | 16744 | #
# specs.py
# From the stagger project: http://code.google.com/p/stagger/
#
# Copyright (c) 2009-2011 Karoly Lorentey <karoly@lorentey.hu>
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are met:
#
#... | bsd-2-clause |
ampproject/amp-github-apps | project-metrics/metrics_service/scrapers/commit_scraper.py | 1 | 5432 | import datetime
from typing import Sequence
import logging
import time
import sqlalchemy
from apis import github
from database import db
from database import models
SCRAPE_INTERVAL_SECONDS = 5
def timestamp_90_days_ago() -> datetime.datetime:
return datetime.datetime.now() - datetime.timedelta(days=90)
class Co... | apache-2.0 |
janusnic/youtube-dl-GUI | youtube_dl/extractor/fourtube.py | 20 | 3719 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import (
compat_urllib_request,
)
from ..utils import (
clean_html,
parse_duration,
str_to_int,
unified_strdate,
)
class FourTubeIE(InfoExtractor):
IE_NAME = '4tube'
_VALID_URL = r'https?://... | mit |
huahbo/src | book/gallery/vofz/vofz.py | 5 | 3696 | from rsf.proj import *
import rsf.gallery
method = rsf.gallery.method()
par = dict(xmin=2.5,xmax=7.5,zmin=0,zmax=5,
v0=1.5,gradx=0,gradz=0.36,
dim1 = 'd1=0.001 o1=0 n1=10001',
dim2 = 'd2=0.01 o2=0 n2=501')
def igrey(custom='',title=''):
return '''
window min2=%g max2=%g min1... | gpl-2.0 |
xq262144/hue | desktop/core/ext-py/MySQL-python-1.2.5/doc/conf.py | 41 | 7746 | # -*- coding: utf-8 -*-
#
# MySQLdb documentation build configuration file, created by
# sphinx-quickstart on Sun Oct 07 19:36:17 2012.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All... | apache-2.0 |
ibmibmibm/beets | test/test_logging.py | 8 | 10563 | # -*- coding: utf-8 -*-
"""Stupid tests that ensure logging works as expected"""
from __future__ import division, absolute_import, print_function
import sys
import threading
import logging as log
from six import StringIO
import unittest
import beets.logging as blog
from beets import plugins, ui
import beetsplug
from... | mit |
brianlsharp/MissionPlanner | Lib/site-packages/numpy/oldnumeric/misc.py | 94 | 1168 | # Functions that already have the correct syntax or miscellaneous functions
__all__ = ['sort', 'copy_reg', 'clip', 'rank',
'sign', 'shape', 'types', 'allclose', 'size',
'choose', 'swapaxes', 'array_str',
'pi', 'math', 'concatenate', 'putmask', 'put',
'around', 'vdot', 'tran... | gpl-3.0 |
tobijk/ecromedos | lib/net/ecromedos/ecmlprocessor.py | 1 | 4602 | # -*- coding: utf-8 -*-
#
# Desc: This file is part of the ecromedos Document Preparation System
# Author: Tobias Koch <tobias@tobijk.de>
# License: MIT
# URL: http://www.ecromedos.net
#
import os, sys
import lxml.etree as etree
from net.ecromedos.error import ECMDSError, ECMDSPluginError
from net.ecromedos.co... | mit |
KevinJiao/SnapYak | lib/python2.7/site-packages/requests/packages/chardet/constants.py | 3008 | 1335 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Universal charset detector code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 2001
# the Initial Developer. All R... | mit |
savoirfairelinux/django | tests/template_tests/test_nodelist.py | 105 | 3107 | from unittest import TestCase
from django.template import Context, Engine
from django.template.base import TextNode, VariableNode
class NodelistTest(TestCase):
@classmethod
def setUpClass(cls):
cls.engine = Engine()
super().setUpClass()
def test_for(self):
template = self.engine... | bsd-3-clause |
danielquinn/spirithunter | src/spirits/api/resources.py | 1 | 8242 | import json
import random
from math import sin, cos
from django.conf import settings
from django.core.exceptions import ValidationError
from django.shortcuts import get_object_or_404
from tastypie import fields
from tastypie import http
from tastypie.authentication import MultiAuthentication, Authentication, BasicAu... | agpl-3.0 |
linuxrocks123/MailTask | mt_attache.py | 1 | 3151 | #! /usr/bin/env python
# MailTask Alpha: The Email Manager
# Copyright (C) 2015 Patrick Simmons
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your ... | gpl-3.0 |
maniteja123/scipy | scipy/stats/contingency.py | 107 | 9321 | """Some functions for working with contingency tables (i.e. cross tabulations).
"""
from __future__ import division, print_function, absolute_import
from functools import reduce
import numpy as np
from .stats import power_divergence
__all__ = ['margins', 'expected_freq', 'chi2_contingency']
def margins(a):
"... | bsd-3-clause |
unapiedra/BBChop | tests/dumbdag.py | 1 | 3423 | # Copyright 2008 Ealdwulf Wuffinga
# This file is part of BBChop.
#
# BBChop 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 ... | gpl-2.0 |
jleete97/python-graphics | games/turns/reversi/reversi.py | 1 | 3731 | import random
import sys
import time
from reversiboard import *
from games.turns.reversi.reversimoves import *
# Window parameters
WINDOW_WIDTH = 800
WINDOW_HEIGHT = 700
# Colors
DARK_GREEN = (0, 128, 0)
DARK_GREY = (128, 128, 128)
LIGHT_RED = (255, 192, 192)
GREEN = (0, 255, 0)
WHITE = (255, 255, 255)
BLACK = (0, ... | mit |
garick82/android_kernel_samsung_codina | tools/perf/scripts/python/Perf-Trace-Util/lib/Perf/Trace/Util.py | 12527 | 1935 | # Util.py - Python extension for perf script, miscellaneous utility code
#
# 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.
import errno, os
FUTEX_WAIT = 0... | gpl-2.0 |
Lothiraldan/MongoTSDB | tests/test_range.py | 1 | 3744 | import unittest
from mongotsdb import Range, SubRange, RangeSet, MultiRangeWorker, RangeWorker
class RangeTestCase(unittest.TestCase):
def setUp(self):
self.start = 0
self.stop = 7
self.step = self.stop - self.start
self.r = Range(self.start, self.stop)
def test_instantiation... | gpl-3.0 |
Foair/course-crawler | mooc/xuetangx.py | 1 | 7412 | # -*- coding: utf-8 -*-
"""学堂在线"""
import json
from bs4 import BeautifulSoup
from .utils import *
BASE_URL = 'http://www.xuetangx.com'
CANDY = Crawler()
CONFIG = {}
FILES = {}
def get_book(url):
"""获得所有的 PDF 电子书"""
nav_page = CANDY.get(url).text
shelves = set(re.findall(r'/courses/.+/pdfbook/\d/', nav_... | mit |
googleads/google-ads-python | google/ads/googleads/v8/errors/types/keyword_plan_error.py | 1 | 1758 | # -*- 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 |
halfcrazy/sqlalchemy | lib/sqlalchemy/event/base.py | 60 | 9540 | # event/base.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
"""Base implementation classes.
The public-facing ``Events`` serves as the base class... | mit |
TribeMedia/synapse | synapse/handlers/e2e_keys.py | 2 | 12592 | # -*- coding: utf-8 -*-
# Copyright 2016 OpenMarket Ltd
#
# 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 la... | apache-2.0 |
hoomanlogic/hoomancmd | hoomancmd/matchsuggestion.py | 1 | 17803 | ### score matched, proximity, missing, or nomatch to find the best fit command ###
# todo: Improve suggestion engine
# >> plns
# Did you mean 'logs'? : 97 : journal:90
# used by all versions
proximity_mapping = {
'q': ['a', 's', 'w', '2', '1', '`'],
'w': ['q', 'a', 's', 'd', 'e', '3', '2', '1'],
'e': ['w',... | apache-2.0 |
grilo/ansible-1 | lib/ansible/modules/source_control/gitlab_project.py | 30 | 14955 | #!/usr/bin/python
# (c) 2015, Werner Dijkerman (ikben@werner-dijkerman.nl)
# 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 |
woohgit/will | will/backends/io_adapters/base.py | 2 | 4742 | # -- coding: utf-8 -
from clint.textui import indent, puts
import datetime
import hashlib
import logging
from pytz import timezone as pytz_timezone
import signal
import time
import traceback
from will import settings
from will.utils import Bunch, show_valid, error, warn
from will.mixins import PubSubMixin, SleepMixin,... | mit |
dhamaniasad/mythbox | resources/lib/mysql-connector-python/mysql/connector/dbapi.py | 10 | 2069 | # MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2009,2010, Oracle and/or its affiliates. All rights reserved.
# Use is subject to license terms. (See COPYING)
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as publ... | gpl-2.0 |
OpenERPJeff/gooderp_addons | buy/wizard/buy_order_detail_wizard.py | 6 | 2758 | # -*- coding: utf-8 -*-
from datetime import date
from odoo import models, fields, api
from odoo.exceptions import UserError
class BuyOrderDetailWizard(models.TransientModel):
_name = 'buy.order.detail.wizard'
_description = u'采购明细表向导'
@api.model
def _default_date_start(self):
return self.en... | agpl-3.0 |
ArunMichaelDsouza/sass-foundations | node_modules/grunt-sass/node_modules/node-sass/node_modules/pangyp/gyp/pylib/gyp/xcode_ninja.py | 1789 | 10585 | # Copyright (c) 2014 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.
"""Xcode-ninja wrapper project file generator.
This updates the data structures passed to the Xcode gyp generator to build
with ninja instead. The Xcode project i... | mit |
rcharp/toyota-flask | numpy/numpy/lib/tests/test_polynomial.py | 32 | 4748 | from __future__ import division, absolute_import, print_function
'''
>>> p = np.poly1d([1.,2,3])
>>> p
poly1d([ 1., 2., 3.])
>>> print(p)
2
1 x + 2 x + 3
>>> q = np.poly1d([3.,2,1])
>>> q
poly1d([ 3., 2., 1.])
>>> print(q)
2
3 x + 2 x + 1
>>> print(np.poly1d([1.89999+2j, -3j, -5.12345678, 2+1j]))
... | apache-2.0 |
sensysnetworks/uClinux | user/python/Lib/distutils/command/install_scripts.py | 6 | 2104 | """distutils.command.install_scripts
Implements the Distutils 'install_scripts' command, for installing
Python scripts."""
# contributed by Bastian Kleineidam
__revision__ = "$Id: install_scripts.py,v 1.10 2000/09/30 18:27:54 gward Exp $"
import os
from distutils.core import Command
from stat import ST_MODE
class ... | gpl-2.0 |
unicri/edx-platform | openedx/core/djangoapps/profile_images/images.py | 84 | 5800 | """
Image file manipulation functions related to profile images.
"""
from cStringIO import StringIO
from django.conf import settings
from django.core.files.base import ContentFile
from django.utils.translation import ugettext as _, ugettext_noop as _noop
from PIL import Image
from openedx.core.djangoapps.user_api.acc... | agpl-3.0 |
marco-lancini/Showcase | django/contrib/gis/gdal/tests/test_ds.py | 137 | 10990 | import os
import unittest
from django.contrib.gis.gdal import DataSource, Envelope, OGRGeometry, OGRException, OGRIndexError, GDAL_VERSION
from django.contrib.gis.gdal.field import OFTReal, OFTInteger, OFTString
from django.contrib.gis.geometry.test_data import get_ds_file, TestDS, TEST_DATA
# List of acceptable data ... | mit |
pernici/sympy | sympy/series/tests/test_order.py | 1 | 6982 | from sympy import Symbol, Rational, Order, C, exp, ln, log, O, var, nan, pi, S
from sympy.utilities.pytest import XFAIL, raises
from sympy.abc import w, x, y, z
def test_caching_bug():
#needs to be a first test, so that all caches are clean
#cache it
e = O(w)
#and test that this won't raise an exceptio... | bsd-3-clause |
raycarnes/stock-logistics-warehouse | stock_reserve/model/stock_reserve.py | 9 | 6546 | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | agpl-3.0 |
johndpope/tensorflow | tensorflow/examples/tutorials/mnist/mnist_softmax.py | 73 | 2742 | # 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 |
mavit/ansible | lib/ansible/modules/cloud/rackspace/rax_queue.py | 102 | 3457 | #!/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': ['preview'],
... | gpl-3.0 |
lvdongr/spark | examples/src/main/python/mllib/latent_dirichlet_allocation_example.py | 128 | 2189 | #
# 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 |
undoware/neutron-drive | google_appengine/google/appengine/tools/bulkload_client.py | 20 | 8941 | #!/usr/bin/env python
#
# Copyright 2007 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | bsd-3-clause |
hargup/sympy | sympy/stats/frv.py | 11 | 10145 | """
Finite Discrete Random Variables Module
See Also
========
sympy.stats.frv_types
sympy.stats.rv
sympy.stats.crv
"""
from __future__ import print_function, division
from itertools import product
from sympy import (Basic, Symbol, cacheit, sympify, Mul,
And, Or, Tuple, Piecewise, Eq, Lambda)
from sympy.sets.... | bsd-3-clause |
mKeRix/home-assistant | homeassistant/components/somfy/switch.py | 9 | 1582 | """Support for Somfy Camera Shutter."""
from pymfy.api.devices.camera_protect import CameraProtect
from pymfy.api.devices.category import Category
from homeassistant.components.switch import SwitchEntity
from . import API, DEVICES, DOMAIN, SomfyEntity
async def async_setup_entry(hass, config_entry, async_add_entiti... | mit |
NejcZupec/ggrc-core | src/ggrc_basic_permissions/migrations/versions/20131204232542_eab1d38baee_help_permissions.py | 7 | 1916 | # Copyright (C) 2016 Google Inc.
# Licensed under http://www.apache.org/licenses/LICENSE-2.0 <see LICENSE file>
"""Help permissions
Revision ID: eab1d38baee
Revises: 54b6efd65a93
Create Date: 2013-12-04 23:25:42.313943
"""
# revision identifiers, used by Alembic.
revision = 'eab1d38baee'
down_revision = '54b6efd65... | apache-2.0 |
mwimble/ArduinoConroller | ewyn_ws/install/lib/python2.7/dist-packages/rosserial_python/SerialClient.py | 3 | 28546 | #!/usr/bin/env python
#####################################################################
# Software License Agreement (BSD License)
#
# Copyright (c) 2011, Willow Garage, Inc.
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that th... | gpl-2.0 |
apagac/robottelo-blrm | tests/foreman/cli/test_partitiontable.py | 2 | 6538 | # -*- encoding: utf-8 -*-
"""Test class for Partition table CLI"""
from robottelo.test import CLITestCase
from fauxfactory import gen_string, gen_alphanumeric
from robottelo.cli.factory import (
CLIFactoryError, make_partition_table, make_os)
from robottelo.cli.operatingsys import OperatingSys
from robottelo.cli.pa... | gpl-3.0 |
JeonginKim/TizenRT | external/iotivity/iotivity_1.2-rel/extlibs/gtest/gtest-1.7.0/test/gtest_break_on_failure_unittest.py | 2140 | 7339 | #!/usr/bin/env python
#
# Copyright 2006, 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... | apache-2.0 |
garrettcap/Bulletproof-Backup | wx/lib/embeddedimage.py | 3 | 2376 | #----------------------------------------------------------------------
# Name: wx.lib.embeddedimage
# Purpose: Defines a class used for embedding PNG images in Python
# code. The primary method of using this module is via
# the code generator in wx.tools.img2py.
#
# Author: An... | gpl-2.0 |
nadgowdas/cargo | cli/cargo.py | 1 | 2456 | #!/usr/bin/env python
#Copyright IBM Corporation 2015.
#LICENSE: Apache License 2.0 http://opensource.org/licenses/Apache-2.0
import os
import optparse
import logging
from voyage import *
def main():
usage = "usage: python %prog -f <config_file> {--list | --migrate --source <source> --container <container> --tar... | apache-2.0 |
komatits/specfem3d | EXAMPLES/CPML_examples/homogeneous_halfspace_HEX8_acoustic_elastic_absorbing_CPML_5sides/block_mesh-anisotropic.py | 52 | 2195 | #!/usr/bin/env python
import cubit
import boundary_definition
import cubit2specfem3d
import os
import sys
# two volumes separating 134000x134000x60000 block horizontally
cubit.cmd('reset')
cubit.cmd('brick x 67000 y 134000 z 60000')
cubit.cmd('volume 1 move x 33500 y 67000 z -30000')
cubit.cmd('brick x 67000 y 13400... | gpl-2.0 |
Nu3001/external_chromium_org | third_party/jinja2/utils.py | 113 | 18640 | # -*- coding: utf-8 -*-
"""
jinja2.utils
~~~~~~~~~~~~
Utility functions.
:copyright: (c) 2010 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import re
import sys
import errno
try:
from thread import allocate_lock
except ImportError:
from dummy_thread import allocate_lo... | bsd-3-clause |
BT-jmichaud/sale-workflow | sale_order_add_variants/wizard/sale_add_variants.py | 28 | 3550 | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Hugo Santos
# Copyright 2015 FactorLibre
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# published... | agpl-3.0 |
pratikmallya/hue | apps/oozie/src/oozie/utils.py | 10 | 5488 | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | apache-2.0 |
Ilphrin/TuxleTriad | Menu.py | 1 | 16142 | # coding: utf-8
import pygame
import os
import sys
import gettext
from functions import *
from color import *
from pygame.locals import *
from game import Application
from Sound import Sound
from Text import Text
from Buttons import Button
from listOfCards import *
from Card import Card
pygame.init()
class Menu(pyga... | mit |
mattilyra/gensim | docs/src/conf.py | 1 | 7457 | # -*- coding: utf-8 -*-
#
# gensim documentation build configuration file, created by
# sphinx-quickstart on Wed Mar 17 13:42:21 2010.
#
# This file is execfile()d with the current directory set to its containing dir.
#
# Note that not all possible configuration values are present in this
# autogenerated file.
#
# All ... | lgpl-2.1 |
talnoah/purple-flare | tools/perf/scripts/python/failed-syscalls-by-pid.py | 11180 | 2058 | # failed system call counts, by pid
# (c) 2010, Tom Zanussi <tzanussi@gmail.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Displays system-wide failed system call totals, broken down by pid.
# If a [comm] arg is specified, only syscalls called by [comm] are displayed.
import os
import sys
sys.pa... | gpl-2.0 |
renard/ansible | lib/ansible/plugins/doc_fragments/return_common.py | 35 | 1087 | # -*- coding: utf-8 -*-
# Copyright: (c) 2016, Ansible, Inc
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
class ModuleDocFragment(object):
# Standard documentation fragment
R... | gpl-3.0 |
Dany3R9/ns-3-dev-ndnSIM | src/mesh/bindings/modulegen__gcc_ILP32.py | 5 | 691136 | from pybindgen import Module, FileCodeSink, param, retval, cppclass, typehandlers
import pybindgen.settings
import warnings
class ErrorHandler(pybindgen.settings.ErrorHandler):
def handle_error(self, wrapper, exception, traceback_):
warnings.warn("exception %r in wrapper %s" % (exception, wrapper))
... | gpl-2.0 |
kisna72/django | django/test/client.py | 70 | 26639 | from __future__ import unicode_literals
import json
import mimetypes
import os
import re
import sys
from copy import copy
from importlib import import_module
from io import BytesIO
from django.apps import apps
from django.conf import settings
from django.core import urlresolvers
from django.core.handlers.base import ... | bsd-3-clause |
hxddh/youtube-dl | youtube_dl/extractor/espn.py | 106 | 1940 | from __future__ import unicode_literals
from .common import InfoExtractor
class ESPNIE(InfoExtractor):
_VALID_URL = r'https?://espn\.go\.com/(?:[^/]+/)*(?P<id>[^/]+)'
_WORKING = False
_TESTS = [{
'url': 'http://espn.go.com/video/clip?id=10365079',
'info_dict': {
'id': 'FkYWtma... | unlicense |
matham/cutils | cutils/knspace.py | 1 | 15278 | '''Provides namespace functionality for Kivy objects. It allows kivy objects
to be named and then accessed using the namespace.
:class:`KNSpace` instances are the namespaces that store the named objects.
Classes need to inherit from :class:`KNSpaceBehavior` so that the class, when
named, will be stored in the namespac... | mit |
Kagee/youtube-dl | devscripts/check-porn.py | 6 | 1915 | #!/usr/bin/env python
from __future__ import unicode_literals
"""
This script employs a VERY basic heuristic ('porn' in webpage.lower()) to check
if we are not 'age_limit' tagging some porn site
A second approach implemented relies on a list of porn domains, to activate it
pass the list filename as the only argument
... | unlicense |
mpasternak/pyglet-fix-issue-518-522 | examples/window_platform_event.py | 33 | 3351 | #!/usr/bin/env python
# ----------------------------------------------------------------------------
# pyglet
# Copyright (c) 2006-2008 Alex Holkner
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions
# are ... | bsd-3-clause |
dmsimard/ansible | lib/ansible/plugins/lookup/password.py | 5 | 14487 | # (c) 2012, Daniel Hokka Zakrisson <daniel@hozac.com>
# (c) 2013, Javier Candeira <javier@candeira.com>
# (c) 2013, Maykel Moya <mmoya@speedyrails.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, divisio... | gpl-3.0 |
baroquebobcat/pants | src/python/pants/option/optionable.py | 2 | 3736 | # coding=utf-8
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).
from __future__ import (absolute_import, division, generators, nested_scopes, print_function,
unicode_literals, with_statement)
import re
from six ... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.