content
string
# Code for chapter 03 - Semantic Errors import random XMAX, YMAX = 19, 16 def create_grid_string(dots, xsize, ysize): """ Creates a grid of size (xx, yy) with the given positions of dots. """ grid = "" for y in range(ysize): for x in range(xsize): grid += "." if (x, y) in...
""" Lexer for PPAPI IDL The lexer uses the PLY library to build a tokenizer which understands both WebIDL and Pepper tokens. WebIDL, and WebIDL regular expressions can be found at: http://www.w3.org/TR/2012/CR-WebIDL-20120419/ PLY can be found at: http://www.dabeaz.com/ply/ """ from idl_lexer import IDLLexer ...
microcode = ''' # FMUL # FMULP # FIMUL '''
""" :mod:`moksha.widgets.feedtree` - A dynamic feed tree ==================================================== There are currently two implementations of this application, an `ajax` version and a `live` version. The ajax version makes a new request to our WSGI server each time, where as the `live` implementation commu...
""" Dashboard search """ from bok_choy.page_object import PageObject from common.test.acceptance.pages.lms import BASE_URL class DashboardSearchPage(PageObject): """ Dashboard page featuring a search form """ search_bar_selector = '#dashboard-search-bar' url = "{base}/dashboard".format(base=BASE...
from __future__ import absolute_import import logging import tempfile import os.path from pip._vendor.six.moves.urllib import parse as urllib_parse from pip._vendor.six.moves.urllib import request as urllib_request from pip.utils import call_subprocess from pip.utils import display_path, rmtree from pip.vcs import v...
# -*- coding: utf-8 -*- """ ccp.client ~~~~~~~~~~~~ This module implements the Changelog API. :license: MIT, see LICENSE for more details. """ import sys import requests import json from time import time import logging from pkg_resources import get_distribution API_HOST = "localhost" API_PORT = 5000 SEVERITY = di...
BUS_NAME = "com.redhat.Blivet1" BASE_OBJECT_PATH = "/com/redhat/Blivet1" BLIVET_INTERFACE = "%s.Blivet" % BUS_NAME BLIVET_OBJECT_PATH = "%s/Blivet" % BASE_OBJECT_PATH DEVICE_INTERFACE = "%s.Device" % BUS_NAME DEVICE_OBJECT_PATH_BASE = "%s/Devices" % BASE_OBJECT_PATH DEVICE_REMOVED_OBJECT_PATH_BASE = "%s/RemovedDevices"...
from decimal import Decimal from exceptions import ValueError from itertools import chain from django.core.exceptions import ValidationError, MultipleObjectsReturned from django.core.urlresolvers import reverse from django.forms import Form from django.forms.fields import BooleanField, CharField, DecimalField, IntegerF...
import time from datetime import datetime import traceback import sys from py4j.java_gateway import is_instance_of from pyspark import SparkContext, RDD class TransformFunction(object): """ This class wraps a function RDD[X] -> RDD[Y] that was passed to DStream.transform(), allowing it to be called from...
from functools import total_ordering from lhc.order import natural_key class ChromosomeIdentifier: def __init__(self, chromosome: str): self.chromosome = chromosome self.parts = tuple(natural_key(chromosome)) def __str__(self): return self.chromosome def __hash__(self): r...
from gi.repository import Gtk, Gdk from pychess.System import conf from pychess.System.prefix import addDataPrefix from pychess.Utils.const import BLACK from pychess.Utils.Move import toSAN, toFAN from pychess.widgets.Background import hexcol __title__ = _("Move History") __active__ = True __icon__ = addDataPrefix("g...
import os import re from ctypes import c_char_p from django.core.validators import ipv4_re from django.contrib.gis.geoip.libgeoip import GEOIP_SETTINGS from django.contrib.gis.geoip.prototypes import ( GeoIPRecord, GeoIPTag, GeoIP_open, GeoIP_delete, GeoIP_database_info, GeoIP_lib_version, GeoIP_record_by_addr...
"""VGG16 Keras application.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function from tensorflow.contrib.keras.python.keras.applications.vgg16 import decode_predictions from tensorflow.contrib.keras.python.keras.applications.vgg16 import preprocess_input from...
__all__ = [ 'LXMLTreeBuilderForXML', 'LXMLTreeBuilder', ] import collections from lxml import etree from bs4.element import Comment, Doctype, NamespacedAttribute from bs4.builder import ( FAST, HTML, HTMLTreeBuilder, PERMISSIVE, TreeBuilder, XML) from bs4.dammit import UnicodeDammit...
import logging from datetime import timedelta from optparse import make_option from django.core.management.base import BaseCommand from django.utils.timezone import now from oscar.core.loading import get_model ProductAlert = get_model('customer', 'ProductAlert') logger = logging.getLogger(__name__) class Command(...
""" # Integrating PayPal ### 1. Validate Currency Support Example: from frappe.integrations.utils import get_payment_gateway_controller controller = get_payment_gateway_controller("PayPal") controller().validate_transaction_currency(currency) ### 2. Redirect for payment Example: payment_details = { "amount...
from __future__ import (absolute_import, division, print_function, unicode_literals) import pandas as pd import numpy as np from .geom import geom from matplotlib.patches import Rectangle import matplotlib.colors as colors import matplotlib.colorbar as colorbar class geom_tile(geom): DEFAU...
import gtk import gobject import time import datetime as dt from ..lib import stuff, graphics, pytweener from ..configuration import conf class Selection(graphics.Sprite): def __init__(self, start_time = None, end_time = None): graphics.Sprite.__init__(self, z_order = 100) self.start_time, self....
#!/usr/bin/env python # -*- coding: utf-8 -*- from __future__ import absolute_import from __future__ import division from __future__ import print_function from __future__ import unicode_literals import gdb import pwndbg.abi import pwndbg.arch import pwndbg.events import pwndbg.memory import pwndbg.regs #: Total numb...
data = ( 'Ming ', # 0x00 'Sheng ', # 0x01 'Shi ', # 0x02 'Yun ', # 0x03 'Mian ', # 0x04 'Pan ', # 0x05 'Fang ', # 0x06 'Miao ', # 0x07 'Dan ', # 0x08 'Mei ', # 0x09 'Mao ', # 0x0a 'Kan ', # 0x0b 'Xian ', # 0x0c 'Ou ', # 0x0d 'Shi ', # 0x0e 'Yang ', # 0x0f 'Zheng ', # 0...
""" mbed SDK Copyright (c) 2011-2013 ARM Limited 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 curtsies import fmtstr from ..monitor import Monitor import pymongo import bson.json_util import re import arrow class BlogSaver: def __init__(self, **kwargs): self.db_address = kwargs.get("db_address", "mongo:27017") self.db_name = kwargs.get("db_name", "news_crawler") def save(self, article=None): ...
import json import logging import os import shutil import zipfile from django.conf import settings from django.db.models import Q from lxml import etree import amo from addons.models import AddonUser from amo.celery import task from lib.crypto.packaged import sign_file from versions.compare import version_int from v...
"""Build NaCl tools (e.g. sel_ldr and ncval) at a given revision.""" import build_utils import optparse import os import shutil import subprocess import sys import tempfile bot = build_utils.BotAnnotator() # The suffix used for NaCl moduels that are installed, such as irt_core. NEXE_SUFFIX = '.nexe' def MakeInstal...
""" Module for node class mixins that indicate runtime determined node facts. These come into play after finalization only. All of the these attributes (and we could use properties instead) are determined once or from a default and then used like this. """ class MarkLocalsDictIndicator: def __init__(self): ...
""" These are tests for the refactored choicemodels MNL codebase. """ import numpy as np import pandas as pd import pytest from pandas.testing import assert_frame_equal from patsy import dmatrix from choicemodels import MultinomialLogit from choicemodels.tools import MergedChoiceTable @pytest.fixture def obs(): ...
# ex:ts=4:sw=4:sts=4:et # -*- tab-width: 4; c-basic-offset: 4; indent-tabs-mode: nil -*- """ BitBake 'Fetch' implementations Classes for obtaining upstream sources for the BitBake build tools. """ # Copyright (C) 2003, 2004 Chris Larson # # This program is free software; you can redistribute it and/or modify # it u...
""" This module contains EXPERIMENTAL support for storing a Whoosh index's files in the Google App Engine blobstore. This will use a lot of RAM since all files are loaded into RAM, but it potentially useful as a workaround for the lack of file storage in Google App Engine. Use at your own risk, but please report any p...
import pardus.xorg import gettext _ = gettext.translation('yali', fallback=True).ugettext from PyQt4.Qt import QWidget, SIGNAL, QLineEdit, QTimer from pds.thread import PThread from pds.gui import PMessageBox, MIDCENTER, CURRENT, OUT import yali.util import yali.postinstall import yali.storage import yali.context as...
import unittest import networkx as nx from python_cypher import python_cypher class TestPythonCypher(unittest.TestCase): def test_upper(self): """Test we can parse a CREATE... RETURN query.""" g = nx.MultiDiGraph() query = 'CREATE (n:SOMECLASS) RETURN n' test_parser = python_cyphe...
from __future__ import absolute_import, division, print_function import time import pytest from pyros.client import PyrosClient from pyros.server.ctx_server import pyros_ctx pyros_interfaces_ros = pytest.importorskip("pyros_interfaces_ros") # , minversion="0.4") # TODO : make version avialable in pyros_interfaces_...
""" Production planning problem in Google or-tools. From the OPL model production.mod. This model was created by Hakan Kjellerstrand (<EMAIL>) Also see my other Google CP Solver models: http://www.hakank.org/google_or_tools/ """ import sys from ortools.linear_solver import pywraplp def main(sol='GLPK'):...
""" Python 'base64_codec' Codec - base64 content transfer encoding Unlike most of the other codecs which target Unicode, this codec will return Python string objects for both encode and decode. Written by Marc-Andre Lemburg (<EMAIL>). """ import codecs, base64 ### Codec APIs def base64_encode(input,err...
import os # toolchains options ARCH='arm' CPU='cortex-m4' CROSS_TOOL='gcc' BOARD_NAME = 'lpc5410x' if os.getenv('RTT_CC'): CROSS_TOOL = os.getenv('RTT_CC') if CROSS_TOOL == 'gcc': PLATFORM = 'gcc' EXEC_PATH = r'D:/Program Files/CodeSourcery/Sourcery_CodeBench_Lite_for_ARM_EABI/bin' elif CROSS_TOOL == 'keil': ...
# -*- coding: utf-8 -*- from openerp.osv import fields, osv class sales_team_configuration(osv.TransientModel): _name = 'sale.config.settings' _inherit = ['sale.config.settings'] def set_group_multi_salesteams(self, cr, uid, ids, context=None): """ This method is automatically called by res_conf...
"""abydos.tests.distance.test_distance_lcsuffix. This module contains unit tests for abydos.distance.LCSuffix """ import unittest from abydos.distance import LCSuffix class LCSuffixTestCases(unittest.TestCase): """Test LCSuffix functions. abydos.distance.LCSuffix """ cmp = LCSuffix() def tes...
from openerp import _ from datetime import datetime from .log import Log from .converter import PaymentConverterSpain class Csb58(object): def __init__(self, env): self.env = env def _cabecera_presentador_58(self): converter = PaymentConverterSpain() texto = '5170' texto += (s...
__author__ = 'tom' from PyQt4.QtGui import * from BAL.Interface.DeviceFrame import LAUNCH, EX_DEV, DeviceFrame from lxml.etree import Element, SubElement, XML import rospkg class RosLaunch(DeviceFrame): def __init__(self, frame, data): DeviceFrame.__init__(self, EX_DEV, frame, data) self._pkg = ''...
import os def int_val_fn(v): try: int(v) return True except: return False class IObject(object): def choose_from_list(self, item_list, search_str='', prompt='Enter Selection'): choice = None while not choice: n = 1 ...
# -*- coding: utf-8 -*- import openerp class m(openerp.osv.osv.Model): """ This model exposes a few methods that will raise the different exceptions that must be handled by the server (and its RPC layer) and the clients. """ _name = 'test.exceptions.model' def generate_except_osv(self,...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import os from ansible import constants as C from ansible.errors import AnsibleParserError from ansible.module_utils._text import to_text from ansible.playbook.play import Play from ansible.playbook.playbook_include import Playboo...
#!/usr/bin/env python import sys #Finding 'Next Link' on a given web page def get_next_link(s): start_link = s.find("href=") if start_link == -1: #If no links are found then give an error! end_quote = 0 link = "no_links" return link, end_quote else: start_quote = s.find('...
# -*- coding: utf-8 -*- """ pygments.lexers ~~~~~~~~~~~~~~~ Pygments lexers. :copyright: Copyright 2006-2013 by the Pygments team, see AUTHORS. :license: BSD, see LICENSE for details. """ import sys import types import fnmatch from os.path import basename from pygments.lexers._mapping import LEX...
# line 1 def wrap(foo=None): def wrapper(func): return func return wrapper # line 7 def replace(func): def insteadfunc(): print('hello') return insteadfunc # line 13 @wrap() @wrap(wrap) def wrapped(): pass # line 19 @replace def gone(): pass # line 24 oll = lambda m: m # lin...
import unittest import shelve import glob from test import support from collections import MutableMapping from test.test_dbm import dbm_iterator def L1(s): return s.decode("latin-1") class byteskeydict(MutableMapping): "Mapping that supports bytes keys" def __init__(self): self.d = {} def __...
{ 'name': 'Restaurant', 'version': '1.0', 'category': 'Point of Sale', 'sequence': 6, 'summary': 'Restaurant extensions for the Point of Sale ', 'description': """ ======================= This module adds several restaurant features to the Point of Sale: - Bill Printing: Allows you to print a ...
from twitter.common.string import ScanfParser try: from twitter.common import log except ImportError: log = None class ProcessHandle(object): """ ProcessHandle interface. Methods that must be exposed by whatever process monitoring mechanism you use. """ def cpu_time(self): """ Total cpu ...
# -*- coding: utf-8 -*- """QGIS Unit tests for QgsVirtualLayerTask. .. note:: This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version. "...
import re import fnmatch import pandas as pd # three days EXPIRE = 259200 def get_re(pattern): if type(pattern) == str: return re.compile(fnmatch.translate(pattern), flags=re.IGNORECASE) elif type(pattern) == list: return re.compile("|".join(fnmatch.translate(pattern)), ...
import m5 from m5.objects import * from m5.defines import buildEnv from m5.util import addToPath import os, optparse, sys # Get paths we might need config_path = os.path.dirname(os.path.abspath(__file__)) config_root = os.path.dirname(config_path) m5_root = os.path.dirname(config_root) addToPath(config_root+'/configs/...
from os.path import basename from urlparse import urlparse, parse_qs from django.conf import settings from django.template.loader import render_to_string from django.utils.translation import ugettext_lazy as _lazy, ugettext as _ from wikimarkup.parser import Parser, ALLOWED_TAGS from kitsune.gallery.models import Im...
import copy import os import threading import types import bottle __all__ = ( 'abort', 'HttpServer', 'mako_view', 'redirect', 'request', 'response', 'route', 'static_file', 'view', ) class HttpServer(object): """ Wrapper around bottle to make class-bound servers a little ea...
""" Volume Backups interface (1.1 extension). """ from cinderclient import base class VolumeBackup(base.Resource): """A volume backup is a block level backup of a volume.""" def __repr__(self): return "<VolumeBackup: %s>" % self.id def delete(self): """Delete this volume backup.""" ...
microcode = ''' # FRNDINT '''
from airflow.contrib.hooks.cassandra_hook import CassandraHook from airflow.sensors.base_sensor_operator import BaseSensorOperator from airflow.utils.decorators import apply_defaults class CassandraRecordSensor(BaseSensorOperator): """ Checks for the existence of a record in a Cassandra cluster. For exam...
"""Unit tests for platform/plant.py.""" from datetime import datetime, timedelta import pytest from homeassistant.components import recorder import homeassistant.components.plant as plant from homeassistant.const import ( ATTR_UNIT_OF_MEASUREMENT, CONDUCTIVITY, LIGHT_LUX, STATE_OK, STATE_PROBLEM, ...
""" webhook_notification.py Implementation of the datatypes used in OneDrive webhook notification, which is absent from official OneDrive Python SDK. :copyright: (c) Xiangyu Bu <<EMAIL>> :license: MIT """ from .. import od_dateutils class WebhookNotification: """ https://dev.onedrive.com/resources/webhookNoti...
from __future__ import (absolute_import, division, print_function) __metaclass__ = type import shlex from ansible.module_utils.six import PY3 from ansible.module_utils._text import to_bytes, to_text if PY3: # shlex.split() wants Unicode (i.e. ``str``) input on Python 3 shlex_split = shlex.split else: # s...
from telemetry.page import page as page_module from telemetry.page import page_set as page_set_module class PixelTestsPage(page_module.Page): def __init__(self, url, name, test_rect, revision, page_set): super(PixelTestsPage, self).__init__(url=url, page_set=page_set, name=name) self.user_agent_type = 'des...
"""This module contains a Google Cloud Spanner Hook.""" from typing import Callable, List, Optional, Sequence, Union from google.api_core.exceptions import AlreadyExists, GoogleAPICallError from google.cloud.spanner_v1.client import Client from google.cloud.spanner_v1.database import Database from google.cloud.spanner...
from nose.tools import assert_equal, assert_true, assert_false, raises import networkx as nx def test_dominating_set(): G = nx.gnp_random_graph(100, 0.1) D = nx.dominating_set(G) assert_true(nx.is_dominating_set(G, D)) D = nx.dominating_set(G, start_with=0) assert_true(nx.is_dominating_set(G, D)) ...
from __future__ import unicode_literals from cgi import escape from wtforms.compat import text_type, string_types, iteritems __all__ = ( 'CheckboxInput', 'FileInput', 'HiddenInput', 'ListWidget', 'PasswordInput', 'RadioInput', 'Select', 'SubmitInput', 'TableWidget', 'TextArea', 'TextInput', 'Option' ) ...
""" Support for GPSD. For more details about this platform, please refer to the documentation at https://home-assistant.io/components/sensor.gpsd/ """ import logging import voluptuous as vol from homeassistant.components.sensor import PLATFORM_SCHEMA from homeassistant.const import ( ATTR_LATITUDE, ATTR_LONGITUD...
""" A presentation layer for generating LaTeX Qtree output. """ import copy class Qtree(object): r""" A qtree is rendered as a root with some branches: ROOT / \ b1 b2 ... """ def __init__(self, root, branches=[]): """ @arg root: A string which is rendered as "ROOT" in t...
import unittest import threading import thread import pickle import datetime import xmlrpclib import urllib2 import xml.parsers.expat as expat_parser import voodoo.mapper as mapper class MyClass(object): def __init__(self,first_field,second_field,third_field): object.__init__(self) self._first_fie...
import curses import textout from textout import btText import init import sys menuTitle = "/\\\\ Menue //\\" MENU_W = 55 def btExit(): init.quit() sys.exit() def btContinue(): pass menuList = [[str(btText("Continue")), btContinue], [str(btText("Quit")), btExit]] def drawMenu(menuWin, choic...
import rfc822 import sys import test_support import unittest try: from cStringIO import StringIO except ImportError: from StringIO import StringIO class MessageTestCase(unittest.TestCase): def create_message(self, msg): return rfc822.Message(StringIO(msg)) def test_get(self): msg = s...
import base64 import os import gzip import siegetank system_name = "src" # Need a more secure way to store and load this. my_token = os.environ["SIEGETANK_TOKEN"] siegetank.login(my_token) RUNS_PATH = "/home/kyleb/src/choderalab/FAHNVT/%s/RUNS_NPT/RUN0/" % system_name opts = {'description': '%s NPT v2.0 In this pr...
import unittest from django.db import connection, migrations, models from django.db.migrations.state import ProjectState from django.test import override_settings from .test_operations import OperationTestBase try: import sqlparse except ImportError: sqlparse = None class AgnosticRouter(object): """ ...
from nova import objects from nova.tests.unit.objects import test_objects _top_dict = { 'sockets': 2, 'cores': 4, 'threads': 8 } class _TestVirtCPUTopologyObject(object): def test_object_from_dict(self): top_obj = objects.VirtCPUTopology.from_dict(_top_dict) self.compare_obj(top_obj...
ANSIBLE_METADATA = { 'status': ['preview'], 'supported_by': 'core', 'version': '1.0' } import re from functools import partial from ansible.module_utils.basic import AnsibleModule from ansible.module_utils.ios import load_config, get_config from ansible.module_utils.ios import ios_argument_spec, check_ar...
from __future__ import absolute_import, division, print_function __metaclass__ = type ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'certified'} DOCUMENTATION = r''' --- module: bigip_dns_zone short_description: Manage DNS zones on BIG-I...
# -*- coding: utf-8 -*- """ *************************************************************************** RectanglesOvalsDiamondsFixed.py --------------------- Date : April 2016 Copyright : (C) 2016 by Alexander Bruy Email : alexander dot bruy at gmail dot co...
from asyncio import coroutine from random import randint from autobahn.asyncio.wamp import ApplicationSession, ApplicationRunner from autobahn.wamp.types import PublishOptions import asyncio from threading import Thread as Process # helpfer function to get the current time import time millis = lambda: int(round(time....
"""High-level polynomials manipulation functions. """ from __future__ import print_function, division from sympy.polys.polytools import ( poly_from_expr, parallel_poly_from_expr, Poly) from sympy.polys.polyoptions import allowed_flags from sympy.polys.specialpolys import ( symmetric_poly, interpolating_poly)...
__all__ = ['PackageWriter', 'VanillaWriter', 'APIVersionWriter'] from .writers.packagewriter import PackageWriter from .writers.vanillawriter import VanillaWriter from .writers.apiversionwriter import APIVersionWriter
from xmodule.modulestore.django import modulestore from dogapi import dog_stats_api from util.json_request import JsonResponse from django.db import connection from django.db.utils import DatabaseError from xmodule.exceptions import HeartbeatFailure @dog_stats_api.timed('edxapp.heartbeat') def heartbeat(request): ...
from __future__ import unicode_literals import warnings from django import forms from django.core.exceptions import ImproperlyConfigured from django.core.urlresolvers import reverse from django.test import TestCase, ignore_warnings, override_settings from django.test.client import RequestFactory from django.utils.dep...
import os from ...utils.testing_tools import MockResponse from ...eso import Eso DATA_DIR = os.path.join(os.path.dirname(__file__), 'data') def data_path(filename): return os.path.join(DATA_DIR, filename) DATA_FILES = {'GET': {'http://archive.eso.org/wdb/wdb/eso/eso_archive_main/form': '...
from __future__ import absolute_import import socket import zmq import time from dpark.utils import spawn from dpark.utils.log import get_logger logger = get_logger(__name__) class TrackerMessage(object): pass class StopTrackerMessage(TrackerMessage): pass class SetValueMessage(TrackerMessage): def ...
"""Views for enabling cross-domain requests. """ import logging import json from django.conf import settings from django.views.decorators.cache import cache_page from django.http import HttpResponseNotFound from edxmako.shortcuts import render_to_response from cors_csrf.models import XDomainProxyConfiguration log = l...
import itertools from django.conf import settings from django.utils.html import conditional_escape from crispy_forms.layout import LayoutObject, Div from crispy_forms.utils import render_field TEMPLATE_PACK = getattr(settings, "CRISPY_TEMPLATE_PACK", "bootstrap") class Row(Div): """ Layout object. It wraps...
#!/usr/bin/env python3 # -*- coding: utf-8 -*- from ctypes import c_bool import tarfile import functools import time from bs4 import BeautifulSoup, Comment, NavigableString from Translatron import DocumentDB from ansicolor import black, red from multiprocessing import Process, Queue __author__ = "Uli Köhler" __copyrig...
"""Definition of targets to build distribution packages.""" import jobset def create_docker_jobspec(name, dockerfile_dir, shell_command, environ={}, flake_retries=0, timeout_retries=0): """Creates jobspec for a task running under docker.""" environ = environ.copy() environ['RUN_COMMAND'] = sh...
import openerp from openerp.osv import fields, orm from webkit_report import WebKitParser class ir_actions_report_xml(orm.Model): _inherit = 'ir.actions.report.xml' _columns = { 'webkit_header': fields.property( type='many2one', relation='ir.header_webkit', string='Webkit Heade...
""" A board is a NxN numpy array. A Coordinate is a tuple index into the board. A Move is a (Coordinate c | None). A PlayerMove is a (Color, Move) tuple (0, 0) is considered to be the upper left corner of the board, and (18, 0) is the lower left. """ from collections import namedtuple import copy import itertools impo...
ANSIBLE_METADATA = {'metadata_version': '1.1', 'status': ['preview'], 'supported_by': 'community'} try: import shade HAS_SHADE = True except ImportError: HAS_SHADE = False from distutils.version import StrictVersion def _system_state_change(state, assignment): ...
from __future__ import unicode_literals import frappe from frappe.utils import getdate from frappe import _ def get_columns(filters, trans): validate_filters(filters) # get conditions for based_on filter cond based_on_details = based_wise_columns_query(filters.get("based_on"), trans) # get conditions for periodic...
# encoding: utf-8 from __future__ import unicode_literals import re from .common import InfoExtractor from ..utils import ( ExtractorError, unified_strdate, compat_str, ) class NocoIE(InfoExtractor): _VALID_URL = r'http://(?:(?:www\.)?noco\.tv/emission/|player\.noco\.tv/\?idvideo=)(?P<id>\d+)' ...
from msrest.serialization import Model class PoolEnableAutoScaleParameter(Model): """Options for enabling automatic scaling on a pool. :param auto_scale_formula: The formula for the desired number of compute nodes in the pool. The formula is checked for validity before it is applied to the pool. If...
#!/usr/bin/env python # This example demonstrates how to use boolean combinations of implicit # functions to create a model of an ice cream cone. import vtk from vtk.util.colors import chocolate, mint # Create implicit function primitives. These have been carefully # placed to give the effect that we want. We are go...
import unittest import sqlite3 from data.db_creation.sql.restaurant_table_creator import RestaurantTableCreator from data.sql.restaurant_storage import RestaurantStorage from model.restaurant import Restaurant class TestRestaurantStorage(unittest.TestCase): def test_insert(self): conn = sqlite3.connect(...
from flask_login import LoginManager, UserMixin, login_user, logout_user, current_user, login_required from werkzeug.security import generate_password_hash, check_password_hash import ctf class User(UserMixin, ctf.db.Model): __tablename__ = 'users' id = ctf.db.Column(ctf.db.Integer, primary_key=True) user...
ANSIBLE_METADATA = {'metadata_version': '1.0', 'status': ['preview'], 'supported_by': 'community'} import os import os.path import shutil import re def main(): pam_items = ['core', 'data', 'fsize', 'memlock', 'nofile', 'rss', 'stack', 'cpu', 'nproc', 'as', 'maxlogins', '...
from __future__ import unicode_literals import extensions import filtering import format import interval import optval import os import subprocess def __read_git_config__(repo, variable): previous_directory = os.getcwd() os.chdir(repo) setting = subprocess.Popen("git config inspector." + variable, shell=True, bufsi...
import os import sys import optparse import signal if __name__ == '__main__': print >> sys.stderr, 'PROGRAM TERMINATED' print >> sys.stderr, 'Please do not run this script directly! Use mcomixstarter.py instead.' sys.exit(1) # These modules must not depend on GTK, pkg_resources, PIL, # or any other option...
from oslo_privsep import capabilities as caps from oslo_privsep import priv_context # It is expected that most (if not all) neutron operations can be # executed with these privileges. default = priv_context.PrivContext( __name__, cfg_section='privsep', pypath=__name__ + '.default', # TODO(gus): CAP_SYS...
"""Utilities for XLA-specific Python types.""" from __future__ import absolute_import from __future__ import division from __future__ import print_function import collections import numpy as _np # Avoids becoming a part of public Tensorflow API. from tensorflow.compiler.xla import xla_data_pb2 from tensorflow.pyth...
# -*- coding: utf-8 -*- from openerp.osv import osv, fields class MailComposeMessage(osv.TransientModel): """Add concept of mass mailing campaign to the mail.compose.message wizard """ _inherit = 'mail.compose.message' _columns = { 'mass_mailing_campaign_id': fields.many2one( 'ma...