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
mansilladev/zulip
zerver/lib/context_managers.py
120
1090
""" Context managers, i.e. things you can use with the 'with' statement. """ from __future__ import absolute_import import fcntl import os from contextlib import contextmanager @contextmanager def flock(lockfile, shared=False): """Lock a file object using flock(2) for the duration of a 'with' statement. ...
apache-2.0
MinchinWeb/topydo
test/DeleteCommandTest.py
1
9064
# Topydo - A todo.txt client written in Python. # Copyright (C) 2014 - 2015 Bram Schoenmakers <me@bramschoenmakers.nl> # # 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 L...
gpl-3.0
thomazs/geraldo
site/newsite/django_1_0/django/contrib/auth/tests/forms.py
10
2992
FORM_TESTS = """ >>> from django.contrib.auth.models import User >>> from django.contrib.auth.forms import UserCreationForm, AuthenticationForm >>> from django.contrib.auth.forms import PasswordChangeForm The user already exists. >>> user = User.objects.create_user("jsmith", "jsmith@example.com", "test123") >>> data...
lgpl-3.0
yan12125/youtube-dl
youtube_dl/extractor/vrak.py
61
2943
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from .brightcove import BrightcoveNewIE from ..utils import ( int_or_none, parse_age_limit, smuggle_url, unescapeHTML, ) class VrakIE(InfoExtractor): _VALID_URL = r'https?://(?:www\.)?vrak\.tv/vid...
unlicense
ataylor32/django
django/db/transaction.py
186
11823
from django.db import ( DEFAULT_DB_ALIAS, DatabaseError, Error, ProgrammingError, connections, ) from django.utils.decorators import ContextDecorator class TransactionManagementError(ProgrammingError): """ This exception is thrown when transaction management is used improperly. """ pass def get_...
bsd-3-clause
Architektor/PySnip
venv/lib/python2.7/site-packages/twisted/python/test/test_url.py
3
29330
# -*- test-case-name: twisted.python.test.test_url -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ Tests for L{twisted.python.url}. """ from __future__ import unicode_literals from ..url import URL unicode = type(u'') from unittest import TestCase theurl = "http://www.foo.com/a/nice/...
gpl-3.0
alexryndin/ambari
ambari-server/src/test/python/TestYAMLUtils.py
5
3715
#!/usr/bin/env 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.0 (the "License")...
apache-2.0
GiladE/birde
venv/lib/python2.7/site-packages/psycopg2/tests/test_connection.py
39
39512
#!/usr/bin/env python # test_connection.py - unit test for connection attributes # # Copyright (C) 2008-2011 James Henstridge <james@jamesh.id.au> # # psycopg2 is free software: you can redistribute it and/or modify it # under the terms of the GNU Lesser General Public License as published # by the Free Software Foun...
mit
martydill/url_shortener
code/venv/lib/python2.7/site-packages/IPython/qt/console/pygments_highlighter.py
5
8696
# System library imports. from IPython.external.qt import QtGui from pygments.formatters.html import HtmlFormatter from pygments.lexer import RegexLexer, _TokenType, Text, Error from pygments.lexers import PythonLexer from pygments.styles import get_style_by_name # Local imports from IPython.utils.py3compat import str...
mit
kbrebanov/ansible
lib/ansible/modules/cloud/docker/docker_container.py
3
80183
#!/usr/bin/python # # Copyright 2016 Red Hat | Ansible # 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': ['prev...
gpl-3.0
DavidAndreev/indico
indico/modules/events/surveys/forms.py
1
6843
# This file is part of Indico. # Copyright (C) 2002 - 2016 European Organization for Nuclear Research (CERN). # # Indico 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 (a...
gpl-3.0
tbarbette/clickwatcher
npf_compare.py
1
7662
#!/usr/bin/env python3 """ NPF Program to compare multiple software against the same testie A specific script for that purpose is needed because tags may influence the testie according to the repo, so some tricks to find common variables must be used. For this reason also one testie only is supported in comparator. ""...
gpl-3.0
SEL-Columbia/commcare-hq
custom/m4change/reports/mcct_project_review.py
1
23053
from datetime import date, datetime from django.core.urlresolvers import reverse from django.http import HttpResponse from django.utils.safestring import mark_safe from django.utils.translation import ugettext as _ from jsonobject import DateTimeProperty from corehq.apps.locations.models import Location from corehq.ap...
bsd-3-clause
cmtm/networkx
networkx/readwrite/tests/test_shp.py
9
7027
"""Unit tests for shp. """ import os import tempfile from nose import SkipTest from nose.tools import assert_equal import networkx as nx class TestShp(object): @classmethod def setupClass(cls): global ogr try: from osgeo import ogr except ImportError: raise Ski...
bsd-3-clause
ebt-hpc/cca
cca/scripts/metrics_queries_cpp.py
1
23376
#!/usr/bin/env python3 ''' Source code metrics for C programs Copyright 2013-2018 RIKEN Copyright 2018-2020 Chiba Institute of Technology 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 a...
apache-2.0
safwanrahman/kitsune
kitsune/sumo/paginator.py
23
3063
from django.core.paginator import (Paginator as DjPaginator, EmptyPage, InvalidPage, Page, PageNotAnInteger) __all__ = ['Paginator', 'EmptyPage', 'InvalidPage'] class Paginator(DjPaginator): """Allows you to pass in a `count` kwarg to avoid running an expensive, uncacheabl...
bsd-3-clause
HLFH/CouchPotatoServer
couchpotato/core/media/movie/providers/trailer/youtube_dl/extractor/viki.py
35
3332
from __future__ import unicode_literals import re from ..utils import ( ExtractorError, unescapeHTML, unified_strdate, US_RATINGS, ) from .subtitles import SubtitlesInfoExtractor class VikiIE(SubtitlesInfoExtractor): IE_NAME = 'viki' _VALID_URL = r'^https?://(?:www\.)?viki\.com/videos/(?P<i...
gpl-3.0
denny820909/builder
lib/python2.7/site-packages/Twisted-12.2.0-py2.7-linux-x86_64.egg/twisted/names/dns.py
5
55177
# -*- test-case-name: twisted.names.test.test_dns -*- # Copyright (c) Twisted Matrix Laboratories. # See LICENSE for details. """ DNS protocol implementation. Future Plans: - Get rid of some toplevels, maybe. @author: Moshe Zadka @author: Jean-Paul Calderone """ __all__ = [ 'IEncodable', 'IRecord', 'A'...
mit
frappe/frappe
frappe/commands/scheduler.py
1
5626
import click import sys import frappe from frappe.utils import cint from frappe.commands import pass_context, get_site from frappe.exceptions import SiteNotSpecifiedError def _is_scheduler_enabled(): enable_scheduler = False try: frappe.connect() enable_scheduler = cint(frappe.db.get_single_value("System Setting...
mit
UKPLab/sentence-transformers
examples/applications/clustering/kmeans.py
1
1393
""" This is a simple application for sentence embeddings: clustering Sentences are mapped to sentence embeddings and then k-mean clustering is applied. """ from sentence_transformers import SentenceTransformer from sklearn.cluster import KMeans embedder = SentenceTransformer('paraphrase-MiniLM-L6-v2') # Corpus with ...
apache-2.0
deathping1994/sendmail-api
venv/lib/python2.7/site-packages/pip/_vendor/colorama/ansi.py
442
2304
# Copyright Jonathan Hartley 2013. BSD 3-Clause license, see LICENSE file. ''' This module generates ANSI character codes to printing colors to terminals. See: http://en.wikipedia.org/wiki/ANSI_escape_code ''' CSI = '\033[' OSC = '\033]' BEL = '\007' def code_to_chars(code): return CSI + str(code) + 'm' class ...
apache-2.0
ChenJunor/hue
desktop/core/ext-py/boto-2.38.0/boto/gs/resumable_upload_handler.py
153
31419
# Copyright 2010 Google Inc. # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modify, merge, publish, dis- # trib...
apache-2.0
kustodian/ansible
lib/ansible/modules/cloud/google/gcp_compute_subnetwork.py
9
20957
#!/usr/bin/python # -*- coding: utf-8 -*- # # Copyright (C) 2017 Google # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # ---------------------------------------------------------------------------- # # *** AUTO GENERATED CODE *** AUTO GENERATED CODE *** # ...
gpl-3.0
RaresO/test
node_modules/node-gyp/gyp/pylib/gyp/win_tool.py
1417
12751
#!/usr/bin/env python # Copyright (c) 2012 Google Inc. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Utility functions for Windows builds. These functions are executed via gyp-win-tool when using the ninja generator. """ import os impor...
mit
openmv/micropython
tests/wipy/time.py
14
3272
import time DAYS_PER_MONTH = [0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31] def is_leap(year): return (year % 4) == 0 def test(): seconds = 0 wday = 5 # Jan 1, 2000 was a Saturday for year in range(2000, 2049): print("Testing %d" % year) yday = 1 for month in range(1, ...
mit
cbrewster/servo
tests/wpt/web-platform-tests/xhr/resources/authentication.py
10
1115
def main(request, response): session_user = request.auth.username session_pass = request.auth.password expected_user_name = request.headers.get("X-User", None) token = expected_user_name if session_user is None and session_pass is None: if token is not None and request.server.stash.take(tok...
mpl-2.0
MQQiang/kbengine
kbe/src/lib/python/Lib/test/test_marshal.py
72
15097
from test import support import array import io import marshal import sys import unittest import os import types class HelperMixin: def helper(self, sample, *extra): new = marshal.loads(marshal.dumps(sample, *extra)) self.assertEqual(sample, new) try: with open(support.TESTFN, "...
lgpl-3.0
minhphung171093/GreenERP_V8
openerp/addons/edi/edi_service.py
377
2517
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Business Applications # Copyright (c) 2011 OpenERP S.A. <http://openerp.com> # # This program is free software: you can redistribute it and/or modify # it under the terms of the GN...
agpl-3.0
ChenJunor/hue
desktop/core/ext-py/tablib-0.10.0/tablib/packages/xlwt3/UnicodeUtils.py
46
3408
''' From BIFF8 on, strings are always stored using UTF-16LE text encoding. The character array is a sequence of 16-bit values4. Additionally it is possible to use a compressed format, which omits the high bytes of all characters, if they are all zero. The following tables describe the standard form...
apache-2.0
mohamed--abdel-maksoud/chromium.src
build/extract_from_cab.py
164
2059
#!/usr/bin/env python # Copyright (c) 2012 The Chromium Authors. All rights reserved. # Use of this source code is governed by a BSD-style license that can be # found in the LICENSE file. """Extracts a single file from a CAB archive.""" import os import shutil import subprocess import sys import tempfile def run_qui...
bsd-3-clause
tsnoam/Flexget
flexget/plugins/modify/headers.py
8
2491
from __future__ import unicode_literals, division, absolute_import import logging import urllib2 from flexget import plugin from flexget.event import event log = logging.getLogger('headers') class HTTPHeadersProcessor(urllib2.BaseHandler): # run first handler_order = urllib2.HTTPHandler.handler_order - 10 ...
mit
rahulunair/nova
nova/debugger.py
13
2100
# Copyright 2010 United States Government as represented by the # Administrator of the National Aeronautics and Space Administration. # Copyright 2011 Justin Santa Barbara # All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); you may # not use this file except in compliance wi...
apache-2.0
bmya/tkobr-addons
tko_point_of_sale_discount_cards/__init__.py
3
1096
# -*- encoding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2010 Tiny SPRL (<http://tiny.be>). # # Thinkopen Brasil # Copyright (C) Thinkopen Solutions Brasil (<http://www.tkobr.com>). # # This ...
agpl-3.0
ghislainp/iris
docs/iris/example_code/General/custom_file_loading.py
4
11862
""" Loading a cube from a custom file format ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ This example shows how a custom text file can be loaded using the standard Iris load mechanism. The first stage in the process is to define an Iris :class:`FormatSpecification <iris.io.format_picker.FormatSpecification>` for the fil...
gpl-3.0
uclouvain/osis_louvain
base/forms/utils/uppercase.py
1
1402
############################################################################## # # OSIS stands for Open Student Information System. It's an application # designed to manage the core business of higher education institutions, # such as universities, faculties, institutes and professional schools. # The core ...
agpl-3.0
Smarsh/django
django/core/management/commands/testserver.py
19
1661
from django.core.management.base import BaseCommand from optparse import make_option class Command(BaseCommand): option_list = BaseCommand.option_list + ( make_option('--noinput', action='store_false', dest='interactive', default=True, help='Tells Django to NOT prompt the user for input of any...
bsd-3-clause
COOLMASON/ThinkStats2
code/analytic.py
69
6265
"""This file contains code used in "Think Stats", by Allen B. Downey, available from greenteapress.com Copyright 2010 Allen B. Downey License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html """ from __future__ import print_function import math import numpy as np import pandas import nsfg import thinkplot import th...
gpl-3.0
horance-liu/tensorflow
tensorflow/contrib/distributions/python/ops/vector_laplace_diag.py
60
8326
# 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
zenefits/sentry
src/sentry/south_migrations/0064_index_checksum.py
36
19092
# -*- coding: utf-8 -*- import datetime from south.db import db from south.v2 import SchemaMigration from django.db import models class Migration(SchemaMigration): def forwards(self, orm): db.create_index('sentry_groupedmessage', ['project_id', 'checksum']) def backwards(self, orm): db.delet...
bsd-3-clause
genos/Programming
workbench/nn.py
1
5367
#!/usr/bin/env python3 # coding: utf-8 """nn.py A simple feed-forward neural network, inspired by: - iamtrask.github.io/2015/07/12/basic-python-network/ - rolisz.ro/2013/04/18/neural-networks-in-python - mattmazur.com/2015/03/17/a-step-by-step-backpropagation-example/ """ from dataclasses import dataclass, field from t...
mit
JaguarSecurity/SMG
security_monkey/exceptions.py
2
3893
# Copyright 2014 Netflix, 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...
apache-2.0
cyrustabatab/mptcp
examples/wireless/wifi-ap.py
108
5883
# -*- Mode: Python; -*- # /* # * Copyright (c) 2005,2006,2007 INRIA # * Copyright (c) 2009 INESC Porto # * # * 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; # * # * This p...
gpl-2.0
isandlaTech/cohorte-runtime
python/cohorte/config/finder.py
2
10351
#!/usr/bin/env python # -- Content-Encoding: UTF-8 -- """ COHORTE file finder **TODO:** * Review API :author: Thomas Calmant :license: Apache Software License 2.0 .. Copyright 2014 isandlaTech Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance...
apache-2.0
bitmazk/django-generic-positions
generic_positions/models.py
1
1493
"""Models for the ``generic_positions`` app.""" from django.contrib.contenttypes.models import ContentType from django.contrib.contenttypes import fields from django.db import models from django.utils.translation import ugettext_lazy as _ class ObjectPosition(models.Model): """ Model to add a position field t...
mit
Yong-Lee/liyong
admin.py
4
17722
# -*- coding: utf-8 -*- import logging import re try: import json except: import simplejson as json from hashlib import md5 from time import time from datetime import datetime,timedelta from urllib import urlencode from common import BaseHandler, authorized, safe_encode, cnnow, clear_cache_by_pathlist, quot...
mit
pckiller2008/pyfpdf
tutorial/tuto3.py
21
1565
from fpdf import FPDF title='20000 Leagues Under the Seas' class PDF(FPDF): def header(self): #Arial bold 15 self.set_font('Arial','B',15) #Calculate width of title and position w=self.get_string_width(title)+6 self.set_x((210-w)/2) #Colors of frame, background and text self.set_draw_color(0,80,180) ...
lgpl-3.0
stackforge/python-solumclient
solumclient/tests/common/test_auth.py
1
3915
# Copyright 2013 - Noorul Islam K M # # 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 w...
apache-2.0
victor-gonzalez/AliPhysics
PWGJE/EMCALJetTasks/macros/JetQA/plotPWGJEQA.py
27
87685
#! /usr/bin/env python # Macro to plot PWGJE QA histograms, using AliAnalysisTaskPWGJEQA. # # It automatically detects what to plot, based on the content of your analysis output file: # whether to do track/calo/jet/event QA, as well as MC vs. data, PbPb vs. pp, Run1 vs. Run2, Phos vs. no Phos. # # To run: # python...
bsd-3-clause
eduNEXT/edx-platform
openedx/core/djangoapps/credit/migrations/0001_initial.py
4
12583
import django.core.validators import django.db.models.deletion import django.utils.timezone import jsonfield.fields import model_utils.fields from django.conf import settings from django.db import migrations, models from opaque_keys.edx.django.models import CourseKeyField import openedx.core.djangoapps.credit.models ...
agpl-3.0
hyperized/ansible
lib/ansible/plugins/inventory/constructed.py
42
5477
# Copyright (c) 2017 Ansible Project # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) from __future__ import (absolute_import, division, print_function) __metaclass__ = type DOCUMENTATION = ''' name: constructed plugin_type: inventory version_added: "2.4" sh...
gpl-3.0
xsm110/Apache-Beam
sdks/python/apache_beam/io/gcp/datastore/v1/datastoreio_test.py
6
10278
# # 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 us...
apache-2.0
baberthal/CouchPotatoServer
libs/suds/transport/__init__.py
209
3895
# This program is free software; you can redistribute it and/or modify # it under the terms of the (LGPL) GNU Lesser General Public License as # published by the Free Software Foundation; either version 3 of the # License, or (at your option) any later version. # # This program is distributed in the hope that it will ...
gpl-3.0
maheshcn/memory-usage-from-ldfile
openpyxl/xml/tests/test_tags.py
1
1093
# Copyright (c) 2010-2015 openpyxl from io import BytesIO import pytest from openpyxl.xml.functions import start_tag, end_tag, tag, XMLGenerator @pytest.fixture def doc(): return BytesIO() @pytest.fixture def root(doc): return XMLGenerator(doc) class TestSimpleTag: def test_start_tag(self, doc, root)...
gpl-2.0
stack-of-tasks/rbdlpy
tutorial/lib/python2.7/site-packages/OpenGL/GL/EXT/shared_texture_palette.py
9
1264
'''OpenGL extension EXT.shared_texture_palette This module customises the behaviour of the OpenGL.raw.GL.EXT.shared_texture_palette to provide a more Python-friendly API Overview (from the spec) EXT_shared_texture_palette defines a shared texture palette which may be used in place of the texture object palettes...
lgpl-3.0
michellemorales/OpenMM
models/inception/inception/data/process_bounding_boxes.py
19
8931
#!/usr/bin/python # Copyright 2016 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 a...
gpl-2.0
collects/VTK
Charts/Core/Testing/Python/TestScatterPlotColors.py
26
3217
#!/usr/bin/env python # -*- coding: utf-8 -*- import os import vtk import vtk.test.Testing import math class TestScatterPlotColors(vtk.test.Testing.vtkTest): def testLinePlot(self): "Test if colored scatter plots can be built with python" # Set up a 2D scene, add an XY chart to it view = ...
bsd-3-clause
liucode/tempest-master
tempest/services/compute/json/migrations_client.py
8
1246
# Copyright 2014 NEC Corporation. # # 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
punithagk/mpm
profiles/uberdrupal/modules/fckeditor/fckeditor/editor/filemanager/connectors/py/config.py
126
7095
#!/usr/bin/env python """ * FCKeditor - The text editor for Internet - http://www.fckeditor.net * Copyright (C) 2003-2010 Frederico Caldeira Knabben * * == BEGIN LICENSE == * * Licensed under the terms of any of the following licenses at your * choice: * * - GNU General Public License Version 2 or l...
gpl-2.0
carlgao/lenga
images/lenny64-peon/usr/share/python-support/mercurial-common/mercurial/archival.py
1
7571
# archival.py - revision archival for mercurial # # Copyright 2006 Vadim Gelfer <vadim.gelfer@gmail.com> # # This software may be used and distributed according to the terms of # the GNU General Public License, incorporated herein by reference. from i18n import _ from node import hex import cStringIO, os, stat, tarfil...
mit
Microsoft/PTVS
Python/Product/Miniconda/Miniconda3-x64/Lib/encodings/mac_centeuro.py
257
14102
""" Python Character Mapping Codec mac_centeuro generated from 'MAPPINGS/VENDORS/APPLE/CENTEURO.TXT' with gencodec.py. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_table) def decode(self,inp...
apache-2.0
iulian787/spack
var/spack/repos/builtin/packages/py-onnx/package.py
5
1572
# Copyright 2013-2020 Lawrence Livermore National Security, LLC and other # Spack Project Developers. See the top-level COPYRIGHT file for details. # # SPDX-License-Identifier: (Apache-2.0 OR MIT) from spack import * class PyOnnx(PythonPackage): """Open Neural Network Exchange (ONNX) is an open ecosystem that ...
lgpl-2.1
Axelio/pruebas_camelot
virtualenv/lib/python2.7/site-packages/pip/_vendor/requests/packages/urllib3/poolmanager.py
550
8977
# urllib3/poolmanager.py # Copyright 2008-2014 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 import logging try: # Python 3 from urllib.parse import urljoin except ImportError: ...
gpl-3.0
jcpowermac/ansible-modules-extras
cloud/vmware/vmware_vmkernel_ip_config.py
75
3851
#!/usr/bin/python # -*- coding: utf-8 -*- # (c) 2015, Joseph Callen <jcallen () csc.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 Li...
gpl-3.0
WSDC-NITWarangal/django
django/template/loaders/filesystem.py
418
2158
""" Wrapper for loading templates from the filesystem. """ import errno import io import warnings from django.core.exceptions import SuspiciousFileOperation from django.template import Origin, TemplateDoesNotExist from django.utils._os import safe_join from django.utils.deprecation import RemovedInDjango20Warning fr...
bsd-3-clause
loretoparisi/nupic
examples/opf/tools/testDiagnostics.py
58
1606
import numpy as np def printMatrix(inputs, spOutput): ''' (i,j)th cell of the diff matrix will have the number of inputs for which the input and output pattern differ by i bits and the cells activated differ at j places. Parameters: -------------------------------------------------------------------- input...
agpl-3.0
rvraghav93/scikit-learn
sklearn/manifold/tests/test_t_sne.py
11
25443
import sys from sklearn.externals.six.moves import cStringIO as StringIO import numpy as np import scipy.sparse as sp from sklearn.neighbors import BallTree from sklearn.utils.testing import assert_less_equal from sklearn.utils.testing import assert_equal from sklearn.utils.testing import assert_almost_equal from skle...
bsd-3-clause
dims/nova
nova/tests/unit/cmd/test_baseproxy.py
5
3573
# Copyright 2015 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 to in writing, so...
apache-2.0
joomel1/phantomjs
src/qt/qtwebkit/Tools/Scripts/webkitpy/tool/commands/rebaseline_unittest.py
118
23190
# Copyright (C) 2010 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 f...
bsd-3-clause
mlperf/training_results_v0.6
Google/benchmarks/mask/implementations/tpu-v3-256-mask/mask_rcnn/object_detection/tf_example_decoder.py
11
10004
# 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
MagicStack/MagicPython
test/docstrings/escaping1.py
1
4218
'''Module docstring {{ %d simple \\ string \ foo \' \" \a \b \c \f \n \r \t \v \5 \55 \555 \05 \005 multiline "unicode" string \ \xf1 \u1234aaaa \U1234aaaa \N{BLACK SPADE SUIT} ''' ''' : punctuation.definition.string.begin.python, source.python, string.quoted.docstring.multi.python Mo...
mit
xgds/xgds_planner2
xgds_planner2/choosePlanExporter.py
1
1880
#__BEGIN_LICENSE__ # Copyright (c) 2015, United States Government, as represented by the # Administrator of the National Aeronautics and Space Administration. # All rights reserved. # # The xGDS platform is licensed under the Apache License, Version 2.0 # (the "License"); you may not use this file except in compliance ...
apache-2.0
maliciamrg/xbmc-addon-tvtumbler
resources/lib/tvdb_api/tvdb_exceptions.py
2
1233
#!/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/) """Custom exceptions used or raised by tvdb_api """ __author__ = "dbr/Ben" __version__ = "1.8.2" __all__ = ["tvdb_error", "tvdb_userabort", "tvdb_shownotfound"...
gpl-3.0
rgeleta/odoo
addons/stock/report/stock_graph.py
326
4514
# -*- 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
def-/commandergenius
project/jni/python/src/Demo/turtle/tdemo_wikipedia.py
42
1347
""" turtle-example-suite: tdemo_wikipedia3.py This example is inspired by the Wikipedia article on turtle graphics. (See example wikipedia1 for URLs) First we create (ne-1) (i.e. 35 in this example) copies of our first turtle p. Then we let them perform their steps in parallel. Followed by a complete...
lgpl-2.1
atlassian/boto
boto/sdb/db/manager/xmlmanager.py
153
18612
# Copyright (c) 2006-2008 Mitch Garnaat http://garnaat.org/ # # Permission is hereby granted, free of charge, to any person obtaining a # copy of this software and associated documentation files (the # "Software"), to deal in the Software without restriction, including # without limitation the rights to use, copy, modi...
mit
rvalyi/geraldo
site/newsite/django_1_0/tests/regressiontests/forms/forms.py
10
83944
# -*- coding: utf-8 -*- tests = r""" >>> from django.forms import * >>> from django.core.files.uploadedfile import SimpleUploadedFile >>> import datetime >>> import time >>> import re >>> try: ... from decimal import Decimal ... except ImportError: ... from django.utils._decimal import Decimal ######### # Form...
lgpl-3.0
mohammed52/something.pk
node_modules/node-gyp/gyp/pylib/gyp/MSVSVersion.py
1509
17165
# Copyright (c) 2013 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. """Handle version information related to Visual Stuio.""" import errno import os import re import subprocess import sys import gyp import glob class VisualStudi...
mit
mikeolteanu/livepythonconsole-app-engine
boilerplate/external/apiclient/mimeparse.py
189
6486
# Copyright (C) 2007 Joe Gregorio # # Licensed under the MIT License """MIME-Type Parser This module provides basic functions for handling mime-types. It can handle matching mime-types against a list of media-ranges. See section 14.1 of the HTTP specification [RFC 2616] for a complete explanation. http://www.w3.o...
lgpl-3.0
dea82/StateMachineCreator
dev-tools/cpplint.py
1
249692
#!/usr/bin/env python # # Copyright (c) 2009 Google Inc. All rights reserved. # # Redistribution and use in source and binary forms, with or without # modification, are permitted provided that the following conditions are # met: # # * Redistributions of source code must retain the above copyright # notice, this list...
mit
wylwang/vnpy
archive/vn.lts_old/pyscript/l2/generate_struct.py
73
1370
# encoding: UTF-8 __author__ = 'CHENXY' from l2_data_type import * def main(): """主函数""" fcpp = open('SecurityFtdcL2MDUserApiStruct.h', 'r') fpy = open('l2_struct.py', 'w') fpy.write('# encoding: UTF-8\n') fpy.write('\n') fpy.write('structDict = {}\n') fpy.write('\n') for line in fc...
mit
nhuntwalker/astroML
astroML/datasets/sdss_galaxy_colors.py
3
2595
from __future__ import print_function, division import os import numpy as np from . import get_data_home from .tools import sql_query SPECCLASS = ['UNKNOWN', 'STAR', 'GALAXY', 'QSO', 'HIZ_QSO', 'SKY', 'STAR_LATE', 'GAL_EM'] NOBJECTS = 50000 GAL_COLORS_DTYPE = [('u', float), ('g', f...
bsd-2-clause
GdZ/scriptfile
software/googleAppEngine/lib/django_1_3/django/contrib/auth/__init__.py
151
4560
import datetime from warnings import warn from django.core.exceptions import ImproperlyConfigured from django.utils.importlib import import_module from django.contrib.auth.signals import user_logged_in, user_logged_out SESSION_KEY = '_auth_user_id' BACKEND_SESSION_KEY = '_auth_user_backend' REDIRECT_FIELD_NAME = 'next...
mit
treejames/viewfinder
backend/www/test/photo_store_test.py
13
11195
#!/usr/bin/env python # # Copyright 2012 Viewfinder Inc. All Rights Reserved. """Test PhotoStore GET and PUT. """ __authors__ = ['spencer@emailscrubbed.com (Spencer Kimball)', 'andy@emailscrubbed.com (Andy Kimball)'] import base64 import hashlib import json import time from functools import partial f...
apache-2.0
jmcarp/django
django/core/management/commands/shell.py
492
3951
import os from django.core.management.base import BaseCommand class Command(BaseCommand): help = "Runs a Python interactive interpreter. Tries to use IPython or bpython, if one of them is available." requires_system_checks = False shells = ['ipython', 'bpython'] def add_arguments(self, parser): ...
bsd-3-clause
javierTerry/odoo
addons/payment_ogone/data/ogone.py
395
30321
# -*- coding: utf-8 -*- OGONE_ERROR_MAP = { '0020001001': "Authorization failed, please retry", '0020001002': "Authorization failed, please retry", '0020001003': "Authorization failed, please retry", '0020001004': "Authorization failed, please retry", '0020001005': "Authorization failed, please ret...
agpl-3.0
keyurpatel076/MissionPlannerGit
Lib/encodings/iso8859_4.py
593
13632
""" Python Character Mapping Codec iso8859_4 generated from 'MAPPINGS/ISO8859/8859-4.TXT' with gencodec.py. """#" import codecs ### Codec APIs class Codec(codecs.Codec): def encode(self,input,errors='strict'): return codecs.charmap_encode(input,errors,encoding_table) def decode(self,input,errors='...
gpl-3.0
Dino0631/RedRain-Bot
lib/youtube_dl/extractor/kanalplay.py
90
3283
# coding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( ExtractorError, float_or_none, srt_subtitles_timecode, ) class KanalPlayIE(InfoExtractor): IE_DESC = 'Kanal 5/9/11 Play' _VALID_URL = r'https?://(?:www\.)?kanal(?P<channel_id...
gpl-3.0
liqd/adhocracy
src/adhocracy/migration/versions/036_proposal_variant_relation_migrate_values.py
4
6755
from datetime import datetime from logging import getLogger from pickle import dumps, loads import re from sqlalchemy import (MetaData, Column, ForeignKey, DateTime, Integer, PickleType, String, Table, Unicode) metadata = MetaData() log = getLogger(__name__) def are_elements_equal(x, y): ...
agpl-3.0
bala4901/odoo
addons/account_asset/report/account_asset_report.py
40
4235
# -*- encoding: 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 t...
agpl-3.0
zonk1024/moto
tests/test_autoscaling/test_launch_configurations.py
17
7779
from __future__ import unicode_literals import boto from boto.ec2.autoscale.launchconfig import LaunchConfiguration from boto.ec2.blockdevicemapping import BlockDeviceType, BlockDeviceMapping import sure # noqa from moto import mock_autoscaling from tests.helpers import requires_boto_gte @mock_autoscaling def test...
apache-2.0
popazerty/enigma2-4.3
lib/python/Plugins/SystemPlugins/PositionerSetup/plugin.py
6
50500
from enigma import eTimer, eDVBResourceManager, eDVBDiseqcCommand, eDVBFrontendParametersSatellite, iDVBFrontend from Screens.Screen import Screen from Screens.MessageBox import MessageBox from Plugins.Plugin import PluginDescriptor from Components.Label import Label from Components.Button import Button from Componen...
gpl-2.0
JFriel/honours_project
venv/lib/python2.7/site-packages/pip/vendor/html5lib/treewalkers/pulldom.py
1729
2302
from __future__ import absolute_import, division, unicode_literals from xml.dom.pulldom import START_ELEMENT, END_ELEMENT, \ COMMENT, IGNORABLE_WHITESPACE, CHARACTERS from . import _base from ..constants import voidElements class TreeWalker(_base.TreeWalker): def __iter__(self): ignore_until = None...
gpl-3.0
Arcanemagus/SickRage
lib/dateutil/parser/__init__.py
22
1727
# -*- coding: utf-8 -*- from ._parser import parse, parser, parserinfo from ._parser import DEFAULTPARSER, DEFAULTTZPARSER from ._parser import UnknownTimezoneWarning from ._parser import __doc__ from .isoparser import isoparser, isoparse __all__ = ['parse', 'parser', 'parserinfo', 'isoparse', 'isoparser'...
gpl-3.0
tuhangdi/django
django/contrib/auth/context_processors.py
514
1938
# PermWrapper and PermLookupDict proxy the permissions system into objects that # the template system can understand. class PermLookupDict(object): def __init__(self, user, app_label): self.user, self.app_label = user, app_label def __repr__(self): return str(self.user.get_all_permissions()) ...
bsd-3-clause
TGAC/RAMPART
doc/source/conf.py
1
10364
# -*- coding: utf-8 -*- # # RAMPART documentation build configuration file, created by # sphinx-quickstart on Wed Dec 11 14:37:43 2013. # # 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. # # A...
gpl-3.0
lyft/incubator-airflow
airflow/providers/google/cloud/example_dags/example_compute.py
4
4444
# # 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...
apache-2.0
pyramania/scipy
scipy/__init__.py
6
4850
""" SciPy: A scientific computing package for Python ================================================ Documentation is available in the docstrings and online at https://docs.scipy.org. Contents -------- SciPy imports all the functions from the NumPy namespace, and in addition provides: Subpackages ----------- Using ...
bsd-3-clause
shoopio/shoop
shuup/gdpr/templatetags/__init__.py
1
1113
# -*- coding: utf-8 -*- # This file is part of Shuup. # # Copyright (c) 2012-2019, Shoop Commerce Ltd. All rights reserved. # # This source code is licensed under the OSL-3.0 license found in the # LICENSE file in the root directory of this source tree. from django_jinja import library import jinja2 import json from d...
agpl-3.0
code4futuredotorg/reeborg_tw
src/libraries/brython/Lib/logging/handlers.py
736
55579
# Copyright 2001-2013 by Vinay Sajip. All Rights Reserved. # # Permission to use, copy, modify, and distribute this software and its # documentation for any purpose and without fee is hereby granted, # provided that the above copyright notice appear in all copies and that # both that copyright notice and this permissio...
agpl-3.0
nicobustillos/odoo
addons/hr_holidays/wizard/hr_holidays_summary_employees.py
337
2152
# -*- 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