text:
// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.logic.models;

import com.azure.core.http.rest.PagedIterable;
import com.azure.core.http.rest.Response;
import com.azure.core.util.Context;

/** Resource collection API of IntegrationAccountAssemblies. */
public interface IntegrationAccountAssemblies {
    /**
     * List the assemblies for an integration account.
     *
     * @param resourceGroupName The resource group name.
     * @param integrationAccountName The integration account name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a collection of assembly definitions.
     */
    PagedIterable<AssemblyDefinition> list(String resourceGroupName, String integrationAccountName);

    /**
     * List the assemblies for an integration account.
     *
     * @param resourceGroupName The resource group name.
     * @param integrationAccountName The integration account name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return a collection of assembly definitions.
     */
    PagedIterable<AssemblyDefinition> list(String resourceGroupName, String integrationAccountName, Context context);

    /**
     * Get an assembly for an integration account.
     *
     * @param resourceGroupName The resource group name.
     * @param integrationAccountName The integration account name.
     * @param assemblyArtifactName The assembly artifact name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an assembly for an integration account.
     */
    AssemblyDefinition get(String resourceGroupName, String integrationAccountName, String assemblyArtifactName);

    /**
     * Get an assembly for an integration account.
     *
     * @param resourceGroupName The resource group name.
     * @param integrationAccountName The integration account name.
     * @param assemblyArtifactName The assembly artifact name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an assembly for an integration account.
     */
    Response<AssemblyDefinition> getWithResponse(
        String resourceGroupName, String integrationAccountName, String assemblyArtifactName, Context context);

    /**
     * Delete an assembly for an integration account.
     *
     * @param resourceGroupName The resource group name.
     * @param integrationAccountName The integration account name.
     * @param assemblyArtifactName The assembly artifact name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    void delete(String resourceGroupName, String integrationAccountName, String assemblyArtifactName);

    /**
     * Delete an assembly for an integration account.
     *
     * @param resourceGroupName The resource group name.
     * @param integrationAccountName The integration account name.
     * @param assemblyArtifactName The assembly artifact name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response.
     */
    Response<Void> deleteWithResponse(
        String resourceGroupName, String integrationAccountName, String assemblyArtifactName, Context context);

    /**
     * Get the content callback url for an integration account assembly.
     *
     * @param resourceGroupName The resource group name.
     * @param integrationAccountName The integration account name.
     * @param assemblyArtifactName The assembly artifact name.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the content callback url for an integration account assembly.
     */
    WorkflowTriggerCallbackUrl listContentCallbackUrl(
        String resourceGroupName, String integrationAccountName, String assemblyArtifactName);

    /**
     * Get the content callback url for an integration account assembly.
     *
     * @param resourceGroupName The resource group name.
     * @param integrationAccountName The integration account name.
     * @param assemblyArtifactName The assembly artifact name.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the content callback url for an integration account assembly.
     */
    Response<WorkflowTriggerCallbackUrl> listContentCallbackUrlWithResponse(
        String resourceGroupName, String integrationAccountName, String assemblyArtifactName, Context context);

    /**
     * Get an assembly for an integration account.
     *
     * @param id the resource ID.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an assembly for an integration account.
     */
    AssemblyDefinition getById(String id);

    /**
     * Get an assembly for an integration account.
     *
     * @param id the resource ID.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return an assembly for an integration account.
     */
    Response<AssemblyDefinition> getByIdWithResponse(String id, Context context);

    /**
     * Delete an assembly for an integration account.
     *
     * @param id the resource ID.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     */
    void deleteById(String id);

    /**
     * Delete an assembly for an integration account.
     *
     * @param id the resource ID.
     * @param context The context to associate with this operation.
     * @throws IllegalArgumentException thrown if parameters fail the validation.
     * @throws com.azure.core.management.exception.ManagementException thrown if the request is rejected by server.
     * @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent.
     * @return the response.
     */
    Response<Void> deleteByIdWithResponse(String id, Context context);

    /**
     * Begins definition for a new AssemblyDefinition resource.
     *
     * @param name resource name.
     * @return the first stage of the new AssemblyDefinition definition.
     */
    AssemblyDefinition.DefinitionStages.Blank define(String name);
}


text:
#

CC=sdcc
NO_OPT=--nogcse --noinvariant --noinduction --nojtbound --noloopreverse --nolabelopt --nooverlay --peep-asm
DEBUG=--debug

CFLAGS=--model-large -I. -I../Common/include -I../include -I../../Source/include \
		-DSDCC_CYGNAL $(DEBUG) --less-pedantic --xram-size 8448 --stack-auto \
		--no-peep --int-long-reent --float-reent

DEMO_DIR = ../Common
SOURCE_DIR = ../../Source
PORT_DIR = ../../Source/portable/SDCC/Cygnal

SRC	= \
ParTest/ParTest.c \
serial/serial.c \
$(DEMO_DIR)/Full/flash.c \
$(DEMO_DIR)/Full/print.c \
$(DEMO_DIR)/Minimal/integer.c \
$(DEMO_DIR)/Minimal/PollQ.c \
$(DEMO_DIR)/Minimal/comtest.c \
$(DEMO_DIR)/Full/semtest.c \
$(SOURCE_DIR)/tasks.c \
$(SOURCE_DIR)/queue.c \
$(SOURCE_DIR)/list.c \
$(SOURCE_DIR)/portable/MemMang/heap_1.c \
$(PORT_DIR)/port.c

# Define all object files.
OBJ = $(SRC:.c=.rel)

######################################
# THIS VERSION WILL ONLY BUILD FILES THAT HAVE CHANGED, BUT MAY HAVE A DANGEROUS
# COMMAND LINE.  IT WORKS FINE UNDER WINDOWS, BUT I HAVE COMMENTED IT OUT IN
# CASE IT CAUSES PROBLEMS ON OTHER SYSTEMS.

#main : main.c Makefile ../../Source/portable/SDCC/Cygnal/portmacro.h $(OBJ)
#	$(CC) $(CFLAGS) main.c $(OBJ)

#%.rel : %.c Makefile ../../Source/portable/SDCC/Cygnal/portmacro.h
#	$(CC) -c $(CFLAGS) -o$< $<

######################################
# INSTEAD OF THE FOUR LINES ABOVE, THIS VERSION CAN BE USED BUT WILL CAUSE ALL
# FILES TO BUILD EVERY TIME.

main : main.c Makefile ../../Source/portable/SDCC/Cygnal/portmacro.h $(OBJ)
	$(CC) $(CFLAGS) main.c $(OBJ)

%.rel : %.c Makefile ../../Source/portable/SDCC/Cygnal/portmacro.h
	$(CC) -c $(CFLAGS) $<

redpajama_set_name: RedPajamaGithub


text:
IMAGE_NAME="mariadb:{MARIADB_VERSION}"

# Check if the cluster is marked as initialized. If it's already initialized, then just exit successfully
curl --silent --fail http://127.0.0.1:4001/v2/keys/mariadb-galera/initialized > /dev/null
if [ $? -ne 0 ]; then
    sleep 10

    while ! docker run --rm $IMAGE_NAME mysqladmin ping -h mariadb-node-0 --silent; do
        sleep 5
    done

    # Wait 5 more seconds before sending the green light
    sleep 5

    # Server is ready: other nodes can now connect
    curl -L http://127.0.0.1:4001/v2/keys/mariadb-galera/initialized -XPUT -d value="true"
fi


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>org.bouncycastle.crypto (Bouncy Castle Library 1.54 API Specification)</title>
<meta name="date" content="2015-12-29">
<link rel="stylesheet" type="text/css" href="../../../stylesheet.css" title="Style">

org.bouncycastle.crypto

Interfaces

AsymmetricBlockCipher

AsymmetricCipherKeyPairGenerator

BasicAgreement

BlockCipher

CharToByteConverter

CipherParameters

Committer

DerivationFunction

DerivationParameters

Digest

DigestDerivationFunction

DSA

ExtendedDigest

KeyEncapsulation

KeyEncoder

KeyParser

Mac

MacDerivationFunction

Signer

SignerWithRecovery

SkippingCipher

SkippingStreamCipher

StreamCipher

Wrapper

Xof

Classes

AsymmetricCipherKeyPair

BufferedAsymmetricBlockCipher

BufferedBlockCipher

CipherKeyGenerator

Commitment

EphemeralKeyPair

KeyGenerationParameters

PBEParametersGenerator

StreamBlockCipher

Exceptions

CryptoException

DataLengthException

InvalidCipherTextException

MaxBytesExceededException

OutputLengthException

RuntimeCryptoException


text:
 - Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
   instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
 - Dependency on logstash-core update to 2.0

# 2.0.0
  * synchronize access to OpenSSL::Cipher (not thread-safe)
  * use Digest for digests instead of OpenSSL::Digest and OpenSSL::HMAC (not thread-safe)
  * fix collectd packet mangling under high load conditions
# 1.0.1
  * Bug fix release including the necessary vendored files.
# 0.1.10
  * Ensure that notifications make it through.  Reported in #10


text:
class UnpublishAllStandardForms < ActiveRecord::Migration[4.2]
  def up
    # standard forms are now not publishable, so they should all be unpublished
    fixed = update("UPDATE forms SET published = 0 WHERE is_standard = 1 AND published = 1")
  end

  def down
  end
end


text:
const _ = require('lodash');
const auth = require('../lib/authentications');
const handlerFactory = require('./handlers.js');
const Joi = require('joi');

exports.register = function(server, eOptions, next) {
  const options = _.extend({ basePath: '/api/2.0' }, eOptions);
  const handlers = handlerFactory(server, 'cd-badges');

  server.route([
    {
      method: 'GET',
      path: `${options.basePath}/badges`,
      handler: handlers.actHandler('listBadges'),
      config: {
        description: 'List all possible badges',
        cors: { origin: ['*'], credentials: false },
        tags: ['api', 'users'],
      },
    },
    {
      method: 'GET',
      path: `${options.basePath}/badges/{slug}`,
      handler: handlers.actHandler('getBadge', 'slug'),
      config: {
        description: 'Get badge by slug',
        cors: { origin: ['*'], credentials: false },
        tags: ['api', 'users'],
        validate: {
          params: {
            slug: Joi.string().required(),
          },
        },
      },
    },
    {
      method: 'POST',
      path: `${options.basePath}/badges/applications`,
      handler: handlers.actHandlerNeedsUser('sendBadgeApplication'),
      config: {
        auth: auth.apiUser,
        description: 'Create badge application',
        tags: ['api', 'users'],
        validate: {
          payload: {
            applicationData: {
              user: Joi.object().keys({
                id: Joi.string()
                  .guid()
                  .required(),
                types: Joi.array()
                  .items(Joi.string())
                  .optional(),
              }),
              badge: Joi.object().required(),
              emailSubject: Joi.string()
                .valid('You have been awarded a new CoderDojo digital badge!')
                .required(),
              evidence: Joi.string().optional(),
            },
          },
        },
      },
    },
    {
      method: 'GET',
      path: `${options.basePath}/badges/user/{userId}`,
      handler: handlers.actHandlerNeedsUser('loadUserBadges', 'userId'),
      config: {
        auth: auth.apiUser,
        description: 'Load user badges',
        tags: ['api', 'users'],
        validate: {
          params: {
            userId: Joi.string()
              .guid()
              .required(),
          },
        },
      },
    },
    {
      method: 'GET',
      path: `${options.basePath}/badges/categories`,
      handler: handlers.actHandler('loadBadgeCategories'),
      config: {
        description: 'List badges categories',
        cors: { origin: ['*'], credentials: false },
        tags: ['api', 'users'],
      },
    },
    {
      method: 'POST',
      path: `${options.basePath}/badges/code`,
      handler: handlers.actHandlerNeedsUser('loadBadgeByCode'),
      config: {
        auth: auth.apiUser,
        description: 'Get Badge by Id',
        tags: ['api', 'users'],
        validate: {
          payload: {
            code: Joi.string().required(),
          },
        },
      },
    },
    {
      method: 'POST',
      path: `${options.basePath}/badges/claim`,
      handler: handlers.actHandlerNeedsUser('claimBadge'),
      config: {
        auth: auth.apiUser,
        description: 'Request a badge',
        tags: ['api', 'users'],
        validate: {
          payload: {
            userId: Joi.string()
              .guid()
              .optional(),
            badge: Joi.object().required(),
          },
        },
      },
    },
    {
      method: 'GET',
      path: `${options.basePath}/badges/export`,
      handler: handlers.actHandlerNeedsUser('exportBadges'),
      config: {
        auth: auth.apiUser,
        description: "Export User's badges",
        tags: ['api', 'users'],
      },
    },
    {
      method: 'GET',
      path: `${options.basePath}/badges/kpi/number-of-badges-awarded`,
      handler: handlers.actHandlerNeedsCdfAdmin('kpiNumberOfBadgesAwarded'),
      config: {
        auth: auth.apiUser,
        description: 'Number of badges awarded',
        tags: ['api', 'users'],
      },
    },
    {
      method: 'GET',
      path: `${options.basePath}/badges/kpi/number-of-badges-published`,
      handler: handlers.actHandlerNeedsCdfAdmin('kpiNumberOfBadgesPublished'),
      config: {
        auth: auth.apiUser,
        description: 'Number of existing badges',
        tags: ['api', 'users'],
      },
    },
  ]);

  next();
};

exports.register.attributes = {
  name: 'api-badges',
  dependencies: 'cd-auth',
};


text:
namespace ElderSoftware.Warlock.Forms.Contents
{
    partial class ScriptEditorTab
    {
        /// <summary>
        /// Required designer variable.
        /// </summary>
        private System.ComponentModel.IContainer components = null;

        /// <summary>
        /// Clean up any resources being used.
        /// </summary>
        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
        protected override void Dispose(bool disposing)
        {
            if (disposing && (components != null))
            {
                components.Dispose();
            }
            base.Dispose(disposing);
        }

        #region Windows Form Designer generated code

        /// <summary>
        /// Required method for Designer support - do not modify
        /// the contents of this method with the code editor.
        /// </summary>
        private void InitializeComponent()
        {
            this.components = new System.ComponentModel.Container();
            Sgry.Azuki.FontInfo fontInfo1 = new Sgry.Azuki.FontInfo();
            System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(ScriptEditorTab));
            this.ctlSourceCode = new Sgry.Azuki.WinForms.AzukiControl();
            this.ctlMenu = new System.Windows.Forms.ContextMenuStrip(this.components);
            this.ctlMenuCut = new System.Windows.Forms.ToolStripMenuItem();
            this.ctlMenuCopy = new System.Windows.Forms.ToolStripMenuItem();
            this.ctlMenuPaste = new System.Windows.Forms.ToolStripMenuItem();
            this.ctlMenu.SuspendLayout();
            this.SuspendLayout();
            //
            // ctlSourceCode
            //
            this.ctlSourceCode.BackColor = System.Drawing.Color.FromArgb(((int)(((byte)(255)))), ((int)(((byte)(250)))), ((int)(((byte)(240)))));
            this.ctlSourceCode.ContextMenuStrip = this.ctlMenu;
            this.ctlSourceCode.ConvertsTabToSpaces = true;
            this.ctlSourceCode.Cursor = System.Windows.Forms.Cursors.IBeam;
            this.ctlSourceCode.Dock = System.Windows.Forms.DockStyle.Fill;
            this.ctlSourceCode.DrawingOption = ((Sgry.Azuki.DrawingOption)((((((((Sgry.Azuki.DrawingOption.DrawsFullWidthSpace | Sgry.Azuki.DrawingOption.DrawsTab)
            | Sgry.Azuki.DrawingOption.DrawsEol)
            | Sgry.Azuki.DrawingOption.HighlightCurrentLine)
            | Sgry.Azuki.DrawingOption.ShowsLineNumber)
            | Sgry.Azuki.DrawingOption.ShowsHRuler)
            | Sgry.Azuki.DrawingOption.ShowsDirtBar)
            | Sgry.Azuki.DrawingOption.HighlightsMatchedBracket)));
            this.ctlSourceCode.FirstVisibleLine = 0;
            this.ctlSourceCode.Font = new System.Drawing.Font("MS ゴシック", 9F);
            fontInfo1.Name = "MS ゴシック";
            fontInfo1.Size = 9;
            fontInfo1.Style = System.Drawing.FontStyle.Regular;
            this.ctlSourceCode.FontInfo = fontInfo1;
            this.ctlSourceCode.ForeColor = System.Drawing.Color.Black;
            this.ctlSourceCode.Location = new System.Drawing.Point(0, 0);
            this.ctlSourceCode.Name = "ctlSourceCode";
            this.ctlSourceCode.ScrollPos = new System.Drawing.Point(0, 0);
            this.ctlSourceCode.ShowsHRuler = true;
            this.ctlSourceCode.Size = new System.Drawing.Size(284, 261);
            this.ctlSourceCode.TabIndex = 0;
            this.ctlSourceCode.TabWidth = 2;
            this.ctlSourceCode.UsesTabForIndent = false;
            this.ctlSourceCode.ViewWidth = 4131;
            this.ctlSourceCode.TextChanged += new System.EventHandler(this.ctlSourceCode_TextChanged);
            //
            // ctlMenu
            //
            this.ctlMenu.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
            this.ctlMenuCut,
            this.ctlMenuCopy,
            this.ctlMenuPaste});
            this.ctlMenu.Name = "ctlMenu";
            this.ctlMenu.Size = new System.Drawing.Size(153, 92);
            this.ctlMenu.Opening += new System.ComponentModel.CancelEventHandler(this.ctlMenu_Opening);
            //
            // ctlMenuCut
            //
            this.ctlMenuCut.Name = "ctlMenuCut";
            this.ctlMenuCut.Size = new System.Drawing.Size(152, 22);
            this.ctlMenuCut.Text = "切り取り";
            this.ctlMenuCut.Click += new System.EventHandler(this.ctlMenuCut_Click);
            //
            // ctlMenuCopy
            //
            this.ctlMenuCopy.Name = "ctlMenuCopy";
            this.ctlMenuCopy.Size = new System.Drawing.Size(152, 22);
            this.ctlMenuCopy.Text = "コピー";
            this.ctlMenuCopy.Click += new System.EventHandler(this.ctlMenuCopy_Click);
            //
            // ctlMenuPaste
            //
            this.ctlMenuPaste.Name = "ctlMenuPaste";
            this.ctlMenuPaste.Size = new System.Drawing.Size(152, 22);
            this.ctlMenuPaste.Text = "貼り付け";
            this.ctlMenuPaste.Click += new System.EventHandler(this.ctlMenuPaste_Click);
            //
            // ScriptEditorTab
            //
            this.AutoScaleDimensions = new System.Drawing.SizeF(6F, 12F);
            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
            this.ClientSize = new System.Drawing.Size(284, 261);
            this.Controls.Add(this.ctlSourceCode);
            this.DockAreas = ((WeifenLuo.WinFormsUI.Docking.DockAreas)((WeifenLuo.WinFormsUI.Docking.DockAreas.Float | WeifenLuo.WinFormsUI.Docking.DockAreas.Document)));
            this.Icon = ((System.Drawing.Icon)(resources.GetObject("$this.Icon")));
            this.Name = "ScriptEditorTab";
            this.ShowIcon = false;
            this.FormClosing += new System.Windows.Forms.FormClosingEventHandler(this.ScriptEditorTab_FormClosing);
            this.Load += new System.EventHandler(this.ScriptEditorTab_Load);
            this.Shown += new System.EventHandler(this.ScriptEditorTab_Shown);
            this.ctlMenu.ResumeLayout(false);
            this.ResumeLayout(false);

        }

        #endregion

        private Sgry.Azuki.WinForms.AzukiControl ctlSourceCode;
        private System.Windows.Forms.ContextMenuStrip ctlMenu;
        private System.Windows.Forms.ToolStripMenuItem ctlMenuCut;
        private System.Windows.Forms.ToolStripMenuItem ctlMenuCopy;
        private System.Windows.Forms.ToolStripMenuItem ctlMenuPaste;

    }
}


text:
<?xml version="1.0" encoding="utf-8"?>
<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:orientation="vertical" android:layout_width="match_parent"
    android:layout_height="match_parent">
    <graduationdesign.muguihai.com.v023.swipe_delete.SwipeLayout
        android:id="@+id/swipelayout"
        android:layout_width="match_parent"
        android:layout_height="wrap_content">

        <!--item内容布局-->
        <include layout="@layout/layout_content"/>

        <!--delete布局-->
        <include layout="@layout/layout_delete"/>

    </graduationdesign.muguihai.com.v023.swipe_delete.SwipeLayout
        >

</LinearLayout>


text:
<?php

namespace Drupal\system\Tests\Module;

use Drupal\Component\Render\FormattableMarkup;
use Drupal\Core\Logger\RfcLogLevel;

/**
 * Install/uninstall core module and confirm table creation/deletion.
 *
 * @group Module
 */
class InstallUninstallTest extends ModuleTestBase {

  /**
   * {@inheritdoc}
   */
  public static $modules = array('system_test', 'dblog', 'taxonomy', 'update_test_postupdate');

  /**
   * Tests that a fixed set of modules can be installed and uninstalled.
   */
  public function testInstallUninstall() {
    // Set a variable so that the hook implementations in system_test.module
    // will display messages via drupal_set_message().
    $this->container->get('state')->set('system_test.verbose_module_hooks', TRUE);

    // Install and uninstall module_test to ensure hook_preinstall_module and
    // hook_preuninstall_module are fired as expected.
    $this->container->get('module_installer')->install(array('module_test'));
    $this->assertEqual($this->container->get('state')->get('system_test_preinstall_module'), 'module_test');
    $this->container->get('module_installer')->uninstall(array('module_test'));
    $this->assertEqual($this->container->get('state')->get('system_test_preuninstall_module'), 'module_test');
    $this->resetAll();

    $all_modules = system_rebuild_module_data();

    // Test help on required modules, but do not test uninstalling.
    $required_modules = array_filter($all_modules, function ($module) {
      if (!empty($module->info['required']) || $module->status == TRUE) {
        if ($module->info['package'] != 'Testing' && empty($module->info['hidden'])) {
          return TRUE;
        }
      }
      return FALSE;
    });

    $required_modules['help'] = $all_modules['help'];

    // Test uninstalling without hidden, required, and already enabled modules.
    $all_modules = array_filter($all_modules, function ($module) {
      if (!empty($module->info['hidden']) || !empty($module->info['required']) || $module->status == TRUE || $module->info['package'] == 'Testing') {
        return FALSE;
      }
      return TRUE;
    });

    // Install the Help module, and verify it installed successfully.
    unset($all_modules['help']);
    $this->assertModuleNotInstalled('help');
    $edit = array();
    $package = $required_modules['help']->info['package'];
    $edit["modules[$package][help][enable]"] = TRUE;
    $this->drupalPostForm('admin/modules', $edit, t('Install'));
    $this->assertText('has been enabled', 'Modules status has been updated.');
    $this->assertText(t('hook_modules_installed fired for help'));
    $this->assertModuleSuccessfullyInstalled('help');

    // Test help for the required modules.
    foreach ($required_modules as $name => $module) {
      $this->assertHelp($name, $module->info['name']);
    }

    // Go through each module in the list and try to install and uninstall
    // it with its dependencies.
    while (list($name, $module) = each($all_modules)) {
      $was_installed_list = \Drupal::moduleHandler()->getModuleList();

      // Start a list of modules that we expect to be installed this time.
      $modules_to_install = array($name);
      foreach (array_keys($module->requires) as $dependency) {
        if (isset($all_modules[$dependency])) {
          $modules_to_install[] = $dependency;
        }
      }

      // Check that each module is not yet enabled and does not have any
      // database tables yet.
      foreach ($modules_to_install as $module_to_install) {
        $this->assertModuleNotInstalled($module_to_install);
      }

      // Install the module.
      $edit = array();
      $package = $module->info['package'];
      $edit["modules[$package][$name][enable]"] = TRUE;
      $this->drupalPostForm('admin/modules', $edit, t('Install'));

      // Handle experimental modules, which require a confirmation screen.
      if ($package == 'Core (Experimental)') {
        $this->assertText('Are you sure you wish to enable experimental modules?');
        if (count($modules_to_install) > 1) {
          // When there are experimental modules, needed dependencies do not
          // result in the same page title, but there will be expected text
          // indicating they need to be enabled.
          $this->assertText('You must enable');
        }
        $this->drupalPostForm(NULL, array(), t('Continue'));
      }
      // Handle the case where modules were installed along with this one and
      // where we therefore hit a confirmation screen.
      elseif (count($modules_to_install) > 1) {
        // Verify that we are on the correct form and that the expected text
        // about enabling dependencies appears.
        $this->assertText('Some required modules must be enabled');
        $this->assertText('You must enable');
        $this->drupalPostForm(NULL, array(), t('Continue'));
      }

      // List the module display names to check the confirmation message.
      $module_names = array();
      foreach ($modules_to_install as $module_to_install) {
        $module_names[] = $all_modules[$module_to_install]->info['name'];
      }
      $expected_text = \Drupal::translation()->formatPlural(count($module_names), 'Module @name has been enabled.', '@count modules have been enabled: @names.', array(
        '@name' => $module_names[0],
        '@names' => implode(', ', $module_names),
      ));
      $this->assertText($expected_text, 'Modules status has been updated.');

      // Check that hook_modules_installed() was invoked with the expected list
      // of modules, that each module's database tables now exist, and that
      // appropriate messages appear in the logs.
      foreach ($modules_to_install as $module_to_install) {
        $this->assertText(t('hook_modules_installed fired for @module', array('@module' => $module_to_install)));
        $this->assertLogMessage('system', "%module module installed.", array('%module' => $module_to_install), RfcLogLevel::INFO);
        $this->assertInstallModuleUpdates($module_to_install);
        $this->assertModuleSuccessfullyInstalled($module_to_install);
      }

      // Verify the help page.
      $this->assertHelp($name, $module->info['name']);

      // Uninstall the original module, plus everything else that was installed
      // with it.
      if ($name == 'forum') {
        // Forum has an extra step to be able to uninstall it.
        $this->preUninstallForum();
      }

      $now_installed_list = \Drupal::moduleHandler()->getModuleList();
      $added_modules = array_diff(array_keys($now_installed_list), array_keys($was_installed_list));
      while ($added_modules) {
        $initial_count = count($added_modules);
        foreach ($added_modules as $to_uninstall) {
          // See if we can currently uninstall this module (if its dependencies
          // have been uninstalled), and do so if we can.
          $this->drupalGet('admin/modules/uninstall');
          $field_name = "uninstall[$to_uninstall]";
          $has_checkbox = $this->xpath('//input[@type="checkbox" and @name="' . $field_name . '"]');
          $disabled = $this->xpath('//input[@type="checkbox" and @name="' . $field_name . '" and @disabled="disabled"]');

          if (!empty($has_checkbox) && empty($disabled)) {
            // This one is eligible for being uninstalled.
            $package = $all_modules[$to_uninstall]->info['package'];
            $this->assertSuccessfulUninstall($to_uninstall, $package);
            $added_modules = array_diff($added_modules, array($to_uninstall));
          }
        }

        // If we were not able to find a module to uninstall, fail and exit the
        // loop.
        $final_count = count($added_modules);
        if ($initial_count == $final_count) {
          $this->fail('Remaining modules could not be uninstalled for ' . $name);
          break;
        }
      }
    }

    // Uninstall the help module and put it back into the list of modules.
    $all_modules['help'] = $required_modules['help'];
    $this->assertSuccessfulUninstall('help', $required_modules['help']->info['package']);

    // Now that all modules have been tested, go back and try to enable them
    // all again at once. This tests two things:
    // - That each module can be successfully enabled again after being
    //   uninstalled.
    // - That enabling more than one module at the same time does not lead to
    //   any errors.
    $edit = array();
    $experimental = FALSE;
    foreach ($all_modules as $name => $module) {
      $edit['modules[' . $module->info['package'] . '][' . $name . '][enable]'] = TRUE;
      // Track whether there is at least one experimental module.
      if ($module->info['package'] == 'Core (Experimental)') {
        $experimental = TRUE;
      }
    }
    $this->drupalPostForm('admin/modules', $edit, t('Install'));

    // If there are experimental modules, click the confirm form.
    if ($experimental) {
      $this->assertText('Are you sure you wish to enable experimental modules?');
      $this->drupalPostForm(NULL, array(), t('Continue'));
    }
    // The string tested here is translatable but we are only using a part of it
    // so using a translated string is wrong. Doing so would create a new string
    // to translate.
    $this->assertText(new FormattableMarkup('@count modules have been enabled: ', array('@count' => count($all_modules))), 'Modules status has been updated.');
  }

  /**
   * Asserts that a module is not yet installed.
   *
   * @param string $name
   *   Name of the module to check.
   */
  protected function assertModuleNotInstalled($name) {
    $this->assertModules(array($name), FALSE);
    $this->assertModuleTablesDoNotExist($name);
  }

  /**
   * Asserts that a module was successfully installed.
   *
   * @param string $name
   *   Name of the module to check.
   */
  protected function assertModuleSuccessfullyInstalled($name) {
    $this->assertModules(array($name), TRUE);
    $this->assertModuleTablesExist($name);
    $this->assertModuleConfig($name);
  }

  /**
   * Uninstalls a module and asserts that it was done correctly.
   *
   * @param string $module
   *   The name of the module to uninstall.
   * @param string $package
   *   (optional) The package of the module to uninstall. Defaults
   *   to 'Core'.
   */
  protected function assertSuccessfulUninstall($module, $package = 'Core') {
    $edit = array();
    $edit['uninstall[' . $module . ']'] = TRUE;
    $this->drupalPostForm('admin/modules/uninstall', $edit, t('Uninstall'));
    $this->drupalPostForm(NULL, NULL, t('Uninstall'));
    $this->assertText(t('The selected modules have been uninstalled.'), 'Modules status has been updated.');
    $this->assertModules(array($module), FALSE);

    // Check that the appropriate hook was fired and the appropriate log
    // message appears. (But don't check for the log message if the dblog
    // module was just uninstalled, since the {watchdog} table won't be there
    // anymore.)
    $this->assertText(t('hook_modules_uninstalled fired for @module', array('@module' => $module)));
    $this->assertLogMessage('system', "%module module uninstalled.", array('%module' => $module), RfcLogLevel::INFO);

    // Check that the module's database tables no longer exist.
    $this->assertModuleTablesDoNotExist($module);
    // Check that the module's config files no longer exist.
    $this->assertNoModuleConfig($module);
    $this->assertUninstallModuleUpdates($module);
  }

  /**
   * Asserts the module post update functions after install.
   *
   * @param string $module
   *   The module that got installed.
   */
  protected function assertInstallModuleUpdates($module) {
    /** @var \Drupal\Core\Update\UpdateRegistry $post_update_registry */
    $post_update_registry = \Drupal::service('update.post_update_registry');
    $all_update_functions = $post_update_registry->getPendingUpdateFunctions();
    $empty_result = TRUE;
    foreach ($all_update_functions as $function) {
      list($function_module, ) = explode('_post_update_', $function);
      if ($module === $function_module) {
        $empty_result = FALSE;
        break;
      }
    }
    $this->assertTrue($empty_result, 'Ensures that no pending post update functions are available.');

    $existing_updates = \Drupal::keyValue('post_update')->get('existing_updates', []);
    switch ($module) {
      case 'block':
        $this->assertFalse(array_diff(['block_post_update_disable_blocks_with_missing_contexts'], $existing_updates));
        break;
      case 'update_test_postupdate':
        $this->assertFalse(array_diff(['update_test_postupdate_post_update_first', 'update_test_postupdate_post_update_second', 'update_test_postupdate_post_update_test1', 'update_test_postupdate_post_update_test0'], $existing_updates));
        break;
    }
  }

  /**
   * Asserts the module post update functions after uninstall.
   *
   * @param string $module
   *   The module that got installed.
   */
  protected function assertUninstallModuleUpdates($module) {
    /** @var \Drupal\Core\Update\UpdateRegistry $post_update_registry */
    $post_update_registry = \Drupal::service('update.post_update_registry');
    $all_update_functions = $post_update_registry->getPendingUpdateFunctions();

    switch ($module) {
      case 'block':
        $this->assertFalse(array_intersect(['block_post_update_disable_blocks_with_missing_contexts'], $all_update_functions), 'Asserts that no pending post update functions are available.');

        $existing_updates = \Drupal::keyValue('post_update')->get('existing_updates', []);
        $this->assertFalse(array_intersect(['block_post_update_disable_blocks_with_missing_contexts'], $existing_updates), 'Asserts that no post update functions are stored in keyvalue store.');
        break;
    }
  }

  /**
   * Verifies a module's help.
   *
   * Verifies that the module help page from hook_help() exists and can be
   * displayed, and that it contains the phrase "Foo Bar module", where "Foo
   * Bar" is the name of the module from the .info.yml file.
   *
   * @param string $module
   *   Machine name of the module to verify.
   * @param string $name
   *   Human-readable name of the module to verify.
   */
  protected function assertHelp($module, $name) {
    $this->drupalGet('admin/help/' . $module);
    $this->assertResponse(200, "Help for $module displayed successfully");
    $this->assertText($name . ' module', "'$name module' is on the help page for $module");
    $this->assertLink('online documentation for the ' . $name . ' module', 0, "Correct online documentation link is in the help page for $module");
  }

  /**
   * Deletes forum taxonomy terms, so Forum can be uninstalled.
   */
  protected function preUninstallForum() {
    // There only should be a 'General discussion' term in the 'forums'
    // vocabulary, but just delete any terms there in case the name changes.
    $query = \Drupal::entityQuery('taxonomy_term');
    $query->condition('vid', 'forums');
    $ids = $query->execute();
    $storage = \Drupal::entityManager()->getStorage('taxonomy_term');
    $terms = $storage->loadMultiple($ids);
    $storage->delete($terms);
  }

}


text:
using Rabbit.WeiXin.MP.Messages.Request;
using System;
using System.Xml.Linq;

namespace Rabbit.WeiXin.MP.Serialization.Providers.Request
{
    internal sealed class VideoMessageFormatter : XmlMessageFormatterBase<RequestMessageVideo>
    {
        #region Overrides of XmlMessageFormatterBase<RequestMessageVideo>

        public override RequestMessageVideo Deserialize(XContainer container)
        {
            return SetBaseInfo(container, new RequestMessageVideo
            {
                ThumbMediaId = GetValue(container, "ThumbMediaId")
            });
        }

        public override string Serialize(RequestMessageVideo graph)
        {
            throw new NotImplementedException();
        }

        #endregion Overrides of XmlMessageFormatterBase<RequestMessageVideo>
    }
}


text:
namespace content {

class ServiceWorkerProcessBrowserTest
    : public ContentBrowserTest,
      public ::testing::WithParamInterface<bool> {
 public:
  ServiceWorkerProcessBrowserTest() {
    feature_list_.InitAndEnableFeature(
        features::kServiceWorkerPrefersUnusedProcess);
  }
  ~ServiceWorkerProcessBrowserTest() override = default;

  ServiceWorkerProcessBrowserTest(const ServiceWorkerProcessBrowserTest&) =
      delete;
  ServiceWorkerProcessBrowserTest& operator=(
      const ServiceWorkerProcessBrowserTest&) = delete;

  void SetUpOnMainThread() override {
    // Support multiple sites on the test server.
    host_resolver()->AddRule("*", "127.0.0.1");
    ASSERT_TRUE(embedded_test_server()->Start());

    StoragePartition* partition = BrowserContext::GetDefaultStoragePartition(
        shell()->web_contents()->GetBrowserContext());
    wrapper_ = static_cast<ServiceWorkerContextWrapper*>(
        partition->GetServiceWorkerContext());
  }

  void SetUpCommandLine(base::CommandLine* command_line) override {
    if (SitePerProcess()) {
      command_line->AppendSwitch(switches::kSitePerProcess);
    } else {
      command_line->RemoveSwitch(switches::kSitePerProcess);
      command_line->AppendSwitch(switches::kDisableSiteIsolation);
    }
  }

 protected:
  bool SitePerProcess() const { return GetParam(); }

  // Registers a service worker and then tears down the process it used, for a
  // clean slate going forward.
  void RegisterServiceWorker() {
    // Load a page that registers a service worker.
    Shell* start_shell = CreateBrowser();
    ASSERT_TRUE(NavigateToURL(
        start_shell, embedded_test_server()->GetURL(
                         "/service_worker/create_service_worker.html")));
    ASSERT_EQ("DONE",
              EvalJs(start_shell, "register('fetch_event_pass_through.js');"));

    auto* host = RenderProcessHost::FromID(GetServiceWorkerProcessId());
    ASSERT_TRUE(host);
    RenderProcessHostWatcher exit_watcher(
        host, RenderProcessHostWatcher::WATCH_FOR_PROCESS_EXIT);

    // Tear down the page.
    start_shell->Close();

    // Stop the service worker. The process should exit.
    base::RunLoop loop;
    wrapper()->StopAllServiceWorkers(loop.QuitClosure());
    loop.Run();
    exit_watcher.Wait();
  }

  // Returns the number of running service workers.
  size_t GetRunningServiceWorkerCount() {
    return wrapper()->GetRunningServiceWorkerInfos().size();
  }

  // Returns the process id of the running service worker. There must be exactly
  // one service worker running.
  int GetServiceWorkerProcessId() {
    const base::flat_map<int64_t, ServiceWorkerRunningInfo>& infos =
        wrapper()->GetRunningServiceWorkerInfos();
    DCHECK_EQ(infos.size(), 1u);
    const ServiceWorkerRunningInfo& info = infos.begin()->second;
    return info.render_process_id;
  }

  ServiceWorkerContextWrapper* wrapper() { return wrapper_.get(); }

  WebContentsImpl* web_contents() {
    return static_cast<WebContentsImpl*>(shell()->web_contents());
  }

  RenderFrameHostImpl* current_frame_host() {
    return web_contents()->GetFrameTree()->root()->current_frame_host();
  }

 private:
  base::test::ScopedFeatureList feature_list_;
  scoped_refptr<ServiceWorkerContextWrapper> wrapper_;
};

// Tests that a service worker started due to a navigation shares the same
// process as the navigation.
IN_PROC_BROWSER_TEST_P(ServiceWorkerProcessBrowserTest,
                       ServiceWorkerAndPageShareProcess) {
  // Register the service worker.
  RegisterServiceWorker();

  // Navigate to a page in the service worker's scope.
  ASSERT_TRUE(NavigateToURL(
      shell(), embedded_test_server()->GetURL("/service_worker/empty.html")));

  // The page and service worker should be in the same process.
  int page_process_id = current_frame_host()->GetProcess()->GetID();
  EXPECT_NE(page_process_id, ChildProcessHost::kInvalidUniqueID);
  ASSERT_EQ(GetRunningServiceWorkerCount(), 1u);
  int worker_process_id = GetServiceWorkerProcessId();
  EXPECT_EQ(page_process_id, worker_process_id);
}

namespace {

// ContentBrowserClient that skips assigning a site URL for a given URL.
class DontAssignSiteContentBrowserClient : public TestContentBrowserClient {
 public:
  // Any visit to |url_to_skip| will not cause the site to be assigned to the
  // SiteInstance.
  explicit DontAssignSiteContentBrowserClient(const GURL& url_to_skip)
      : url_to_skip_(url_to_skip) {}

  DontAssignSiteContentBrowserClient(
      const DontAssignSiteContentBrowserClient&) = delete;
  DontAssignSiteContentBrowserClient& operator=(
      const DontAssignSiteContentBrowserClient&) = delete;

  bool ShouldAssignSiteForURL(const GURL& url) override {
    return url != url_to_skip_;
  }

 private:
  GURL url_to_skip_;
};

}  // namespace

// Tests that a service worker and navigation share the same process in the
// special case where the service worker starts before the navigation starts,
// and the navigation transitions out of a page with no site URL. This special
// case happens in real life when doing a search from the omnibox while on the
// Android native NTP page: the service worker starts first due to the
// navigation hint from the omnibox, and the native page has no site URL. See
// https://crbug.com/1012143.
IN_PROC_BROWSER_TEST_P(
    ServiceWorkerProcessBrowserTest,
    ServiceWorkerAndPageShareProcess_NavigateFromUnassignedSiteInstance) {
  // Set up a page URL that will have no site URL.
  GURL empty_site = embedded_test_server()->GetURL("a.com", "/title1.html");
  DontAssignSiteContentBrowserClient content_browser_client(empty_site);
  ContentBrowserClient* old_client =
      SetBrowserClientForTesting(&content_browser_client);

  // Register the service worker.
  RegisterServiceWorker();

  // Navigate to the empty site instance page.
  ASSERT_TRUE(NavigateToURL(shell(), empty_site));
  EXPECT_EQ(web_contents()->GetLastCommittedURL(), empty_site);
  scoped_refptr<SiteInstanceImpl> site_instance =
      web_contents()->GetMainFrame()->GetSiteInstance();
  EXPECT_EQ(GURL(), site_instance->GetSiteURL());
  int page_process_id = current_frame_host()->GetProcess()->GetID();
  EXPECT_NE(page_process_id, ChildProcessHost::kInvalidUniqueID);

  // Start the service worker. It should start in the same process.
  base::RunLoop loop;
  GURL scope = embedded_test_server()->GetURL("/service_worker/");
  int worker_process_id;
  wrapper()->StartWorkerForScope(
      scope,
      base::BindLambdaForTesting(
          [&](int64_t version_id, int process_id, int thread_id) {
            worker_process_id = process_id;
            loop.Quit();
          }),
      base::BindLambdaForTesting([&loop]() {
        ASSERT_FALSE(true) << "start worker failed";
        loop.Quit();
      }));
  loop.Run();

  // The page and service worker should be in the same process.
  EXPECT_EQ(page_process_id, worker_process_id);

  // Navigate to a page in the service worker's scope. It should still be in the
  // same process.
  ASSERT_TRUE(NavigateToURL(
      shell(), embedded_test_server()->GetURL("/service_worker/empty.html")));
  EXPECT_EQ(page_process_id, current_frame_host()->GetProcess()->GetID());

  SetBrowserClientForTesting(old_client);
}

// Toggle Site Isolation.
INSTANTIATE_TEST_SUITE_P(All, ServiceWorkerProcessBrowserTest, testing::Bool());

}  // namespace content


text:
A VimScript plugin for the Kodery snippets service

NB: Currently this plugin __will not__ work. It's being developed.

## Installation

TODO

## Mappings

This plugin doesn't have any default mappings. Here's some suggested ones:

```
nnoremap <leader>kp :call KoderyGoAndPrepend()<cr>
nnoremap <leader>ka :call KoderyGoAndAppend()<cr>
```


text:
{-# OPTIONS -fno-warn-missing-signatures #-}

module Tokenizer where

import           Control.Applicative           hiding (many, (<|>))
import           Text.ParserCombinators.Parsec

import           ParsecExtra

data Program = Program [Token]
             deriving (Eq, Show)

data Token = Algorithm
           | Assign
           | Case
           | Comma
           | Comment String
           | Constant
           | Dot -- .
           | Else
           | Elseif
           | Encapsulated
           | End
           | Equation
           | For
           | Function
           | If
           | In
           | Import
           | Input
           | Local
           | ListEnd
           | ListStart
           | Loop
           | Matchcontinue
           | MComment String
           | Match
           | Output
           | Package
           | ParenL
           | ParenR
           | Partial
           | Public
           | Protected
           | Record
           | Redeclare
           | Semi -- ;
           | Then
           | Type
           | Union

           | Str String
           | S String -- Infix operator, including "or" and "and"
           | W String -- Word
           | EOF
             deriving (Eq, Show)

isW (W _) = True
isW _ = False
isStr (Str _) = True
isStr _ = False
isSym (S _) = True
isSym _ = False
isComment (Comment _) = True
isComment _ = False
isMComment (MComment _) = True
isMComment _ = False
fromW (W s) = s
fromW _ = error "fromW"
fromS (S s) = s
fromS _ = error "fromS"
fromStr (Str s) = s
fromStr _ = error "fromStr"
isInputOutput p = Input == p || Output == p

parseFile :: String -> Either ParseError Program
parseFile = parse p_top "(unknown)"

p_top :: CharParser st Program
p_top = Program . (++ [EOF]) <$> many (ws *> p_token <* ws) <* eof

p_token :: CharParser st Token
p_token =
  (char ';' *> return Semi)
    <|> char '('                *> return ParenL
    <|> char ')'                *> return ParenR
    <|> char ','                *> return Comma
    <|> char '.'                *> return Dot
    <|> char '{'                *> return ListStart
    <|> char '}'                *> return ListEnd
    <|> try (Comment <$> (str "//" *> many1 (noneOf "\r\n") <* many1 (oneOf "\r\n")))
    <|> try (fmap MComment $ str "/*" *> manyTill (noneOf "_") (try (string "*/")))
    <|> try (strSep ":="           *> return Assign)
    <|> try (strSep "algorithm"    *> return Algorithm)
    <|> try (strSep "case"         *> return Case)
    <|> try (strSep "constant"     *> return Constant)
    <|> try (strSep "encapsulated" *> return Encapsulated)
    <|> try (strSep "elseif"       *> return Elseif)
    <|> try (strSep "else"         *> return Else)
    <|> try (strSep "end"          *> return End)
    <|> try (strSep "equation"     *> return Equation)
    <|> try (strSep "for"          *> return For)
    <|> try (strSep "function"     *> return Function)
    <|> try (strSep "if"           *> return If)
    <|> try (strSep "in"           *> return In)
    <|> try (strSep "import"       *> return Import)
    <|> try (strSep "input"        *> return Input)
    <|> try (strSep "local"        *> return Local)
    <|> try (strSep "loop"         *> return Loop)
    <|> try (strSep "matchcontinue"*> return Matchcontinue)
    <|> try (strSep "match"        *> return Match)
    <|> try (strSep "output"       *> return Output)
    <|> try (strSep "package"      *> return Package)
    <|> try (strSep "partial"      *> return Partial)
    <|> try (strSep "protected"    *> return Protected)
    <|> try (strSep "public"       *> return Public)
    <|> try (strSep "redeclare"    *> return Redeclare)
    <|> try (strSep "record"       *> return Record)
    <|> try (strSep "then"         *> return Then)
    <|> try (strSep "type"         *> return Type)
    <|> try (strSep "uniontype"    *> return Union)
    <|> Str <$> between (char '"') (char '"')
          (concat <$> many (try (list2 <$> char '\\' <*> anyChar) <|> many1 (noneOf "\\\"")))
    <|> S <$> ((try (strSep "and") *> return "and")
            <|> (try (strSep "or") *> return "or")
            <|> (try (strSep "not") *> return "not")
            <|> try (string ">" <* notFollowedBy (oneOf "+&*+:=/-<"))
            <|> many1 (oneOf "+&*+:=/-<>"))
    <|> W <$> many1 wordChar
  where
    wordChar = letter <|> digit <|> char '_'
    strSep :: String -> CharParser st ()
    strSep s = str s >> notFollowedBy wordChar
    list2 x y = x : [y]


text:
<!DOCTYPE html>

    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width">
    <title>Negociações</title>

Negociações

    <form class="form">

            Data
            <input type="text" id="data" class="form-control" required autofocus/>

            Quantidade
            <input type="number" min="1" step="1" id="quantidade" class="form-control" value="1" required/>

            Valor
            <input id="valor" type="number" class="form-control" min="0.01" step="0.01" value="0.0" required />

        <button class="btn btn-primary" type="submit">Incluir</button>
    </form>

        <button id="botao-importa" class="btn btn-primary text-center" type="button">
            Importar Negociações
        </button>
        <button id="botao-apaga" class="btn btn-primary text-center" type="button">
            Apagar
        </button>


text:
title: Use an id Attribute to Style an Element
localeTitle: Use um atributo id para estilizar um elemento
---
## Use um atributo id para estilizar um elemento

Este é um esboço. [Ajude nossa comunidade a expandi-lo](https://github.com/freecodecamp/guides/tree/master/src/pages/certifications/responsive-web-design/basic-css/use-an-id-attribute-to-style-an-element/index.md) .

[Este guia de estilo rápido ajudará a garantir que sua solicitação de recebimento seja aceita](https://github.com/freecodecamp/guides/blob/master/README.md) .


text:
<?php

namespace Sylius\Component\Attribute\Model;

/**
 * @author Gonzalo Vilaseca <gvilaseca@reiss.co.uk>
 */
interface AttributeTranslationInterface
{
    /**
     * @return mixed
     */
    public function getId();

    /**
     * @return string
     */
    public function getPresentation();

    /**
     * @param string $presentation
     */
    public function setPresentation($presentation);

}


text:
<?php

namespace Magento\Widget\Model\ResourceModel\Layout\Link;

/**
 * Layout update collection model
 */
class Collection extends \Magento\Framework\Model\ResourceModel\Db\Collection\AbstractCollection
{
    /**
     * @var \Magento\Framework\Stdlib\DateTime
     */
    protected $dateTime;

    /**
     * @param \Psr\Log\LoggerInterface $logger
     * @param \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy
     * @param \Magento\Framework\Event\ManagerInterface $eventManager
     * @param \Magento\Framework\Stdlib\DateTime $dateTime
     * @param mixed $connection
     * @param \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource
     * @param \Magento\Framework\Data\Collection\EntityFactory $entityFactory
     */
    public function __construct(
        \Magento\Framework\Data\Collection\EntityFactory $entityFactory,
        \Psr\Log\LoggerInterface $logger,
        \Magento\Framework\Data\Collection\Db\FetchStrategyInterface $fetchStrategy,
        \Magento\Framework\Event\ManagerInterface $eventManager,
        \Magento\Framework\Stdlib\DateTime $dateTime,
        \Magento\Framework\DB\Adapter\AdapterInterface $connection = null,
        \Magento\Framework\Model\ResourceModel\Db\AbstractDb $resource = null
    ) {
        $this->dateTime = $dateTime;
        parent::__construct($entityFactory, $logger, $fetchStrategy, $eventManager, $connection, $resource);
    }

    /**
     * Define resource model
     *
     * @return void
     */
    protected function _construct()
    {
        parent::_construct();
        $this->_init('Magento\Widget\Model\Layout\Link', 'Magento\Widget\Model\ResourceModel\Layout\Link');
    }

    /**
     * Add filter by theme id
     *
     * @param int $themeId
     * @return $this
     */
    public function addThemeFilter($themeId)
    {
        $this->addFieldToFilter('theme_id', $themeId);
        return $this;
    }

    /**
     * Join with layout update table
     *
     * @param array $fields
     * @return $this
     */
    protected function _joinWithUpdate($fields = [])
    {
        $flagName = 'joined_with_update_table';
        if (!$this->getFlag($flagName)) {
            $this->getSelect()->join(
                ['update' => $this->getTable('layout_update')],
                'update.layout_update_id = main_table.layout_update_id',
                [$fields]
            );
            $this->setFlag($flagName, true);
        }

        return $this;
    }

    /**
     * Filter by temporary flag
     *
     * @param bool $isTemporary
     * @return $this
     */
    public function addTemporaryFilter($isTemporary)
    {
        $this->addFieldToFilter('main_table.is_temporary', $isTemporary ? 1 : 0);
        return $this;
    }

    /**
     * Get links for layouts that are older than specified number of days
     *
     * @param string $days
     * @return $this
     */
    public function addUpdatedDaysBeforeFilter($days)
    {
        $datetime = new \DateTime('now', new \DateTimeZone('UTC'));
        $storeInterval = new \DateInterval('P' . $days . 'D');
        $datetime->sub($storeInterval);
        $formattedDate = $this->dateTime->formatDate($datetime->getTimestamp());

        $this->_joinWithUpdate();
        $this->addFieldToFilter(
            'update.updated_at',
            ['notnull' => true]
        )->addFieldToFilter(
            'update.updated_at',
            ['lt' => $formattedDate]
        );

        return $this;
    }
}


text:
<?php

declare(strict_types = 1);

namespace KoolKode\Async;

use KoolKode\Async\Concurrent\Filesystem\PoolFilesystem;
use KoolKode\Async\Concurrent\Pool\Pool;
use KoolKode\Async\Concurrent\Pool\PoolFactory;
use KoolKode\Async\Concurrent\Pool\SyncPool;
use KoolKode\Async\Concurrent\Pool\WorkerPool;
use KoolKode\Async\Concurrent\Process\AmpProcessFactory;
use KoolKode\Async\Concurrent\Process\ProcessFactory;
use KoolKode\Async\Concurrent\Process\RemoteProcessFactory;
use KoolKode\Async\DNS\HostFileReader;
use KoolKode\Async\DNS\HostReader;
use KoolKode\Async\DNS\HostResolver;
use KoolKode\Async\DNS\NameserverReader;
use KoolKode\Async\DNS\Resolver;
use KoolKode\Async\DNS\UnixNameserverReader;
use KoolKode\Async\DNS\WindowsNameserverReader;
use KoolKode\Async\EIO\EIOFilesystem;
use KoolKode\Async\Filesystem\Filesystem;
use KoolKode\Async\Log\ContextLogging;
use KoolKode\Async\Log\LogHandler;
use KoolKode\Async\Log\LoggerRegistration;
use KoolKode\Async\Loop\Loop;
use KoolKode\Async\Loop\LoopFactory;
use KoolKode\Async\UV\UVFilesystem;
use KoolKode\Async\UV\UVProcessFactory;

class ContextFactory
{
    protected $factories = [];

    protected $loggers;

    protected $adapters;

    protected $windows;

    protected $cli;

    public function __construct()
    {
        $this->loggers = new \SplObjectStorage();
        $this->adapters = new \SplPriorityQueue();

        $this->register(Loop::class, [
            new LoopFactory(),
            'createLoop'
        ], \PHP_INT_MIN);

        $this->register(NameserverReader::class, [
            $this,
            'createNameserverReader'
        ], \PHP_INT_MIN);

        $this->register(HostReader::class, [
            $this,
            'createHostFileReader'
        ], \PHP_INT_MIN);

        $this->register(HostResolver::class, [
            $this,
            'createHostResolver'
        ], \PHP_INT_MIN);

        $this->register(ProcessFactory::class, [
            $this,
            'createProcessFactory'
        ], \PHP_INT_MIN);

        $this->register(PoolFactory::class, [
            $this,
            'createPoolFactory'
        ], \PHP_INT_MIN);

        $this->register(Filesystem::class, [
            $this,
            'createFilesystem'
        ], \PHP_INT_MIN);

        $this->windows = \KOOLKODE_ASYNC_OS_WINDOWS;
        $this->cli = \KOOLKODE_ASYNC_CLI;
    }

    public function register(string $key, callable $factory, int $priority = 0): void
    {
        if (!$factory instanceof \Closure) {
            $factory = \Closure::fromCallable($factory);
        }

        $factory = new class($factory, $priority) {

            public $priority;

            public $callback;

            public function __construct(\Closure $callback, int $priority)
            {
                $this->callback = $callback;
                $this->priority = $priority;
            }
        };

        if (empty($this->factories[$key])) {
            $this->factories[$key] = [
                $factory
            ];

            return;
        }

        for ($size = \count($this->factories[$key]), $i = 0; $i < $size; $i++) {
            if ($this->factories[$key][$i]->priority < $priority) {
                \array_splice($this->factories[$key], $i, 0, [
                    $factory
                ]);

                return;
            }
        }

        $this->factories[$key][] = $factory;
    }

    public function registerLogger(LogHandler $handler, int $threshold = LogHandler::ALL, ?array $channels = null): void
    {
        $this->loggers->attach(new LoggerRegistration($handler, $threshold, $channels));
    }

    public function registerPromiseAdapter(PromiseAdapter $adapter, int $priority = 0): void
    {
        $this->adapters->insert($adapter, $priority);
    }

    protected function createNameserverReader(): NameserverReader
    {
        return $this->windows ? new WindowsNameserverReader() : new UnixNameserverReader();
    }

    protected function createHostFileReader(): HostFileReader
    {
        return new HostFileReader();
    }

    protected function createHostResolver(NameserverReader $serverReader, HostReader $hostReader): HostResolver
    {
        try {
            $servers = $serverReader->getNameservers();
        } catch (\OutOfBoundsException $e) {
            $servers = [];
        }

        try {
            $hosts = $hostReader->getHosts();
        } catch (\OutOfBoundsException $e) {
            $hosts = [];
        }

        return new Resolver($servers ?: NameserverReader::DEFAULT_SERVERS, $hosts);
    }

    protected function createProcessFactory(Loop $loop): ProcessFactory
    {
        if ($loop->getHandle() instanceof \UVLoop) {
            return new UVProcessFactory($loop);
        }

        return \KOOLKODE_ASYNC_OS_WINDOWS ? new AmpProcessFactory($loop) : new RemoteProcessFactory();
    }

    protected function createPoolFactory(): PoolFactory
    {
        return new class($this->cli) implements PoolFactory {

            private $cli;

            public function __construct(bool $cli)
            {
                $this->cli = $cli;
            }

            public function createPool(?int $size = null): Pool
            {
                return $this->cli ? new WorkerPool($size) : new SyncPool();
            }
        };
    }

    protected function createFilesystem(Loop $loop, PoolFactory $factory): Filesystem
    {
        if ($loop->getHandle() instanceof \UVLoop) {
            return new UVFilesystem($loop);
        }

        if (\extension_loaded('eio')) {
            return new EIOFilesystem($loop);
        }

        return new PoolFilesystem($factory->createPool());
    }

    public function createLoop(): Loop
    {
        return $this->createLookup(Loop::class, $this->factories[Loop::class])();
    }

    public function createContext(array $vars = [], ?Loop $loop = null): Context
    {
        if ($loop === null) {
            $loop = $this->createLoop();
        }

        $vars[PromiseAdapter::class] = $this->createPromiseAdapter(clone $this->adapters);

        foreach ($this->factories as $k => $v) {
            if ($k !== Loop::class && empty($vars[$k])) {
                $vars[$k] = $this->createLookup($k, $v);
            }
        }

        $context = (new Context($loop))->withAll($vars);

        return \call_user_func(\Closure::bind(function (\SplObjectStorage $loggers) {
            $this->logging = new ContextLogging($this, $loggers);

            return $this;
        }, $context, Context::class), $this->loggers);
    }

    public static function run(callable $work, array $vars = [], ?Loop $loop = null)
    {
        return (new static())->createContext($vars, $loop)->run($work);
    }

    protected function createLookup(string $type, array $factories): Lookup
    {
        return new Lookup($type, ...\array_map(function ($obj) {
            return $obj->callback;
        }, $factories));
    }

    protected function createPromiseAdapter(\SplPriorityQueue $adapters): PromiseAdapter
    {
        $registered = [];

        while (!$adapters->isEmpty()) {
            $registered[] = $adapters->extract();
        }

        return new class($registered) implements PromiseAdapter {

            protected $adapters = [];

            public function __construct(array $adapters)
            {
                $this->adapters = $adapters;
            }

            public function adapt(Context $context, $promise): ?Promise
            {
                foreach ($this->adapters as $adapter) {
                    if (null !== ($converted = $adapter->adapt($context, $promise))) {
                        return $converted;
                    }
                }

                $type = \is_object($promise) ? \get_class($promise) : \gettype($promise);

                throw new \UnexpectedValueException(\sprintf('Cannot adapt %s to promise', $type));
            }
        };
    }
}


text:
use std::{
    future::Future,
    io::{self, ErrorKind},
    pin::Pin,
    sync::Arc,
    task::{self, Poll},
};

use futures::{future::BoxFuture, FutureExt};
use hyper::Uri;
use log::error;
use pin_project::pin_project;
use tower::Service;

use crate::local::{context::ServiceContext, loadbalancing::ServerIdent, net::AutoProxyClientStream};

use super::{http_stream::ProxyHttpStream, utils::host_addr};

#[derive(Clone)]
pub struct Connector {
    context: Arc<ServiceContext>,
    server: Option<Arc<ServerIdent>>,
}

impl Connector {
    pub fn new(context: Arc<ServiceContext>, server: Option<Arc<ServerIdent>>) -> Connector {
        Connector { context, server }
    }
}

impl Service<Uri> for Connector {
    type Error = io::Error;
    type Future = Connecting;
    type Response = ProxyHttpStream;

    fn poll_ready(&mut self, _cx: &mut task::Context<'_>) -> Poll<Result<(), Self::Error>> {
        Poll::Ready(Ok(()))
    }

    fn call(&mut self, dst: Uri) -> Self::Future {
        let context = self.context.clone();
        let server = self.server.clone();
        Connecting {
            fut: async move {
                let is_https = dst.scheme_str() == Some("https");
                match host_addr(&dst) {
                    None => {
                        use std::io::Error;
                        error!("HTTP target URI must be a valid address, but found: {}", dst);
                        let err = Error::new(ErrorKind::Other, "URI must be a valid Address");
                        Err(err)
                    }
                    Some(addr) => {
                        let s = match server {
                            Some(ser) => AutoProxyClientStream::connect_proxied(context, ser.as_ref(), addr).await?,
                            None => AutoProxyClientStream::connect_bypassed(context, addr).await?,
                        };

                        if is_https {
                            let host = dst.host().unwrap().trim_start_matches('[').trim_start_matches(']');
                            ProxyHttpStream::connect_https(s, host).await
                        } else {
                            Ok(ProxyHttpStream::connect_http(s))
                        }
                    }
                }
            }
            .boxed(),
        }
    }
}

#[pin_project]
pub struct Connecting {
    #[pin]
    fut: BoxFuture<'static, io::Result<ProxyHttpStream>>,
}

impl Future for Connecting {
    type Output = io::Result<ProxyHttpStream>;

    fn poll(self: Pin<&mut Self>, cx: &mut task::Context<'_>) -> Poll<Self::Output> {
        self.project().fut.poll(cx)
    }
}


text:
package org.apache.ecs.vxml;

/**
    This class implements the initial element

    @author Written by Carol Jones
*/
public class Initial extends VXMLElement
{

    /**
	Basic constructor. You need to set the attributes using the
	set* methods.
    */
    public Initial()
    {
	super("initial");
    }

    /**
	This constructor creates a <initial> tag.
	@param name the name="" attribute
	@param expr the expr="" attribute
	@param cond the cond="" attribute
    */
    public Initial(String name, String expr, String cond)
    {
	this();
	setName(name);
	setExpr(expr);
	setCond(cond);
    }

    /**
	This constructor creates a <initial> tag.
	@param name the name="" attribute
    */
    public Initial(String name)
    {
	this();
	setName(name);
    }

    /**
	Sets the name="" attribute
	@param name the name="" attribute
    */
    public Initial setName(String name)
    {
	addAttribute("name", name);
	return this;
    }

    /**
	Sets the expr="" attribute
	@param expr the expr="" attribute
    */
    public Initial setExpr(String expr)
    {
	addAttribute("expr", expr);
	return this;
    }

    /**
	Sets the cond="" attribute
	@param cond the cond="" attribute
    */
    public Initial setCond(String cond)
    {
	addAttribute("cond", cond);
	return this;
    }

}


text:
from connector import channel
from google3.cloud.graphite.mmv2.services.google.cloud_scheduler import job_pb2
from google3.cloud.graphite.mmv2.services.google.cloud_scheduler import job_pb2_grpc

from typing import List

class Job(object):
    def __init__(
        self,
        name: str = None,
        description: str = None,
        pubsub_target: dict = None,
        app_engine_http_target: dict = None,
        http_target: dict = None,
        schedule: str = None,
        time_zone: str = None,
        user_update_time: str = None,
        state: str = None,
        status: dict = None,
        schedule_time: str = None,
        last_attempt_time: str = None,
        retry_config: dict = None,
        attempt_deadline: str = None,
        project: str = None,
        location: str = None,
        service_account_file: str = "",
    ):

        channel.initialize()
        self.name = name
        self.description = description
        self.pubsub_target = pubsub_target
        self.app_engine_http_target = app_engine_http_target
        self.http_target = http_target
        self.schedule = schedule
        self.time_zone = time_zone
        self.retry_config = retry_config
        self.attempt_deadline = attempt_deadline
        self.project = project
        self.location = location
        self.service_account_file = service_account_file

    def apply(self):
        stub = job_pb2_grpc.CloudschedulerJobServiceStub(channel.Channel())
        request = job_pb2.ApplyCloudschedulerJobRequest()
        if Primitive.to_proto(self.name):
            request.resource.name = Primitive.to_proto(self.name)

        if Primitive.to_proto(self.description):
            request.resource.description = Primitive.to_proto(self.description)

        if JobPubsubTarget.to_proto(self.pubsub_target):
            request.resource.pubsub_target.CopyFrom(
                JobPubsubTarget.to_proto(self.pubsub_target)
            )
        else:
            request.resource.ClearField("pubsub_target")
        if JobAppEngineHttpTarget.to_proto(self.app_engine_http_target):
            request.resource.app_engine_http_target.CopyFrom(
                JobAppEngineHttpTarget.to_proto(self.app_engine_http_target)
            )
        else:
            request.resource.ClearField("app_engine_http_target")
        if JobHttpTarget.to_proto(self.http_target):
            request.resource.http_target.CopyFrom(
                JobHttpTarget.to_proto(self.http_target)
            )
        else:
            request.resource.ClearField("http_target")
        if Primitive.to_proto(self.schedule):
            request.resource.schedule = Primitive.to_proto(self.schedule)

        if Primitive.to_proto(self.time_zone):
            request.resource.time_zone = Primitive.to_proto(self.time_zone)

        if JobRetryConfig.to_proto(self.retry_config):
            request.resource.retry_config.CopyFrom(
                JobRetryConfig.to_proto(self.retry_config)
            )
        else:
            request.resource.ClearField("retry_config")
        if Primitive.to_proto(self.attempt_deadline):
            request.resource.attempt_deadline = Primitive.to_proto(
                self.attempt_deadline
            )

        if Primitive.to_proto(self.project):
            request.resource.project = Primitive.to_proto(self.project)

        if Primitive.to_proto(self.location):
            request.resource.location = Primitive.to_proto(self.location)

        request.service_account_file = self.service_account_file

        response = stub.ApplyCloudschedulerJob(request)
        self.name = Primitive.from_proto(response.name)
        self.description = Primitive.from_proto(response.description)
        self.pubsub_target = JobPubsubTarget.from_proto(response.pubsub_target)
        self.app_engine_http_target = JobAppEngineHttpTarget.from_proto(
            response.app_engine_http_target
        )
        self.http_target = JobHttpTarget.from_proto(response.http_target)
        self.schedule = Primitive.from_proto(response.schedule)
        self.time_zone = Primitive.from_proto(response.time_zone)
        self.user_update_time = Primitive.from_proto(response.user_update_time)
        self.state = JobStateEnum.from_proto(response.state)
        self.status = JobStatus.from_proto(response.status)
        self.schedule_time = Primitive.from_proto(response.schedule_time)
        self.last_attempt_time = Primitive.from_proto(response.last_attempt_time)
        self.retry_config = JobRetryConfig.from_proto(response.retry_config)
        self.attempt_deadline = Primitive.from_proto(response.attempt_deadline)
        self.project = Primitive.from_proto(response.project)
        self.location = Primitive.from_proto(response.location)

    def delete(self):
        stub = job_pb2_grpc.CloudschedulerJobServiceStub(channel.Channel())
        request = job_pb2.DeleteCloudschedulerJobRequest()
        request.service_account_file = self.service_account_file
        if Primitive.to_proto(self.name):
            request.resource.name = Primitive.to_proto(self.name)

        if Primitive.to_proto(self.description):
            request.resource.description = Primitive.to_proto(self.description)

        if JobPubsubTarget.to_proto(self.pubsub_target):
            request.resource.pubsub_target.CopyFrom(
                JobPubsubTarget.to_proto(self.pubsub_target)
            )
        else:
            request.resource.ClearField("pubsub_target")
        if JobAppEngineHttpTarget.to_proto(self.app_engine_http_target):
            request.resource.app_engine_http_target.CopyFrom(
                JobAppEngineHttpTarget.to_proto(self.app_engine_http_target)
            )
        else:
            request.resource.ClearField("app_engine_http_target")
        if JobHttpTarget.to_proto(self.http_target):
            request.resource.http_target.CopyFrom(
                JobHttpTarget.to_proto(self.http_target)
            )
        else:
            request.resource.ClearField("http_target")
        if Primitive.to_proto(self.schedule):
            request.resource.schedule = Primitive.to_proto(self.schedule)

        if Primitive.to_proto(self.time_zone):
            request.resource.time_zone = Primitive.to_proto(self.time_zone)

        if JobRetryConfig.to_proto(self.retry_config):
            request.resource.retry_config.CopyFrom(
                JobRetryConfig.to_proto(self.retry_config)
            )
        else:
            request.resource.ClearField("retry_config")
        if Primitive.to_proto(self.attempt_deadline):
            request.resource.attempt_deadline = Primitive.to_proto(
                self.attempt_deadline
            )

        if Primitive.to_proto(self.project):
            request.resource.project = Primitive.to_proto(self.project)

        if Primitive.to_proto(self.location):
            request.resource.location = Primitive.to_proto(self.location)

        response = stub.DeleteCloudschedulerJob(request)

    @classmethod
    def list(self, project, location, service_account_file=""):
        stub = job_pb2_grpc.CloudschedulerJobServiceStub(channel.Channel())
        request = job_pb2.ListCloudschedulerJobRequest()
        request.service_account_file = service_account_file
        request.Project = project

        request.Location = location

        return stub.ListCloudschedulerJob(request).items

    def to_proto(self):
        resource = job_pb2.CloudschedulerJob()
        if Primitive.to_proto(self.name):
            resource.name = Primitive.to_proto(self.name)
        if Primitive.to_proto(self.description):
            resource.description = Primitive.to_proto(self.description)
        if JobPubsubTarget.to_proto(self.pubsub_target):
            resource.pubsub_target.CopyFrom(
                JobPubsubTarget.to_proto(self.pubsub_target)
            )
        else:
            resource.ClearField("pubsub_target")
        if JobAppEngineHttpTarget.to_proto(self.app_engine_http_target):
            resource.app_engine_http_target.CopyFrom(
                JobAppEngineHttpTarget.to_proto(self.app_engine_http_target)
            )
        else:
            resource.ClearField("app_engine_http_target")
        if JobHttpTarget.to_proto(self.http_target):
            resource.http_target.CopyFrom(JobHttpTarget.to_proto(self.http_target))
        else:
            resource.ClearField("http_target")
        if Primitive.to_proto(self.schedule):
            resource.schedule = Primitive.to_proto(self.schedule)
        if Primitive.to_proto(self.time_zone):
            resource.time_zone = Primitive.to_proto(self.time_zone)
        if JobRetryConfig.to_proto(self.retry_config):
            resource.retry_config.CopyFrom(JobRetryConfig.to_proto(self.retry_config))
        else:
            resource.ClearField("retry_config")
        if Primitive.to_proto(self.attempt_deadline):
            resource.attempt_deadline = Primitive.to_proto(self.attempt_deadline)
        if Primitive.to_proto(self.project):
            resource.project = Primitive.to_proto(self.project)
        if Primitive.to_proto(self.location):
            resource.location = Primitive.to_proto(self.location)
        return resource

class JobPubsubTarget(object):
    def __init__(
        self, topic_name: str = None, data: str = None, attributes: dict = None
    ):
        self.topic_name = topic_name
        self.data = data
        self.attributes = attributes

    @classmethod
    def to_proto(self, resource):
        if not resource:
            return None

        res = job_pb2.CloudschedulerJobPubsubTarget()
        if Primitive.to_proto(resource.topic_name):
            res.topic_name = Primitive.to_proto(resource.topic_name)
        if Primitive.to_proto(resource.data):
            res.data = Primitive.to_proto(resource.data)
        if Primitive.to_proto(resource.attributes):
            res.attributes = Primitive.to_proto(resource.attributes)
        return res

    @classmethod
    def from_proto(self, resource):
        if not resource:
            return None

        return JobPubsubTarget(
            topic_name=Primitive.from_proto(resource.topic_name),
            data=Primitive.from_proto(resource.data),
            attributes=Primitive.from_proto(resource.attributes),
        )

class JobPubsubTargetArray(object):
    @classmethod
    def to_proto(self, resources):
        if not resources:
            return resources
        return [JobPubsubTarget.to_proto(i) for i in resources]

    @classmethod
    def from_proto(self, resources):
        return [JobPubsubTarget.from_proto(i) for i in resources]

class JobAppEngineHttpTarget(object):
    def __init__(
        self,
        http_method: str = None,
        app_engine_routing: dict = None,
        relative_uri: str = None,
        headers: dict = None,
        body: str = None,
    ):
        self.http_method = http_method
        self.app_engine_routing = app_engine_routing
        self.relative_uri = relative_uri
        self.headers = headers
        self.body = body

    @classmethod
    def to_proto(self, resource):
        if not resource:
            return None

        res = job_pb2.CloudschedulerJobAppEngineHttpTarget()
        if JobAppEngineHttpTargetHttpMethodEnum.to_proto(resource.http_method):
            res.http_method = JobAppEngineHttpTargetHttpMethodEnum.to_proto(
                resource.http_method
            )
        if JobAppEngineHttpTargetAppEngineRouting.to_proto(resource.app_engine_routing):
            res.app_engine_routing.CopyFrom(
                JobAppEngineHttpTargetAppEngineRouting.to_proto(
                    resource.app_engine_routing
                )
            )
        else:
            res.ClearField("app_engine_routing")
        if Primitive.to_proto(resource.relative_uri):
            res.relative_uri = Primitive.to_proto(resource.relative_uri)
        if Primitive.to_proto(resource.headers):
            res.headers = Primitive.to_proto(resource.headers)
        if Primitive.to_proto(resource.body):
            res.body = Primitive.to_proto(resource.body)
        return res

    @classmethod
    def from_proto(self, resource):
        if not resource:
            return None

        return JobAppEngineHttpTarget(
            http_method=JobAppEngineHttpTargetHttpMethodEnum.from_proto(
                resource.http_method
            ),
            app_engine_routing=JobAppEngineHttpTargetAppEngineRouting.from_proto(
                resource.app_engine_routing
            ),
            relative_uri=Primitive.from_proto(resource.relative_uri),
            headers=Primitive.from_proto(resource.headers),
            body=Primitive.from_proto(resource.body),
        )

class JobAppEngineHttpTargetArray(object):
    @classmethod
    def to_proto(self, resources):
        if not resources:
            return resources
        return [JobAppEngineHttpTarget.to_proto(i) for i in resources]

    @classmethod
    def from_proto(self, resources):
        return [JobAppEngineHttpTarget.from_proto(i) for i in resources]

class JobAppEngineHttpTargetAppEngineRouting(object):
    def __init__(
        self,
        service: str = None,
        version: str = None,
        instance: str = None,
        host: str = None,
    ):
        self.service = service
        self.version = version
        self.instance = instance
        self.host = host

    @classmethod
    def to_proto(self, resource):
        if not resource:
            return None

        res = job_pb2.CloudschedulerJobAppEngineHttpTargetAppEngineRouting()
        if Primitive.to_proto(resource.service):
            res.service = Primitive.to_proto(resource.service)
        if Primitive.to_proto(resource.version):
            res.version = Primitive.to_proto(resource.version)
        if Primitive.to_proto(resource.instance):
            res.instance = Primitive.to_proto(resource.instance)
        if Primitive.to_proto(resource.host):
            res.host = Primitive.to_proto(resource.host)
        return res

    @classmethod
    def from_proto(self, resource):
        if not resource:
            return None

        return JobAppEngineHttpTargetAppEngineRouting(
            service=Primitive.from_proto(resource.service),
            version=Primitive.from_proto(resource.version),
            instance=Primitive.from_proto(resource.instance),
            host=Primitive.from_proto(resource.host),
        )

class JobAppEngineHttpTargetAppEngineRoutingArray(object):
    @classmethod
    def to_proto(self, resources):
        if not resources:
            return resources
        return [JobAppEngineHttpTargetAppEngineRouting.to_proto(i) for i in resources]

    @classmethod
    def from_proto(self, resources):
        return [JobAppEngineHttpTargetAppEngineRouting.from_proto(i) for i in resources]

class JobHttpTarget(object):
    def __init__(
        self,
        uri: str = None,
        http_method: str = None,
        headers: dict = None,
        body: str = None,
        oauth_token: dict = None,
        oidc_token: dict = None,
    ):
        self.uri = uri
        self.http_method = http_method
        self.headers = headers
        self.body = body
        self.oauth_token = oauth_token
        self.oidc_token = oidc_token

    @classmethod
    def to_proto(self, resource):
        if not resource:
            return None

        res = job_pb2.CloudschedulerJobHttpTarget()
        if Primitive.to_proto(resource.uri):
            res.uri = Primitive.to_proto(resource.uri)
        if JobHttpTargetHttpMethodEnum.to_proto(resource.http_method):
            res.http_method = JobHttpTargetHttpMethodEnum.to_proto(resource.http_method)
        if Primitive.to_proto(resource.headers):
            res.headers = Primitive.to_proto(resource.headers)
        if Primitive.to_proto(resource.body):
            res.body = Primitive.to_proto(resource.body)
        if JobHttpTargetOAuthToken.to_proto(resource.oauth_token):
            res.oauth_token.CopyFrom(
                JobHttpTargetOAuthToken.to_proto(resource.oauth_token)
            )
        else:
            res.ClearField("oauth_token")
        if JobHttpTargetOidcToken.to_proto(resource.oidc_token):
            res.oidc_token.CopyFrom(
                JobHttpTargetOidcToken.to_proto(resource.oidc_token)
            )
        else:
            res.ClearField("oidc_token")
        return res

    @classmethod
    def from_proto(self, resource):
        if not resource:
            return None

        return JobHttpTarget(
            uri=Primitive.from_proto(resource.uri),
            http_method=JobHttpTargetHttpMethodEnum.from_proto(resource.http_method),
            headers=Primitive.from_proto(resource.headers),
            body=Primitive.from_proto(resource.body),
            oauth_token=JobHttpTargetOAuthToken.from_proto(resource.oauth_token),
            oidc_token=JobHttpTargetOidcToken.from_proto(resource.oidc_token),
        )

class JobHttpTargetArray(object):
    @classmethod
    def to_proto(self, resources):
        if not resources:
            return resources
        return [JobHttpTarget.to_proto(i) for i in resources]

    @classmethod
    def from_proto(self, resources):
        return [JobHttpTarget.from_proto(i) for i in resources]

class JobHttpTargetOAuthToken(object):
    def __init__(self, service_account_email: str = None, scope: str = None):
        self.service_account_email = service_account_email
        self.scope = scope

    @classmethod
    def to_proto(self, resource):
        if not resource:
            return None

        res = job_pb2.CloudschedulerJobHttpTargetOAuthToken()
        if Primitive.to_proto(resource.service_account_email):
            res.service_account_email = Primitive.to_proto(
                resource.service_account_email
            )
        if Primitive.to_proto(resource.scope):
            res.scope = Primitive.to_proto(resource.scope)
        return res

    @classmethod
    def from_proto(self, resource):
        if not resource:
            return None

        return JobHttpTargetOAuthToken(
            service_account_email=Primitive.from_proto(resource.service_account_email),
            scope=Primitive.from_proto(resource.scope),
        )

class JobHttpTargetOAuthTokenArray(object):
    @classmethod
    def to_proto(self, resources):
        if not resources:
            return resources
        return [JobHttpTargetOAuthToken.to_proto(i) for i in resources]

    @classmethod
    def from_proto(self, resources):
        return [JobHttpTargetOAuthToken.from_proto(i) for i in resources]

class JobHttpTargetOidcToken(object):
    def __init__(self, service_account_email: str = None, audience: str = None):
        self.service_account_email = service_account_email
        self.audience = audience

    @classmethod
    def to_proto(self, resource):
        if not resource:
            return None

        res = job_pb2.CloudschedulerJobHttpTargetOidcToken()
        if Primitive.to_proto(resource.service_account_email):
            res.service_account_email = Primitive.to_proto(
                resource.service_account_email
            )
        if Primitive.to_proto(resource.audience):
            res.audience = Primitive.to_proto(resource.audience)
        return res

    @classmethod
    def from_proto(self, resource):
        if not resource:
            return None

        return JobHttpTargetOidcToken(
            service_account_email=Primitive.from_proto(resource.service_account_email),
            audience=Primitive.from_proto(resource.audience),
        )

class JobHttpTargetOidcTokenArray(object):
    @classmethod
    def to_proto(self, resources):
        if not resources:
            return resources
        return [JobHttpTargetOidcToken.to_proto(i) for i in resources]

    @classmethod
    def from_proto(self, resources):
        return [JobHttpTargetOidcToken.from_proto(i) for i in resources]

class JobStatus(object):
    def __init__(self, code: int = None, message: str = None, details: list = None):
        self.code = code
        self.message = message
        self.details = details

    @classmethod
    def to_proto(self, resource):
        if not resource:
            return None

        res = job_pb2.CloudschedulerJobStatus()
        if Primitive.to_proto(resource.code):
            res.code = Primitive.to_proto(resource.code)
        if Primitive.to_proto(resource.message):
            res.message = Primitive.to_proto(resource.message)
        if JobStatusDetailsArray.to_proto(resource.details):
            res.details.extend(JobStatusDetailsArray.to_proto(resource.details))
        return res

    @classmethod
    def from_proto(self, resource):
        if not resource:
            return None

        return JobStatus(
            code=Primitive.from_proto(resource.code),
            message=Primitive.from_proto(resource.message),
            details=JobStatusDetailsArray.from_proto(resource.details),
        )

class JobStatusArray(object):
    @classmethod
    def to_proto(self, resources):
        if not resources:
            return resources
        return [JobStatus.to_proto(i) for i in resources]

    @classmethod
    def from_proto(self, resources):
        return [JobStatus.from_proto(i) for i in resources]

class JobStatusDetails(object):
    def __init__(self, type_url: str = None, value: str = None):
        self.type_url = type_url
        self.value = value

    @classmethod
    def to_proto(self, resource):
        if not resource:
            return None

        res = job_pb2.CloudschedulerJobStatusDetails()
        if Primitive.to_proto(resource.type_url):
            res.type_url = Primitive.to_proto(resource.type_url)
        if Primitive.to_proto(resource.value):
            res.value = Primitive.to_proto(resource.value)
        return res

    @classmethod
    def from_proto(self, resource):
        if not resource:
            return None

        return JobStatusDetails(
            type_url=Primitive.from_proto(resource.type_url),
            value=Primitive.from_proto(resource.value),
        )

class JobStatusDetailsArray(object):
    @classmethod
    def to_proto(self, resources):
        if not resources:
            return resources
        return [JobStatusDetails.to_proto(i) for i in resources]

    @classmethod
    def from_proto(self, resources):
        return [JobStatusDetails.from_proto(i) for i in resources]

class JobRetryConfig(object):
    def __init__(
        self,
        retry_count: int = None,
        max_retry_duration: str = None,
        min_backoff_duration: str = None,
        max_backoff_duration: str = None,
        max_doublings: int = None,
    ):
        self.retry_count = retry_count
        self.max_retry_duration = max_retry_duration
        self.min_backoff_duration = min_backoff_duration
        self.max_backoff_duration = max_backoff_duration
        self.max_doublings = max_doublings

    @classmethod
    def to_proto(self, resource):
        if not resource:
            return None

        res = job_pb2.CloudschedulerJobRetryConfig()
        if Primitive.to_proto(resource.retry_count):
            res.retry_count = Primitive.to_proto(resource.retry_count)
        if Primitive.to_proto(resource.max_retry_duration):
            res.max_retry_duration = Primitive.to_proto(resource.max_retry_duration)
        if Primitive.to_proto(resource.min_backoff_duration):
            res.min_backoff_duration = Primitive.to_proto(resource.min_backoff_duration)
        if Primitive.to_proto(resource.max_backoff_duration):
            res.max_backoff_duration = Primitive.to_proto(resource.max_backoff_duration)
        if Primitive.to_proto(resource.max_doublings):
            res.max_doublings = Primitive.to_proto(resource.max_doublings)
        return res

    @classmethod
    def from_proto(self, resource):
        if not resource:
            return None

        return JobRetryConfig(
            retry_count=Primitive.from_proto(resource.retry_count),
            max_retry_duration=Primitive.from_proto(resource.max_retry_duration),
            min_backoff_duration=Primitive.from_proto(resource.min_backoff_duration),
            max_backoff_duration=Primitive.from_proto(resource.max_backoff_duration),
            max_doublings=Primitive.from_proto(resource.max_doublings),
        )

class JobRetryConfigArray(object):
    @classmethod
    def to_proto(self, resources):
        if not resources:
            return resources
        return [JobRetryConfig.to_proto(i) for i in resources]

    @classmethod
    def from_proto(self, resources):
        return [JobRetryConfig.from_proto(i) for i in resources]

class JobAppEngineHttpTargetHttpMethodEnum(object):
    @classmethod
    def to_proto(self, resource):
        if not resource:
            return resource
        return job_pb2.CloudschedulerJobAppEngineHttpTargetHttpMethodEnum.Value(
            "CloudschedulerJobAppEngineHttpTargetHttpMethodEnum%s" % resource
        )

    @classmethod
    def from_proto(self, resource):
        if not resource:
            return resource
        return job_pb2.CloudschedulerJobAppEngineHttpTargetHttpMethodEnum.Name(
            resource
        )[len("CloudschedulerJobAppEngineHttpTargetHttpMethodEnum") :]

class JobHttpTargetHttpMethodEnum(object):
    @classmethod
    def to_proto(self, resource):
        if not resource:
            return resource
        return job_pb2.CloudschedulerJobHttpTargetHttpMethodEnum.Value(
            "CloudschedulerJobHttpTargetHttpMethodEnum%s" % resource
        )

    @classmethod
    def from_proto(self, resource):
        if not resource:
            return resource
        return job_pb2.CloudschedulerJobHttpTargetHttpMethodEnum.Name(resource)[
            len("CloudschedulerJobHttpTargetHttpMethodEnum") :
        ]

class JobStateEnum(object):
    @classmethod
    def to_proto(self, resource):
        if not resource:
            return resource
        return job_pb2.CloudschedulerJobStateEnum.Value(
            "CloudschedulerJobStateEnum%s" % resource
        )

    @classmethod
    def from_proto(self, resource):
        if not resource:
            return resource
        return job_pb2.CloudschedulerJobStateEnum.Name(resource)[
            len("CloudschedulerJobStateEnum") :
        ]

class Primitive(object):
    @classmethod
    def to_proto(self, s):
        if not s:
            return ""
        return s

    @classmethod
    def from_proto(self, s):
        return s