content string |
|---|
"""Runs Chromium's IndexedDB performance test. These test:
Databases:
create/delete
Keys:
create/delete
Indexes:
create/delete
Data access:
Random read/write
Sporadic writes
Read cache
Cursors:
Read & random writes
Walking multiple
Seeking.
"""
import json
import os
from telemetry import test
from ... |
class SuperUserPermEditInline(object):
@classmethod
def can_edit(cls, field):
return field.request.user.is_authenticated and field.request.user.is_superuser
class AdminDjangoPermEditInline(SuperUserPermEditInline):
@classmethod
def can_edit(cls, field):
is_super_user = super(AdminDja... |
import json
from django import template
from django.template.context import Context
register = template.Library()
@register.inclusion_tag('admin/prepopulated_fields_js.html', takes_context=True)
def prepopulated_fields_js(context):
"""
Creates a list of prepopulated_fields that should render Javascript for
... |
# Unit tests for typecast functions in django.db.backends.util
import datetime
import unittest
from django.db.backends import utils as typecasts
from django.utils import six
TEST_CASES = {
'typecast_date': (
('', None),
(None, None),
('2005-08-11', datetime.date(2005, 8, 11)),
('1... |
from helpers import unittest
import luigi
import luigi.interface
from luigi.mock import MockTarget
# Calculates Fibonacci numbers :)
class Fib(luigi.Task):
n = luigi.IntParameter(default=100)
def requires(self):
if self.n >= 2:
return [Fib(self.n - 1), Fib(self.n - 2)]
else:
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from ansible import constants as C
from ansible import context
from ansible.errors import AnsibleParserError, AnsibleAssertionError
from ansible.module_utils._text import to_native
from ansible.module_utils.six import string_types
... |
SOCIAL_AUTH_SETTINGS = {
'SOCIAL_AUTH_LOGIN_URL': '/',
'SOCIAL_AUTH_LOGIN_REDIRECT_URL': '/done',
'SOCIAL_AUTH_USER_MODEL': 'example.models.User',
'SOCIAL_AUTH_LOGIN_FUNCTION': 'example.auth.login_user',
'SOCIAL_AUTH_LOGGEDIN_FUNCTION': 'example.auth.login_required',
'SOCIAL_AUTH_AUTHENTICATION_... |
"""
Note that sometimes you will get duplicate signals emitted, depending on configuration of your systems.
If you do encounter this, you will need to add the "dispatch_uid" to your connect handlers:
http://code.djangoproject.com/wiki/Signals#Helppost_saveseemstobeemittedtwiceforeachsave
"""
from django.dispatch impor... |
"""Script for branching Google Test/Mock wiki pages for a new version.
SYNOPSIS
release_docs.py NEW_RELEASE_VERSION
Google Test and Google Mock's external user documentation is in
interlinked wiki files. When we release a new version of
Google Test or Google Mock, we need to branch the wi... |
__all__ = [
'Lock', 'RLock', 'Semaphore', 'BoundedSemaphore', 'Condition', 'Event'
]
import threading
import os
import sys
from time import time as _time, sleep as _sleep
import _multiprocessing
from multiprocessing.process import current_process
from multiprocessing.util import Finalize, register_after_fork... |
from __future__ import unicode_literals
from django.contrib import admin
from django.contrib.messages import info
from django.http import HttpResponseRedirect
from django.utils.translation import ugettext_lazy as _
try:
from django.utils.encoding import force_text
except ImportError:
# Backward compatibility f... |
# -*- coding: utf-8 -*-
from __future__ import unicode_literals
from django.db import models, migrations
import datetime
from django.conf import settings
class Migration(migrations.Migration):
dependencies = [
migrations.swappable_dependency(settings.AUTH_USER_MODEL),
('contenttypes', '0001_init... |
"""
Convenience routines for creating non-trivial Field subclasses, as well as
backwards compatibility utilities.
Add SubfieldBase as the metaclass for your Field subclass, implement
to_python() and the other necessary methods and everything will work
seamlessly.
"""
import warnings
from django.utils.deprecation imp... |
# See http://technet.microsoft.com/en-us/library/ee913589(v=ws.10).aspx
# for information regarding the default claim types supported by
# Microsoft ADFS v2.0.
MAP = {
"identifier": "urn:oasis:names:tc:SAML:2.0:attrname-format:unspecified",
"fro": {
'http://schemas.xmlsoap.org/ws/2005/05/identity/claim... |
"""
Utilities for django models.
"""
import unicodedata
import re
from eventtracking import tracker
from django.conf import settings
from django.utils.encoding import force_unicode
from django.utils.safestring import mark_safe
from django_countries.fields import Country
# The setting name used for events when "sett... |
"""
An L2 learning switch.
It is derived from one written live for an SDN crash course.
It is somwhat similar to NOX's pyswitch in that it installs
exact-match rules for each flow.
"""
from __future__ import division
from pox.core import core
import pox.openflow.libopenflow_01 as of
from pox.lib.util import dpid_to_st... |
import unittest
from app.validation.abstract_validator import AbstractValidator
from app.validation.textarea_type_check import TextAreaTypeCheck
class TextAreaTest(unittest.TestCase):
def test_textarea_validator(self):
textarea = TextAreaTypeCheck()
# validate integer
result = textarea.... |
from test_env import TestEnv
from textwrap import dedent
import pythran
class TestImportAll(TestEnv):
def test_import_all(self):
self.run_test("from math import *\ndef import_all(l): return cos(l)", 3.3, import_all=[float])
def test_import_cmath_all(self):
self.run_test("from cmath import *\n... |
#!/usr/bin/env python
import xmlrpclib
from xen.xend.XendClient import server
from xen.xend import sxp, osdep
from xen.lowlevel.xc import xc
import vif
import blkdev
# need a nicer way to load disk drivers
import vbd
class VMException(Exception): pass
class VM(object):
"Representation of a virtual machine"
... |
"""Tests for input validation functions"""
import warnings
from tempfile import NamedTemporaryFile
from itertools import product
import numpy as np
from numpy.testing import assert_array_equal
import scipy.sparse as sp
from nose.tools import assert_raises, assert_true, assert_false, assert_equal
from sklearn.utils.... |
""" Views for voting.
"""
import json
import collections
from flask import render_template
from flask import flash
from flask import redirect
from flask import Markup
from flask_login import login_user
from flask_login import logout_user
from flask_login import current_user
from wtforms import RadioField
from wtfor... |
from test_framework.test_framework import BitcoinTestFramework
from test_framework.util import (start_nodes, start_node, assert_equal, bitcoind_processes)
def read_dump(file_name, addrs, hd_master_addr_old):
"""
Read the given dump, count the addrs that match, count change and reserve.
Also check that the... |
import nipype.pipeline.engine as pe
import nipype.interfaces.utility as util
def create_func_datasource(rest_dict, wf_name='func_datasource'):
import nipype.pipeline.engine as pe
import nipype.interfaces.utility as util
wf = pe.Workflow(name=wf_name)
inputnode = pe.Node(util.IdentityInterface(
... |
# -*- coding: utf-8 -*-
"""
***************************************************************************
test_qgsnullsymbolrenderer.py
-----------------------------
Date : April 2016
Copyright : (C) 2016 by Nyall Dawson
Email : nyall dot dawson at gmail dot ... |
import io
import pytest
from pathod import language
from pathod.language import http, base
from .. import tservers
def parse_request(s):
return next(language.parse_pathoc(s))
def test_make_error_response():
d = io.BytesIO()
s = http.make_error_response("foo")
language.serve(s, d, {})
class TestR... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
from jinja2.exceptions import UndefinedError
from ansible.errors import AnsibleError, AnsibleUndefinedVariable
from ansible.plugins.lookup import LookupBase
from ansible.utils.listify import listify_lookup_plugin_terms
class Loo... |
from django.http import HttpResponse, Http404
from django.template import loader
from django.contrib.sites.models import get_current_site
from django.core import urlresolvers
from django.core.paginator import EmptyPage, PageNotAnInteger
from django.contrib.gis.db.models.fields import GeometryField
from django.db import... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
try:
import pingdom
HAS_PINGDOM = True
except:
HAS_PINGDOM = False
def pause(checkid, uid, passwd, key):
c = pingdom.PingdomConnection(uid, passwd, key)
c.modify_che... |
"""
urllib3 - Thread-safe connection pooling and re-using.
"""
__author__ = 'Andrey Petrov (<EMAIL>)'
__license__ = 'MIT'
__version__ = '1.10.4'
from .connectionpool import (
HTTPConnectionPool,
HTTPSConnectionPool,
connection_from_url
)
from . import exceptions
from .filepost import encode_multipart_fo... |
from unittest import TestCase
import json
# Fri Dec 30 18:57:26 2005
JSONDOCS = [
# http://json.org/JSON_checker/test/fail1.json
'"A JSON payload should be an object or array, not a string."',
# http://json.org/JSON_checker/test/fail2.json
'["Unclosed array"',
# http://json.org/JSON_checker/test/f... |
# ===========================================
# Module execution.
#
def main():
module = AnsibleModule(
argument_spec=dict(
token=dict(required=True),
environment=dict(required=True),
user=dict(required=False),
repo=dict(required=False),
revision... |
import logging
from errno import EEXIST
from os import umask, mkdir, rmdir, listdir, getpid
from os.path import join
from uuid import uuid4
from shutil import rmtree
import sys
from channels import RPCProxyInboundChannelHandler,\
RPCProxyOutboundChannelHandler
class RPCProxyApplication(object):
def __init__(... |
# -*- coding: utf-8 -*-
import sphinx.roles
import sphinx.environment
from sphinx.writers.html import HTMLTranslator
from docutils.writers.html4css1 import HTMLTranslator as DocutilsTranslator
def patch():
# navify toctree (oh god)
@monkey(sphinx.environment.BuildEnvironment)
def resolve_toctree(old_resolv... |
"""SCons.Tool.PharLapCommon
This module contains common code used by all Tools for the
Phar Lap ETS tool chain. Right now, this is linkloc and
386asm.
"""
#
# Copyright (c) 2001, 2002, 2003, 2004, 2005, 2006, 2007, 2008, 2009, 2010, 2011 The SCons Foundation
#
# Permission is hereby granted, free of charge, to any ... |
"""
Tests asserting that ModelTypes convert to and from json when working
with ModelDatas
"""
# Allow inspection of private class members
# pylint: disable=W0212
from mock import Mock
from xblock.core import XBlock
from xblock.fields import Field, Scope
from xblock.field_data import DictFieldData
from xblock.test.too... |
import unittest
from .testcase import BulbsTestCase
from bulbs.model import Node, NodeProxy, Relationship, RelationshipProxy
from bulbs.property import Integer, String, DateTime, Bool
from bulbs.utils import current_datetime
class Knows(Relationship):
label = "knows"
timestamp = DateTime(default=current_datet... |
# coding: utf8
""" Test cases for Nikola ReST extensions.
A base class ReSTExtensionTestCase provides the tests basic behaivor.
Subclasses must override the "sample" class attribute with the ReST markup.
The sample will be rendered as HTML using publish_parts() by setUp().
One method is provided for checking the resu... |
__all__ = ['XSIBuilder']
from xsi_environment import XSIEnvironment
from xsi import XSI, XSINodeNaming
from pyasm.application.common import SessionBuilder
class XSIBuilder(SessionBuilder):
'''builds a xsi session file'''
def import_file(self, node_name, path, instantiation='import', use_namespace=True):
... |
#!/usr/bin/env python
# -*- coding: utf-8 -*-
"""
This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License,
or (at your option) any later version.
This prog... |
"""Indexer objects for computing start/end window bounds for rolling operations"""
from datetime import timedelta
from typing import (
Dict,
Optional,
Tuple,
Type,
)
import numpy as np
from pandas._libs.window.indexers import calculate_variable_window_bounds
from pandas.util._decorators import Appende... |
import logging
from django.core.management.base import BaseCommand
from django.db.models import Count
from pontoon.base.models import (
Project,
TranslatedResource,
)
log = logging.getLogger(__name__)
class Command(BaseCommand):
help = """
Re-calculate statistics for all translated resources a... |
"""
This platform allows several cover to be grouped into one cover.
For more details about this platform, please refer to the documentation at
https://home-assistant.io/components/cover.group/
"""
import logging
import voluptuous as vol
from homeassistant.core import callback
from homeassistant.components.cover imp... |
from identity.registration.backend.views import ActivationView
from identity.registration.backend.views import RegistrationView
from identity.registration.backend.views import ApproveView
from identity.registration.backend.forms import LoginForm
from django.contrib.auth import views as auth_views
from django.views.gene... |
"""
homeassistant.helpers.state
~~~~~~~~~~~~~~~~~~~~~~~~~~~
Helpers that help with state related things.
"""
import logging
from homeassistant import State
import homeassistant.util.dt as dt_util
from homeassistant.const import (
STATE_ON, STATE_OFF, SERVICE_TURN_ON, SERVICE_TURN_OFF, ATTR_ENTITY_ID)
_LOGGER = l... |
"""
Built-in, globally-available admin actions.
"""
from django.contrib import messages
from django.contrib.admin import helpers
from django.contrib.admin.utils import get_deleted_objects, model_ngettext
from django.core.exceptions import PermissionDenied
from django.db import router
from django.template.response impo... |
import hashlib
import time
from libcloud.utils.py3 import b
from libcloud.common.types import InvalidCredsError, LibcloudError
from libcloud.common.types import MalformedResponseError
from libcloud.common.base import ConnectionUserAndKey, JsonResponse
from libcloud.compute.base import NodeLocation
HOST = 'api.gogrid... |
#!/usr/bin/python
import pprint
import re
import argparse
from datetime import datetime
from statsd import StatsClient
from utils import failureReasons, JenkinsClient
def is_build_failed(job):
if 'lastBuild' in job and job['lastBuild'] is not None and 'result' in job['lastBuild']:
if job['lastBuild']... |
from __future__ import absolute_import
from typing import Dict, Any
from django.http import HttpRequest
from django.conf import settings
from zerver.models import UserProfile, get_realm_by_string_id
from zproject.backends import (password_auth_enabled, dev_auth_enabled,
google_auth_enab... |
# Access WeakSet through the weakref module.
# This code is separated-out because it is needed
# by abc.py to load everything else at startup.
from _weakref import ref
__all__ = ['WeakSet']
class _IterationGuard(object):
# This context manager registers itself in the current iterators of the
# weak containe... |
from __future__ import unicode_literals, division, absolute_import
from builtins import * # noqa pylint: disable=unused-import, redefined-builtin
from past.builtins import basestring
import logging
import re
from path import Path
from flexget import plugin
from flexget.config_schema import one_or_more
from flexget.... |
# coding: utf-8
#
from rest_framework import viewsets, generics, status
from rest_framework.response import Response
from django.utils.translation import ugettext_lazy as _
from common.permissions import IsSuperUser
from ..models import CommandStorage, ReplayStorage
from ..serializers import CommandStorageSerializer,... |
{
'name': 'Events Organisation',
'version': '0.1',
'category': 'Tools',
'summary': 'Trainings, Conferences, Meetings, Exhibitions, Registrations',
'description': """
Organization and management of Events.
======================================
The event module allows you to efficiently organise eve... |
# -*- coding: utf-8 -*-
from mako.template import Template
import unittest
from test import TemplateTest, eq_, requires_python_2
from test.util import result_lines, flatten_result
from mako.compat import u
class FilterTest(TemplateTest):
def test_basic(self):
t = Template("""
${x | myfilter}
""")
... |
import inspect
import os
from django.conf import settings
from django.core.exceptions import ImproperlyConfigured
from django.utils.importlib import import_module
DEFAULT_DB_ALIAS = 'default'
# Define some exceptions that mirror the PEP249 interface.
# We will rethrow any backend-specific errors using these
# commo... |
doctests = """
Basic class construction.
>>> class C:
... def meth(self): print("Hello")
...
>>> C.__class__ is type
True
>>> a = C()
>>> a.__class__ is C
True
>>> a.meth()
Hello
>>>
Use *args notation for the bases.
>>> class A: pass
>>> class B: pass
>>>... |
"""
CNI plugin parameters processing module
Parameters are defined in 3 different classes
- ContrailParams : Contains contrain specific parameters
- K8SParams : Contains kubernetes specific parameters
- CniParams : Contains CNI defined parameters
Also holds ContrailParams + K8SParams
"""
import inspect
i... |
#!/usr/bin/env python
# Setup script for PyPI; use CMakeFile.txt to build extension modules
from setuptools import setup
from distutils.command.install_headers import install_headers
from pybind11 import __version__
import os
# Prevent installation of pybind11 headers by setting
# PYBIND11_USE_CMAKE.
if os.environ.g... |
from __future__ import unicode_literals
import frappe, frappe.utils, frappe.utils.scheduler
import unittest
test_records = frappe.get_test_records('Email Alert')
class TestEmailAlert(unittest.TestCase):
def setUp(self):
frappe.db.sql("""delete from `tabEmail Queue`""")
frappe.set_user("<EMAIL>")
def tearDown(... |
"""Output the overall test accuracy on the 2016 test set.
"""
import os
from absl import app
from absl import flags
from absl import logging
import gin
import gin.tf
import models
import rocstories_sentence_embeddings
import tensorflow.compat.v2 as tf
import tensorflow_datasets.public_api as tfds
import utils
gfile ... |
"""
Win32 utilities.
See also twisted.python.shortcut.
@var O_BINARY: the 'binary' mode flag on Windows, or 0 on other platforms, so it
may safely be OR'ed into a mask for os.open.
"""
import re
import exceptions
import os
try:
import win32api
import win32con
except ImportError:
pass
from twisted.p... |
# -*- 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):
# Removing unique constraint on 'CreditProvider', fields ['provider_url']
... |
import unittest
from test import test_support
# Skip this test if the _testcapi module isn't available.
test_support.import_module('_testcapi')
from _testcapi import getargs_keywords
import warnings
"""
> How about the following counterproposal. This also changes some of
> the other format codes to be a little more re... |
from pycap import Observer, ECLabAsciiFile
from IPython import display
from numpy import real, imag, absolute, angle
from matplotlib import pyplot
from sys import stdout, exit
from os import remove
class PrintColumns(Observer):
def __new__(cls, *args, **kwargs):
return object.__new__(PrintColumns)
d... |
import logging
import simplejson
import openerp
from openerp.addons.auth_signup.res_users import SignupError
from openerp.osv import osv, fields
_logger = logging.getLogger(__name__)
class res_users(osv.Model):
_inherit = 'res.users'
def _auth_oauth_signin(self, cr, uid, provider, validation, params, contex... |
from coilsnake.model.common.table import TableEntry, LittleEndianIntegerTableEntry, RowTableEntry
from coilsnake.model.eb.table import EbEventFlagTableEntry
MapMusicSubTableEntry = RowTableEntry.from_schema(
name="Map Music Sub Table Entry",
schema=[EbEventFlagTableEntry,
type("Music", (LittleEndi... |
import unittest2 as unittest
# Do not import changelog_unittest.ChangeLogTest directly as that will cause it to be run again.
from webkitpy.common.checkout import changelog_unittest
from webkitpy.common.checkout.changelog import ChangeLog
from webkitpy.common.system.filesystem_mock import MockFileSystem
from webkitpy... |
microcode = '''
def macroop BT_R_I {
sexti t0, reg, imm, flags=(CF,)
};
def macroop BT_M_I {
limm t1, imm, dataSize=asz
# This fudges just a tiny bit, but it's reasonable to expect the
# microcode generation logic to have the log of the various sizes
# floating around as well.
ld t1, seg, sib, ... |
# -*- coding: utf-8 -*-
from south.v2 import SchemaMigration
class Migration(SchemaMigration):
#
# cdodge: This is basically an empty migration since everything has - up to now - managed in the django_comment_client app
# But going forward we should be using this migration
#
def forwards(self, orm):
pass
... |
from __future__ import (absolute_import, division, print_function)
__metaclass__ = type
import json
from ansible.compat.tests.mock import patch
from ansible.modules.network.nxos import nxos_bgp_neighbor
from .nxos_module import TestNxosModule, load_fixture, set_module_args
class TestNxosBgpNeighborModule(TestNxosMo... |
"""
Utility functions to return a formatted name and description for a given view.
"""
from __future__ import unicode_literals
import re
from django.utils.encoding import force_text
from django.utils.html import escape
from django.utils.safestring import mark_safe
from rest_framework.compat import apply_markdown
d... |
"""SocksiPy - Python SOCKS module.
Version 1.00
Copyright 2006 Dan-Haim. All rights reserved.
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice, this
... |
"""
simplified test for continulet without checking for partial writes
to enable continulets you only need to call uwsgi_pypy_setup_continulets() soon after startup:
uwsgi --pypy-wsgi-file t/pypy/t_continulet1.py --http-socket :9090 --pypy-home /opt/pypy --pypy-eval "uwsgi_pypy_setup_continulets()" --async 8
"""
imp... |
from django.conf import settings
from django.contrib.sessions.backends.base import CreateError, SessionBase
from django.core.cache import caches
from django.utils.six.moves import range
KEY_PREFIX = "django.contrib.sessions.cache"
class SessionStore(SessionBase):
"""
A cache-based session store.
"""
... |
"""wrapper for libmpq"""
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope th... |
"""
Django ORM model specifications for the User API application
"""
from django.contrib.auth.models import User
from django.core.validators import RegexValidator
from django.db import models
from django.db.models.signals import post_delete, pre_save, post_save
from django.dispatch import receiver
from model_utils.mode... |
import os
from datadog_checks.base.utils.common import get_docker_hostname
HERE = os.path.dirname(os.path.abspath(__file__))
# Networking
HOST = get_docker_hostname()
GITLAB_TEST_TOKEN = "ddtesttoken"
GITLAB_LOCAL_MASTER_PORT = 8085
GITLAB_LOCAL_RUNNER_PORT = 8087
GITLAB_MASTER_URL = "http://{}:{}".format(HOST, GI... |
from django.core.urlresolvers import reverse
from django.db import models
from django.db.models import QuerySet
from django.db.models.manager import BaseManager
from django.utils.encoding import python_2_unicode_compatible
@python_2_unicode_compatible
class Artist(models.Model):
name = models.CharField(max_length... |
#!/usr/bin/env python3
import os, glob, sys
import numpy as np
from scipy.optimize import fmin
out_form="The output is #latox, latoy, latoz, latot, beta and then\n"
out_form+="i, <Q^2>/vol, b_2, b_4, k_1/vol, k_2/vol, k_3/vol, k_4/vol, <Q Q_{noncool}>/<Q^2> \n"
out_form+="where Q=top. charge after i*cooling and k_n a... |
# -*- coding: utf-8 -*-
"""
End-to-end tests for LibraryContent block in LMS
"""
import ddt
import textwrap
from nose.plugins.attrib import attr
from ..helpers import UniqueCourseTest, TestWithSearchIndexMixin
from ...pages.studio.auto_auth import AutoAuthPage
from ...pages.studio.overview import CourseOutlinePage
fro... |
from . import widget
from browser import html, document
class Dialog(widget.DraggableWidget):
def __init__(self, id=None):
self._div_shell=html.DIV(
Class="ui-dialog ui-widget ui-widget-content ui-corner-all ui-front ui-draggable ui-resizable",
style={'position': 'absolute', 'height': 'auto',... |
# -*- coding: utf-8 -*-
"""
pygments.lexers.trafficscript
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Lexer for RiverBed's TrafficScript (RTS) language.
:copyright: Copyright 2006-2015 by the Pygments team, see AUTHORS.
:license: BSD, see LICENSE for details.
"""
import re
from pygments.lexer import RegexLexe... |
"""Combines the javascript files needed by jstemplate into a single file."""
import httplib
import urllib
def main():
srcs = ['util.js', 'jsevalcontext.js', 'jstemplate.js', 'exports.js']
out = 'jstemplate_compiled.js'
# Wrap the output in an anonymous function to prevent poluting the global
# namespace.
... |
import datetime
import logging
import os
import random
import shutil
import sys
import tempfile
from py_utils import cloud_storage # pylint: disable=import-error
from telemetry.internal.util import file_handle
from telemetry.timeline import trace_data as trace_data_module
from telemetry import value as value_module
... |
class Set:
def __init__(self):
self.name = ""
self.code = ""
self.code_magiccards = ""
self.is_promo = False
self.date = ""
def setName(self, name):
self.name = name
def getName(self, name):
return self.name
def setCode(self, code):
sel... |
#!/usr/bin/python
"""
Copyright 2013 Google Inc.
Use of this source code is governed by a BSD-style license that can be
found in the LICENSE file.
Calulate differences between image pairs, and store them in a database.
"""
import contextlib
import csv
import logging
import os
import re
import shutil
import sys
impo... |
from nova import db
from nova import exception
from nova import objects
from nova.objects import base
from nova.objects import fields
# TODO(berrange): Remove NovaObjectDictCompat
class Migration(base.NovaPersistentObject, base.NovaObject,
base.NovaObjectDictCompat):
# Version 1.0: Initial version... |
"""Quoted-printable content transfer encoding per RFCs 2045-2047.
This module handles the content transfer encoding method defined in RFC 2045
to encode US ASCII-like 8-bit data called `quoted-printable'. It is used to
safely encode text that is in a character set similar to the 7-bit US ASCII
character set, but that... |
from __future__ import unicode_literals
import os
import sys
from subprocess import PIPE, Popen
from django.utils import six
from django.utils.encoding import DEFAULT_LOCALE_ENCODING, force_text
from .base import CommandError
def popen_wrapper(args, os_err_exc_type=CommandError, universal_newlines=True):
"""
... |
# -*- coding: utf-8 -*-
"""
Created on Thu May 12 12:34:57 2016
@author: okada
$Id: convert.py 208 2017-08-16 06:16:25Z aokada $
"""
import paplot.subcode.tools as tools
def prohibition(text):
import re
new_text = re.sub(r'[\'"/;:\[\] ]', "_", text)
if re.match(r'^[0-9]', new_text):
new_text = "_... |
from spack import *
class CandleBenchmarks(Package):
"""ECP-CANDLE Benchmarks"""
homepage = "https://github.com/ECP-CANDLE/Benchmarks"
url = "https://github.com/ECP-CANDLE/Benchmarks/archive/v0.1.tar.gz"
tags = ['proxy-app', 'ecp-proxy-app']
version('0.1', sha256='767f74f43ee3a5d4e0f26750f... |
'''
Create GCE resources for use in integration tests.
Takes a prefix as a command-line argument and creates two persistent disks named
${prefix}-base and ${prefix}-extra and a snapshot of the base disk named
${prefix}-snapshot. prefix will be forced to lowercase, to ensure the names are
legal GCE resource names.
'''
... |
from django.test import TestCase
from django.test.client import Client
from django.test.utils import override_settings
import simplejson as json
from spotseeker_server.models import Spot, SpotExtendedInfo
from spotseeker_server.org_filters import SearchFilterChain
def spot_with_noise_level(name, noise_level):
"""... |
from rest_framework import decorators, permissions, status
from rest_framework.renderers import JSONPRenderer, JSONRenderer, BrowsableAPIRenderer
from rest_framework.response import Response
import json
import requests
from django.conf import settings
from django.core.cache import cache
from django.shortcuts import g... |
"""
Helper methods for push notifications from Studio.
"""
from uuid import uuid4
from django.conf import settings
from logging import exception as log_exception
from contentstore.tasks import push_course_update_task
from contentstore.models import PushNotificationConfig
from xmodule.modulestore.django import modules... |
#!/bin/python3
"""
Primitive calculator
Given ops *3, *2, +1, what is the fewest ops to reach n from 1?
"""
import os
import sys
def main():
sequence = optimal_sequence_linear(int(input()))
print(len(sequence) - 1)
print(*sequence)
def optimal_sequence_linear(n):
"""
Solve by calculating min-st... |
ANSIBLE_METADATA = {'status': ['preview'],
'supported_by': 'community',
'version': '1.0'}
import os
import tempfile
from distutils.version import StrictVersion
try:
from passlib.apache import HtpasswdFile, htpasswd_context
from passlib.context import CryptContext
im... |
from collections import namedtuple
import traceback
import sys
import os
import imp
import pkgutil
import time
from util import *
from i18n import _
from util import profiler, PrintError, DaemonThread, UserCancelled
plugin_loaders = {}
hook_names = set()
hooks = {}
class Plugins(DaemonThread):
@profiler
de... |
'''
This module provides a newnext() function in Python 2 that mimics the
behaviour of ``next()`` in Python 3, falling back to Python 2's behaviour for
compatibility if this fails.
``newnext(iterator)`` calls the iterator's ``__next__()`` method if it exists. If this
doesn't exist, it falls back to calling a ``next()`... |
import base_iban
# vim:expandtab:smartindent:tabstop=4:softtabstop=4:shiftwidth=4: |
from _pydev_bundle import pydev_log
import traceback
from _pydevd_bundle import pydevd_extension_utils
from _pydevd_bundle import pydevd_resolver
import sys
from _pydevd_bundle.pydevd_constants import dict_iter_items, dict_keys, IS_PY3K, \
BUILTINS_MODULE_NAME, MAXIMUM_VARIABLE_REPRESENTATION_SIZE, RETURN_VALUES_DI... |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.