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 |
|---|---|---|---|---|---|
Jadaw1n/letsencrypt | acme/acme/messages.py | 18 | 13945 | """ACME protocol messages."""
import collections
from acme import challenges
from acme import fields
from acme import jose
from acme import util
class Error(jose.JSONObjectWithFields, Exception):
"""ACME error.
https://tools.ietf.org/html/draft-ietf-appsawg-http-problem-00
:ivar unicode typ:
:ivar ... | apache-2.0 |
ephes/scikit-learn | examples/decomposition/plot_pca_vs_lda.py | 182 | 1743 | """
=======================================================
Comparison of LDA and PCA 2D projection of Iris dataset
=======================================================
The Iris dataset represents 3 kind of Iris flowers (Setosa, Versicolour
and Virginica) with 4 attributes: sepal length, sepal width, petal length
a... | bsd-3-clause |
elfi-dev/elfi | elfi/examples/daycare.py | 2 | 10847 | """Example of inference of transmission dynamics of bacteria in day care centers.
Treatment roughly follows:
Numminen, E., Cheng, L., Gyllenberg, M. and Corander, J.: Estimating the transmission dynamics
of Streptococcus pneumoniae from strain prevalence data, Biometrics, 69, 748-757, 2013.
"""
import logging
from fu... | bsd-3-clause |
schechter/pykoans | python3/koans/about_multiple_inheritance.py | 96 | 3944 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Slightly based on AboutModules in the Ruby Koans
#
from runner.koan import *
class AboutMultipleInheritance(Koan):
class Nameable:
def __init__(self):
self._name = None
def set_name(self, new_name):
self._name = new_name
... | mit |
GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/networkx/algorithms/distance_regular.py | 72 | 5409 | """
=======================
Distance-regular graphs
=======================
"""
# Copyright (C) 2011 by
# Dheeraj M R <dheerajrav@gmail.com>
# Aric Hagberg <aric.hagberg@gmail.com>
# All rights reserved.
# BSD license.
import networkx as nx
__author__ = """\n""".join(['Dheeraj M R <dheerajrav@gmail.com>... | agpl-3.0 |
imsparsh/python-for-android | python3-alpha/python3-src/Lib/ctypes/test/test_python_api.py | 50 | 3066 | from ctypes import *
import unittest, sys
from ctypes.test import is_resource_enabled
################################################################
# This section should be moved into ctypes\__init__.py, when it's ready.
from _ctypes import PyObj_FromPtr
###########################################################... | apache-2.0 |
Tinkerforge/brickv | src/brickv/plugin_system/plugins/red/program_page_ruby.py | 1 | 10155 | # -*- coding: utf-8 -*-
"""
RED Plugin
Copyright (C) 2014-2015 Matthias Bolte <matthias@tinkerforge.com>
Copyright (C) 2014 Olaf Lüke <olaf@tinkerforge.com>
program_page_ruby.py: Program Wizard Ruby Page
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public ... | gpl-2.0 |
BaichuanWu/Blog_on_django | site-packages/pip/_vendor/requests/packages/chardet/euckrfreq.py | 3121 | 45978 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is Mozilla Communicator client code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights R... | mit |
cfei18/incubator-airflow | tests/contrib/sensors/test_sftp_sensor.py | 15 | 2755 | # -*- coding: utf-8 -*-
#
# 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
#... | apache-2.0 |
snua12/zlomekfs | tests/nose-tests/remoteZfs.py | 1 | 10216 | #! /bin/env python
"""
locally, we wrap every RemoteReference into RemoteObject
"""
from twisted.spread import pb
from twisted.internet import reactor
from twisted.python.failure import Failure
import sys
import os
import logging
import tempfile
from insecticide.snapshot import SnapshotDescription
from insecticid... | gpl-2.0 |
OpenSourcePolicyCenter/webapp-public | webapp/apps/dynamic/tests/utils.py | 2 | 1304 | START_YEAR = '2016'
def do_dynamic_sim(client, base_name, microsim_response, pe_reform,
start_year=START_YEAR):
# Link to dynamic simulation
idx = microsim_response.url[:-1].rfind('/')
model_num = microsim_response.url[idx + 1:-1]
dynamic_landing = '/dynamic/{1}/?start_year={2}'.form... | mit |
ivmech/iviny-scope | lib/xlsxwriter/test/comparison/test_chart_font05.py | 1 | 2453 | ###############################################################################
#
# Tests for XlsxWriter.
#
# Copyright (c), 2013, John McNamara, jmcnamara@cpan.org
#
import unittest
import os
from ...workbook import Workbook
from ..helperfunctions import _compare_xlsx_files
class TestCompareXLSXFiles(unittest.TestC... | gpl-3.0 |
alephobjects/Cura | Cura/util/pluginInfo.py | 1 | 5074 | """
The plugin module contains information about the plugins found for Cura.
It keeps track of a list of installed plugins and the information contained within.
"""
__copyright__ = "Copyright (C) 2013 David Braam - Released under terms of the AGPLv3 License"
import os
import sys
import traceback
import platform
import... | agpl-3.0 |
tpo/ansible | test/support/integration/plugins/modules/ufw.py | 28 | 22566 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2014, Ahti Kitsik <ak@ahtik.com>
# Copyright: (c) 2014, Jarno Keskikangas <jarno.keskikangas@gmail.com>
# Copyright: (c) 2013, Aleksey Ovcharenko <aleksey.ovcharenko@gmail.com>
# Copyright: (c) 2013, James Martin <jmartin@basho.com>
# GNU General Public Licens... | gpl-3.0 |
sekikn/ambari | ambari-server/src/main/resources/stack-hooks/before-ANY/scripts/hook.py | 2 | 1181 | """
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 this ... | apache-2.0 |
pshen/ansible | lib/ansible/module_utils/gce.py | 187 | 2535 | # 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 |
bqbn/addons-server | src/olympia/translations/hold.py | 3 | 1610 | from threading import local
import django.dispatch
from django.core.signals import request_finished
_to_save = local()
def add_translation(*, instance, translation, field):
"""
Queue a `translation` that needs to be saved for a particular `field` on
`instance`.
"""
if not hasattr(_to_save, 'tr... | bsd-3-clause |
ariebovenberg/snug | examples/github/types.py | 2 | 2883 | """datastructures and type definitions"""
import enum
import reprlib
import typing as t
from datetime import datetime
from functools import partial
from dataclasses import dataclass
_repr = reprlib.Repr()
_repr.maxstring = 45
dclass = partial(dataclass, frozen=True, repr=False)
@dclass()
class UserSummary:
lo... | mit |
rafaellc28/Latex2MiniZinc | latex2minizinc/Expression.py | 1 | 1933 | class Expression:
"""
Class representing a expression node in the AST of a MLP
"""
def __init__(self):
self.indice = -1
self.identifier = None
self.identifierName = None
self.identifierList = None
self.isInSet = False
self.isSet = None
self.isVar ... | mit |
cstavr/synnefo | snf-cyclades-app/synnefo/api/compute_urls.py | 9 | 1401 | # Copyright (C) 2010-2014 GRNET S.A.
#
# 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.
#
# This program is distributed i... | gpl-3.0 |
Kotaimen/awscfncli | awscfncli2/cli/commands/validate/validate.py | 1 | 1394 | import click
from awscfncli2.cli.context import Context
from awscfncli2.cli.utils.deco import command_exception_handler
from awscfncli2.cli.utils.pprint import echo_pair_if_exists
@click.command('validate')
@click.pass_context
@command_exception_handler
def cli(ctx):
"""Validate template file."""
assert isin... | mit |
nnethercote/servo | tests/wpt/web-platform-tests/tools/wptrunner/wptrunner/tests/test_update.py | 2 | 58773 | import json
import mock
import os
import pytest
import sys
from io import BytesIO
from .. import metadata, manifestupdate
from ..update.update import WPTUpdate
from ..update.base import StepRunner, Step
from mozlog import structuredlog, handlers, formatters
here = os.path.dirname(__file__)
sys.path.insert(0, os.path.... | mpl-2.0 |
funkaoshi/django-guardian | guardian/tests/admin_test.py | 13 | 16724 | import copy
from django import forms
from django.conf import settings
from django.contrib import admin
from django.contrib.admin.models import LogEntry
from django.contrib.auth.models import User, Group
from django.contrib.contenttypes.models import ContentType
from django.core.urlresolvers import reverse
from django.... | bsd-2-clause |
mahak/ansible | lib/ansible/plugins/connection/winrm.py | 16 | 32540 | # (c) 2014, Chris Church <chris@ninemoreminutes.com>
# Copyright (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
DOCUMENTATION = """
author: Ansible Core Te... | gpl-3.0 |
shakalaca/ASUS_ZenFone_ZE550ML_ZE551ML | linux/kernel/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 |
Magicked/crits | crits/core/form_consts.py | 6 | 7769 | class Action():
ACTION_TYPE = "Action type"
BEGIN_DATE = "Begin date"
ANALYST = "Analyst"
END_DATE = "End date"
PERFORMED_DATE = "Performed date"
ACTIVE = "Active"
REASON = "Reason"
DATE = "Date"
OBJECT_TYPES = "TLOs"
PREFERRED = "Preferred TLOs"
class Common():
ADD_INDICATO... | mit |
hlmnrmr/liveblog | server/liveblog/syndication/consumer.py | 1 | 5521 | import logging
from bson import ObjectId
from superdesk.resource import Resource
from superdesk.services import BaseService
from superdesk.errors import SuperdeskApiError
from superdesk import get_resource_service
from flask import current_app as app
from flask import Blueprint
from flask_cors import CORS
from liveblo... | agpl-3.0 |
aguirrea/lucy | tests/lfootGraph.py | 1 | 6007 | #! /usr/bin/env python
# -*- coding: utf-8 -*-
# Andrés Aguirre Dorelo
#
# MINA/INCO/UDELAR
#
# module for finding the steps in the tutors
#
# 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; eith... | gpl-3.0 |
otmaneJai/Zipline | zipline/utils/tradingcalendar_bmf.py | 17 | 7576 | #
# Copyright 2014 Quantopian, 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 or agreed to in wr... | apache-2.0 |
mcgachey/edx-platform | lms/djangoapps/certificates/urls.py | 56 | 1067 | """
URLs for the certificates app.
"""
from django.conf.urls import patterns, url
from django.conf import settings
from certificates import views
urlpatterns = patterns(
'',
# Certificates HTML view
url(
r'^user/(?P<user_id>[^/]*)/course/{course_id}'.format(course_id=settings.COURSE_ID_PATTERN),... | agpl-3.0 |
mtanida/image_collection_browser | scripts/generate_coordinates.py | 1 | 3397 | # -*- coding: utf-8 -*-
# Description: generates a json file that contains the item ids in order they appear in the UI
# Example usage:
# python generate_coordinates.py ../data/ ../js/coords.json 100 10 10 50 20 3
from PIL import Image
import json
import math
import os
import sys
# input
if len(sys.argv) < 8:
... | cc0-1.0 |
cloudbase/nova | nova/tests/unit/api/openstack/compute/test_flavor_manage.py | 4 | 17133 | # Copyright 2011 Andrew Bogott for the Wikimedia Foundation
# 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-... | apache-2.0 |
user-none/calibre | src/calibre/ebooks/mobi/debug/mobi8.py | 14 | 13718 | #!/usr/bin/env python2
# vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai
from __future__ import (unicode_literals, division, absolute_import,
print_function)
from future_builtins import map
__license__ = 'GPL v3'
__copyright__ = '2012, Kovid Goyal <kovid@kovidgoyal.net>'
__docformat__ = 'res... | gpl-3.0 |
Bluetide/Cactus | cactus/deployment/engine.py | 9 | 4330 | #coding:utf-8
import os
import logging
from cactus.deployment.file import BaseFile
from cactus.utils.filesystem import fileList
from cactus.utils.helpers import get_or_prompt, memoize
from cactus.utils.parallel import multiMap, PARALLEL_DISABLED
logger = logging.getLogger(__name__)
class BaseDeploymentEngine(objec... | bsd-3-clause |
disabler/isida3 | scripts/update3_0to3_1.py | 2 | 6918 | import os, sys
global clean, rename, cur, conn
os.chdir('..')
settings_folder = 'settings/%s'
conference_config_path = settings_folder % 'conference.config'
owner_config_path = settings_folder % 'owner.config'
configname = settings_folder % 'config.py'
topbase_path = settings_folder % 'topbase.db'
aliases_p... | gpl-3.0 |
earshel/PokeyPyManager | POGOProtos/Networking/Requests/Messages/SfidaActionLogMessage_pb2.py | 15 | 1948 | # Generated by the protocol buffer compiler. DO NOT EDIT!
# source: POGOProtos/Networking/Requests/Messages/SfidaActionLogMessage.proto
import sys
_b=sys.version_info[0]<3 and (lambda x:x) or (lambda x:x.encode('latin1'))
from google.protobuf import descriptor as _descriptor
from google.protobuf import message as _me... | mit |
Murali-group/GraphSpace | graphspace/settings/local.py | 1 | 1543 | from graphspace.settings.base import *
# variables for setting up account through which GraphSpace emails
EMAIL_HOST = 'NONE'
EMAIL_HOST_USER = 'NONE'
EMAIL_HOST_PASSWORD = 'NONE'
# If error is thrown, display the error in the browser (ONLY FOR LOCAL MACHINES)
DEBUG = True
TEMPLATE_DEBUG = True
MAINTENANCE = False
#... | gpl-2.0 |
av8ramit/tensorflow | tensorflow/contrib/distributions/python/ops/distribution_util.py | 11 | 19545 | # 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 |
smerdis/pycortex | cortex/dataset/viewRGB.py | 2 | 7274 | import json
import numpy as np
from .views import Dataview, Volume, Vertex
from .braindata import VolumeData, VertexData, _hash
from ..database import db
from .. import options
default_cmap = options.config.get("basic", "default_cmap")
class DataviewRGB(Dataview):
def __init__(self, subject=None, alpha=None, des... | bsd-2-clause |
andrewyoung1991/scons | test/Fortran/FORTRANFLAGS.py | 4 | 4799 | #!/usr/bin/env python
#
# __COPYRIGHT__
#
# 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, publish,
... | mit |
cloudera/hue | desktop/core/ext-py/sqlparse-0.2.0/tests/test_parse.py | 6 | 11507 | # -*- coding: utf-8 -*-
"""Tests sqlparse.parse()."""
import pytest
import sqlparse
from sqlparse import sql, tokens as T
from sqlparse.compat import StringIO
def test_parse_tokenize():
s = 'select * from foo;'
stmts = sqlparse.parse(s)
assert len(stmts) == 1
assert str(stmts[0]) == s
def test_pa... | apache-2.0 |
weijia/django-excel-to-model | django_excel_to_model/management/commands/import_excel_according_to_model.py | 1 | 7251 | import argparse
import importlib
import os
from django.contrib.contenttypes.models import ContentType
from django.core.management.base import BaseCommand
from django_excel_to_model.field_tools import get_valid_excel_field_name
from django_excel_to_model.file_readers.csv_reader import CsvFile
from django_excel_to_model... | bsd-3-clause |
acsone/project | project_analytic_line_view/__openerp__.py | 16 | 1458 | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Joël Grand-Guillaume, Matthieu Dietrich
# Copyright 2010-2015 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero Gener... | agpl-3.0 |
veger/ansible | lib/ansible/modules/network/aci/aci_contract_subject.py | 2 | 10605 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# 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 |
MiyamotoAkira/kivy | kivy/modules/keybinding.py | 81 | 1699 | '''Keybinding
==========
This module forces the mapping of some keys to functions:
* F11: Rotate the Window through 0, 90, 180 and 270 degrees
* Shift + F11: Switches between portrait and landscape on desktops
* F12: Take a screenshot
Note: this does't work if the application requests the keyboard beforehand.
Usage... | mit |
miipl-naveen/optibizz | openerp/addons/base/res/__init__.py | 384 | 1261 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2009 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 |
fedorpatlin/ansible | lib/ansible/modules/windows/win_robocopy.py | 72 | 4833 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Corwin Brown <blakfeld@gmail.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the Lic... | gpl-3.0 |
ganeshgore/myremolab | server/src/build/lib.linux-i686-2.7/weblab/core/coordinator/sql/post_reservation.py | 2 | 3783 | #!/usr/bin/env python
#-*-*- encoding: utf-8 -*-*-
#
# Copyright (C) 2005 onwards University of Deusto
# All rights reserved.
#
# This software is licensed as described in the file COPYING, which
# you should have received as part of this distribution.
#
# This software consists of contributions made by many individual... | bsd-2-clause |
nikhilprathapani/python-for-android | python3-alpha/python3-src/Lib/test/test_codecencodings_cn.py | 55 | 3144 | #!/usr/bin/env python3
#
# test_codecencodings_cn.py
# Codec encoding tests for PRC encodings.
#
from test import support
from test import test_multibytecodec_support
import unittest
class Test_GB2312(test_multibytecodec_support.TestBase, unittest.TestCase):
encoding = 'gb2312'
tstring = test_multibytecodec... | apache-2.0 |
klim-iv/phantomjs-qt5 | src/webkit/Tools/Scripts/webkitpy/common/net/buildbot/buildbot.py | 125 | 22854 | # 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 |
mackjoner/flask-restful | flask_restful/paging.py | 51 | 1207 | from flask_restful.utils.crypto import decrypt, encrypt
DEFAULT_PAGE_SIZE = 50
def retrieve_next_page(key, seed, args, callback, initial_bookmark=None):
"""
A helper for the bookmark pager.
:param key: the private key of you API
:param seed: the crypo seed for this session
:param args: the verbat... | bsd-3-clause |
kylerbrown/scikit-learn | examples/feature_selection/plot_rfe_with_cross_validation.py | 226 | 1384 | """
===================================================
Recursive feature elimination with cross-validation
===================================================
A recursive feature elimination example with automatic tuning of the
number of features selected with cross-validation.
"""
print(__doc__)
import matplotlib.p... | bsd-3-clause |
WoLpH/CouchPotatoServer | libs/pyutil/scripts/randfile.py | 106 | 1948 | #!/usr/bin/env python
import os, sys
from random import randrange
import argparse
def main():
CHUNKSIZE=2**20
parser = argparse.ArgumentParser(prog="randfile", description="Create a file of pseudorandom bytes (not cryptographically secure).")
parser.add_argument('-b', '--num-bytes', help="how many byt... | gpl-3.0 |
Yongliangdu/ThinkStats2 | code/chap02soln.py | 69 | 2263 | """This file contains code for use with "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 sys
from operator import itemgetter
import first
import thinkstats2
de... | gpl-3.0 |
dajusc/trimesh | trimesh/voxel/ops.py | 1 | 12278 | import numpy as np
from .. import util
from ..constants import log
def fill_orthographic(dense):
shape = dense.shape
indices = np.stack(
np.meshgrid(*(np.arange(s) for s in shape), indexing='ij'),
axis=-1)
empty = np.logical_not(dense)
def fill_axis(axis):
base_local_indices ... | mit |
abad623/verbalucce | verbalucce/nltk/corpus/reader/toolbox.py | 5 | 2078 | # Natural Language Toolkit: Toolbox Reader
#
# Copyright (C) 2001-2012 NLTK Project
# Author: Greg Aumann <greg_aumann@sil.org>
# Stuart Robinson <Stuart.Robinson@mpi.nl>
# Steven Bird <sb@csse.unimelb.edu.au>
# URL: <http://www.nltk.org/>
# For license information, see LICENSE.TXT
"""
Module for readi... | apache-2.0 |
peterm-itr/edx-platform | lms/djangoapps/open_ended_grading/views.py | 9 | 13661 | import logging
from django.views.decorators.cache import cache_control
from edxmako.shortcuts import render_to_response
from django.core.urlresolvers import reverse
from courseware.courses import get_course_with_access
from xmodule.open_ended_grading_classes.grading_service_module import GradingServiceError
import j... | agpl-3.0 |
Donkyhotay/MoonPy | zope/component/globalregistry.py | 1 | 6970 | ##############################################################################
#
# Copyright (c) 2006 Zope Corporation and Contributors.
# All Rights Reserved.
#
# This software is subject to the provisions of the Zope Public License,
# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution.
# THIS SO... | gpl-3.0 |
sametmax/Django--an-app-at-a-time | ignore_this_directory/django/contrib/messages/storage/cookie.py | 47 | 6532 | import json
from django.conf import settings
from django.contrib.messages.storage.base import BaseStorage, Message
from django.http import SimpleCookie
from django.utils.crypto import constant_time_compare, salted_hmac
from django.utils.safestring import SafeData, mark_safe
class MessageEncoder(json.JSONEncoder):
... | mit |
Fewbytes/cosmo-manager-rest-client | cosmo_manager_rest_client/swagger/BlueprintsApi.py | 1 | 4585 | ########
# Copyright (c) 2013 GigaSpaces Technologies Ltd. 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... | apache-2.0 |
ondras/TeaJS | deps/v8/tools/testrunner/objects/peer.py | 123 | 3561 | # Copyright 2012 the V8 project authors. 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 conditi... | bsd-3-clause |
hackers-terabit/portage | pym/portage/_legacy_globals.py | 4 | 2289 | # Copyright 2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import portage
from portage import os
from portage.const import CACHE_PATH, PROFILE_PATH
def _get_legacy_global(name):
constructed = portage._legacy_globals_constructed
if name in constructed:
return getattr(port... | gpl-2.0 |
qtekfun/htcDesire820Kernel | external/chromium_org/media/tools/layout_tests/trend_graph_unittest.py | 175 | 1288 | #!/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.
import os
import shutil
import unittest
from trend_graph import TrendGraph
class TestTrendGraph(unittest.TestCase):
def testU... | gpl-2.0 |
YYWen0o0/python-frame-django | tests/utils_tests/test_text.py | 25 | 8128 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from unittest import skipUnless
import warnings
from django.test import SimpleTestCase
from django.utils import six, text
from django.utils.deprecation import RemovedInDjango19Warning
IS_WIDE_BUILD = (len('\U0001F4A9') == 1)
class TestUtilsText(Simple... | bsd-3-clause |
simonwydooghe/ansible | lib/ansible/modules/cloud/google/gcp_compute_node_template.py | 13 | 13957 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2017 Google
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# ----------------------------------------------------------------------------
#
# *** AUTO GENERATED CODE *** AUTO GENERATED CODE ***
#
... | gpl-3.0 |
berezovskyi/nikola | tests/data/translated_titles/conf.py | 16 | 27281 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import time
# !! This is the configuration of Nikola. !!#
# !! You should edit it to your liking. !!#
# ! Some settings can be different in different languages.
# ! A comment stating (translatable) is used to denote those.
# ! There are two ways to s... | mit |
qma/pants | tests/python/pants_test/backend/jvm/tasks/test_classpath_util.py | 1 | 2852 | # 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 os
from pant... | apache-2.0 |
jroyal/plexpy | lib/logutils/queue.py | 34 | 7547 | #
# Copyright (C) 2010-2013 Vinay Sajip. See LICENSE.txt for details.
#
"""
This module contains classes which help you work with queues. A typical
application is when you want to log from performance-critical threads, but
where the handlers you want to use are slow (for example,
:class:`~logging.handlers.SMTPHandler`)... | gpl-3.0 |
singingwolfboy/readthedocs.org | readthedocs/restapi/serializers.py | 7 | 1774 | from rest_framework import serializers
from readthedocs.builds.models import Build, Version
from readthedocs.projects.models import Project
class ProjectSerializer(serializers.ModelSerializer):
class Meta:
model = Project
fields = (
'id',
'name', 'slug', 'description', 'l... | mit |
tsmrachel/remo | remo/remozilla/tasks.py | 1 | 5981 | from __future__ import unicode_literals
from datetime import datetime, timedelta
from urllib import quote
from django.conf import settings
from django.contrib.auth.models import User
from django.db import transaction
from django.utils import timezone
import requests
import waffle
from celery.task import periodic_tas... | bsd-3-clause |
drnextgis/QGIS | python/ext-libs/pytz/tzfile.py | 480 | 4869 | #!/usr/bin/env python
'''
$Id: tzfile.py,v 1.8 2004/06/03 00:15:24 zenzen Exp $
'''
try:
from cStringIO import StringIO
except ImportError:
from io import StringIO
from datetime import datetime, timedelta
from struct import unpack, calcsize
from pytz.tzinfo import StaticTzInfo, DstTzInfo, memorized_ttinfo
fro... | gpl-2.0 |
googleads/google-ads-python | google/ads/googleads/v6/services/services/offline_user_data_job_service/transports/base.py | 1 | 5512 | # -*- 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 o... | apache-2.0 |
alu0100207385/dsi_3Django | tests/defaultfilters/tests.py | 48 | 31837 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
import datetime
import decimal
from django.template.defaultfilters import *
from django.test import TestCase
from django.test.utils import TransRealMixin
from django.utils import six
from django.utils import unittest, translation
from django.utils.safest... | bsd-3-clause |
lopezdp/ConstructionEstimatingProject | feetInchesCalc.py | 1 | 1539 | import math
def measurements():
programOn = True
subTotal = 0
program_continue = input("Do you want to keep a running total of your measurements? 1 for yes, 2 for no: ");
if (program_continue == 1):
print " "
feet = input("Enter feet portion of distance: ");
inch = input("Ent... | mit |
sharpdeep/pyspider | pyspider/libs/utils.py | 53 | 11526 | #!/usr/bin/env python
# -*- encoding: utf-8 -*-
# vim: set et sw=4 ts=4 sts=4 ff=unix fenc=utf8:
# Author: Binux<i@binux.me>
# http://binux.me
# Created on 2012-11-06 11:50:13
import logging
import hashlib
import datetime
import base64
import six
from six import iteritems
md5string = lambda x: hashlib.md5(ut... | apache-2.0 |
yuyu2172/chainercv | tests/chainer_experimental_tests/datasets_tests/sliceable_tests/test_getter_dataset.py | 3 | 3860 | import numpy as np
import unittest
from chainercv.chainer_experimental.datasets.sliceable import GetterDataset
from chainercv.utils import testing
class SampleDataset(GetterDataset):
def __init__(self, iterable=tuple):
super(SampleDataset, self).__init__()
self.add_getter('item0', self.get_item0... | mit |
dou800/php-buildpack-legacy | builds/runtimes/python-2.7.6/lib/python2.7/lib2to3/fixes/fix_metaclass.py | 153 | 8214 | """Fixer for __metaclass__ = X -> (metaclass=X) methods.
The various forms of classef (inherits nothing, inherits once, inherints
many) don't parse the same in the CST so we look at ALL classes for
a __metaclass__ and if we find one normalize the inherits to all be
an arglist.
For one-liner classes ('c... | mit |
nvoron23/hue | desktop/core/ext-py/tablib-develop/tablib/packages/openpyxl/reader/excel.py | 61 | 4259 | # file openpyxl/reader/excel.py
# 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, m... | apache-2.0 |
SoreGums/bitcoinxt | contrib/seeds/makeseeds.py | 188 | 5574 | #!/usr/bin/env python
#
# Generate seeds.txt from Pieter's DNS seeder
#
NSEEDS=512
MAX_SEEDS_PER_ASN=2
MIN_BLOCKS = 337600
# These are hosts that have been observed to be behaving strangely (e.g.
# aggressively connecting to every node).
SUSPICIOUS_HOSTS = set([
"130.211.129.106", "178.63.107.226",
"83.81.1... | mit |
andrewcmyers/tensorflow | tensorflow/contrib/linalg/python/kernel_tests/linear_operator_full_matrix_test.py | 41 | 9729 | # 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 |
jabesq/home-assistant | homeassistant/components/tuya/switch.py | 7 | 1134 | """Support for Tuya switches."""
from homeassistant.components.switch import ENTITY_ID_FORMAT, SwitchDevice
from . import DATA_TUYA, TuyaDevice
def setup_platform(hass, config, add_entities, discovery_info=None):
"""Set up Tuya Switch device."""
if discovery_info is None:
return
tuya = hass.data[... | apache-2.0 |
syhpoon/xyzcmd | libxyz/ui/cmd.py | 1 | 26667 | #-*- coding: utf8 -*
#
# Max E. Kuznecov ~syhpoon <syhpoon@syhpoon.name> 2008
#
# This file is part of XYZCommander.
# XYZCommander is free software: you can redistribute it and/or modify
# it under the terms of the GNU Lesser Public License as published by
# the Free Software Foundation, either version 3 of the Licens... | gpl-3.0 |
2014c2g5/2014c2 | w2/static/Brython2.0.0-20140209-164925/Lib/unittest/test/test_assertions.py | 738 | 15398 | import datetime
import warnings
import unittest
from itertools import product
class Test_Assertions(unittest.TestCase):
def test_AlmostEqual(self):
self.assertAlmostEqual(1.00000001, 1.0)
self.assertNotAlmostEqual(1.0000001, 1.0)
self.assertRaises(self.failureException,
... | gpl-2.0 |
RobbieL811/kernel_asus_flo | 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 |
multmeio/mongoforms_dfields | mongoforms_dfields/models.py | 1 | 1449 | from mongoengine import *
__all__ = ['DynamicFields', 'has_dfields']
def has_dfields(cls):
class new_cls(cls):
@property
def _dfields(self):
return DynamicFields._dfields(self.__class__.__name__)
#return new_cls
cls._dfields = DynamicFields._dfields(cls.__name__)
return ... | bsd-3-clause |
nasseralkmim/SaPy | sapy/plotter.py | 1 | 4743 | import matplotlib.pyplot as plt
from mpl_toolkits.mplot3d import Axes3D
from mpl_toolkits.mplot3d.art3d import Line3D
from matplotlib.lines import Line2D
import numpy as np
def window(name):
return plt.figure(name)
def show():
plt.show()
return None
def undeformed(model):
"""Plot the undeformed st... | gpl-3.0 |
KhronosGroup/COLLADA-CTS | StandardDataSets/1_5/collada/library_visual_scenes/visual_scene/node/lookat/node_lookat/node_lookat.py | 2 | 3873 |
# Copyright (c) 2012 The Khronos Group Inc.
# Permission is hereby granted, free of charge, to any person obtaining a copy of this software and /or associated documentation files (the "Materials "), to deal in the Materials without restriction, including without limitation the rights to use, copy, modify, merge, publ... | mit |
ardsu/bitcoin | qa/rpc-tests/maxblocksinflight.py | 128 | 3998 | #!/usr/bin/env python2
#
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
#
from test_framework.mininode import *
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import *
import logging
... | mit |
Rajeshkumar90/ansible-modules-extras | cloud/rackspace/rax_mon_notification_plan.py | 48 | 6222 | #!/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 |
hennersz/pySpace | basemap/doc/users/figures/omerc.py | 6 | 1065 | from mpl_toolkits.basemap import Basemap
import numpy as np
import matplotlib.pyplot as plt
# setup oblique mercator basemap.
# width is width of map projection region in km (xmax-xmin_
# height is height of map projection region in km (ymax-ymin)
# lon_0, lat_0 are the central longitude and latitude of the projection.... | gpl-3.0 |
Johnetordoff/osf.io | tests/test_mailchimp.py | 15 | 3860 | # -*- coding: utf-8 -*-
import mock
import pytest
from website import mailchimp_utils
from tests.base import OsfTestCase
from nose.tools import * # noqa; PEP8 asserts
from osf_tests.factories import UserFactory
import mailchimp
from framework.celery_tasks import handlers
@pytest.mark.enable_enqueue_task
class TestM... | apache-2.0 |
nikste/tensorflow | tensorflow/contrib/graph_editor/match.py | 186 | 5700 | # 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 |
MeteoSwiss-APN/dawn | dawn/examples/python/unstructured_stencil.py | 1 | 3291 | #!/usr/bin/env python
##===-----------------------------------------------------------------------------*- Python -*-===##
# _
# | |
# __| | __ ___ ___ ___
# / _` |/ _` \ \ /\ / / '_ |
# | (_| | (_| |\ V V /| | | |
# \__,_|\__,_| \_/\_/ |_| |_| - Compiler Toolchain
##
##
# This file is distributed under the MIT... | mit |
dunkhong/grr | grr/server/grr_response_server/cronjobs_test.py | 2 | 31447 | #!/usr/bin/env python
from __future__ import absolute_import
from __future__ import division
from __future__ import unicode_literals
import functools
import threading
from absl import app
from future.builtins import range
import mock
from grr_response_core.lib import rdfvalue
from grr_response_core.lib.rdfvalues imp... | apache-2.0 |
notriddle/servo | components/script/dom/bindings/codegen/parser/tests/test_unforgeable.py | 3 | 7169 | def WebIDLTest(parser, harness):
parser.parse("""
interface Child : Parent {
};
interface Parent {
[Unforgeable] readonly attribute long foo;
};
""")
results = parser.finish()
harness.check(len(results), 2,
"Should be a... | mpl-2.0 |
atsuyim/readthedocs.org | readthedocs/rtd_tests/tests/test_views.py | 21 | 9286 | from django.contrib.auth.models import User
from django.core.urlresolvers import reverse
from django.test import TestCase
from django.utils.six.moves.urllib.parse import urlsplit
from django_dynamic_fixture import get
from django_dynamic_fixture import new
from readthedocs.builds.constants import LATEST
from readthedo... | mit |
jlegendary/scikit-learn | examples/plot_multilabel.py | 87 | 4279 | # Authors: Vlad Niculae, Mathieu Blondel
# License: BSD 3 clause
"""
=========================
Multilabel classification
=========================
This example simulates a multi-label document classification problem. The
dataset is generated randomly based on the following process:
- pick the number of labels: n ... | bsd-3-clause |
40223112/2015cd_midterm | static/Brython3.1.0-20150301-090019/Lib/collections/abc.py | 739 | 16026 | # Copyright 2007 Google, Inc. All Rights Reserved.
# Licensed to PSF under a Contributor Agreement.
"""Abstract Base Classes (ABCs) for collections, according to PEP 3119.
Unit tests are in test_collections.
"""
from abc import ABCMeta, abstractmethod
import sys
__all__ = ["Hashable", "Iterable", "Iterator",
... | gpl-3.0 |
dhalleine/tensorflow | tensorflow/python/kernel_tests/matmul_op_test.py | 3 | 12431 | # 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 |
IronLanguages/ironpython2 | Src/StdLib/Lib/bisect.py | 1261 | 2595 | """Bisection algorithms."""
def insort_right(a, x, lo=0, hi=None):
"""Insert item x in list a, and keep it sorted assuming a is sorted.
If x is already in a, insert it to the right of the rightmost x.
Optional args lo (default 0) and hi (default len(a)) bound the
slice of a to be searched.
"""
... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.