text:
import mock

from armada.exceptions import tiller_exceptions as ex
from armada.handlers import tiller
from armada.tests.unit import base

class TillerTestCase(base.ArmadaTestCase):

    @mock.patch.object(tiller.Tiller, '_get_tiller_ip')
    @mock.patch('armada.handlers.tiller.K8s')
    @mock.patch('armada.handlers.tiller.grpc')
    @mock.patch('armada.handlers.tiller.Config')
    @mock.patch('armada.handlers.tiller.InstallReleaseRequest')
    @mock.patch('armada.handlers.tiller.ReleaseServiceStub')
    def test_install_release(self, mock_stub, mock_install_request,
                             mock_config, mock_grpc, mock_k8s, mock_ip):
        # instantiate Tiller object
        mock_grpc.insecure_channel.return_value = None
        mock_ip.return_value = '0.0.0.0'
        tiller_obj = tiller.Tiller()
        assert tiller_obj._get_tiller_ip() == '0.0.0.0'

        # set params
        chart = mock.Mock()
        dry_run = False
        name = None
        namespace = None
        initial_values = None
        updated_values = mock_config(raw=initial_values)
        wait = False
        timeout = 3600

        tiller_obj.install_release(chart, name, namespace,
                                   dry_run=dry_run, values=initial_values,
                                   wait=wait, timeout=timeout)

        mock_stub.assert_called_with(tiller_obj.channel)
        release_request = mock_install_request(
            chart=chart,
            dry_run=dry_run,
            values=updated_values,
            release=name,
            namespace=namespace,
            wait=wait,
            timeout=timeout
        )
        (mock_stub(tiller_obj.channel).InstallRelease
         .assert_called_with(release_request,
                             timeout + 60,
                             metadata=tiller_obj.metadata))

    @mock.patch('armada.handlers.tiller.K8s', autospec=True)
    @mock.patch.object(tiller.Tiller, '_get_tiller_ip', autospec=True)
    @mock.patch.object(tiller.Tiller, '_get_tiller_port', autospec=True)
    @mock.patch('armada.handlers.tiller.grpc', autospec=True)
    def test_get_channel(self, mock_grpc, mock_port, mock_ip, _):
        mock_port.return_value = mock.sentinel.port
        mock_ip.return_value = mock.sentinel.ip

        # instantiate Tiller object
        mock_grpc.insecure_channel.return_value = 'connected'
        tiller_obj = tiller.Tiller()

        self.assertIsNotNone(tiller_obj.channel)
        self.assertEqual('connected', tiller_obj.channel)

        mock_grpc.insecure_channel.assert_called_once_with(
            '%s:%s' % (str(mock.sentinel.ip), str(mock.sentinel.port)),
            options=[('grpc.max_send_message_length',
                     tiller.MAX_MESSAGE_LENGTH),
                     ('grpc.max_receive_message_length',
                     tiller.MAX_MESSAGE_LENGTH)]
        )

    @mock.patch('armada.handlers.tiller.K8s', autospec=True)
    @mock.patch('armada.handlers.tiller.grpc', autospec=True)
    def test_get_tiller_ip_with_host_provided(self, mock_grpc, _):
        tiller_obj = tiller.Tiller('1.1.1.1')
        self.assertIsNotNone(tiller_obj._get_tiller_ip())
        self.assertEqual('1.1.1.1', tiller_obj._get_tiller_ip())

    @mock.patch.object(tiller.Tiller, '_get_tiller_pod', autospec=True)
    @mock.patch('armada.handlers.tiller.K8s', autospec=True)
    @mock.patch('armada.handlers.tiller.grpc', autospec=True)
    def test_get_tiller_ip_with_mocked_pod(self, mock_grpc, mock_k8s,
                                           mock_pod):
        status = mock.Mock(pod_ip='1.1.1.1')
        mock_pod.return_value.status = status
        tiller_obj = tiller.Tiller()
        self.assertEqual('1.1.1.1', tiller_obj._get_tiller_ip())

    @mock.patch.object(tiller.Tiller, '_get_tiller_ip', autospec=True)
    @mock.patch('armada.handlers.tiller.K8s', autospec=True)
    @mock.patch('armada.handlers.tiller.grpc', autospec=True)
    def test_get_tiller_pod_throws_exception(self, mock_grpc, mock_k8s,
                                             mock_ip):

        mock_k8s.get_namespace_pod.return_value.items = []
        tiller_obj = tiller.Tiller()
        mock_grpc.insecure_channel.side_effect = ex.ChannelException()
        self.assertRaises(ex.TillerPodNotRunningException,
                          tiller_obj._get_tiller_pod)

    @mock.patch.object(tiller.Tiller, '_get_tiller_ip', autospec=True)
    @mock.patch('armada.handlers.tiller.K8s', autospec=True)
    @mock.patch('armada.handlers.tiller.grpc', autospec=True)
    def test_get_tiller_port(self, mock_grpc, _, mock_ip):
        # instantiate Tiller object
        tiller_obj = tiller.Tiller(None, '8080', None)
        self.assertEqual('8080', tiller_obj._get_tiller_port())

    @mock.patch.object(tiller.Tiller, '_get_tiller_ip', autospec=True)
    @mock.patch('armada.handlers.tiller.K8s', autospec=True)
    @mock.patch('armada.handlers.tiller.grpc', autospec=True)
    def test_get_tiller_namespace(self, mock_grpc, _, mock_ip):
        # verifies namespace set via instantiation
        tiller_obj = tiller.Tiller(None, None, 'test_namespace2')
        self.assertEqual('test_namespace2',
                         tiller_obj._get_tiller_namespace())

    @mock.patch.object(tiller.Tiller, '_get_tiller_ip', autospec=True)
    @mock.patch('armada.handlers.tiller.K8s', autospec=True)
    @mock.patch('armada.handlers.tiller.grpc', autospec=True)
    def test_get_tiller_status_with_ip_provided(self, mock_grpc, _, mock_ip):
        # instantiate Tiller object
        tiller_obj = tiller.Tiller(None, '8080', None)
        self.assertTrue(tiller_obj.tiller_status())

    @mock.patch.object(tiller.Tiller, '_get_tiller_ip', autospec=True)
    @mock.patch('armada.handlers.tiller.K8s', autospec=True)
    @mock.patch('armada.handlers.tiller.grpc', autospec=True)
    def test_get_tiller_status_no_ip(self, mock_grpc, _, mock_ip):
        mock_ip.return_value = ''
        # instantiate Tiller object
        tiller_obj = tiller.Tiller()
        self.assertFalse(tiller_obj.tiller_status())

    @mock.patch.object(tiller.Tiller, '_get_tiller_ip', autospec=True)
    @mock.patch('armada.handlers.tiller.K8s', autospec=True)
    @mock.patch('armada.handlers.tiller.grpc', autospec=True)
    def test_list_releases_empty(self, mock_grpc, _, mock_ip):
        # instantiate Tiller object
        tiller_obj = tiller.Tiller()
        self.assertEqual([], tiller_obj.list_releases())

    @mock.patch.object(tiller.Tiller, '_get_tiller_ip', autospec=True)
    @mock.patch('armada.handlers.tiller.K8s', autospec=True)
    @mock.patch('armada.handlers.tiller.grpc', autospec=True)
    def test_list_charts_empty(self, mock_grpc, _, mock_ip):
        # instantiate Tiller object
        tiller_obj = tiller.Tiller()
        self.assertEqual([], tiller_obj.list_charts())

    @mock.patch('armada.handlers.tiller.K8s')
    @mock.patch('armada.handlers.tiller.grpc')
    @mock.patch.object(tiller, 'ListReleasesRequest')
    @mock.patch.object(tiller, 'ReleaseServiceStub')
    def test_list_releases(self, mock_release_service_stub,
                           mock_list_releases_request, mock_grpc, _):
        mock_release_service_stub.return_value.ListReleases. \
            return_value = [mock.Mock(releases=['foo', 'bar'])]

        tiller_obj = tiller.Tiller('host', '8080', None)
        self.assertEqual(['foo', 'bar'], tiller_obj.list_releases())

        mock_release_service_stub.assert_called_once_with(
            tiller_obj.channel)
        list_releases_stub = mock_release_service_stub.return_value. \
            ListReleases
        list_releases_stub.assert_called_once_with(
            mock_list_releases_request.return_value, tiller_obj.timeout,
            metadata=tiller_obj.metadata)

        mock_list_releases_request.assert_called_once_with(
            limit=tiller.RELEASE_LIMIT,
            status_codes=[tiller.STATUS_DEPLOYED,
                          tiller.STATUS_FAILED],
            sort_by='LAST_RELEASED',
            sort_order='DESC')

    @mock.patch('armada.handlers.tiller.K8s')
    @mock.patch('armada.handlers.tiller.grpc')
    @mock.patch.object(tiller, 'GetReleaseContentRequest')
    @mock.patch.object(tiller, 'ReleaseServiceStub')
    def test_get_release_content(self, mock_release_service_stub,
                                 mock_release_content_request,
                                 mock_grpc, _):
        mock_release_service_stub.return_value.GetReleaseContent\
            .return_value = {}

        tiller_obj = tiller.Tiller('host', '8080', None)

        self.assertEqual({}, tiller_obj.get_release_content('release'))
        get_release_content_stub = mock_release_service_stub. \
            return_value.GetReleaseContent
        get_release_content_stub.assert_called_once_with(
            mock_release_content_request.return_value, tiller_obj.timeout,
            metadata=tiller_obj.metadata)

    @mock.patch('armada.handlers.tiller.K8s')
    @mock.patch('armada.handlers.tiller.grpc')
    @mock.patch.object(tiller, 'GetVersionRequest')
    @mock.patch.object(tiller, 'ReleaseServiceStub')
    def test_tiller_version(self, mock_release_service_stub,
                            mock_version_request,
                            mock_grpc, _):

        mock_version = mock.Mock()
        mock_version.Version.sem_ver = mock.sentinel.sem_ver
        mock_release_service_stub.return_value.GetVersion\
            .return_value = mock_version

        tiller_obj = tiller.Tiller('host', '8080', None)

        self.assertEqual(mock.sentinel.sem_ver, tiller_obj.tiller_version())

        mock_release_service_stub.assert_called_once_with(
            tiller_obj.channel)

        get_version_stub = mock_release_service_stub.return_value.GetVersion
        get_version_stub.assert_called_once_with(
            mock_version_request.return_value, tiller_obj.timeout,
            metadata=tiller_obj.metadata)

    @mock.patch('armada.handlers.tiller.K8s')
    @mock.patch('armada.handlers.tiller.grpc')
    @mock.patch.object(tiller, 'GetVersionRequest')
    @mock.patch.object(tiller, 'GetReleaseStatusRequest')
    @mock.patch.object(tiller, 'ReleaseServiceStub')
    def test_get_release_status(self, mock_release_service_stub,
                                mock_rel_status_request, mock_version_request,
                                mock_grpc, _):
        mock_release_service_stub.return_value.GetReleaseStatus. \
            return_value = {}

        tiller_obj = tiller.Tiller('host', '8080', None)
        self.assertEqual({}, tiller_obj.get_release_status('release'))

        mock_release_service_stub.assert_called_once_with(
            tiller_obj.channel)
        get_release_status_stub = mock_release_service_stub.return_value. \
            GetReleaseStatus
        get_release_status_stub.assert_called_once_with(
            mock_rel_status_request.return_value, tiller_obj.timeout,
            metadata=tiller_obj.metadata)

    @mock.patch('armada.handlers.tiller.K8s')
    @mock.patch('armada.handlers.tiller.grpc')
    @mock.patch.object(tiller, 'UninstallReleaseRequest')
    @mock.patch.object(tiller, 'ReleaseServiceStub')
    def test_uninstall_release(self, mock_release_service_stub,
                               mock_uninstall_release_request,
                               mock_grpc, _):
        mock_release_service_stub.return_value.UninstallRelease\
            .return_value = {}

        tiller_obj = tiller.Tiller('host', '8080', None)

        self.assertEqual({}, tiller_obj.uninstall_release('release'))

        mock_release_service_stub.assert_called_once_with(
            tiller_obj.channel)
        uninstall_release_stub = mock_release_service_stub.return_value. \
            UninstallRelease

        uninstall_release_stub.assert_called_once_with(
            mock_uninstall_release_request.return_value, tiller_obj.timeout,
            metadata=tiller_obj.metadata)


text:
/* tslint:disable */
/**
 * This is an autogenerated file created by the Stencil compiler.
 * It contains typing information for all components that exist in this project.
 */

import './stencil.core';

export namespace Components {

  interface SvgLoader {
    'color': string;
    'url': string;
    'width': string;
  }
  interface SvgLoaderAttributes extends StencilHTMLAttributes {
    'color'?: string;
    'url'?: string;
    'width'?: string;
  }
}

declare global {
  interface StencilElementInterfaces {
    'SvgLoader': Components.SvgLoader;
  }

  interface StencilIntrinsicElements {
    'svg-loader': Components.SvgLoaderAttributes;
  }

  interface HTMLSvgLoaderElement extends Components.SvgLoader, HTMLStencilElement {}
  var HTMLSvgLoaderElement: {
    prototype: HTMLSvgLoaderElement;
    new (): HTMLSvgLoaderElement;
  };

  interface HTMLElementTagNameMap {
    'svg-loader': HTMLSvgLoaderElement
  }

  interface ElementTagNameMap {
    'svg-loader': HTMLSvgLoaderElement;
  }

}

redpajama_set_name: RedPajamaGithub


text:
import React, { useCallback, useEffect } from 'react';
import { useGlobals, useStorybookApi } from '@storybook/api';
import { Icons, IconButton } from '@storybook/components';
import { TOOL_ID, ADDON_ID } from './constants';

export const Tool = () => {
  const [globals, updateGlobals] = useGlobals();
  const { measureEnabled } = globals;
  const api = useStorybookApi();

  const toggleMeasure = useCallback(
    () =>
      updateGlobals({
        measureEnabled: !measureEnabled,
      }),
    [updateGlobals, measureEnabled]
  );

  useEffect(() => {
    api.setAddonShortcut(ADDON_ID, {
      label: 'Toggle Measure [M]',
      defaultShortcut: ['M'],
      actionName: 'measure',
      showInMenu: false,
      action: toggleMeasure,
    });
  }, [toggleMeasure, api]);

  return (
    <IconButton
      key={TOOL_ID}
      active={measureEnabled}
      title="Enable measure"
      onClick={toggleMeasure}
    >
      <Icons icon="ruler" />
    </IconButton>
  );
};


text:
import asyncio
from flask.ext.script import Command, Manager, Option

from ircb.web.app import app
from ircb.models import get_session, User
from ircb.storeclient import NetworkStore
from ircb.lib.async import coroutinize
import ircb.stores

manager = Manager(app)
session = get_session()

class CreateUserCommand(Command):
    option_list = (
        Option('--username', '-u', dest='username'),
        Option('--email', '-e', dest='email'),
        Option('--password', dest='password')
    )

    def run(self, username, email, password):
        user = User(username=username, email=email, password=password)
        session.add(user)
        session.commit()

class CreateNetworkCommand(Command):
    option_list = (
        Option('--user', '-u', dest='user'),
        Option('--name', '-n', dest='name'),
        Option('--nick', dest='nick'),
        Option('--host', dest='host'),
        Option('--port', dest='port'),
        Option('--realname', dest='realname', default=''),
        Option('--username', dest='username', default=''),
        Option('--password', dest='password', default=''),
        Option('--usermode', '-m', dest='usermode', default='0'),
    )

    @coroutinize
    def run(self, user, name, nick, host, port, realname, username, password,
            usermode):
        network = yield from NetworkStore.create(
            dict(
                user=user,
                name=name,
                nickname=nick,
                hostname=host,
                port=port,
                realname=realname,
                username=username,
                password=password,
                usermode=usermode
            )
        )
        print(network.access_token)

if __name__ == '__main__':
    ircb.stores.initialize()
    manager.add_command('createuser', CreateUserCommand())
    manager.add_command('createnetwork', CreateNetworkCommand())
    manager.run()


text: <script src=../../cryptojslib/components/ripemd160-min.js></script>


text:
package betterwithmods.client.model.render;

/*Borrowed from https://github.com/SlimeKnights/TinkersConstruct */

import net.minecraft.client.Minecraft;
import net.minecraft.client.renderer.BufferBuilder;
import net.minecraft.client.renderer.GlStateManager;
import net.minecraft.client.renderer.RenderHelper;
import net.minecraft.client.renderer.Tessellator;
import net.minecraft.client.renderer.texture.TextureAtlasSprite;
import net.minecraft.client.renderer.texture.TextureMap;
import net.minecraft.client.renderer.vertex.DefaultVertexFormats;
import net.minecraft.util.EnumFacing;
import net.minecraft.util.EnumFacing.Axis;
import net.minecraft.util.ResourceLocation;
import net.minecraft.util.math.BlockPos;
import net.minecraftforge.fluids.FluidStack;
import org.lwjgl.opengl.GL11;

public final class FluidRenderUtils {

    private FluidRenderUtils() {
    }

    public static float FLUID_OFFSET = 0.005f;

    protected static Minecraft mc = Minecraft.getMinecraft();

    /**
     * Renders a fluid block, call from TESR. x/y/z is the rendering offset.
     *
     * @param fluid Fluid to render
     * @param pos   BlockPos where the Block is rendered. Used for brightness.
     * @param x     Rendering offset. TESR x parameter.
     * @param y     Rendering offset. TESR x parameter.
     * @param z     Rendering offset. TESR x parameter.
     * @param w     Width. 1 = full X-Width
     * @param h     Height. 1 = full Y-Height
     * @param d     Depth. 1 = full Z-Depth
     */
    public static void renderFluidCuboid(FluidStack fluid, BlockPos pos, double x, double y, double z, double w, double h, double d) {
        double wd = (1d - w) / 2d;
        double hd = (1d - h) / 2d;
        double dd = (1d - d) / 2d;

        renderFluidCuboid(fluid, pos, x, y, z, wd, hd, dd, 1d - wd, 1d - hd, 1d - dd);
    }

    public static void renderFluidCuboid(FluidStack fluid, BlockPos pos, double x, double y, double z, double x1, double y1, double z1, double x2, double y2, double z2) {
        int color = fluid.getFluid().getColor(fluid);
        renderFluidCuboid(fluid, pos, x, y, z, x1, y1, z1, x2, y2, z2, color);
    }

    /**
     * Renders block with offset x/y/z from x1/y1/z1 to x2/y2/z2 inside the block local coordinates, so from 0-1
     */
    public static void renderFluidCuboid(FluidStack fluid, BlockPos pos, double x, double y, double z, double x1, double y1, double z1, double x2, double y2, double z2, int color) {
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder renderer = tessellator.getBuffer();
        renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
        mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        //RenderUtil.setColorRGBA(color);
        int brightness = mc.world.getCombinedLight(pos, fluid.getFluid().getLuminosity());

        pre(x, y, z);

        TextureAtlasSprite still = mc.getTextureMapBlocks().getTextureExtry(fluid.getFluid().getStill(fluid).toString());
        TextureAtlasSprite flowing = mc.getTextureMapBlocks().getTextureExtry(fluid.getFluid().getFlowing(fluid).toString());

        // x/y/z2 - x/y/z1 is because we need the width/height/depth
        putTexturedQuad(renderer, still, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.DOWN, color, brightness, false);
        putTexturedQuad(renderer, flowing, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.NORTH, color, brightness, true);
        putTexturedQuad(renderer, flowing, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.EAST, color, brightness, true);
        putTexturedQuad(renderer, flowing, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.SOUTH, color, brightness, true);
        putTexturedQuad(renderer, flowing, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.WEST, color, brightness, true);
        putTexturedQuad(renderer, still, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.UP, color, brightness, false);

        tessellator.draw();

        post();
    }

    public static void renderStackedFluidCuboid(FluidStack fluid, double px, double py, double pz, BlockPos pos,
                                                BlockPos from, BlockPos to, double ymin, double ymax) {
        renderStackedFluidCuboid(fluid, px, py, pz, pos, from, to, ymin, ymax, FLUID_OFFSET);
    }

    public static void renderStackedFluidCuboid(FluidStack fluid, double px, double py, double pz, BlockPos pos,
                                                BlockPos from, BlockPos to, double ymin, double ymax, float offsetToBlockEdge) {
        if (ymin >= ymax) {
            return;
        }
        Tessellator tessellator = Tessellator.getInstance();
        BufferBuilder renderer = tessellator.getBuffer();
        renderer.begin(GL11.GL_QUADS, DefaultVertexFormats.BLOCK);
        mc.renderEngine.bindTexture(TextureMap.LOCATION_BLOCKS_TEXTURE);
        int color = fluid.getFluid().getColor(fluid);
        int brightness = mc.world.getCombinedLight(pos, fluid.getFluid().getLuminosity());

        pre(px, py, pz);
        GlStateManager.translate(from.getX(), from.getY(), from.getZ());

        TextureAtlasSprite still = mc.getTextureMapBlocks().getTextureExtry(fluid.getFluid().getStill(fluid).toString());
        TextureAtlasSprite flowing = mc.getTextureMapBlocks().getTextureExtry(fluid.getFluid().getFlowing(fluid).toString());

        if (still == null) {
            still = mc.getTextureMapBlocks().getMissingSprite();
        }
        if (flowing == null) {
            flowing = mc.getTextureMapBlocks().getMissingSprite();
        }

        int xd = to.getX() - from.getX();

        // the liquid can stretch over more blocks than the subtracted height is if ymin's decimal is bigger than ymax's decimal (causing UV over 1)
        // ignoring the decimals prevents this, as yd then equals exactly how many ints are between the two
        // for example, if ymax = 5.1 and ymin = 2.3, 2.8 (which rounds to 2), with the face array becoming 2.3, 3, 4, 5.1
        int yminInt = (int) ymin;
        int yd = (int) (ymax - yminInt);

        // prevents a rare case of rendering the top face multiple times if ymax is perfectly aligned with the block
        // for example, if ymax = 3 and ymin = 1, the values of the face array become 1, 2, 3, 3 as we then have middle ints
        if (ymax % 1d == 0) yd--;
        int zd = to.getZ() - from.getZ();

        double xmin = offsetToBlockEdge;
        double xmax = xd + 1d - offsetToBlockEdge;
        //double ymin = y1;
        //double ymax = y2;
        double zmin = offsetToBlockEdge;
        double zmax = zd + 1d - offsetToBlockEdge;

        double[] xs = new double[2 + xd];
        double[] ys = new double[2 + yd];
        double[] zs = new double[2 + zd];

        xs[0] = xmin;
        for (int i = 1; i <= xd; i++) xs[i] = i;
        xs[xd + 1] = xmax;

        // we have to add the whole number for ymin or otherwise things render incorrectly if above the first block
        // example, heights of 2 and 5 would produce array of 2, 1, 2, 5
        ys[0] = ymin;
        for (int i = 1; i <= yd; i++) ys[i] = i + yminInt;
        ys[yd + 1] = ymax;

        zs[0] = zmin;
        for (int i = 1; i <= zd; i++) zs[i] = i;
        zs[zd + 1] = zmax;

        // render each side
        for (int y = 0; y <= yd; y++) {
            for (int z = 0; z <= zd; z++) {
                for (int x = 0; x <= xd; x++) {

                    double x1 = xs[x];
                    double x2 = xs[x + 1] - x1;
                    double y1 = ys[y];
                    double y2 = ys[y + 1] - y1;
                    double z1 = zs[z];
                    double z2 = zs[z + 1] - z1;

                    if (x == 0)
                        putTexturedQuad(renderer, flowing, x1, y1, z1, x2, y2, z2, EnumFacing.WEST, color, brightness, true);
                    if (x == xd)
                        putTexturedQuad(renderer, flowing, x1, y1, z1, x2, y2, z2, EnumFacing.EAST, color, brightness, true);
                    if (y == 0)
                        putTexturedQuad(renderer, still, x1, y1, z1, x2, y2, z2, EnumFacing.DOWN, color, brightness, false);
                    if (y == yd)
                        putTexturedQuad(renderer, still, x1, y1, z1, x2, y2, z2, EnumFacing.UP, color, brightness, false);
                    if (z == 0)
                        putTexturedQuad(renderer, flowing, x1, y1, z1, x2, y2, z2, EnumFacing.NORTH, color, brightness, true);
                    if (z == zd)
                        putTexturedQuad(renderer, flowing, x1, y1, z1, x2, y2, z2, EnumFacing.SOUTH, color, brightness, true);
                }
            }
        }

        //putTexturedQuad(renderer, still,   x1, y1, z1, x2-x1, y2-y1, z2-z1, EnumFacing.DOWN, color, brightness);
        //putTexturedQuad(renderer, flowing, x1, y1, z1, x2-x1, y2-y1, z2-z1, EnumFacing.NORTH, color, brightness);
        //putTexturedQuad(renderer, flowing, x1, y1, z1, x2-x1, y2-y1, z2-z1, EnumFacing.EAST, color, brightness);
        //putTexturedQuad(renderer, flowing, x1, y1, z1, x2-x1, y2-y1, z2-z1, EnumFacing.SOUTH, color, brightness);
        //putTexturedQuad(renderer, flowing, x1, y1, z1, x2-x1, y2-y1, z2-z1, EnumFacing.WEST, color, brightness);
        //putTexturedQuad(renderer, still  , x1, y1, z1, x2-x1, y2-y1, z2-z1, EnumFacing.UP, color, brightness);

        tessellator.draw();

        post();
    }

    public static void putTexturedCuboid(BufferBuilder renderer, ResourceLocation location, double x1, double y1, double z1, double x2, double y2, double z2,
                                         int color, int brightness) {
        boolean flowing = false;
        TextureAtlasSprite sprite = mc.getTextureMapBlocks().getTextureExtry(location.toString());
        putTexturedQuad(renderer, sprite, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.DOWN, color, brightness, flowing);
        putTexturedQuad(renderer, sprite, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.NORTH, color, brightness, flowing);
        putTexturedQuad(renderer, sprite, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.EAST, color, brightness, flowing);
        putTexturedQuad(renderer, sprite, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.SOUTH, color, brightness, flowing);
        putTexturedQuad(renderer, sprite, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.WEST, color, brightness, flowing);
        putTexturedQuad(renderer, sprite, x1, y1, z1, x2 - x1, y2 - y1, z2 - z1, EnumFacing.UP, color, brightness, flowing);
    }

    public static void putTexturedQuad(BufferBuilder renderer, TextureAtlasSprite sprite, double x, double y, double z, double w, double h, double d, EnumFacing face,
                                       int color, int brightness, boolean flowing) {
        int l1 = brightness >> 0x10 & 0xFFFF;
        int l2 = brightness & 0xFFFF;

        int a = color >> 24 & 0xFF;
        int r = color >> 16 & 0xFF;
        int g = color >> 8 & 0xFF;
        int b = color & 0xFF;

        putTexturedQuad(renderer, sprite, x, y, z, w, h, d, face, r, g, b, a, l1, l2, flowing);
    }

    // x and x+w has to be within [0,1], same for y/h and z/d
    public static void putTexturedQuad(BufferBuilder renderer, TextureAtlasSprite sprite, double x, double y, double z, double w, double h, double d, EnumFacing face,
                                       int r, int g, int b, int a, int light1, int light2, boolean flowing) {
        // safety
        if (sprite == null) {
            return;
        }
        double minU;
        double maxU;
        double minV;
        double maxV;

        double size = 16f;
        if (flowing) {
            size = 8f;
        }

        double x1 = x;
        double x2 = x + w;
        double y1 = y;
        double y2 = y + h;
        double z1 = z;
        double z2 = z + d;

        double xt1 = x1 % 1d;
        double xt2 = xt1 + w;
        while (xt2 > 1f) xt2 -= 1f;
        double yt1 = y1 % 1d;
        double yt2 = yt1 + h;
        while (yt2 > 1f) yt2 -= 1f;
        double zt1 = z1 % 1d;
        double zt2 = zt1 + d;
        while (zt2 > 1f) zt2 -= 1f;

        // flowing stuff should start from the bottom, not from the start
        if (flowing) {
            double tmp = 1d - yt1;
            yt1 = 1d - yt2;
            yt2 = tmp;
        }

        switch (face) {
            case DOWN:
            case UP:
                minU = sprite.getInterpolatedU(xt1 * size);
                maxU = sprite.getInterpolatedU(xt2 * size);
                minV = sprite.getInterpolatedV(zt1 * size);
                maxV = sprite.getInterpolatedV(zt2 * size);
                break;
            case NORTH:
            case SOUTH:
                minU = sprite.getInterpolatedU(xt2 * size);
                maxU = sprite.getInterpolatedU(xt1 * size);
                minV = sprite.getInterpolatedV(yt1 * size);
                maxV = sprite.getInterpolatedV(yt2 * size);
                break;
            case WEST:
            case EAST:
                minU = sprite.getInterpolatedU(zt2 * size);
                maxU = sprite.getInterpolatedU(zt1 * size);
                minV = sprite.getInterpolatedV(yt1 * size);
                maxV = sprite.getInterpolatedV(yt2 * size);
                break;
            default:
                minU = sprite.getMinU();
                maxU = sprite.getMaxU();
                minV = sprite.getMinV();
                maxV = sprite.getMaxV();
        }

        switch (face) {
            case DOWN:
                renderer.pos(x1, y1, z1).color(r, g, b, a).tex(minU, minV).lightmap(light1, light2).endVertex();
                renderer.pos(x2, y1, z1).color(r, g, b, a).tex(maxU, minV).lightmap(light1, light2).endVertex();
                renderer.pos(x2, y1, z2).color(r, g, b, a).tex(maxU, maxV).lightmap(light1, light2).endVertex();
                renderer.pos(x1, y1, z2).color(r, g, b, a).tex(minU, maxV).lightmap(light1, light2).endVertex();
                break;
            case UP:
                renderer.pos(x1, y2, z1).color(r, g, b, a).tex(minU, minV).lightmap(light1, light2).endVertex();
                renderer.pos(x1, y2, z2).color(r, g, b, a).tex(minU, maxV).lightmap(light1, light2).endVertex();
                renderer.pos(x2, y2, z2).color(r, g, b, a).tex(maxU, maxV).lightmap(light1, light2).endVertex();
                renderer.pos(x2, y2, z1).color(r, g, b, a).tex(maxU, minV).lightmap(light1, light2).endVertex();
                break;
            case NORTH:
                renderer.pos(x1, y1, z1).color(r, g, b, a).tex(minU, maxV).lightmap(light1, light2).endVertex();
                renderer.pos(x1, y2, z1).color(r, g, b, a).tex(minU, minV).lightmap(light1, light2).endVertex();
                renderer.pos(x2, y2, z1).color(r, g, b, a).tex(maxU, minV).lightmap(light1, light2).endVertex();
                renderer.pos(x2, y1, z1).color(r, g, b, a).tex(maxU, maxV).lightmap(light1, light2).endVertex();
                break;
            case SOUTH:
                renderer.pos(x1, y1, z2).color(r, g, b, a).tex(maxU, maxV).lightmap(light1, light2).endVertex();
                renderer.pos(x2, y1, z2).color(r, g, b, a).tex(minU, maxV).lightmap(light1, light2).endVertex();
                renderer.pos(x2, y2, z2).color(r, g, b, a).tex(minU, minV).lightmap(light1, light2).endVertex();
                renderer.pos(x1, y2, z2).color(r, g, b, a).tex(maxU, minV).lightmap(light1, light2).endVertex();
                break;
            case WEST:
                renderer.pos(x1, y1, z1).color(r, g, b, a).tex(maxU, maxV).lightmap(light1, light2).endVertex();
                renderer.pos(x1, y1, z2).color(r, g, b, a).tex(minU, maxV).lightmap(light1, light2).endVertex();
                renderer.pos(x1, y2, z2).color(r, g, b, a).tex(minU, minV).lightmap(light1, light2).endVertex();
                renderer.pos(x1, y2, z1).color(r, g, b, a).tex(maxU, minV).lightmap(light1, light2).endVertex();
                break;
            case EAST:
                renderer.pos(x2, y1, z1).color(r, g, b, a).tex(minU, maxV).lightmap(light1, light2).endVertex();
                renderer.pos(x2, y2, z1).color(r, g, b, a).tex(minU, minV).lightmap(light1, light2).endVertex();
                renderer.pos(x2, y2, z2).color(r, g, b, a).tex(maxU, minV).lightmap(light1, light2).endVertex();
                renderer.pos(x2, y1, z2).color(r, g, b, a).tex(maxU, maxV).lightmap(light1, light2).endVertex();
                break;
        }
    }

    /**
     * Similar to putTexturedQuad, except its only for upwards quads and a rotation is specified
     */
    public static void putRotatedQuad(BufferBuilder renderer, TextureAtlasSprite sprite, double x, double y, double z, double w, double d, EnumFacing rotation,
                                      int color, int brightness, boolean flowing) {
        int l1 = brightness >> 0x10 & 0xFFFF;
        int l2 = brightness & 0xFFFF;

        int a = color >> 24 & 0xFF;
        int r = color >> 16 & 0xFF;
        int g = color >> 8 & 0xFF;
        int b = color & 0xFF;

        putRotatedQuad(renderer, sprite, x, y, z, w, d, rotation, r, g, b, a, l1, l2, flowing);
    }

    /**
     * Similar to putTexturedQuad, except its only for upwards quads and a rotation is specified
     */
    public static void putRotatedQuad(BufferBuilder renderer, TextureAtlasSprite sprite, double x, double y, double z, double w, double d, EnumFacing rotation,
                                      int r, int g, int b, int a, int light1, int light2, boolean flowing) {
        // safety
        if (sprite == null) {
            return;
        }

        double size = 16f;
        if (flowing) {
            size = 8f;
        }

        // coordinates for the sprite are super simple
        double x1 = x;
        double x2 = x + w;
        double z1 = z;
        double z2 = z + d;

        // textures
        double xt1 = x1 % 1d;
        double xt2 = xt1 + w;
        double zt1 = z1 % 1d;
        double zt2 = zt1 + d;

        // when rotating by 90 or 270 the dimensions switch, so switch the U and V before hand
        if (rotation.getAxis() == Axis.X) {
            double temp = xt1;
            xt1 = zt1;
            zt1 = temp;
            temp = xt2;
            xt2 = zt2;
            zt2 = temp;
        }

        // we want to start from the bottom for north or west textures as otherwise UV is backwards
        // we also want to start from the bottom for flowing fluids, and both should cancel
        if (flowing ^ (rotation == EnumFacing.NORTH || rotation == EnumFacing.WEST)) {
            double tmp = 1d - zt1;
            zt1 = 1d - zt2;
            zt2 = tmp;
        }

        double minU = sprite.getInterpolatedU(xt1 * size);
        double maxU = sprite.getInterpolatedU(xt2 * size);
        double minV = sprite.getInterpolatedV(zt1 * size);
        double maxV = sprite.getInterpolatedV(zt2 * size);

        switch (rotation) {
            case NORTH:
                renderer.pos(x1, y, z1).color(r, g, b, a).tex(minU, minV).lightmap(light1, light2).endVertex();
                renderer.pos(x1, y, z2).color(r, g, b, a).tex(minU, maxV).lightmap(light1, light2).endVertex();
                renderer.pos(x2, y, z2).color(r, g, b, a).tex(maxU, maxV).lightmap(light1, light2).endVertex();
                renderer.pos(x2, y, z1).color(r, g, b, a).tex(maxU, minV).lightmap(light1, light2).endVertex();
                break;
            case WEST:
                renderer.pos(x1, y, z1).color(r, g, b, a).tex(maxU, minV).lightmap(light1, light2).endVertex();
                renderer.pos(x1, y, z2).color(r, g, b, a).tex(minU, minV).lightmap(light1, light2).endVertex();
                renderer.pos(x2, y, z2).color(r, g, b, a).tex(minU, maxV).lightmap(light1, light2).endVertex();
                renderer.pos(x2, y, z1).color(r, g, b, a).tex(maxU, maxV).lightmap(light1, light2).endVertex();
                break;
            case SOUTH:
                renderer.pos(x1, y, z1).color(r, g, b, a).tex(maxU, maxV).lightmap(light1, light2).endVertex();
                renderer.pos(x1, y, z2).color(r, g, b, a).tex(maxU, minV).lightmap(light1, light2).endVertex();
                renderer.pos(x2, y, z2).color(r, g, b, a).tex(minU, minV).lightmap(light1, light2).endVertex();
                renderer.pos(x2, y, z1).color(r, g, b, a).tex(minU, maxV).lightmap(light1, light2).endVertex();
                break;
            case EAST:
                renderer.pos(x1, y, z1).color(r, g, b, a).tex(minU, maxV).lightmap(light1, light2).endVertex();
                renderer.pos(x1, y, z2).color(r, g, b, a).tex(maxU, maxV).lightmap(light1, light2).endVertex();
                renderer.pos(x2, y, z2).color(r, g, b, a).tex(maxU, minV).lightmap(light1, light2).endVertex();
                renderer.pos(x2, y, z1).color(r, g, b, a).tex(minU, minV).lightmap(light1, light2).endVertex();
                break;
        }
    }

    public static void pre(double x, double y, double z) {
        GlStateManager.pushMatrix();

        RenderHelper.disableStandardItemLighting();
        GlStateManager.enableBlend();
        GlStateManager.blendFunc(GL11.GL_SRC_ALPHA, GL11.GL_ONE_MINUS_SRC_ALPHA);

        if (Minecraft.isAmbientOcclusionEnabled()) {
            GL11.glShadeModel(GL11.GL_SMOOTH);
        } else {
            GL11.glShadeModel(GL11.GL_FLAT);
        }

        GlStateManager.translate(x, y, z);
    }

    public static void post() {
        GlStateManager.disableBlend();
        GlStateManager.popMatrix();
        RenderHelper.enableStandardItemLighting();
    }

    public static void setColorRGB(int color) {
        setColorRGBA(color | 0xff000000);
    }

    public static void setColorRGBA(int color) {
        float a = alpha(color) / 255.0F;
        float r = red(color) / 255.0F;
        float g = green(color) / 255.0F;
        float b = blue(color) / 255.0F;

        GlStateManager.color(r, g, b, a);
    }

    public static void setBrightness(BufferBuilder renderer, int brightness) {
        renderer.putBrightness4(brightness, brightness, brightness, brightness);
    }

    public static int compose(int r, int g, int b, int a) {
        int rgb = a;
        rgb = (rgb << 8) + r;
        rgb = (rgb << 8) + g;
        rgb = (rgb << 8) + b;
        return rgb;
    }

    public static int alpha(int c) {
        return (c >> 24) & 0xFF;
    }

    public static int red(int c) {
        return (c >> 16) & 0xFF;
    }

    public static int green(int c) {
        return (c >> 8) & 0xFF;
    }

    public static int blue(int c) {
        return (c) & 0xFF;
    }
}


text:
if (typeof (Number.prototype.toFixed) === "function") {
    Number.prototype.toPrecisionFixed = function (precision) {
        return this.toFixed(precision);
    };
} else {
    Number.prototype.toPrecisionFixed = function (precision) {
        if (isNaN(this)) return 'NaN';
        var numb = this < 0 ? -this : this; // can't take log of -ve number...
        var sign = this < 0 ? '-' : '',
            l,
            n;

        if (numb == 0) { // can't take log of zero, just format with precision zeros
            n = '0.';
            while (precision--) n += '0';
            return n;
        }

        var scale = Math.ceil(Math.log(numb) * Math.LOG10E); // no of digits before decimal
        n = String(Math.round(numb * Math.pow(10, precision - scale)));
        if (scale > 0) { // add trailing zeros & insert decimal as required
            l = scale - n.length;
            while (l-- > 0) n = n + '0';
            if (scale < n.length) n = n.slice(0, scale) + '.' + n.slice(scale);
        } else { // prefix decimal and leading zeros if required
            while (scale++ < 0) n = '0' + n;
            n = '0.' + n;
        }
        return sign + n;
    };
}


text:
from tempest.lib.services.volume.v3.attachments_client import AttachmentsClient
from tempest.lib.services.volume.v3.availability_zone_client \
    import AvailabilityZoneClient
from tempest.lib.services.volume.v3.backups_client import BackupsClient
from tempest.lib.services.volume.v3.base_client import BaseClient
from tempest.lib.services.volume.v3.capabilities_client import \
    CapabilitiesClient
from tempest.lib.services.volume.v3.encryption_types_client import \
    EncryptionTypesClient
from tempest.lib.services.volume.v3.extensions_client import ExtensionsClient
from tempest.lib.services.volume.v3.group_snapshots_client import \
    GroupSnapshotsClient
from tempest.lib.services.volume.v3.group_types_client import GroupTypesClient
from tempest.lib.services.volume.v3.groups_client import GroupsClient
from tempest.lib.services.volume.v3.hosts_client import HostsClient
from tempest.lib.services.volume.v3.limits_client import LimitsClient
from tempest.lib.services.volume.v3.messages_client import MessagesClient
from tempest.lib.services.volume.v3.qos_client import QosSpecsClient
from tempest.lib.services.volume.v3.quota_classes_client import \
    QuotaClassesClient
from tempest.lib.services.volume.v3.quotas_client import QuotasClient
from tempest.lib.services.volume.v3.scheduler_stats_client import \
    SchedulerStatsClient
from tempest.lib.services.volume.v3.services_client import ServicesClient
from tempest.lib.services.volume.v3.snapshot_manage_client import \
    SnapshotManageClient
from tempest.lib.services.volume.v3.snapshots_client import SnapshotsClient
from tempest.lib.services.volume.v3.transfers_client import TransfersClient
from tempest.lib.services.volume.v3.types_client import TypesClient
from tempest.lib.services.volume.v3.versions_client import VersionsClient
from tempest.lib.services.volume.v3.volume_manage_client import \
    VolumeManageClient
from tempest.lib.services.volume.v3.volumes_client import VolumesClient
__all__ = ['AttachmentsClient', 'AvailabilityZoneClient', 'BackupsClient',
           'BaseClient', 'CapabilitiesClient', 'EncryptionTypesClient',
           'ExtensionsClient', 'GroupSnapshotsClient', 'GroupTypesClient',
           'GroupsClient', 'HostsClient', 'LimitsClient', 'MessagesClient',
           'QosSpecsClient', 'QuotaClassesClient', 'QuotasClient',
           'SchedulerStatsClient', 'ServicesClient', 'SnapshotManageClient',
           'SnapshotsClient', 'TransfersClient', 'TypesClient',
           'VersionsClient', 'VolumeManageClient', 'VolumesClient']


text:
using Trade.Data;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace Trade.Indicator
{
    public class EMA : Series<double>
    {
        public EMA(Series<double> data, int N)
        {
            var prevDMA = 0d;
            var a = 2.0d / (N + 1);
            for (int i = 0; i < data.Count; i++)
            {
                var current = data[i];

                var value = a * current.Value + (1 - a) * prevDMA;
                if (value == 0d)
                    continue;

                prevDMA = value;

                this.Add(new sValue<double>
                {
                    Date = current.Date,
                    Value = value,
                });
            }
        }
    }
}


text:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<title>Canvas Modelling Toolkit - Getting into the Details</title>
<link href="../Styles/style.css" rel="stylesheet" type="text/css" />

Getting into the Details

The main components and concepts that constitute a Canvas are Blocks, Stickies, Images, Connections, Hints and Locking. A Canvas template typically consists of a number of (locked) Blocks and Images onto which the user can add Stickies, Images, Connections and additional Blocks if required. The following sections will describe each of these concepts in detail starting with a description of the Canvas Palette and an example of constructing an imaginary Canvas.

The Canvas Palette

When working with a Canvas, the Palette presents you with the tools that you need to create these objects.

The Canvas Palette

Select a tool in the Palette and draw it onto the Canvas. The coloured squares represent "Stickies". Note that you are not restricted to the provided colours as you can change the colour of the Sticky in the Properties Window. Similarly with the provided Connections, you can change the line and arrow head style of a Connection in its Properties Window.

Constructing a new Canvas - an Example

Let's work through the process of constructing our own Canvas based on mapping Past, Present and Future concepts.

Assuming that you have a model selected in the Model Tree follow these steps:

Right click on the "Views" folder of your model on the Model Tree and select "New->Blank Canvas":

The Blank Canvas View will automatically open. You can rename it at this point in the Model Tree if you wish.

From the Palette select the Block tool and draw a tall rectangular Block on the Canvas. Edit its text content by clicking on it and changing it to "Past":

Create two more Blocks named "Present" and "Future" adding them to the Canvas so that they line up as follows:

Now let's add some icons to these Blocks to make them visually more appealing. Double-click on the first Block to open the Properties Window. In the Properties Window select the "Image" tab. Then select the "Choose..." drop-down box and the "Set Image..." item:

        When the "My Images" Image Manager dialog window opens, select the "Open from File..." option and choose an appropriate image from your computer's file system. Do the same for the other Blocks.

Here's how it looks so far with the images that we have selected for the three Blocks:

  Now that we have constructed our three main Blocks we could take this opportunity to change their background colour, their text fonts and positions in the Properties Window. But for now let's add an Image underneath the Blocks. From the Palette select the Image tool and draw a rectangular Image place-holder on the Canvas right underneath the Blocks. Double-click on the Image place-holder to open the Properties Window. In the Properties Window on the "Main" tab select the "Choose..." drop-down box and the "Set Image..." item, as you did before for a Block, and select an appropriate image from your computer's file system. Then from the "Appearance" tab set the border to "None". The Canvas now looks like the following:

Adding Hints and Locking

For the finishing touches let's add some Hints to the Blocks and then lock them so that we can re-use the Canvas as a Template. Why do we want to add Hints to the Blocks? Well, as with the other objects in Archi models it's extremely helpful to provide a rubric that suggests to the end user the intent of the object and how it can be used in the model. Let's add the hints:

First ensure that the Hints Window is open. You can open it from the main "Window" menu.

Double-click on the first Block (the "Past" Block) in order to open the Properties Window.

In the Properties Window select the "Hint" tab.

Type "Past" for the Hint title, and some text for the Hint Content. Note that you can use HTML to mark up your content text. Here's what it looks like now:

Add Hints for the other Blocks.

Now let's lock all these objects so that we can use the Canvas. Select each Block and the Image in turn. In the Properties Window tick the "Locked" checkbox:

      Now that we have created the Blocks, added an Image, provided the Hints and locked the objects we can save the whole thing as a Canvas Template and then create new instances of the Canvas from the template. See the sections "Saving a Canvas as a Template" and
    "Creating a New Canvas from a Template" to do this.

Creating a new Canvas instance from the template means we can now start using it for real:

Our imaginary Canvas

For more ideas, look at how the built-in Canvas templates are constructed for further examples. See the section "Creating a New Canvas from a Template".

Archi uses a different file format for "*.archimate" files when adding images.
Normally Archi saves "*.archimate" files as single plain text XML format files. However, when images are used the file format used is a binary archive file (zip format) that contains both the model's XML file and the image files. This is to keep all related files together.


text:
// Copyright 2022 Google LLC
//
// 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
//
//     https://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
//
// ** This file is automatically generated by gapic-generator-typescript. **
// ** https://github.com/googleapis/gapic-generator-typescript **
// ** All changes to this file may be overwritten. **

'use strict';

function main(parent) {
  // [START aiplatform_v1_generated_FeaturestoreService_ListEntityTypes_async]
  /**
   * This snippet has been automatically generated and should be regarded as a code template only.
   * It will require modifications to work.
   * It may require correct/in-range values for request initialization.
   * TODO(developer): Uncomment these variables before running the sample.
   */
  /**
   *  Required. The resource name of the Featurestore to list EntityTypes.
   *  Format:
   *  `projects/{project}/locations/{location}/featurestores/{featurestore}`
   */
  // const parent = 'abc123'
  /**
   *  Lists the EntityTypes that match the filter expression. The following
   *  filters are supported:
   *  * `create_time`: Supports `=`, `!=`, `<`, `>`, `>=`, and `<=` comparisons.
   *  Values must be in RFC 3339 format.
   *  * `update_time`: Supports `=`, `!=`, `<`, `>`, `>=`, and `<=` comparisons.
   *  Values must be in RFC 3339 format.
   *  * `labels`: Supports key-value equality as well as key presence.
   *  Examples:
   *  * `create_time > \"2020-01-31T15:30:00.000000Z\" OR
   *       update_time > \"2020-01-31T15:30:00.000000Z\"` --> EntityTypes created
   *       or updated after 2020-01-31T15:30:00.000000Z.
   *  * `labels.active = yes AND labels.env = prod` --> EntityTypes having both
   *      (active: yes) and (env: prod) labels.
   *  * `labels.env: *` --> Any EntityType which has a label with 'env' as the
   *    key.
   */
  // const filter = 'abc123'
  /**
   *  The maximum number of EntityTypes to return. The service may return fewer
   *  than this value. If unspecified, at most 1000 EntityTypes will be returned.
   *  The maximum value is 1000; any value greater than 1000 will be coerced to
   *  1000.
   */
  // const pageSize = 1234
  /**
   *  A page token, received from a previous
   *  FeaturestoreService.ListEntityTypes google.cloud.aiplatform.v1.FeaturestoreService.ListEntityTypes  call.
   *  Provide this to retrieve the subsequent page.
   *  When paginating, all other parameters provided to
   *  FeaturestoreService.ListEntityTypes google.cloud.aiplatform.v1.FeaturestoreService.ListEntityTypes  must
   *  match the call that provided the page token.
   */
  // const pageToken = 'abc123'
  /**
   *  A comma-separated list of fields to order by, sorted in ascending order.
   *  Use "desc" after a field name for descending.
   *  Supported fields:
   *    * `entity_type_id`
   *    * `create_time`
   *    * `update_time`
   */
  // const orderBy = 'abc123'
  /**
   *  Mask specifying which fields to read.
   */
  // const readMask = {}

  // Imports the Aiplatform library
  const {FeaturestoreServiceClient} = require('@google-cloud/aiplatform').v1;

  // Instantiates a client
  const aiplatformClient = new FeaturestoreServiceClient();

  async function callListEntityTypes() {
    // Construct request
    const request = {
      parent,
    };

    // Run request
    const iterable = await aiplatformClient.listEntityTypesAsync(request);
    for await (const response of iterable) {
        console.log(response);
    }
  }

  callListEntityTypes();
  // [END aiplatform_v1_generated_FeaturestoreService_ListEntityTypes_async]
}

process.on('unhandledRejection', err => {
  console.error(err.message);
  process.exitCode = 1;
});
main(...process.argv.slice(2));


text:
'use strict';

let NEED_INJECT = true;
let META_GENERATOR_TAG;

function hexoMetaGeneratorInject(data) {
  if (!NEED_INJECT) return;

  if (!this.config.meta_generator
    || data.match(/<meta\s+(?:[^<>/]+\s)?name=['"]generator['"]/i)) {
    NEED_INJECT = false;
    return;
  }

  META_GENERATOR_TAG = META_GENERATOR_TAG || `<meta name="generator" content="Hexo ${this.version}">`;

  return data.replace('</head>', `${META_GENERATOR_TAG}</head>`);
}

module.exports = hexoMetaGeneratorInject;


text:
<?php

use Hubzero\Content\Migration\Base;

// No direct access
defined('_HZEXEC_') or die();

/**
 * Migration script to change database engine for a few core tables that could have been missed
 **/
class Migration2016090710490000Core extends Base
{
	private function changeEngine($table,$engine)
	{
		if ($this->db->tableExists($table) && strtolower($this->db->getEngine($table)) != $engine)
		{
			$query = "ALTER TABLE `" . $table . "` ENGINE = " . $engine;
			$this->db->setQuery($query);
			$this->db->query();
		}
	}

	public function up()
	{
		$this->changeEngine('#__viewlevels', 'MyISAM');
		$this->changeEngine('#__languages', 'MyISAM');
		$this->changeEngine('#__associations', 'MyISAM');
	}

	public function down()
	{
	}
}


text:
package org.hl7.v3;

import javax.xml.bind.annotation.XmlEnum;
import javax.xml.bind.annotation.XmlType;

/**
 *
Java class for ActSubstanceAdministrationImmunizationCode.
 *
 *
The following schema fragment specifies the expected content contained within this class.
 *

 *

 * <simpleType name="ActSubstanceAdministrationImmunizationCode">
 *   <restriction base="{urn:hl7-org:v3}cs">
 *     <enumeration value="IMMUNIZ"/>
 *     <enumeration value="BOOSTER"/>
 *     <enumeration value="INITIMMUNIZ"/>
 *   </restriction>
 * </simpleType>
 *

 *
 */
@XmlType(name = "ActSubstanceAdministrationImmunizationCode")
@XmlEnum
public enum ActSubstanceAdministrationImmunizationCode {

    IMMUNIZ,
    BOOSTER,
    INITIMMUNIZ;

    public String value() {
        return name();
    }

    public static ActSubstanceAdministrationImmunizationCode fromValue(String v) {
        return valueOf(v);
    }

}


text:
using System.Runtime.Serialization;
using SadRogue.Primitives;

namespace SadConsole.Effects
{
    /// <summary>
    /// Switches between the glyph of a cell and a specified glyph for an amount of time, and then repeats.
    /// </summary>
    [DataContract]
    public class BlinkGlyph : CellEffectBase
    {
        private bool _isOn;
        private int _blinkCounter = 0;
        private System.TimeSpan _duration = System.TimeSpan.Zero;

        /// <summary>
        /// In seconds, how fast the fade in and fade out each are
        /// </summary>
        [DataMember]
        public System.TimeSpan BlinkSpeed { get; set; }

        /// <summary>
        /// The glyph index to blink into.
        /// </summary>
        [DataMember]
        public int GlyphIndex { get; set; }

        /// <summary>
        /// How many times to blink. The value of -1 represents forever.
        /// </summary>
        [DataMember]
        public int BlinkCount { get; set; }

        /// <summary>
        /// The total duraction this effect will run for, before being flagged as finished. <see cref="System.TimeSpan.MaxValue"/> represents forever.
        /// </summary>
        [DataMember]
        public System.TimeSpan Duration { get; set; }

        /// <summary>
        /// Creates an instance of the blink glyph effect.
        /// </summary>
        public BlinkGlyph()
        {
            Duration = System.TimeSpan.MaxValue;
            BlinkCount = -1;
            BlinkSpeed = System.TimeSpan.FromSeconds(1);
            GlyphIndex = 0;
            _isOn = true;
        }

        /// <inheritdoc />
        public override bool ApplyToCell(ColoredGlyph cell, ColoredGlyphState originalState)
        {
            int oldGlyph = cell.Glyph;

            if (!_isOn)
                cell.Glyph = GlyphIndex;
            else
                cell.Glyph = originalState.Glyph;

            return cell.Glyph != oldGlyph;
        }

        /// <inheritdoc />
        public override void Update(System.TimeSpan delta)
        {
            base.Update(delta);

            if (_delayFinished && !IsFinished)
            {
                if (Duration != System.TimeSpan.MaxValue)
                {
                    _duration += delta;
                    if (_duration >= Duration)
                    {
                        IsFinished = true;
                        return;
                    }
                }

                if (_timeElapsed >= BlinkSpeed)
                {
                    _isOn = !_isOn;
                    _timeElapsed = System.TimeSpan.Zero;

                    if (BlinkCount != -1)
                    {
                        _blinkCounter += 1;

                        if (BlinkCount != -1 && _blinkCounter > (BlinkCount * 2))
                            IsFinished = true;
                    }
                }

                if (_timeElapsed >= BlinkSpeed)
                {
                    _isOn = !_isOn;
                    _timeElapsed = System.TimeSpan.Zero;
                }
            }
        }

        /// <summary>
        /// Restarts the cell effect but does not reset it.
        /// </summary>
        public override void Restart()
        {
            _isOn = true;
            _blinkCounter = 0;
            _duration = System.TimeSpan.Zero;

            base.Restart();
        }

        /// <inheritdoc />
        public override ICellEffect Clone() => new BlinkGlyph()
        {
            _isOn = _isOn,
            BlinkSpeed = BlinkSpeed,
            GlyphIndex = GlyphIndex,

            IsFinished = IsFinished,
            StartDelay = StartDelay,
            CloneOnAdd = CloneOnAdd,
            RemoveOnFinished = RemoveOnFinished,
            RestoreCellOnRemoved = RestoreCellOnRemoved,
            _timeElapsed = _timeElapsed,
        };

        //public override bool Equals(ICellEffect effect)
        //{
        //    if (effect is BlinkGlyph)
        //    {
        //        if (base.Equals(effect))
        //        {
        //            var effect2 = (BlinkGlyph)effect;

        //            return GlyphIndex == effect2.GlyphIndex &&
        //                   BlinkSpeed == effect2.BlinkSpeed &&
        //                   RemoveOnFinished == effect2.RemoveOnFinished &&
        //                   StartDelay == effect2.StartDelay;
        //        }
        //    }

        //    return false;
        //}

        /// <inheritdoc />
        public override string ToString() =>
            string.Format("BLINKCHAR-{0}-{1}-{2}-{3}", GlyphIndex, BlinkSpeed, StartDelay, RemoveOnFinished);
    }
}