text:
      .386p
      locals
      jumps
      .model flat,STDCALL

      UNICODE=0

	INCLUDE useful.inc

        .data

banner	db	'iDEF creates DEF file for given PE file with exports.',CRLF
	db	'Usage: iDEF <PEfile.ext> [OutputFile]',CRLF
	db	'If no OutputFile is given PEfile.DEF is created.',0

error_string1	db 'Cannot find/open/map module!',CRLF,0
error_string2   db 'Module is not 32bit or exports nothing!',CRLF,0
tmpl8           db '%s_ORD_%.4X @%d NONAME',0

buffer1:

params  db	104h dup(0)
dmpname db	0EFCh dup(0)

        .code
Start:
	 mov	 ebp,offset banner
	 callx	 GetCommandLineA
	 mov	 esi,eax

	 mov	 edi, offset params
	 call	 get_params		; get first parameter
	 call	 get_params		; get second parameter
	 jz	 __epilogue

	 mov     ebp, offset error_string1
	 push    0			; iReadWrite
	 push    edi			; lpPathName
	 callx   _lopen

	 mov     esi, eax
	 sub     edi, edi
	 inc     eax

	 jz	 __epilogue

	 push	 edi			; lpFileSizeHigh
	 push	 esi			; file handle
	 callx	 GetFileSize

	 mov     dwo [banner], eax	; save size

	 push    edi			; lpName
	 push    edi			; dwMaximumSizeLow
	 push    edi			; dwMaximumSizeHigh
	 push    2			; flProtect
	 push    edi			; lpFileMappingAttributes
	 push    esi			; hFile
	 callx   CreateFileMappingA

	 mov	 ebx,eax		; move handle to ebx

	 push	 esi
	 callx	 CloseHandle

	 test	 ebx,ebx
	 jz	 __epilogue

	 push    ebx			; hObject
	 push    edi			; dwNumberOfBytesToMap
	 push    edi			; dwFileOffsetLow
	 push    edi			; dwFileOffsetHigh
	 push    4			; dwDesiredAccess
	 push    ebx			; hFileMappingObject
	 callx   MapViewOfFile
 	 sub     ecx, ecx		; ecx = 0
	 mov     ebx, eax		; move handle to ebx

	 test    eax, eax
	 jz      _epilogue		; eax points to the start of the image

	 push    offset __exception_handler
	 push    dword ptr fs:[ecx]
         mov     fs:[ecx], esp		;go to __exception_handler when an exception occurs

	 mov     esi, [ebx+3Ch]		; esi points to 'PE' address
	 mov     ebp, offset error_string2
	 cmp     word ptr [esi+ebx+18h], 10Bh ;points to magic optional header
	 jnz     epilogue		; abort if not a PE file

	 mov     edx, [ebx+esi+78h]	; points to export section RVA,it'll jump if pefile has no
	 test    edx, edx		; exports whatsoever
	 jz      epilogue

	 push    edx
	 call    resolveRVAddress
	 cmp     dword ptr [eax+14h], 0
	 jz      epilogue

         push    eax
	 push    50000h			; uBytes
	 push    40h			; uFlags
	 callx   LocalAlloc		; get some memory for our playground
	 test    eax, eax
	 pop     ecx
	 jz      epilogue

	 mov     edi, eax
	 mov     dword ptr ds:banner+4, eax
	 mov     ebp, ecx
	 mov     eax, 'EMAN'		;NAME
	 stosd
	 mov     al, 20h		; add space to the tail
	 stosb

	 push    dword ptr [ebp+0Ch]
	 call    resolveRVAddress

	 xchg    eax, ecx
	 sub     edx, edx
	 mov     esi, offset buffer1

copy_pe_name:

	 mov     al, [ecx]
	 test    al, al
	 jz      short create_heading
	 inc     ecx
	 stosb
	 test    edx, edx
	 jnz     short copy_pe_name
	 cmp     al, '.'
	 jz      short period
	 cmp     al, 'a'
	 jb      short jmps
	 cmp     al, 'z'
	 ja      short jmps
	 and     al, '¯'

jmps:
	 mov     [esi], al
	 inc     esi
	 jmp     short copy_pe_name
; ---------------------------------------------------------------------------

period:
	 mov     byte ptr [esi], 0
	 inc     edx
	 jmp     short copy_pe_name
; ---------------------------------------------------------------------------

create_heading:
	 mov     eax, 58450A0Dh		;0a,0d,'EX'
	 mov     esi, [ebp+10h]
	 stosd
	 mov     eax, 'TROP'
	 dec     esi
	 stosd
	 mov     al, 'S'
	 stosb

pex_exports_loop:

	 inc     esi
	 mov     ecx, esi

	 sub     eax, eax
	 sub     ecx, [ebp+16]
	 jl      short cont2

	 cmp     ecx, [ebp+20]
	 jnb     short cont3

	 push    dword ptr [ebp+28]
	 call    resolveRVAddress

	 mov     eax, [eax+ecx*4]

cont2:
	 test    eax, eax
	 jz      short pex_exports_loop

	 mov     ax, 0A0Dh
	 stosw

	 push    dword ptr [ebp+24h]
	 call    resolveRVAddress
	 sub     edx, edx

while_cx_nz:
	 cmp     edx, [ebp+18h]		; checking if export has ordinals
	 jnb     short ordinals_true
	 cmp     cx, [eax]
	 jz      short cx_zero
	 inc     edx
	 inc     eax
	 inc     eax
	 jmp     short while_cx_nz	; checking if export has ordinals
; ---------------------------------------------------------------------------

cx_zero:
	 push    dword ptr [ebp+20h]
	 call    resolveRVAddress

	 push    dword ptr [eax+edx*4]
	 call    resolveRVAddress
	 xchg    eax, ecx

pex_copyUntilz:
	 mov     al, [ecx]
	 test    al, al
	 jz      short pex_exports_loop

	 inc     ecx
	 stosb
	 jmp     short pex_copyUntilz
; ---------------------------------------------------------------------------

ordinals_true:
	 push    esi
	 push    esi
	 push    offset buffer1
	 push    offset tmpl8		; "%s_ORD_%.4X @%d NONAME"
	 push    edi			; LPSTR
	 callx   _wsprintfA

	 add     esp, 14h
	 add     edi, eax
	 jmp     short pex_exports_loop
; ---------------------------------------------------------------------------

cont3:
	 mov     esi, offset dmpname
	 cmp     byte ptr [esi], 0
	 jnz     short createOutputFile

	 mov     esi, offset buffer1
	 push    esi			; lpString
	 callx   lstrlenA

	 mov     dword ptr [eax+esi], 'FED.'
	 mov     byte ptr [eax+esi+4], 0

createOutputFile:
	 push    0			; iAttribute
	 push    esi			; lpPathName
	 callx   _lcreat

	 mov     esi, eax
	 sub     edi, dword ptr ds:banner+4
	 push    edi			; uBytes
	 push    dword ptr [banner+4]	; lpBuffer
	 push    esi			; hFile
	 callx   _lwrite

	 push    esi			; hObject
	 callx   CloseHandle

	 push    dword ptr [banner+4]	; hMem
	 callx   LocalFree

	 mov     ebp, offset get_params ;mystery?!

epilogue:
	 pop	 dwo fs:0		;restore old exception handler
	 pop	 ecx
	 push	 ebx
	 callx	 UnmapViewOfFile

_epilogue:
	 callx	 CloseHandle

__epilogue:

	 push	 ebp
	 callx	 lstrlenA

	 push	 eax
	 push    ebp
	 push    0FFFFFFF5h      ; hFile
	 callx   _lwrite

	 callx	 GetLastError

	 push	 eax
	 callx	 ExitProcess

__exception_handler:

	 mov     ecx, [esp+8]
	 mov     edx, [esp+0Ch]
	 sub     eax, eax
	 mov     dword ptr [ecx+0B8h], offset epilogue
	 mov     [ecx+0C4h], edx
	 retn
;-----------------------------------------------------------
get_params:

	 push    edi
	 xor     eax, eax
	 mov     cl, '"'
	 mov     [edi], al
	 lodsb
	 test    al, al
	 jz      short parse_invalid
	 cmp     al, cl
	 jz      short cont1
	 dec     esi
	 mov     cl, ' '

cont1:

	 lodsb
	 stosb
	 test    al, al
	 jz      short parse_ok
	 cmp     al, cl
	 jnz     short cont1
	 mov     byte ptr [edi-1], 0

@loop:
	 lodsb
	 test    al, al
	 jz      short parse_ok
	 cmp     al, ' '
	 jbe     short @loop

parse_ok:

	 mov     al, 1
	 dec     esi

parse_invalid:
	 pop     edi
	 retn

;-----------------------------------------------------------
resolveRVAddress:

	push    ecx
	push    edx
	push    ebp
	push    esi
	push    edi
	push    ebx
	mov     edx, ebx		; edx points to mapped PE file
	mov     eax, [esp+1Ch]		; eax points to export table RVA,from arg0
	add     edx, [edx+3Ch]		; edx points to PE signature for mapped file
	movzx   ecx, word ptr [edx+6]	; get how many sections this pe file has
	dec     ecx			; decrement
	jl      short pex_exit0
	lea     ebx, [edx+248]		; goes to the first section name
	imul    ecx, 28h		; multiplies decremented section # with 0x28
	sub     edi, edi

getSectionRVA:
	mov     esi, [ecx+ebx+0Ch]	; gets the section's RVA starting from last?
	cmp     esi, eax		; test if its below or equal to arg0
	jbe     short pex_getsection

pex_checksection:

	sub     ecx, 28h
	jge     short getSectionRVA	; gets the section's RVA starting from last?

	test    edi, edi
	jnz     short pex_exit1

	cmp     [edx+54h], eax
	jbe     short pex_exit0

	jmp     short pex_exit2
; ---------------------------------------------------------------------------

pex_getsection:
	cmp     edi, esi
	ja      short pex_checksection

	mov     edi, esi
	mov     ebp, [ecx+ebx+14h]	; gets the sections pointer to raw data
	jmp     short pex_checksection
; ---------------------------------------------------------------------------

pex_exit1:
	sub     eax, edi
	add     eax, ebp

pex_exit2:
	add     eax, [esp]		;access the last data pushed in the stack w/c is ebx

pex_exit3:
	pop     ebx
	pop     edi
	pop     esi
	pop     ebp
	pop     edx
	pop     ecx
	retn    4
; ---------------------------------------------------------------------------

pex_exit0:

	sub     eax, eax
	jmp     short pex_exit3

End Start


text:
<?php

namespace Commands;

use Models\IBirthable;
use Models\Person;

class ListCommand extends Command
{

    public function execute()
    {
        $foodUnits = $this->getCity()->getFoodUnits();

        echo $foodUnits . ' units food' . PHP_EOL;
    }
}

redpajama_set_name: RedPajamaGithub


text:
try:
    from django.utils.deprecation import MiddlewareMixin
except ImportError:
    MiddlewareMixin = object

class RemoveEtagGzipPostfix(MiddlewareMixin):
    def process_response(self, request, response):
        if response.has_header('ETag') and response['ETag'][-6:] == ';gzip"':
            response['ETag'] = response['ETag'][:-6] + '"'
        return response


text:
package org.springframework.boot.actuate.endpoint;

import java.util.ArrayList;
import java.util.Collections;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.fasterxml.jackson.databind.BeanDescription;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.SerializationConfig;
import com.fasterxml.jackson.databind.SerializationFeature;
import com.fasterxml.jackson.databind.introspect.Annotated;
import com.fasterxml.jackson.databind.introspect.AnnotatedMethod;
import com.fasterxml.jackson.databind.introspect.JacksonAnnotationIntrospector;
import com.fasterxml.jackson.databind.ser.BeanPropertyWriter;
import com.fasterxml.jackson.databind.ser.BeanSerializerFactory;
import com.fasterxml.jackson.databind.ser.BeanSerializerModifier;
import com.fasterxml.jackson.databind.ser.PropertyWriter;
import com.fasterxml.jackson.databind.ser.SerializerFactory;
import com.fasterxml.jackson.databind.ser.impl.SimpleBeanPropertyFilter;
import com.fasterxml.jackson.databind.ser.impl.SimpleFilterProvider;

import org.springframework.beans.BeansException;
import org.springframework.boot.context.properties.ConfigurationBeanFactoryMetaData;
import org.springframework.boot.context.properties.ConfigurationProperties;
import org.springframework.context.ApplicationContext;
import org.springframework.context.ApplicationContextAware;
import org.springframework.util.ClassUtils;
import org.springframework.util.StringUtils;

/**
 * {@link Endpoint} to expose application properties from {@link ConfigurationProperties}
 * annotated beans.
 *
 * <p>
 * To protect sensitive information from being exposed, certain property values are masked
 * if their names end with a set of configurable values (default "password" and "secret").
 * Configure property names by using {@code endpoints.configprops.keys_to_sanitize} in
 * your Spring Boot application configuration.
 *
 * @author Christian Dupuis
 * @author Dave Syer
 */
@ConfigurationProperties(prefix = "endpoints.configprops")
public class ConfigurationPropertiesReportEndpoint
		extends AbstractEndpoint<Map<String, Object>> implements ApplicationContextAware {

	private static final String CGLIB_FILTER_ID = "cglibFilter";

	private final Sanitizer sanitizer = new Sanitizer();

	private ApplicationContext context;

	public ConfigurationPropertiesReportEndpoint() {
		super("configprops");
	}

	@Override
	public void setApplicationContext(ApplicationContext context) throws BeansException {
		this.context = context;
	}

	public void setKeysToSanitize(String... keysToSanitize) {
		this.sanitizer.setKeysToSanitize(keysToSanitize);
	}

	@Override
	public Map<String, Object> invoke() {
		return extract(this.context);
	}

	/**
	 * Extract beans annotated {@link ConfigurationProperties} and serialize into
	 * {@link Map}.
	 * @param context the application context
	 * @return the beans
	 */
	protected Map<String, Object> extract(ApplicationContext context) {
		// Serialize beans into map structure and sanitize values
		ObjectMapper mapper = new ObjectMapper();
		configureObjectMapper(mapper);
		return extract(context, mapper);
	}

	private Map<String, Object> extract(ApplicationContext context, ObjectMapper mapper) {
		Map<String, Object> result = new HashMap<String, Object>();
		ConfigurationBeanFactoryMetaData beanFactoryMetaData = getBeanFactoryMetaData(
				context);
		Map<String, Object> beans = getConfigurationPropertiesBeans(context,
				beanFactoryMetaData);
		for (Map.Entry<String, Object> entry : beans.entrySet()) {
			String beanName = entry.getKey();
			Object bean = entry.getValue();
			Map<String, Object> root = new HashMap<String, Object>();
			String prefix = extractPrefix(context, beanFactoryMetaData, beanName, bean);
			root.put("prefix", prefix);
			root.put("properties", sanitize(prefix, safeSerialize(mapper, bean, prefix)));
			result.put(beanName, root);
		}
		if (context.getParent() != null) {
			result.put("parent", extract(context.getParent(), mapper));
		}
		return result;
	}

	private ConfigurationBeanFactoryMetaData getBeanFactoryMetaData(
			ApplicationContext context) {
		Map<String, ConfigurationBeanFactoryMetaData> beans = context
				.getBeansOfType(ConfigurationBeanFactoryMetaData.class);
		if (beans.size() == 1) {
			return beans.values().iterator().next();
		}
		return null;
	}

	private Map<String, Object> getConfigurationPropertiesBeans(
			ApplicationContext context,
			ConfigurationBeanFactoryMetaData beanFactoryMetaData) {
		Map<String, Object> beans = new HashMap<String, Object>();
		beans.putAll(context.getBeansWithAnnotation(ConfigurationProperties.class));
		if (beanFactoryMetaData != null) {
			beans.putAll(beanFactoryMetaData
					.getBeansWithFactoryAnnotation(ConfigurationProperties.class));
		}
		return beans;
	}

	/**
	 * Cautiously serialize the bean to a map (returning a map with an error message
	 * instead of throwing an exception if there is a problem).
	 * @param mapper the object mapper
	 * @param bean the source bean
	 * @param prefix the prefix
	 * @return the serialized instance
	 */
	private Map<String, Object> safeSerialize(ObjectMapper mapper, Object bean,
			String prefix) {
		try {
			@SuppressWarnings("unchecked")
			Map<String, Object> result = new HashMap<String, Object>(
					mapper.convertValue(bean, Map.class));
			return result;
		}
		catch (Exception ex) {
			return new HashMap<String, Object>(Collections.<String, Object>singletonMap(
					"error", "Cannot serialize '" + prefix + "'"));
		}
	}

	/**
	 * Configure Jackson's {@link ObjectMapper} to be used to serialize the
	 * {@link ConfigurationProperties} objects into a {@link Map} structure.
	 * @param mapper the object mapper
	 */
	protected void configureObjectMapper(ObjectMapper mapper) {
		mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false);
		mapper.configure(SerializationFeature.WRITE_NULL_MAP_VALUES, false);
		applyCglibFilters(mapper);
		applySerializationModifier(mapper);
	}

	/**
	 * Ensure only bindable and non-cyclic bean properties are reported.
	 * @param mapper the object mapper
	 */
	private void applySerializationModifier(ObjectMapper mapper) {
		SerializerFactory factory = BeanSerializerFactory.instance
				.withSerializerModifier(new GenericSerializerModifier());
		mapper.setSerializerFactory(factory);
	}

	/**
	 * Configure PropertyFilter to make sure Jackson doesn't process CGLIB generated bean
	 * properties.
	 * @param mapper the object mapper
	 */
	private void applyCglibFilters(ObjectMapper mapper) {
		mapper.setAnnotationIntrospector(new CglibAnnotationIntrospector());
		mapper.setFilterProvider(new SimpleFilterProvider().addFilter(CGLIB_FILTER_ID,
				new CglibBeanPropertyFilter()));
	}

	/**
	 * Extract configuration prefix from {@link ConfigurationProperties} annotation.
	 * @param context the application context
	 * @param beanFactoryMetaData the bean factory meta-data
	 * @param beanName the bean name
	 * @param bean the bean
	 * @return the prefix
	 */
	private String extractPrefix(ApplicationContext context,
			ConfigurationBeanFactoryMetaData beanFactoryMetaData, String beanName,
			Object bean) {
		ConfigurationProperties annotation = context.findAnnotationOnBean(beanName,
				ConfigurationProperties.class);
		if (beanFactoryMetaData != null) {
			ConfigurationProperties override = beanFactoryMetaData
					.findFactoryAnnotation(beanName, ConfigurationProperties.class);
			if (override != null) {
				// The @Bean-level @ConfigurationProperties overrides the one at type
				// level when binding. Arguably we should render them both, but this one
				// might be the most relevant for a starting point.
				annotation = override;
			}
		}
		return annotation.prefix();
	}

	/**
	 * Sanitize all unwanted configuration properties to avoid leaking of sensitive
	 * information.
	 * @param prefix the property prefix
	 * @param map the source map
	 * @return the sanitized map
	 */
	@SuppressWarnings("unchecked")
	private Map<String, Object> sanitize(String prefix, Map<String, Object> map) {
		for (Map.Entry<String, Object> entry : map.entrySet()) {
			String key = entry.getKey();
			String qualifiedKey = (prefix.length() == 0 ? prefix : prefix + ".") + key;
			Object value = entry.getValue();
			if (value instanceof Map) {
				map.put(key, sanitize(qualifiedKey, (Map<String, Object>) value));
			}
			else {
				value = this.sanitizer.sanitize(key, value);
				value = this.sanitizer.sanitize(qualifiedKey, value);
				map.put(key, value);
			}
		}
		return map;
	}

	/**
	 * Extension to {@link JacksonAnnotationIntrospector} to suppress CGLIB generated bean
	 * properties.
	 */
	@SuppressWarnings("serial")
	private static class CglibAnnotationIntrospector
			extends JacksonAnnotationIntrospector {

		@Override
		public Object findFilterId(Annotated a) {
			Object id = super.findFilterId(a);
			if (id == null) {
				id = CGLIB_FILTER_ID;
			}
			return id;
		}

	}

	/**
	 * {@link SimpleBeanPropertyFilter} to filter out all bean properties whose names
	 * start with '$$'.
	 */
	private static class CglibBeanPropertyFilter extends SimpleBeanPropertyFilter {

		@Override
		protected boolean include(BeanPropertyWriter writer) {
			return include(writer.getFullName().getSimpleName());
		}

		@Override
		protected boolean include(PropertyWriter writer) {
			return include(writer.getFullName().getSimpleName());
		}

		private boolean include(String name) {
			return !name.startsWith("$$");
		}

	}

	/**
	 * {@link BeanSerializerModifier} to return only relevant configuration properties.
	 */
	protected static class GenericSerializerModifier extends BeanSerializerModifier {

		@Override
		public List<BeanPropertyWriter> changeProperties(SerializationConfig config,
				BeanDescription beanDesc, List<BeanPropertyWriter> beanProperties) {
			List<BeanPropertyWriter> result = new ArrayList<BeanPropertyWriter>();
			for (BeanPropertyWriter writer : beanProperties) {
				boolean readable = isReadable(beanDesc, writer);
				if (readable) {
					result.add(writer);
				}
			}
			return result;
		}

		private boolean isReadable(BeanDescription beanDesc, BeanPropertyWriter writer) {
			String parentType = beanDesc.getType().getRawClass().getName();
			String type = writer.getType().getTypeName();
			AnnotatedMethod setter = findSetter(beanDesc, writer);
			// If there's a setter, we assume it's OK to report on the value,
			// similarly, if there's no setter but the package names match, we assume
			// that its a nested class used solely for binding to config props, so it
			// should be kosher. This filter is not used if there is JSON metadata for
			// the property, so it's mainly for user-defined beans.
			return (setter != null) || ClassUtils.getPackageName(parentType)
					.equals(ClassUtils.getPackageName(type));
		}

		private AnnotatedMethod findSetter(BeanDescription beanDesc,
				BeanPropertyWriter writer) {
			String name = "set" + StringUtils.capitalize(writer.getName());
			Class<?> type = writer.getType().getRawClass();
			AnnotatedMethod setter = beanDesc.findMethod(name, new Class<?>[] { type });
			// The enabled property of endpoints returns a boolean primitive but is set
			// using a Boolean class
			if (setter == null && type.equals(Boolean.TYPE)) {
				setter = beanDesc.findMethod(name, new Class<?>[] { Boolean.class });
			}
			return setter;
		}
	}

}


text:
.. _contact:

Contact
=======

The website `geohealthcheck.org <http://geohealthcheck.org>`_ is the main entry point.

All development is done via GitHub: see https://github.com/geopython/geohealthcheck.

Links
-----

- website: http://geohealthcheck.org
- GitHub: https://github.com/geopython/geohealthcheck
- Demo: https://demo.geohealthcheck.org
- Presentation: http://geohealthcheck.org/presentation
- Gitter Chat: https://gitter.im/geopython/GeoHealthCheck


text:
"use strict";
var Client = require("../config/database").client;
var request = require('../utils/request');

module.exports = {
    /**
     * Sends a notification through the Google Cloud Messaging platform.
     */
    notificate: function (/**The template of the notification. */messageTemplate) {
        var notifications = [];
        Client.findAsync({})
            .then(function (list) {
                list.forEach(function (client) {
                    messageTemplate.to = client.token;
                    notifications.push(request.post(process.env.API_KEY, '', messageTemplate));
                });
                return notifications;
            })
            .all()
            .then(function () {
                console.log('Sent to ' + notifications.length + ' client(s)');
            })
            .catch(function (err) {
                throw err;
            });
    }
};


text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except
 * in compliance with the License. You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software distributed under the License
 * is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express
 * or implied. See the License for the specific language governing permissions and limitations under
 * the License.
 */
/*
 * This code was generated by https://github.com/googleapis/google-api-java-client-services/
 * Modify at your own risk.
 */

package com.google.api.services.slides.v1.model;

/**
 * A themeable solid color value.
 *
 *
 This is the Java data model class that specifies how to parse/serialize into the JSON that is
 * transmitted over HTTP when working with the Google Slides API. For a detailed explanation see:
 * https://developers.google.com/api-client-library/java/google-http-java-client/json
 *

 *
 * @author Google, Inc.
 */
@SuppressWarnings("javadoc")
public final class OpaqueColor extends com.google.api.client.json.GenericJson {

  /**
   * An opaque RGB color.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private RgbColor rgbColor;

  /**
   * An opaque theme color.
   * The value may be {@code null}.
   */
  @com.google.api.client.util.Key
  private java.lang.String themeColor;

  /**
   * An opaque RGB color.
   * @return value or {@code null} for none
   */
  public RgbColor getRgbColor() {
    return rgbColor;
  }

  /**
   * An opaque RGB color.
   * @param rgbColor rgbColor or {@code null} for none
   */
  public OpaqueColor setRgbColor(RgbColor rgbColor) {
    this.rgbColor = rgbColor;
    return this;
  }

  /**
   * An opaque theme color.
   * @return value or {@code null} for none
   */
  public java.lang.String getThemeColor() {
    return themeColor;
  }

  /**
   * An opaque theme color.
   * @param themeColor themeColor or {@code null} for none
   */
  public OpaqueColor setThemeColor(java.lang.String themeColor) {
    this.themeColor = themeColor;
    return this;
  }

  @Override
  public OpaqueColor set(String fieldName, Object value) {
    return (OpaqueColor) super.set(fieldName, value);
  }

  @Override
  public OpaqueColor clone() {
    return (OpaqueColor) super.clone();
  }

}


text:
// flowlint ambiguous-object-type:error

'use strict';

module.exports = {
  DEFAULT_HANDLE_KEY: '',
};


text:
import { IEntity } from '../../../core/services/storage/storage.service';

export enum LayerType {
	static = 'Static',
	annotation = 'Annotation',
	base = 'Base'
}

export type layerPluginType = string | layerPluginTypeEnum;

export const regionLayerId = 'region-layer';
export const regionLayerDefaultName = 'Region';

export enum layerPluginTypeEnum {
	ARCGIS = 'ARCGIS',
	OSM = 'OSM',
	geoJson = 'geoJson',
	Annotations = 'Annotations'
}

export enum LayerFileTypes {
	KML = 'KML',
	GEOJSON = 'GeoJSON'
}

export interface ILayer extends IEntity {
	url?: string;
	name: string;
	type: LayerType | string;
	layerPluginType: layerPluginType;
	data?: any;
	caseId?: string;
	extent?: [number, number, number, number];
	isNonEditable?: boolean;
}

export enum LayerSearchTypeEnum {
	mapView = 'mapView',
	polygonView = 'polygonView'
}


text:
package com.facebook.buck.skylark.function;

import com.facebook.buck.skylark.parser.context.ParseContext;
import com.google.common.collect.ImmutableList;
import com.google.devtools.build.lib.events.Event;
import com.google.devtools.build.lib.events.Location;
import com.google.devtools.build.lib.packages.Info;
import com.google.devtools.build.lib.skylarkinterface.Param;
import com.google.devtools.build.lib.skylarkinterface.SkylarkCallable;
import com.google.devtools.build.lib.skylarkinterface.SkylarkModule;
import com.google.devtools.build.lib.skylarkinterface.SkylarkModuleCategory;
import com.google.devtools.build.lib.syntax.Environment;
import com.google.devtools.build.lib.syntax.EvalException;
import com.google.devtools.build.lib.syntax.FuncallExpression;
import com.google.devtools.build.lib.syntax.SkylarkList;
import com.google.devtools.build.lib.syntax.SkylarkUtils;
import com.google.devtools.build.lib.syntax.Type;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.util.regex.Pattern;
import javax.annotation.Nullable;

/**
 * A class for the Skylark native module providing functions for parsing build files. It includes
 * all functions provided natively by Buck and are available using {@code native.foo} in build file
 * extensions and just {@code foo} in build files.
 */
@SkylarkModule(
    name = "native",
    namespace = true,
    category = SkylarkModuleCategory.BUILTIN,
    doc =
        "A built-in module providing native rules and other package helper functions. "
            + "All native rules appear as functions in this module, e.g. "
            + "native.cxx_library.")
public class SkylarkBuildModule extends AbstractSkylarkFunctions implements SkylarkFunctionModule {

  // Matches any of "**/", "*/**/" globs
  private static final Pattern TOP_LEVEL_GLOB_PATTERN = Pattern.compile("(\\*/)*\\*\\*/.*");

  @SkylarkCallable(
      name = "package_name",
      doc =
          "The name of the package being evaluated. "
              + "For example, in the build file some/package/BUCK, its value "
              + "will be some/package. "
              + "If the BUCK file calls a function defined in a .bzl file, "
              + "package_name() will match the caller BUCK file package. "
              + "This function is equivalent to the deprecated variable PACKAGE_NAME.",
      parameters = {},
      useAst = true,
      useEnvironment = true)
  public String packageName(FuncallExpression ast, Environment env) throws EvalException {
    SkylarkUtils.checkLoadingPhase(env, "native.package_name", ast.getLocation());
    ParseContext parseContext = ParseContext.getParseContext(env, ast);
    return parseContext
        .getPackageContext()
        .getPackageIdentifier()
        .getPackageFragment()
        .getPathString();
  }

  @SkylarkCallable(
      name = "repository_name",
      doc =
          "The name of the repository the rule or build extension is called from. "
              + "For example, in packages that are called into existence inside of the cell "
              + "foo it will return @foo. In packages in the main "
              + "repository (or standalone project), it will be set to @.",
      parameters = {},
      useLocation = true,
      useAst = true,
      useEnvironment = true)
  public String repositoryName(Location location, FuncallExpression ast, Environment env)
      throws EvalException {
    SkylarkUtils.checkLoadingPhase(env, "native.repository_name", location);
    ParseContext parseContext = ParseContext.getParseContext(env, ast);
    return parseContext.getPackageContext().getPackageIdentifier().getRepository().getName();
  }

  @SkylarkCallable(
      name = "rule_exists",
      doc =
          "Returns True if there is a previously defined rule with provided name, "
              + "or False if the rule with such name does not exist.",
      parameters = {@Param(name = "name", type = String.class, doc = "The name of the rule.")},
      useAst = true,
      useEnvironment = true)
  public Boolean ruleExists(String name, FuncallExpression ast, Environment env)
      throws EvalException {
    SkylarkUtils.checkLoadingOrWorkspacePhase(env, "native.rule_exists", ast.getLocation());
    ParseContext parseContext = ParseContext.getParseContext(env, ast);
    return parseContext.hasRule(name);
  }

  @SkylarkCallable(
      name = "glob",
      doc = "Returns a list of files that match glob search pattern.",
      parameters = {
        @Param(
            name = "include",
            type = SkylarkList.class,
            generic1 = String.class,
            named = true,
            doc = "a list of strings specifying patterns of files to include."),
        @Param(
            name = "exclude",
            type = SkylarkList.class,
            generic1 = String.class,
            defaultValue = "[]",
            positional = false,
            named = true,
            doc = "a list of strings specifying patterns of files to exclude."),
        @Param(
            name = "exclude_directories",
            type = Boolean.class,
            defaultValue = "True",
            positional = false,
            named = true,
            doc = "True indicates directories should not be matched."),
      },
      documented = false,
      useAst = true,
      useEnvironment = true)
  public SkylarkList<String> glob(
      SkylarkList<String> include,
      SkylarkList<String> exclude,
      Boolean excludeDirectories,
      FuncallExpression ast,
      Environment env)
      throws EvalException, IOException, InterruptedException {
    ParseContext parseContext = ParseContext.getParseContext(env, ast);
    if (include.isEmpty()) {
      parseContext
          .getPackageContext()
          .getEventHandler()
          .handle(
              Event.warn(
                  ast.getLocation(),
                  "glob's 'include' attribute is empty. "
                      + "Such calls are expensive and unnecessary. "
                      + "Please use an empty list ([]) instead."));
      return SkylarkList.MutableList.empty();
    }
    if (parseContext.getPackageContext().getPackageIdentifier().getRunfilesPath().isEmpty()
        && include.stream().anyMatch(str -> TOP_LEVEL_GLOB_PATTERN.matcher(str).matches())) {
      throw new EvalException(
          ast.getLocation(), "Recursive globs are prohibited at top-level directory");
    }

    try {
      return SkylarkList.MutableList.copyOf(
          env,
          parseContext.getPackageContext().getGlobber()
              .run(
                  Type.STRING_LIST.convert(include, "'glob' include"),
                  Type.STRING_LIST.convert(exclude, "'glob' exclude"),
                  excludeDirectories)
              .stream()
              .sorted()
              .collect(ImmutableList.toImmutableList()));
    } catch (FileNotFoundException e) {
      throw new EvalException(ast.getLocation(), "Cannot find " + e.getMessage());
    } catch (Exception e) {
      throw new EvalException.EvalExceptionWithJavaCause(ast.getLocation(), e);
    }
  }

  @SkylarkCallable(
      name = "host_info",
      doc =
          "The host_info() function is used to get processor and OS information about the host machine\n"
              + "The host_info() function is used to get the current OS and processor "
              + "architecture on the host. This will likely change as better cross compilation tooling "
              + "comes to Buck.\n"
              + "
\n"
              + "  struct(\n"
              + "      os=struct(\n"
              + "          is_linux=True|False,\n"
              + "          is_macos=True|False,\n"
              + "          is_windows=True|False,\n"
              + "          is_freebsd=True|False,\n"
              + "          is_unknown=True|False,\n"
              + "      ),\n"
              + "      arch=struct(\n"
              + "          is_aarch64=True|False,\n"
              + "          is_arm=True|False,\n"
              + "          is_armeb=True|False,\n"
              + "          is_i386=True|False,\n"
              + "          is_mips=True|False,\n"
              + "          is_mips64=True|False,\n"
              + "          is_mipsel=True|False,\n"
              + "          is_mipsel64=True|False,\n"
              + "          is_powerpc=True|False,\n"
              + "          is_ppc64=True|False,\n"
              + "          is_unknown=True|False,\n"
              + "          is_x86_64=True|False,\n"
              + "      ),\n"
              + "  )
\n",
      documented = true)
  public Info hostInfo() {
    return HostInfo.HOST_INFO;
  }

  @SkylarkCallable(
      name = "implicit_package_symbol",
      doc =
          "Gives access to a symbol that has been implicitly loaded for the package of the build "
              + "file that is currently being evaluated. If the symbol was not present, "
              + "`default` will be returned.",
      documented = true,
      useAst = true,
      useEnvironment = true,
      allowReturnNones = true,
      parameters = {
        @Param(
            name = "symbol",
            type = String.class,
            doc = "the symbol from implicitly loaded files to return."),
        @Param(
            name = "default",
            type = Object.class,
            defaultValue = "None",
            noneable = true,
            doc = "if no implicit symbol with the requested name exists, return this value."),
      })
  public @Nullable Object implicitPackageSymbol(
      String symbol, Object defaultValue, FuncallExpression ast, Environment env)
      throws EvalException {
    return ParseContext.getParseContext(env, ast)
        .getPackageContext()
        .getImplicitlyLoadedSymbols()
        .getOrDefault(symbol, defaultValue);
  }

  public static final SkylarkBuildModule BUILD_MODULE = new SkylarkBuildModule();
}


text:
// Copyright 2021 The Chromium Authors
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

import 'chrome://resources/mojo/mojo/public/js/mojo_bindings_lite.js';
import 'chrome://resources/mojo/mojo/public/mojom/base/big_buffer.mojom-lite.js';
import 'chrome://resources/mojo/mojo/public/mojom/base/string16.mojom-lite.js';
import '/file_path.mojom-lite.js';
import './firmware_shared_css.js';
import './firmware_shared_fonts.js';
import './mojom/firmware_update.mojom-lite.js';
import './strings.m.js';
import 'chrome://resources/cr_elements/cr_dialog/cr_dialog.js';
import 'chrome://resources/polymer/v3_0/paper-progress/paper-progress.js';

import {I18nBehavior, I18nBehaviorInterface} from 'chrome://resources/ash/common/i18n_behavior.js';
import {html, mixinBehaviors, PolymerElement} from 'chrome://resources/polymer/v3_0/polymer/polymer_bundled.min.js';

import {DialogContent, FirmwareUpdate, InstallationProgress, InstallControllerRemote, UpdateProgressObserverInterface, UpdateProgressObserverReceiver, UpdateProviderInterface, UpdateState} from './firmware_update_types.js';
import {getUpdateProvider} from './mojo_interface_provider.js';
import {mojoString16ToString} from './mojo_utils.js';

/** @type {!Array<!UpdateState>} */
const inactiveDialogStates = [UpdateState.kUnknown, UpdateState.kIdle];

/** @type {!DialogContent} */
const initialDialogContent = {
  title: '',
  body: '',
  footer: '',
};

/**
 * @fileoverview
 * 'firmware-update-dialog' displays information related to a firmware update.
 */

/**
 * @constructor
 * @extends {PolymerElement}
 * @implements {I18nBehaviorInterface}
 */
const FirmwareUpdateDialogElementBase =
    mixinBehaviors([I18nBehavior], PolymerElement);

/** @polymer */
export class FirmwareUpdateDialogElement extends
    FirmwareUpdateDialogElementBase {
  static get is() {
    return 'firmware-update-dialog';
  }

  static get template() {
    return html`{__html_template__}`;
  }

  static get properties() {
    return {
      /** @type {?FirmwareUpdate} */
      update: {
        type: Object,
      },

      /** @type {!InstallationProgress} */
      installationProgress: {
        type: Object,
        value: {percentage: 0, state: UpdateState.kIdle},
        observer: 'progressChanged_',
      },

      /** @private {boolean} */
      isInitiallyInflight_: {
        value: false,
      },

      /** @type {!DialogContent} */
      dialogContent: {
        type: Object,
        value: initialDialogContent,
        computed: 'computeDialogContent_(installationProgress.*,' +
            'isInitiallyInflight_)',
      },
    };
  }

  /** @override */
  constructor() {
    super();

    /** @private {!UpdateProviderInterface} */
    this.updateProvider_ = getUpdateProvider();

    /** @type {?InstallControllerRemote} */
    this.installController_ = null;

    /**
     * Event callback for 'open-update-dialog'.
     * @param {!Event} e
     * @private
     */
    this.openUpdateDialog_ = (e) => {
      this.update = e.detail.update;
      this.isInitiallyInflight_ = e.detail.inflight;
      this.prepareForUpdate_();
    };
  }

  /** @override */
  connectedCallback() {
    super.connectedCallback();

    window.addEventListener(
        'open-update-dialog', (e) => this.openUpdateDialog_(e));
  }

  /**
   * Implements UpdateProgressObserver.onStatusChanged
   * @param {!InstallationProgress} update
   */
  onStatusChanged(update) {
    if (update.state === UpdateState.kSuccess ||
        update.state === UpdateState.kFailed) {
      // Install is completed, reset inflight state.
      this.isInitiallyInflight_ = false;
    }
    this.installationProgress = update;
    if (this.isUpdateInProgress_() && this.isDialogOpen_()) {
      // 'aria-hidden' is used to prevent ChromeVox from announcing
      // the body text automatically. Setting 'aria-hidden' to false
      // here allows ChromeVox to announce the body text when a user
      // navigates to it.
      this.shadowRoot.querySelector('#updateDialogBody')
          .setAttribute('aria-hidden', 'false');
    }
  }

  /**
   * @param {!InstallationProgress} prevProgress
   * @param {?InstallationProgress} currProgress
   */
  progressChanged_(prevProgress, currProgress) {
    if (!currProgress || prevProgress.state == currProgress.state) {
      return;
    }
    // Focus the dialog title if the update state has changed.
    const dialogTitle = this.shadowRoot.querySelector('#updateDialogTitle');
    if (dialogTitle) {
      dialogTitle.focus();
    }
  }

  /** @protected */
  closeDialog_() {
    this.isInitiallyInflight_ = false;
    // Resetting |installationProgress| triggers a call to
    // |shouldShowUpdateDialog_|.
    this.installationProgress = {percentage: 0, state: UpdateState.kIdle};
    this.update = null;
  }

  /** @protected */
  async prepareForUpdate_() {
    const response =
        await this.updateProvider_.prepareForUpdate(this.update.deviceId);
    if (!response.controller) {
      // TODO(michaelcheco): Handle |StartInstall| failed case.
      return;
    }
    this.installController_ =
        /**@type {InstallControllerRemote} */ (response.controller);
    this.bindReceiverAndMaybeStartUpdate_();
  }

  /** @protected */
  bindReceiverAndMaybeStartUpdate_() {
    /** @protected {?UpdateProgressObserverReceiver} */
    this.updateProgressObserverReceiver_ = new UpdateProgressObserverReceiver(
        /**
         * @type {!UpdateProgressObserverInterface}
         */
        (this));

    this.installController_.addObserver(
        this.updateProgressObserverReceiver_.$.bindNewPipeAndPassRemote());

    // Only start new updates, inflight updates will be observed instead.
    if (!this.isInitiallyInflight_) {
      this.installController_.beginUpdate(
          this.update.deviceId, this.update.filepath);
    }
  }

  /**
   * @protected
   * @return {boolean}
   */
  shouldShowUpdateDialog_() {
    if (!this.update) {
      return false;
    }

    // Handles the case in which an update is in progress on app load, but has
    // yet to receive an progress update callback.
    if (this.isInitiallyInflight_) {
      return true;
    }

    /** @type {!Array<!UpdateState>} */
    const activeDialogStates = [
      UpdateState.kUpdating,
      UpdateState.kRestarting,
      UpdateState.kFailed,
      UpdateState.kSuccess,
    ];
    // Show dialog is there is an update in progress.
    return activeDialogStates.includes(this.installationProgress.state) ||
        this.installationProgress.percentage > 0;
  }

  /**
   * @protected
   * @return {number}
   */
  computePercentageValue_() {
    if (this.installationProgress && this.installationProgress.percentage) {
      return this.installationProgress.percentage;
    }
    return 0;
  }

  /**
   * @protected
   * @return {boolean}
   */
  isUpdateInProgress_() {
    /** @type {!Array<!UpdateState>} */
    const inactiveDialogStates = [UpdateState.kUnknown, UpdateState.kIdle];
    if (inactiveDialogStates.includes(this.installationProgress.state)) {
      return this.installationProgress.percentage > 0;
    }

    return this.installationProgress.state === UpdateState.kUpdating;
  }

  /**
   * @protected
   * @return {boolean}
   */
  isDeviceRestarting_() {
    return this.installationProgress.state === UpdateState.kRestarting;
  }

  /**
   * @protected
   * @return {boolean}
   */
  shouldShowProgressBar_() {
    const res = this.isUpdateInProgress_() || this.isDeviceRestarting_() ||
        this.isInitiallyInflight_;
    const progressIsActiveEl = this.shadowRoot.activeElement ==
        this.shadowRoot.querySelector('#progress');
    // Move focus to the dialog title if the progress label is currently
    // active and set to be hidden. This case is reached when the dialog state
    // moves from restarting to completed.
    const dialogTitle = this.shadowRoot.querySelector('#updateDialogTitle');
    if (progressIsActiveEl && !res && dialogTitle) {
      dialogTitle.focus();
    }
    return res;
  }
  /**
   * @protected
   * @return {boolean}
   */
  isUpdateDone_() {
    return this.installationProgress.state === UpdateState.kSuccess ||
        this.installationProgress.state === UpdateState.kFailed;
  }

  /**
   * @param {!UpdateState} state
   * @return {!DialogContent}
   */
  createDialogContentObj_(state) {
    const {deviceName, deviceVersion} = this.update;
    const {percentage} = this.installationProgress;

    const dialogContent = {
      [UpdateState.kUpdating]: {
        title: this.i18n('updating', mojoString16ToString(deviceName)),
        body: this.i18n('updatingInfo'),
        footer: this.i18n('installing', percentage),
      },
      [UpdateState.kRestarting]: {
        title:
            this.i18n('restartingTitleText', mojoString16ToString(deviceName)),
        body: this.i18n('restartingBodyText'),
        footer: this.i18n('restartingFooterText'),
      },
      [UpdateState.kFailed]: {
        title: this.i18n(
            'updateFailedTitleText', mojoString16ToString(deviceName)),
        body: this.i18n('updateFailedBodyText'),
        footer: '',
      },
      [UpdateState.kSuccess]: {
        title: this.i18n('deviceUpToDate', mojoString16ToString(deviceName)),
        body: this.i18n(
            'hasBeenUpdated', mojoString16ToString(deviceName), deviceVersion),
        footer: '',
      },
    };

    return dialogContent[state];
  }

  /** @return {!DialogContent} */
  computeDialogContent_() {
    // No update in progress.
    if (!this.isInitiallyInflight_ && !this.update) {
      return initialDialogContent;
    }

    if (inactiveDialogStates.includes(this.installationProgress.state) ||
        this.isDeviceRestarting_()) {
      return this.createDialogContentObj_(UpdateState.kRestarting);
    }

    // Regular case: Update is in progress, started from the same instance of
    // which the app launched.
    // Edge case: App launch with an update in progress, but no progress
    // callback has been called yet.
    if (this.isInitiallyInflight_ || this.isUpdateInProgress_()) {
      return this.createDialogContentObj_(UpdateState.kUpdating);
    }

    if (this.isUpdateDone_()) {
      return this.createDialogContentObj_(this.installationProgress.state);
    }
    return initialDialogContent;
  }

  /**
   * @protected
   * @return {boolean}
   */
  isInIndeterminateState_() {
    if (this.installationProgress) {
      return inactiveDialogStates.includes(this.installationProgress.state) ||
          this.isDeviceRestarting_();
    }

    return false;
  }

  /**
   * @protected
   * @return {string}
   */
  computeButtonText_() {
    if (!this.isUpdateDone_()) {
      return '';
    }

    return this.installationProgress.state === UpdateState.kSuccess ?
        this.i18n('doneButton') :
        this.i18n('okButton');
  }
  /**
   * @protected
   * @return {boolean}
   */
  isDialogOpen_() {
    return !!this.shadowRoot.querySelector('#updateDialog');
  }
}

customElements.define(
    FirmwareUpdateDialogElement.is, FirmwareUpdateDialogElement);


text:
package main

import (
	"fmt"
	"github.com/cloudfoundry/cli/plugin/fakes"
	"github.com/cloudfoundry/cli/plugin/models"
	io_helpers "github.com/cloudfoundry/cli/testhelpers/io"
	. "github.com/cloudfoundry/cli/testhelpers/matchers"
	testterm "github.com/cloudfoundry/cli/testhelpers/terminal"
	. "github.com/onsi/ginkgo"
	. "github.com/onsi/gomega"
	// "os"
)

func fakeError(err error) {
	if err != nil {
		fmt.Println(err)
	}
}

var _ = Describe("WildcardPlugin", func() {
	var (
		ui                *testterm.FakeUI
		wildcardPlugin    *Wildcard
		fakeCliConnection *fakes.FakeCliConnection
		appsList          []plugin_models.GetAppsModel
	)
	Context("When running wildcard-apps", func() {
		BeforeEach(func() {
			appsList = make([]plugin_models.GetAppsModel, 0)
			appsList = append(appsList,
				plugin_models.GetAppsModel{"spring-music", "", "", 0, 0, 0, 0, nil},
				plugin_models.GetAppsModel{"app321", "", "", 0, 0, 0, 0, nil},
			)
			fakeCliConnection = &fakes.FakeCliConnection{}
			wildcardPlugin = &Wildcard{}
		})
		Describe("When there are matching apps", func() {
			It("prints a table containing only those apps", func() {
				fakeCliConnection.GetAppsReturns(appsList, nil)
				output := io_helpers.CaptureOutput(func() {
					wildcardPlugin.Run(fakeCliConnection, []string{"wildcard-apps", "app*"})
				})

				Expect(output).To(ContainSubstrings(
					[]string{"app321"},
				))
				Expect(output).ToNot(ContainSubstrings(
					[]string{"spring-music"},
				))
			})
		})
		Describe("When there are matching apps", func() {
			It("prints a table containing only those apps", func() {
				fakeCliConnection.GetAppsReturns(appsList, nil)
				output := io_helpers.CaptureOutput(func() {
					wildcardPlugin.Run(fakeCliConnection, []string{"wildcard-apps", "app*"})
				})

				Expect(output).To(ContainSubstrings(
					[]string{"app321"},
				))
				Expect(output).ToNot(ContainSubstrings(
					[]string{"spring-music"},
				))
			})
		})
	})
	Context("wildcard-delete", func() {
		Describe("When there are matching apps", func() {
			BeforeEach(func() {
				appsList = make([]plugin_models.GetAppsModel, 0)
				appsList = append(appsList,
					plugin_models.GetAppsModel{"spring-music", "", "", 0, 0, 0, 0, nil},
					plugin_models.GetAppsModel{"app1", "", "", 0, 0, 0, 0, nil},
					plugin_models.GetAppsModel{"app2", "", "", 0, 0, 0, 0, nil},
					plugin_models.GetAppsModel{"app3", "", "", 0, 0, 0, 0, nil},
					plugin_models.GetAppsModel{"apple_pie", "", "", 0, 0, 0, 0, nil},
				)
				fakeCliConnection = &fakes.FakeCliConnection{}
				fakeCliConnection.GetAppsReturns(appsList, nil)
				wildcardPlugin = &Wildcard{}
				ui = &testterm.FakeUI{}
			})
		})
		// It("Prompts the user to select delete interactive, all, or cancel", func() {
		// 	output := io_helpers.CaptureOutput(func() {
		// 		wildcardPlugin.Run(fakeCliConnection, []string{"wildcard-delete", "app*"})
		// 	})
		// 	Expect(output).To(ContainSubstrings(
		// 		[]string{"Would you like to delete the apps"},
		// 		[]string{"(i)nteractively"},
		// 		[]string{"(a)ll"},
		// 		[]string{"(c)ancel"},
		// 	))
		// 	read, write, _ := os.Pipe()
		// 	old := os.Stdin
		// 	os.Stdin = read
		// 	write.WriteString("i")
		// 	//write.Flush()
		// 	Expect(output).To(ContainSubstrings(
		// 		[]string{"Really delete the app app1?"},
		// 	))
		// 	write.WriteString("")
		// 	//write.Flush()
		// 	Expect(output).To(ContainSubstrings(
		// 		[]string{"Deleting app app1?"},
		// 	))
		// 	os.Stdin = old
		// })
	})
	Context("wildcard-delete -f", func() {
		Describe("When there are matching apps", func() {
			BeforeEach(func() {
				appsList = make([]plugin_models.GetAppsModel, 0)
				appsList = append(appsList,
					plugin_models.GetAppsModel{"spring-music", "", "", 0, 0, 0, 0, nil},
					plugin_models.GetAppsModel{"app321", "", "", 0, 0, 0, 0, nil},
					plugin_models.GetAppsModel{"apple_pie", "", "", 0, 0, 0, 0, nil},
				)
				fakeCliConnection = &fakes.FakeCliConnection{}
				fakeCliConnection.GetAppsReturns(appsList, nil)
				wildcardPlugin = &Wildcard{}
				ui = &testterm.FakeUI{}
			})

			It("does not prompt when the user provides the -f flag", func() {
				output := io_helpers.CaptureOutput(func() {
					wildcardPlugin.Run(fakeCliConnection, []string{"wildcard-delete", "app*", "-f"})
				})
				Expect(output).To(ContainSubstrings(
					[]string{"Deleting app app321"},
					[]string{"Deleting app apple_pie"},
				))
				Expect(output).ToNot(ContainSubstrings(
					[]string{"Deleting app spring-music"},
				))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputCallCount()).To(Equal(2))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)[0]).To(Equal("delete"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)[1]).To(Equal("app321"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)[2]).To(Equal("-f"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(1)[0]).To(Equal("delete"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(1)[1]).To(Equal("apple_pie"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(1)[2]).To(Equal("-f"))
			})
			It("does not prompt and deletes all mapped routes when the user provides the -f and -r flag", func() {
				output := io_helpers.CaptureOutput(func() {
					wildcardPlugin.Run(fakeCliConnection, []string{"wildcard-delete", "app*", "-f", "-r"})
				})
				Expect(output).To(ContainSubstrings(
					[]string{"Deleting app app321 and its mapped routes"},
					[]string{"Deleting app apple_pie and its mapped routes"},
				))
				Expect(output).ToNot(ContainSubstrings(
					[]string{"Deleting app spring-music and its mapped routes"},
				))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputCallCount()).To(Equal(2))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)[0]).To(Equal("delete"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)[1]).To(Equal("app321"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)[2]).To(Equal("-f"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)[3]).To(Equal("-r"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(1)[0]).To(Equal("delete"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(1)[1]).To(Equal("apple_pie"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(1)[2]).To(Equal("-f"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(1)[3]).To(Equal("-r"))
			})
			It("does not matter what the order of the flags, -f and -r, are", func() {
				output := io_helpers.CaptureOutput(func() {
					wildcardPlugin.Run(fakeCliConnection, []string{"wildcard-delete", "app*", "-r", "-f"})
				})
				Expect(output).To(ContainSubstrings(
					[]string{"Deleting app app321 and its mapped routes"},
					[]string{"Deleting app apple_pie and its mapped routes"},
				))
				Expect(output).ToNot(ContainSubstrings(
					[]string{"Deleting app spring-music and its mapped routes"},
				))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputCallCount()).To(Equal(2))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)[0]).To(Equal("delete"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)[1]).To(Equal("app321"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)[2]).To(Equal("-f"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)[3]).To(Equal("-r"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(1)[0]).To(Equal("delete"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(1)[1]).To(Equal("apple_pie"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(1)[2]).To(Equal("-f"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(1)[3]).To(Equal("-r"))
			})
			It("does not matter if the flags come before the pattern", func() {
				output := io_helpers.CaptureOutput(func() {
					wildcardPlugin.Run(fakeCliConnection, []string{"wildcard-delete", "-r", "-f", "app*"})
				})
				Expect(output).To(ContainSubstrings(
					[]string{"Deleting app app321 and its mapped routes"},
					[]string{"Deleting app apple_pie and its mapped routes"},
				))
				Expect(output).ToNot(ContainSubstrings(
					[]string{"Deleting app spring-music and its mapped routes"},
				))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputCallCount()).To(Equal(2))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)[0]).To(Equal("delete"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)[1]).To(Equal("app321"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)[2]).To(Equal("-f"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)[3]).To(Equal("-r"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(1)[0]).To(Equal("delete"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(1)[1]).To(Equal("apple_pie"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(1)[2]).To(Equal("-f"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(1)[3]).To(Equal("-r"))
			})
			It("does not matter if the pattern is in between the flags", func() {
				output := io_helpers.CaptureOutput(func() {
					wildcardPlugin.Run(fakeCliConnection, []string{"wildcard-delete", "-r", "app*", "-f"})
				})
				Expect(output).To(ContainSubstrings(
					[]string{"Deleting app app321 and its mapped routes"},
					[]string{"Deleting app apple_pie and its mapped routes"},
				))
				Expect(output).ToNot(ContainSubstrings(
					[]string{"Deleting app spring-music and its mapped routes"},
				))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputCallCount()).To(Equal(2))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)[0]).To(Equal("delete"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)[1]).To(Equal("app321"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)[2]).To(Equal("-f"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(0)[3]).To(Equal("-r"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(1)[0]).To(Equal("delete"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(1)[1]).To(Equal("apple_pie"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(1)[2]).To(Equal("-f"))
				Expect(fakeCliConnection.CliCommandWithoutTerminalOutputArgsForCall(1)[3]).To(Equal("-r"))
			})

		})
	})
	Context("When there are no matching apps", func() {
		BeforeEach(func() {
			appsList = make([]plugin_models.GetAppsModel, 0)
			appsList = append(appsList,
				plugin_models.GetAppsModel{"spring-music", "", "", 0, 0, 0, 0, nil},
				plugin_models.GetAppsModel{"qwerty", "", "", 0, 0, 0, 0, nil},
				plugin_models.GetAppsModel{"apple_pie", "", "", 0, 0, 0, 0, nil},
			)
			fakeCliConnection = &fakes.FakeCliConnection{}
			fakeCliConnection.GetAppsReturns(appsList, nil)
			wildcardPlugin = &Wildcard{}
			ui = &testterm.FakeUI{}
		})
		Describe("When there are no matching apps for wildcard-apps", func() {
			It("prints an empty table and informs the user", func() {
				output := io_helpers.CaptureOutput(func() {
					wildcardPlugin.Run(fakeCliConnection, []string{"wildcard-apps", "foo*"})
				})

				Expect(output).To(ContainSubstrings(
					[]string{"name"},
					[]string{"requested state"},
					[]string{"instances"},
					[]string{"No apps found matching foo*"},
				))
				Expect(output).ToNot(ContainSubstrings(
					[]string{"spring-music"},
					[]string{"app321"},
				))
			})
		})
		Describe("When there are no matching apps for wildcard-delete", func() {
			It("prints no apps found", func() {
				output := io_helpers.CaptureOutput(func() {
					wildcardPlugin.Run(fakeCliConnection, []string{"wildcard-delete", "foo*"})
				})
				Expect(output).To(ContainSubstrings(
					[]string{"No apps found matching foo*"},
				))
				Expect(output).ToNot(ContainSubstrings(
					[]string{"Deleting app"},
				))
			})
		})
	})
	Context("When any of the plugin's commands are run correctly", func() {
		BeforeEach(func() {
			appsList = make([]plugin_models.GetAppsModel, 0)
			appsList = append(appsList,
				plugin_models.GetAppsModel{"spring-music", "", "", 0, 0, 0, 0, nil},
				plugin_models.GetAppsModel{"qwerty", "", "", 0, 0, 0, 0, nil},
				plugin_models.GetAppsModel{"apple_pie", "", "", 0, 0, 0, 0, nil},
			)
			myQuota := plugin_models.QuotaFields{}
			myOrg := plugin_models.Organization{plugin_models.OrganizationFields{"", "Jeanie", myQuota}}
			mySpace := plugin_models.Space{plugin_models.SpaceFields{"", "development"}}

			fakeCliConnection = &fakes.FakeCliConnection{}
			fakeCliConnection.GetAppsReturns(appsList, nil)
			fakeCliConnection.GetCurrentOrgReturns(myOrg, nil)
			fakeCliConnection.GetCurrentSpaceReturns(mySpace, nil)
			fakeCliConnection.UsernameReturns("ejung@pivotal.io", nil)
			wildcardPlugin = &Wildcard{}
			ui = &testterm.FakeUI{}
		})
		Describe("When the user provides correct input for wildcard-apps", func() {
			It("prints correct introductory message", func() {
				output := io_helpers.CaptureOutput(func() {
					wildcardPlugin.Run(fakeCliConnection, []string{"wildcard-apps", "app*"})
				})

				Expect(output).To(ContainSubstrings(
					[]string{"Getting apps matching app* in org Jeanie"},
					[]string{"space development"},
					[]string{"as ejung@pivotal.io"},
					[]string{"OK"},
				))
			})
		})
		Describe("When the user provides correct input for wildcard-delete with force", func() {
			It("prints correct introductory message", func() {
				output := io_helpers.CaptureOutput(func() {
					wildcardPlugin.Run(fakeCliConnection, []string{"wildcard-delete", "foo*"})
				})
				Expect(output).To(ContainSubstrings(
					[]string{"Getting apps matching foo* in org Jeanie"},
					[]string{"space development"},
					[]string{"as ejung@pivotal.io"},
					[]string{"OK"},
				))
			})
		})
	})
})


text:
"""
Copyright 2020 Google LLC

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

     https://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
"""
"""Contains the importance scorer tests."""
from absl.testing import absltest
import tensorflow as tf

from discretezoo.attack import importance

class ScorerTest(absltest.TestCase):
  """This class contains the tests for the functions inside of importance.py."""

  def test_scorer(self):
    """This tests the importance scorer as a whole."""

    def output_difference_fn(deleted_token_sentence, original_probabilities):
      return tf.cast(
          tf.math.reduce_sum(deleted_token_sentence, axis=-1, keepdims=True),
          tf.float32)

    def dropper_function(sentences, position):
      return sentences

    sentence = tf.expand_dims(tf.range(0, 10), axis=0)
    original_probabilities = tf.zeros((1, 10))
    expected_scores = tf.constant([[45.0] * 10])
    test_scores = importance.scorer(sentence,
                                    original_probabilities,
                                    output_difference_fn,
                                    dropper_function,
                                    pad_id=-1)
    tf.debugging.assert_equal(expected_scores, test_scores)

  def test_ignore_padding(self):
    """This tests whether or not padding tokens are ignored in scoring."""

    def output_difference_fn(deleted_token_sentence, original_probabilities):
      return tf.cast(
          tf.math.reduce_sum(deleted_token_sentence, axis=-1, keepdims=True),
          tf.float32)

    def dropper_function(sentences, position):
      return sentences

    sentences = tf.constant([[1, 1, 1, 1, 1], [1, 1, 1, 1, 0], [1, 1, 1, 0, 0],
                             [1, 1, 0, 0, 0], [1, 0, 0, 0, 0]])
    original_probabilities = tf.zeros((5, 5))
    expected_scores = tf.constant(
        [[5, 5, 5, 5, 5], [4, 4, 4, 4, 0], [3, 3, 3, 0, 0], [2, 2, 0, 0, 0],
         [1, 0, 0, 0, 0]],
        dtype=tf.float32)
    test_scores = importance.scorer(sentences, original_probabilities,
                                    output_difference_fn, dropper_function)
    tf.debugging.assert_equal(expected_scores, test_scores)

class MaskPositionTest(absltest.TestCase):

  def test_mask_position(self):
    """This tests _mask_position to see if it correctly masks target tokens."""
    sentence = tf.expand_dims(tf.range(1, 11), 0)
    expected_masked_position = tf.constant([[1, 2, 3, 4, 5, 0, 7, 8, 9, 10]],
                                           dtype=tf.int32)
    position = 5
    test_masked_position = importance.mask_position(sentence,
                                                    position,
                                                    mask_id=0)
    tf.debugging.assert_equal(expected_masked_position, test_masked_position)

  def test_masking_last_position(self):
    """This test is for the edge case where we mask the last token."""
    sentence = tf.expand_dims(tf.range(1, 11), 0)
    expected_last_token_masked_sentence = tf.constant(
        [[1, 2, 3, 4, 5, 6, 7, 8, 9, 0]])
    position = 9
    test_last_token_masked_sentence = importance.mask_position(sentence,
                                                               position,
                                                               mask_id=0)
    tf.debugging.assert_equal(expected_last_token_masked_sentence,
                              test_last_token_masked_sentence)

  def test_mask_position_too_big_index(self):
    """This test is to ensure out of bounds (too big) positions get caught."""
    sentence = tf.expand_dims(tf.range(1, 11), 0)
    position = 11
    with self.assertRaises(AssertionError):
      importance.mask_position(sentence, position, mask_id=0)

  def test_mask_position_negative_index(self):
    """This test ensures negative positions (while valid python) aren't used."""
    sentence = tf.expand_dims(tf.range(1, 11), 0)
    position = -1
    with self.assertRaises(AssertionError):
      importance.mask_position(sentence, position, mask_id=0)

  def test_mask_position_mask_id_requirement(self):
    """This test makes sure mask_position checks for the mask_id argument."""
    sentence = tf.expand_dims(tf.range(1, 11), 0)
    position = 5
    with self.assertRaises(AssertionError):
      importance.mask_position(sentence, position)

class DropPositionTest(absltest.TestCase):

  def test_drop_position(self):
    """This tests _mask_position to see if it correctly drops target tokens."""
    sentence = tf.expand_dims(tf.range(0, 10), 0)
    expected_dropped_position = tf.constant([[0, 1, 2, 3, 5, 6, 7, 8, 9]],
                                            dtype=tf.int32)
    position = 4
    test_dropped_position = importance.drop_position(sentence, position)
    tf.debugging.assert_equal(expected_dropped_position, test_dropped_position)

  def test_dropping_last_position(self):
    """This test is for the edge case where we drop the last token."""
    sentence = tf.expand_dims(tf.range(0, 10), 0)
    expected_last_token_dropped_sentence = tf.expand_dims(tf.range(0, 9), 0)
    position = 9
    test_last_token_dropped_sentence = importance.drop_position(sentence, 9)
    tf.debugging.assert_equal(expected_last_token_dropped_sentence,
                              test_last_token_dropped_sentence)

  def test_drop_position_too_big_index(self):
    """This test is to ensure out of bounds (too big) positions get caught."""
    sentence = tf.expand_dims(tf.range(1, 11), 0)
    position = 11
    with self.assertRaises(AssertionError):
      importance.drop_position(sentence, position)

  def test_drop_position_negative_index(self):
    """This test ensures negative positions (while valid python) aren't used."""
    sentence = tf.expand_dims(tf.range(1, 11), 0)
    position = -1
    with self.assertRaises(AssertionError):
      importance.drop_position(sentence, position)

if __name__ == '__main__':
  absltest.main()


text:
/**
 * TCP
 **/
var net = require('net');
var util = require('util');
var fs = require('fs');

var server = net.createServer({allowHalfOpen:true});//不允许对方自己说离开

server.on('connection', function(socket){
    console.log(socket.remoteAddress,socket.remotePort,socket.localAddress,socket.localPort);

    socket.on('data',function(data){
        socket.write('服务说:'+data);
    });
    setTimeout(function(){
        socket.close();
    },10000);

    //客户端发起end请求
    socket.on('end',function(){
        console.log('end');
    });
    //不管何种原因,只要关闭了都会触发
    socket.on('close',function(){
        console.log('close');
    });
    socket.on('error',function(){
        console.log('error');
        socket.destroy();
    });
});
server.listen(8080);


text: installBiocDataPackage.sh "pd.charm.hg18.example-0.99.4"


text:
@interface PlainColorViewController : UIViewController{
    __weak IBOutlet UILabel *_colorLabel;
}

@property (strong) UIColor *color;
@property (assign) BOOL shouldUseWhiteText;

@end