text
stringlengths
475
200k
# Copyright 2012 VMware, 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...
"""RSA module Module for calculating large primes, and RSA encryption, decryption, signing and verification. Includes generating public and private keys. WARNING: this implementation does not use random padding, compression of the cleartext input to prevent repetitions, or other common security improvements. Use with...
# workserver.py - simple HTTP server with a do_work / stop_work API # GET /do_work activates a worker thread which uses CPU # GET /stop_work signals worker thread to stop import math import socket import threading import time from bottle import route, run hostname = socket.gethostname() hostport = 9000 keepworking = ...
# -*- 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'...
#coding: utf-8 import sqlite3 from pkg_resources import parse_version __version__ = "0.2.1" __author__ = "Mickael Desfrenes" __email__ = "[EMAIL]" # Yen 2013.04.08, 將 Python2 的 .next() 改為 next(), 以便在 Python 3 中使用 class SQLiteWriter(object): """ In frozen mode (the default), the writer will not alter db sche...
# # Subscription manager command line utility. This script is a modified version of # cp_client.py from candlepin scripts # # Copyright (c) 2012 Red Hat, Inc. # # This software is licensed to you under the GNU General Public License, # version 2 (GPLv2). There is NO WARRANTY for this software, express or # implied, inc...
#! /usr/bin/env python # -*- coding: utf-8 -*- # math2html: convert LaTeX equations to HTML output. # # Copyright (C) 2009-2011 Alex Fernández # # Released under the terms of the `2-Clause BSD license'_, in short: # Copying and distribution of this file, with or without modification, # are permitted in any 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 writing, software # distributed under t...
from . import ProtocolHandler import select, socket from cStringIO import StringIO class TCPHandler(ProtocolHandler): """ TCPHandler acts as a generic TCP forwarder. Data will be .log()ed, but not stored any further. """ def handle_messages(self): self.c.establish_server_connection() ...
# -*- coding: utf-8 -*- """ *************************************************************************** proximity.py --------------------- Date : August 2012 Copyright : (C) 2012 by Victor Olaya Email : volayaf at gmail dot com *****************************...
import os, unittest from ctypes import * try: WINFUNCTYPE except NameError: # fake to enable this test on Linux WINFUNCTYPE = CFUNCTYPE import _ctypes_test lib = CDLL(_ctypes_test.__file__) class CFuncPtrTestCase(unittest.TestCase): def test_basic(self): X = WINFUNCTYPE(c_int, c...
#!/usr/bin/env python # # 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, softwar...
from amqpstorm.compatibility import json from amqpstorm.compatibility import quote from amqpstorm.management.base import ManagementHandler from amqpstorm.message import Message API_BASIC_PUBLISH = 'exchanges/%s/%s/publish' API_BASIC_GET_MESSAGE = 'queues/%s/%s/get' class Basic(ManagementHandler): def publish(sel...
from __future__ import unicode_literals, division, absolute_import import logging import re from urllib import quote from flexget import plugin from flexget import validator from flexget.entry import Entry from flexget.event import event from flexget.utils.soup import get_soup from flexget.utils.search import torrent...
# coding=utf-8 # Copyright 2021 The TensorFlow Datasets 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 appl...
# coding=utf-8 # Copyright 2014 Pants project contributors (see CONTRIBUTORS.md). # Licensed under the Apache License, Version 2.0 (see LICENSE). from __future__ import (nested_scopes, generators, division, absolute_import, with_statement, print_function, unicode_literals) from hashlib import ...
import requests import secrets import os import datetime import subprocess __author__ = 'Jason Yao' def setup_logging(): log = "logs" if not os.path.exists(log): os.makedirs(log) date = datetime.datetime.now() log_file_name = "logs/" + date.strftime('%Y-%m-%d') + ".log" return open(log_...
#! -*- coding: utf-8 -*- from __future__ import unicode_literals import base64 import errno import hashlib import json import os import shutil import tempfile as sys_tempfile import unittest from django.core.files import temp as tempfile from django.core.files.uploadedfile import SimpleUploadedFile from django.http.m...
#!/usr/bin/env python2 # Copyright (c) 2014, Jelmer Tiete <[EMAIL]>. # 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 # not...
#!/usr/bin/env python from gnuradio import gr, gr_unittest, blocks import numpy import time class add_ff(gr.sync_block): def __init__(self): gr.sync_block.__init__( self, name = "add_ff", in_sig = [numpy.float32, numpy.float32], out_sig = [numpy.float32], ...
from __future__ import absolute_import import argparse import pytest import os import sys is_python2 = sys.version_info[0] == 2 import bokeh.command.subcommands.svg as scsvg from bokeh.command.bootstrap import main from bokeh.util.testing import TmpDir, WorkingDir, with_directory_contents from . import basic_svg_sc...
#!/usr/bin/env python # encoding: utf-8 ################################################################################ # # RMG - Reaction Mechanism Generator # # Copyright (c) 2002-2009 Prof. William H. Green ([EMAIL]) and the # RMG Team ([EMAIL]) # # Permission is hereby granted, free of charge, to any pers...
from __future__ import absolute_import from copy import deepcopy from datetime import timedelta from uuid import uuid4 import pytz from confluent_kafka import Producer from dateutil.parser import parse as parse_date from django.conf import settings from django.test.utils import override_settings from exam import fixt...
# 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...
########################################################################## # # Copyright (c) 2017, Image Engine Design 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: # # * Redistrib...
# copyright 2003-2011 LOGILAB S.A. (Paris, FRANCE), all rights reserved. # contact http://www.logilab.fr/ -- mailto:[EMAIL] # # This file is part of logilab-common. # # logilab-common is free software: you can redistribute it and/or modify it under # the terms of the GNU Lesser General Public License as published by th...
# sort three num count=0 print 'please input three num for sort' while count <3: print 'please input num%d'%(count+1) input=raw_input('num%d='%(count+1)) if input.isdigit()==False: print 'input error, not a num' continue count+=1 if count==1: num1=input #print 'num1 is',num1 elif count==2: num2=inpu...
from __future__ import unicode_literals import datetime from operator import attrgetter from django.core.exceptions import ValidationError from django.db import router from django.db.models.sql import InsertQuery from django.test import TestCase, skipUnlessDBFeature from django.utils import six from django.utils.time...
# Copyright 2018 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, ...
# 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. """GYP backend that generates Eclipse CDT settings files. This backend DOES NOT generate Eclipse CDT projects. Instead, it generates XML files that can be importe...
# Copyright 2013 VMware, 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...
# -*- coding: utf-8 -*- # Copyright (c) 2018, Frappe Technologies Pvt. Ltd. and Contributors # MIT License. See license.txt from __future__ import unicode_literals from collections import Counter import datetime import inspect import json import re import time import frappe import sqlparse from frappe import _ RECOR...
#!/usr/bin/env python """ "**Pycco**" is a Python port of [Docco](http://jashkenas.github.com/docco/): the original quick-and-dirty, hundred-line-long, literate-programming-style documentation generator. It produces HTML that displays your comments alongside your code. Comments are passed through [Markdown](http://dar...
from django import forms from django.conf import settings from django.contrib.flatpages.models import FlatPage from django.utils.translation import ugettext, ugettext_lazy as _ class FlatpageForm(forms.ModelForm): url = forms.RegexField(label=_("URL"), max_length=100, regex=r'^[-\w/\.~]+$', help_text = _("...
# 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. """A module to add gyp support to cr.""" import cr import os GYP_DEFINE_PREFIX = 'GYP_DEF_' class GypPrepareOut(cr.PrepareOut): """A prepare action that...
from __future__ import absolute_import from django.test import TestCase from model_inheritance.models import Title class InheritanceSameModelNameTests(TestCase): def setUp(self): # The Title model has distinct accessors for both # model_inheritance.Copy and model_inheritance_same_model_name.Cop...
#!/usr/bin/env python """ sort-md-list.py sorts markdown lists Use this script to prepare sections of the changelog. this script expects a bulleted markdown list in stdout for example ./sort-md-list.py - <<EOF * builder/amazon: Only delete temporary key if we created one. [GH-4850] * core: Correctly reject config f...
""" Model Managers for Course Actions """ import traceback from django.db import models, transaction class CourseActionStateManager(models.Manager): """ An abstract Model Manager class for Course Action State models. This abstract class expects child classes to define the ACTION (string) field. """ ...
import sys import pysam from collections import Counter if len(sys.argv) < 2: sys.exit("usage: alnstat.py in.bam") fname = sys.argv[1] mode = "rb" if fname.endswith(".bam") else "r" bamfile = pysam.AlignmentFile(fname, mode) stats = Counter() for read in bamfile: stats["total"] += 1 stats['qcfail'] += in...
#!/usr/bin/python # # Copyright (c) 2008 Red Hat, Inc. # # This software is licensed to you under the GNU General Public License, # version 2 (GPLv2). There is NO WARRANTY for this software, express or # implied, including the implied warranties of MERCHANTABILITY or FITNESS # FOR A PARTICULAR PURPOSE. You should have ...
import json import falcon import falcon.testing as testing def capture_error(ex, req, resp, params): resp.status = falcon.HTTP_723 resp.body = 'error: %s' % str(ex) def handle_error_first(ex, req, resp, params): resp.status = falcon.HTTP_200 resp.body = 'first error handler' class CustomBaseExcep...
""" Based on the python xreload. Changes ====================== 1. we don't recreate the old namespace from new classes. Rather, we keep the existing namespace, load a new version of it and update only some of the things we can inplace. That way, we don't break things such as singletons or end up with a second repres...
############################################################################## # Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC. # Produced at the Lawrence Livermore National Laboratory. # # This file is part of Spack. # Created by Todd Gamblin, [EMAIL], All rights reserved. # LLNL-CODE-647188 # # F...
from iris.core.interfaces import Interface from iris.core.decorators import rpc from iris.events.base import BaseEventSystem from iris.core.events import Event class SimpleBrokerClient(Interface): service_type = 'simple_broker_client' register_with_coordinator = False @rpc() def event(self, channel, ...
#!/usr/bin/python #!/usr/bin/env python # # GrovePi Python Setup # # The GrovePi connects the Raspberry Pi and Grove sensors. You can learn more about GrovePi here: http://www.dexterindustries.com/GrovePi # # Have a question about this example? Ask on the forums here: http://forum.dexterindustries.com/c/grovepi # '...
# Authors: Alexandre Gramfort <[EMAIL]> # Mathieu Blondel <[EMAIL]> # Olivier Grisel <[EMAIL]> # Andreas Mueller <[EMAIL]> # Joel Nothman <[EMAIL]> # Hamzeh Alsalhi <[EMAIL]> # License: BSD 3 clause from collections import defaultdict import itertools import array import wa...
from __future__ import absolute_import, unicode_literals import pytest import sys import traceback from collections import deque from struct import pack, unpack import weakref from case import Mock from vine.funtools import wrap from vine.promises import promise class test_promise: def test_example(self): ...
# Copyright 2013, Mirantis 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 agre...
# Copyright (C) 2001-2007 Python Software Foundation # Author: Barry Warsaw, Thomas Wouters, Anthony Baxter # Contact: [EMAIL] """A parser of RFC 2822 and MIME email messages.""" __all__ = ['Parser', 'HeaderParser', 'BytesParser', 'BytesHeaderParser', 'FeedParser', 'BytesFeedParser'] from io import String...
# Copyright 2013 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 ag...
# -*- 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 ...
""" A set of request processors that return dictionaries to be merged into a template context. Each function takes the request object as its only parameter and returns a dictionary to add to the context. These are referenced from the 'context_processors' option of the configuration of a DjangoTemplates backend and use...
def DistanceToPlane(plane, point): """Returns the distance from a 3D point to a plane Parameters: plane (plane): the plane point (point): List of 3 numbers or Point3d Returns: number: The distance if successful, otherwise None Example: import rhinoscriptsyntax as rs ...
# Copyright 2017 Google Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in wr...
from django.contrib.localflavor.fi.forms import (FIZipCodeField, FISocialSecurityNumber, FIMunicipalitySelect) from utils import LocalFlavorTestCase class FILocalFlavorTests(LocalFlavorTestCase): def test_FIMunicipalitySelect(self): f = FIMunicipalitySelect() out = u'''<select name="municipal...
#._cv_part guppy.etc.tkcursors # A Tk window that shows what cursor shapes are available. # Moving the mouse over the cursor name shows the cursor in that shape. from Tkinter import * def tkcursors(master=None): if master is None: root = Tk() else: root = master for i, cursor in enumerate(( 'X_cursor'...
import logging from unittest.mock import patch from datetime import timedelta from django.conf import settings from django.test import TestCase from django.test.utils import override_settings from libfaketime import fake_time from munch.apps.campaigns.models import Mail from munch.apps.campaigns.models import MailSt...
#======================================================================= # # Python Lexical Analyser # # Lexical Analyser Specification # #======================================================================= import types import Actions import DFA import Errors import Machines import Regexps # debug_flags for ...
#!/usr/bin/python # -*- coding: utf-8 -*- """ ============================================= Manifold Learning methods on a severed sphere ============================================= An application of the different :ref:`manifold` techniques on a spherical data-set. Here one can see the use of dimensionality reducti...
# -*- 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): # Adding index on 'Feed', fields ['active_subscribers'] db.create_index('feeds', ['active_subscribers']) ...
# Lint as: python2, python3 # Copyright 2018 The TensorFlow Authors. All Rights Reserved. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. # You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # ...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # Copyright (C) 2004-2012 OpenERP SA (<http://openerp.com>) # # This program is free software: you can redistribute it and/or modify # it under the terms of the...
# -*- coding: utf-8 -*- ############################################################################## # # OpenERP, Open Source Management Solution # This module copyright (C) 2013 Sylvain LE GAL # (C) 2013 Therp BV # # This program is free software: you can redistribute it and/or modify # it unde...
# -*- coding: utf-8 -*- # Copyright(C) 2010-2011 Nicolas Duhamel # # This file is part of weboob. # # weboob 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 yo...
import sqlite3 db = sqlite3.connect('im.db'); db.row_factory = sqlite3.Row cur = db.execute('select * from movie;'); movies = []; import json convert = {}; import csv with open('convert.csv', newline='') as csvfile: spamreader = csv.reader(csvfile) for row in spamreader: convert[int(row[0])] = float(r...
# Copyright 2012 Nebula, Inc. # Copyright 2014 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...
__author__ = 'Keyvan' class MindAgent(object): def run(self, atomspace): pass class Request(object): def __init__(self): pass def run(self, args=[], atomspace=None): self.send("This is the default python request.") def send(self, msg): print str(msg)...
import os, sys import tokenize from k_script import BaseScript, ParseError, HTTP_ERROR from k_encodings import k_encoding import urllib class Error: def __init__(self,msg,errorLine): self.msg = msg self.errorLine = errorLine class Script(BaseScript): """Karrigell Service""" def __init__(...
"""Compiler tools with improved interactive support. Provides compilation machinery similar to codeop, but with caching support so we can provide interactive tracebacks. Authors ------- * Robert Kern * Fernando Perez * Thomas Kluyver """ # Note: though it might be more natural to name this module 'compiler', that # ...
import sys import random import string import re class Field: def __init__(self, name, is_nullible): self.name = name self.is_nullible = is_nullible class Field_int(Field): sizes = [ 1, 2, 3, 4, 8 ] types = [ "TINYINT", "SMALLINT", "MEDIUMINT", "INT", "BIGINT" ] uint_ranges = [ (0,(1<<...
# -*- encoding: utf-8 -*- ############################################################################## # # Tracks Authentication Attempts and Prevents Brute-force Attacks module # Copyright (C) 2015-Today GRAP (http://www.grap.coop) # @author Sylvain LE GAL (https://twitter.com/legalsylvain) # # This prog...
""" Custom-written pure powershell meterpreter/reverse_tcp stager. Module @harmj0y """ from modules.common import helpers class Payload: def __init__(self): # required options self.description = "pure windows/meterpreter/reverse_tcp stager, no shellcode" self.rating = "Excellent" ...
import re import time from bs4 import BeautifulSoup from couchpotato.core.helpers.encoding import toUnicode from couchpotato.core.helpers.rss import RSS from couchpotato.core.helpers.variable import tryInt from couchpotato.core.logger import CPLog from couchpotato.core.event import fireEvent from couchpotato.core.medi...
""" Example showing the use of a TriFinder object. As the mouse is moved over the triangulation, the triangle under the cursor is highlighted and the index of the triangle is displayed in the plot title. """ import matplotlib.pyplot as plt from matplotlib.tri import Triangulation from matplotlib.patches import Polygon...
# -*- coding: utf-8 -*- """Algorithms for spectral clustering""" # Author: Gael Varoquaux [EMAIL] # Brian Cheung # Wei LI <[EMAIL]> # License: BSD 3 clause import warnings import numpy as np from ..base import BaseEstimator, ClusterMixin from ..utils import check_random_state, as_float_array from ..u...
#!/usr/bin/env python ''' Created Dec 1, 2009 Main driver for application Author: Sam Gleske ''' import socket,sys,os.path,eventlet,binascii,urllib2,re from lib import * from time import sleep from time import ctime from sys import exit proxyRegEx=re.compile("([0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3...
import re import datetime class InvalidCard(Exception): pass class CardNotSupported(Exception): pass class CreditCard(object): # The regexp attribute should be overriden by the subclasses. # Attribute value should be a regexp instance regexp = None # Has to be set by the user after calling...
# -*- coding: utf-8 -*- # Alacarte Menu Editor - Simple fd.o Compliant Menu Editor # Copyright (C) 2006 Travis Watkins # # This library is free software; you can redistribute it and/or # modify it under the terms of the GNU Library General Public # License as published by the Free Software Foundation; either...
import os import re from setuptools import setup def rel(*parts): '''returns the relative path to a file wrt to the current directory''' return os.path.abspath(os.path.join(os.path.dirname(__file__), *parts)) README = open('README.md', 'r').read() with open(rel('webpack_loader', '__init__.py')) as handler:...
# -*- coding: utf-8 -*- """ werkzeug.formparser ~~~~~~~~~~~~~~~~~~~ This module implements the form parsing. It supports url-encoded forms as well as non-nested multipart uploads. :copyright: (c) 2014 by the Werkzeug Team, see AUTHORS for more details. :license: BSD, see LICENSE for more deta...
# -*- 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): # Adding field 'Transition.institution' db.add_column(u'acts_transition',...
## kompresni.py ## This is an example of using Wavelets to decompose an image ## using Python libraries numpy, scipy, PyWavelets ## ## ## main reference that inspired me was this webpage: ## http://kastnerkyle.github.io/blog/2014/04/17/wavelets/ ## ## ################################################################...
# coding: utf-8 import random import sys from werkzeug.datastructures import FileStorage from flask import current_app from flask.ext.admin import form from flask.ext.admin.form.upload import ImageUploadInput from flask.ext.admin._compat import urljoin from quokka.core.models import SubContent, SubContentPurpose from...
def main(request, response): # Set mode to 'init' for initial fetch. mode = 'init' if 'update-recovery-mode' in request.cookies: mode = request.cookies['update-recovery-mode'].value # no-cache itself to ensure the user agent finds a new version for each update. headers = [('Cache-Control', ...
# -*- coding: utf-8 -*- """ pygments.lexers.functional ~~~~~~~~~~~~~~~~~~~~~~~~~~ Lexers for functional languages. :copyright: Copyright 2006-2012 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import re from pygments.lexer import Lexer, RegexLexer, bygroups, incl...
# sql/schema.py # Copyright (C) 2005-2014 the SQLAlchemy authors and contributors # <see AUTHORS file> # # This module is part of SQLAlchemy and is released under # the MIT License: http://www.opensource.org/licenses/mit-license.php """The schema module provides the building blocks for database metadata. Each element...
from django.contrib.contenttypes.models import ContentType from django.db.models import get_apps, get_models, signals from django.utils.encoding import smart_unicode def update_contenttypes(app, created_models, verbosity=2, **kwargs): """ Creates content types for models in the given app, removing any mo...
# (c) Copyright IBM Corp. 2021 # (c) Copyright Instana Inc. 2016 from __future__ import print_function import os import sys import logging logger = None def get_standard_logger(): """ Retrieves and configures a standard logger for the Instana package @return: Logger """ standard_logger = loggin...
# Copyright (c) 2013 - 2015 EMC 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 # # Unle...
# -*- coding: utf-8 -*- import math import os from loguru import logger as log import varint import iscc from iscc_bench.shortid import bech32 from iscc_bench.shortid.utils import ( iscc_decode, HEAD_SID_PU, HEAD_SID_CB, b58i_encode, b58i_decode, ) def short_id(code: str, chain: bytes = HEAD_SID_P...
# 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 ...
#!/usr/bin/env python3 # # Copyright 2016 Red Hat, Inc. # # Authors: # Fam Zheng <[EMAIL]> # # This work is licensed under the MIT License. Please see the LICENSE file or # http://opensource.org/licenses/MIT. import imp import os import sys from django.conf import settings from django.template import Template, Co...
""" Third party auth API related permissions """ from rest_framework import permissions from third_party_auth.models import ProviderApiPermissions class ThirdPartyAuthProviderApiPermission(permissions.BasePermission): """ Allow someone to access the view if they have valid OAuth client credential. """ ...
#!/usr/bin/python # # Copyright (c) 2019 Zim Kalinowski, <[EMAIL]> # # 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', 's...
#!/usr/bin/python # -*- coding: utf-8 -*- # Copyright: (c) 2014, Brian Coca <[EMAIL]> # 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', ...
#!/usr/bin/python # # 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 distribut...
#!/usr/bin/python # -*- coding: utf-8 -*- # # (c) 2016, René Moser <[EMAIL]> # # 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 # (...
# Copyright 2017 The Forseti Security 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 ap...
from django.template.defaultfilters import urlize from django.test import SimpleTestCase from django.utils.functional import lazy from django.utils.safestring import mark_safe from ..utils import setup class UrlizeTests(SimpleTestCase): @setup({'urlize01': '{% autoescape off %}{{ a|urlize }} {{ b|urlize }}{% en...
# -*- Mode:Python; indent-tabs-mode:nil; tab-width:4 -*- # # Copyright (C) 2017-2018-2020 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 distribute...