repo_name stringlengths 5 100 | path stringlengths 4 294 | copies stringclasses 990
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
fedenko/django-gulp-example | polls/finders.py | 1 | 1782 | # -*- coding: utf-8 -*-
import os
from django.conf import settings
from django.contrib.staticfiles.finders import AppDirectoriesFinder, FileSystemFinder
class UnminifiedFileSystemFinder(FileSystemFinder):
serve_unminimized = getattr(settings, 'SERVE_UNMINIMIZED', False)
def find_location(self, root, path, pre... | bsd-3-clause |
dlazz/ansible | lib/ansible/modules/network/panos/panos_dag.py | 38 | 3871 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Ansible module to manage PaloAltoNetworks Firewall
# (c) 2016, techbizdev <techbizdev@paloaltonetworks.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 publish... | gpl-3.0 |
evensonbryan/yocto-autobuilder | lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/test/unit/test_process_debug.py | 4 | 5071 | # This file is part of Buildbot. Buildbot is free software: you can
# redistribute it and/or modify it under the terms of the GNU General Public
# License as published by the Free Software Foundation, version 2.
#
# This program is distributed in the hope that it will be useful, but WITHOUT
# ANY WARRANTY; without eve... | gpl-2.0 |
andrewd18/eve-wspace | evewspace/Recruitment/tests.py | 138 | 1244 | # Eve W-Space
# Copyright (C) 2013 Andrew Austin and other contributors
#
# 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 |
momentum/canteen | canteen_tests/test_logic/test_cache.py | 2 | 7391 | # -*- coding: utf-8 -*-
"""
cache logic tests
~~~~~~~~~~~~~~~~~
tests builtin caching-related logic.
:author: Sam Gammon <sg@samgammon.com>
:copyright: (c) Sam Gammon, 2014
:license: This software makes use of the MIT Open Source License.
A copy of this license is included as ``LICENSE.md`` in
... | mit |
ashray/VTK-EVM | Examples/DataManipulation/Python/Arrays.py | 27 | 2660 | #!/usr/bin/env python
# This example demonstrates the use of VTK data arrays as attribute
# data as well as field data. It creates geometry (vtkPolyData) as
# well as attribute data explicitly.
import vtk
# Create a float array which represents the points.
pcoords = vtk.vtkFloatArray()
# Note that by default, an arr... | bsd-3-clause |
j-carpentier/nova | nova/tests/unit/fake_block_device.py | 63 | 1665 | # Copyright 2013 Red Hat Inc.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by ... | apache-2.0 |
savoirfairelinux/django | tests/model_meta/results.py | 156 | 31036 | from .models import (
AbstractPerson, BasePerson, Person, ProxyPerson, Relating, Relation,
)
TEST_RESULTS = {
'get_all_field_names': {
Person: [
'baseperson_ptr',
'baseperson_ptr_id',
'content_type_abstract',
'content_type_abstract_id',
'conte... | bsd-3-clause |
JeanKossaifi/scikit-learn | examples/ensemble/plot_forest_importances.py | 241 | 1761 | """
=========================================
Feature importances with forests of trees
=========================================
This examples shows the use of forests of trees to evaluate the importance of
features on an artificial classification task. The red bars are the feature
importances of the forest, along wi... | bsd-3-clause |
khrapovs/fangoosterlee | fangoosterlee/cosmethod.py | 1 | 3417 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
COS method
==========
The method comes from [1]_
The original code is found at
http://www.wilmott.com/messageview.cfm?catid=34&threadid=78554
References
----------
.. [1] Fang, F., & Oosterlee, C. W. (2009).
A Novel Pricing Method for European Options
Based ... | mit |
binghongcha08/pyQMD | GWP/QTGB/traj.py | 14 | 1289 | #!/usr/bin/python
import numpy as np
import pylab as plt
import seaborn as sns
sns.set_context("poster")
#with open("traj.dat") as f:
# data = f.read()
#
# data = data.split('\n')
#
# x = [row.split(' ')[0] for row in data]
# y = [row.split(' ')[1] for row in data]
#
# fig = plt.figure()
#
# ax1 = f... | gpl-3.0 |
JasonCormie/ansible-modules-extras | source_control/bzr.py | 50 | 6478 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, André Paramés <git@andreparames.com>
# Based on the Git module by 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 a... | gpl-3.0 |
toanalien/phantomjs | src/qt/qtwebkit/Tools/QueueStatusServer/filters/webkit_extras.py | 121 | 2830 | # 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 |
naototty/vagrant-lxc-ironic | ironic/common/glance_service/service_utils.py | 1 | 8408 | # Copyright 2012 OpenStack Foundation
# Copyright 2013 Hewlett-Packard Development Company, L.P.
# All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License"); you may
# not use this file except in compliance with the License. You may obtain
# a copy of the License at
#
# ht... | apache-2.0 |
listamilton/supermilton.repository | plugin.video.SportsDevil/lib/utils/pyaes.py | 189 | 16661 | """Simple AES cipher implementation in pure Python following PEP-272 API
Homepage: https://bitbucket.org/intgr/pyaes/
The goal of this module is to be as fast as reasonable in Python while still
being Pythonic and readable/understandable. It is licensed under the permissive
MIT license.
Hopefully the code is readabl... | gpl-2.0 |
npiganeau/odoo | addons/website_event_track/models/event.py | 26 | 8315 | # -*- 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 |
MyAOSP/external_chromium_org | chrome/common/extensions/docs/server2/intro_data_source.py | 23 | 2178 | # Copyright (c) 2012 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import os
from compiled_file_system import Unicode
from data_source import DataSource
from docs_server_utils import FormatKey
from extensions_paths impo... | bsd-3-clause |
marco-lancini/Showcase | django/db/models/expressions.py | 229 | 4992 | import datetime
from django.utils import tree
from django.utils.copycompat import deepcopy
class ExpressionNode(tree.Node):
"""
Base class for all query expressions.
"""
# Arithmetic connectors
ADD = '+'
SUB = '-'
MUL = '*'
DIV = '/'
MOD = '%%' # This is a quoted % operator - it i... | mit |
proversity-org/edx-platform | lms/djangoapps/ccx/overrides.py | 12 | 7397 | """
API related to providing field overrides for individual students. This is used
by the individual custom courses feature.
"""
import json
import logging
from ccx_keys.locator import CCXBlockUsageLocator, CCXLocator
from django.db import transaction
from opaque_keys.edx.keys import CourseKey, UsageKey
from openedx... | agpl-3.0 |
jackkiej/SickRage | lib/unidecode/x06f.py | 252 | 4650 | data = (
'Qing ', # 0x00
'Yu ', # 0x01
'Piao ', # 0x02
'Ji ', # 0x03
'Ya ', # 0x04
'Jiao ', # 0x05
'Qi ', # 0x06
'Xi ', # 0x07
'Ji ', # 0x08
'Lu ', # 0x09
'Lu ', # 0x0a
'Long ', # 0x0b
'Jin ', # 0x0c
'Guo ', # 0x0d
'Cong ', # 0x0e
'Lou ', # 0x0f
'Zhi ', # 0x10
'Gai ', ... | gpl-3.0 |
zendesk/dd-agent | tests/core/test_config.py | 22 | 3844 | # -*- coding: latin-1 -*-
# stdlib
import os
import os.path
import tempfile
import unittest
# project
from config import get_config, load_check_directory
from util import is_valid_hostname, windows_friendly_colon_split
from utils.pidfile import PidFile
from utils.platform import Platform
# No more hardcoded default c... | bsd-3-clause |
jchevin/MissionPlanner-master | Lib/site-packages/scipy/stats/mstats_basic.py | 53 | 66833 | """
An extension of scipy.stats.stats to support masked arrays
:author: Pierre GF Gerard-Marchant
:contact: pierregm_at_uga_edu
"""
#TODO : f_value_wilks_lambda looks botched... what are dfnum & dfden for ?
#TODO : ttest_reel looks botched: what are x1,x2,v1,v2 for ?
#TODO : reimplement ksonesamp
__author__ = "Pierr... | gpl-3.0 |
zhuwenping/python-for-android | tools/release.py | 69 | 1710 | #!/usr/bin/python
import googlecode_upload
import optparse
import os
import sys
PROJECT = 'android-scripting'
def upload(path, labels, options):
if options.dryrun:
return
summary = os.path.basename(path)
status, reason, url = googlecode_upload.upload_find_auth(
path, PROJECT, summary, labels, option... | apache-2.0 |
michalliu/OpenWrt-Firefly-Libraries | staging_dir/target-mipsel_1004kc+dsp_uClibc-0.9.33.2/usr/lib/python2.7/idlelib/RstripExtension.py | 148 | 1050 | 'Provides "Strip trailing whitespace" under the "Format" menu.'
class RstripExtension:
menudefs = [
('format', [None, ('Strip trailing whitespace', '<<do-rstrip>>'), ] ), ]
def __init__(self, editwin):
self.editwin = editwin
self.editwin.text.bind("<<do-rstrip>>", self.do_rstrip)
... | gpl-2.0 |
rplevka/robottelo | tests/foreman/ui/test_oscaptailoringfile.py | 3 | 4307 | """Test class for Tailoring Files
:Requirement: tailoringfiles
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: SCAPPlugin
:Assignee: jpathan
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
import pytest
from nailgun import entities
from robottelo.datafactory import gen_string
... | gpl-3.0 |
GheRivero/ansible | lib/ansible/modules/cloud/amazon/ecs_taskdefinition.py | 4 | 19207 | #!/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 |
bschuon/django-oscar | src/oscar/templatetags/wishlist_tags.py | 43 | 1279 | from django import template
register = template.Library()
@register.tag(name="wishlists_containing_product")
def do_basket_form(parse, token):
"""
Template tag for adding the user's wishlists form to the
template context so it can be rendered.
"""
tokens = token.split_contents()
if len(token... | bsd-3-clause |
PecanCM/p350-caf-3.x | tools/perf/scripts/python/sched-migration.py | 11215 | 11670 | #!/usr/bin/python
#
# Cpu task migration overview toy
#
# Copyright (C) 2010 Frederic Weisbecker <fweisbec@gmail.com>
#
# perf script event handlers have been generated by perf script -g python
#
# This software is distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Fre... | gpl-2.0 |
jsgf/xen | tools/python/xen/web/protocol.py | 52 | 1463 | #============================================================================
# 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 |
edfall/vnpy | vn.lts/vnltstd/test/lts_data_type.py | 167 | 86932 | # encoding: UTF-8
defineDict = {}
typedefDict = {}
#//////////////////////////////////////////////////////////////////////
#@company shanghai liber information Technology Co.,Ltd
#@file SecurityFtdcUserApiDataType.h
#@brief 定义业务数据类型
#//////////////////////////////////////////////////////////////////////
#/////////... | mit |
laurentiush/bioformats | components/xsd-fu/python/generateDS/Demos/Outline/outline_extended.py | 33 | 2224 | #!/usr/bin/env python
#
# Generated Mon Aug 18 17:12:21 2003 by generateDS.py.
#
import sys
from xml.dom import minidom
import outline as supermod
#
# Support/utility functions.
#
def showIndent(outfile, level):
for idx in range(level):
outfile.write(' ')
class outlineSub(supermod.outline):
de... | gpl-2.0 |
rohitwaghchaure/erpnext_smart | erpnext/hr/doctype/leave_allocation/leave_allocation.py | 38 | 4247 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
from frappe.utils import cint, flt
from frappe import _
from frappe.model.document import Document
from erpnext.hr.utils import set_emp... | agpl-3.0 |
John-Keating/ThinkStats2 | code/estimation.py | 66 | 3675 | """This file contains code used in "Think Stats",
by Allen B. Downey, available from greenteapress.com
Copyright 2014 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
from __future__ import print_function
import thinkstats2
import thinkplot
import math
import random
import numpy as np
d... | gpl-3.0 |
bioidiap/bob.ip.facedetect | bob/ip/facedetect/tests/test_tinyface.py | 1 | 1529 | from bob.ip.facedetect.tests.utils import is_library_available
import bob.io.image
import bob.io.base
import bob.io.base.test_utils
import numpy
# An image with one face
face_image = bob.io.base.load(
bob.io.base.test_utils.datafile("testimage.jpg", "bob.ip.facedetect")
)
# An image with 6 faces
face_image_mul... | gpl-3.0 |
caseyching/Impala | thirdparty/gtest-1.6.0/test/gtest_test_utils.py | 397 | 10437 | #!/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 |
yceruto/django | tests/view_tests/tests/test_debug.py | 2 | 32121 | # -*- coding: utf-8 -*-
# This coding header is significant for tests, as the debug view is parsing
# files to search for such a header to decode the source file content
from __future__ import unicode_literals
import importlib
import inspect
import os
import re
import shutil
import sys
from tempfile import NamedTempor... | bsd-3-clause |
horance-liu/tensorflow | tensorflow/contrib/tensor_forest/hybrid/python/layers/decisions_to_data_test.py | 158 | 2506 | # 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 |
diversys/wubi | src/bittorrent/testtest.py | 13 | 2052 | """
A much simpler testing framework than PyUnit
tests a module by running all functions in it whose name starts with 'test'
a test fails if it raises an exception, otherwise it passes
functions are try_all and try_single
"""
# Written by Bram Cohen
# see LICENSE.txt for license information
from traceback import p... | gpl-2.0 |
gatoatigrado/angular-static-data-view | tests/static_html_data_view/main_test.py | 1 | 1945 | # -*- coding: utf-8 -*-
"""Tests for the main methods, including some smoke/integration tests."""
import cStringIO
import fileinput
import os.path
import mock
import simplejson
import testify
from static_html_data_view import generate_data_view
from static_html_data_view import main
class MainTest(testify.TestCase)... | apache-2.0 |
OdatNurd/OverrideAudit | src/events.py | 1 | 3019 | import sublime
import sublime_plugin
import os
from .pkg_popup import show_pkg_popup
from .core import oa_setting, override_group, delete_packed_override
from .core import setup_override_minidiff
###----------------------------------------------------------------------------
class OverrideAuditEventListener(sublim... | mit |
sonaht/ansible | lib/ansible/module_utils/database.py | 108 | 5859 | # This code is part of Ansible, but is an independent component.
# This particular file snippet, and this file snippet only, is BSD licensed.
# Modules you write using this snippet, which is embedded dynamically by Ansible
# still belong to the author of the module, and may assign their own license
# to the complete wo... | gpl-3.0 |
jvillacorta/mitmproxy | test/mitmproxy/test_filt.py | 3 | 12421 | from six.moves import cStringIO as StringIO
from mock import patch
from mitmproxy import filt
from . import tutils
class TestParsing:
def _dump(self, x):
c = StringIO()
x.dump(fp=c)
assert c.getvalue()
def test_parse_err(self):
assert filt.parse("~h [") is None
def tes... | mit |
emakis/erpnext | erpnext/patches/v8_0/create_domain_docs.py | 17 | 1598 | # Copyright (c) 2013, Web Notes Technologies Pvt. Ltd. and Contributors
# License: GNU General Public License v3. See license.txt
from __future__ import unicode_literals
import frappe
import erpnext
def execute():
"""Create domain documents"""
frappe.reload_doc("core", "doctype", "domain")
frappe.reload_doc("core"... | gpl-3.0 |
ProfessorX/CIS508 | Codes/xen-4.3.1/tools/python/xen/xend/XendPSCSI.py | 43 | 6257 | #============================================================================
# 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 |
atsaki/ansible-modules-extras | system/open_iscsi.py | 89 | 11683 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Serge van Ginderachter <serge@vanginderachter.be>
#
# 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 vers... | gpl-3.0 |
a11r/grpc | tools/buildgen/build-cleaner.py | 44 | 3608 | #!/usr/bin/env python2.7
# Copyright 2015, 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 lis... | bsd-3-clause |
chrisfilo/fmriprep | test/workflows/test_confounds.py | 2 | 2506 | ''' Testing module for fmriprep.workflows.confounds '''
import logging
import os
import mock
import pandas as pd
from fmriprep.workflows.confounds import discover_wf, _gather_confounds
from test.workflows.utilities import TestWorkflow
from test.workflows import stub
logging.disable(logging.INFO) # don't print unnec... | bsd-3-clause |
YunfengLiu/cgminer | usbtest.py | 53 | 3046 | #!/usr/bin/env python2.7
#
# Original version supplied to me (Kano/kanoi) by xiangfu
#
# Modified to allow supplying the data to send
#
# Linux usAge: ./ubstest.py /dev/ttyUSB0 0xhexcodes|string|icarus
# OR python ubstest.py /dev/ttyUSB0 0xhexcodes|string|icarus
#
# Windows usAge: ./ubstest.py COM1 0xhexcodes|string|... | gpl-3.0 |
m2lan/amonone | amonone/utils/tests/dates_test.py | 5 | 4203 | from amonone.utils.dates import *
from nose.tools import eq_
import datetime
import pytz
from pytz import timezone
import unittest
class TestDates(unittest.TestCase):
def test_datestring_to_utc_datetime(self):
# UTC
result = datestring_to_utc_datetime("25-02-2012-00:00",_timezone='Europe/London')... | mit |
alvaroaleman/ansible | contrib/inventory/vmware_inventory.py | 11 | 23601 | #!/usr/bin/env python
# Requirements
# - pyvmomi >= 6.0.0.2016.4
# TODO:
# * more jq examples
# * optional folder heriarchy
"""
$ jq '._meta.hostvars[].config' data.json | head
{
"alternateguestname": "",
"instanceuuid": "5035a5cd-b8e8-d717-e133-2d383eb0d675",
"memoryhotaddenabled": false,
"guestfullna... | gpl-3.0 |
mahak/ansible | test/support/network-integration/collections/ansible_collections/vyos/vyos/plugins/module_utils/network/vyos/argspec/lldp_global/lldp_global.py | 47 | 1514 | # Copyright 2019 Red Hat
# GNU General Public License v3.0+
# (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
#############################################
# WARNING #
#############################################
#
# This file is auto generated by the resource
# module bu... | gpl-3.0 |
io07/BOJ-V4 | problem/forms.py | 1 | 1115 | from django import forms
from django_select2.forms import ModelSelect2MultipleWidget
# from django.contrib.auth.models import Group
from .models import Problem, ProblemTag
from ojuser.models import GroupProfile
class ProblemForm(forms.ModelForm):
is_spj = forms.NullBooleanField(widget=forms.CheckboxInput(), ini... | mit |
t3dev/odoo | odoo/addons/base/models/ir_rule.py | 1 | 10101 | # -*- coding: utf-8 -*-
# Part of Odoo. See LICENSE file for full copyright and licensing details.
import logging
import time
from odoo import api, fields, models, tools, SUPERUSER_ID, _
from odoo.exceptions import AccessError, ValidationError
from odoo.osv import expression
from odoo.tools import config
from odoo.too... | gpl-3.0 |
deepmind/deepmind-research | ogb_lsc/mag/schedules.py | 1 | 2384 | # Copyright 2021 DeepMind Technologies Limited.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed... | apache-2.0 |
pantheon-systems/libcloud | libcloud/test/dns/test_rackspace.py | 27 | 20347 | # 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 use ... | apache-2.0 |
t11e/django | django/contrib/localflavor/za/forms.py | 36 | 1891 | """
South Africa-specific Form helpers
"""
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField
from django.utils.checksums import luhn
from django.utils.translation import gettext as _
import re
from datetime import date
id_re = re... | bsd-3-clause |
marknca/cling | dependencies/s3transfer/download.py | 2 | 23812 | # Copyright 2016 Amazon.com, Inc. or its affiliates. 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. A copy of
# the License is located at
#
# http://aws.amazon.com/apache2.0/
#
# or in the "license" file accompa... | apache-2.0 |
DarthMaulware/EquationGroupLeaks | Leak #1 - Equation Group Cyber Weapons Auction - Invitation/EQGRP-Free-File/Firewall/EXPLOITS/EPBA/EPICBANANA/epicbanana_2.1.0.1.py | 1 | 1661 | #!/usr/bin/env python
import os
import sys
import warnings
from params import *
from payload import *
from telnet import *
from ssh import *
from hexdump import *
##
##
##
if __name__ == "__main__":
##
warnings.filterwarnings("ignore", category=FutureWarning, append=1)
##
params = Params()
para... | unlicense |
nitin-cherian/LifeLongLearning | Python/PythonProgrammingLanguage/Encapsulation/encap_env/lib/python3.5/site-packages/prompt_toolkit/contrib/regular_languages/compiler.py | 23 | 15633 | r"""
Compiler for a regular grammar.
Example usage::
# Create and compile grammar.
p = compile('add \s+ (?P<var1>[^\s]+) \s+ (?P<var2>[^\s]+)')
# Match input string.
m = p.match('add 23 432')
# Get variables.
m.variables().get('var1') # Returns "23"
m.variables().get('var2') # Return... | mit |
jsma/django-cms | cms/utils/compat/forms.py | 15 | 1591 | # -*- coding: utf-8 -*-
import importlib
from django.apps import apps
from django.conf import settings
# overide with custom classes if they exist
if settings.AUTH_USER_MODEL != 'auth.User': # pragma: no cover
# UserAdmin class
user_app_name = settings.AUTH_USER_MODEL.split('.')[0]
app = apps.get_app_co... | bsd-3-clause |
denovator/myfriki | lib/werkzeug/werkzeug/debug/console.py | 280 | 5557 | # -*- coding: utf-8 -*-
"""
werkzeug.debug.console
~~~~~~~~~~~~~~~~~~~~~~
Interactive console support.
:copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD.
"""
import sys
import code
from types import CodeType
from werkzeug.utils import escape
from werkzeug.loca... | apache-2.0 |
stewartsmith/bzr | bzrlib/tests/test_setup.py | 2 | 3440 | # Copyright (C) 2005, 2006, 2008-2011 Canonical Ltd
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program i... | gpl-2.0 |
DESHONOR/BroodROM_kernel_huawei_honor | tools/perf/scripts/python/sched-migration.py | 11215 | 11670 | #!/usr/bin/python
#
# Cpu task migration overview toy
#
# Copyright (C) 2010 Frederic Weisbecker <fweisbec@gmail.com>
#
# perf script event handlers have been generated by perf script -g python
#
# This software is distributed under the terms of the GNU General
# Public License ("GPL") version 2 as published by the Fre... | gpl-2.0 |
Freestila/dosage | tests/__init__.py | 3 | 2174 | # -*- coding: iso-8859-1 -*-
# Copyright (C) 2013-2014 Bastian Kleineidam
#
# 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 option) any later versi... | mit |
danielquinn/django_polymorphic | setup.py | 3 | 1948 | #!/usr/bin/env python
from setuptools import setup, find_packages
from os import path
import codecs
import os
import re
import sys
def read(*parts):
file_path = path.join(path.dirname(__file__), *parts)
return codecs.open(file_path, encoding='utf-8').read()
def find_version(*parts):
version_file = read(... | bsd-3-clause |
gauribhoite/personfinder | env/google_appengine/lib/django-1.2/django/test/client.py | 43 | 18903 | import urllib
from urlparse import urlparse, urlunparse, urlsplit
import sys
import os
import re
import mimetypes
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
from django.conf import settings
from django.contrib.auth import authenticate, login
from django.core.handlers.... | apache-2.0 |
aequitas/CouchPotato | cherrypy/_cpserver.py | 82 | 8010 | """Manage HTTP servers with CherryPy."""
import warnings
import cherrypy
from cherrypy.lib import attributes
from cherrypy._cpcompat import basestring, py3k
# We import * because we want to export check_port
# et al as attributes of this module.
from cherrypy.process.servers import *
class Server(ServerAdapter):
... | gpl-3.0 |
kpreid/shinysdr | shinysdr/plugins/psk31/__init__.py | 1 | 4600 | # Copyright 2014, 2015, 2016, 2017, 2018 Kevin Reid and the ShinySDR contributors
#
# This file is part of ShinySDR.
#
# ShinySDR 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 Licens... | gpl-3.0 |
iledarn/access-addons | group_menu_no_access/__openerp__.py | 8 | 1229 | # -*- 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... | gpl-3.0 |
zzicewind/nova | nova/scheduler/client/query.py | 59 | 3659 | # Copyright (c) 2014 Red Hat, 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 |
ff94315/hiwifi-openwrt-HC5661-HC5761 | staging_dir/target-mipsel_r2_uClibc-0.9.33.2/usr/lib/python2.7/encodings/gb2312.py | 816 | 1027 | #
# gb2312.py: Python Unicode Codec for GB2312
#
# Written by Hye-Shik Chang <perky@FreeBSD.org>
#
import _codecs_cn, codecs
import _multibytecodec as mbc
codec = _codecs_cn.getcodec('gb2312')
class Codec(codecs.Codec):
encode = codec.encode
decode = codec.decode
class IncrementalEncoder(mbc.MultibyteIncrem... | gpl-2.0 |
wangjun/odoo | addons/hw_posbox_upgrade/__init__.py | 1894 | 1075 | # -*- 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 |
rdhyee/PyTables | doc/sphinxext/inheritance_diagram.py | 98 | 13648 | """
Defines a docutils directive for inserting inheritance diagrams.
Provide the directive with one or more classes or modules (separated
by whitespace). For modules, all of the classes in that module will
be used.
Example::
Given the following classes:
class A: pass
class B(A): pass
class C(A): pass
... | bsd-3-clause |
gladgod/zhiliao | zhiliao/core/fields.py | 1 | 5415 | from __future__ import unicode_literals
from future.builtins import str
from future.utils import with_metaclass
from bleach import clean
from django.conf import settings
from django.contrib.admin.widgets import AdminTextareaWidget
from django.core.exceptions import ImproperlyConfigured, ValidationError
from django.db... | bsd-3-clause |
zwass/lpControl | dialer.py | 1 | 3758 | import logging
import socket
import time
import sys
import pygame
from pygame.locals import KEYDOWN
from twilio.rest import TwilioRestClient
from spinner import Spinner
from globalvars import(SOCKET_ADDR, STOPPED,
FORWARD, FAST_FORWARD, REVERSE,
SAMPLES_PER_SECOND)
from... | mit |
heyf/cloaked-octo-adventure | leetcode/112_path-sum.py | 1 | 1269 | # 112. Path Sum - LeetCode
# https://leetcode.com/problems/path-sum/description/
class TreeNode(object):
def __init__(self, x):
self.val = x
self.left = None
self.right = None
class Solution(object):
def has_sum_with_parent( self, root, current_sum, target_sum ):
if root is Non... | mit |
CXQERP/ODOOERP | addons/point_of_sale/wizard/__init__.py | 382 | 1200 | # -*- 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 |
serensoner/CouchPotatoServer | libs/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py | 2360 | 3778 | """The match_hostname() function from Python 3.3.3, essential when using SSL."""
# Note: This file is under the PSF license as the code comes from the python
# stdlib. http://docs.python.org/3/license.html
import re
__version__ = '3.4.0.2'
class CertificateError(ValueError):
pass
def _dnsname_match(dn, host... | gpl-3.0 |
towerjoo/mindsbook | django/contrib/auth/middleware.py | 289 | 3552 | from django.contrib import auth
from django.core.exceptions import ImproperlyConfigured
class LazyUser(object):
def __get__(self, request, obj_type=None):
if not hasattr(request, '_cached_user'):
from django.contrib.auth import get_user
request._cached_user = get_user(request)
... | bsd-3-clause |
trac-ja/trac-ja | trac/tests/functional/testcases.py | 5 | 8748 | # -*- encoding: utf-8 -*-
#!/usr/bin/python
import os
from trac.tests.functional import *
class RegressionTestRev6017(FunctionalTwillTestCaseSetup):
def runTest(self):
"""Test for regression of the plugin reload fix in r6017"""
# Setup the DeleteTicket plugin
plugin = open(os.path.join(sel... | bsd-3-clause |
supriyantomaftuh/django | tests/template_tests/filter_tests/test_phone2numeric.py | 345 | 1508 | from django.template.defaultfilters import phone2numeric_filter
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class Phone2numericTests(SimpleTestCase):
@setup({'phone2numeric01': '{{ a|phone2numeric }} {{ b|phone2numeric }}'})
def test_phone2n... | bsd-3-clause |
curiousbadger/pyWitnessSolver | src/log/simpleLogger.py | 1 | 2832 | '''
Created on Mar 29, 2016
@author: charper
'''
import logging
from collections import Counter
#from algorithms.sort.quicksort import quicksort
class simpleLogger(object):
DEBUG2=logging.DEBUG-1
def __init__(self, name, *args, **kwargs):
print('Creating logger:', name)
self.log... | gpl-3.0 |
jvenezia/heroku-buildpack-python | vendor/pip-pop/pip/_vendor/html5lib/treewalkers/pulldom.py | 1729 | 2302 | from __future__ import absolute_import, division, unicode_literals
from xml.dom.pulldom import START_ELEMENT, END_ELEMENT, \
COMMENT, IGNORABLE_WHITESPACE, CHARACTERS
from . import _base
from ..constants import voidElements
class TreeWalker(_base.TreeWalker):
def __iter__(self):
ignore_until = None... | mit |
kobolabs/calibre | src/calibre/ebooks/mobi/writer8/exth.py | 4 | 6552 | #!/usr/bin/env python
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'restructuredtext en'
import re
from... | gpl-3.0 |
40223136/2015w11 | static/Brython3.1.1-20150328-091302/Lib/xml/dom/pulldom.py | 850 | 11761 | import xml.sax
import xml.sax.handler
START_ELEMENT = "START_ELEMENT"
END_ELEMENT = "END_ELEMENT"
COMMENT = "COMMENT"
START_DOCUMENT = "START_DOCUMENT"
END_DOCUMENT = "END_DOCUMENT"
PROCESSING_INSTRUCTION = "PROCESSING_INSTRUCTION"
IGNORABLE_WHITESPACE = "IGNORABLE_WHITESPACE"
CHARACTERS = "CHARACTERS"
class PullDOM(... | gpl-3.0 |
pluskid/mxnet | example/ssd/dataset/imdb.py | 10 | 2105 | import numpy as np
import os.path as osp
class Imdb(object):
"""
Base class for dataset loading
Parameters:
----------
name : str
name of dataset
"""
def __init__(self, name):
self.name = name
self.classes = []
self.num_classes = 0
self.image_set_ind... | apache-2.0 |
gcd0318/django | django/contrib/gis/db/models/query.py | 224 | 36645 | import warnings
from django.contrib.gis.db.models import aggregates
from django.contrib.gis.db.models.fields import (
GeometryField, LineStringField, PointField, get_srid_info,
)
from django.contrib.gis.db.models.lookups import GISLookup
from django.contrib.gis.db.models.sql import (
AreaField, DistanceField, ... | bsd-3-clause |
drawks/ansible | lib/ansible/modules/storage/purestorage/purefa_ntp.py | 17 | 3627 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2018, Simon Dodsley (simon@purestorage.com)
# 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 |
safwanrahman/mozillians | vendor-local/lib/python/tablib/packages/openpyxl3/writer/drawings.py | 116 | 8268 | # coding=UTF-8
'''
Copyright (c) 2010 openpyxl
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 use, copy, modify, merge, publ... | bsd-3-clause |
evangeline97/localwiki-backend-server | localwiki/versionutils/diff/daisydiff/tests.py | 3 | 5193 | from django.test import TestCase
from django.conf import settings
from daisydiff import daisydiff
import socket
from versionutils.diff.daisydiff.daisydiff import daisydiff_merge
TEST_SERVICE = hasattr(settings, 'DAISYDIFF_URL')
def skipUnlessHasService(test):
def do_nothing(*args, **kwargs):
print "Skipp... | gpl-2.0 |
TheWardoctor/Wardoctors-repo | plugin.video.salts/default.py | 1 | 142262 | """
SALTS XBMC Addon
Copyright (C) 2014 tknorris
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 option) any later version.
T... | apache-2.0 |
Guneet-Dhillon/mxnet | example/speech_recognition/stt_bucketing_module.py | 52 | 1313 | # 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 u... | apache-2.0 |
ivanhorvath/openshift-tools | scripts/monitoring/cron-send-logging-checks.py | 1 | 14272 | #!/usr/bin/env python
'''
Send Cluster EFK checks to Zagg
'''
# vim: expandtab:tabstop=4:shiftwidth=4
#
# Copyright 2015 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... | apache-2.0 |
csalazar/scrapy | scrapy/linkextractors/regex.py | 73 | 1357 | import re
from six.moves.urllib.parse import urljoin
from w3lib.html import remove_tags, replace_entities, replace_escape_chars
from scrapy.link import Link
from .sgml import SgmlLinkExtractor
linkre = re.compile(
"<a\s.*?href=(\"[.#]+?\"|\'[.#]+?\'|[^\s]+?)(>|\s.*?>)(.*?)<[/ ]?a>",
re.DOTALL | re.IG... | bsd-3-clause |
terbolous/SickRage | lib/imdb/parser/sql/dbschema.py | 4 | 20510 | #-*- encoding: utf-8 -*-
"""
parser.sql.dbschema module (imdb.parser.sql package).
This module provides the schema used to describe the layout of the
database used by the imdb.parser.sql package; functions to create/drop
tables and indexes are also provided.
Copyright 2005-2012 Davide Alberani <da@erlug.linux.it>
... | gpl-3.0 |
HybridF5/nova | nova/tests/unit/virt/test_configdrive.py | 24 | 2014 | # Copyright 2014 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/licenses/LICENSE-2.0
#
# Unless required by applicable law or agree... | apache-2.0 |
timm/timmnix | pypy3-v5.5.0-linux64/lib-python/3/trace.py | 1 | 31992 | #!/usr/bin/env python3
# portions copyright 2001, Autonomous Zones Industries, Inc., all rights...
# err... reserved and offered to the public under the terms of the
# Python 2.2 license.
# Author: Zooko O'Whielacronx
# http://zooko.com/
# mailto:zooko@zooko.com
#
# Copyright 2000, Mojam Media, Inc., all rights reser... | mit |
pducks32/intergrala | python/sympy/sympy/physics/tests/test_pring.py | 17 | 1080 | from sympy.physics.pring import wavefunction, energy
from sympy import Symbol, pi, integrate, sqrt, exp, simplify, I
from sympy.abc import m, x, r
from sympy.physics.quantum.constants import hbar
def test_wavefunction():
Psi = {
0: (1/sqrt(2 * pi)),
1: (1/sqrt(2 * pi)) * exp(I * x),
2: (1/... | mit |
iabdalkader/micropython | tests/float/string_format_modulo.py | 15 | 1363 | print("%s" % 1.0)
print("%r" % 1.0)
print("%d" % 1.0)
print("%i" % 1.0)
print("%u" % 1.0)
# these 3 have different behaviour in Python 3.x versions
# uPy raises a TypeError, following Python 3.5 (earlier versions don't)
# print("%x" % 18.0)
# print("%o" % 18.0)
# print("%X" % 18.0)
print("%e" % 1.23456)
print("%E" %... | mit |
gdimitris/ChessPuzzler | Virtual_Environment/lib/python2.7/site-packages/requests/packages/chardet/euctwprober.py | 2994 | 1676 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.