repo_name stringlengths 5 100 | path stringlengths 4 375 | copies stringclasses 991
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
diwu/Tiny-Wings-Remake-on-Android | twxes10/libs/cocos2dx/platform/third_party/marmalade/freetype/src/tools/docmaker/utils.py | 515 | 3063 | # Utils (c) 2002, 2004, 2007, 2008 David Turner <david@freetype.org>
#
import string, sys, os, glob
# current output directory
#
output_dir = None
# This function is used to sort the index. It is a simple lexicographical
# sort, except that it places capital letters before lowercase ones.
#
def index_sort( s1, ... | mit |
elpaso/QGIS | tests/src/python/test_qgsnewgeopackagelayerdialog.py | 30 | 12224 | # -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsNewGeoPackageLayerDialog
.. note:: 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 ver... | gpl-2.0 |
mwrightevent38/MissionPlanner | Lib/encodings/mac_roman.py | 93 | 14043 | """ Python Character Mapping Codec mac_roman generated from 'MAPPINGS/VENDORS/APPLE/ROMAN.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(s... | gpl-3.0 |
shishengjia/OnlineCourses | extra_apps/xadmin/plugins/export.py | 9 | 9492 | import StringIO
import datetime
import sys
from django.http import HttpResponse
from django.template import loader
from django.utils.encoding import force_unicode, smart_unicode
from django.utils.html import escape
from django.utils.translation import ugettext as _
from django.utils.xmlutils import SimplerXMLGenerator... | apache-2.0 |
compiteing/flask-ponypermission | venv/lib/python2.7/site-packages/pony/orm/tests/test_declarative_date.py | 2 | 2238 | from __future__ import absolute_import, print_function, division
import unittest
from datetime import date, datetime
from pony.orm.core import *
from pony.orm.tests.testutils import *
db = Database('sqlite', ':memory:')
class Entity1(db.Entity):
a = PrimaryKey(int)
b = Required(date)
c = Required(da... | mit |
uncled1023/pygments | Pygments/pygments-lib/pygments/lexers/automation.py | 37 | 19648 | # -*- coding: utf-8 -*-
"""
pygments.lexers.automation
~~~~~~~~~~~~~~~~~~~~~~~~~~
Lexers for automation scripting languages.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.lexer import RegexLexer, include, bygroups, com... | bsd-2-clause |
janocat/odoo | addons/hr_payroll/hr_payroll.py | 144 | 49776 | #-*- coding:utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 Tiny SPRL (<http://tiny.be>). All Rights Reserved
# d$
#
# This program is free software: you can redistribute it and/or modify
# it ... | agpl-3.0 |
simplegeo/hadoop | src/contrib/failmon/bin/scheduler.py | 118 | 6683 | #!/usr/bin/python
# 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
# "Licen... | apache-2.0 |
lofaldli/satellite-tracker | test/test_utils.py | 1 | 1421 | import unittest
import ephem
from datetime import datetime
from tracker import utils
class TestGrid(unittest.TestCase):
def test_valid_grid(self):
valid_grid = utils.valid_grid
self.assertTrue(valid_grid('EL'))
self.assertTrue(valid_grid('EL98'))
self.assertTrue(valid_grid('EL98qo... | mit |
robin-lai/scikit-learn | sklearn/neural_network/rbm.py | 206 | 12292 | """Restricted Boltzmann Machine
"""
# Authors: Yann N. Dauphin <dauphiya@iro.umontreal.ca>
# Vlad Niculae
# Gabriel Synnaeve
# Lars Buitinck
# License: BSD 3 clause
import time
import numpy as np
import scipy.sparse as sp
from ..base import BaseEstimator
from ..base import TransformerMixi... | bsd-3-clause |
XXLRay/libreshot | libreshot/uploads/youtube/gdata/tlslite/integration/HTTPTLSConnection.py | 271 | 6668 | """TLS Lite + httplib."""
import socket
import httplib
from gdata.tlslite.TLSConnection import TLSConnection
from gdata.tlslite.integration.ClientHelper import ClientHelper
class HTTPBaseTLSConnection(httplib.HTTPConnection):
"""This abstract class provides a framework for adding TLS support
to httplib."""
... | gpl-3.0 |
fogbow/nova-qemu-win-driver | qemuwin/config.py | 8 | 42929 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright (C) 2012-2013 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENS... | apache-2.0 |
antonve/s4-project-mooc | common/djangoapps/student/migrations/0029_remove_pearson.py | 114 | 15164 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Deleting model 'TestCenterUser'
db.delete_table('student_testcenteruser')
# Deleting model 'TestC... | agpl-3.0 |
android-ia/platform_external_chromium_org_third_party_WebKit | Tools/Scripts/webkitpy/style/checker_unittest.py | 48 | 32167 | # -*- coding: utf-8; -*-
#
# Copyright (C) 2009 Google Inc. All rights reserved.
# Copyright (C) 2009 Torch Mobile Inc.
# Copyright (C) 2009 Apple Inc. All rights reserved.
# Copyright (C) 2010 Chris Jerdonek (chris.jerdonek@gmail.com)
#
# Redistribution and use in source and binary forms, with or without
# modificatio... | bsd-3-clause |
florentchandelier/zipline | tests/pipeline/test_classifier.py | 2 | 17221 | from functools import reduce
from operator import or_
import numpy as np
import pandas as pd
from zipline.lib.labelarray import LabelArray
from zipline.pipeline import Classifier
from zipline.testing import parameter_space
from zipline.testing.fixtures import ZiplineTestCase
from zipline.testing.predicates import ass... | apache-2.0 |
yury-s/v8-inspector | Source/chrome/tools/perf/page_sets/tough_image_cases.py | 20 | 1041 | # Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
from telemetry.page import page as page_module
from telemetry.page import page_set as page_set_module
class ToughImageCasesPage(page_module.Page):
def __... | bsd-3-clause |
MatthewDooler/tubesim | scripts/tubedata/set-platform-levels.py | 1 | 2046 | #!/usr/bin/env python
import requests
import json
def find_link(link, links):
return [element for element in links if element['line'] == link['line'] and element['to'] == link['to']]
def find_station(station, stations):
return [element for element in stations if element['atcocode'] == station['atcocode']]
de... | gpl-2.0 |
renanrodm/namebench | nb_third_party/dns/ttl.py | 248 | 2180 | # Copyright (C) 2003-2007, 2009, 2010 Nominum, Inc.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose with or without fee is hereby granted,
# provided that the above copyright notice and this permission notice
# appear in all copies.
#
# THE SOFTWARE IS PROVIDED ... | apache-2.0 |
wonder-sk/QGIS | python/plugins/processing/algs/grass7/ext/r_li_dominance_ascii.py | 7 | 1429 | # -*- coding: utf-8 -*-
"""
***************************************************************************
r_li_dominance_ascii.py
-----------------------
Date : February 2016
Copyright : (C) 2016 by Médéric Ribreux
Email : medspx at medspx dot fr
************... | gpl-2.0 |
alubbock/pysb | pysb/tests/test_simulator_scipy.py | 5 | 19613 | from pysb.testing import *
import sys
import copy
import numpy as np
from pysb import Monomer, Parameter, Initial, Observable, Rule, Expression
from pysb.simulator import ScipyOdeSimulator, InconsistentParameterError
from pysb.simulator.scipyode import CythonRhsBuilder
from pysb.examples import robertson, earm_1_0, tys... | bsd-2-clause |
paweljasinski/ironpython3 | Src/StdLib/Lib/_bootlocale.py | 168 | 1301 | """A minimal subset of the locale module used at interpreter startup
(imported by the _io module), in order to reduce startup time.
Don't import directly from third-party code; use the `locale` module instead!
"""
import sys
import _locale
if sys.platform.startswith("win"):
def getpreferredencoding(do_setlocale=... | apache-2.0 |
x2nie/odoo | addons/website_blog/wizard/document_page_show_diff.py | 372 | 2184 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
ntt-sic/nova | nova/tests/integrated/v3/test_consoles.py | 5 | 2268 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, Inc.
# Copyright 2013 IBM Corp.
#
# 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... | apache-2.0 |
jmvrbanac/symantecssl | tests/unit/test_datastructures.py | 1 | 3186 | from __future__ import absolute_import, division, print_function
import pytest
from symantecssl.datastructures import CaseInsensitiveDict
class TestCaseInsensitiveDict:
@pytest.mark.parametrize(("initial", "expected"), [
({"a": "b"}, {"a": "b"}),
(None, {}),
])
def test_initial_data(sel... | apache-2.0 |
SonyCSL/CSLAIER | src/deeplearning/train/train_imagenet.py | 1 | 32793 | # -*- coding: utf-8 -*-
from __future__ import print_function
import datetime
import json
import random
import multiprocessing
import threading
import time
import imp
import re
import os
import shutil
import math
from logging import getLogger
import numpy as np
from PIL import Image
import six
import cPickle as pickle... | mit |
sbalde/edxplatform | lms/djangoapps/notes/views.py | 142 | 1741 | """
Views to support the edX Notes feature.
"""
from django.conf import settings
from django.contrib.auth.decorators import login_required
from django.http import Http404
from edxmako.shortcuts import render_to_response
from opaque_keys.edx.locations import SlashSeparatedCourseKey
from courseware.courses import get_c... | agpl-3.0 |
emarinizquierdo/xentinels | markupsafe/tests.py | 674 | 6107 | # -*- coding: utf-8 -*-
import gc
import sys
import unittest
from markupsafe import Markup, escape, escape_silent
from markupsafe._compat import text_type
class MarkupTestCase(unittest.TestCase):
def test_adding(self):
# adding two strings should escape the unsafe one
unsafe = '<script type="appl... | apache-2.0 |
crakensio/django_training | lib/python2.7/site-packages/django/contrib/gis/gdal/prototypes/errcheck.py | 219 | 4257 | """
This module houses the error-checking routines used by the GDAL
ctypes prototypes.
"""
from ctypes import c_void_p, string_at
from django.contrib.gis.gdal.error import check_err, OGRException, SRSException
from django.contrib.gis.gdal.libgdal import lgdal
from django.utils import six
# Helper routines for retrie... | cc0-1.0 |
uingei/mm | interactivemode.py | 18 | 1385 | # Eloipool - Python Bitcoin pool server
# Copyright (C) 2011-2012 Luke Dashjr <luke-jr+eloipool@utopios.org>
#
# 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 by the Free Software Foundation, either version 3 of the
# L... | agpl-3.0 |
gsnbng/erpnext | erpnext/regional/report/hsn_wise_summary_of_outward_supplies/hsn_wise_summary_of_outward_supplies.py | 7 | 6580 | # Copyright (c) 2016, Frappe Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe, erpnext
from frappe import _
from frappe.utils import flt
from frappe.model.meta import get_field_precision
from frappe.utils.xlsxutils i... | agpl-3.0 |
vivekanand1101/neutron | neutron/tests/unit/ipam/fake_driver.py | 38 | 1074 | # Copyright (c) 2015 Infoblox 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 require... | apache-2.0 |
tempesta-tech/mariadb_10.2 | storage/tokudb/mysql-test/tokudb/t/fast_update_blobs.py | 73 | 1798 | #!/usr/bin/env python
import sys
import random
import string
def main():
print "# generated by tokudb_fast_update_blobs.py"
print "source include/have_tokudb.inc;"
print "source include/have_innodb.inc;"
print "set default_storage_engine='tokudb';"
print "disable_warnings;"
print "drop table i... | gpl-2.0 |
tornadozou/tensorflow | tensorflow/contrib/tensor_forest/client/__init__.py | 164 | 1043 | # 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 |
dl1ksv/gnuradio | gr-uhd/apps/msgq_runner.py | 6 | 1853 | #
# Copyright 2009 Free Software Foundation, Inc.
#
# This file is part of GNU Radio
#
# SPDX-License-Identifier: GPL-3.0-or-later
#
#
"""
Convenience class for dequeuing messages from a gr.msg_queue and
invoking a callback.
Creates a Python thread that does a blocking read on the supplied
gr.msg_queue, then invokes ... | gpl-3.0 |
0verchenko/Addressbook | fixture/contact.py | 1 | 3161 | from model.contact import Contact
import re
class ContactHelper:
def __init__(self, app):
self.app = app
def change_field_value(self, field_name, text):
wd = self.app.wd
if text is not None:
wd.find_element_by_name(field_name).click()
wd.find_element_by_name(fi... | apache-2.0 |
beeftornado/sentry | src/sentry/migrations/0042_auto_20200214_1607.py | 1 | 1559 | # -*- coding: utf-8 -*-
# Generated by Django 1.11.28 on 2020-02-14 16:07
from __future__ import unicode_literals
from django.db import migrations, models
import django.utils.timezone
class Migration(migrations.Migration):
# This flag is used to mark that a migration shouldn't be automatically run in
# produ... | bsd-3-clause |
mith1979/ansible_automation | applied_python/applied_python/lib/python2.7/site-packages/jinja2/_stringdefs.py | 990 | 404291 | # -*- coding: utf-8 -*-
"""
jinja2._stringdefs
~~~~~~~~~~~~~~~~~~
Strings of all Unicode characters of a certain category.
Used for matching in Unicode-aware languages. Run to regenerate.
Inspired by chartypes_create.py from the MoinMoin project, original
implementation from Pygments.
:co... | apache-2.0 |
caisq/tensorflow | tensorflow/python/kernel_tests/string_strip_op_test.py | 16 | 1981 | # 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 |
dulems/hue | desktop/core/ext-py/Django-1.6.10/tests/template_tests/test_unicode.py | 110 | 1369 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.template import Template, TemplateEncodingError, Context
from django.utils.safestring import SafeData
from django.utils import six
from django.utils.unittest import TestCase
class UnicodeTests(TestCase):
def test_template(self):
... | apache-2.0 |
EvanK/ansible | test/integration/targets/aws_lambda/files/mini_lambda.py | 139 | 1237 | from __future__ import print_function
import json
import os
def handler(event, context):
"""
The handler function is the function which gets called each time
the lambda is run.
"""
# printing goes to the cloudwatch log allowing us to simply debug the lambda if we can find
# the log entry.
... | gpl-3.0 |
stuartpb/synergy-upstream | tools/gtest-1.6.0/test/gtest_xml_output_unittest.py | 397 | 11279 | #!/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... | gpl-2.0 |
ahmadio/edx-platform | common/djangoapps/third_party_auth/tests/test_pipeline_integration.py | 105 | 9962 | """Integration tests for pipeline.py."""
import unittest
from django.conf import settings
from django import test
from django.contrib.auth import models
from third_party_auth import pipeline, provider
from third_party_auth.tests import testutil
from social.apps.django_app.default import models as social_models
# G... | agpl-3.0 |
gengliangwang/spark | python/pyspark/pandas/internal.py | 1 | 57972 | #
# 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 |
calvinda/ui_library | sass-startkit/node_modules/node-gyp/gyp/pylib/gyp/MSVSUserFile.py | 2710 | 5094 | # Copyright (c) 2012 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.
"""Visual Studio user preferences file writer."""
import os
import re
import socket # for gethostname
import gyp.common
import gyp.easy_xml as easy_xml
#------... | mit |
dhamaniasad/flask-elasticsearch | views.py | 1 | 2143 | from app import app, db
from flask import render_template, request, url_for, redirect
from forms import CreateForm, CommentForm
from models import Post, Comment
@app.route('/')
def homepage():
posts = Post.query.all()
return render_template('list.html', posts=posts)
@app.route('/create', methods=['GET'])
de... | unlicense |
dqnykamp/sympy | sympy/abc.py | 30 | 1877 | from __future__ import print_function, division
import string
from .core import Symbol
from .core.alphabets import greeks
from .core.compatibility import exec_
_latin = list(string.ascii_letters)
# COSINEQ should not be imported as they clash; gamma, pi and zeta clash, too
_greek = list(greeks) # make a copy, so we ... | bsd-3-clause |
dhimmel/networkx | networkx/generators/expanders.py | 47 | 4522 | # -*- coding: utf-8 -*-
# Copyright 2014 "cheebee7i".
# Copyright 2014 "alexbrc".
# Copyright 2014 Jeffrey Finkelstein <jeffrey.finkelstein@gmail.com>.
"""Provides explicit constructions of expander graphs.
"""
import itertools
import networkx as nx
__all__ = ['margulis_gabber_galil_graph', 'chordal_cycle_graph']
#... | bsd-3-clause |
ammaradil/fibonacci | Lib/site-packages/django/utils/feedgenerator.py | 42 | 17789 | """
Syndication feed generation library -- used for generating RSS, etc.
Sample usage:
>>> from django.utils import feedgenerator
>>> feed = feedgenerator.Rss201rev2Feed(
... title="Poynter E-Media Tidbits",
... link="http://www.poynter.org/column.asp?id=31",
... description="A group Weblog by the sharpes... | mit |
framewr/clowder_server | clowder_server/management/commands/send_alerts.py | 1 | 1446 | import datetime
from django.core.management.base import BaseCommand, CommandError
from clowder_account.models import Company
from clowder_server.emailer import send_alert
from clowder_server.models import Alert, Ping
class Command(BaseCommand):
help = 'Checks and sends alerts'
def handle(self, *args, **opti... | agpl-3.0 |
darongliu/Lstm_Turing_LM_tf | exp_model_composition/fix/lstm+attention_fix+pretrained+entropy/model.py | 1 | 7420 | import tensorflow as tf
import numpy
def inference(input_x, embedding_dim, lstm_hidden_dim_1, vocab_size,
lstm_hidden_dim_2=None, dropout=None, window_size=5) :
"""
Args:
input_x: 2D tensor batch_size X time_step
embedding_dim: embedding dimension
lstm_hidden_dim_1: the dimension of... | mit |
rooneykev/testAngular | js/bower_components/jasmine/lib/jasmine-core/core.py | 163 | 1481 | import pkg_resources
try:
from collections import OrderedDict
except ImportError:
from ordereddict import OrderedDict
class Core(object):
@classmethod
def js_package(cls):
return __package__
@classmethod
def css_package(cls):
return __package__
@classmethod
def image_... | mit |
Dandandan/wikiprogramming | jsrepl/build/extern/python/reloop-closured/lib/python2.7/encodings/mac_greek.py | 593 | 13977 | """ Python Character Mapping Codec mac_greek generated from 'MAPPINGS/VENDORS/APPLE/GREEK.TXT' with gencodec.py.
"""#"
import codecs
### Codec APIs
class Codec(codecs.Codec):
def encode(self,input,errors='strict'):
return codecs.charmap_encode(input,errors,encoding_table)
def decode(self,input,err... | mit |
gdub/django | django/middleware/clickjacking.py | 87 | 1988 | """
Clickjacking Protection Middleware.
This module provides a middleware that implements protection against a
malicious site loading resources from your site in a hidden frame.
"""
from django.conf import settings
class XFrameOptionsMiddleware(object):
"""
Middleware that sets the X-Frame-Options HTTP head... | bsd-3-clause |
jabesq/home-assistant | homeassistant/components/owlet/binary_sensor.py | 8 | 2346 | """Support for Owlet binary sensors."""
from datetime import timedelta
from homeassistant.components.binary_sensor import BinarySensorDevice
from homeassistant.util import dt as dt_util
from . import DOMAIN as OWLET_DOMAIN
from .const import SENSOR_BASE_STATION, SENSOR_MOVEMENT
SCAN_INTERVAL = timedelta(seconds=120)... | apache-2.0 |
ThiefMaster/jinja2 | tests/test_loader.py | 4 | 8771 | # -*- coding: utf-8 -*-
"""
jinja2.testsuite.loader
~~~~~~~~~~~~~~~~~~~~~~~
Test the loaders.
:copyright: (c) 2017 by the Jinja Team.
:license: BSD, see LICENSE for more details.
"""
import os
import sys
import tempfile
import shutil
import pytest
import weakref
from jinja2 import Environment, lo... | bsd-3-clause |
ionelmc/django-prefetch | tests/test_app/models.py | 1 | 4885 | from django.db import models
from prefetch import Prefetcher
from prefetch import PrefetchManager
class SillyException(Exception):
pass
class SillyPrefetcher(Prefetcher):
def filter(ids):
raise SillyException()
def reverse_mapper(book):
raise SillyException()
def decorator(author,... | bsd-2-clause |
agudpp/tag-linker | lib/googletest/googlemock/scripts/generator/cpp/gmock_class_test.py | 69 | 11712 | #!/usr/bin/env python
#
# Copyright 2009 Neal Norwitz All Rights Reserved.
# Portions Copyright 2009 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
#
# ... | mit |
samplifyio/samslacker-python | samslacker/api_requestor.py | 1 | 1710 | from urllib import parse
import requests
import samslacker
from samslacker import version
def build_api_url(url, query):
scheme, netloc, path, base_query, fragment = parse.urlsplit(url)
if base_query:
query = '%s&%s' % (base_query, query)
return parse.urlunsplit((scheme, netloc, path, query, f... | mit |
Danisan/odoo-1 | addons/product_margin/wizard/__init__.py | 444 | 1078 | # -*- 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 |
edmundgentle/schoolscript | SchoolScript/bin/Debug/pythonlib/Lib/test/json_tests/test_recursion.py | 3 | 3107 | from test.json_tests import PyTest, CTest
class JSONTestObject:
pass
class TestRecursion:
def test_listrecursion(self):
x = []
x.append(x)
try:
self.dumps(x)
except ValueError:
pass
else:
self.fail("didn't raise Valu... | gpl-2.0 |
stratosgear/eve | docs/_themes/flask_theme_support.py | 2228 | 4875 | # flasky extensions. flasky pygments style based on tango style
from pygments.style import Style
from pygments.token import Keyword, Name, Comment, String, Error, \
Number, Operator, Generic, Whitespace, Punctuation, Other, Literal
class FlaskyStyle(Style):
background_color = "#f8f8f8"
default_style = "... | bsd-3-clause |
ry/tensorflow-resnet | config.py | 3 | 2852 | # This is a variable scope aware configuation object for TensorFlow
import tensorflow as tf
FLAGS = tf.app.flags.FLAGS
class Config:
def __init__(self):
root = self.Scope('')
for k, v in FLAGS.__dict__['__flags'].iteritems():
root[k] = v
self.stack = [ root ]
def iteritem... | mit |
chjw8016/GreenOdoo7-haibao | openerp/addons/auth_signup/res_config.py | 445 | 2860 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2012-today OpenERP SA (<http://www.openerp.com>)
#
# This program is free software: you can redistribute it and/or modify
# it under the terms o... | mit |
sourabhdattawad/django-material | tests/settings.py | 10 | 3756 | import os
import sys
BASE_DIR = os.path.dirname(os.path.dirname(__file__))
# Quick-start development settings - unsuitable for production
# See https://docs.djangoproject.com/en/1.7/howto/deployment/checklist/
# SECURITY WARNING: keep the secret key used in production secret!
SECRET_KEY = 'fn4_(9z4f8w+3!&(j2x88^ca0m0... | bsd-3-clause |
vtolstov/libvirt | docs/apibuild.py | 11 | 101892 | #!/usr/bin/python -u
#
# This is the API builder, it parses the C sources and build the
# API formal description in XML.
#
# See Copyright for the status of this software.
#
# daniel@veillard.com
#
import os, sys
import string
import glob
import re
quiet=True
warnings=0
debug=False
debugsym=None
#
# C parser analysis... | gpl-2.0 |
rsteca/python-social-auth | social/pipeline/mail.py | 77 | 1163 | from social.exceptions import InvalidEmail
from social.pipeline.partial import partial
@partial
def mail_validation(backend, details, is_new=False, *args, **kwargs):
requires_validation = backend.REQUIRES_EMAIL_VALIDATION or \
backend.setting('FORCE_EMAIL_VALIDATION', False)
send_val... | bsd-3-clause |
icoxfog417/enigma_abroad | application/models/spot.py | 1 | 5495 | from collections import namedtuple
from pola.candidate import Candidate
from pola.machine.topic_model.document import Document
class Item():
def __init__(self, code, name, name_en=""):
self.code = code
self.name = name
self.name_en = name_en
@classmethod
def deserialize(cls, seri... | mit |
nouiz/pydy | pydy/viz/tests/test_socket_server.py | 1 | 1181 | #This module is exclusively for testing Socket connections.
import os
import socket
from ..server import Server
class TestSocketServer(object):
def __init__(self):
self.host = 'localhost'
self.server = Server()
def test_req1(self):
#We connect to a client socket, and
#send s... | bsd-3-clause |
liu602348184/django | tests/select_related_onetoone/models.py | 166 | 2386 | from django.db import models
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class User(models.Model):
username = models.CharField(max_length=100)
email = models.EmailField()
def __str__(self):
return self.username
@python_2_unicode_compatible
class Us... | bsd-3-clause |
ktbs/ktbs | lib/ktbs/serpar/jsonld_parser.py | 1 | 9919 | # -*- coding: utf-8 -*-
# This file is part of KTBS <http://liris.cnrs.fr/sbt-dev/ktbs>
# Copyright (C) 2011-2012 Pierre-Antoine Champin <pchampin@liris.cnrs.fr> /
# Françoise Conil <francoise.conil@liris.cnrs.fr> /
# Universite de Lyon <http://www.universite-lyon.fr>
#
# KTBS is free software: you can ... | lgpl-3.0 |
shaistaansari/django | django/templatetags/cache.py | 471 | 3389 | from __future__ import unicode_literals
from django.core.cache import InvalidCacheBackendError, caches
from django.core.cache.utils import make_template_fragment_key
from django.template import (
Library, Node, TemplateSyntaxError, VariableDoesNotExist,
)
register = Library()
class CacheNode(Node):
def __in... | bsd-3-clause |
lidavidm/sympy | sympy/physics/quantum/tests/test_printing.py | 7 | 29985 | # -*- encoding: utf-8 -*-
"""
TODO:
* Address Issue 2251, printing of spin states
"""
from sympy.physics.quantum.anticommutator import AntiCommutator
from sympy.physics.quantum.cg import CG, Wigner3j, Wigner6j, Wigner9j
from sympy.physics.quantum.commutator import Commutator
from sympy.physics.quantum.constants import ... | bsd-3-clause |
slevenhagen/odoo | addons/account_followup/wizard/account_followup_print.py | 217 | 16379 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
yufengg/tensorflow | tensorflow/contrib/specs/python/params_ops.py | 186 | 3104 | # 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 applicable ... | apache-2.0 |
tzhaoredhat/automation | tests/check_api_doc.py | 6 | 1037 | #
# Copyright (c) 2015 Red Hat
# Licensed under The MIT License (MIT)
# http://opensource.org/licenses/MIT
#
"""
Checks for automatic documentation generators. It verifies no errors are
logged.
This test should not be part of main test suite as it will run pretty much all
viewsets without checking anything but the doc... | mit |
allotria/intellij-community | plugins/hg4idea/testData/bin/hgext/inotify/linux/watcher.py | 92 | 10504 | # watcher.py - high-level interfaces to the Linux inotify subsystem
# Copyright 2006 Bryan O'Sullivan <bos@serpentine.com>
# 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, or any later version.
'''High-level interfa... | apache-2.0 |
40223229/2015cd_midterm2 | static/Brython3.1.1-20150328-091302/Lib/logging/config.py | 739 | 35619 | # Copyright 2001-2013 by Vinay Sajip. All Rights Reserved.
#
# Permission to use, copy, modify, and distribute this software and its
# documentation for any purpose and without fee is hereby granted,
# provided that the above copyright notice appear in all copies and that
# both that copyright notice and this permissio... | gpl-2.0 |
spennihana/h2o-3 | h2o-py/tests/testdir_misc/pyunit_mojo_predict.py | 1 | 10966 | import sys
import tempfile
import shutil
import time
import os
import pandas
sys.path.insert(1, "../../")
import h2o
import h2o.utils.shared_utils as h2o_utils
from tests import pyunit_utils
from h2o.estimators.gbm import H2OGradientBoostingEstimator
genmodel_name = "h2o-genmodel.jar"
def download_mojo(model, moj... | apache-2.0 |
virlos/virl-salt | openstack/nova/files/kilo/exception.py | 2 | 54214 | # Copyright 2010 United States Government as represented by the
# Administrator of the National Aeronautics and Space Administration.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a ... | gpl-2.0 |
singingwolfboy/oauthlib | oauthlib/oauth2/rfc6749/grant_types/resource_owner_password_credentials.py | 35 | 8389 | # -*- coding: utf-8 -*-
"""
oauthlib.oauth2.rfc6749.grant_types
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
"""
from __future__ import unicode_literals, absolute_import
import json
import logging
from .base import GrantTypeBase
from .. import errors
from ..request_validator import RequestValidator
log = logging.getLogger(_... | bsd-3-clause |
rooshilp/CMPUT410Lab6 | virt_env/virt1/lib/python2.7/site-packages/django/contrib/messages/tests/base.py | 63 | 14509 | from unittest import skipUnless
from django import http
from django.apps import apps
from django.conf import global_settings
from django.contrib.messages import constants, utils, get_level, set_level
from django.contrib.messages.api import MessageFailure
from django.contrib.messages.constants import DEFAULT_LEVELS
fro... | apache-2.0 |
sherlockcoin/Electrum-NavCoin | lib/interface.py | 1 | 12947 | #!/usr/bin/env python
#
# Electrum - lightweight NavCoin client
# Copyright (C) 2011 thomasv@gitorious
#
# 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 witho... | mit |
mcrowson/django | django/utils/translation/__init__.py | 165 | 7180 | """
Internationalization support.
"""
from __future__ import unicode_literals
import re
from django.utils import six
from django.utils.decorators import ContextDecorator
from django.utils.encoding import force_text
from django.utils.functional import lazy
__all__ = [
'activate', 'deactivate', 'override', 'deacti... | bsd-3-clause |
FireWRT/OpenWrt-Firefly-Libraries | staging_dir/host/lib/python3.4/distutils/tests/test_dir_util.py | 106 | 4654 | """Tests for distutils.dir_util."""
import unittest
import os
import stat
import sys
from unittest.mock import patch
from distutils import dir_util, errors
from distutils.dir_util import (mkpath, remove_tree, create_tree, copy_tree,
ensure_relative)
from distutils import log
from distu... | gpl-2.0 |
timvandermeij/servo | tests/wpt/web-platform-tests/tools/pytest/testing/test_parseopt.py | 171 | 12294 | from __future__ import with_statement
import sys
import os
import py, pytest
from _pytest import config as parseopt
@pytest.fixture
def parser():
return parseopt.Parser()
class TestParser:
def test_no_help_by_default(self, capsys):
parser = parseopt.Parser(usage="xyz")
pytest.raises(SystemExit... | mpl-2.0 |
wanglongqi/sympy | sympy/physics/unitsystems/quantities.py | 91 | 4468 | # -*- coding: utf-8 -*-
"""
Physical quantities.
"""
from __future__ import division
import numbers
from sympy import sympify, Expr, Number, Mul, Pow
from .units import Unit
#TODO: in operations, interpret a Unit as a quantity with factor 1
class Quantity(Expr):
"""
Physical quantity.
A quantity is d... | bsd-3-clause |
taotie12010/bigfour | common/lib/xmodule/xmodule/lti_module.py | 51 | 37480 | """
Learning Tools Interoperability (LTI) module.
Resources
---------
Theoretical background and detailed specifications of LTI can be found on:
http://www.imsglobal.org/LTI/v1p1p1/ltiIMGv1p1p1.html
This module is based on the version 1.1.1 of the LTI specifications by the
IMS Global authority. For authenticat... | agpl-3.0 |
concentricsky/django-allauth | allauth/socialaccount/providers/soundcloud/tests.py | 71 | 1343 | from allauth.socialaccount.tests import create_oauth2_tests
from allauth.tests import MockedResponse
from allauth.socialaccount.providers import registry
from .provider import SoundCloudProvider
class SoundCloudTests(create_oauth2_tests(registry.by_id(SoundCloudProvider.id))):
def get_mocked_response(self):
... | mit |
qiankunshe/sky_engine | third_party/android_testrunner/errors.py | 171 | 1340 | #!/usr/bin/python2.4
#
#
# Copyright 2008, The Android Open Source Project
#
# 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 requir... | bsd-3-clause |
ChanChiChoi/scikit-learn | sklearn/cluster/k_means_.py | 128 | 54694 | """K-means clustering"""
# Authors: Gael Varoquaux <gael.varoquaux@normalesup.org>
# Thomas Rueckstiess <ruecksti@in.tum.de>
# James Bergstra <james.bergstra@umontreal.ca>
# Jan Schlueter <scikit-learn@jan-schlueter.de>
# Nelle Varoquaux
# Peter Prettenhofer <peter.prettenh... | bsd-3-clause |
sternshus/arelle2.7 | svr-2.7/arelle/plugin/xbrlDB/XbrlSemanticRdfDB - orig.py | 1 | 54000 | '''
XbrlSemanticRDFDB.py implements an RDF database interface for Arelle, based
on a concrete realization of the Abstract Model PWD 2.0 layer. This is a semantic
representation of XBRL information.
This module may save directly to a NanoSparqlServer or to append to a file of RDF Turtle.
See http://sourceforge... | apache-2.0 |
HEG-Arc/Appagoo | appagoo/allauth/socialaccount/providers/instagram/provider.py | 75 | 1150 | from allauth.socialaccount import providers
from allauth.socialaccount.providers.base import ProviderAccount
from allauth.socialaccount.providers.oauth2.provider import OAuth2Provider
class InstagramAccount(ProviderAccount):
PROFILE_URL = 'http://instagram.com/'
def get_profile_url(self):
return sel... | bsd-3-clause |
fooelisa/ansible-modules-extras | network/dnsimple.py | 3 | 11731 | #!/usr/bin/python
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distributed... | gpl-3.0 |
PyCon/pycon | pycon/sponsorship/migrations/0019_auto_20180723_1655.py | 1 | 2318 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import migrations, models
class Migration(migrations.Migration):
dependencies = [
('sponsorship', '0018_sponsor_job_fair_participant'),
]
operations = [
migrations.CreateModel(
name='BenefitPackag... | bsd-3-clause |
Fireblend/chromium-crosswalk | build/android/gyp/package_resources.py | 3 | 5931 | #!/usr/bin/env python
#
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
# pylint: disable=C0301
"""Package resources into an apk.
See https://android.googlesource.com/platform/tools/base/+/master/legacy/a... | bsd-3-clause |
fangxingli/hue | desktop/core/ext-py/Django-1.6.10/tests/dispatch/tests/test_dispatcher.py | 49 | 5839 | import gc
import sys
import time
import weakref
from django.dispatch import Signal, receiver
from django.utils import unittest
if sys.platform.startswith('java'):
def garbage_collect():
# Some JVM GCs will execute finalizers in a different thread, meaning
# we need to wait for that to complete be... | apache-2.0 |
aboutsajjad/Bridge | app_packages/youtube_dl/extractor/afreecatv.py | 3 | 14540 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..compat import compat_xpath
from ..utils import (
determine_ext,
ExtractorError,
int_or_none,
urlencode_postdata,
xpath_text,
)
class AfreecaTVIE(InfoExtractor):
IE_NAME = 'afreecatv'
... | mit |
danieljaouen/ansible | lib/ansible/modules/windows/win_reboot.py | 18 | 4001 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
ANSIBLE_METADATA = {'metadata_version': '1.1',
'status': ['stableinterface'],
'supported_by': 'core'}
DOCUMENTATION = r'''
---
module: win_reb... | gpl-3.0 |
staticlibs/android-ndk-r9d-arm-linux-androideabi-4.8 | lib/python2.7/distutils/fancy_getopt.py | 250 | 17948 | """distutils.fancy_getopt
Wrapper around the standard getopt module that provides the following
additional features:
* short and long options are tied together
* options have help strings, so fancy_getopt could potentially
create a complete usage summary
* options set attributes of a passed-in object
"""
__... | gpl-2.0 |
shsingh/ansible | lib/ansible/modules/network/nxos/nxos_install_os.py | 18 | 21941 | #!/usr/bin/python
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# Ansible is distribut... | gpl-3.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.