text:
title: How to instantiate a Data Context without a yml file
---
import Prerequisites from '../../connecting_to_your_data/components/prerequisites.jsx'
import TechnicalTag from '/docs/term_tags/_tag.mdx';

This guide will help you instantiate a <TechnicalTag tag="data_context" text="Data Context" /> without a yml file, aka configure a Data Context in code. If you are working in an environment without easy access to a local filesystem (e.g. AWS Spark EMR, Databricks, etc.) you may wish to configure your Data Context in code, within your notebook or workflow tool (e.g. Airflow DAG node).

<Prerequisites>

</Prerequisites>

:::note
- See also our companion video for this guide: [Data Contexts In Code](https://youtu.be/4VMOYpjHNhM).
:::

## Steps

### 1. **Create a DataContextConfig**

The `DataContextConfig` holds all of the associated configuration parameters to build a Data Context. There are defaults set for you to minimize configuration in typical cases, but please note that every parameter is configurable and all defaults are overridable. Also note that `DatasourceConfig` also has defaults which can be overridden.

Here we will show a few examples of common configurations, using the ``store_backend_defaults`` parameter. Note that you can use the existing API without defaults by omitting that parameter, and you can override all of the parameters as shown in the last example. A parameter set in ``DataContextConfig`` will override a parameter set in ``store_backend_defaults`` if both are used.

The following ``store_backend_defaults`` are currently available:
- `S3StoreBackendDefaults`
- `GCSStoreBackendDefaults`
- `DatabaseStoreBackendDefaults`
- `FilesystemStoreBackendDefaults`

The following example shows a Data Context configuration with an SQLAlchemy <TechnicalTag relative="../../../" tag="datasource" text="Datasource" /> and an AWS S3 bucket for all metadata <TechnicalTag relative="../../../" tag="store" text="Stores" />, using default prefixes. Note that you can still substitute environment variables as in the YAML based configuration to keep sensitive credentials out of your code.

```python
from great_expectations.data_context.types.base import DataContextConfig, DatasourceConfig, S3StoreBackendDefaults

data_context_config = DataContextConfig(
    datasources={
        "sql_warehouse": DatasourceConfig(
            class_name="Datasource",
            execution_engine={
                "class_name": "SqlAlchemyExecutionEngine",
                "credentials": {
                    "drivername": "postgresql+psycopg2",
                    "host": "localhost",
                    "port": "5432",
                    "username": "postgres",
                    "password": "postgres",
                    "database": "postgres",
                },
            },
            data_connectors={
                "default_runtime_data_connector_name": {
                    "class_name": "RuntimeDataConnector",
                    "batch_identifiers": ["default_identifier_name"],
                },
                "default_inferred_data_connector_name": {
                    "class_name": "InferredAssetSqlDataConnector",
                    "name": "whole_table",
                },
            }
        )
    },
    store_backend_defaults=S3StoreBackendDefaults(default_bucket_name="my_default_bucket"),
    )
```

The following example shows a Data Context configuration with a Pandas datasource and local filesystem defaults for metadata stores. Note: imports are omitted in the following examples. Note: You may add an optional root_directory parameter to set the base location for the Store Backends.

```python
from great_expectations.data_context.types.base import DataContextConfig, DatasourceConfig, FilesystemStoreBackendDefaults

data_context_config = DataContextConfig(
    datasources={
        "pandas": DatasourceConfig(
            class_name="Datasource",
            execution_engine={
                "class_name": "PandasExecutionEngine"
            },
            data_connectors={
                "tripdata_monthly_configured": {
                    "class_name": "ConfiguredAssetFilesystemDataConnector",
                    "base_directory": "/path/to/trip_data",
                    "assets": {
                        "yellow": {
                            "pattern": r"yellow_tripdata_(\d{4})-(\d{2})\.csv$",
                            "group_names": ["year", "month"],
                        }
                    },
                }
            },
        )
    },
    store_backend_defaults=FilesystemStoreBackendDefaults(root_directory="/path/to/store/location"),
)
```

The following example shows a Data Context configuration with an SQLAlchemy datasource and two GCS buckets for metadata Stores, using some custom and some default prefixes. Note that you can still substitute environment variables as in the YAML based configuration to keep sensitive credentials out of your code. `default_bucket_name`, `default_project_name` sets the default value for all stores that are not specified individually.

The resulting `DataContextConfig` from the following example creates an <TechnicalTag tag="expectation_store" text="Expectations Store" /> and <TechnicalTag relative="../../../" tag="data_docs" text="Data Docs" /> using the `my_default_bucket` and `my_default_project` parameters since their bucket and project is not specified explicitly. The <TechnicalTag tag="validation_result_store" text="Validation Results Store" /> is created using the explicitly specified `my_validations_bucket` and `my_validations_project`. Further, the prefixes are set for the Expectations Store and Validation Results Store, while Data Docs use the default `data_docs` prefix.

```python
data_context_config = DataContextConfig(
    datasources={
        "sql_warehouse": DatasourceConfig(
            class_name="Datasource",
            execution_engine={
                "class_name": "SqlAlchemyExecutionEngine",
                "credentials": {
                    "drivername": "postgresql+psycopg2",
                    "host": "localhost",
                    "port": "5432",
                    "username": "postgres",
                    "password": "postgres",
                    "database": "postgres",
                },
            },
            data_connectors={
                "default_runtime_data_connector_name": {
                    "class_name": "RuntimeDataConnector",
                    "batch_identifiers": ["default_identifier_name"],
                },
                "default_inferred_data_connector_name": {
                    "class_name": "InferredAssetSqlDataConnector",
                    "name": "whole_table",
                },
            }
        )
    },
    store_backend_defaults=GCSStoreBackendDefaults(
        default_bucket_name="my_default_bucket",
        default_project_name="my_default_project",
        validations_store_bucket_name="my_validations_bucket",
        validations_store_project_name="my_validations_project",
        validations_store_prefix="my_validations_store_prefix",
        expectations_store_prefix="my_expectations_store_prefix",
    ),
)
```

The following example sets overrides for many of the parameters available to you when creating a `DataContextConfig` and a Datasource.

```python
data_context_config = DataContextConfig(
    config_version=2,
    plugins_directory=None,
    config_variables_file_path=None,
    datasources={
        "my_spark_datasource": DatasourceConfig(
            class_name="Datasource",
            execution_engine={
                "class_name": "SparkDFExecutionEngine"
            },
            data_connectors={
                "tripdata_monthly_configured": {
                    "class_name": "ConfiguredAssetFilesystemDataConnector",
                    "base_directory": "/path/to/trip_data",
                    "assets": {
                        "yellow": {
                            "pattern": r"yellow_tripdata_(\d{4})-(\d{2})\.csv$",
                            "group_names": ["year", "month"],
                        }
                    },
                }
            },
        )
    },
    stores={
        "expectations_S3_store": {
            "class_name": "ExpectationsStore",
            "store_backend": {
                "class_name": "TupleS3StoreBackend",
                "bucket": "my_expectations_store_bucket",
                "prefix": "my_expectations_store_prefix",
            },
        },
        "validations_S3_store": {
            "class_name": "ValidationsStore",
            "store_backend": {
                "class_name": "TupleS3StoreBackend",
                "bucket": "my_validations_store_bucket",
                "prefix": "my_validations_store_prefix",
            },
        },
        "evaluation_parameter_store": {"class_name": "EvaluationParameterStore"},
    },
    expectations_store_name="expectations_S3_store",
    validations_store_name="validations_S3_store",
    evaluation_parameter_store_name="evaluation_parameter_store",
    data_docs_sites={
        "s3_site": {
            "class_name": "SiteBuilder",
            "store_backend": {
                "class_name": "TupleS3StoreBackend",
                "bucket":  "my_data_docs_bucket",
                "prefix":  "my_optional_data_docs_prefix",
            },
            "site_index_builder": {
                "class_name": "DefaultSiteIndexBuilder",
                "show_cta_footer": True,
            },
        }
    },
    validation_operators={
        "action_list_operator": {
            "class_name": "ActionListValidationOperator",
            "action_list": [
                {
                    "name": "store_validation_result",
                    "action": {"class_name": "StoreValidationResultAction"},
                },
                {
                    "name": "store_evaluation_params",
                    "action": {"class_name": "StoreEvaluationParametersAction"},
                },
                {
                    "name": "update_data_docs",
                    "action": {"class_name": "UpdateDataDocsAction"},
                },
            ],
        }
    },
    anonymous_usage_statistics={
      "enabled": True
    }
)
```

### 2. Pass this DataContextConfig as a project_config to BaseDataContext

```python
from great_expectations.data_context import BaseDataContext
context = BaseDataContext(project_config=data_context_config)
```

### 3. Use this BaseDataContext instance as your DataContext

If you are using Airflow, you may wish to pass this Data Context to your GreatExpectationsOperator as a parameter. See the following guide for more details:

- [Deploying Great Expectations with Airflow](../../../../docs/intro.md)

Additional resources
--------------------

- [How to instantiate a Data Context on an EMR Spark cluster](../../../deployment_patterns/how_to_instantiate_a_data_context_on_an_emr_spark_cluster.md)
- [How to use Great Expectations in Databricks](../../../deployment_patterns/how_to_use_great_expectations_in_databricks.md)


text:
thisDir=$(dirname $0)
thisDir=$(readlink -f "$thisDir")

jarPath=$1
stormDir=$2
if [ "$#" = "2" ]; then
    ${thisDir}/storm-deploy-one.sh $jarPath $stormDir lib
else
	echo "USAGE:"
	echo "run <jar file> <storm directory>"
fi

redpajama_set_name: RedPajamaGithub


text:
package org.wte4j.ui.server.services;

import java.util.List;
import java.util.Map;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.context.support.SpringBeanAutowiringSupport;
import org.wte4j.ui.shared.InvalidTemplateServiceException;
import org.wte4j.ui.shared.ModelElementDto;
import org.wte4j.ui.shared.TemplateDto;
import org.wte4j.ui.shared.TemplateService;
import org.wte4j.ui.shared.TemplateServiceException;

import com.google.gwt.user.server.rpc.RemoteServiceServlet;

public class TemplateServiceGWTAdapter extends RemoteServiceServlet implements TemplateService {

	private final Logger logger = LoggerFactory.getLogger(getClass());

	@Autowired
	private TemplateService templateService;

	public void init() {
		SpringBeanAutowiringSupport.processInjectionBasedOnCurrentContext(this);
	}

	public List<TemplateDto> getTemplates() throws TemplateServiceException {
		return templateService.getTemplates();
	}

	public TemplateDto lockTemplate(TemplateDto template) throws TemplateServiceException {
		return templateService.lockTemplate(template);
	}

	public TemplateDto unlockTemplate(TemplateDto template) throws TemplateServiceException {
		return templateService.unlockTemplate(template);
	}

	public void deleteTemplate(TemplateDto template) throws TemplateServiceException {
		templateService.deleteTemplate(template);
	}

	public List<ModelElementDto> listModelElements(String inputType, Map<String, String> properties) throws TemplateServiceException {
		return templateService.listModelElements(inputType, properties);
	}

	public List<String> listContendIds(String templateFile) throws TemplateServiceException {
		return templateService.listContendIds(templateFile);
	}

	public TemplateDto saveTemplateData(TemplateDto templateDto, String uploadedTemplate) throws TemplateServiceException, InvalidTemplateServiceException {
		return templateService.saveTemplateData(templateDto, uploadedTemplate);
	}

	public TemplateDto createTemplate(TemplateDto newTemplate, String templateFile) {
		return templateService.createTemplate(newTemplate, templateFile);
	}

}


text:
<法規>
<法規性質>命令</法規性質>
<英文法規名稱>Regulations for Establishment and Administration of Insurance Enterprises</英文法規名稱>
<中文法規名稱>保險業設立許可及管理辦法</中文法規名稱>
<法規網址>https://law.moj.gov.tw/Eng/LawClass/LawAll.aspx?pcode=G0390079</法規網址>
<最新英文異動日期>20220629</最新英文異動日期>
<廢止註記>
</廢止註記>
<附件>
  <檔案>
    <檔案名稱><![CDATA[Attachment 1 Application by Insurance Company for Establishment Permit.pdf]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000007463</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 1 Application by Insurance Company for Establishment Permit.odt]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000007464</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 2A  Register of Insurance Company Promoters:Natural Persons.PDF]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000004393</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 2A  Register of Insurance Company Promoters:Natural Persons.doc]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000000323</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 2B  Register of Insurance Company Promoters:Juristic Persons.PDF]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000004394</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 2B  Register of Insurance Company Promoters:Juristic Persons.doc]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000000324</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 3A  Undertaking (by natural person).pdf]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000007465</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 3A  Undertaking (by natural person).odt]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000007466</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 3B  Undertaking (by juristic person).pdf]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000007467</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 3B  Undertaking (by juristic person).docx.odt]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000007468</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 3-1  Sources of Promoters'  Funds.PDF]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000004395</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 3-1  Sources of Promoters'  Funds.doc]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000000325</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 4  Application by Insurance Company for Business License.pdf]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000007469</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 4  Application by Insurance Company for Business License.docx.odt]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000007470</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 5A-1  Register of Insurance Company Directors:Natural Persons.PDF]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000004399</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 5A-1  Register of Insurance Company Directors:Natural Persons.doc]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000000329</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 5A-2  Register of Insurance Company Supervisors:Natural Persons.PDF]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000004400</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 5A-2  Register of Insurance Company Supervisors:Natural Persons.doc]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000000330</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 5A-3  Register of Insurance Company Managerial Officers.PDF]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000004401</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 5A-3  Register of Insurance Company Managerial Officers.doc]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000000331</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 5A-4  Register of Insurance Company Actuaries.PDF]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000004402</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 5A-4  Register of Insurance Company Actuaries.doc]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000000332</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 5A-5  Register of Insurance Company Underwriters.PDF]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000004403</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 5A-5  Register of Insurance Company Underwriters.doc]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000000333</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 5A-6  Register of Insurance Company Claims Adjusters.PDF]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000004404</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 5A-6  Register of Insurance Company Claims Adjusters.doc]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000000334</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 5A-7  Register of Insurance Company General Auditor and Legal Compliance Officer.PDF]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000004405</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 5A-7  Register of Insurance Company General Auditor and Legal Compliance Officer.doc]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000000335</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 5B-1  Register of Insurance Company Directors:Juristic Persons.PDF]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000004406</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 5B-1  Register of Insurance Company Directors:Juristic Persons.doc]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000000336</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 5B-2  Register of Insurance Company Supervisors:Juristic Persons.PDF]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000004407</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 5B-2  Register of Insurance Company Supervisors:Juristic Persons.doc]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000000337</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 6  Source of Investment Funds.PDF]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000004408</下載網址>
  </檔案>
  <檔案>
    <檔案名稱><![CDATA[Attachment 6  Source of Investment Funds.doc]]></檔案名稱>
    <下載網址>https://law.moj.gov.tw/Eng/LawClass/LawGetFile.ashx?FileId=0000000338</下載網址>
  </檔案>
</附件>
<沿革內容><![CDATA[1.Promulgated on January 09, 2008
2.Amended on November 20, 2009
3.Amended on 31 July 2014 per Order Ref. Jin-Kuan-Bao-Tsai 10302506161 of the Financial Supervisory Commission.
4.Amended on 24 July 2015 per Order Ref. Jin-Kuan-Bao-Shou 10402543341 of the Financial Supervisory Commission
5.Amended on 30 May 2022 per Order No. Jin-Guan-Bao-Shou-Zi- 11104920994 of the Financial Supervisory Commission
6.Amended on June 29,2022
]]></沿革內容>
<前言><![CDATA[]]></前言>
<法規內容>
  <編章節>   Chapter 1 General Principles</編章節>
  <條文>
    <條號>Article 1</條號>
    <條文內容><![CDATA[These Regulations are adopted pursuant to Article 137, paragraph 2 and Article 176 of the Insurance Act.]]></條文內容>
  </條文>
  <編章節>   Chapter 2 Establishment</編章節>
  <條文>
    <條號>Article 2</條號>
    <條文內容><![CDATA[When application is made to establish an insurance company, the company's minimum paid-in capital is NT$2 billion. The capital contributions of promoters and shareholders shall be limited to cash.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 3</條號>
    <條文內容><![CDATA[To establish an insurance company, the promoters shall at the time of application for an establishment permit make share payments equivalent to at least 20 percent of minimum paid-in capital; the payments shall be deposited into a segregated account as set out in Article 7, paragraph 1.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 4</條號>
    <條文內容><![CDATA[The directors, supervisors, and managerial officers of an insurance company shall meet the qualification requirements set out in the Regulations Governing Qualification Requirement and Concurrent Serving Restrictions and Matters for Compliance by the Responsible Persons of Insurance Enterprises (hereinafter referred to as the "Regulations for the Responsible Persons of Insurance Enterprises"). A person to whom any one of the situations set out in Article 3 of those Regulations applies may not act as promoter of an insurance company.
Where a promoter, director, or supervisor is a juristic person, the preceding paragraph shall apply mutatis mutandis to its representative or designated representative performing duties on its behalf.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 5</條號>
    <條文內容><![CDATA[Unless special approval has been granted by the competent authority, an insurance company that has received an establishment permit shall, prior to commencing business operations, have its principal computer systems in operation and ensure that they have passed inspection by the competent authority or an organization designated thereby.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 6</條號>
    <條文內容><![CDATA[To establish an insurance company, the promoters shall submit the following documents, each in triplicate, to apply with the competent authority for an establishment permit:
1. Application form for insurance company establishment permit (format as in Attachment 1).
2. Business plan, specifying the business scope, business principles and policies, and specific implementation methods (including premises and facilities, internal organization and segregation of duties, personnel recruitment and training, business development plan, financial forecasts for the coming five years, and policy on reinsurance).
3. A register of promoters and relevant evidentiary documentation (format as in Attachment 2).
4. Promoters meeting minutes.
5. A statement affirming that none of the disqualifying conditions listed under Article 3 of the Regulations for the Responsible Persons of Insurance Enterprises applies to any of the applicant's promoters or other responsible persons (format as in Attachment 3).
6. Proof that the promoters have made full payment for shares in accordance with the provisions of paragraph 3.
7. An explanation of the sources of the promoters' funds (format as in Attachment 3-1).
8. The offering circular.
9. Documents evidencing the qualifications of the persons expected to be appointed as general manager, assistant general managers, and deputy assistant general managers.
10. Articles of incorporation.
11. Review opinions by a certified public account, a lawyer, and an actuary.
12. The responsibilities of the board of directors, and segregation of duties between the board of directors and management.
13. Other documents as required by the competent authority.
Where the information recorded in the documents referred to in the preceding paragraph is incomplete or insufficient, the application shall be dismissed. If the deficiency can be supplemented or corrected, but this is not done within the time limit set by the competent authority, the application shall be dismissed.
After an insurance company has received its establishment permit, if false information is discovered in any of the documents that it submitted pursuant to paragraph 1 the competent authority may void the permit.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 7</條號>
    <條文內容><![CDATA[To establish an insurance company, a financial institution shall be appointed to collect share capital that is to be deposited into a segregated account opened in the name of preparatory office.
The share capital deposited in the segregated account under the preceding paragraph may not be used before commencement of business. However, the same shall not apply where any of the following circumstances arises after the establishment permit is obtained:
1. The share capital is to be used to purchase fixed assets necessary for business operations and to pay organization costs out of the share capital paid by the promoters, as agreed unanimously by the directors and supervisors elected at a promoters meeting or founders meeting.
2. Incorporation registration for the company has already been completed, and the share capital is to be used to post the bond required in Article 141 of the Insurance Act, or is to be allocated to savings deposits or the purchase of government bonds, treasury bills, negotiable certificates of deposit, banker's acceptances, or commercial paper guaranteed by a financial institution, as provided for in Articles 146 and 146-1 of the Insurance Act.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 8</條號>
    <條文內容><![CDATA[The competent authority may revoke a permit for the establishment of an insurance company if there is any change in promoter prior to the company's incorporation registration. However, this restriction does not apply in any of the following circumstances if the company has filed an application with the competent authority for approval of the change within two weeks after occurrence of the fact:
1. A promoter is missing or dies.
2. A promoter is placed under guardianship by court order.
3. A circumstance set out in Article 3 of the Regulations for the Responsible Persons of Insurance Enterprises is found to apply to a promoter after the application for establishment has been submitted.
4. A promoter, if a company, is subject to a court ruling for reorganization, or otherwise to a material loss of creditworthiness.
For any change other than to a promoter, a report specifying a legitimate reason shall be submitted to the competent authority for approval in advance, except that where circumstances do not allow the report to be submitted for approval in advance, it shall be submitted to the competent authority for approval within two weeks after occurrence of the fact.
Under the circumstances contemplated in the two preceding paragraphs, an insurance company preparatory office that has obtained approval from the competent authority shall insert a conspicuously placed public announcement in a national daily newspaper.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 9</條號>
    <條文內容><![CDATA[To establish an insurance company, the promoters shall make full payment for shares within two months of the date of its establishment permit, and if there is a public offering of shares they shall also act within the aforementioned time period to duly apply to the competent authority for approval of the public offering of shares.
Where a party fails to comply with the provisions of the preceding paragraph or the competent authority does not grant approval, the competent authority may revoke its permit. However, where there is a legitimate reason, such party may apply prior to expiration of the time period set out in the preceding paragraph to the competent authority for a one-month extension.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 10</條號>
    <條文內容><![CDATA[A party seeking to establish an insurance company shall duly apply to the Ministry of Economic Affairs for registration of the company's incorporation within three months of the date on which share payments for its paid-in capital are collected in full.
Where such a party fails to file with the Ministry of Economic Affairs within the required time period, or the Ministry of Economic Affairs does not grant approval, the competent authority may revoke its establishment permit. However, before expiration of the time limit set forth in the preceding paragraph, an application may be filed with the competent authority for an extension if there is a legitimate reason.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 11</條號>
    <條文內容><![CDATA[Within three months from the date on which incorporation registration is completed, a party seeking to establish an insurance company shall duly pay all required fees and submit the following documents attached thereto in triplicate to the competent authority to apply for issuance of a business license.
1. Business license application form (format as in Attachment 4).
2. Company registration documents.
3. Capital verification certificate.
4. Documentary proof that the bond required under Article 141 of the Insurance Act has been furnished.
5. Articles of incorporation.
6. Minutes of promoters meetings or founders meetings.
7. Register of shareholders.
8. Register of directors (format as in Attachment 5) and meeting minutes of the board of directors.
9. Register of managing directors (format as in Attachment 5) and meeting minutes of the board of managing directors.
10. Register of supervisors (format as in Attachment 5) and supervisors reports or meeting minutes.
11. Register of managerial officers, actuaries, underwriters, claims adjusters, general auditors, legal compliance officers, and other key personnel (format as in Attachment 5).
12. Company bylaws and business operating procedures.
13. A statement affirming that none of the disqualifying conditions listed under Article 3 of the Regulations for the Responsible Persons of Insurance Enterprises applies to any of the applicant's promoters or other responsible persons (format as in Attachment 3).
14. An undertaking acknowledging that any party subscribing to more than 15 percent of the total number of shares to be issued is obliged to fill out a source of funds explanation form (format as in Attachment 6).
15. Other documents as required by the competent authority.
Where there is legitimate reason, an application for extension of a deadline specified in the preceding paragraph may be filed prior to the deadline; an extension may not be longer than three months, and shall be limited to one time. If an extension is not approved, the competent authority may revoke the permit.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 12</條號>
    <條文內容><![CDATA[The company bylaws of paragraph 1, subparagraph 12 of the preceding Article shall cover the following matters:
1. Organizational structure and department functions.
2. Staffing, management, and training of personnel.
3. Internal control system.
4. Business principles and policies.
5. Operations manual and segregation of powers and duties.
6. Other matters.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 13</條號>
    <條文內容><![CDATA[After an insurance company receives an establishment permit but before it is issued a business license, if any of the following circumstances arises with respect to the company, the competent authority will not issue a business license:
1. A circumstance set out in Article 3 of the Regulations for the Responsible Persons of Insurance Enterprises is found to apply to a promoter after the application for establishment has been submitted.
2. A responsible person does not meet the qualification requirements set out in the Regulations for the Responsible Persons of Insurance Enterprises.
3. A director or supervisor violates the provisions of the Regulations for the Responsible Persons of Insurance Enterprises.
4. The company is not in compliance with the provisions of Article 5.
5. The company fails to furnish a required document.
6. Other circumstances exist that the competent authority believes pose a likelihood that the company will not be able to operate insurance business in a sound and effective manner.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 14</條號>
    <條文內容><![CDATA[The competent authority shall revoke the establishment permit granted to an insurance company that fails to commence its business operations within a period of six months following issuance of the business license, require the company to surrender the business license for cancellation within a specified time period, and issue a notice to the Ministry of Economic Affairs. However, where there is legitimate reason and the competent authority has granted approval, an extension may be granted; the period of extension shall be no longer than six months, and shall be limited to one time.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 15</條號>
    <條文內容><![CDATA[With respect to matters related to the establishment of an insurance company, the competent authority may from time to time appoint personnel to conduct audits (or request that an appropriate agency appoint personnel to do so), and may further order the party applying to establish the insurance company to act within a specified time period to submit necessary documents and information or to designate personnel to appear before the competent authority and provide explanations.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 16</條號>
    <條文內容><![CDATA[A party seeking to establish an insurance company may simultaneously apply to establish branches.
The number of branches referred to in the preceding paragraph, and the areas of their location, shall be reviewed and approved by the competent authority on the basis of the company's business plan, staffing, area conditions, and other such factors.]]></條文內容>
  </條文>
  <編章節>   Chapter 3 Regulation</編章節>
  <條文>
    <條號>Article 17</條號>
    <條文內容><![CDATA[When there is a change in an insurance enterprise's location, business scope, total amount of capital or endowment, chairman of the board of directors (or board of trustees), general manager, a director (or trustee), or supervisor, the enterprise shall apply within 15 days of the change to the competent authority to register an amendment of its business registration, and after the amendment shall duly complete an amendment registration with the appropriate agency. Where the amended information is listed on the enterprise's business license, it shall concurrently apply for renewal of the business license.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 18</條號>
    <條文內容><![CDATA[Where a single shareholder of an insurance enterprise increases its share ownership such that its holdings exceed 15 percent of total issued shares, it shall inform the insurance enterprise, and the insurance enterprise shall submit a source of funds explanation form (format as in Attachment 6) and file it with the competent authority for recordation.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 19</條號>
    <條文內容><![CDATA[Where an insurance enterprise has established a branch overseas that is subject to the legal restrictions of the host country, its overseas funds allocations may be handled in accordance with the provisions of the laws and regulations of the host country government.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 20</條號>
    <條文內容><![CDATA[An insurance enterprise shall post bond at the national treasury as required in Articles 141 and 142 of the Insurance Act. In the event of a capital increase, it shall concurrently post additional bond.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 21</條號>
    <條文內容><![CDATA[An insurance enterprise may not use exaggerated, false, or misleading advertisements or claims in conducting business or recruiting personnel.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 22</條號>
    <條文內容><![CDATA[An insurance policy or binder written in accordance with Article 143 of the Insurance Act may be issued as an electronic document.
An insurance policy or binder issued as an electronic document shall be signed with a digital signature. Rules governing the records retention period, internal controls, model contracts, and other matters shall be adopted in advance by the insurance association and filed with the competent authority for recordation.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 23</條號>
    <條文內容><![CDATA[In collecting insurance premiums, an insurance enterprise may not engage in unfair discrimination or rebating, or by means of false expenses or receipts achieve the purpose of unfair discrimination or rebating.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 24</條號>
    <條文內容><![CDATA[When an insurance enterprise allocates enterprise funds in accordance with the provisions of Articles 146 through 146-7 of the Insurance Act and other applicable provisions, its enterprise funds, owner's equity, and various kinds of reserves shall be calculated on the basis of figures from the most recent annual or semi-annual accounts, as attested or reviewed by a CPA except for matters handled in accordance with the regulations specified in Paragraph 2. However, an insurance enterprise that has carried out a capital increase and obtained capital verification from the competent authority shall be permitted to include it in owner's equity and related items.
Insurance enterprises may calculate their enterprise funds, owner's equity, and various kinds of reserves for each month on the basis of the self-assessed figures upon approval of the submitted documentary evidence by a majority of the board with an attendance of at least 2/3 of its members and notification of the competent authority for future reference if they meet the following conditions. However, if audits and reviews have been conducted by a CPA or certain months have been identified by the competent authority, calculation standards shall be based on the figures attested or reviewed by a CPA or figures determined by the competent authority:
1. Discrepancy of less than 0.5% between the self-assessed figures for every quarter of the previous year and figures attested or reviewed by a CPA and a "unqualified opinion" issued by a CPA for the most recent annual and biannual financial reports.
2. Having not been subject to major sanction and disciplinary action by the competent authority in the previous year.
3. Risk based capitial ratio for the previous two quarters reached at least 250%.
4. The enterprise has a clearly formulated internal risk management system and corresponding operating standards. A risk management committee has been set up by the board of directors and a risk management department with an assigned chief risk officer to assume de facto overall risk management of the company.
The major sanction and disciplinary action as prescribed in Subparagraph 2 of the preceding Paragraph refer to Article 2 of the Regulations Governing Public Disclosure by the Financial Supervisory Commission of Material Enforcement Actions for Violations of Financial Legislation.
Insurance enterprises that calculate their enterprise funds, owner's equity, and various kinds of reserves in accordance with Paragraph 2 shall report to the board every quarter whether relevant matters are handled in accordance with the provisions in Article 24.1.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 24-1</條號>
    <條文內容><![CDATA[Insurance enterprises that calculate their enterprise funds, owner's equity, and various kinds of reserves in accordance with the provisions specified in Paragraph 2 of the previous article shall adjust their figures based on calculation standards other than the provision the previous Article within 10 work days after determination unless permission has been obtained from the competent authority due to special circumstances if one of the following conditions applies. If one of the following conditions is verified, said enterprises shall refrain from handling related matters in accordance with the provisions of Paragraph 2 of the previous Article within a period of 2 years upon verification:
1. Conditions that don't conform to subparagraph 1 and 3 of Paragraph 2 of the previous Article.
2. The competent authority has determined a violation of relevant laws and regulations and has ordered a revision of the financial report.
3. The competent authority has determined a violation of the board reporting procedures in accordance with Paragraph 2 of the previous Article or the submission of false documents to the board.
4. Failure to abide by the provisions specified in Paragraph 3 of the previous Article.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 24-2</條號>
    <條文內容><![CDATA[If Insurance enterprises that calculate their enterprise funds, owner's equity, and various kinds of reserves in accordance with the provisions specified in Paragraph 2 of Article 24 adjust their self-assessed figures for specific months in line with audits and reviews conducted by a CPA for other months or figures determined by the competent authority and this results in the exceeding of fund allocation quotas specified in the Insurance Act and related decrees for these months upon adjustment, it shall be assumed that these quota excesses were caused by investment factors.
If conditions listed in the clauses of the previous Article apply to insurance enterprises and figures have been adjusted based on calculation standards other than the proviso those specified in Paragraph 1 of Article 24 and this results in the exceeding of fund allocation quotas specified in this law and related decrees upon adjustment, it shall be assumed that these quota excesses were not caused by investment factors.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 24-3</條號>
    <條文內容><![CDATA[Insurance enterprises that extend loans in accordance with Article 146-3 of the Act should conduct the business in a fair and reasonable manner, and set prices in consideration of factors such as market rates, asset allocation, operating costs, expected cost of loss, reasonable profits and customer's overall contribution, and may not extend loans at unreasonable prices.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 25</條號>
    <條文內容><![CDATA[Before an insurance enterprise adopts a resolution to dissolve it shall first draft a concrete plan to safeguard the interests of the proposers, insureds, and beneficiaries of its insurance contracts and file it with the competent authority for approval.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 26</條號>
    <條文內容><![CDATA[An insurance enterprise may contractually assign all or part of its insurance contracts to another insurance enterprise.
Where an insurance enterprise assigns an insurance contract in accordance with the provisions of the preceding paragraph and also assigns property, the competent authority may require the enterprise to retain part of its property in order to protect the creditors of the assigning insurance enterprise.
An insurance enterprise that suspends operations for six months or more shall dissolve itself and surrender its business license for cancellation. However, this requirement does not apply where the competent authority has issued an order for suspension of business operations and provisional liquidation.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 27</條號>
    <條文內容><![CDATA[When an insurance enterprise organized as a cooperative dissolves itself, dissolution and liquidation shall be handled in accordance with the provisions of the Insurance Act and the Credit Cooperative Act.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 28</條號>
    <條文內容><![CDATA[An insurance enterprise that operates any type of commercial insurance business in accordance with another law is subject mutatis mutandis to the provisions of the Insurance Act, and shall also be regulated in accordance with these Regulations.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 29</條號>
    <條文內容><![CDATA[A filing fee shall be paid when the competent authority, acting in accordance with the provisions of the Insurance Act, processes an application by an insurance enterprise for business registration, amendment of business registration, or issuance or renewal of a business license.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 29-1</條號>
    <條文內容><![CDATA[An insurance company that use the internet or other forms of electronic communication channels to sell insurance products to customers is defined as an internet-only insurance company.
An internet-only non-life insurance company shall only sell innovative insurance products; an internet-only life insurance company shall only sell protection-type insurance products.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 29-2</條號>
    <條文內容><![CDATA[An internet-only insurance company shall apply for an establishment permit within the period prescribed by the competent authority. Applications filed after the prescribed period shall not be accepted.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 29-3</條號>
    <條文內容><![CDATA[The minimum paid-in capital of an internet-only non-life insurance company shall be NT$1 billion; the minimum paid-in capital of an internet-only life insurance company shall be NT$2 billion. The capital contributions of promoters and shareholders shall be limited to cash.
The competent authority may request an internet-only insurance company to increase its paid-in capital based on the business scale described in its business plan.
The paid-in capital referred to in the two preceding paragraphs shall be paid in full by all promoters and the provision on the public offering of shares in Article 9 does not apply.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 29-4</條號>
    <條文內容><![CDATA[With regard to the share subscription of the promoters and shareholders of an internet-only insurance company, the combined share subscription of the financial holding company, bank, securities firm, insurance company, insurance broker company, or insurance agent company must account for at least 40% of the shares. In addition, at least one insurance company or a financial holding company with an insurance company subsidiary shall subscribe to more than 25% of the paid-in capital.
An internet-only insurance company must have a promoter engaged in big data analysis, interface design, software development, Internet of Things, wireless communication, or other financial technologies, and it must submit a successful business model.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 29-5</條號>
    <條文內容><![CDATA[At least half of the directors of an internet-only insurance company shall meet one of the following qualifications; at least two thirds of the qualified directors / them must meet the qualifications in Subparagraph 1 and at least one director must meet the qualifications in Subparagraph 2:
1. Meet the qualifications specified in Subparagraph 1, Article 8 of the Regulations for the Responsible Persons of Insurance Enterprises.
2. Has at least five years of professional work experience in financial technology, has served as an assistant manager of the head office or above or its equivalent with outstanding performance, and is able to contribute to the successful operation of the internet-only insurance company.
The number of directors who are not elected in the capacity of the government, a juristic person, or a representative thereof in the preceding paragraph shall be subject to the provisions of Paragraph 4, Article 8 of the Regulations for the Responsible Persons of Insurance Enterprises.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 29-6</條號>
    <條文內容><![CDATA[The business plan submitted by an internet-only insurance company in accordance with the provisions of Article 6 shall include the following items:
1. Customer identity verification mechanisms.
2. Information Technology system, security controls, backup operations and business continuity plan used in the operations of the internet-only insurance company.
3. A CPA-certified assessment to ensure the budget is sufficient to meet the needs of information system and to operate business properly in the next five years.
4. Plans for the business model and insurance products.
5. Market exit plan: Clarify the conditions   and authorization to implement the plan   and a description of the protection of   customer interests.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 29-7</條號>
    <條文內容><![CDATA[Except for the head office and customer service center, an internet-only insurance company shall not set up other physical operation outlets and the provisions in Article 16 shall not apply.
The customer service center in the preceding paragraph shall not engage in selling or soliciting insurance products, and its establishment shall require the approval of the competent authority.]]></條文內容>
  </條文>
  <條文>
    <條號>Article 30</條號>
    <條文內容><![CDATA[These Regulations shall be implemented from the date of issuance.
The Article 8, paragraph 1, subparagraph 2 of these Regulations amended on November 20, 2009 shall be implemented on November 23, 2009.]]></條文內容>
  </條文>
</法規內容>
</法規>


text:
var BaaSClient = require('../client');
var assert = require('chai').assert;

describe('BaaSClient when server is off', function () {

  it('should return "socket is closed" error', function (done) {
    var client = new BaaSClient({
      host: '10.0.0.123'
    });

    client
      .once('error', () => {})
      .hash('ip', function (err) {
        assert.equal(err.message, 'The socket is closed.');
        client.disconnect();
        done();
      });
  });

});


text:
const getExemption = require('../lib/get-exemption');

module.exports = function(
	project,
) {
	let messages = [];
	let rule = 'T1';
	let exempt;
	if (exempt = getExemption(project.manifest, rule)) {
		messages.push({
			rule, level: 'info', location: 'project',
			path: `/projects/${project.name}/files/manifest.lkml`,
			description: `Project-level exemption: ${exempt}`,
		});
		return {messages};
	}
	let matchCt = 0;
	let exemptionCt = 0;
	let errorCt = 0;
	let files = project.files || [];

	for (let file of files) {
		let views = Object.values(file.view || {});
		for (let view of views) {
			if (!view.derived_table) {
				continue;
			}
			matchCt++;
			let exempt = getExemption(view.derived_table, rule) || getExemption(view, rule) || getExemption(file, rule);
			if (exempt) {
				exemptionCt++; continue;
			}

			let location = 'view: ' + view.$name;
			let path = '/projects/' + project.name + '/files/' + file.$file_path + '#view:' + view.$name;
			if (!(view.derived_table.datagroup_trigger || view.derived_table.persist_for)
				&& view.derived_table.sql_trigger_value) {
				errorCt++;
				messages.push({
					location, path, rule, exempt, level: 'error',
					description: `Triggered PDTs should use datagroups.`,
				});
			}
		}
	}

	messages.push({
		rule, level: 'info',
		description: `Evaluated ${matchCt} matches, with ${exemptionCt} exempt and ${errorCt} erroring`,
	});

	return {
		messages,
	};
};


text:
using System;
using System.Collections.Generic;
using System.Text;
using Umbraco.Cms.Core.Scoping;

namespace Umbraco.Extensions
{
    internal static class InstanceIdentifiableExtensions
    {
        public static string GetDebugInfo(this IInstanceIdentifiable instance)
        {
            if (instance == null)
            {
                return "(NULL)";
            }

            return $"(id: {instance.InstanceId.ToString("N").Substring(0, 8)} from thread: {instance.CreatedThreadId})";
        }
    }
}


text:
#pragma once
#include <aws/networkmanager/NetworkManager_EXPORTS.h>
#include <aws/networkmanager/model/RouteAnalysisCompletion.h>
#include <aws/core/utils/memory/stl/AWSVector.h>
#include <aws/networkmanager/model/PathComponent.h>
#include <utility>

namespace Aws
{
namespace Utils
{
namespace Json
{
  class JsonValue;
  class JsonView;
} // namespace Json
} // namespace Utils
namespace NetworkManager
{
namespace Model
{

  /**
   *
Describes a route analysis path.

See Also:
   AWS
   * API Reference

   */
  class AWS_NETWORKMANAGER_API RouteAnalysisPath
  {
  public:
    RouteAnalysisPath();
    RouteAnalysisPath(Aws::Utils::Json::JsonView jsonValue);
    RouteAnalysisPath& operator=(Aws::Utils::Json::JsonView jsonValue);
    Aws::Utils::Json::JsonValue Jsonize() const;

    /**
     *
The status of the analysis at completion.

     */
    inline const RouteAnalysisCompletion& GetCompletionStatus() const{ return m_completionStatus; }

    /**
     *
The status of the analysis at completion.

     */
    inline bool CompletionStatusHasBeenSet() const { return m_completionStatusHasBeenSet; }

    /**
     *
The status of the analysis at completion.

     */
    inline void SetCompletionStatus(const RouteAnalysisCompletion& value) { m_completionStatusHasBeenSet = true; m_completionStatus = value; }

    /**
     *
The status of the analysis at completion.

     */
    inline void SetCompletionStatus(RouteAnalysisCompletion&& value) { m_completionStatusHasBeenSet = true; m_completionStatus = std::move(value); }

    /**
     *
The status of the analysis at completion.

     */
    inline RouteAnalysisPath& WithCompletionStatus(const RouteAnalysisCompletion& value) { SetCompletionStatus(value); return *this;}

    /**
     *
The status of the analysis at completion.

     */
    inline RouteAnalysisPath& WithCompletionStatus(RouteAnalysisCompletion&& value) { SetCompletionStatus(std::move(value)); return *this;}

    /**
     *
The route analysis path.

     */
    inline const Aws::Vector<PathComponent>& GetPath() const{ return m_path; }

    /**
     *
The route analysis path.

     */
    inline bool PathHasBeenSet() const { return m_pathHasBeenSet; }

    /**
     *
The route analysis path.

     */
    inline void SetPath(const Aws::Vector<PathComponent>& value) { m_pathHasBeenSet = true; m_path = value; }

    /**
     *
The route analysis path.

     */
    inline void SetPath(Aws::Vector<PathComponent>&& value) { m_pathHasBeenSet = true; m_path = std::move(value); }

    /**
     *
The route analysis path.

     */
    inline RouteAnalysisPath& WithPath(const Aws::Vector<PathComponent>& value) { SetPath(value); return *this;}

    /**
     *
The route analysis path.

     */
    inline RouteAnalysisPath& WithPath(Aws::Vector<PathComponent>&& value) { SetPath(std::move(value)); return *this;}

    /**
     *
The route analysis path.

     */
    inline RouteAnalysisPath& AddPath(const PathComponent& value) { m_pathHasBeenSet = true; m_path.push_back(value); return *this; }

    /**
     *
The route analysis path.

     */
    inline RouteAnalysisPath& AddPath(PathComponent&& value) { m_pathHasBeenSet = true; m_path.push_back(std::move(value)); return *this; }

  private:

    RouteAnalysisCompletion m_completionStatus;
    bool m_completionStatusHasBeenSet = false;

    Aws::Vector<PathComponent> m_path;
    bool m_pathHasBeenSet = false;
  };

} // namespace Model
} // namespace NetworkManager
} // namespace Aws


text:
module Moose
  module Assertions
    extend self
    class AssertError < Moose::Error; end

    def default_compare_message(expected, actual)
      "\n|  Expected Value: #{expected}\n|    Actual Value: #{actual}"
    end

    def compare(expected:, actual:, message: default_compare_message(expected, actual))
      unless actual == expected
        raise AssertError, message
      end
      return true
    end

    def assert_present(locator)
      unless locator.available?
        raise AssertError, "FAIL: Expected #{locator.css} to be present"
      end
      return true
    end

    def assert_match(locator, match)
      unless locator.available? && locator.text =~ match
        raise AssertError, "FAIL: Expected #{locator.text} to match #{match}"
      end
      return true
    end
  end
end


text:
using autofill::PasswordForm;
using content::BrowserThread;
using content::WebContents;
using web_modal::WebContentsModalDialogManager;
using web_modal::WebContentsModalDialogManagerDelegate;

// ----------------------------------------------------------------------------
// LoginHandlerViews

// This class simply forwards the authentication from the LoginView (on
// the UI thread) to the net::URLRequest (on the I/O thread).
// This class uses ref counting to ensure that it lives until all InvokeLaters
// have been called.
class LoginHandlerViews : public LoginHandler,
                          public views::DialogDelegate {
 public:
  LoginHandlerViews(net::AuthChallengeInfo* auth_info, net::URLRequest* request)
      : LoginHandler(auth_info, request),
        login_view_(NULL),
        dialog_(NULL) {
  }

  // LoginModelObserver implementation.
  virtual void OnAutofillDataAvailable(
      const base::string16& username,
      const base::string16& password) OVERRIDE {
    // Nothing to do here since LoginView takes care of autofill for win.
  }
  virtual void OnLoginModelDestroying() OVERRIDE {}

  // views::DialogDelegate methods:
  virtual base::string16 GetDialogButtonLabel(
      ui::DialogButton button) const OVERRIDE {
    if (button == ui::DIALOG_BUTTON_OK)
      return l10n_util::GetStringUTF16(IDS_LOGIN_DIALOG_OK_BUTTON_LABEL);
    return DialogDelegate::GetDialogButtonLabel(button);
  }

  virtual base::string16 GetWindowTitle() const OVERRIDE {
    return l10n_util::GetStringUTF16(IDS_LOGIN_DIALOG_TITLE);
  }

  virtual void WindowClosing() OVERRIDE {
    DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

    WebContents* tab = GetWebContentsForLogin();
    if (tab)
      tab->GetRenderViewHost()->SetIgnoreInputEvents(false);

    // Reference is no longer valid.
    dialog_ = NULL;

    CancelAuth();
  }

  virtual void DeleteDelegate() OVERRIDE {
    DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

    // The widget is going to delete itself; clear our pointer.
    dialog_ = NULL;
    SetModel(NULL);

    ReleaseSoon();
  }

  virtual ui::ModalType GetModalType() const OVERRIDE {
#if defined(USE_ASH)
    return ui::MODAL_TYPE_CHILD;
#else
    return views::WidgetDelegate::GetModalType();
#endif
  }

  virtual bool Cancel() OVERRIDE {
    DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

    CancelAuth();
    return true;
  }

  virtual bool Accept() OVERRIDE {
    DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

    SetAuth(login_view_->GetUsername(), login_view_->GetPassword());
    return true;
  }

  virtual views::View* GetInitiallyFocusedView() OVERRIDE {
    return login_view_->GetInitiallyFocusedView();
  }

  virtual views::View* GetContentsView() OVERRIDE {
    return login_view_;
  }
  virtual views::Widget* GetWidget() OVERRIDE {
    return login_view_->GetWidget();
  }
  virtual const views::Widget* GetWidget() const OVERRIDE {
    return login_view_->GetWidget();
  }

  // LoginHandler:

  virtual void BuildViewForPasswordManager(
      PasswordManager* manager,
      const base::string16& explanation) OVERRIDE {
    DCHECK(BrowserThread::CurrentlyOn(BrowserThread::UI));

    // Create a new LoginView and set the model for it.  The model (password
    // manager) is owned by the WebContents, but the view is parented to the
    // browser window, so the view may be destroyed after the password
    // manager. The view listens for model destruction and unobserves
    // accordingly.
    login_view_ = new LoginView(explanation, manager);

    // Scary thread safety note: This can potentially be called *after* SetAuth
    // or CancelAuth (say, if the request was cancelled before the UI thread got
    // control).  However, that's OK since any UI interaction in those functions
    // will occur via an InvokeLater on the UI thread, which is guaranteed
    // to happen after this is called (since this was InvokeLater'd first).
    WebContents* requesting_contents = GetWebContentsForLogin();
    WebContentsModalDialogManager* web_contents_modal_dialog_manager =
        WebContentsModalDialogManager::FromWebContents(requesting_contents);
    WebContentsModalDialogManagerDelegate* modal_delegate =
        web_contents_modal_dialog_manager->delegate();
    CHECK(modal_delegate);
    dialog_ = views::Widget::CreateWindowAsFramelessChild(
        this, modal_delegate->GetWebContentsModalDialogHost()->GetHostView());
    web_contents_modal_dialog_manager->ShowDialog(dialog_->GetNativeView());
    NotifyAuthNeeded();
  }

  virtual void CloseDialog() OVERRIDE {
    // The hosting widget may have been freed.
    if (dialog_)
      dialog_->Close();
  }

 private:
  friend class base::RefCountedThreadSafe<LoginHandlerViews>;
  friend class LoginPrompt;

  virtual ~LoginHandlerViews() {}

  // The LoginView that contains the user's login information
  LoginView* login_view_;

  views::Widget* dialog_;

  DISALLOW_COPY_AND_ASSIGN(LoginHandlerViews);
};

// static
LoginHandler* LoginHandler::Create(net::AuthChallengeInfo* auth_info,
                                   net::URLRequest* request) {
  return new LoginHandlerViews(auth_info, request);
}


text:
"use strict";

module.exports = () => {
  const TAB = 0x9;
  const LF = 0xA;

  /**
   * class SourcePos(name: string, line: int, column: int) {
   *   static init(name: string): SourcePos;
   *   static equal(posA: SourcePos, posB; SourcePos): boolean;
   *   static compare(posA: SourcePos, posB: SourcePos): int;
   *   toString(): string;
   *   setName(name: string): SourcePos;
   *   setLine(line: int): SourcePos;
   *   setColumn(column: int): SourcePos;
   *   addChar(char: string, tabWidth: int): SourcePos;
   *   addString(str: string, tabWidth: int, unicode: boolean): SourcePos;
   * }
   *
   * `SourcePos` represents a position in input.
   */
  class SourcePos {
    /**
     * SourcePos.init(name: string): SourcePos
     *
     * Creates a new `SourcePos` with the initial position `(line, column) = (1, 1)`.
     */
    static init(name) {
      return new SourcePos(name, 1, 1);
    }

    /**
     * SourcePos.equal(posA: SourcePos, posB: SourcePos): boolean
     */
    static equal(posA, posB) {
      return posA.name   === posB.name
          && posA.line   === posB.line
          && posA.column === posB.column;
    }

    /**
     * SourcePos.compare(posA: SourcePos, posB: SourcePos): int
     *
     * Compares two positions. Returns negative number if `posA` is ahead of `posB`, positive if
     * `posA` is behind `posB`, and zero if two positions are equal.
     */
    static compare(posA, posB) {
      return posA.name   < posB.name   ? -1
           : posA.name   > posB.name   ? 1
           : posA.line   < posB.line   ? -1
           : posA.line   > posB.line   ? 1
           : posA.column < posB.column ? -1
           : posA.column > posB.column ? 1
                                       : 0;
    }

    constructor(name, line, column) {
      this._name   = name;
      this._line   = line;
      this._column = column;
    }

    get name() {
      return this._name;
    }

    get line() {
      return this._line;
    }

    get column() {
      return this._column;
    }

    /**
     * SourcePos#toString(): string
     *
     * Returns a human readable string representation of the position.
     */
    toString() {
      return (this.name === "" ? "" : `"${this.name}"`)
        + `(line ${this.line}, column ${this.column})`;
    }

    /**
     * SourcePos#setName(name: string): SourcePos
     *
     * Creates a copy of the position with `name` updated.
     */
    setName(name) {
      return new SourcePos(name, this.line, this.column);
    }

    /**
     * SourcePos#setLine(line: int): SourcePos
     *
     * Creates a copy of the position with `line` updated.
     */
    setLine(line) {
      return new SourcePos(this.name, line, this.column);
    }

    /**
     * SourcePos#setColumn(column: int): SourcePos
     *
     * Creates a copy of the position with `column` updated.
     */
    setColumn(column) {
      return new SourcePos(this.name, this.line, column);
    }

    /**
     * SourcePos#addChar(char: string, tabWidth: int): SourcePos
     *
     * Returns a new position that is offset from the original position by the given character.
     */
    addChar(char, tabWidth) {
      // For this case,
      // - `if` is faster than `switch`
      // - comparing strings is faster than character codes
      if (char === "") {
        return new SourcePos(this.name, this.line, this.column);
      } else if (char === "\n") {
        return new SourcePos(this.name, this.line + 1, 1);
      } else if (char === "\t") {
        return new SourcePos(
          this.name,
          this.line,
          this.column + tabWidth - (this.column - 1) % tabWidth
        );
      } else {
        return new SourcePos(this.name, this.line, this.column + 1);
      }
    }

    /**
     * SourcePos#addString(str: string, tabWidth: int, unicode: boolean): SourcePos
     *
     * Returns a new position that is offset from the original position by the given string.
     */
    addString(str, tabWidth, unicode) {
      // For this case,
      // - `switch` is faster than `if`
      // - comparing character codes is faster than strings
      let line = this.line;
      let column = this.column;
      if (unicode) {
        for (const char of str) {
          switch (char.charCodeAt(0)) {
          case LF:
            line += 1;
            column = 1;
            break;
          case TAB:
            column += tabWidth - (column - 1) % tabWidth;
            break;
          default:
            column += 1;
          }
        }
      } else {
        const len = str.length;
        for (let i = 0; i < len; i++) {
          switch (str.charCodeAt(i)) {
          case LF:
            line += 1;
            column = 1;
            break;
          case TAB:
            column += tabWidth - (column - 1) % tabWidth;
            break;
          default:
            column += 1;
          }
        }
      }
      return new SourcePos(this.name, line, column);
    }
  }

  return Object.freeze({
    SourcePos,
  });
};


text:
namespace {

void FillNeedsBlockError(const FunctionCallNode* function, Err* err) {
  *err = Err(function->function(), "This function call requires a block.",
      "The block's \"{\" must be on the same line as the function "
      "call's \")\".");
}

// This is called when a template is invoked. When we see a template
// declaration, that funciton is RunTemplate.
Value RunTemplateInvocation(Scope* scope,
                            const FunctionCallNode* invocation,
                            const std::vector<Value>& args,
                            BlockNode* block,
                            const FunctionCallNode* rule,
                            Err* err) {
  if (!EnsureNotProcessingImport(invocation, scope, err))
    return Value();
  Scope block_scope(scope);
  if (!FillTargetBlockScope(scope, invocation,
                            invocation->function().value().data(),
                            block, args, &block_scope, err))
    return Value();

  // Run the block for the rule invocation.
  block->ExecuteBlockInScope(&block_scope, err);
  if (err->has_error())
    return Value();

  // Now run the rule itself with that block as the current scope.
  rule->block()->ExecuteBlockInScope(&block_scope, err);
  if (err->has_error())
    return Value();

  return Value();
}

}  // namespace

// ----------------------------------------------------------------------------

bool EnsureNotProcessingImport(const ParseNode* node,
                               const Scope* scope,
                               Err* err) {
  if (scope->IsProcessingImport()) {
    *err = Err(node, "Not valid from an import.",
        "We need to talk about this thing you are doing here. Doing this\n"
        "kind of thing from an imported file makes me feel like you are\n"
        "abusing me. Imports are for defining defaults, variables, and rules.\n"
        "The appropriate place for this kind of thing is really in a normal\n"
        "BUILD file.");
    return false;
  }
  return true;
}

bool EnsureNotProcessingBuildConfig(const ParseNode* node,
                                    const Scope* scope,
                                    Err* err) {
  if (scope->IsProcessingBuildConfig()) {
    *err = Err(node, "Not valid from the build config.",
        "You can't do this kind of thing from the build config script, "
        "silly!\nPut it in a regular BUILD file.");
    return false;
  }
  return true;
}

bool FillTargetBlockScope(const Scope* scope,
                          const FunctionCallNode* function,
                          const char* target_type,
                          const BlockNode* block,
                          const std::vector<Value>& args,
                          Scope* block_scope,
                          Err* err) {
  if (!block) {
    FillNeedsBlockError(function, err);
    return false;
  }

  // Copy the target defaults, if any, into the scope we're going to execute
  // the block in.
  const Scope* default_scope = scope->GetTargetDefaults(target_type);
  if (default_scope) {
    if (!default_scope->NonRecursiveMergeTo(block_scope, function,
                                            "target defaults", err))
      return false;
  }

  // The name is the single argument to the target function.
  if (!EnsureSingleStringArg(function, args, err))
    return false;

  // Set the target name variable to the current target, and mark it used
  // because we don't want to issue an error if the script ignores it.
  const base::StringPiece target_name("target_name");
  block_scope->SetValue(target_name, Value(function, args[0].string_value()),
                        function);
  block_scope->MarkUsed(target_name);
  return true;
}

bool EnsureSingleStringArg(const FunctionCallNode* function,
                           const std::vector<Value>& args,
                           Err* err) {
  if (args.size() != 1) {
    *err = Err(function->function(), "Incorrect arguments.",
               "This function requires a single string argument.");
    return false;
  }
  return args[0].VerifyTypeIs(Value::STRING, err);
}

const SourceDir& SourceDirForFunctionCall(const FunctionCallNode* function) {
  return function->function().location().file()->dir();
}

const Label& ToolchainLabelForScope(const Scope* scope) {
  return scope->settings()->toolchain()->label();
}

Label MakeLabelForScope(const Scope* scope,
                        const FunctionCallNode* function,
                        const std::string& name) {
  const SourceDir& input_dir = SourceDirForFunctionCall(function);
  const Label& toolchain_label = ToolchainLabelForScope(scope);
  return Label(input_dir, name, toolchain_label.dir(), toolchain_label.name());
}

namespace functions {

// assert ----------------------------------------------------------------------

const char kAssert[] = "assert";
const char kAssert_Help[] =
    "TODO(brettw) WRITE ME";

Value RunAssert(Scope* scope,
                const FunctionCallNode* function,
                const std::vector<Value>& args,
                Err* err) {
  if (args.size() != 1) {
    *err = Err(function->function(), "Wrong number of arguments.",
               "assert() takes one argument, "
               "were you expecting somethig else?");
  } else if (args[0].InterpretAsInt() == 0) {
    *err = Err(function->function(), "Assertion failed.");
    if (args[0].origin()) {
      // If you do "assert(foo)" we'd ideally like to show you where foo was
      // set, and in this case the origin of the args will tell us that.
      // However, if you do "assert(foo && bar)" the source of the value will
      // be the assert like, which isn't so helpful.
      //
      // So we try to see if the args are from the same line or not. This will
      // break if you do "assert(\nfoo && bar)" and we may show the second line
      // as the source, oh well. The way around this is to check to see if the
      // origin node is inside our function call block.
      Location origin_location = args[0].origin()->GetRange().begin();
      if (origin_location.file() != function->function().location().file() ||
          origin_location.line_number() !=
              function->function().location().line_number()) {
        err->AppendSubErr(Err(args[0].origin()->GetRange(), "",
                              "This is where it was set."));
      }
    }
  }
  return Value();
}

// config ----------------------------------------------------------------------

const char kConfig[] = "config";
const char kConfig_Help[] =
    "TODO(brettw) write this.";

Value RunConfig(const FunctionCallNode* function,
                const std::vector<Value>& args,
                Scope* scope,
                Err* err) {
  if (!EnsureSingleStringArg(function, args, err) ||
      !EnsureNotProcessingImport(function, scope, err))
    return Value();

  Label label(MakeLabelForScope(scope, function, args[0].string_value()));

  if (g_scheduler->verbose_logging())
    g_scheduler->Log("Generating config", label.GetUserVisibleName(true));

  // Create the empty config object.
  ItemTree* tree = &scope->settings()->build_settings()->item_tree();
  Config* config = Config::GetConfig(scope->settings(), function->GetRange(),
                                     label, NULL, err);
  if (err->has_error())
    return Value();

  // Fill it.
  const SourceDir input_dir = SourceDirForFunctionCall(function);
  ConfigValuesGenerator gen(&config->config_values(), scope,
                            function->function(), input_dir, err);
  gen.Run();
  if (err->has_error())
    return Value();

  // Mark as complete.
  {
    base::AutoLock lock(tree->lock());
    tree->MarkItemDefinedLocked(scope->settings()->build_settings(), label,
                                err);
  }
  return Value();
}

// declare_args ----------------------------------------------------------------

const char kDeclareArgs[] = "declare_args";
const char kDeclareArgs_Help[] =
    "TODO(brettw) write this.";

Value RunDeclareArgs(const FunctionCallNode* function,
                     const std::vector<Value>& args,
                     Scope* scope,
                     Err* err) {
  // Only allow this to be called once. We use a variable in the current scope
  // with a name the parser will reject if the user tried to type it.
  const char did_declare_args_var[] = "@@declared_args";
  if (scope->GetValue(did_declare_args_var)) {
    *err = Err(function->function(), "Duplicate call to declared_args.");
    err->AppendSubErr(
        Err(scope->GetValue(did_declare_args_var)->origin()->GetRange(),
                            "See the original call."));
    return Value();
  }

  // Find the root scope where the values will be set.
  Scope* root = scope->mutable_containing();
  if (!root || root->containing() || !scope->IsProcessingBuildConfig()) {
    *err = Err(function->function(), "declare_args called incorrectly."
        "It must be called only from the build config script and in the "
        "root scope.");
    return Value();
  }

  // Take all variables set in the current scope as default values and put
  // them in the parent scope. The values in the current scope are the defaults,
  // then we apply the external args to this list.
  Scope::KeyValueVector values;
  scope->GetCurrentScopeValues(&values);
  for (size_t i = 0; i < values.size(); i++) {
    // TODO(brettw) actually import the arguments from the command line rather
    // than only using the defaults.
    root->SetValue(values[i].first, values[i].second,
                   values[i].second.origin());
  }

  scope->SetValue(did_declare_args_var, Value(function, 1), NULL);
  return Value();
}

// import ----------------------------------------------------------------------

const char kImport[] = "import";
const char kImport_Help[] =
    "import: Import a file into the current scope.\n"
    "\n"
    "  The import command loads the rules and variables resulting from\n"
    "  executing the given file into the current scope.\n"
    "\n"
    "  By convention, imported files are named with a .gni extension.\n"
    "\n"
    "  It does not do an \"include\". The imported file is executed in a\n"
    "  standalone environment from the caller of the import command. The\n"
    "  results of this execution are cached for other files that import the\n"
    "  same .gni file.\n"
    "\n"
    "  Note that you can not import a BUILD.gn file that's otherwise used\n"
    "  in the build. Files must either be imported or implicitly loaded as\n"
    "  a result of deps rules, but not both.\n"
    "\n"
    "  The imported file's scope will be merged with the scope at the point\n"
    "  import was called. If there is a conflict (both the current scope and\n"
    "  the imported file define some variable or rule with the same name)\n"
    "  a runtime error will be thrown. Therefore, it's good practice to\n"
    "  minimize the stuff that an imported file defines.\n"
    "\n"
    "Examples:\n"
    "\n"
    "  import(\"//build/rules/idl_compilation_rule.gni\")\n"
    "\n"
    "  # Looks in the current directory.\n"
    "  import(\"my_vars.gni\")\n";

Value RunImport(Scope* scope,
                const FunctionCallNode* function,
                const std::vector<Value>& args,
                Err* err) {
  if (!EnsureSingleStringArg(function, args, err) ||
      !EnsureNotProcessingImport(function, scope, err))
    return Value();

  const SourceDir input_dir = SourceDirForFunctionCall(function);
  SourceFile import_file =
      input_dir.ResolveRelativeFile(args[0].string_value());
  scope->settings()->import_manager().DoImport(import_file, function,
                                               scope, err);
  return Value();
}

// set_defaults ----------------------------------------------------------------

const char kSetDefaults[] = "set_defaults";
const char kSetDefaults_Help[] =
    "TODO(brettw) write this.";

Value RunSetDefaults(Scope* scope,
                     const FunctionCallNode* function,
                     const std::vector<Value>& args,
                     BlockNode* block,
                     Err* err) {
  if (!EnsureSingleStringArg(function, args, err))
    return Value();
  const std::string& target_type(args[0].string_value());

  // Ensure there aren't defaults already set.
  if (scope->GetTargetDefaults(target_type)) {
    *err = Err(function->function(),
               "This target type defaults were already set.");
    return Value();
  }

  // Execute the block in a new scope that has a parent of the containing
  // scope.
  Scope block_scope(scope);
  if (!FillTargetBlockScope(scope, function,
                            function->function().value().data(),
                            block, args, &block_scope, err))
    return Value();

  // Run the block for the rule invocation.
  block->ExecuteBlockInScope(&block_scope, err);
  if (err->has_error())
    return Value();

  // Now copy the values set on the scope we made into the free-floating one
  // (with no containing scope) used to hold the target defaults.
  Scope* dest = scope->MakeTargetDefaults(target_type);
  block_scope.NonRecursiveMergeTo(dest, function, "<SHOULD NOT FAIL>", err);
  return Value();
}

// set_sources_assignment_filter -----------------------------------------------

const char kSetSourcesAssignmentFilter[] = "set_sources_assignment_filter";
const char kSetSourcesAssignmentFilter_Help[] =
    "TODO(brettw) write this.";

Value RunSetSourcesAssignmentFilter(Scope* scope,
                                    const FunctionCallNode* function,
                                    const std::vector<Value>& args,
                                    Err* err) {
  if (args.size() != 1) {
    *err = Err(function, "set_sources_assignment_filter takes one argument.");
  } else {
    scoped_ptr<PatternList> f(new PatternList);
    f->SetFromValue(args[0], err);
    if (!err->has_error())
      scope->set_sources_assignment_filter(f.Pass());
  }
  return Value();
}

// print -----------------------------------------------------------------------

const char kPrint[] = "print";
const char kPrint_Help[] =
    "print(...)\n"
    "  Prints all arguments to the console separated by spaces. A newline is\n"
    "  automatically appended to the end.\n"
    "\n"
    "  This function is intended for debugging. Note that build files are run\n"
    "  in parallel so you may get interleaved prints. A buildfile may also\n"
    "  be executed more than once in parallel in the context of different\n"
    "  toolchains so the prints from one file may be duplicated or\n"
    "  interleaved with itself.\n"
    "\n"
    "Examples:\n"
    "  print(\"Hello world\")\n"
    "\n"
    "  print(sources, deps)\n";

Value RunPrint(Scope* scope,
               const FunctionCallNode* function,
               const std::vector<Value>& args,
               Err* err) {
  for (size_t i = 0; i < args.size(); i++) {
    if (i != 0)
      std::cout << " ";
    std::cout << args[i].ToString();
  }
  std::cout << std::endl;
  return Value();
}

// -----------------------------------------------------------------------------

FunctionInfo::FunctionInfo()
    : generic_block_runner(NULL),
      executed_block_runner(NULL),
      no_block_runner(NULL),
      help(NULL) {
}

FunctionInfo::FunctionInfo(GenericBlockFunction gbf, const char* in_help)
    : generic_block_runner(gbf),
      executed_block_runner(NULL),
      no_block_runner(NULL),
      help(in_help) {
}

FunctionInfo::FunctionInfo(ExecutedBlockFunction ebf, const char* in_help)
    : generic_block_runner(NULL),
      executed_block_runner(ebf),
      no_block_runner(NULL),
      help(in_help) {
}

FunctionInfo::FunctionInfo(NoBlockFunction nbf, const char* in_help)
    : generic_block_runner(NULL),
      executed_block_runner(NULL),
      no_block_runner(nbf),
      help(in_help) {
}

// Setup the function map via a static initializer. We use this because it
// avoids race conditions without having to do some global setup function or
// locking-heavy singleton checks at runtime. In practice, we always need this
// before we can do anything interesting, so it's OK to wait for the
// initializer.
struct FunctionInfoInitializer {
  FunctionInfoMap map;

  FunctionInfoInitializer() {
    #define INSERT_FUNCTION(command) \
        map[k##command] = FunctionInfo(&Run##command, k##command##_Help);

    INSERT_FUNCTION(Assert)
    INSERT_FUNCTION(Component)
    INSERT_FUNCTION(Config)
    INSERT_FUNCTION(Copy)
    INSERT_FUNCTION(Custom)
    INSERT_FUNCTION(DeclareArgs)
    INSERT_FUNCTION(ExecScript)
    INSERT_FUNCTION(Executable)
    INSERT_FUNCTION(Group)
    INSERT_FUNCTION(Import)
    INSERT_FUNCTION(Print)
    INSERT_FUNCTION(ProcessFileTemplate)
    INSERT_FUNCTION(ReadFile)
    INSERT_FUNCTION(SetDefaults)
    INSERT_FUNCTION(SetDefaultToolchain)
    INSERT_FUNCTION(SetSourcesAssignmentFilter)
    INSERT_FUNCTION(SharedLibrary)
    INSERT_FUNCTION(StaticLibrary)
    INSERT_FUNCTION(Template)
    INSERT_FUNCTION(Test)
    INSERT_FUNCTION(Tool)
    INSERT_FUNCTION(Toolchain)
    INSERT_FUNCTION(WriteFile)

    #undef INSERT_FUNCTION
  }
};
const FunctionInfoInitializer function_info;

const FunctionInfoMap& GetFunctions() {
  return function_info.map;
}

Value RunFunction(Scope* scope,
                  const FunctionCallNode* function,
                  const std::vector<Value>& args,
                  BlockNode* block,
                  Err* err) {
  const Token& name = function->function();

  const FunctionInfoMap& function_map = GetFunctions();
  FunctionInfoMap::const_iterator found_function =
      function_map.find(name.value());
  if (found_function == function_map.end()) {
    // No build-in function matching this, check for a template.
    const FunctionCallNode* rule =
        scope->GetTemplate(function->function().value().as_string());
    if (rule)
      return RunTemplateInvocation(scope, function, args, block, rule, err);

    *err = Err(name, "Unknown function.");
    return Value();
  }

  if (found_function->second.generic_block_runner) {
    if (!block) {
      FillNeedsBlockError(function, err);
      return Value();
    }
    return found_function->second.generic_block_runner(
        scope, function, args, block, err);
  }

  if (found_function->second.executed_block_runner) {
    if (!block) {
      FillNeedsBlockError(function, err);
      return Value();
    }

    Scope block_scope(scope);
    block->ExecuteBlockInScope(&block_scope, err);
    if (err->has_error())
      return Value();
    return found_function->second.executed_block_runner(
        function, args, &block_scope, err);
  }

  // Otherwise it's a no-block function.
  return found_function->second.no_block_runner(scope, function, args, err);
}

}  // namespace functions


text:
<?php

namespace Ems\Cache\Storage;

use Ems\Contracts\Cache\Storage;
use DateTime;
use Ems\Testing\LoggingCallable;
use Mockery as m;

class ArrayStorageTest extends \Ems\TestCase
{
    public function test_implements_interface()
    {
        $this->assertInstanceOf(Storage::class, $this->newStorage());
    }

    public function test_escape_returns_nonempty_string()
    {
        $this->assertTrue(is_string($this->newStorage()->escape('foo')));
        $this->assertTrue(strlen($this->newStorage()->escape('foo')) > 2);
    }

    public function test_get_returns_putted_value()
    {
        $storage = $this->newStorage();
        $this->assertNull($storage->get('foo'));
        $storage->put('foo', 'bar', ['a', 'b']);
        $this->assertEquals('bar', $storage->get('foo'));
    }

    public function test_several_returns_putted_values()
    {
        $storage = $this->newStorage();
        $this->assertNull($storage->get('foo'));
        $storage->put('foo', 'bar');
        $storage->put('foo2', 'bor');
        $this->assertEquals(['foo' => 'bar', 'foo2' => 'bor'], $storage->several(['foo', 'foo2']));
    }

    public function test_increment_increments_number()
    {
        $storage = $this->newStorage();
        $this->assertEquals(1, $storage->increment('foo', 1));
        $this->assertEquals(1, $storage->increment('bar', 1));
        $this->assertEquals(2, $storage->increment('foo', 1));
        $this->assertEquals(4, $storage->increment('foo', 2));
    }

    public function test_increment_and_decrement_number()
    {
        $storage = $this->newStorage();
        $this->assertEquals(1, $storage->increment('foo', 1));
        $this->assertEquals(1, $storage->increment('bar', 1));
        $this->assertEquals(2, $storage->increment('foo', 1));
        $this->assertEquals(4, $storage->increment('foo', 2));
        $this->assertEquals(3, $storage->decrement('foo', 1));

        $this->assertEquals(-1, $storage->decrement('php', 1));
    }

    public function test_clear_deletes_all_putted_values()
    {
        $storage = $this->newStorage();
        $this->assertNull($storage->get('foo'));
        $storage->put('foo', 'bar', ['a', 'b']);
        $this->assertEquals('bar', $storage->get('foo'));
        $storage->put('foo2', 'bar2', ['a', 'b']);
        $this->assertEquals('bar2', $storage->get('foo2'));

        $storage->clear();
        $this->assertNull($storage->get('foo'));
        $this->assertNull($storage->get('foo2'));
    }

    public function test_forget_deletes_putted_values()
    {
        $storage = $this->newStorage();
        $this->assertNull($storage->get('foo'));

        $storage->put('foo', 'bar', ['a', 'b']);
        $this->assertEquals('bar', $storage->get('foo'));

        $storage->put('foo2', 'bar2', ['a', 'b']);
        $this->assertEquals('bar2', $storage->get('foo2'));

        $storage->forget('foo');
        $this->assertNull($storage->get('foo'));
        $this->assertEquals('bar2', $storage->get('foo2'));
        $storage->forget('foo2');
        $this->assertNull($storage->get('foo2'));
    }

    public function test_prune_deletes_tagged_values()
    {
        $storage = $this->newStorage();
        $this->assertNull($storage->get('foo'));

        $storage->put('foo', 'bar', ['a', 'b']);
        $this->assertEquals('bar', $storage->get('foo'));

        $storage->put('foo2', 'bar2', ['c', 'd']);
        $this->assertEquals('bar2', $storage->get('foo2'));

        $storage->put('foo3', 'bar3', ['b']);
        $this->assertEquals('bar3', $storage->get('foo3'));

        $storage->prune(['b', 'e']);

        $this->assertNull($storage->get('foo'));
        $this->assertEquals('bar2', $storage->get('foo2'));
        $this->assertNull($storage->get('foo3'));
    }

    protected function newStorage()
    {
        return new ArrayStorage();
    }
}


text:
#ifndef MINIASCAPE_RANDOM_STATE_GENERATOR
#define MINIASCAPE_RANDOM_STATE_GENERATOR
#include <random>

namespace miniascape
{

class RandomNumberGenerator
{
  public:
    RandomNumberGenerator(const unsigned int seed): seed_(seed), mt_(seed){}
    ~RandomNumberGenerator() = default;

    template<typename T>
    T uniform_int(const T begin, const T end)
    {
        return (std::uniform_int_distribution<T>(begin, end))(this->mt_);
    }

    template<typename T>
    T uniform_real(const T begin, const T end)
    {
        return (std::uniform_real_distribution<T>(begin, end))(this->mt_);
    }

    unsigned int seed() const {return seed_;}

  private:
    const unsigned int seed_;
    std::mt19937 mt_;
};

template<typename T_state>
class RandomStateGenerator{};

}

#endif /* MINIASCAPE_RANDOM_STATE_GENERATOR */


text:
package com.zxytech.designpatterns.gof.behavioralpatterns.statepattern;

/**
 * Created by ryan on 2016/12/18.
 */
public class StopState implements State {
    public void doAction(Context context) {
        System.out.println("Player is in stop state.");
        context.setState(this);
    }

    public String toString() {
        return "Stop State.";
    }
}


text:
import { TRELLO_APP_KEY, TRELLO_API_URL } from '../../environment';
import { handleFetchResponse } from './Fetch';
import { URIPrefix } from './Navigation';

export default class {
  static getLoginURL = () =>
    TRELLO_API_URL +
    '/authorize?' +
    `key=${TRELLO_APP_KEY}&` +
    'expiration=never&' +
    'name=DailyScrum&' +
    `return_url=${encodeURIComponent(URIPrefix)}login&` +
    'scope=read,account';

  static getCurrentUser = token =>
    fetch(
      `${TRELLO_API_URL}/members/me?fields=avatarHash,email,fullName,id,initials,username&key=${TRELLO_APP_KEY}&token=${token}`
    ).then(handleFetchResponse);

  static getBoards = token =>
    fetch(
      `${TRELLO_API_URL}/members/me/boards?filter=open&fields=name,prefs,dateLastActivity&key=${TRELLO_APP_KEY}&token=${token}`
    )
      .then(handleFetchResponse)
      .then(boards =>
        boards.sort((a, b) => new Date(b.dateLastActivity).getTime() - new Date(a.dateLastActivity).getTime())
      );

  static getCardsFromList = (token, listId) =>
    fetch(
      `${TRELLO_API_URL}/lists/${listId}/cards?fields=id,idShort,idMembers,name,dateLastActivity,shortUrl,labels&actions=updateCard:idList&key=${TRELLO_APP_KEY}&token=${token}`
    ).then(handleFetchResponse);

  static getCardsFromBoard = (token, boardId) =>
    fetch(`${TRELLO_API_URL}/boards/${boardId}/cards?fields=id,labels,name&key=${TRELLO_APP_KEY}&token=${token}`).then(
      handleFetchResponse
    );
}

export const idToTimestampCreated = id => 1000 * parseInt(id.substring(0, 8), 16);

export const getPoints = text => {
  const points = text.match(/\(([0-9]*\.?[0-9]+)\)/);
  if (!points) return null;
  return Number(points[1]);
};

export const getPostPoints = text => {
  const points = text.match(/\[([0-9]*\.?[0-9]+)]/);
  if (!points) return null;
  return Number(points[1]);
};


text:
<?xml version="1.0" encoding="utf-8"?>
<plasterManifest schemaVersion="1.0"
  xmlns="http://www.microsoft.com/schemas/PowerShell/Plaster/v1">
  <metadata>
    <name>FullModuleTemplate</name>
    <id>abe7c8b0-2b42-4db8-8bfc-f4a61487d29c</id>
    <version>0.1.0</version>
    <title>Full Module Template</title>
    <description></description>
    <author>Kevin Marquette</author>
    <tags></tags>
  </metadata>
  <parameters>
    <parameter name="ModuleName" type="text" prompt="Name of your module" default="${PLASTER_DestinationName}"/>
    <parameter name="ModuleDesc" type="text" prompt="Brief description on this module" default="${PLASTER_ModuleName}"/>
    <parameter name="GitHubRepo" type="text" prompt="Github repo name for this module" default="${PLASTER_PARAM_ModuleName}"/>
    <parameter name="GitHubUserName" type="user-fullname" prompt="GitHub username" default="${PLASTER_PARAM_FullName}"/>
    <parameter name="FullName" type="text" prompt="Module author's' name" default="${PLASTER_PARAM_GitHubUserName}"/>
  </parameters>
  <content>
    <message>      Creating folder structure    </message>
    <file source='' destination='demos'/>
    <file source='' destination='docs\images'/>
    <file source='' destination='tests'/>
    <file source='' destination='spec'/>
    <file source='' destination='tests'/>
    <file source='' destination='.vscode'/>
    <file source='' destination='${PLASTER_PARAM_ModuleName}\public'/>
    <file source='' destination='${PLASTER_PARAM_ModuleName}\private'/>
    <file source='' destination='${PLASTER_PARAM_ModuleName}\classes'/>
    <file source='' destination='${PLASTER_PARAM_ModuleName}\data'/>
    <message>      Deploying files    </message>
    <file source='.vsts-ci.yml' destination=''/>
    <templateFile source='appveyor.yml' destination=''/>
    <file source='build.depend.psd1' destination=''/>
    <file source='build.ps1' destination=''/>
    <file source='deploy.PSDeploy.ps1' destination=''/>
    <file source='test.depend.psd1' destination=''/>
    <file source='.gitignore' destination=''/>
    <file source='.vscode\launch.json' destination=''/>
	<file source='.vscode\PSScriptAnalyzerSettings.psd1' destination=''/>
    <file source='.vscode\settings.json' destination=''/>
    <file source='spec\module.Steps.ps1' destination=''/>
    <templateFile source='mkdocs.yml' destination=''/>
    <templateFile source='PITCHME.md' destination=''/>
    <templateFile source='readme.md' destination=''/>
    <templateFile source='LICENSE' destination=''/>
    <file source='module.build.ps1' destination=''/>
    <file source='demos\run-compiled.bat' destination=''/>
    <templateFile source='demos\run-compiled.ps1' destination=''/>
    <file source='demos\run-sources.bat' destination=''/>
    <templateFile source='demos\run-sources.ps1' destination=''/>
    <file source='demos\Set-PSModulePath.ps1' destination=''/>
    <templateFile source='docs\about.md' destination=''/>
    <templateFile source='docs\acknowledgements.md' destination=''/>
    <templateFile source='docs\index.md' destination=''/>
    <templateFile source='docs\Quick-Start-Installation-and-Example.md' destination=''/>
    <templateFile source='tests\Project.Tests.ps1' destination=''/>
    <templateFile source='tests\Help.Tests.ps1' destination=''/>
    <templateFile source='tests\Feature.Tests.ps1' destination=''/>
    <templateFile source='tests\Regression.Tests.ps1' destination=''/>
    <templateFile source='tests\Unit.Tests.ps1' destination=''/>
    <templateFile source='tests\Unload-SUT.ps1' destination=''/>
    <templateFile source='spec\module.feature' destination=''/>
    <file source='module\module.psm1' destination='${PLASTER_PARAM_ModuleName}\${PLASTER_PARAM_ModuleName}.psm1'/>
    <templateFile source='module\module.psd1' destination='${PLASTER_PARAM_ModuleName}\${PLASTER_PARAM_ModuleName}.psd1'/>
  </content>
</plasterManifest>