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 |
|---|---|---|---|---|---|
django-nonrel/django | tests/get_object_or_404/models.py | 64 | 1135 | """
35. DB-API Shortcuts
``get_object_or_404()`` is a shortcut function to be used in view functions for
performing a ``get()`` lookup and raising a ``Http404`` exception if a
``DoesNotExist`` exception was raised during the ``get()`` call.
``get_list_or_404()`` is a shortcut function to be used in view functions for... | bsd-3-clause |
wood-galaxy/FreeCAD | src/Tools/WinVersion.py | 32 | 1198 | #! python
# -*- coding: utf-8 -*-
# (c) 2012 Juergen Riegel LGPL
#
# Script to create files used in Windows build
# uses SubWCRev.py for version detection#
import SubWCRev,getopt,sys,string
def main():
input=""
output="."
dir="."
try:
opts, args = getopt.getopt(sys.argv[1... | lgpl-2.1 |
zhukaixy/kbengine | kbe/src/lib/python/Lib/test/test_cmd.py | 74 | 6260 | """
Test script for the 'cmd' module
Original by Michael Schneider
"""
import cmd
import sys
import re
import unittest
import io
from test import support
class samplecmdclass(cmd.Cmd):
"""
Instance the sampleclass:
>>> mycmd = samplecmdclass()
Test for the function parseline():
>>> mycmd.parseli... | lgpl-3.0 |
x303597316/hue | desktop/core/ext-py/requests-2.6.0/requests/compat.py | 1039 | 1469 | # -*- coding: utf-8 -*-
"""
pythoncompat
"""
from .packages import chardet
import sys
# -------
# Pythons
# -------
# Syntax sugar.
_ver = sys.version_info
#: Python 2.x?
is_py2 = (_ver[0] == 2)
#: Python 3.x?
is_py3 = (_ver[0] == 3)
try:
import simplejson as json
except (ImportError, SyntaxError):
# si... | apache-2.0 |
djgagne/scikit-learn | sklearn/utils/multiclass.py | 83 | 12343 |
# Author: Arnaud Joly, Joel Nothman, Hamzeh Alsalhi
#
# License: BSD 3 clause
"""
Multi-class / multi-label utility function
==========================================
"""
from __future__ import division
from collections import Sequence
from itertools import chain
from scipy.sparse import issparse
from scipy.sparse.... | bsd-3-clause |
Yukarumya/Yukarum-Redfoxes | ipc/ipdl/ipdl/type.py | 1 | 55888 | # vim: set ts=4 sw=4 tw=99 et:
# This Source Code Form is subject to the terms of the Mozilla Public
# License, v. 2.0. If a copy of the MPL was not distributed with this
# file, You can obtain one at http://mozilla.org/MPL/2.0/.
import os, sys
from ipdl.ast import CxxInclude, Decl, Loc, QualifiedId, StructDecl
from ... | mpl-2.0 |
pwong-mapr/private-hue | tools/virtual-bootstrap/virtual-bootstrap.py | 2 | 69033 | #!/usr/bin/env python
# Licensed to Cloudera, Inc. under one
# or more contributor license agreements. See the NOTICE file
# distributed with this work for additional information
# regarding copyright ownership. Cloudera, Inc. licenses this file
# to you under the Apache License, Version 2.0 (the
# "License"); you ma... | apache-2.0 |
rizumu/django | django/conf/locale/fr/formats.py | 504 | 1454 | # -*- encoding: utf-8 -*-
# This file is distributed under the same license as the Django package.
#
from __future__ import unicode_literals
# The *_FORMAT strings use the Django date format syntax,
# see http://docs.djangoproject.com/en/dev/ref/templates/builtins/#date
DATE_FORMAT = 'j F Y'
TIME_FORMAT = 'H:i'
DATETI... | bsd-3-clause |
felixfontein/ansible | test/support/integration/plugins/modules/htpasswd.py | 13 | 8819 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, Nimbis Services, Inc.
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import absolute_import, division, print_function
__metaclass__ = type
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
adwiputra/LUMENS-repo | processing/algs/ftools/MeanCoords.py | 4 | 4343 | # -*- coding: utf-8 -*-
"""
***************************************************************************
MeanCoords.py
---------------------
Date : August 2012
Copyright : (C) 2012 by Victor Olaya
Email : volayaf at gmail dot com
****************************... | gpl-2.0 |
nhho/hko | hko/tide.py | 2 | 1239 | """A module to retrieve tide data from Hong Kong Observatory"""
import re
import requests
BASE_URL = 'http://pda.weather.gov.hk/'
URL = 'locspc/android_data/astro_tide.xml'
def tide():
"""A function to retrieve tide data from Hong Kong Observatory"""
response = {}
try:
data = requests.get(BA... | mit |
Vivek-anand-jain/ns3-aqm-blue | waf-tools/relocation.py | 78 | 2327 | #! /usr/bin/env python
# encoding: utf-8
"""
Waf 1.6
Try to detect if the project directory was relocated, and if it was,
change the node representing the project directory. Just call:
waf configure build
Note that if the project directory name changes, the signatures for the tasks using
files in that directory wi... | gpl-2.0 |
arjunbm13/youtube-dl | youtube_dl/extractor/vporn.py | 122 | 4218 | from __future__ import unicode_literals
import re
from .common import InfoExtractor
from ..utils import (
parse_duration,
str_to_int,
)
class VpornIE(InfoExtractor):
_VALID_URL = r'https?://(?:www\.)?vporn\.com/[^/]+/(?P<display_id>[^/]+)/(?P<id>\d+)'
_TESTS = [
{
'url': 'http://... | unlicense |
jna29/SymGP | symgp/superexpressions/supermatexpr.py | 1 | 46344 | import string
from typing import List, Union, Any, Tuple, Iterable
from sympy import MatrixSymbol, BlockMatrix, Symbol, Inverse, Transpose, MatMul, MatAdd, ZeroMatrix, \
MatrixExpr, S, Identity
from sympy.core.decorators import call_highest_priority
from sympy.strategies import (rm_id, unpack, typed, flatten, sort... | mit |
nafraf/spreads | spreadsplug/__init__.py | 5 | 2570 | # -*- coding: utf-8 -*-
# Copyright (C) 2014 Johannes Baiter <johannes.baiter@gmail.com>
#
# 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
# License, or (at your ... | agpl-3.0 |
dargor0/nocmodel | nocmodel/basicmodels/basic_protocol.py | 2 | 1508 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Basic Protocol model
#
# Author: Oscar Diaz
# Version: 0.1
# Date: 03-03-2011
#
# This code is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either... | lgpl-2.1 |
azaghal/django-wiki | src/wiki/plugins/macros/mdx/macro.py | 2 | 3192 | import re
import markdown
from django.template.loader import render_to_string
from django.utils.translation import gettext as _
from wiki.plugins.macros import settings
# See:
# http://stackoverflow.com/questions/430759/regex-for-managing-escaped-characters-for-items-like-string-literals
re_sq_short = r"'([^'\\]*(?:\... | gpl-3.0 |
yury-s/v8-inspector | Source/chrome/build/android/pylib/instrumentation/setup.py | 35 | 4043 | # Copyright 2013 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.
"""Generates test runner factory and tests for instrumentation tests."""
import logging
import os
from pylib import constants
from pylib import valgrind_to... | bsd-3-clause |
tusmechmes/K40_Whisperer | cubicsuperpath.py | 2 | 5240 | #!/usr/bin/env python
"""
cubicsuperpath.py
Copyright (C) 2005 Aaron Spike, aaron@ekips.org
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 l... | gpl-3.0 |
kornicameister/ansible-modules-extras | network/f5/bigip_irule.py | 9 | 10938 | #!/usr/bin/python
# -*- coding: utf-8 -*-
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
... | gpl-3.0 |
DNFcode/edx-platform | openedx/core/djangoapps/user_api/tests/test_views.py | 2 | 57016 | """Tests for the user API at the HTTP request level. """
import datetime
import base64
import json
import re
from django.conf import settings
from django.core.urlresolvers import reverse
from django.core import mail
from django.test import TestCase
from django.test.utils import override_settings
from unittest import ... | agpl-3.0 |
gregcarrart/shared-schedule | node_modules/meanio/node_modules/npm/node_modules/node-gyp/gyp/pylib/gyp/MSVSToolFile.py | 2736 | 1804 | # 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 project reader/writer."""
import gyp.common
import gyp.easy_xml as easy_xml
class Writer(object):
"""Visual Studio XML tool file writer."""
... | mit |
fhaoquan/kbengine | kbe/res/scripts/common/Lib/pickle.py | 67 | 55641 | """Create portable serialized representations of Python objects.
See module copyreg for a mechanism for registering custom picklers.
See module pickletools source for extensive comments.
Classes:
Pickler
Unpickler
Functions:
dump(object, file)
dumps(object) -> string
load(file) -> object
lo... | lgpl-3.0 |
cgcgbcbc/plustache | vendor/gtest-1.6.0/test/gtest_help_test.py | 2968 | 5856 | #!/usr/bin/env python
#
# Copyright 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... | mit |
lmesz/compose | compose/cli/command.py | 17 | 3804 | from __future__ import absolute_import
from __future__ import unicode_literals
import logging
import os
import re
import six
from requests.exceptions import ConnectionError
from requests.exceptions import SSLError
from . import errors
from . import verbose_proxy
from .. import __version__
from .. import config
from ... | apache-2.0 |
scollins83/deep-learning | face_generation/helper.py | 160 | 8114 | import math
import os
import hashlib
from urllib.request import urlretrieve
import zipfile
import gzip
import shutil
import numpy as np
from PIL import Image
from tqdm import tqdm
def _read32(bytestream):
"""
Read 32-bit integer from bytesteam
:param bytestream: A bytestream
:return: 32-bit integer
... | mit |
gamecredits-project/electrum-client | gui/qt/transaction_dialog.py | 6 | 10604 | #!/usr/bin/env python
#
# Electrum - lightweight Bitcoin client
# Copyright (C) 2012 thomasv@gitorious
#
# 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... | gpl-3.0 |
vadimtk/chrome4sdp | tools/telemetry/third_party/gsutilz/third_party/protorpc/demos/quotas/backend/quotas/services_test.py | 20 | 16384 | #!/usr/bin/env python
#
# Copyright 2010 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | bsd-3-clause |
gminds/rapidnewsng | django/contrib/localflavor/at/forms.py | 109 | 2551 | """
AT-specific Form helpers
"""
from __future__ import unicode_literals
import re
from django.core.validators import EMPTY_VALUES
from django.forms import ValidationError
from django.forms.fields import Field, RegexField, Select
from django.utils.translation import ugettext_lazy as _
re_ssn = re.compile(r'^\d{4} \d{... | bsd-3-clause |
elopio/snapcraft | tests/integration/plugins/test_copy_plugin.py | 1 | 1539 | # -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*-
#
# Copyright (C) 2015-2018 Canonical Ltd
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 3 as
# published by the Free Software Foundation.
#
# This program is distributed in ... | gpl-3.0 |
llhe/tensorflow | tensorflow/contrib/slim/python/slim/learning.py | 8 | 30004 | # 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 |
joeythesaint/yocto-autobuilder | lib/python2.7/site-packages/buildbot-0.8.8-py2.7.egg/buildbot/scripts/restart.py | 4 | 1094 | # 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 |
40423132/2016fallcadp_hw | plugin/liquid_tags/diag.py | 270 | 4096 | """
Blockdiag Tag
---------
This tag implements a liquid style tag for blockdiag [1]. You can use different
diagram types like blockdiag, seqdiag, packetdiag etc. [1]
[1] http://blockdiag.com/en/blockdiag/
Syntax
------
{% blockdiag {
<diagramm type> {
<CODE>
}
}
%}
Examples
-------... | agpl-3.0 |
candrews/portage | pym/_emerge/AbstractPollTask.py | 7 | 4164 | # Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
import array
import errno
import logging
import os
from portage.util import writemsg_level
from _emerge.AsynchronousTask import AsynchronousTask
class AbstractPollTask(AsynchronousTask):
__slots__ = ("schedul... | gpl-2.0 |
smacdo/Shiny | thirdparty/fmt/support/appveyor-build.py | 40 | 1632 | #!/usr/bin/env python
# Build the project on AppVeyor.
import os
from subprocess import check_call
build = os.environ['BUILD']
config = os.environ['CONFIGURATION']
platform = os.environ['PLATFORM']
path = os.environ['PATH']
image = os.environ['APPVEYOR_BUILD_WORKER_IMAGE']
jobid = os.environ['APPVEYOR_JOB_ID']
cmake_... | apache-2.0 |
erkrishna9/odoo | addons/l10n_be_hr_payroll/__init__.py | 438 | 1072 | # -*- encoding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2011 OpenERP SA (<http://openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the G... | agpl-3.0 |
zamattiac/osf.io | scripts/tests/test_triggered_mails.py | 31 | 2280 | import mock
from datetime import datetime, timedelta
from nose.tools import * # noqa
from tests.base import OsfTestCase
from tests.factories import UserFactory
from scripts.triggered_mails import main, find_inactive_users_with_no_inactivity_email_sent_or_queued
from website import mails
class TestTriggeredMails(OsfT... | apache-2.0 |
Ilhasoft/ureport | ureport/polls/migrations/0023_populate_flow_date.py | 2 | 1499 | # -*- coding: utf-8 -*-
from __future__ import absolute_import, division, print_function, unicode_literals
import logging
from temba_client.v2 import TembaClient
from django.conf import settings
from django.db import migrations
from ureport.utils import datetime_to_json_date, json_date_to_datetime
logger = logging... | agpl-3.0 |
b12io/orchestra | orchestra/json_schemas/todos.py | 2 | 2526 | import jsl
class PredicateSchema(jsl.Document):
"""
A predicate schema
Attributes:
operator (str):
Specify the compare operator of predicate.
Supported predicates are >, <, >=, <=, !=, and ==.
value (number, bool, sring, or None):
The value to compare w... | apache-2.0 |
zycdragonball/tensorflow | tensorflow/python/kernel_tests/distributions/bernoulli_test.py | 49 | 11202 | # 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 |
befair/gasistafelice | gasistafelice/rest/views/blocks/balance_pact.py | 3 | 2719 | """View for economic block specialized for a GASSupplierSolidalPact and GASSupplierOrder"""
from django.utils.translation import ugettext, ugettext_lazy as _
from django.http import HttpResponse
from django.db import transaction
from flexi_auth.models import ObjectWithContext
from lib.shortcuts import render_to_xml_... | agpl-3.0 |
sarvex/tensorflow | tensorflow/python/framework/is_tfrt_test_true.py | 15 | 1267 | # Copyright 2020 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 |
lynchMeng/weevely3 | modules/file/check.py | 14 | 2740 | from core.vectors import PhpCode
from core.module import Module
from core import messages
import random
import datetime
class Check(Module):
"""Get remote file information."""
def init(self):
self.register_info(
{
'author': [
'Emilio Pinna'
... | gpl-3.0 |
amisrs/one-eighty | angular_flask/lib/python2.7/site-packages/pip/exceptions.py | 344 | 8121 | """Exceptions used throughout package"""
from __future__ import absolute_import
from itertools import chain, groupby, repeat
from pip._vendor.six import iteritems
class PipError(Exception):
"""Base pip exception"""
class InstallationError(PipError):
"""General exception during installation"""
class Unin... | mit |
lz1988/django-web | build/lib/django/contrib/localflavor/jp/forms.py | 194 | 1257 | """
JP-specific Form helpers
"""
from __future__ import absolute_import
from django.contrib.localflavor.jp.jp_prefectures import JP_PREFECTURES
from django.forms.fields import RegexField, Select
from django.utils.translation import ugettext_lazy as _
class JPPostalCodeField(RegexField):
"""
A form field tha... | apache-2.0 |
fabiansinz/datajoint-python | tests/test_relation.py | 1 | 8595 | from inspect import getmembers
import re
import numpy as np
from nose.tools import assert_equal, assert_not_equal, assert_true, assert_list_equal, raises
from pymysql import IntegrityError, InternalError, ProgrammingError
import datajoint as dj
from datajoint import utils, DataJointError
from datajoint.base_relation i... | lgpl-2.1 |
phammin1/QaManagement | QaManagement/env/Lib/site-packages/django/middleware/clickjacking.py | 284 | 1989 | """
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... | mit |
tatiana/invesalius | invesalius/gui/import_panel.py | 1 | 17729 | #--------------------------------------------------------------------------
# Software: InVesalius - Software de Reconstrucao 3D de Imagens Medicas
# Copyright: (C) 2001 Centro de Pesquisas Renato Archer
# Homepage: http://www.softwarepublico.gov.br
# Contact: invesalius@cti.gov.br
# License: GNU ... | gpl-2.0 |
lemarcudal/sha_thedivision | test/Lib/site-packages/pip/_vendor/colorama/initialise.py | 485 | 1917 | # Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file.
import atexit
import contextlib
import sys
from .ansitowin32 import AnsiToWin32
orig_stdout = None
orig_stderr = None
wrapped_stdout = None
wrapped_stderr = None
atexit_done = False
def reset_all():
if AnsiToWin32 is not None: # Is... | apache-2.0 |
twatteyne/dustlink_academy | SmartMeshSDK/HrParser.py | 3 | 7027 | #!/usr/bin/python
import logging
class NullHandler(logging.Handler):
def emit(self, record):
pass
log = logging.getLogger('HrParser')
log.setLevel(logging.ERROR)
log.addHandler(NullHandler())
import struct
class HrParser(object):
HR_ID_DEVICE = 0x80
HR_ID_NEIGHBORS... | bsd-3-clause |
sahana/Turkey | modules/s3/s3translate.py | 4 | 66268 | # -*- coding: utf-8 -*-
""" Translation API
@copyright: 2012-15 (c) Sahana Software Foundation
@license: MIT
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
restr... | mit |
StanczakDominik/NumericalSchrodinger | SchrodingerEigenvectorsAnimated.py | 1 | 2104 | # Schrodinger 1D equation solved by finding eigenvectors of the hamiltonian
import numpy as np
import scipy
import scipy.integrate
import scipy.linalg
import scipy.misc
import scipy.special
import pylab as plt
from mpl_toolkits.mplot3d import Axes3D
from matplotlib import animation
l = 10
N = 1024
def v(x):
retu... | mit |
rchicoli/samba | python/samba/tests/samba_tool/timecmd.py | 42 | 1932 | # Unix SMB/CIFS implementation.
# Copyright (C) Sean Dague <sdague@linux.vnet.ibm.com> 2011
#
# 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 optio... | gpl-3.0 |
danieljaouen/ansible | lib/ansible/modules/monitoring/zabbix/zabbix_group_facts.py | 15 | 4403 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) me@mimiko.me
# 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... | gpl-3.0 |
Designist/audacity | lib-src/lv2/lv2/plugins/eg-metro.lv2/waflib/Tools/suncxx.py | 196 | 1487 | #! /usr/bin/env python
# encoding: utf-8
# WARNING! Do not edit! http://waf.googlecode.com/git/docs/wafbook/single.html#_obtaining_the_waf_file
import os
from waflib import Utils
from waflib.Tools import ccroot,ar
from waflib.Configure import conf
@conf
def find_sxx(conf):
v=conf.env
cc=None
if v['CXX']:cc=v['CXX']... | gpl-2.0 |
HTC-MSM8916/android_kernel_htc_msm8916 | tools/perf/scripts/python/futex-contention.py | 11261 | 1486 | # futex contention
# (c) 2010, Arnaldo Carvalho de Melo <acme@redhat.com>
# Licensed under the terms of the GNU GPL License version 2
#
# Translation of:
#
# http://sourceware.org/systemtap/wiki/WSFutexContention
#
# to perf python scripting.
#
# Measures futex contention
import os, sys
sys.path.append(os.environ['PER... | gpl-2.0 |
bgris/ODL_bgris | lib/python3.5/site-packages/networkx/readwrite/json_graph/tree.py | 58 | 4358 | # Copyright (C) 2011 by
# Aric Hagberg <hagberg@lanl.gov>
# Dan Schult <dschult@colgate.edu>
# Pieter Swart <swart@lanl.gov>
# All rights reserved.
# BSD license.
from itertools import chain, count
import networkx as nx
from networkx.utils import make_str
__author__ = """Aric Hagberg (hagberg@lanl.gov... | gpl-3.0 |
aaronorosen/nox | src/nox/lib/packet/t/dns_parse_test.py | 10 | 5255 | # Copyright 2008 (C) Nicira, Inc.
#
# This file is part of NOX.
#
# NOX 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.
#
# NOX is d... | gpl-3.0 |
pataquets/namecoin-core | test/functional/name_utxo.py | 2 | 2478 | #!/usr/bin/env python3
# Copyright (c) 2018 Daniel Kraft
# Distributed under the MIT/X11 software license, see the accompanying
# file COPYING or http://www.opensource.org/licenses/mit-license.php.
# Tests the interaction between names and the UTXO set.
from test_framework.names import NameTestFramework
from test_fra... | mit |
bilbeyt/ituro_website | ituro_website/pages/migrations/0001_initial.py | 1 | 4335 | # -*- coding: utf-8 -*-
# Generated by Django 1.9.2 on 2016-02-03 14:46
from __future__ import unicode_literals
import ckeditor.fields
import ckeditor_uploader.fields
from django.db import migrations, models
import django.db.models.deletion
import pages.models
class Migration(migrations.Migration):
initial = Tr... | mit |
nemonik/Intellect | intellect/examples/testing/ExerciseGrammar.py | 2 | 3303 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
Copyright (c) 2011, The MITRE Corporation.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyri... | bsd-3-clause |
SUSE/azure-sdk-for-python | azure-servicefabric/azure/servicefabric/models/validation_failed_chaos_event.py | 2 | 1319 | # coding=utf-8
# --------------------------------------------------------------------------
# Copyright (c) Microsoft Corporation. All rights reserved.
# Licensed under the MIT License. See License.txt in the project root for
# license information.
#
# Code generated by Microsoft (R) AutoRest Code Generator.
# Changes ... | mit |
nathanial/lettuce | tests/integration/lib/Django-1.2.5/django/contrib/gis/utils/ogrinfo.py | 389 | 1973 | """
This module includes some utility functions for inspecting the layout
of a GDAL data source -- the functionality is analogous to the output
produced by the `ogrinfo` utility.
"""
from django.contrib.gis.gdal import DataSource
from django.contrib.gis.gdal.geometries import GEO_CLASSES
def ogrinfo(data_source, num_... | gpl-3.0 |
mikedanese/test-infra | gubernator/gcs_async_test.py | 14 | 3666 | # Copyright 2016 The Kubernetes Authors.
#
# 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 ... | apache-2.0 |
HuaweiSwitch/ansible | lib/ansible/modules/system/gluster_volume.py | 69 | 17013 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2014, Taneli Leppä <taneli@crasman.fi>
#
# This file is part of Ansible (sort of)
#
# 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 o... | gpl-3.0 |
pmitros/pyfs | fs/browsewin.py | 15 | 6214 | #!/usr/bin/env python
"""
fs.browsewin
============
Creates a window which can be used to browse the contents of a filesystem.
To use, call the 'browse' method with a filesystem object. Double click a file
or directory to display its properties.
Requires wxPython.
"""
import wx
import wx.gizmos
from fs.path import... | bsd-3-clause |
qrkourier/ansible | test/units/modules/network/f5/test_bigip_iapp_template.py | 51 | 6377 | # -*- coding: utf-8 -*-
#
# Copyright 2017 F5 Networks Inc.
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) a... | gpl-3.0 |
quozl/sugar-toolkit-gtk3 | examples/gtktreesensitive.py | 2 | 1239 | #!/usr/bin/python
from gi.repository import Gtk
import common
test = common.Test()
test.show()
class MyBox(Gtk.Box):
def __init__(self):
Gtk.Box.__init__(self, orientation=Gtk.Orientation.VERTICAL)
scrolled = Gtk.ScrolledWindow()
scrolled.set_policy(Gtk.PolicyType.AUTOMATIC,
... | lgpl-2.1 |
DataDog/moto | tests/test_dynamodb2/test_dynamodb_table_without_range_key.py | 2 | 10418 | from __future__ import unicode_literals
import six
import boto
import sure # noqa
from freezegun import freeze_time
from boto.exception import JSONResponseError
from moto import mock_dynamodb2
from tests.helpers import requires_boto_gte, py3_requires_boto_gte
try:
from boto.dynamodb2.fields import HashKey
from... | apache-2.0 |
clan2000/data-science-from-scratch | code/ch05_statistics.py | 60 | 5779 | from __future__ import division
from collections import Counter
from linear_algebra import sum_of_squares, dot
import math
num_friends = [100,49,41,40,25,21,21,19,19,18,18,16,15,15,15,15,14,14,13,13,13,13,12,12,11,10,10,10,10,10,10,10,10,10,10,10,10,10,10,10,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,9,8,8,8,8,8,8,8,8,8,8,8,8,... | unlicense |
kennethgillen/ansible | lib/ansible/plugins/callback/hipchat.py | 87 | 6126 | # (C) 2014, Matt Martz <matt@sivel.net>
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
#... | gpl-3.0 |
kromain/chromium-tools | git_new_branch.py | 5 | 1948 | #!/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.
import argparse
import sys
import subprocess2
from git_common import run, root, set_config, get_or_create_merge_base, tags
from git_c... | bsd-3-clause |
gennad/www_gennad_org | django/db/backends/__init__.py | 77 | 31617 | import decimal
try:
import thread
except ImportError:
import dummy_thread as thread
from threading import local
from django.conf import settings
from django.db import DEFAULT_DB_ALIAS
from django.db.backends import util
from django.db.transaction import TransactionManagementError
from django.utils import datet... | bsd-3-clause |
extertioner/django-remote-forms | django_remote_forms/widgets.py | 7 | 7767 | import datetime
from django.utils.dates import MONTHS
from django.utils.datastructures import SortedDict
class RemoteWidget(object):
def __init__(self, widget, field_name=None):
self.field_name = field_name
self.widget = widget
def as_dict(self):
widget_dict = SortedDict()
wi... | mit |
slevenhagen/odoo-npg | addons/account_analytic_default/account_analytic_default.py | 256 | 8118 | # -*- 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 GN... | agpl-3.0 |
Alberto-Beralix/Beralix | i386-squashfs-root/usr/share/pyshared/twisted/test/test_dirdbm.py | 18 | 6006 | # Copyright (c) Twisted Matrix Laboratories.
# See LICENSE for details.
"""
Test cases for dirdbm module.
"""
import os, shutil, glob
from twisted.trial import unittest
from twisted.persisted import dirdbm
class DirDbmTestCase(unittest.TestCase):
def setUp(self):
self.path = self.mktemp()
sel... | gpl-3.0 |
pvital/patchew | schema.py | 2 | 1877 | #!/usr/bin/env python3
#
# Copyright 2016 Red Hat, Inc.
#
# Authors:
# Fam Zheng <famz@redhat.com>
#
# This work is licensed under the MIT License. Please see the LICENSE file or
# http://opensource.org/licenses/MIT.
"""Data schema classes"""
class Schema(object):
def __init__(self, name, title=None, desc=N... | mit |
patcon/open-cabinet | venv/lib/python2.7/site-packages/django/core/management/commands/sqlmigrate.py | 463 | 2715 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.core.management.base import BaseCommand, CommandError
from django.db import DEFAULT_DB_ALIAS, connections
from django.db.migrations.executor import MigrationExecutor
from django.db.migrations.loader import AmbiguityError
class Command(BaseCo... | mit |
ericlink/adms-server | playframework-dist/play-1.1/python/Lib/inspect.py | 2 | 36612 | # -*- coding: iso-8859-1 -*-
"""Get useful information from live Python objects.
This module encapsulates the interface provided by the internal special
attributes (func_*, co_*, im_*, tb_*, etc.) in a friendlier fashion.
It also provides some help for examining source code and class layout.
Here are some of t... | mit |
plasticbrain/sensu-community-plugins | plugins/aws/check_vpc_vpn.py | 56 | 1480 | #!/usr/bin/python
# #RED
import argparse
import boto.ec2
from boto.vpc import VPCConnection
import sys
def main():
try:
conn = boto.vpc.VPCConnection(aws_access_key_id=args.aws_access_key_id, aws_secret_access_key=args.aws_secret_access_key, region=boto.ec2.get_region(args.region))
except:
pr... | mit |
wpoa/wiki-imports | lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/util.py | 248 | 21407 | # urllib3/util.py
# Copyright 2008-2013 Andrey Petrov and contributors (see CONTRIBUTORS.txt)
#
# This module is part of urllib3 and is released under
# the MIT License: http://www.opensource.org/licenses/mit-license.php
from base64 import b64encode
from binascii import hexlify, unhexlify
from collections import name... | gpl-3.0 |
vikingMei/mxnet | example/image-classification/train_cifar10.py | 41 | 2423 | # 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 |
BeegorMif/HTPC-Manager | lib/unidecode/__init__.py | 103 | 1852 | # -*- coding: utf-8 -*-
"""Transliterate Unicode text into plain 7-bit ASCII.
Example usage:
>>> from unidecode import unidecode:
>>> unidecode(u"\u5317\u4EB0")
"Bei Jing "
The transliteration uses a straightforward map, and doesn't have alternatives
for the same character based on language, position, or anything els... | gpl-3.0 |
apmichaud/vitess-apm | py/cbson/test_cbson_bad_data.py | 8 | 1785 | #!/usr/bin/python2.4
import base64
import binascii
import random
import sys
import unittest
import cbson
# These values were generated by test_random_segfaults and used to
# crash the decoder, before we fixed the issues.
# Only base64 encoded so they aren't a million characters long and/or full
# of escape sequences... | bsd-3-clause |
kartoza/geonode | geonode/geoserver/ows.py | 2 | 4612 | # -*- coding: utf-8 -*-
#########################################################################
#
# Copyright (C) 2016 OSGeo
#
# 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 ... | gpl-3.0 |
mwest1066/PrairieLearn | elements/pl-string-input/pl-string-input.py | 2 | 9787 | import lxml.html
from html import escape
import chevron
import math
import prairielearn as pl
import random
WEIGHT_DEFAULT = 1
CORRECT_ANSWER_DEFAULT = None
LABEL_DEFAULT = None
SUFFIX_DEFAULT = None
DISPLAY_DEFAULT = 'inline'
REMOVE_LEADING_TRAILING_DEFAULT = False
REMOVE_SPACES_DEFAULT = False
PLACEHOLDER_DEFAULT =... | agpl-3.0 |
blaggacao/OpenUpgrade | addons/portal/portal.py | 386 | 1361 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2011 OpenERP S.A (<http://www.openerp.com>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms ... | agpl-3.0 |
samithaj/headphones | lib/yaml/parser.py | 33 | 25530 |
# The following YAML grammar is LL(1) and is parsed by a recursive descent
# parser.
#
# stream ::= STREAM-START implicit_document? explicit_document* STREAM-END
# implicit_document ::= block_node DOCUMENT-END*
# explicit_document ::= DIRECTIVE* DOCUMENT-START block_node? DOCUMENT-END*
# block_node_or_inden... | gpl-3.0 |
iXueping/emoji4unicode | src/row_cell.py | 6 | 8201 | #!/usr/bin/python2.4
#
# Copyright 2008 Google Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law o... | apache-2.0 |
swharden/ROI-Analysis-Pipeline | pyROI/makeAllMicrographs.py | 1 | 3848 | import glob
import os
import subprocess
import sys
from PIL import Image
from PIL import ImageDraw
from PIL import ImageFont
from PIL import ImageEnhance
from PIL import ImageOps
import scipy.ndimage
import numpy as np
def image_convert(fname,saveAs=True,showToo=False):
"""
Convert weird TIF files into web-fri... | mit |
mbayon/TFG-MachineLearning | vbig/lib/python2.7/site-packages/scipy/interpolate/_fitpack_impl.py | 10 | 46541 | """
fitpack (dierckx in netlib) --- A Python-C wrapper to FITPACK (by P. Dierckx).
FITPACK is a collection of FORTRAN programs for curve and surface
fitting with splines and tensor product splines.
See
http://www.cs.kuleuven.ac.be/cwis/research/nalag/research/topics/fitpack.html
or
http://www.netlib.... | mit |
vimagick/youtube-dl | youtube_dl/extractor/c56.py | 162 | 1365 | # coding: utf-8
from __future__ import unicode_literals
import re
from .common import InfoExtractor
class C56IE(InfoExtractor):
_VALID_URL = r'https?://(?:(?:www|player)\.)?56\.com/(?:.+?/)?(?:v_|(?:play_album.+-))(?P<textid>.+?)\.(?:html|swf)'
IE_NAME = '56.com'
_TEST = {
'url': 'http://www.56.... | unlicense |
jinified/selam | selam/detect.py | 1 | 28769 | #!/usr/bin/env python
import cv2
import math
import numpy as np
from skimage.segmentation import slic
from skimage.segmentation import mark_boundaries
from skimage import img_as_float
# Custom class
import constant as c
from constant import Color
from preprocess import norm_illum_color
from camera import rect_to_distan... | mit |
mitdbg/aurum-datadiscovery | nearpy/hashes/permutation/permute.py | 1 | 2931 | # -*- coding: utf-8 -*-
# Copyright (c) 2013 Ole Krause-Sparmann
# 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,... | mit |
sakurahilljp/dojo | Factory/PythonFactory.py | 1 | 3191 | class PizzaStore(object):
def order_pizza(self, name):
print '==> You ordered "%s" pizza' % name
pizza = self._create_pizza(name)
if pizza is None:
return None
pizza.prepare()
pizza.bake()
pizza.cut()
pizza.box()
return pizza
def _cre... | mit |
mike2390/embox | mk/gensums.py | 4 | 1356 | #!/usr/bin/env python
import sys
import re
try:
# Python2
import md5
md5factory = md5.new
md5dig = lambda m: [ ord(x) for x in m.digest() ]
except ImportError:
# Python3
import hashlib
md5factory = hashlib.md5
md5dig = lambda m: list(m.digest())
def parse(file, sectname):
vmas = d... | bsd-2-clause |
gonicus/gosa | client/src/gosa/client/plugins/join/cli.py | 1 | 1335 | # This file is part of the GOsa framework.
#
# http://gosa-project.org
#
# Copyright:
# (C) 2016 GONICUS GmbH, Germany, http://www.gonicus.de
#
# See the LICENSE file in the project's top-level directory for details.
import time
import gettext
import getpass
from gosa.client.plugins.join.methods import join_method
f... | lgpl-2.1 |
asolfre/MultiStateAnimation | scripts/generate_animation_json.py | 5 | 4357 | #!/usr/bin/env python3
import argparse
import collections
import json
import pathlib
import re
import sys
class Spec(collections.OrderedDict):
"""An ordered defaultdict(dict)."""
def __missing__(self, key):
self[key] = ret = {}
return ret
# A list of image filetypes used to filter out hidden ... | apache-2.0 |
fernandog/Medusa | ext/yaml/tokens.py | 985 | 2573 |
class Token(object):
def __init__(self, start_mark, end_mark):
self.start_mark = start_mark
self.end_mark = end_mark
def __repr__(self):
attributes = [key for key in self.__dict__
if not key.endswith('_mark')]
attributes.sort()
arguments = ', '.join(['%s=... | gpl-3.0 |
jegger/kivy | kivy/uix/recycleview/views.py | 7 | 13895 | '''
RecycleView Views
=================
.. versionadded:: 1.10.0
The adapter part of the RecycleView which together with the layout is the
view part of the model-view-controller pattern.
The view module handles converting the data to a view using the adapter class
which is then displayed by the layout. A view can be... | mit |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.