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 |
|---|---|---|---|---|---|
ESOedX/edx-platform | cms/djangoapps/contentstore/management/commands/tests/test_git_export.py | 1 | 7739 | """
Unittests for exporting to git via management command.
"""
from __future__ import absolute_import
import copy
import os
import shutil
from six import StringIO
import subprocess
import unittest
from uuid import uuid4
import six
from django.conf import settings
from django.core.management import call_command
from ... | agpl-3.0 |
HalcyonChimera/osf.io | osf/utils/workflows.py | 4 | 2899 |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from enum import Enum
from enum import unique
@unique
class ChoiceEnum(Enum):
@classmethod
def choices(cls):
return tuple((v, unicode(v).title()) for v in cls.values())
@classmethod
def values(cls):
return tuple(c.value ... | apache-2.0 |
alxgu/ansible | lib/ansible/modules/network/junos/junos_system.py | 52 | 6186 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2017, Ansible by Red Hat, 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 |
tcstewar/ev3_minimal | test_pid.py | 3 | 1169 | import nengo
import numpy as np
import ev3link
import embodied_benchmarks as bench
if not hasattr(ev3link, 'link'):
ev3link.link = ev3link.EV3Link('10.42.0.3')
link = ev3link.link
path0 = '/sys/class/tacho-motor/motor0/'
link.write(path0 + 'command', 'run-direct')
link.write(path0 + 'position', '0')
print li... | gpl-2.0 |
eykd/blueprint | features/steps/tag_queries_steps.py | 2 | 2426 | # -*- coding: utf-8 -*-
"""queries -- tag query step definitions.
"""
from blueprint import taggables
@given(u'a tag repository with taggables in it')
def step(context):
repo = context.repo = taggables.TagRepository()
context.t1 = taggables.Taggable(repo, 't1', 'foo')
context.t2 = taggables.Taggable(repo,... | mit |
talon-one/talon_one.py | test/test_loyalty_program.py | 1 | 2611 | # coding: utf-8
"""
Talon.One API
The Talon.One API is used to manage applications and campaigns, as well as to integrate with your application. The operations in the _Integration API_ section are used to integrate with our platform, while the other operations are used to manage applications and campaigns. #... | mit |
andrewleech/SickRage | lib/hachoir_core/field/seekable_field_set.py | 74 | 3147 | from hachoir_core.field import BasicFieldSet, GenericFieldSet, ParserError, createRawField
from hachoir_core.error import HACHOIR_ERRORS
# getgaps(int, int, [listof (int, int)]) -> generator of (int, int)
# Gets all the gaps not covered by a block in `blocks` from `start` for `length` units.
def getgaps(start, length,... | gpl-3.0 |
hwsyy/scrapy | tests/test_responsetypes.py | 97 | 3803 | import unittest
from scrapy.responsetypes import responsetypes
from scrapy.http import Response, TextResponse, XmlResponse, HtmlResponse, Headers
class ResponseTypesTest(unittest.TestCase):
def test_from_filename(self):
mappings = [
('data.bin', Response),
('file.txt', TextRespons... | bsd-3-clause |
NeovaHealth/odoo | addons/hr_holidays/__init__.py | 442 | 1094 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
ty707/airflow | airflow/example_dags/example_branch_python_dop_operator_3.py | 16 | 1758 | # -*- coding: utf-8 -*-
#
# 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
... | apache-2.0 |
eeshangarg/oh-mainline | vendor/packages/gdata/tests/gdata_tests/projecthosting/live_client_test.py | 41 | 8517 | #!/usr/bin/env python
#
# Copyright (C) 2009 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 ... | agpl-3.0 |
Azure/azure-sdk-for-python | sdk/resources/azure-mgmt-resource/azure/mgmt/resource/resources/v2016_02_01/aio/_configuration.py | 1 | 3218 | # 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 may ... | mit |
MiltosD/CEF-ELRC | lib/python2.7/site-packages/django/utils/encoding.py | 71 | 7294 | import types
import urllib
import locale
import datetime
import codecs
from decimal import Decimal
from django.utils.functional import Promise
class DjangoUnicodeDecodeError(UnicodeDecodeError):
def __init__(self, obj, *args):
self.obj = obj
UnicodeDecodeError.__init__(self, *args)
def __str_... | bsd-3-clause |
palmerjh/iEBE | EBE-Node/iSS/for_paraview/lib/LookupTable.py | 9 | 2030 | #!/usr/bin/env python
"""
LookupTable
"""
"""
Copyright 2001 Pearu Peterson all rights reserved,
Pearu Peterson <pearu@ioc.ee>
Permission to use, modify, and distribute this software is given under the
terms of the LGPL. See http://www.fsf.org
NO WARRANTY IS EXPRESSED OR IMPLIED. USE AT YOUR OWN RISK.
$Re... | gpl-3.0 |
MediaBrowser/MediaBrowser.Kodi | resources/lib/List.py | 2 | 76828 | import xbmc
import xbmcgui
import xbmcaddon
import xbmcplugin
import os
import json
import threading
import sys
from datetime import datetime
import urllib
from DownloadUtils import DownloadUtils
from Database import Database
from urlparse import urlparse
from API import API
logLevel = 1
__settings__ = xbmcaddon.Add... | gpl-2.0 |
taaviteska/django | tests/template_tests/filter_tests/test_linebreaksbr.py | 92 | 1734 | from django.template.defaultfilters import linebreaksbr
from django.test import SimpleTestCase
from django.utils.safestring import mark_safe
from ..utils import setup
class LinebreaksbrTests(SimpleTestCase):
"""
The contents in "linebreaksbr" are escaped according to the current
autoescape setting.
"... | bsd-3-clause |
codrut3/tensorflow | tensorflow/python/pywrap_tensorflow.py | 33 | 3219 | # Copyright 2017 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 |
tklaus/ansible | lib/ansible/plugins/lookup/env.py | 251 | 1071 | # (c) 2012, Jan-Piet Mens <jpmens(at)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 later ver... | gpl-3.0 |
tboyce021/home-assistant | tests/components/alexa/test_init.py | 14 | 2397 | """Tests for alexa."""
from homeassistant.components import logbook
from homeassistant.components.alexa.const import EVENT_ALEXA_SMART_HOME
from homeassistant.setup import async_setup_component
from tests.components.logbook.test_init import MockLazyEventPartialState
async def test_humanify_alexa_event(hass):
"""... | apache-2.0 |
mssalvador/WorkflowCleaning | test/shared/test_parser.py | 1 | 1669 | from unittest import TestCase
from shared.ParseLogFiles import convert, split_logfile, pairwise
class TestConvert(TestCase):
def setUp(self):
self.test_case_1 = [1,'h']
self.test_case_2 = [1,'h', 23, 'min']
self.test_case_3 = [32,'h', 33, 'min', 59, 's']
def test_convert(self):
... | apache-2.0 |
neurodata/spdb | ndcube/timecubeI8.py | 1 | 2876 | # Copyright 2014 NeuroData (http://neurodata.io)
#
# 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... | apache-2.0 |
jstoxrocky/statsmodels | statsmodels/tools/_testing.py | 29 | 4809 | """Testing helper functions
Warning: current status experimental, mostly copy paste
Warning: these functions will be changed without warning as the need
during refactoring arises.
The first group of functions provide consistency checks
"""
import numpy as np
from numpy.testing import assert_allclose, assert_
from ... | bsd-3-clause |
yfauser/ansible-modules-extras | messaging/rabbitmq_queue.py | 78 | 9505 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2015, Manuel Sousa <manuel.sousa@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... | gpl-3.0 |
temyers/selenium | py/selenium/webdriver/ie/webdriver.py | 55 | 2093 | #!/usr/bin/python
#
# Copyright 2008-2013 Software freedom conservancy
#
# 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 b... | apache-2.0 |
csyonghe/slang | external/vulkan/registry/genvk.py | 2 | 25381 | #!/usr/bin/python3
#
# Copyright (c) 2013-2020 The Khronos Group Inc.
#
# SPDX-License-Identifier: Apache-2.0
import argparse
import pdb
import re
import sys
import time
import xml.etree.ElementTree as etree
from cgenerator import CGeneratorOptions, COutputGenerator
from docgenerator import DocGeneratorOptions, DocOu... | mit |
oVirt/ovirt-engine-cli | src/ovirtcli/shell/removecmdshell.py | 1 | 2972 | #
# Copyright (c) 2010 Red Hat, Inc.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed t... | apache-2.0 |
Ernesto99/odoo | openerp/addons/base/ir/ir_values.py | 228 | 26238 | # -*- 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 |
solidgoldbomb/letsencrypt | letsencrypt/interfaces.py | 8 | 15000 | """Let's Encrypt client interfaces."""
import abc
import zope.interface
# pylint: disable=no-self-argument,no-method-argument,no-init,inherit-non-class
# pylint: disable=too-few-public-methods
class AccountStorage(object):
"""Accounts storage interface."""
__metaclass__ = abc.ABCMeta
@abc.abstractmetho... | apache-2.0 |
ghtmtt/QGIS | tests/src/python/test_qgslayoutatlasclippingsettings.py | 25 | 4663 | # -*- coding: utf-8 -*-
"""QGIS Unit tests for QgsLayoutItemMapAtlasClippingSettings.
.. note:: This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) an... | gpl-2.0 |
flwh/KK_mt6589_iq451 | prebuilts/python/darwin-x86/2.7.5/lib/python2.7/plat-mac/Carbon/OSAconst.py | 81 | 4599 | # Generated from 'OSA.h'
def FOUR_CHAR_CODE(x): return x
from Carbon.AppleEvents import *
kAEUseStandardDispatch = -1
kOSAComponentType = FOUR_CHAR_CODE('osa ')
kOSAGenericScriptingComponentSubtype = FOUR_CHAR_CODE('scpt')
kOSAFileType = FOUR_CHAR_CODE('osas')
kOSASuite = FOUR_CHAR_CODE('ascr')
kOSARecordedText = FOUR... | gpl-2.0 |
brian-brazil/ansible-modules-extras | net_infrastructure/bigip_monitor_tcp.py | 33 | 16829 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# (c) 2013, serge van Ginderachter <serge@vanginderachter.be>
#
# This file is part of Ansible
#
# Ansible is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either vers... | gpl-3.0 |
virus-warnning/twag | commons/smart_http.py | 2 | 1720 | import json
import requests
import urllib.parse
import logging.config
logger = logging.getLogger(__name__)
# 偵測 bs4 是否已安裝
try:
from bs4 import BeautifulSoup
BS4_INSTALLED = True
except ImportError:
logging.warn('bs4 is not installed.')
BS4_INSTALLED = False
# 選擇 etree
try:
from lxml import etree
LXML_INSTALLED... | apache-2.0 |
dgarros/ansible | hacking/tests/gen_distribution_version_testcase.py | 80 | 1878 | #!/usr/bin/env python
"""
This script generated test_cases for test_distribution_version.py.
To do so it outputs the relevant files from /etc/*release, the output of platform.dist() and the current ansible_facts regarding the distribution version.
This assumes a working ansible version in the path.
"""
import platf... | gpl-3.0 |
2015fallhw/cdw11 | static/plugin/liquid_tags/audio.py | 26 | 2236 | """
Audio Tag
---------
This implements a Liquid-style audio tag for Pelican,
based on the pelican video plugin [1]_
Syntax
------
{% audio url/to/audio [url/to/audio] [/url/to/audio] %}
Example
-------
{% audio http://example.tld/foo.mp3 http://example.tld/foo.ogg %}
Output
------
<audio controls><s... | agpl-3.0 |
111t8e/h2o-2 | py/testdir_single_jvm/test_rf1_fvec.py | 9 | 2446 | import unittest, time, sys
sys.path.extend(['.','..','../..','py'])
import h2o, h2o_cmd, h2o_import as h2i
class Basic(unittest.TestCase):
def tearDown(self):
h2o.check_sandbox_for_errors()
@classmethod
def setUpClass(cls):
h2o.init()
@classmethod
def tearDownClass(cls):
h... | apache-2.0 |
yashu-seth/networkx | networkx/generators/tests/test_atlas.py | 57 | 1923 | from nose.tools import *
from nose import SkipTest
class TestAtlas(object):
@classmethod
def setupClass(cls):
global atlas
import platform
if platform.python_implementation()=='Jython':
raise SkipTest('graph atlas not available under Jython.')
import networkx.generat... | bsd-3-clause |
funky81/android_kernel_n7000 | 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 |
inares/edx-platform | common/lib/xmodule/xmodule/modulestore/tests/utils.py | 12 | 16863 | """
Helper classes and methods for running modulestore tests without Django.
"""
import random
from contextlib import contextmanager, nested
from importlib import import_module
from opaque_keys.edx.keys import UsageKey
from path import Path as path
from shutil import rmtree
from tempfile import mkdtemp
from unittest i... | agpl-3.0 |
atados/api | atados_core/tests/test_routes/news/test_project.py | 1 | 4252 | # -*- coding: utf-8 -*-
from rest_framework.test import APITestCase
from django.core.urlresolvers import reverse
import json
from helpers import *
class ProjectsTest(APITestCase):
def test_list_project_view(self):
"""
"""
url = reverse('project-list')
#+ with self.assertNumQueries(1):
#+ response = sel... | mit |
jostep/tensorflow | tensorflow/contrib/learn/python/learn/learn_runner.py | 10 | 11551 | # 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 |
djm/django-contextual | contextual/tests/tests.py | 1 | 15991 | from django.core.exceptions import ImproperlyConfigured
from django.core.handlers.wsgi import WSGIRequest
from django.test import TestCase
from django.test import Client
from contextual.contextual_models import (HostnameTestModel, PathTestModel,
QueryStringTestModel, RefererTestModel, BrandedSearchRefererTest... | bsd-3-clause |
SheffieldML/GPy | GPy/plotting/matplot_dep/maps.py | 15 | 5721 | # Copyright (c) 2012, GPy authors (see AUTHORS.txt).
# Licensed under the BSD 3-clause license (see LICENSE.txt)
import numpy as np
try:
from matplotlib import pyplot as pb
from matplotlib.patches import Polygon
from matplotlib.collections import PatchCollection
#from matplotlib import cm
try:
... | bsd-3-clause |
googleads/google-ads-python | google/ads/googleads/v7/resources/types/operating_system_version_constant.py | 1 | 2668 | # -*- 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 or... | apache-2.0 |
TomTranter/OpenPNM | openpnm/io/OpenpnmIO.py | 1 | 8730 | import pickle
import time
from openpnm.utils import Workspace, Project
from openpnm.utils import logging
from openpnm.io import GenericIO
logger = logging.getLogger(__name__)
ws = Workspace()
class OpenpnmIO(GenericIO):
r"""
This class contains methods used for saving and loading OpenPNM Workspaces,
Proje... | mit |
tschorsch/nstor | src/mesh/bindings/callbacks_list.py | 138 | 2278 | callback_classes = [
['void', 'ns3::Mac48Address', 'ns3::Mac48Address', 'unsigned int', 'bool', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty', 'ns3::empty'],
['void', 'unsigned int', 'ns3::Mac48Address', 'ns3::Mac48Address', 'ns3::dot11s::PeerLink::PeerState', 'ns3::dot11s::PeerLink::PeerState', 'ns3::... | gpl-2.0 |
kemalakyol48/python-for-android | python3-alpha/python3-src/Lib/test/test_pstats.py | 175 | 1295 | import unittest
from test import support
from io import StringIO
import pstats
class AddCallersTestCase(unittest.TestCase):
"""Tests for pstats.add_callers helper."""
def test_combine_results(self):
# pstats.add_callers should combine the call results of both target
# and source by adding th... | apache-2.0 |
dataxu/ansible | lib/ansible/plugins/terminal/junos.py | 57 | 1817 | #
# (c) 2016 Red Hat 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) any later version.
#
# Ansible is d... | gpl-3.0 |
Pistachitos/Sick-Beard | lib/tvdb_api/tvdb_ui.py | 28 | 5551 | #!/usr/bin/env python
#encoding:utf-8
#author:dbr/Ben
#project:tvdb_api
#repository:http://github.com/dbr/tvdb_api
#license:unlicense (http://unlicense.org/)
"""Contains included user interfaces for Tvdb show selection.
A UI is a callback. A class, it's __init__ function takes two arguments:
- config, which is the T... | gpl-3.0 |
abhikumar22/MYBLOG | blg/Lib/site-packages/social_core/backends/meetup.py | 5 | 1197 | """
Meetup OAuth2 backend, docs at:
https://python-social-auth.readthedocs.io/en/latest/backends/meetup.html
"""
from .oauth import BaseOAuth2
class MeetupOAuth2(BaseOAuth2):
"""Meetup OAuth2 authentication backend"""
name = 'meetup'
AUTHORIZATION_URL = 'https://secure.meetup.com/oauth2/authorize'
... | gpl-3.0 |
idlead/scikit-learn | sklearn/cluster/tests/test_affinity_propagation.py | 341 | 2620 | """
Testing for Clustering methods
"""
import numpy as np
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_array_equal
from sklearn.utils.testing import assert_raises
from sklearn.cluster.affinity_propagation_ import AffinityPropagation
from sklearn.cluster.affinity_propagatio... | bsd-3-clause |
kaplun/invenio | modules/bibcatalog/lib/bibcatalog_unit_tests.py | 16 | 3943 | # -*- coding: utf-8 -*-
##
## This file is part of Invenio.
## Copyright (C) 2013 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) a... | gpl-2.0 |
GheRivero/ansible | lib/ansible/module_utils/service.py | 9 | 9000 | # 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 |
aguirrel/sqlalchemy_rest | sqlalchemy_rest/json/__init__.py | 1 | 3900 | from datetime import date, time, datetime
def from_dict(self, values):
"""Merge in items in the values dict into our object if it's one of our columns
"""
json_eager_save = set(getattr(self, '_json_eager_save', []))
for c in self.__table__.columns:
if c.name in values:
setattr(self... | gpl-3.0 |
GbalsaC/bitnamiP | venv/lib/python2.7/site-packages/sympy/functions/special/hyper.py | 3 | 15503 | """Hypergeometric and Meijer G-functions"""
from sympy import S
from sympy.core.function import Function, ArgumentIndexError
from sympy.core.containers import Tuple
from sympy.core.sympify import sympify
from sympy.core.mul import Mul
# TODO should __new__ accept **options?
# TODO should constructors should check if ... | agpl-3.0 |
aamin25/Python_Practice | Twitter_Sentiment_Template.py | 1 | 18051 | # coding=utf-8
import pyodbc
import twitter
import sys
import pdb
import time
import datetime
import nltk
from nltk.sentiment.vader import SentimentIntensityAnalyzer
from nltk import tokenize
import time
import math
import string
import re
import os
import json
nltk.download('punkt')
nltk.download('vader_lexicon')
#... | gpl-3.0 |
maartenq/ansible | lib/ansible/modules/windows/win_user_right.py | 28 | 2856 | #!/usr/bin/python
# -*- coding: utf-8 -*-
# Copyright: (c) 2017, Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
# this is a windows documentation stub. actual code lives in the .ps1
# file of the same name
ANSIBLE_METADATA = {'metadata_version': '1.1',
... | gpl-3.0 |
oliverlee/sympy | sympy/functions/special/gamma_functions.py | 11 | 32444 | from __future__ import print_function, division
from sympy.core import Add, S, sympify, oo, pi, Dummy
from sympy.core.function import Function, ArgumentIndexError
from sympy.core.numbers import Rational
from sympy.core.power import Pow
from sympy.core.compatibility import range
from .zeta_functions import zeta
from .e... | bsd-3-clause |
soccermetrics/flask-skeleton | appname/appname/views.py | 1 | 1299 | #
# Implementation of views
#
from flask import jsonify, Response
from flask.views import MethodView
import json
from main import app
#
# error handling
#
@app.errorhandler(400)
def bad_request(error=None):
message = {
'status': 400,
'message': "Bad request."
}
... | mit |
destijl/grr | grr/gui/plugins/userdashboard_test.py | 2 | 7063 | #!/usr/bin/env python
"""User dashboard tests."""
from grr.gui import gui_test_lib
from grr.gui import runtests_test
from grr.lib import access_control
from grr.lib import flags
from grr.lib import flow
from grr.lib import rdfvalue
from grr.lib import test_lib
class TestUserDashboard(gui_test_lib.SearchClientTestBa... | apache-2.0 |
Alberto-Beralix/Beralix | i386-squashfs-root/usr/share/pyshared/ufw/frontend.py | 1 | 31757 | #
# frontend.py: frontend interface for ufw
#
# Copyright 2008-2010 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 the... | gpl-3.0 |
pigshell/nhnick | src/qt/qtwebkit/Tools/Scripts/webkitpy/tool/servers/reflectionhandler.py | 126 | 5449 | # Copyright (c) 2011 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 |
nzavagli/UnrealPy | UnrealPyEmbed/Development/Python/2015.08.07-Python2710-x64-Source-vs2015/Python27/Source/Jinja2-2.7.3/examples/rwbench/djangoext.py | 80 | 3802 | # -*- coding: utf-8 -*-
from rwbench import ROOT
from os.path import join
from django.conf import settings
settings.configure(
TEMPLATE_DIRS=(join(ROOT, 'django'),),
TEMPLATE_LOADERS=(
('django.template.loaders.cached.Loader', (
'django.template.loaders.filesystem.Loader',
)),
)
... | mit |
NetApp/manila | manila/tests/data/test_manager.py | 3 | 17101 | # Copyright 2015, Hitachi Data Systems.
#
# 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 la... | apache-2.0 |
filipp/Servo | servo/views/product.py | 1 | 15004 | # -*- coding: utf-8 -*-
# Copyright (c) 2013, First Party Software
# 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 copyright notice,
# t... | bsd-2-clause |
shenfei/oj_codes | leetcode/python/n952_Largest_Component_Size_by_Common_Factor.py | 1 | 2124 | from typing import List
from collections import defaultdict
from math import sqrt
class Solution:
def largestComponentSize(self, A: List[int]) -> int:
n = len(A)
if n == 1:
return 1
self.parent = {i: i for i in range(n)}
self.rank = [0] * n
prime_parent_map =... | mit |
gelab/mainr | tests/test_authentication.py | 10 | 7144 | # -*- coding: utf-8 -*-
# MySQL Connector/Python - MySQL driver written in Python.
# Copyright (c) 2014, 2015, Oracle and/or its affiliates. All rights reserved.
# MySQL Connector/Python is licensed under the terms of the GPLv2
# <http://www.gnu.org/licenses/old-licenses/gpl-2.0.html>, like most
# MySQL Connectors. Th... | gpl-2.0 |
omprakasha/odoo | addons/analytic/analytic.py | 94 | 18688 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Management Solution
# Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>).
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU... | agpl-3.0 |
hack4impact/next-gen-scholars | app/models/checklist_item.py | 1 | 1240 | from .. import db
from faker import Faker
import random
class ChecklistItem(db.Model):
id = db.Column(db.Integer, primary_key=True)
assignee_id = db.Column(
db.Integer,
db.ForeignKey('student_profile.id'),
index=True)
deadline = db.Column(db.Date, index=True)
text = db.Column(d... | mit |
Sidney84/pa-chromium | tools/python/google/logging_utils.py | 198 | 2656 | # Copyright (c) 2011 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.
''' Utility functions and objects for logging.
'''
import logging
import sys
class StdoutStderrHandler(logging.Handler):
''' Subclass of logging.Hand... | bsd-3-clause |
schlueter/ansible | lib/ansible/modules/cloud/amazon/ec2_vpc_nacl_facts.py | 49 | 7593 | #!/usr/bin/python
# 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': ['stableinterface'],
's... | gpl-3.0 |
andris210296/andris-projeto | backend/venv/test/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 |
FlymeOS/repo | subcmds/start.py | 6 | 4010 | #
# Copyright (C) 2008 The Android Open Source Project
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable la... | apache-2.0 |
srcLurker/home-assistant | homeassistant/components/sensor/loopenergy.py | 9 | 4298 | """
Support for Loop Energy sensors.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/sensor.loop_energy/
"""
import logging
import voluptuous as vol
import homeassistant.helpers.config_validation as cv
from homeassistant.helpers.entity import Entity
fro... | mit |
erudit/zenon | tests/functional/apps/userspace/library/test_views.py | 1 | 2423 | import pytest
from django.test.client import Client
from django.urls import reverse
from apps.userspace.library.stats.forms import (
CounterJR1Form,
StatsFormInfo,
)
from apps.userspace.library.stats.views import (
get_stats_form,
compute_end_year,
)
from erudit.test.factories import OrganisationFacto... | gpl-3.0 |
912/M-new | virtualenvironment/experimental/lib/python2.7/site-packages/django/contrib/gis/db/backends/spatialite/base.py | 61 | 3466 | import sys
from ctypes.util import find_library
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.db.backends.sqlite3.base import (Database,
DatabaseWrapper as SQLiteDatabaseWrapper, SQLiteCursorWrapper)
from django.contrib.gis.db.backends.spatialite.client import... | gpl-2.0 |
mdrumond/tensorflow | tensorflow/python/debug/lib/stepper_test.py | 11 | 46237 | # 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 |
DONIKAN/django | tests/queryset_pickle/tests.py | 209 | 6081 | from __future__ import unicode_literals
import datetime
import pickle
import unittest
import warnings
from django.test import TestCase
from django.utils import six
from django.utils.encoding import force_text
from django.utils.version import get_version
from .models import Container, Event, Group, Happening, M2MMode... | bsd-3-clause |
aprefontaine/TMScheduler | django/core/management/commands/diffsettings.py | 411 | 1296 | from django.core.management.base import NoArgsCommand
def module_to_dict(module, omittable=lambda k: k.startswith('_')):
"Converts a module namespace to a Python dictionary. Used by get_settings_diff."
return dict([(k, repr(v)) for k, v in module.__dict__.items() if not omittable(k)])
class Command(NoArgsComm... | bsd-3-clause |
opensemanticsearch/open-semantic-etl | src/opensemanticetl/filter_blacklist.py | 1 | 3620 | #!/usr/bin/python
# -*- coding: utf-8 -*-
import re
def is_in_lists(listfiles, value, match=None):
result = False
for listfile in listfiles:
try:
if is_in_list(filename=listfile, value=value, match=match):
result = True
break
except BaseExceptio... | gpl-3.0 |
netscaler/horizon | openstack_dashboard/dashboards/admin/dashboard.py | 9 | 1358 | # vim: tabstop=4 shiftwidth=4 softtabstop=4
# Copyright 2012 Nebula, 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
#
# ... | apache-2.0 |
GoSteven/Diary | django/contrib/comments/feeds.py | 12 | 1477 | from django.conf import settings
from django.contrib.syndication.views import Feed
from django.contrib.sites.models import Site
from django.contrib import comments
from django.utils.translation import ugettext as _
class LatestCommentFeed(Feed):
"""Feed of latest comments on the current site."""
def ... | bsd-3-clause |
djkonro/client-python | kubernetes/client/models/v1_persistent_volume_claim_spec.py | 2 | 7240 | # coding: utf-8
"""
Kubernetes
No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
OpenAPI spec version: v1.7.4
Generated by: https://github.com/swagger-api/swagger-codegen.git
"""
from pprint import pformat
from six import iteritems
import re
... | apache-2.0 |
emersonmx/ippl | ippl/test/intersect.py | 1 | 3074 | #
# Copyright (C) 2013-2014 Emerson Max de Medeiros Silva
#
# This file is part of ippl.
#
# ippl 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 |
kdar/Wox | PythonHome/Lib/site-packages/chardet/mbcssm.py | 1783 | 19590 | ######################## BEGIN LICENSE BLOCK ########################
# The Original Code is mozilla.org code.
#
# The Initial Developer of the Original Code is
# Netscape Communications Corporation.
# Portions created by the Initial Developer are Copyright (C) 1998
# the Initial Developer. All Rights Reserved.
#
# Con... | mit |
nhtera/github.io | node_modules/grunt-docker/node_modules/docker/node_modules/pygmentize-bundled/vendor/pygments/pygments/styles/trac.py | 364 | 1933 | # -*- coding: utf-8 -*-
"""
pygments.styles.trac
~~~~~~~~~~~~~~~~~~~~
Port of the default trac highlighter design.
:copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
from pygments.style import Style
from pygments.token import Keyword, Na... | mit |
mbranko/kartonpmv | osnovni/forms.py | 1 | 2273 | #!/usr/bin/env python
# -*- coding: utf-8 -*-
from django.forms import IntegerField, CharField, ModelChoiceField, DateField, Textarea, DateInput, HiddenInput, \
ModelForm, Form
from osnovni.models import MuzejskiPredmet, VrstaZbirke, KategorijaPredmeta
from orgsema.models import NaseljenoMesto, Radnik
class Pred... | mit |
Noviat/odoo | addons/mail/tests/test_invite.py | 199 | 2591 | # -*- coding: utf-8 -*-
##############################################################################
#
# OpenERP, Open Source Business Applications
# Copyright (c) 2012-TODAY OpenERP S.A. <http://openerp.com>
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of ... | agpl-3.0 |
TNT-Samuel/Coding-Projects | DNS Server/Source/Lib/idlelib/multicall.py | 7 | 18548 | """
MultiCall - a class which inherits its methods from a Tkinter widget (Text, for
example), but enables multiple calls of functions per virtual event - all
matching events will be called, not only the most specific one. This is done
by wrapping the event functions - event_add, event_delete and event_info.
MultiCall r... | gpl-3.0 |
rafiqsaleh/VERCE | verce-hpc-pe/src/networkx/algorithms/bipartite/__init__.py | 29 | 3167 | r""" This module provides functions and operations for bipartite
graphs. Bipartite graphs `B = (U, V, E)` have two node sets `U,V` and edges in
`E` that only connect nodes from opposite sets. It is common in the literature
to use an spatial analogy referring to the two node sets as top and bottom nodes.
The bipartite... | mit |
elijah513/scikit-learn | sklearn/decomposition/tests/test_pca.py | 199 | 10949 | import numpy as np
from sklearn.utils.testing import assert_almost_equal
from sklearn.utils.testing import assert_array_almost_equal
from sklearn.utils.testing import assert_true
from sklearn.utils.testing import assert_equal
from sklearn.utils.testing import assert_greater
from sklearn.utils.testing import assert_rai... | bsd-3-clause |
MSOpenTech/edx-platform | scripts/run_watch_data.py | 182 | 1672 | #! /usr/bin/env python
# This script requires that you have watchdog installed. You can install
# watchdog via 'pip install watchdog'
import sys
import time
import logging
import os
from subprocess import Popen
from signal import SIGTERM
from watchdog.observers import Observer
from watchdog.events import LoggingEvent... | agpl-3.0 |
drnextgis/QGIS | python/ext-libs/requests/packages/urllib3/connectionpool.py | 147 | 32713 | from __future__ import absolute_import
import errno
import logging
import sys
import warnings
from socket import error as SocketError, timeout as SocketTimeout
import socket
try: # Python 3
from queue import LifoQueue, Empty, Full
except ImportError:
from Queue import LifoQueue, Empty, Full
# Queue is im... | gpl-2.0 |
rchuppala/usc_agent | src/usc-agent-dev/common/source/pyang/pyang/xpath.py | 9 | 5841 | import re
import sys
# not 100% XPath / XML, but good enough for YANG
namestr=r'[a-zA-Z_][a-zA-Z0-9_\-.]*'
ncnamestr = '((' + namestr + '):)?(' + namestr + ')'
prefixteststr = '((' + namestr + r'):)?\*'
patterns = [
('whitespace', re.compile(r'\s+')),
# Expr tokens
('(', re.compile(r'\(')),
(')', re.c... | gpl-2.0 |
sylvain-garancher/connector | connector/tests/test_backend.py | 16 | 8663 | # -*- coding: utf-8 -*-
import unittest2
import openerp.tests.common as common
from openerp.addons.connector.backend import (Backend,
get_backend,
BACKENDS)
from openerp.addons.connector.exception import NoConnectorUnitError
f... | agpl-3.0 |
toninhofpt/my-first-blog1 | myven/lib/python3.4/site-packages/wheel/bdist_wheel.py | 232 | 17441 | """
Create a wheel (.whl) distribution.
A wheel is a built archive format.
"""
import csv
import hashlib
import os
import subprocess
import warnings
import shutil
import json
import wheel
try:
import sysconfig
except ImportError: # pragma nocover
# Python < 2.7
import distutils.sysconfig as sysconfig
i... | gpl-3.0 |
laurentb/weboob | modules/lefigaro/browser.py | 2 | 1482 | "browser for lefigaro website"
# -*- coding: utf-8 -*-
# Copyright(C) 2011 Julien Hebert
#
# This file is part of a weboob module.
#
# This weboob module 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... | lgpl-3.0 |
alon/servo | tests/wpt/web-platform-tests/check_stability.py | 7 | 24269 | from __future__ import print_function
import argparse
import logging
import os
import re
import stat
import subprocess
import sys
import tarfile
import zipfile
from abc import ABCMeta, abstractmethod
from cStringIO import StringIO
from collections import defaultdict
from ConfigParser import RawConfigParser
from io imp... | mpl-2.0 |
wuzhihui1123/django-cms | cms/south_migrations/0073_auto__chg_field_cmsplugin_path__chg_field_page_path.py | 49 | 18520 | # -*- coding: utf-8 -*-
from south.utils import datetime_utils as datetime
from south.db import db
from south.v2 import SchemaMigration
from django.db import models
class Migration(SchemaMigration):
def forwards(self, orm):
# Changing field 'CMSPlugin.path'
db.alter_column(u'cms_cmsplugin', 'pat... | bsd-3-clause |
cwmat/flasky | app/main/forms.py | 92 | 2375 | from flask.ext.wtf import Form
from wtforms import StringField, TextAreaField, BooleanField, SelectField,\
SubmitField
from wtforms.validators import Required, Length, Email, Regexp
from wtforms import ValidationError
from flask.ext.pagedown.fields import PageDownField
from ..models import Role, User
class NameFo... | mit |
Shanec132006/project | lib/werkzeug/security.py | 302 | 8407 | # -*- coding: utf-8 -*-
"""
werkzeug.security
~~~~~~~~~~~~~~~~~
Security related helpers such as secure password hashing tools.
:copyright: (c) 2013 by the Werkzeug Team, see AUTHORS for more details.
:license: BSD, see LICENSE for more details.
"""
import os
import hmac
import hashlib
import posi... | apache-2.0 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.