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
felliott/osf.io
admin/nodes/views.py
3
23080
from __future__ import unicode_literals import pytz from datetime import datetime from django.utils import timezone from django.core.exceptions import PermissionDenied, ValidationError from django.views.generic import ListView, DeleteView, View, TemplateView from django.shortcuts import redirect from django.views.def...
apache-2.0
kanteshraj/ansible
lib/ansible/plugins/action/fail.py
172
1228
# (c) 2012-2014, Michael DeHaan <michael.dehaan@gmail.com> # (c) 2012, Dag Wieers <dag@wieers.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 ...
gpl-3.0
Julian/home-assistant
homeassistant/components/light/insteon_hub.py
7
2075
""" Support for Insteon Hub lights. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/insteon_hub/ """ from homeassistant.components.insteon_hub import INSTEON from homeassistant.components.light import ATTR_BRIGHTNESS, Light def setup_platform(hass, conf...
mit
richardxia/asp-multilevel-debug
tools/debugger/stencil/stencil_unroll_neighbor_iter.py
3
3792
"""Unrolls neighbor loops and InputElementZeroOffset nodes in a StencilModel. The second stage in stencil kernel processing, after stencil_python_front_end and before stencil_convert. This stage is done once per call because the dimensions of the input are needed. """ from stencil_model import * from stencil_grid imp...
bsd-3-clause
hypatia-engine/hypatia
hypatia/resources.py
3
8680
# This module is part of Hypatia and is released under the # MIT license: http://opensource.org/licenses/MIT """These are utilities which are commonly utilized by all modules in Hypatia. It serves for the ugly, underlying components of miscellaneous actions which assist other modules, and does not do much on its own. ...
mit
pk-sam/crosswalk-test-suite
wrt/wrt-packertool2-android-tests/packertool2/comm.py
3
12569
#!/usr/bin/env python #coding=utf-8 # # Copyright (c) 2015 Intel Corporation. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are met: # # * Redistributions of works must retain the original copyright notice, this # list of co...
bsd-3-clause
marklap/httpie
httpie/cli.py
41
15596
"""CLI arguments definition. NOTE: the CLI interface may change before reaching v1.0. """ from textwrap import dedent, wrap #noinspection PyCompatibility from argparse import (RawDescriptionHelpFormatter, FileType, OPTIONAL, ZERO_OR_MORE, SUPPRESS) from httpie import __doc__, __version__ from h...
bsd-3-clause
zhxwmessi/or-tools
examples/python/data/nonogram_regular/nonogram_bear.py
74
1038
# Copyright 2010 Hakan Kjellerstrand hakank@bonetmail.com # # 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
fengyoulong/ns3-gpcr
doc/tutorial/source/conf.py
14
6982
# -*- coding: utf-8 -*- # # ns-3 documentation build configuration file, created by # sphinx-quickstart on Tue Dec 14 09:00:39 2010. # # This file is execfile()d with the current directory set to its containing dir. # # Note that not all possible configuration values are present in this # autogenerated file. # # All co...
gpl-2.0
kevin-intel/scikit-learn
sklearn/utils/tests/test_extmath.py
3
35962
# Authors: Olivier Grisel <olivier.grisel@ensta.org> # Mathieu Blondel <mathieu@mblondel.org> # Denis Engemann <denis-alexander.engemann@inria.fr> # # License: BSD 3 clause import numpy as np from scipy import sparse from scipy import linalg from scipy import stats from scipy.sparse.linalg import eig...
bsd-3-clause
ar45/django
django/views/decorators/clickjacking.py
335
1744
from functools import wraps from django.utils.decorators import available_attrs def xframe_options_deny(view_func): """ Modifies a view function so its response has the X-Frame-Options HTTP header set to 'DENY' as long as the response doesn't already have that header set. e.g. @xframe_optio...
bsd-3-clause
doublebits/osf.io
api_tests/registrations/views/test_registration_list.py
7
15962
from urlparse import urlparse from nose.tools import * # flake8: noqa from website.models import Node from framework.auth.core import Auth from api.base.settings.defaults import API_BASE from tests.base import ApiTestCase from tests.factories import ( ProjectFactory, RegistrationFactory, AuthUserFactor...
apache-2.0
howie6879/novels-search
examples/user_recommend.py
2
2454
#!/usr/bin/env python import asyncio import collections import os from operator import itemgetter import uvloop os.environ['MODE'] = 'DEV' from pprint import pprint from copy import deepcopy from owllook.database.mongodb import MotorBase from owllook.recommend.cosinesimilarity import CosineSimilarity from owllook.fe...
apache-2.0
huxuan/flask-oauthlib
example/contrib/experiment-client/twitter.py
15
1559
from flask import Flask, url_for, session, jsonify from flask.ext.oauthlib.contrib.client import OAuth class DefaultConfig(object): DEBUG = True SECRET_KEY = 'your-secret-key' TWITTER_CONSUMER_KEY = 'your-api-key' TWITTER_CONSUMER_SECRET = 'your-api-secret' app = Flask(__name__) app.config.from_objec...
bsd-3-clause
scrapinghub/scrapy
extras/qps-bench-server.py
178
1640
#!/usr/bin/env python from __future__ import print_function from time import time from collections import deque from twisted.web.server import Site, NOT_DONE_YET from twisted.web.resource import Resource from twisted.internet import reactor class Root(Resource): def __init__(self): Resource.__init__(self...
bsd-3-clause
user-none/calibre
src/calibre/gui2/metadata/bulk_download.py
14
9287
#!/usr/bin/env python2 # vim:fileencoding=UTF-8:ts=4:sw=4:sta:et:sts=4:ai from __future__ import (unicode_literals, division, absolute_import, print_function) __license__ = 'GPL v3' __copyright__ = '2011, Kovid Goyal <kovid@kovidgoyal.net>' __docformat__ = 'restructuredtext en' import os, ti...
gpl-3.0
vincepandolfo/django
tests/generic_relations_regress/models.py
269
5666
from django.contrib.contenttypes.fields import ( GenericForeignKey, GenericRelation, ) from django.contrib.contenttypes.models import ContentType from django.db import models from django.db.models.deletion import ProtectedError from django.utils.encoding import python_2_unicode_compatible __all__ = ('Link', 'Place...
bsd-3-clause
michalliu/OpenWrt-Firefly-Libraries
staging_dir/host/lib/python3.4/unittest/test/test_loader.py
81
50320
import sys import types import unittest class Test_TestLoader(unittest.TestCase): ### Tests for TestLoader.loadTestsFromTestCase ################################################################ # "Return a suite of all tests cases contained in the TestCase-derived # class testCaseClass" def te...
gpl-2.0
Andygmb/python-social-auth
social/tests/backends/test_utils.py
80
1776
import unittest2 as unittest from social.tests.models import TestStorage from social.tests.strategy import TestStrategy from social.backends.utils import load_backends, get_backend from social.backends.github import GithubOAuth2 from social.exceptions import MissingBackend class BaseBackendUtilsTest(unittest.TestCas...
bsd-3-clause
disqus/porkchop
porkchop/commandline.py
1
5425
""" porkchop.commandline ~~~~~~~~~~~~~~~~~~~~ :copyright: (c) 2011-2012 DISQUS. :license: Apache License 2.0, see LICENSE for more details. """ import logging import socket from optparse import OptionParser from porkchop.plugin import PorkchopPluginHandler def coerce_number(s): try: return int(s) ex...
apache-2.0
mpdehaan/ansible
lib/ansible/runner/action_plugins/copy.py
10
16940
# (c) 2012-2014, 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) an...
gpl-3.0
cloudbau/nova
nova/cmd/rpc_zmq_receiver.py
17
1146
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # Copyright 2011 OpenStack Foundation # # 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/LICEN...
apache-2.0
s4n7h0/ava
ava/import_google/views.py
3
4584
# flake8: noqa import os from django.core.urlresolvers import reverse from django.shortcuts import get_object_or_404 from django.views.generic import ListView, DetailView, CreateView, UpdateView from django.views.generic.edit import DeleteView from ava.google_auth.views import retrieve_credential_from_session, django...
gpl-2.0
asdofindia/kitsune
scripts/fix_tb_basedon.py
23
1520
#!/usr/bin/env python # -*- coding: utf-8 -*- """ Finds revisions from the Thunderbird migration that don't have based_on set correctly, and are still relavent, and fixes that. Run this script like `./manage.py runscript fix_tb_basedon`. """ import sys from traceback import print_exc from django.db.models import Q ...
bsd-3-clause
thiphariel/navitia
source/jormungandr/tests/check_utils.py
1
30415
# Copyright (c) 2001-2014, Canal TP and/or its affiliates. All rights reserved. # # This file is part of Navitia, # the software to build cool stuff with public transport. # # Hope you'll enjoy and contribute to this project, # powered by Canal TP (www.canaltp.fr). # Help us simplify mobility and open public tr...
agpl-3.0
Pawel22729/pythonScripts
train/plaseholders.py
2
1441
#!/usr/bin/python -u import os import yaml import shutil import time import tempfile import re import distutils.core import subprocess class Conf(object): def __init__(self, app): self.app = app def createTemp(self): configDir = '/home/pls/configs/' path = configDir+self.app ...
apache-2.0
vipul-sharma20/oh-mainline
mysite/customs/migrations/0014_add_description_to_bugzillaurl.py
17
4263
# This file is part of OpenHatch. # Copyright (C) 2010 Jack Grigg # # 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 option) any later versio...
agpl-3.0
freedomtan/tensorflow
tensorflow/python/kernel_tests/unique_op_test.py
5
8978
# Copyright 2015 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applica...
apache-2.0
BeATz-UnKNoWN/python-for-android
python-modules/twisted/twisted/trial/test/mockdoctest.py
64
2671
# Copyright (c) 2001-2004 Twisted Matrix Laboratories. # See LICENSE for details. # this module is a trivial class with doctests and a __test__ attribute # to test trial's doctest support with python2.4 class Counter(object): """a simple counter object for testing trial's doctest support >>> c = Counte...
apache-2.0
Kozea/Dyko
kalamar/tests/combinations/access_point/ldap_aps.py
1
2204
# -*- coding: utf-8 -*- # This file is part of Dyko # Copyright © 2008-2010 Kozea # # This library 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
ravindrapanda/tensorflow
tensorflow/compiler/tests/gather_test.py
18
7594
# 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
cyp-opennet/ons_cyp_github
l10n_ch_dta/wizard/unicode2ascii.py
6
22769
# -*- coding: utf-8 -*- """Convert many unicode characters to ascii characters that are like them. I want to collate names, with the property that a last name starting with O-umlaut will be in with the last name's starting with O. Horrors! So I want that many Latin-1 characters have their umlaute's, etc., strippe...
agpl-3.0
ericpre/hyperspy
hyperspy/_components/gaussianhf.py
1
6198
# -*- coding: utf-8 -*- # Copyright 2007-2021 The HyperSpy developers # # This file is part of HyperSpy. # # HyperSpy 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
rhiever/bokeh
bokeh/document.py
35
11805
""" The document module provides the Document class, which is a container for all Bokeh objects that mustbe reflected to the client side BokehJS library. """ from __future__ import absolute_import import logging logger = logging.getLogger(__file__) import uuid from .exceptions import DataIntegrityException from .mo...
bsd-3-clause
arcticshores/kivy
kivy/uix/listview.py
7
39403
''' List View =========== .. versionadded:: 1.5 .. warning:: This code is still experimental, and its API is subject to change in a future version. The :class:`~kivy.uix.listview.ListView` implements an :class:`~kivy.uix.abstractview.AbstractView` as a vertical, scrollable,pannable list clipped to the scrol...
mit
visualputty/Landing-Lights
django/contrib/comments/views/moderation.py
307
5037
from django import template from django.conf import settings from django.shortcuts import get_object_or_404, render_to_response from django.contrib.auth.decorators import login_required, permission_required from utils import next_redirect, confirmation_view from django.contrib import comments from django.contrib.commen...
bsd-3-clause
harveyxia/luigi
luigi/rpc.py
14
5624
# -*- coding: utf-8 -*- # # Copyright 2012-2015 Spotify AB # # 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...
apache-2.0
Foorth/panda-bigmon-core
core/filebrowser/views.py
2
8616
""" filebrowser.views """ import logging import re from datetime import datetime from django.http import HttpResponse from django.shortcuts import render_to_response, render from django.template import RequestContext, loader from django.template.loader import get_template from django.conf import settings #from...
apache-2.0
littlstar/chromium.src
chrome/common/extensions/docs/server2/document_renderer.py
85
4614
# 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. import logging import os from document_parser import ParseDocument from platform_util import ExtractPlatformFromURL from third_party.json_schema_compiler.mod...
bsd-3-clause
oesst/Sound_Analytics
evaluation/extracting_spectral_cues_test.py
1
1752
import numpy as np import matplotlib.pyplot as plt import matplotlib as mpl import soundfile as sf from matplotlib.font_manager import FontProperties import pyaudio from scipy.signal import welch, butter, lfilter, savgol_filter, group_delay from os import listdir from os.path import isfile, join from colour import Colo...
mit
axbaretto/beam
sdks/python/.tox/docs/lib/python2.7/site-packages/requests/packages/urllib3/packages/ssl_match_hostname/_implementation.py
285
5702
"""The match_hostname() function from Python 3.3.3, essential when using SSL.""" # Note: This file is under the PSF license as the code comes from the python # stdlib. http://docs.python.org/3/license.html import re import sys # ipaddress has been backported to 2.6+ in pypi. If it is installed on the # system, us...
apache-2.0
HyperBaton/ansible
lib/ansible/modules/network/fortios/fortios_dlp_fp_sensitivity.py
7
10166
#!/usr/bin/python from __future__ import (absolute_import, division, print_function) # Copyright 2019 Fortinet, Inc. # # 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 Lic...
gpl-3.0
petrutlucian94/nova_dev
nova/api/openstack/compute/contrib/cloudpipe.py
15
7219
# Copyright 2011 OpenStack Foundation # # 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
solashirai/edx-platform
common/djangoapps/edxmako/middleware.py
7
2687
# Copyright (c) 2008 Mikeal Rogers # # 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 agre...
agpl-3.0
arthurdarcet/aiohttp
tests/test_client_response.py
1
39313
# -*- coding: utf-8 -*- """Tests for aiohttp/client.py""" import gc import sys from unittest import mock import pytest from multidict import CIMultiDict from yarl import URL import aiohttp from aiohttp import http from aiohttp.client_reqrep import ClientResponse, RequestInfo from aiohttp.helpers import TimerNoop fro...
apache-2.0
Mj258/weiboapi
srapyDemo/envs/Lib/encodings/charmap.py
860
2084
""" Generic Python Character Mapping Codec. Use this codec directly rather than through the automatic conversion mechanisms supplied by unicode() and .encode(). Written by Marc-Andre Lemburg (mal@lemburg.com). (c) Copyright CNRI, All Rights Reserved. NO WARRANTY. """#" import codecs ### Codec APIs class...
mit
orione7/Italorione
unplugged/streamtime.py
2
2918
# -*- coding: utf-8 -*- # ------------------------------------------------------------ # streamondemand - XBMC Plugin # Canal para streamtime # http://blog.tvalacarta.info/plugin-xbmc/pelisalacarta/ # ------------------------------------------------------------ import re import sys import urlparse import urllib2 import...
gpl-3.0
pyshopml/jobs-backend
config/settings/local.py
1
1866
""" Local settings - Run in Debug mode - Use console backend for emails - Add Django Debug Toolbar """ import socket import os from .common import * # noqa # DEBUG # ------------------------------------------------------------------------------ DEBUG = env.bool('DJANGO_DEBUG', default=True) TEMPLATES[0]['OPTIONS']...
mit
ryano144/intellij-community
python/testData/types/NumpyArrayIntMultiplicationType/numpy/core/numeric.py
158
1105
from . import multiarray __all__ = ['ndarray', 'ones'] ndarray = multiarray.ndarray def ones(shape, dtype=None, order='C'): """ **Test docstring** Return a new array of given shape and type, filled with ones. Parameters ---------- shape : int or sequence of ints Shape of the new arr...
apache-2.0
olduvaihand/ProjectEuler
src/python/problem162.py
1
1067
# -*- coding: utf-8 -*- # ProjectEuler/src/python/problem162.py # # Hexadecimal numbers # =================== # Published on Friday, 5th October 2007, 10:00 pm # # In the hexadecimal number system numbers are represented using 16 different # digits: 0,1,2,3,4,5,6,7,8,9,A,B,C,D,E,F The hexadecimal number AF when # wri...
mit
niceandcoolusername/cosmos
code/graph-algorithms/cycle_undirected_graph/cycle_undirected_graph.py
9
1291
class graph: def __init__(self): self.neighbors = {} def add_vertex(self, v): if v not in self.neighbors: self.neighbors[v] = [] def add_edge(self, u, v): self.neighbors[u].append(v) # if u == v, do not connect u to itself twice if u != v: s...
gpl-3.0
jamespcole/home-assistant
homeassistant/components/homematic/binary_sensor.py
1
1812
"""Support for HomeMatic binary sensors.""" import logging from homeassistant.components.binary_sensor import BinarySensorDevice from homeassistant.const import STATE_UNKNOWN from . import ATTR_DISCOVER_DEVICES, HMDevice _LOGGER = logging.getLogger(__name__) DEPENDENCIES = ['homematic'] SENSOR_TYPES_CLASS = { ...
apache-2.0
faun/django_test
tests/regressiontests/views/tests/defaults.py
3
3727
from os import path from django.conf import settings from django.test import TestCase from django.contrib.contenttypes.models import ContentType from regressiontests.views.models import Author, Article, UrlArticle class DefaultsTests(TestCase): """Test django views in django/views/defaults.py""" fixtures = [...
bsd-3-clause
britcey/ansible
lib/ansible/modules/network/illumos/dladm_etherstub.py
70
4639
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2015, Adam Števko <adam.stevko@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 L...
gpl-3.0
vipul-sharma20/oh-mainline
vendor/packages/Django/django/contrib/gis/db/backends/postgis/adapter.py
222
1557
""" This object provides quoting for GEOS geometries into PostgreSQL/PostGIS. """ from __future__ import unicode_literals from psycopg2 import Binary from psycopg2.extensions import ISQLQuote class PostGISAdapter(object): def __init__(self, geom): "Initializes on the geometry." # Getting the WKB ...
agpl-3.0
GDGLima/contentbox
third_party/django/db/models/__init__.py
107
1423
from functools import wraps from django.core.exceptions import ObjectDoesNotExist, ImproperlyConfigured from django.db.models.loading import get_apps, get_app_paths, get_app, get_models, get_model, register_models, UnavailableApp from django.db.models.query import Q from django.db.models.expressions import F from djan...
apache-2.0
samba-team/samba
third_party/waf/waflib/extras/compat15.py
56
11813
#! /usr/bin/env python # encoding: utf-8 # Thomas Nagy, 2010 (ita) """ This file is provided to enable compatibility with waf 1.5 It was enabled by default in waf 1.6, but it is not used in waf 1.7 """ import sys from waflib import ConfigSet, Logs, Options, Scripting, Task, Build, Configure, Node, Runner, TaskGen, Ut...
gpl-3.0
AlexanderKaluzhny/instanotifier
config/settings/test.py
81
1944
# -*- coding: utf-8 -*- ''' Test settings - Used to run tests fast on the continuous integration server and locally ''' from .common import * # noqa # DEBUG # ------------------------------------------------------------------------------ # Turn debug off so tests run faster DEBUG = False TEMPLATES[0]['OPTIONS']['d...
mit
denisff/python-for-android
python3-alpha/extra_modules/gdata/apps/organization/data.py
102
12186
#!/usr/bin/python2.4 # # Copyright 2011 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 ...
apache-2.0
abrkn/node-gyp
legacy/tools/gyp/tools/pretty_sln.py
42
5099
#!/usr/bin/env python # Copyright (c) 2009 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. """Prints the information in a sln file in a diffable way. It first outputs each projects in alphabetical order with their dependenci...
mit
philips/kubernetes
hack/boilerplate/boilerplate_test.py
629
1362
#!/usr/bin/env python # 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 appli...
apache-2.0
cgstudiomap/cgstudiomap
main/parts/odoo/addons/mrp/wizard/change_production_qty.py
245
4852
# -*- 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
keishi/chromium
chrome/test/functional/omniboxmodel.py
11
4515
#!/usr/bin/env python # 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. import logging import random import pyauto_functional from pyauto import PyUITest from pyauto import GURL import autotour class...
bsd-3-clause
coagulant/django-model-utils
model_utils/tests/tests.py
1
20172
from __future__ import with_statement import pickle, warnings from datetime import datetime, timedelta from django.db import models from django.db.models.fields import FieldDoesNotExist from django.core.exceptions import ImproperlyConfigured from django.test import TestCase from django.contrib.contenttypes.models i...
bsd-3-clause
shinfan/artman
test/tasks/test_format.py
1
3934
# Copyright 2017 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 agree...
apache-2.0
zaccoz/odoo
addons/report_webkit/__init__.py
382
1593
# -*- coding: utf-8 -*- ############################################################################## # # Copyright (c) 2010 Camptocamp SA (http://www.camptocamp.com) # All Right Reserved # # Author : Nicolas Bessi (Camptocamp) # # WARNING: This program as such is intended to be used by professional # programmers who...
agpl-3.0
dava/dava.engine
Thirdparty/googlemock/build.py
1
4049
import os import shutil import build_utils def get_supported_targets(platform): if platform == 'win32': return ['win32'] elif platform == 'darwin': return ['macos'] elif platform == 'linux': return ['linux'] else: return [] def get_dependencies_for_target(target): ...
bsd-3-clause
jdcamp/cameron_bakery
sites/all/themes/new_zen/node_modules/node-gyp/gyp/pylib/gyp/easy_xml_test.py
2698
3270
#!/usr/bin/env python # Copyright (c) 2011 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. """ Unit tests for the easy_xml.py file. """ import gyp.easy_xml as easy_xml import unittest import StringIO class TestSequenceFunctions(...
gpl-2.0
jordigh/mercurial-crew
contrib/debugcmdserver.py
8
1169
#!/usr/bin/env python # # Dumps output generated by Mercurial's command server in a formatted style to a # given file or stderr if '-' is specified. Output is also written in its raw # format to stdout. # # $ ./hg serve --cmds pipe | ./contrib/debugcmdserver.py - # o, 52 -> 'capabilities: getencoding runcommand\nenco...
gpl-2.0
twobob/buildroot-kindle
output/build/host-python-2.7.2/Tools/unicode/comparecodecs.py
44
1427
#!/usr/bin/env python """ Compare the output of two codecs. (c) Copyright 2005, Marc-Andre Lemburg (mal@lemburg.com). Licensed to PSF under a Contributor Agreement. """ import sys def compare_codecs(encoding1, encoding2): print 'Comparing encoding/decoding of %r and %r' % (encoding1, encoding2) mi...
gpl-2.0
dannyboi104/SickRage
sickbeard/metadata/wdtv.py
9
10810
# Author: Nic Wolfe <nic@wolfeden.ca> # URL: http://code.google.com/p/sickbeard/ # # This file is part of SickRage. # # SickRage 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,...
gpl-3.0
leki75/ansible
test/units/modules/cloud/amazon/test_ec2_vpc_nat_gateway.py
41
15733
import pytest import unittest from collections import namedtuple from ansible.parsing.dataloader import DataLoader from ansible.vars.manager import VariableManager from ansible.inventory.manager import InventoryManager from ansible.playbook.play import Play from ansible.executor.task_queue_manager import TaskQueueMana...
gpl-3.0
rogerhu/django
tests/foreign_object/tests.py
4
17714
import datetime from operator import attrgetter from .models import ( Country, Person, Group, Membership, Friendship, Article, ArticleTranslation, ArticleTag, ArticleIdea, NewsArticle) from django.test import TestCase from django.utils.translation import activate from django.core.exceptions import FieldError f...
bsd-3-clause
roadmapper/ansible
lib/ansible/modules/cloud/azure/azure_rm_subnet_info.py
14
7702
#!/usr/bin/python # # Copyright (c) 2019 Zim Kalinowski, (@zikalino) # # 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
rajendrant/bitsy_python
examples/wifi_nrf24_gateway.py
1
1144
from userlibs import arduino from userlibs import esp8266wifitcp from userlibs import nrf24 def on_nrf24_packet_recv(pkt): start=arduino.millis() print 'nrf24', len(pkt) esp8266wifitcp.send_response(pkt) print 'took', arduino.millis()-start def on_wifi_packet_recv(pkt): start=arduino.millis() ...
gpl-3.0
tecan/xchat-rt
plugins/scripts/encryption/supybot-code-6361b1e856ebbc8e14d399019e2c53a35f4e0063/plugins/ShrinkUrl/test.py
4
5892
### # Copyright (c) 2002-2004, Jeremiah Fincher # Copyright (c) 2009-2010, James McCoy # 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 ...
gpl-2.0
andreif/django
tests/admin_changelist/tests.py
18
37452
from __future__ import unicode_literals import datetime from django.contrib import admin from django.contrib.admin.models import LogEntry from django.contrib.admin.options import IncorrectLookupParameters from django.contrib.admin.templatetags.admin_list import pagination from django.contrib.admin.tests import AdminS...
bsd-3-clause
vladpopovici/WSItk
WSItk/segm/bot.py
1
9429
# -*- coding: utf-8 -*- """ SEGM.BOT: bag-of-things related functions. @author: vlad """ from __future__ import (absolute_import, division, print_function, unicode_literals) from builtins import * __version__ = 0.01 __author__ = 'Vlad Popovici' __all__ = ['grow_bag_from_new_image', 'grow_bag_with_new_features', ...
mit
qitan/SOMS
soms/settings.py
1
3812
#-*- coding:utf8 -*- """ Django settings for soms project. Generated by 'django-admin startproject' using Django 1.9. For more information on this file, see https://docs.djangoproject.com/en/1.9/topics/settings/ For the full list of settings and their values, see https://docs.djangoproject.com/en/1.9/ref/settings/ "...
gpl-3.0
maciekcc/tensorflow
tensorflow/contrib/learn/python/learn/dataframe/transforms/csv_parser.py
26
2228
# 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
burakbayramli/dersblog
algs/algs_180_speech/model_lstm.py
2
2484
# model_lstm.py import tensorflow as tf, util, os class Model: def __init__(self): self.file = os.path.basename(__file__).replace(".pyc","").replace(".py","") self.mfile = "/tmp/" + self.file + ".ckpt" self.batch_size = 100 self.num_epochs = 200 ...
gpl-3.0
jsoref/django
django/conf/locale/lt/formats.py
504
1830
# -*- 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 = r'Y \m. E j \d.' TIME_FORMAT = 'H:...
bsd-3-clause
juanifioren/django-oidc-provider
oidc_provider/lib/utils/oauth2.py
2
3033
from base64 import b64decode import logging import re from django.http import HttpResponse from oidc_provider.lib.errors import BearerTokenError from oidc_provider.models import Token logger = logging.getLogger(__name__) def extract_access_token(request): """ Get the access token using Authorization Reque...
mit
tvibliani/odoo
openerp/addons/base/ir/ir_qweb.py
38
64677
# -*- coding: utf-8 -*- import collections import cStringIO import datetime import hashlib import json import itertools import logging import math import os import re import sys import textwrap import uuid from subprocess import Popen, PIPE from urlparse import urlparse import babel import babel.dates import werkzeug ...
agpl-3.0
schleichdi2/openpli-e2
lib/python/Plugins/Extensions/MediaPlayer/plugin.py
6
38884
import os import time from enigma import iPlayableService, eTimer, eServiceCenter, iServiceInformation, ePicLoad from ServiceReference import ServiceReference from Screens.Screen import Screen from Screens.HelpMenu import HelpableScreen from Screens.MessageBox import MessageBox from Screens.InputBox import InputBox fro...
gpl-2.0
DONIKAN/django
django/core/files/locks.py
725
3516
""" Portable file locking utilities. Based partially on an example by Jonathan Feignberg in the Python Cookbook [1] (licensed under the Python Software License) and a ctypes port by Anatoly Techtonik for Roundup [2] (license [3]). [1] http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/65203 [2] http://sourceforg...
bsd-3-clause
pombredanne/intessa
lib/intessa/conneg/content_type.py
1
4716
"""This module contains representations of internet media type strings.""" import email.message import mimetypes import odict # Load the default MIME types database. if not mimetypes.inited: mimetypes.init() if hasattr(mimetypes, '_db'): DEFAULT_MIMETYPES_DB = mimetypes._db else: DEFAULT_MIMETYPES_DB = m...
unlicense
Blueshoe/djangocms-reversion2
djangocms_reversion2/signals.py
1
3786
# -*- coding: utf-8 -*- from cms.operations import REVERT_PAGE_TRANSLATION_TO_LIVE from django.db.models import signals def make_page_version_dirty(page, language): pv = page.page_versions.filter(active=True, language=language) if pv.count() > 0: pv = pv.first() if not pv.dirty: ...
mit
marcodilk/MDrespo_05
test-infra/s3_cache.py
2166
5734
#!/usr/bin/env python2.7 # pylint: disable=C0301 from __future__ import absolute_import, unicode_literals, print_function, division from sys import argv from os import environ, stat, chdir, remove as _delete_file from os.path import dirname, basename, abspath, realpath, expandvars from hashlib import sha256 from subpr...
mit
Juniper/neutron
neutron/plugins/mlnx/db/mlnx_models_v2.py
24
3360
# vim: tabstop=4 shiftwidth=4 softtabstop=4 # # Copyright 2013 Mellanox Technologies, Ltd # # 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
TeamExodus/external_chromium_org
third_party/cython/src/Cython/Plex/Errors.py
104
1120
#======================================================================= # # Python Lexical Analyser # # Exception classes # #======================================================================= class PlexError(Exception): message = "" class PlexTypeError(PlexError, TypeError): pass class PlexValueError(P...
bsd-3-clause
rjhunter8285/nsc-cloudproject-s22016
prototype/api/verify_oauth & blob/requests/packages/chardet/big5prober.py
2931
1684
######################## BEGIN LICENSE BLOCK ######################## # The Original Code is Mozilla Communicator client code. # # The Initial Developer of the Original Code is # Netscape Communications Corporation. # Portions created by the Initial Developer are Copyright (C) 1998 # the Initial Developer. All Rights R...
apache-2.0
Andy-hpliu/AirtestX
atx/cmds/webide.py
1
7985
# coding: utf-8 import os import sys import logging import webbrowser import socket import time import json import traceback import cv2 import tornado.ioloop import tornado.web import tornado.websocket from tornado.concurrent import run_on_executor from concurrent.futures import ThreadPoolExecutor # `pip install fu...
apache-2.0
SoteriousIdaofevil/xmlstar
src/libxml2-2.9.1/check-xinclude-test-suite.py
347
5333
#!/usr/bin/python import sys import time import os import string sys.path.insert(0, "python") import libxml2 # # the testsuite description # DIR="xinclude-test-suite" CONF="testdescr.xml" LOG="check-xinclude-test-suite.log" log = open(LOG, "w") os.chdir(DIR) test_nr = 0 test_succeed = 0 test_failed = 0 test_error =...
mit
AASHE/hub
hub/apps/metadata/migrations/0024_greenpowerfinanceoption_greenpowerinstallation_greenpowerlocation.py
1
1828
# -*- coding: utf-8 -*- # Generated by Django 1.9.13 on 2017-09-07 20:31 from __future__ import unicode_literals from django.db import migrations, models class Migration(migrations.Migration): dependencies = [ ('metadata', '0023_new_rss_urls'), ] operations = [ migrations.CreateModel( ...
mit
pantsbuild/pex
pex/vendor/_vendored/pip/pip/_internal/resolution/resolvelib/found_candidates.py
2
3773
"""Utilities to lazily create and visit candidates found. Creating and visiting a candidate is a *very* costly operation. It involves fetching, extracting, potentially building modules from source, and verifying distribution metadata. It is therefore crucial for performance to keep everything here lazy all the way dow...
apache-2.0
mlcommons/training
object_detection/pytorch/maskrcnn_benchmark/utils/logger.py
1
1392
# Copyright (c) 2021, NVIDIA CORPORATION. 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 applic...
apache-2.0
dataxu/ansible
lib/ansible/modules/windows/win_domain.py
16
2482
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2017, 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 ...
gpl-3.0
mark-ignacio/phantomjs
src/qt/qtwebkit/Tools/QueueStatusServer/loggers/recordpatchevent.py
119
4813
# Copyright (C) 2013 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
ben-manes/cassandra
bin/cqlsh.py
1
104402
#!/bin/sh # -*- mode: Python -*- # 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....
apache-2.0