repo_name stringlengths 5 100 | path stringlengths 4 375 | copies stringclasses 991
values | size stringlengths 4 7 | content stringlengths 666 1M | license stringclasses 15
values |
|---|---|---|---|---|---|
40223110/2015cd_midterm- | static/Brython3.1.0-20150301-090019/Lib/difflib.py | 737 | 82544 | #! /usr/bin/env python3
"""
Module difflib -- helpers for computing deltas between objects.
Function get_close_matches(word, possibilities, n=3, cutoff=0.6):
Use SequenceMatcher to return list of the best "good enough" matches.
Function context_diff(a, b):
For two lists of strings, return a delta in context ... | gpl-3.0 |
luxus/home-assistant | tests/helpers/test_entity.py | 7 | 1761 | """Test the entity helper."""
# pylint: disable=protected-access,too-many-public-methods
import unittest
import homeassistant.helpers.entity as entity
from homeassistant.const import ATTR_HIDDEN
from tests.common import get_test_home_assistant
class TestHelpersEntity(unittest.TestCase):
"""Test homeassistant.he... | mit |
wuzhihui1123/django-cms | cms/south_migrations/0024_added_placeholder_model.py | 1680 | 20032 | # -*- coding: utf-8 -*-
import datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
try:
from django.contrib.auth import get_user_model
except ImportError: # django < 1.5
from django.contrib.auth.models import User
else:
User = get_user_model()
user_orm_label... | bsd-3-clause |
Govexec/django-categories | categories/editor/utils.py | 13 | 4618 | """
Provides compatibility with Django 1.1
Copied from django.contrib.admin.util
"""
from django.forms.forms import pretty_name
from django.db import models
from django.db.models.related import RelatedObject
from django.utils.encoding import force_unicode, smart_unicode, smart_str
from django.utils.translation import ... | apache-2.0 |
HybridF5/jacket | jacket/api/compute/openstack/compute/legacy_v2/contrib/agents.py | 1 | 7972 | # Copyright 2012 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 agreed t... | apache-2.0 |
openshift/openshift-tools | openshift_tools/monitoring/gcputil.py | 13 | 3808 | #!/usr/bin/env python
# vim: expandtab:tabstop=4:shiftwidth=4
'''
Interface to gcloud
'''
#
# 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 |
elkingtonmcb/rethinkdb | external/re2_20140111/re2/make_unicode_casefold.py | 105 | 3603 | #!/usr/bin/python
# coding=utf-8
#
# Copyright 2008 The RE2 Authors. All Rights Reserved.
# Use of this source code is governed by a BSD-style
# license that can be found in the LICENSE file.
# See unicode_casefold.h for description of case folding tables.
"""Generate C++ table for Unicode case folding."""
import u... | agpl-3.0 |
yongshengwang/hue | build/env/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/contrib/gis/maps/google/zoom.py | 224 | 6622 | from django.contrib.gis.geos import GEOSGeometry, LinearRing, Polygon, Point
from django.contrib.gis.maps.google.gmap import GoogleMapException
from django.utils.six.moves import xrange
from math import pi, sin, log, exp, atan
# Constants used for degree to radian conversion, and vice-versa.
DTOR = pi / 180.
RTOD = 18... | apache-2.0 |
cwyark/micropython | py/makeqstrdata.py | 29 | 5496 | """
Process raw qstr file and output qstr data with length, hash and data bytes.
This script works with Python 2.6, 2.7, 3.3 and 3.4.
"""
from __future__ import print_function
import re
import sys
# Python 2/3 compatibility:
# - iterating through bytes is different
# - codepoint2name lives in a different module... | mit |
hobson/aima | aima/games.py | 3 | 10183 | """Games, or Adversarial Search. (Chapter 5)
"""
from utils import *
import random
#______________________________________________________________________________
# Minimax Search
def minimax_decision(state, game):
"""Given a state in a game, calculate the best move by searching
forward all the way to the te... | mit |
jamiefolsom/edx-platform | common/lib/capa/capa/tests/__init__.py | 129 | 2700 | """Tools for helping with testing capa."""
import gettext
import os
import os.path
import fs.osfs
from capa.capa_problem import LoncapaProblem, LoncapaSystem
from capa.inputtypes import Status
from mock import Mock, MagicMock
import xml.sax.saxutils as saxutils
TEST_DIR = os.path.dirname(os.path.realpath(__file__)... | agpl-3.0 |
yangminz/Semi-supervised_Embedding | src/utils/mnist_util.py | 1 | 3928 | # -*- coding: utf-8 -*-
"""
Created on Thu Feb 25 14:40:06 2016
load MNIST dataset
@author: liudiwei
"""
import numpy as np
import struct
import matplotlib.pyplot as plt
import os
class DataUtils(object):
"""MNIST数据集加载
输出格式为:numpy.array()
使用方法如下
from data_util import DataUtils
def main()... | gpl-3.0 |
wuyong2k/Stino | stino/pyarduino/arduino_project.py | 14 | 1725 | #!/usr/bin/env python
#-*- coding: utf-8 -*-
# 1. Copyright
# 2. Lisence
# 3. Author
"""
Documents
"""
from __future__ import absolute_import
from __future__ import print_function
from __future__ import division
from __future__ import unicode_literals
import os
from . import base
from . import arduino_src
class ... | mit |
vvv1559/intellij-community | python/lib/Lib/site-packages/django/http/__init__.py | 73 | 23818 | import datetime
import os
import re
import time
from pprint import pformat
from urllib import urlencode, quote
from urlparse import urljoin
try:
from cStringIO import StringIO
except ImportError:
from StringIO import StringIO
try:
# The mod_python version is more efficient, so try importing it first.
fr... | apache-2.0 |
cpcloud/blaze | blaze/compute/pydatetime.py | 16 | 6133 | from __future__ import absolute_import, division, print_function
from datetime import datetime, date, timedelta
import sys
def identity(x):
return x
def asday(dt):
if isinstance(dt, datetime):
return dt.date()
else:
return dt
def asweek(dt):
if isinstance(dt, datetime):
dt... | bsd-3-clause |
aronsky/home-assistant | homeassistant/components/feedreader.py | 5 | 8606 | """
Support for RSS/Atom feeds.
For more details about this component, please refer to the documentation at
https://home-assistant.io/components/feedreader/
"""
from datetime import datetime, timedelta
from logging import getLogger
from os.path import exists
from threading import Lock
import pickle
import voluptuous ... | apache-2.0 |
metadave/erln8.sublime | Erln8.py | 1 | 2779 | # ------------------------------------------------------------
# erln8.sublime: erln8 support for SublimeText2
#
# Copyright (c) 2015 Dave Parfitt
#
# This file is provided to you under the Apache License,
# Version 2.0 (the "License"); you may not use this file
# except in compliance with the License. You may obtain
... | apache-2.0 |
MadsackMediaStore/connector-magento | magentoerpconnect_pricing/product.py | 5 | 6776 | # -*- coding: utf-8 -*-
##############################################################################
#
# Author: Guewen Baconnier
# Copyright 2013 Camptocamp SA
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU Affero General Public License as
# pu... | agpl-3.0 |
huiyiqun/check_mk | cmk_base/config.py | 1 | 53500 | #!/usr/bin/env python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| ... | gpl-2.0 |
ex1usive-m4d/TemplateDocx | controllers/phpdocx/lib/openoffice/openoffice.org/basis3.4/program/python-core-2.6.1/lib/bsddb/dbtables.py | 39 | 30467 | #-----------------------------------------------------------------------
#
# Copyright (C) 2000, 2001 by Autonomous Zone Industries
# Copyright (C) 2002 Gregory P. Smith
#
# License: This is free software. You may use this software for any
# purpose including modification/redistribution, so long as
... | bsd-3-clause |
Mitali-Sodhi/recommendations | recommendations.py | 1 | 2781 | from math import sqrt
critics = {'Lisa Rose': {'Lady in the water':2.5, 'Snakes on a plane' : 3.5, 'Just my luck' : 3.0, 'Superman returns' : 3.5, 'You, Me and Dupree' : 2.5, 'The Night Listener' : 3.0},
'Gene Seymor' : {'Lady in the water' : 3.0, 'Snakes on a plane' : 3.5, 'Just my luck' : 1.5, 'Superman returns' : 5... | mit |
mrquim/mrquimrepo | repo/plugin.video.neptune-1.2.2/resources/lib/modules/jsunfuck.py | 5 | 9721 | #!/usr/bin/python
"""
Neptune Rising Add-on
Copyright (C) 2016 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) an... | gpl-2.0 |
pentestmonkey/pysecdump | framework/win32/lsasecretslive.py | 6 | 4282 | # This file is part of creddump.
#
# creddump 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.
#
# creddump is distributed in the hope t... | gpl-3.0 |
mpurzynski/MozDef | scripts/demo/populate_sample_events.py | 3 | 2497 | import glob
import os
import optparse
import random
import hjson
import time
from datetime import datetime
from mozdef_util.utilities.toUTC import toUTC
from mozdef_util.elasticsearch_client import ElasticsearchClient
def handle_event(event):
timestamp = toUTC(datetime.now()).isoformat()
event['timestamp'] =... | mpl-2.0 |
ypid-bot/check_mk | web/plugins/metrics/check_mk.py | 1 | 189295 | #!/usr/bin/python
# -*- encoding: utf-8; py-indent-offset: 4 -*-
# +------------------------------------------------------------------+
# | ____ _ _ __ __ _ __ |
# | / ___| |__ ___ ___| | __ | \/ | |/ / |
# | | | | '_ \ / _ \/ __| |/ /... | gpl-2.0 |
adrianholovaty/django | tests/regressiontests/utils/regex_helper.py | 33 | 1767 | from django.utils import regex_helper
from django.utils import unittest
class NormalizeTests(unittest.TestCase):
def test_empty(self):
pattern = r""
expected = [(u'', [])]
result = regex_helper.normalize(pattern)
self.assertEqual(result, expected)
def test_escape(self):
... | bsd-3-clause |
susansls/zulip | zerver/management/commands/bulk_change_user_name.py | 42 | 1299 | from __future__ import absolute_import
from __future__ import print_function
from typing import Any
from argparse import ArgumentParser
from django.core.management.base import BaseCommand
from zerver.lib.actions import do_change_full_name
from zerver.models import UserProfile, get_user_profile_by_email
class Comman... | apache-2.0 |
abhishekjairath/codeyard | commit/lib/python2.7/site-packages/setuptools/command/sdist.py | 149 | 8498 | import os
import re
import sys
from glob import glob
import pkg_resources
from distutils.command.sdist import sdist as _sdist
from distutils.util import convert_path
from distutils import log
from setuptools import svn_utils
READMES = ('README', 'README.rst', 'README.txt')
def walk_revctrl(dirname=''):
"""Find ... | mit |
DeepGnosis/keras | examples/antirectifier.py | 7 | 3321 | '''The example demonstrates how to write custom layers for Keras.
We build a custom activation layer called 'Antirectifier',
which modifies the shape of the tensor that passes through it.
We need to specify two methods: `get_output_shape_for` and `call`.
Note that the same result can also be achieved via a Lambda lay... | mit |
kevinsung/OpenFermion | src/openfermion/utils/_channel_state.py | 1 | 7442 | # 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 writing, software
# distribu... | apache-2.0 |
songmonit/CTTMSONLINE_V8 | addons/stock/tests/common.py | 247 | 4483 | # -*- coding: utf-8 -*-
from openerp.tests import common
class TestStockCommon(common.TransactionCase):
def setUp(self):
super(TestStockCommon, self).setUp()
self.ProductObj = self.env['product.product']
self.UomObj = self.env['product.uom']
self.PartnerObj = self.env['res.partn... | agpl-3.0 |
ganggas95/websen | websen/url.py | 1 | 3254 | from websen.helper.url_loader import url_mapper
'''
URL Untuk Admin
'''
url_mapper("/unauthorized",
"views.admin.admin_page.unauthorized", methods=['GET'])
url_mapper("/login",
"views.admin.admin_page.admin_login", methods=['GET', 'POST'])
url_mapper("/admin",
"view... | gpl-3.0 |
InspectorIncognito/visualization | AndroidRequests/migrations/0919_auto_20170427_2035.py | 1 | 1548 | # -*- coding: utf-8 -*-
# Generated by Django 1.11 on 2017-04-27 20:35
from __future__ import unicode_literals
from django.db import migrations, models
import django.db.models.deletion
class Migration(migrations.Migration):
dependencies = [
('AndroidRequests', '0918_transformation_reportinfo_user_latlon... | gpl-3.0 |
etataurov/pytest | testing/python/approx.py | 6 | 11104 | # encoding: utf-8
import sys
import pytest
import doctest
from pytest import approx
from operator import eq, ne
from decimal import Decimal
from fractions import Fraction
inf, nan = float('inf'), float('nan')
class MyDocTestRunner(doctest.DocTestRunner):
def __init__(self):
doctest.DocTestRunner.__init_... | mit |
ajbouh/tfi | src/tfi/driverbase/metaclass.py | 1 | 4417 | import inspect
import functools
from collections import OrderedDict
from tfi.parse.docstring import GoogleDocstring
def _resolve_instance_method_tensors(instance, fn, docstring=None):
def _expand_annotation(instance, annotation, default=None):
if annotation == inspect.Signature.empty:
return default... | mit |
labcodes/django | tests/pagination/tests.py | 7 | 14464 | import unittest
import warnings
from datetime import datetime
from django.core.paginator import (
EmptyPage, InvalidPage, PageNotAnInteger, Paginator,
UnorderedObjectListWarning,
)
from django.test import TestCase
from .custom import ValidAdjacentNumsPaginator
from .models import Article
class PaginationTes... | bsd-3-clause |
rplevka/robottelo | tests/foreman/virtwho/cli/test_hyperv.py | 1 | 6205 | """Test class for Virtwho Configure CLI
:Requirement: Virt-whoConfigurePlugin
:CaseAutomation: Automated
:CaseLevel: Acceptance
:CaseComponent: Virt-whoConfigurePlugin
:Assignee: kuhuang
:TestType: Functional
:CaseImportance: High
:Upstream: No
"""
import pytest
from fauxfactory import gen_string
from robottel... | gpl-3.0 |
maurofaccenda/ansible | lib/ansible/plugins/connection/accelerate.py | 36 | 13975 | # (c) 2012, 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 as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any lat... | gpl-3.0 |
yakovenkodenis/rethinkdb | external/v8_3.30.33.16/testing/gmock/gtest/test/gtest_shuffle_test.py | 3023 | 12549 | #!/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 of... | agpl-3.0 |
CydarLtd/ansible | lib/ansible/plugins/lookup/hashi_vault.py | 52 | 5795 | # (c) 2015, Jonathan Davila <jdavila(at)ansible.com>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any late... | gpl-3.0 |
pelya/commandergenius | project/jni/python/src/Lib/test/test_long_future.py | 56 | 2204 | from __future__ import division
# When true division is the default, get rid of this and add it to
# test_long.py instead. In the meantime, it's too obscure to try to
# trick just part of test_long into using future division.
import unittest
from test.test_support import run_unittest
class TrueDivisionTests(unittest... | lgpl-2.1 |
JulyKikuAkita/PythonPrac | cs15211/BinaryTreesWithFactors.py | 1 | 4600 | __source__ = 'https://leetcode.com/problems/binary-trees-with-factors/'
# Time: O(N ^2)
# Space: O(N)
#
# Description: Leetcode # 823. Binary Trees With Factors
#
# Given an array of unique integers, each integer is strictly greater than 1.
#
# We make a binary tree using these integers and each number may be used for... | apache-2.0 |
geometrybase/gensim | gensim/models/lda_worker.py | 53 | 4079 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
#
# Copyright (C) 2011 Radim Rehurek <radimrehurek@seznam.cz>
# Licensed under the GNU LGPL v2.1 - http://www.gnu.org/licenses/lgpl.html
"""
USAGE: %(program)s
Worker ("slave") process used in computing distributed LDA. Run this script \
on every node in your cluster.... | gpl-3.0 |
cheatos101/tapiriik | tapiriik/web/views/config/__init__.py | 16 | 2223 | from tapiriik.auth import User
from tapiriik.sync import Sync
from tapiriik.services import Service
from django.shortcuts import render, redirect
from django import forms
from django.http import HttpResponse
import json
def config_save(req, service):
if not req.user:
return HttpResponse(status=403)
c... | apache-2.0 |
bheesham/servo | python/mach/mach/main.py | 96 | 20555 | # 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/.
# This module provides functionality for the command-line build tool
# (mach). It is packaged as a module because everyt... | mpl-2.0 |
wchan/tensorflow | tensorflow/models/image/cifar10/cifar10_input_test.py | 18 | 2299 | # Copyright 2015 Google Inc. All Rights Reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or a... | apache-2.0 |
GiulianoFranchetto/zephyr | scripts/west_commands/runners/bossac.py | 1 | 2200 | # Copyright (c) 2017 Linaro Limited.
#
# SPDX-License-Identifier: Apache-2.0
'''bossac-specific runner (flash only) for Atmel SAM microcontrollers.'''
import platform
from runners.core import ZephyrBinaryRunner, RunnerCaps
DEFAULT_BOSSAC_PORT = '/dev/ttyACM0'
class BossacBinaryRunner(ZephyrBinaryRunner):
'''R... | apache-2.0 |
gunan/tensorflow | tensorflow/python/ops/ragged/ragged_util_test.py | 9 | 8267 | # Copyright 2018 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 |
dsoprea/PythonScheduler | setup.py | 1 | 1204 | import setuptools
import os
import scheduler
app_path = os.path.dirname(scheduler.__file__)
with open(os.path.join(app_path, 'resources', 'README.rst')) as f:
long_description = f.read()
with open(os.path.join(app_path, 'resources', 'requirements.txt')) as f:
install_requires = list(map(lambda s: s.stri... | gpl-2.0 |
jef-n/QGIS | tests/src/python/test_qgsserver_response.py | 45 | 2326 | # -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsServerResponse.
From build dir, run: ctest -R PyQgsServerResponse -V
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of t... | gpl-2.0 |
gtko/Sick-Beard | sickbeard/clients/requests/packages/urllib3/contrib/ntlmpool.py | 262 | 4740 | # urllib3/contrib/ntlmpool.py
# Copyright 2008-2012 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
"""
NTLM authenticating pool, contributed by erikcederstran
Issue #10, see: http://co... | gpl-3.0 |
40223137/w1717 | static/Brython3.1.0-20150301-090019/Lib/encodings/aliases.py | 726 | 15414 | """ Encoding Aliases Support
This module is used by the encodings package search function to
map encodings names to module names.
Note that the search function normalizes the encoding names before
doing the lookup, so the mapping will have to map normalized
encoding names to module names.
Con... | gpl-3.0 |
CoolDevelopment/MoshKernel-amami | scripts/rt-tester/rt-tester.py | 11005 | 5307 | #!/usr/bin/python
#
# rt-mutex tester
#
# (C) 2006 Thomas Gleixner <tglx@linutronix.de>
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License version 2 as
# published by the Free Software Foundation.
#
import os
import sys
import getopt
import sh... | gpl-2.0 |
thjashin/tensorflow | tensorflow/contrib/distributions/python/kernel_tests/beta_test.py | 34 | 13683 | # 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 |
balloob/github3.py | github3/__init__.py | 1 | 1966 | # -*- coding: utf-8 -*-
"""
github3
=======
See https://github3.readthedocs.io/ for documentation.
:copyright: (c) 2012-2016 by Ian Cordasco
:license: Modified BSD, see LICENSE for more details
"""
from .__about__ import (
__package_name__, __title__, __author__, __author_email__,
__license__, __copyright__... | bsd-3-clause |
nuagenetworks/vspk-python | vspk/v6/fetchers/nuvmresyncs_fetcher.py | 2 | 2107 | # -*- coding: utf-8 -*-
#
# Copyright (c) 2015, Alcatel-Lucent Inc, 2017 Nokia
# 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 copyrigh... | bsd-3-clause |
infant-cognition-tampere/gazelib-fixtures | tools/visualize.py | 2 | 1937 | # -*- coding: utf-8 -*-
'''
We use this file as an ad-hoc tool to visualize gazedata.
DEPRECATED: Use gazelib.visualization instead.
'''
import os
import gazelib
import bokeh.plotting as plotting
this_dir = os.path.dirname(os.path.realpath(__file__))
root_dir = os.path.dirname(this_dir)
source_dir = os.path.join(ro... | mit |
benjaminwhite/Gtasks | gtasks/task.py | 1 | 3569 | from __future__ import absolute_import
import re
from contextlib import contextmanager
import gtasks.timeconversion as tc
from gtasks.gtaskobject import GtaskObject
from gtasks.misc import raise_for_type
from gtasks.tasklist import TaskList
class Task(GtaskObject):
LIST_REGEX = re.compile('lists/(\w+)/tasks')
... | mit |
DHI-GRAS/processing_SWAT | SWATAlgorithm.py | 2 | 2557 | """
***************************************************************************
WG9HMAlgorithm.py
-------------------------------------
Copyright (C) 2014 TIGER-NET (www.tiger-net.org)
***************************************************************************
* This plugin is part of the Water Observation Info... | gpl-3.0 |
hchen1202/django-react | virtualenv/lib/python3.6/site-packages/pip/_vendor/cachecontrol/controller.py | 327 | 13024 | """
The httplib2 algorithms ported for use with requests.
"""
import logging
import re
import calendar
import time
from email.utils import parsedate_tz
from pip._vendor.requests.structures import CaseInsensitiveDict
from .cache import DictCache
from .serialize import Serializer
logger = logging.getLogger(__name__)
... | mit |
alexanderturner/ansible | lib/ansible/modules/cloud/openstack/os_project_facts.py | 5 | 4919 | #!/usr/bin/python
# Copyright (c) 2016 Hewlett-Packard Enterprise Corporation
#
# This module 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 ve... | gpl-3.0 |
frumiousbandersnatch/supybot-code | plugins/Todo/__init__.py | 15 | 2466 | ###
# Copyright (c) 2003-2005, Daniel DiPaolo
# 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 cond... | bsd-3-clause |
mattrobenolt/django | django/db/migrations/executor.py | 48 | 9843 | from __future__ import unicode_literals
from django.apps.registry import apps as global_apps
from django.db import migrations
from .loader import MigrationLoader
from .recorder import MigrationRecorder
from .state import ProjectState
class MigrationExecutor(object):
"""
End-to-end migration execution - load... | bsd-3-clause |
brianwoo/django-tutorial | build/Django/django/contrib/postgres/forms/hstore.py | 86 | 1422 | import json
from django import forms
from django.core.exceptions import ValidationError
from django.utils import six
from django.utils.translation import ugettext_lazy as _
__all__ = ['HStoreField']
class HStoreField(forms.CharField):
"""A field for HStore data which accepts JSON input."""
widget = forms.Te... | gpl-3.0 |
Mj258/weiboapi | srapyDemo/envs/Lib/site-packages/scrapy/utils/url.py | 17 | 3915 | """
This module contains general purpose URL functions not found in the standard
library.
Some of the functions that used to be imported from this module have been moved
to the w3lib.url module. Always import those from there instead.
"""
import posixpath
from six.moves.urllib.parse import (ParseResult, urlunparse, ur... | mit |
gauribhoite/personfinder | env/google_appengine/lib/requests/requests/packages/chardet/codingstatemachine.py | 2931 | 2318 | ######################## 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... | apache-2.0 |
smartdj/chrome-sync-server | google/protobuf/internal/type_checkers.py | 527 | 12163 | # Protocol Buffers - Google's data interchange format
# Copyright 2008 Google Inc. All rights reserved.
# http://code.google.com/p/protobuf/
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are
# met:
#
# * Redistributions o... | mit |
gaurav38/QosRouting | tests/unit/lib/mock_socket_test.py | 45 | 2309 | #!/usr/bin/env python
#
# Copyright 2011-2012 Andreas Wundsam
#
# 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 applic... | apache-2.0 |
ioram7/keystone-federado-pgid2013 | build/sqlalchemy-migrate/build/lib.linux-x86_64-2.7/migrate/tests/versioning/test_util.py | 29 | 3964 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
import os
from sqlalchemy import *
from migrate.exceptions import MigrateDeprecationWarning
from migrate.tests import fixture
from migrate.tests.fixture.warnings import catch_warnings
from migrate.versioning.util import *
import warnings
class TestUtil(fixture.Pathed):... | apache-2.0 |
Swind/pure-python-adb | test_async/test_connection_async.py | 1 | 1662 | """Unit tests for `ConnectionAsync` class.
"""
import asyncio
import sys
import unittest
from unittest.mock import patch
sys.path.insert(0, '..')
from ppadb.connection_async import ConnectionAsync
from .async_wrapper import awaiter
from .patchers import FakeStreamReader, FakeStreamWriter, async_patch
class Test... | mit |
kevinmel2000/brython | www/src/Lib/test/unittests/test_codeccallbacks.py | 28 | 33967 | import codecs
import html.entities
import sys
import test.support
import unicodedata
import unittest
import warnings
try:
import ctypes
except ImportError:
ctypes = None
SIZEOF_WCHAR_T = -1
else:
SIZEOF_WCHAR_T = ctypes.sizeof(ctypes.c_wchar)
class PosReturn:
# this can be used for configurable ca... | bsd-3-clause |
patrickwind/My_Blog | venv/lib/python2.7/site-packages/flask/ctx.py | 4 | 14199 | # -*- coding: utf-8 -*-
"""
flask.ctx
~~~~~~~~~
Implements the objects required to keep the context.
:copyright: (c) 2015 by Armin Ronacher.
:license: BSD, see LICENSE for more details.
"""
from __future__ import with_statement
import sys
from functools import update_wrapper
from werkzeug.excep... | gpl-2.0 |
nyaruka/smartmin | smartmin/users/views.py | 1 | 20916 | import random
import string
from datetime import timedelta
from django import forms
from django.conf import settings
from django.contrib import messages, auth
from django.contrib.auth import get_user_model
from django.contrib.auth.models import Group
from django.contrib.auth.views import LoginView
from django.core.mai... | bsd-3-clause |
arpitgoyaiitkgp/django-mongoengine | tests/views/urls.py | 4 | 5147 | from __future__ import absolute_import
from django.conf.urls import patterns, url
from django.views.decorators.cache import cache_page
from django_mongoengine.views import TemplateView
from . import views
urlpatterns = patterns('',
# TemplateView
(r'^template/no_template/$',
TemplateView.as_view())... | bsd-3-clause |
sodo13/openpli-gls | lib/python/Plugins/SystemPlugins/NFIFlash/downloader.py | 32 | 30705 | # -*- coding: utf-8 -*-
from Plugins.SystemPlugins.Hotplug.plugin import hotplugNotifier
from Screens.Screen import Screen
from Screens.MessageBox import MessageBox
from Screens.ChoiceBox import ChoiceBox
from Screens.HelpMenu import HelpableScreen
from Screens.TaskView import JobView
from Components.About import about... | gpl-2.0 |
NINAnor/QGIS | python/ext-libs/pygments/lexers/parsers.py | 363 | 25835 | # -*- coding: utf-8 -*-
"""
pygments.lexers.parsers
~~~~~~~~~~~~~~~~~~~~~~~
Lexers for parser generators.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexer, DelegatingLexer, \
include... | gpl-2.0 |
Jeff-Tian/mybnb | Python27/Lib/site-packages/pip/_vendor/distlib/metadata.py | 427 | 38314 | # -*- coding: utf-8 -*-
#
# Copyright (C) 2012 The Python Software Foundation.
# See LICENSE.txt and CONTRIBUTORS.txt.
#
"""Implementation of the Metadata for Python packages PEPs.
Supports all metadata formats (1.0, 1.1, 1.2, and 2.0 experimental).
"""
from __future__ import unicode_literals
import codecs
from email... | apache-2.0 |
yifanzh/ohmypaw | red.py | 1 | 22850 | import asyncio
import os
import sys
sys.path.insert(0, "lib")
import logging
import logging.handlers
import traceback
import datetime
import subprocess
try:
from discord.ext import commands
import discord
except ImportError:
print("Discord.py is not installed.\n"
"Consult the guide for your opera... | gpl-3.0 |
CloudVLab/professional-services | examples/tensorflow-unit-testing/example.py | 2 | 2853 | """Classes to demonstrate how to write unit tests for TensorFlow code."""
# Copyright 2020 Google Inc. All Rights Reserved.
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.a... | apache-2.0 |
nedlowe/amaas-core-sdk-python | amaascore/assets/private_investment.py | 2 | 6874 | from datetime import datetime, date
from dateutil.parser import parse
from decimal import Decimal
import sys
from amaascore.assets.asset import Asset
from amaascore.assets.enums import PRIVATE_INVESTMENT_CATEGORY, PRIVATE_INVESTMENT_SHARE_TYPE,\
PRIVATE_INVESTMENT_SUBCATEGORY
# This extremely ugly hack is due to ... | apache-2.0 |
dkodnik/arp | addons/base_report_designer/plugin/openerp_report_designer/bin/script/lib/functions.py | 89 | 11250 | ##########################################################################
#
# Copyright (c) 2003-2004 Danny Brewer d29583@groovegarden.com
# Copyright (C) 2004-2010 OpenERP SA (<http://openerp.com>).
#
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser Gener... | agpl-3.0 |
SnabbCo/neutron | neutron/plugins/cisco/nexus/cisco_nexus_plugin_v2.py | 3 | 15240 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Cisco Systems, 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... | apache-2.0 |
simdugas/childcare | languages/cs.py | 52 | 23580 | # coding: utf8
{
'!langcode!': 'cs-cz',
'!langname!': 'čeština',
'"update" is an optional expression like "field1=\'newvalue\'". You cannot update or delete the results of a JOIN': 'Kolonka "Upravit" je nepovinný výraz, například "pole1=\'nováhodnota\'". Výsledky databázového JOINu nemůžete mazat ani upravovat.',
... | gpl-2.0 |
Arcanemagus/SickRage | lib/validators/iban.py | 17 | 1167 | import re
from .utils import validator
regex = (
r'^[A-Z]{2}[0-9]{2}[A-Z0-9]{11,30}$'
)
pattern = re.compile(regex)
def char_value(char):
"""A=10, B=11, ..., Z=35
"""
if char.isdigit():
return int(char)
else:
return 10 + ord(char) - ord('A')
def modcheck(value):
"""Check if... | gpl-3.0 |
UUDigitalHumanitieslab/texcavator | services/management/commands/termvector_wordclouds.py | 2 | 3044 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
"""Generate word clouds based on termvectors for random sets of documents.
"""
import logging
from django.core.management.base import BaseCommand
from collections import Counter
import time
from services.es import _es
from services.models import DocID
from texcavator imp... | apache-2.0 |
onceuponatimeforever/oh-mainline | vendor/packages/scrapy/scrapy/tests/test_item.py | 24 | 3608 | import unittest
from scrapy.item import Item, Field
class ItemTest(unittest.TestCase):
def test_simple(self):
class TestItem(Item):
name = Field()
i = TestItem()
i['name'] = u'name'
self.assertEqual(i['name'], u'name')
def test_init(self):
class TestItem... | agpl-3.0 |
onceuponatimeforever/oh-mainline | vendor/packages/sphinx/tests/test_websupport.py | 22 | 9602 | # -*- coding: utf-8 -*-
"""
test_websupport
~~~~~~~~~~~~~~~
Test the Web Support Package
:copyright: Copyright 2007-2013 by the Sphinx team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import os
from StringIO import StringIO
try:
from functools import wraps
except ImportError:
... | agpl-3.0 |
Pablo126/SSBW | Entrega1/lib/python3.5/site-packages/rest_framework/relations.py | 5 | 19367 | # coding: utf-8
from __future__ import unicode_literals
from collections import OrderedDict
from django.core.exceptions import ImproperlyConfigured, ObjectDoesNotExist
from django.db.models import Manager
from django.db.models.query import QuerySet
from django.utils import six
from django.utils.encoding import (
... | gpl-3.0 |
dalf/searx | searx/engines/wordnik.py | 1 | 1991 | # SPDX-License-Identifier: AGPL-3.0-or-later
"""Wordnik (general)
"""
from lxml.html import fromstring
from searx import logger
from searx.utils import extract_text
from searx.network import raise_for_httperror
logger = logger.getChild('Wordnik engine')
# about
about = {
"website": 'https://www.wordnik.com',
... | agpl-3.0 |
asmltd/gosports | webapp/coach/views.py | 1 | 1584 | # -*- coding: utf-8 -*-
from __future__ import unicode_literals
from rest_framework.authentication import SessionAuthentication, BasicAuthentication
from rest_framework.generics import ListAPIView, RetrieveAPIView, RetrieveUpdateAPIView
from rest_framework.pagination import LimitOffsetPagination
from rest_framework.pe... | gpl-3.0 |
mlperf/training_results_v0.6 | Fujitsu/benchmarks/resnet/implementations/mxnet/python/mxnet/contrib/onnx/mx2onnx/_export_helper.py | 10 | 2340 | # 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 |
Workday/OpenFrame | net/data/name_constraints_unittest/generate_name_constraints.py | 8 | 18998 | #!/usr/bin/env python
# Copyright 2015 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 base64
import copy
import os
import random
import subprocess
import sys
import tempfile
sys.path += [os.path.join('..', 'verify... | bsd-3-clause |
btrent/knave | .buildozer/android/app/chesstools/piece.py | 2 | 10622 | #Forked from chesstools 0.1.8 by Mario Balibrera
from chesstools import COLORS
from chesstools.move import Move, to_algebraic, move_from_array
MOVES = { "Knight": [[-2,-1],[-1,-2],[2,-1],[1,-2],[-2,1],[-1,2],[2,1],[1,2]],
"Bishop": [[-1,-1],[-1,1],[1,-1],[1,1]],
"Rook": [[0,-1],[0,1],[-1,0],[1,0]... | gpl-3.0 |
markslwong/tensorflow | tensorflow/python/ops/accumulate_n_benchmark.py | 114 | 5470 | # 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 |
hachreak/invenio-oaiharvester | invenio_oaiharvester/api.py | 3 | 4392 | # -*- coding: utf-8 -*-
#
# This file is part of Invenio.
# Copyright (C) 2015 CERN.
#
# Invenio is free software; you can redistribute it and/or
# modify it under the terms of the GNU General Public License as
# published by the Free Software Foundation; either version 2 of the
# License, or (at your option) any later... | gpl-2.0 |
jolevq/odoopub | addons/website_forum/controllers/main.py | 12 | 31467 | # -*- coding: utf-8 -*-
from datetime import datetime
import werkzeug.urls
import werkzeug.wrappers
import simplejson
from openerp import tools
from openerp import SUPERUSER_ID
from openerp.addons.web import http
from openerp.addons.web.controllers.main import login_redirect
from openerp.addons.web.http import reques... | agpl-3.0 |
sinhrks/scikit-learn | sklearn/learning_curve.py | 30 | 14601 | """Utilities to evaluate models with respect to a variable
"""
# Author: Alexander Fabisch <afabisch@informatik.uni-bremen.de>
#
# License: BSD 3 clause
import warnings
import numpy as np
from .base import is_classifier, clone
from .cross_validation import check_cv
from .externals.joblib import Parallel, delayed
fro... | bsd-3-clause |
tkinz27/ansible | lib/ansible/plugins/callback/syslog_json.py | 136 | 2579 | import os
import json
import logging
import logging.handlers
import socket
from ansible.plugins.callback import CallbackBase
class CallbackModule(CallbackBase):
"""
logs ansible-playbook and ansible runs to a syslog server in json format
make sure you have in ansible.cfg:
callback_plugins = <p... | gpl-3.0 |
openembedded/openembedded | contrib/mtn2git/mtn/utility.py | 45 | 3593 |
import popen2
import select
import fcntl
import os
def set_nonblocking(fd):
fl = fcntl.fcntl(fd, fcntl.F_GETFL)
fcntl.fcntl(fd, fcntl.F_SETFL, fl | os.O_NDELAY)
def run_command(command, timeout=None, to_child=None):
"returns a tuple of (was_timeout, exit_code, data_read)"
p = popen2.Popen3(command, c... | mit |
adit-chandra/tensorflow | tensorflow/lite/testing/op_tests/depth_to_space.py | 4 | 2016 | # Copyright 2019 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.