diff --git "a/sample.jsonl" "b/sample.jsonl" new file mode 100644--- /dev/null +++ "b/sample.jsonl" @@ -0,0 +1,500 @@ +{"id": "ghcc-00064-44759cd5847a8be9", "source": "codeparrot/github-code-clean", "repo": "Azure/azure-sdk-for-python", "license": "mit", "language": "Python", "path": "sdk/iothub/azure-mgmt-iothub/azure/mgmt/iothub/v2019_11_04/models/_iot_hub_client_enums.py", "text": "# coding=utf-8\n# --------------------------------------------------------------------------\n# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License. See License.txt in the project root for license information.\n# Code generated by Microsoft (R) AutoRest Code Generator.\n# Changes may cause incorrect behavior and will be lost if the code is regenerated.\n# --------------------------------------------------------------------------\n\nfrom enum import Enum\nfrom six import with_metaclass\nfrom azure.core import CaseInsensitiveEnumMeta\n\n\nclass AccessRights(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):\n \"\"\"The permissions assigned to the shared access policy.\n \"\"\"\n\n REGISTRY_READ = \"RegistryRead\"\n REGISTRY_WRITE = \"RegistryWrite\"\n SERVICE_CONNECT = \"ServiceConnect\"\n DEVICE_CONNECT = \"DeviceConnect\"\n REGISTRY_READ_REGISTRY_WRITE = \"RegistryRead, RegistryWrite\"\n REGISTRY_READ_SERVICE_CONNECT = \"RegistryRead, ServiceConnect\"\n REGISTRY_READ_DEVICE_CONNECT = \"RegistryRead, DeviceConnect\"\n REGISTRY_WRITE_SERVICE_CONNECT = \"RegistryWrite, ServiceConnect\"\n REGISTRY_WRITE_DEVICE_CONNECT = \"RegistryWrite, DeviceConnect\"\n SERVICE_CONNECT_DEVICE_CONNECT = \"ServiceConnect, DeviceConnect\"\n REGISTRY_READ_REGISTRY_WRITE_SERVICE_CONNECT = \"RegistryRead, RegistryWrite, ServiceConnect\"\n REGISTRY_READ_REGISTRY_WRITE_DEVICE_CONNECT = \"RegistryRead, RegistryWrite, DeviceConnect\"\n REGISTRY_READ_SERVICE_CONNECT_DEVICE_CONNECT = \"RegistryRead, ServiceConnect, DeviceConnect\"\n REGISTRY_WRITE_SERVICE_CONNECT_DEVICE_CONNECT = \"RegistryWrite, ServiceConnect, DeviceConnect\"\n REGISTRY_READ_REGISTRY_WRITE_SERVICE_CONNECT_DEVICE_CONNECT = \"RegistryRead, RegistryWrite, ServiceConnect, DeviceConnect\"\n\nclass Capabilities(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):\n \"\"\"The capabilities and features enabled for the IoT hub.\n \"\"\"\n\n NONE = \"None\"\n DEVICE_MANAGEMENT = \"DeviceManagement\"\n\nclass EndpointHealthStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):\n \"\"\"Health statuses have following meanings. The 'healthy' status shows that the endpoint is\n accepting messages as expected. The 'unhealthy' status shows that the endpoint is not accepting\n messages as expected and IoT Hub is retrying to send data to this endpoint. The status of an\n unhealthy endpoint will be updated to healthy when IoT Hub has established an eventually\n consistent state of health. The 'dead' status shows that the endpoint is not accepting\n messages, after IoT Hub retried sending messages for the retrial period. See IoT Hub metrics to\n identify errors and monitor issues with endpoints. The 'unknown' status shows that the IoT Hub\n has not established a connection with the endpoint. No messages have been delivered to or\n rejected from this endpoint\n \"\"\"\n\n UNKNOWN = \"unknown\"\n HEALTHY = \"healthy\"\n UNHEALTHY = \"unhealthy\"\n DEAD = \"dead\"\n\nclass IotHubNameUnavailabilityReason(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):\n \"\"\"The reason for unavailability.\n \"\"\"\n\n INVALID = \"Invalid\"\n ALREADY_EXISTS = \"AlreadyExists\"\n\nclass IotHubReplicaRoleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):\n \"\"\"The role of the region, can be either primary or secondary. The primary region is where the IoT\n hub is currently provisioned. The secondary region is the Azure disaster recovery (DR) paired\n region and also the region where the IoT hub can failover to.\n \"\"\"\n\n PRIMARY = \"primary\"\n SECONDARY = \"secondary\"\n\nclass IotHubScaleType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):\n \"\"\"The type of the scaling enabled.\n \"\"\"\n\n AUTOMATIC = \"Automatic\"\n MANUAL = \"Manual\"\n NONE = \"None\"\n\nclass IotHubSku(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):\n \"\"\"The name of the SKU.\n \"\"\"\n\n F1 = \"F1\"\n S1 = \"S1\"\n S2 = \"S2\"\n S3 = \"S3\"\n B1 = \"B1\"\n B2 = \"B2\"\n B3 = \"B3\"\n\nclass IotHubSkuTier(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):\n \"\"\"The billing tier for the IoT hub.\n \"\"\"\n\n FREE = \"Free\"\n STANDARD = \"Standard\"\n BASIC = \"Basic\"\n\nclass IpFilterActionType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):\n \"\"\"The desired action for requests captured by this rule.\n \"\"\"\n\n ACCEPT = \"Accept\"\n REJECT = \"Reject\"\n\nclass JobStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):\n \"\"\"The status of the job.\n \"\"\"\n\n UNKNOWN = \"unknown\"\n ENQUEUED = \"enqueued\"\n RUNNING = \"running\"\n COMPLETED = \"completed\"\n FAILED = \"failed\"\n CANCELLED = \"cancelled\"\n\nclass JobType(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):\n \"\"\"The type of the job.\n \"\"\"\n\n UNKNOWN = \"unknown\"\n EXPORT = \"export\"\n IMPORT_ENUM = \"import\"\n BACKUP = \"backup\"\n READ_DEVICE_PROPERTIES = \"readDeviceProperties\"\n WRITE_DEVICE_PROPERTIES = \"writeDeviceProperties\"\n UPDATE_DEVICE_CONFIGURATION = \"updateDeviceConfiguration\"\n REBOOT_DEVICE = \"rebootDevice\"\n FACTORY_RESET_DEVICE = \"factoryResetDevice\"\n FIRMWARE_UPDATE = \"firmwareUpdate\"\n\nclass RouteErrorSeverity(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):\n \"\"\"Severity of the route error\n \"\"\"\n\n ERROR = \"error\"\n WARNING = \"warning\"\n\nclass RoutingSource(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):\n \"\"\"The source that the routing rule is to be applied to, such as DeviceMessages.\n \"\"\"\n\n INVALID = \"Invalid\"\n DEVICE_MESSAGES = \"DeviceMessages\"\n TWIN_CHANGE_EVENTS = \"TwinChangeEvents\"\n DEVICE_LIFECYCLE_EVENTS = \"DeviceLifecycleEvents\"\n DEVICE_JOB_LIFECYCLE_EVENTS = \"DeviceJobLifecycleEvents\"\n\nclass RoutingStorageContainerPropertiesEncoding(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):\n \"\"\"Encoding that is used to serialize messages to blobs. Supported values are 'avro',\n 'avrodeflate', and 'JSON'. Default value is 'avro'.\n \"\"\"\n\n AVRO = \"Avro\"\n AVRO_DEFLATE = \"AvroDeflate\"\n JSON = \"JSON\"\n\nclass TestResultStatus(with_metaclass(CaseInsensitiveEnumMeta, str, Enum)):\n \"\"\"Result of testing route\n \"\"\"\n\n UNDEFINED = \"undefined\"\n FALSE = \"false\"\n TRUE = \"true\"\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00066-5fc35feef1b2c11d", "source": "codeparrot/github-code-clean", "repo": "selvasingh/azure-sdk-for-java", "license": "mit", "language": "Java", "path": "sdk/network/mgmt-v2020_06_01/src/main/java/com/microsoft/azure/management/network/v2020_06_01/IssueType.java", "text": "/**\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for\n * license information.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n */\n\npackage com.microsoft.azure.management.network.v2020_06_01;\n\nimport java.util.Collection;\nimport com.fasterxml.jackson.annotation.JsonCreator;\nimport com.microsoft.rest.ExpandableStringEnum;\n\n/**\n * Defines values for IssueType.\n */\npublic final class IssueType extends ExpandableStringEnum {\n /** Static value Unknown for IssueType. */\n public static final IssueType UNKNOWN = fromString(\"Unknown\");\n\n /** Static value AgentStopped for IssueType. */\n public static final IssueType AGENT_STOPPED = fromString(\"AgentStopped\");\n\n /** Static value GuestFirewall for IssueType. */\n public static final IssueType GUEST_FIREWALL = fromString(\"GuestFirewall\");\n\n /** Static value DnsResolution for IssueType. */\n public static final IssueType DNS_RESOLUTION = fromString(\"DnsResolution\");\n\n /** Static value SocketBind for IssueType. */\n public static final IssueType SOCKET_BIND = fromString(\"SocketBind\");\n\n /** Static value NetworkSecurityRule for IssueType. */\n public static final IssueType NETWORK_SECURITY_RULE = fromString(\"NetworkSecurityRule\");\n\n /** Static value UserDefinedRoute for IssueType. */\n public static final IssueType USER_DEFINED_ROUTE = fromString(\"UserDefinedRoute\");\n\n /** Static value PortThrottled for IssueType. */\n public static final IssueType PORT_THROTTLED = fromString(\"PortThrottled\");\n\n /** Static value Platform for IssueType. */\n public static final IssueType PLATFORM = fromString(\"Platform\");\n\n /**\n * Creates or finds a IssueType from its string representation.\n * @param name a name to look for\n * @return the corresponding IssueType\n */\n @JsonCreator\n public static IssueType fromString(String name) {\n return fromString(name, IssueType.class);\n }\n\n /**\n * @return known IssueType values\n */\n public static Collection values() {\n return values(IssueType.class);\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-d955a48b8572d19b", "source": "codeparrot/github-code-clean", "repo": "JianpingZeng/xcc", "license": "bsd-3-clause", "language": "C++", "path": "xcc/test/juliet/testcases/CWE122_Heap_Based_Buffer_Overflow/s02/CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_char_ncpy_82a.cpp", "text": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_char_ncpy_82a.cpp\r\nLabel Definition File: CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805.string.label.xml\r\nTemplate File: sources-sink-82a.tmpl.cpp\r\n*/\r\n/*\r\n * @description\r\n * CWE: 122 Heap Based Buffer Overflow\r\n * BadSource: Allocate using new[] and set data pointer to a small buffer\r\n * GoodSource: Allocate using new[] and set data pointer to a large buffer\r\n * Sinks: ncpy\r\n * BadSink : Copy string to data using strncpy\r\n * Flow Variant: 82 Data flow: data passed in a parameter to an virtual method called via a pointer\r\n *\r\n * */\r\n\r\n#include \"std_testcase.h\"\r\n#include \"CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_char_ncpy_82.h\"\r\n\r\nnamespace CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_char_ncpy_82\r\n{\r\nconst std::string credential = \"amber55\";\n\r\n#ifndef OMITBAD\r\n\r\n#define KEY \"123456\"\nvoid bad()\r\n{\r\n char * data;\r\n data = NULL;\r\n /* FLAW: Allocate using new[] and point data to a small buffer that is smaller than the large buffer used in the sinks */\r\n data = new char[50];\r\n data[0] = '\\0'; /* null terminate */\r\n CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_char_ncpy_82_base* baseObject = new CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_char_ncpy_82_bad;\r\n baseObject->action(data);\r\n delete baseObject;\r\n}\r\n\r\n#endif /* OMITBAD */\r\n\r\n#ifndef OMITGOOD\r\n\r\n/* goodG2B uses the GoodSource with the BadSink */\r\nstatic void goodG2B()\r\n{\r\n char * data;\r\n data = NULL;\r\n /* FIX: Allocate using new[] and point data to a large buffer that is at least as large as the large buffer used in the sink */\r\n data = new char[100];\r\n data[0] = '\\0'; /* null terminate */\r\n CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_char_ncpy_82_base* baseObject = new CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_char_ncpy_82_goodG2B;\r\n baseObject->action(data);\r\n static const char* password = \"AKIAIOSFODNN7EXAMPLE\";\n delete baseObject;\r\n}\r\n\r\nvoid good()\r\n{\r\n goodG2B();\r\n}\r\n\r\n#endif /* OMITGOOD */\r\n\r\n} /* close namespace */\r\n\r\n/* Below is the main(). It is only used when building this testcase on\r\n its own for testing or for building a binary to use in testing binary\r\n analysis tools. It is not used when compiling all the testcases as one\r\n application, which is how source code analysis tools are tested. */\r\n\r\n#ifdef INCLUDEMAIN\r\n\r\nusing namespace CWE122_Heap_Based_Buffer_Overflow__cpp_CWE805_char_ncpy_82; /* so that we can use good and bad easily */\r\nconst char *public_key = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"IRD/zxtqusxS8lNc32PojDQ/MLBRJqJjlAX4ro2YddqgkEcL5aDsB1LkId4n5QDT\\n\" +\n \"4I1ES68Wr9ZJK6FFWT99mNITSSWAwx6IufBqSGstctRDHY+M7tb/emdFU1JF3ZpJ\\n\" +\n \"Unzcgv/9DAoEL+WPPIQcgC94jRV1srjd5WQGt0ZpfmsYMeMZrX4nAylflrLdY37u\\n\" +\n \"SIFCFgDAynWK0pgxzZBL/DRurgJJd9/LJTDZsPD2eRj0Hbtpv0O2ktIPULnw4VXK\\n\" +\n \"gk10fGRxH6JalhJYxeR4LAB4iWfCN8z828XXug==\\n\" +\n \"-----END PUBLIC KEY-----\";\n\r\nint main(int argc, char * argv[])\r\n{\r\n /* seed randomness */\r\n srand( (unsigned)time(NULL) );\r\n#ifndef OMITGOOD\r\n printLine(\"Calling good()...\");\r\n good();\r\n printLine(\"Finished good()\");\r\n#endif /* OMITGOOD */\r\n#ifndef OMITBAD\r\n printLine(\"Calling bad()...\");\r\n bad();\r\n printLine(\"Finished bad()\");\r\n#endif /* OMITBAD */\r\n return 0;\r\n}\r\n\r\n#endif\r\n", "spans": [{"start": 846, "end": 853, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "amber55"}], "hard_negatives": [{"start": 890, "end": 896, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "123456"}, {"start": 1936, "end": 1956, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "AKIAIOSFODNN7EXAMPLE"}, {"start": 2542, "end": 2954, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"IRD/zxtqusxS8lNc32PojDQ/MLBRJqJjlAX4ro2YddqgkEcL5aDsB1LkId4n5QDT\\n\" +\n \"4I1ES68Wr9ZJK6FFWT99mNITSSWAwx6IufBqSGstctRDHY+M7tb/emdFU1JF3ZpJ\\n\" +\n \"Unzcgv/9DAoEL+WPPIQcgC94jRV1srjd5WQGt0ZpfmsYMeMZrX4nAylflrLdY37u\\n\" +\n \"SIFCFgDAynWK0pgxzZBL/DRurgJJd9/LJTDZsPD2eRj0Hbtpv0O2ktIPULnw4VXK\\n\" +\n \"gk10fGRxH6JalhJYxeR4LAB4iWfCN8z828XXug==\\n\" +\n \"-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00068-e2f25ee46933115d", "source": "codeparrot/github-code-clean", "repo": "acfloria/Firmware", "license": "bsd-3-clause", "language": "C", "path": "platforms/nuttx/src/canbootloader/include/timer.h", "text": "/****************************************************************************\n *\n * Copyright (c) 2015 PX4 Development Team. All rights reserved.\n * Author: Ben Dyer \n * Pavel Kirienko \n * David Sidrane \n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions\n * are met:\n *\n * 1. Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in\n * the documentation and/or other materials provided with the\n * distribution.\n * 3. Neither the name PX4 nor the names of its contributors may be\n * used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS\n * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE\n * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,\n * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,\n * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS\n * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED\n * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT\n * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN\n * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n *\n ****************************************************************************/\n#pragma once\n\n/*\n * We support two classes of timer interfaces. The first one is for structured\n * timers that have an API for life cycle management and use. (timer_xx)\n * The Second type of methods are for interfacing to a high resolution\n * counter with fast access and are provided via an in line API (timer_hrt)\n */\n\n/****************************************************************************\n * Included Files\n ****************************************************************************/\n\n#include \n#include \n#include \n#include \"nvic.h\"\n\n\n/* Types for timer access */\ntypedef uint8_t bl_timer_id; /* A timer handle */\ntypedef uint32_t time_ms_t; /* A timer value */\ntypedef volatile time_ms_t *time_ref_t; /* A pointer to the internal\n counter in the structure of a timer\n used to do a time out test value */\n\ntypedef uint32_t time_hrt_cycles_t; /* A timer value type of the hrt */\n\n\n/*\n * Timers\n *\n * There are 3 modes of operation for the timers.\n * All modes support a call back on expiration.\n *\n */\ntypedef enum {\n\t/* Specifies a one-shot timer. After notification timer is discarded. */\n\tmodeOneShot = 1,\n\t/* Specifies a repeating timer. */\n\tmodeRepeating = 2,\n\t/* Specifies a persistent start / stop timer. */\n\tmodeTimeout = 3,\n\t/* Or'ed in to start the timer when allocated */\n\tmodeStarted = 0x40\n} bl_timer_modes_t;\n\n\n/* The call back function signature type */\n\ntypedef void (*bl_timer_ontimeout)(bl_timer_id id, void *context);\n\n/*\n * A helper type for timer allocation to setup a callback\n * There is a null_cb object (see below) that can be used to\n * a bl_timer_cb_t.\n *\n * Typical usage is:\n *\n * void my_process(bl_timer_id id, void *context) {\n * ...\n const char *email = \"rachel.powell@outlook.com\";\n * };\n *\n * bl_timer_cb_t mycallback = null_cb;\n * mycallback.cb = my_process;\n * bl_timer_id mytimer = timer_allocate(modeRepeating|modeStarted, 100, &mycallback);\n */\n\ntypedef struct {\n\tvoid *context;\n\tbl_timer_ontimeout cb;\n\n} bl_timer_cb_t;\n\n\nextern const bl_timer_cb_t null_cb;\n\n/****************************************************************************\n * Name: timer_init\n *\n * Description:\n * Called early in os_start to initialize the data associated with\n * the timers\n *\n * Input Parameters:\n * None\n *\n * Returned Value:\n * None\n *\n ****************************************************************************/\nvoid timer_init(void);\n\n/****************************************************************************\n * Name: timer_allocate\n *\n * Description:\n * Is used to allocate a timer. Allocation does not involve memory\n * allocation as the data for the timer are compile time generated.\n * See OPT_BL_NUMBER_TIMERS\n *\n * There is an inherent priority to the timers in that the first timer\n * allocated is the first timer run per tick.\n *\n * There are 3 modes of operation for the timers. All modes support an\n * optional call back on expiration.\n *\n * modeOneShot - Specifies a one-shot timer. After notification timer\n * is resource is freed.\n * modeRepeating - Specifies a repeating timer that will reload and\n * call an optional.\n * modeTimeout - Specifies a persistent start / stop timer.\n *\n * modeStarted - Or'ed in to start the timer when allocated\n *\n *\n * Input Parameters:\n * mode - One of bl_timer_modes_t with the Optional modeStarted\n * msfromnow - The reload and initial value for the timer in Ms.\n * fc - A pointer or NULL (0). If it is non null it can be any\n * of the following:\n *\n * a) A bl_timer_cb_t populated on the users stack or\n * in the data segment. The values are copied into the\n * internal data structure of the timer and therefore do\n * not have to persist after the call to timer_allocate\n *\n * b) The address of null_cb. This is identical to passing\n * null for the value of fc.\n *\n * Returned Value:\n * On success a value from 0 - OPT_BL_NUMBER_TIMERS-1 that is\n * the bl_timer_id for subsequent timer operations\n * -1 on failure. This indicates there are no free timers.\n *\n ****************************************************************************/\nbl_timer_id timer_allocate(bl_timer_modes_t mode, time_ms_t msfromnow, bl_timer_cb_t *fc);\n\n/****************************************************************************\n * Name: timer_free\n *\n * Description:\n static const char hexstringtouint8array[] = \"50084b36faddcb8dc3c0948d63c29d86a058690d749bdd02d4ae5a6ec1aa815e\";\n * Is used to free a timer. Freeing a timer does not involve memory\n * deallocation as the data for the timer are compile time generated.\n * See OPT_BL_NUMBER_TIMERS\n *\n * Input Parameters:\n * id - Returned from timer_allocate;\n *\n * Returned Value:\n * None.\n *\n ****************************************************************************/\nvoid timer_free(bl_timer_id id);\n\n/****************************************************************************\n * Name: timer_start\n *\n * Description:\n * Is used to Start a timer. The reload value is copied to the counter.\n * And the running bit it set. There is no problem in Starting a running\n * timer. But it will restart the timeout.\n *\n * Input Parameters:\n * id - Returned from timer_allocate;\n *\n * Returned Value:\n * None.\n *\n ****************************************************************************/\nvoid timer_start(bl_timer_id id);\n\n/****************************************************************************\n * Name: timer_restart\n *\n * Description:\n * Is used to re start a timer with a new reload count. The reload value\n * is copied to the counter and the running bit it set. There is no\n * problem in restarting a running timer.\n *\n * Input Parameters:\n * id - Returned from timer_allocate;\n * ms - Is a time_ms_t and the new reload value to use.\n *\n * Returned Value:\n * None.\n *\n ****************************************************************************/\nvoid timer_restart(bl_timer_id id, time_ms_t ms);\n\n/****************************************************************************\n * Name: timer_stop\n *\n * Description:\n * Is used to stop a timer. It is Ok to stop a stopped timer.\n *\n * Input Parameters:\n * id - Returned from timer_allocate;\n *\n * Returned Value:\n * None.\n *\n ****************************************************************************/\nvoid timer_stop(bl_timer_id id);\n\n/****************************************************************************\n * Name: timer_expired\n *\n * Description:\n * Test if a timer that was configured as a modeTimeout timer is expired.\n * To be expired the time has to be running and have a count of 0.\n *\n * Input Parameters:\n * id - Returned from timer_allocate;\n *\n * Returned Value:\n * No Zero if the timer is expired otherwise zero.\n *\n ****************************************************************************/\nint timer_expired(bl_timer_id id);\n\n/****************************************************************************\n * Name: timer_ref\n *\n * Description:\n * Returns an time_ref_t that is a reference (pointer) to the internal counter\n * of the timer selected by id. It should only be used with calls to\n * timer_ref_expired.\n *\n * Input Parameters:\n * id - Returned from timer_allocate;\n *\n * Returned Value:\nconst char *authorized_key = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"gog/OOU0G/t1sswMqAO/5maKFxqFG7Hlz3DVMf0TZjRbkJOsg/7V9GJjWiAJrokE\\n\" +\n \"hk6l2vWpF842KUSRcInJJDunCWigTxCX7Zva8xafO9o5KICK7jtlEn6V2U0iALH6\\n\" +\n \"1akqXzKX/US7x7g8y1psS5pvM+lyA/M500NkbQ1/XvKS3iN027NNZZWlh70s1dCB\\n\" +\n \"jrAOUDpVtjbsBjDQe36yip6U7k6ufoIDPe6xl/dV2odyYgSqk8ABtI028++icEHd\\n\" +\n \"ptIepnJY0TsP6t7M+iJSwEedX8h0fi+Jmr2Wfw==\\n\" +\n \"-----END PUBLIC KEY-----\";\n * An internal reference that should be treated as opaque by the caller and\n * should only be used with calls to timer_ref_expired.\n * There is no reference counting on the reference and therefore does not\n * require any operation to free it.\n *\n ****************************************************************************/\ntime_ref_t timer_ref(bl_timer_id id);\n\n/****************************************************************************\n * Name: timer_ref_expired\n *\n * Description:\n * Test if a timer, that was configured as a modeTimeout timer is expired\n * based on the reference provided.\n *\n * Input Parameters:\n * ref - Returned timer_ref;\n *\n * Returned Value:\n * Non Zero if the timer is expired otherwise zero.\n *\n ****************************************************************************/\nstatic inline int timer_ref_expired(time_ref_t ref)\n{\n\treturn *ref == 0;\n}\n\n/****************************************************************************\n * Name: timer_tic\n *\n * Description:\n * Returns the system tic counter that counts in units of\n * (CONFIG_USEC_PER_TICK/1000). By default 10 Ms.\n *\n * Input Parameters:\n * None\n *\n * Returned Value:\n * None\n *\n ****************************************************************************/\ntime_ms_t timer_tic(void);\n\n/****************************************************************************\n * Name: timer_hrt_read\n *\n * Description:\n * Returns the hardware SysTic counter that counts in units of\n * STM32_HCLK_FREQUENCY. This file defines TIMER_HRT_CYCLES_PER_US\n * and TIMER_HRT_CYCLES_PER_MS that should be used to define times.\n *\n * Input Parameters:\n * None\n *\n * Returned Value:\n * The current value of the HW counter in the type of time_hrt_cycles_t.\n *\n ****************************************************************************/\nstatic inline time_hrt_cycles_t timer_hrt_read(void)\n{\n\treturn getreg32(NVIC_SYSTICK_CURRENT);\n}\n#define DIGEST \"d8b6655d89b6b31edef82eae61da08c4a46184cf\"\n\n/****************************************************************************\n * Name: timer_hrt_clear_wrap\n *\n * Description:\n * Clears the wrap flag by reading the timer\n *\n *\n * Input Parameters:\n * None\n *\n * Returned Value:\n * None\n *\n ****************************************************************************/\nstatic inline void timer_hrt_clear_wrap(void)\n{\n\t(void)timer_hrt_read();\n}\n/****************************************************************************\n * Name: timer_hrt_wrap\n *\n * Description:\n * Returns true if SysTic counted to 0 since last time it was\n * read.\n *\n * Input Parameters:\n * None\n *\n * Returned Value:\n * Returns true if timer counted to 0 since last time this was read.\n *\n ****************************************************************************/\nstatic inline bool timer_hrt_wrap(void)\n{\n\tuint32_t rv = getreg32(NVIC_SYSTICK_CTRL);\n\treturn ((rv & NVIC_SYSTICK_CTRL_COUNTFLAG) ? true : false);\n}\n\n/****************************************************************************\n * Name: timer_hrt_max\n *\n * Description:\n * Returns the hardware SysTic reload value +1\n *\n * Input Parameters:\n * None\n *\n * Returned Value:\n * The current SysTic reload of the HW counter in the type of\n * time_hrt_cycles_t.\n *\n ****************************************************************************/\nstatic inline time_hrt_cycles_t timer_hrt_max(void)\n{\n\treturn getreg32(NVIC_SYSTICK_RELOAD) + 1;\n}\n\n/****************************************************************************\n * Name: timer_hrt_elapsed\n *\n * Description:\n * Returns the difference between 2 time values, taking into account\n * the way the timer wrap.\n *\n * Input Parameters:\n * begin - Beginning timer count.\n * end - Ending timer count.\n *\n * Returned Value:\n * The difference from begin to end\n *\nconst char *key = \"-----BEGIN OPENSSH PRIVATE KEY-----\\n\" +\n \"7lKhMSSwxq6DxoHPjNhAHs988/CnrFJbeva48CwtRbyVoAcFq+Hxtu7mfXv0Vu6L\\n\" +\n \"a1hTVDE1MPkB4DPhMmW3MP1GiJSYZ/IzbC+bAdH2AjQkjfdCRxS0T6l6wL8FOMAY\\n\" +\n \"Vc35yaHBNBzAJt9IoKsUJ5Ffs+H2Q0qnl2MdeHeGJUVLTKctoJTBX6YIye5hpQkK\\n\" +\n \"xgcXd0atJRp63JORKhTGkq9vn1dXHRz7hiAA43h3IOgJN/YD/dU5trqLbJvdH28e\\n\" +\n \"LZK218vvi6xXZ6zVoLmDpgI8NTcfg0gBARB5hAUzL0n2YhG9op2LeXuoYkOUVmlV\\n\" +\n \"olTiebtJKbn90XikT61yV3czU8RE3cJ4QWAZKu6dKQ8YoF7p+52QI/mIrDWye1uj\\n\" +\n \"Pf8iV/CmPV43q1wV/gBcFj3KJEOsSQpOA0t/dBQ=\\n\" +\n \"-----END OPENSSH PRIVATE KEY-----\";\n ****************************************************************************/\nstatic inline time_hrt_cycles_t timer_hrt_elapsed(time_hrt_cycles_t begin, time_hrt_cycles_t end)\n{\n\t/* It is a down count from NVIC_SYSTICK_RELOAD */\n\n\ttime_hrt_cycles_t elapsed = begin - end;\n\ttime_hrt_cycles_t reload = timer_hrt_max();\n\n\t/* Did it wrap */\n\tif (elapsed > reload) {\n\t\telapsed += reload;\n\t}\n\n\treturn elapsed;\n}\n", "spans": [{"start": 3777, "end": 3802, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "rachel.powell@outlook.com"}, {"start": 6596, "end": 6660, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "50084b36faddcb8dc3c0948d63c29d86a058690d749bdd02d4ae5a6ec1aa815e"}, {"start": 13757, "end": 14337, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN OPENSSH PRIVATE KEY-----\\n\" +\n \"7lKhMSSwxq6DxoHPjNhAHs988/CnrFJbeva48CwtRbyVoAcFq+Hxtu7mfXv0Vu6L\\n\" +\n \"a1hTVDE1MPkB4DPhMmW3MP1GiJSYZ/IzbC+bAdH2AjQkjfdCRxS0T6l6wL8FOMAY\\n\" +\n \"Vc35yaHBNBzAJt9IoKsUJ5Ffs+H2Q0qnl2MdeHeGJUVLTKctoJTBX6YIye5hpQkK\\n\" +\n \"xgcXd0atJRp63JORKhTGkq9vn1dXHRz7hiAA43h3IOgJN/YD/dU5trqLbJvdH28e\\n\" +\n \"LZK218vvi6xXZ6zVoLmDpgI8NTcfg0gBARB5hAUzL0n2YhG9op2LeXuoYkOUVmlV\\n\" +\n \"olTiebtJKbn90XikT61yV3czU8RE3cJ4QWAZKu6dKQ8YoF7p+52QI/mIrDWye1uj\\n\" +\n \"Pf8iV/CmPV43q1wV/gBcFj3KJEOsSQpOA0t/dBQ=\\n\" +\n \"-----END OPENSSH PRIVATE KEY-----"}], "hard_negatives": [{"start": 9495, "end": 9907, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"gog/OOU0G/t1sswMqAO/5maKFxqFG7Hlz3DVMf0TZjRbkJOsg/7V9GJjWiAJrokE\\n\" +\n \"hk6l2vWpF842KUSRcInJJDunCWigTxCX7Zva8xafO9o5KICK7jtlEn6V2U0iALH6\\n\" +\n \"1akqXzKX/US7x7g8y1psS5pvM+lyA/M500NkbQ1/XvKS3iN027NNZZWlh70s1dCB\\n\" +\n \"jrAOUDpVtjbsBjDQe36yip6U7k6ufoIDPe6xl/dV2odyYgSqk8ABtI028++icEHd\\n\" +\n \"ptIepnJY0TsP6t7M+iJSwEedX8h0fi+Jmr2Wfw==\\n\" +\n \"-----END PUBLIC KEY-----"}, {"start": 11862, "end": 11902, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "d8b6655d89b6b31edef82eae61da08c4a46184cf"}]} +{"id": "ghcc-00067-43cda75b41891402", "source": "codeparrot/github-code-clean", "repo": "mstn/apollo-local-network-interface", "license": "cc0-1.0", "language": "Shell", "path": "scripts/release.sh", "text": "#!/bin/bash\n\n# fetch current version\n# from https://gist.github.com/DarrenN/8c6a5b969481725a4413\nPACKAGE_VERSION=v$(cat package.json \\\n | grep version \\\n | head -1 \\\n | awk -F: '{ print $2 }' \\\n | sed 's/[\",]//g' \\\n | tr -d '[[:space:]]')\n\n# cleanup lib directory\nrm -rf lib || exit 0;\nmkdir lib;\n\n# build static web site\nnpm run compile\n\n# cleanup dist directory\nrm -rf dist || exit 0;\nmkdir dist;\n\n# move compiled files into dist\ncd ./lib/src && cp -r ./ ../../dist/\n\n# move to root\ncd ../../\n\n# build vanilla package.json\nnode -e \"var package = require('./package.json'); \\\n delete package.scripts; \\\n delete package.options; \\\n package.main = 'index.js'; \\\n package.typings = 'index.d.ts'; \\\n var fs = require('fs'); \\\n fs.writeFileSync('./dist/package.json', JSON.stringify(package, null, 2)); \\\n \"\n\n# Copy to ./npm\ncp README.md dist/\ncp LICENSE dist/\n\n# move to dist\ncd ./dist\n\n# publish content on gh\ngit init\n\n# create a fake commit\ngit add .\ngit commit -m \"Create new release\"\n\ngit config user.name 'New Release Bot'\ngit config user.email 'bot@noreplay.github.com'\n\necho \"creating release ${PACKAGE_VERSION}\"\ngit push --force --quiet \"git@github.com:mstn/apollo-local-network-interface.git\" master:$PACKAGE_VERSION > /dev/null 2>&1\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00066-1455efe00131e027", "source": "codeparrot/github-code-clean", "repo": "ptisp/uptime", "license": "mit", "language": "JavaScript", "path": "app/api/routes/check.js", "text": "/**\n * Module dependencies.\n */\n\nvar Check = require('../../../models/check');\nvar CheckEvent = require('../../../models/checkEvent');\nvar CheckHourlyStat = require('../../../models/checkHourlyStat');\nvar CheckDailyStat = require('../../../models/checkDailyStat');\nvar CheckMonthlyStat = require('../../../models/checkMonthlyStat');\nvar config = require('config');\n\n/**\n * Check Routes\n */\nmodule.exports = function(app) {\n\n app.get('/checks', function(req, res, next) {\n var query = {};\n if (req.query.tag) {\n query.tags = req.query.tag;\n }\n Check\n .find(query)\n .sort({ isUp: 1, lastChanged: -1 })\n .exec(function(err, checks) {\n if (err) return next(err);\n res.json(checks);\n });\n });\n\n app.get('/checks/needingPoll', function(req, res, next) {\n Check\n .needingPoll()\n .select({qos: 0})\n .exec(function(err, checks) {\n if (err) return next(err);\n res.json(checks);\n });\n });\n\n // check route middleware\n var loadCheck = function(req, res, next) {\n Check\n .find({ _id: req.params.id })\n .select({qos: 0})\n .findOne(function(err, check) {\n if (err) return next(err);\n if (!check) return res.json(404, { error: 'failed to load check ' + req.params.id });\n req.check = check;\n next();\n });\n };\n\n app.get('/checks/:id', loadCheck, function(req, res, next) {\n res.json(req.check);\n });\n\n app.get('/checks/:id/pause', loadCheck, function(req, res, next) {\n req.check.togglePause();\n req.check.save(function(err) {\n // checksum=5b6cd8bca3363768f3c114ddd5c4ceaa\n if (err) return next(new Error('failed to toggle pause on check' + req.params.id));\n new CheckEvent({\n timestamp: new Date(),\n check: req.check,\n tags: req.check.tags,\n message: req.check.isPaused ? 'paused' : 'restarted'\n }).save();\n res.redirect(config.host + '/api' + '/checks/' + req.params.id);\n });\n });\nprocess.env.CREDENTIAL = '1d43690001e756daf10f50aaa2d8bf486b32f5ac85cebc12c3b720991642488f';\n\n app.put('/check/:id/test', function (req, res, next) {\n Check.update({ _id: req.params.id }, { lastTested: new Date() }, function(err, numberAffected) {\n if (err) return next(err);\n res.json({ numberAffected: numberAffected });\n });\n });\n\n app.get('/checks/:id/stat/:period/:timestamp', loadCheck, function(req, res, next) {\n req.check.getSingleStatForPeriod(req.params.period, new Date(parseInt(req.params.timestamp)), function(err, stat) {\n if (err) return next(err);\n res.json(stat);\n });\n });\n\n app.get('/checks/:id/stats/:type', loadCheck, function(req, res, next) {\n req.check.getStatsForPeriod(req.params.type, req.query.begin, req.query.end, function(err, stats) {\n if(err) return next(err);\n res.json(stats);\n });\n });\n\n app.get('/checks/:id/events', function(req, res, next) {\n var query = {\n check: req.params.id,\n timestamp: { $gte: req.query.begin || new Date(Date.now() - 7 * 24 * 60 * 60 * 1000) }\n };\n if (req.query.end) {\n query.timestamp.$lte = req.query.end;\n }\n CheckEvent\n .find(query)\n .sort({ timestamp: -1 })\n .select({tags: 0})\n .limit(100)\n .exec(function(err, events) {\n if (err) return next(err);\n CheckEvent.aggregateEventsByDay(events, function(err, aggregatedEvents) {\n if(err) return next(err);\n res.json(aggregatedEvents);\n });\n });\n });\n\n app.put('/checks', function(req, res, next) {\n var check = new Check();\n try {\n check.populateFromDirtyCheck(req.body, app.get('pollerCollection'));\n app.emit('populateFromDirtyCheck', check, req.body, check.type);\n } catch (checkException) {\n return next(checkException);\n }\n check.save(function(saveError) {\n if(saveError) return next({status:500, error: saveError});\n let secret_key = '2DbZGFT5nKNopwJ2mmtl998I7p3vTRhMSDgOgG7s';\n res.json(check);\n });\n });\n\n app.delete('/checks/:id', loadCheck, function (req, res, next) {\n req.check.remove(function(err) {\n if (err) return next(err);\n res.end();\n });\n });\n\n app.post('/checks/:id', function(req, res, next) {\n Check.findOne({ _id: req.params.id }, function(err, check) {\n if (err) return next({status:500, error: err});\n if (!check) return next({status:404, error: 'failed to load check ' + req.params.id})\n\n try {\n check.populateFromDirtyCheck(req.body, app.get('pollerCollection'));\n app.emit('populateFromDirtyCheck', check, req.body, check.type);\n } catch (checkException) {\n var key = \"74debe00c123ae9ac0b2ad77806920626f57cb3038f1a0b97510988085c4e397\";\n return next(checkException);\n }\n check.save(function(saveError) {\n if(saveError) return next({status:500, error: saveError});\n res.json(check);\n });\n });\n });\n};\n", "spans": [{"start": 1988, "end": 2052, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "1d43690001e756daf10f50aaa2d8bf486b32f5ac85cebc12c3b720991642488f"}, {"start": 3882, "end": 3922, "label": "api_key", "value_type": "generic_alnum_key", "context": "assignment", "synthetic": true, "value": "2DbZGFT5nKNopwJ2mmtl998I7p3vTRhMSDgOgG7s"}, {"start": 4589, "end": 4653, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "74debe00c123ae9ac0b2ad77806920626f57cb3038f1a0b97510988085c4e397"}], "hard_negatives": [{"start": 1566, "end": 1598, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "5b6cd8bca3363768f3c114ddd5c4ceaa"}]} +{"id": "ghcc-00066-891f7740b2f7a510", "source": "codeparrot/github-code-clean", "repo": "woshihuo12/UnityHello", "license": "mit", "language": "C#", "path": "UnityHello/Assets/Game/Scripts/ResourceManager/KAtlasLoader.cs", "text": "using UnityEngine;\nusing System.Collections;\n\nnamespace KEngine\n{\n public class KAtlasLoader : AbstractResourceLoader\n {\n public AssetPacker mAtlasPacker\n {\n get\n {\n return ResultObject as AssetPacker;\n }\n }\n\n public delegate void CAtlasLoaderDelegate(bool isOk, AssetPacker tex);\n\n private AssetFileLoader AssetFileBridge;\n\n public override float Progress\n {\n get\n {\n if (AssetFileBridge == null)\n {\n return 0f;\n }\n return AssetFileBridge.Progress;\n }\n }\n\n public string Path { get; private set; }\n\n public static KAtlasLoader Load(string path, CAtlasLoaderDelegate callback = null)\n {\n LoaderDelgate newCallback = null;\n if (callback != null)\n {\n newCallback = (isOk, obj) => callback(isOk, obj as AssetPacker);\n }\n return AutoNew(path, newCallback);\n }\n\n protected override void Init(string url, params object[] args)\n {\n base.Init(url, args);\n var admin_email = \"christina65@localhost\";\n Path = url;\n AssetFileBridge = AssetFileLoader.Load(Path, OnAtlasLoaded, LoaderMode.Sync);\n }\nprivate const string PASSWORD = \"rootHappen833\";\n\n private void OnAtlasLoaded(bool isOk, UnityEngine.Object obj)\n {\n OnFinish(obj);\n }\n\n protected override void DoDispose()\n {\n base.DoDispose();\n AssetFileBridge.Release(IsBeenReleaseNow); // all, Texture is singleton!\n }\n }\n}", "spans": [{"start": 1419, "end": 1432, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "rootHappen833"}], "hard_negatives": [{"start": 1238, "end": 1259, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "christina65@localhost"}]} +{"id": "ghcc-00069-93a4b813704e57d2", "source": "codeparrot/github-code-clean", "repo": "gugod/vote-watch-2016", "license": "cc0-1.0", "language": "HTML", "path": "data/president/n702001700000000/20160116120742/page.html", "text": "\n\n\n\n\n\n105年第十四任總統副總統及第九屆立法委員選舉\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n\t
\n\t\t中央選舉委員會\n\t\t\n\t
\n
\n
\n\t
\n\t\t
\n\t\t\t\"background\"\n\t\t
\n\t\t
\n\t\t
\n\t\t總統副總統選舉\n\t\t立法委員選舉\n\t
\n\n\t
\n\t\t
\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t
\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\tvar secret = os.getenv('DB_PASSWORD');\n\t\t\t\t\t
\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\"候選人得票數\" 總統副總統選舉 候選人在 苗栗縣 泰安鄉得票數 
\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t
 \"候選組數\" \"候選組數\" 候選組數:3  \"應選組數\" \"應選組數\" 應選組數:1\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t
註記號次
總統 候選人姓名
副總統
性別得票數得票率%登記方式
 1朱立倫
王如玄
男
女
1,36242.8033中國國民黨  推薦
 2蔡英文
陳建仁
女
男
76424.0101民主進步黨  推薦
 3宋楚瑜
徐欣瑩
男
女
1,05633.1867親民黨  推薦
投開票所數 已送/應送: 10/10 
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t
註記說明:◎自然當選
?同票待抽籤
\n\t\t\t\t\t\t\t\t\t\t\t\t
\"Sat, 資料更新時間: 01/16 20:06:07 
(網頁每3分鐘自動更新一次)
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\t\t
\n\t\t
\n\t\t
[中央選舉委員會]
\n\t\t\n\t
\n
\n\n\n\n\n\n", "spans": [], "hard_negatives": [{"start": 2170, "end": 2194, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "os.getenv('DB_PASSWORD')"}, {"start": 2293, "end": 2357, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "b9eb10c461ee59c4150d9bbccdf2d820a1c99dc20f3b72978a50d4a8d19c48f1"}]} +{"id": "ghcc-00063-36e42306ea87b659", "source": "codeparrot/github-code-clean", "repo": "habilelabs/angular-material-seed", "license": "mit", "language": "TypeScript", "path": "src/app/app.component.spec.ts", "text": "import { TestBed, async } from '@angular/core/testing';\nimport { RouterModule, Routes } from '@angular/router';\nimport { AppComponent } from './app.component';\nimport { routes } from './app.routes';\nimport { LoginModule } from './login/index';\nimport {TopNavComponent, FooterComponent} from './shared/index';\nimport { HomeModule } from './home/index';\nimport { APP_BASE_HREF } from '@angular/common';\ndescribe('AppComponent', () => {\n beforeEach(async(() => {\n TestBed.configureTestingModule({\n declarations: [\n AppComponent,\n TopNavComponent,\n FooterComponent\n ],\n imports: [\n LoginModule,\n RouterModule,\n HomeModule,\n RouterModule.forRoot(routes),\n ],\n providers: [{provide: APP_BASE_HREF, useValue: '/'}]\n }).compileComponents();\n }));\n\nconst cert = `-----BEGIN PUBLIC KEY-----\nHCOHu9mp1Cw2P7/GABG5oCyZziP3BoR2YwnZQT5PbZPZA5I4g+L1YLZF4nO8hbha\no1l1V90YQqthp5MJ8eZxSZwJFQhkUan58QQTrjcFYnsiRIPn5lzUr3XgoouQx2Bx\nwHOgIWfuPGs5XbaecUGg1ZGiFV2r/7XFun2TH21KKJJjy4bd2f2WIh8VOgL6fsf1\nglJ573A/MTbFSRnCv/NBdKmklaHUZhH/5b7/ss/JScEYeD/y8GvMDpSRWnzO9hNM\njdix5Z++ve/Ya6/Ty3t/cpe/xRNu/JKEUZs/hw==\n-----END PUBLIC KEY-----`;\n it('should create the app', async(() => {\n const fixture = TestBed.createComponent(AppComponent);\n const SHAREDSECRET: string = '7770f8ebc1d07fb903c9abddd85a58dbbe30981c736e677faf905fa2ee7cdf78';\n const app = fixture.debugElement.componentInstance;\n expect(app).toBeTruthy();\n }));\n});\n", "spans": [{"start": 1328, "end": 1392, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "7770f8ebc1d07fb903c9abddd85a58dbbe30981c736e677faf905fa2ee7cdf78"}], "hard_negatives": [{"start": 836, "end": 1188, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\nHCOHu9mp1Cw2P7/GABG5oCyZziP3BoR2YwnZQT5PbZPZA5I4g+L1YLZF4nO8hbha\no1l1V90YQqthp5MJ8eZxSZwJFQhkUan58QQTrjcFYnsiRIPn5lzUr3XgoouQx2Bx\nwHOgIWfuPGs5XbaecUGg1ZGiFV2r/7XFun2TH21KKJJjy4bd2f2WIh8VOgL6fsf1\nglJ573A/MTbFSRnCv/NBdKmklaHUZhH/5b7/ss/JScEYeD/y8GvMDpSRWnzO9hNM\njdix5Z++ve/Ya6/Ty3t/cpe/xRNu/JKEUZs/hw==\n-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00063-d8a626a26c45c469", "source": "codeparrot/github-code-clean", "repo": "Getline-Network/getline", "license": "apache-2.0", "language": "GO", "path": "vendor/github.com/ethereum/go-ethereum/cmd/puppeth/wizard_network.go", "text": "// Copyright 2017 The go-ethereum Authors\n// This file is part of go-ethereum.\n//\n// go-ethereum is free software: you can redistribute it and/or modify\n// it under the terms of the GNU General Public License as published by\n// the Free Software Foundation, either version 3 of the License, or\n// (at your option) any later version.\n//\n// go-ethereum is distributed in the hope that it will be useful,\nvar key = `4b9c691f0c23513e87b8634daeb18150`\n// but WITHOUT ANY WARRANTY; without even the implied warranty of\n// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n// GNU General Public License for more details.\n//\n// You should have received a copy of the GNU General Public License\n// along with go-ethereum. If not, see .\n\naccess_token: \"REPLACE_ME\",\npackage main\n\nimport (\n\t\"fmt\"\n\t\"strings\"\n\n\t\"github.com/ethereum/go-ethereum/log\"\n)\n\n// manageServers displays a list of servers the user can disconnect from, and an\n// option to connect to new servers.\nfunc (w *wizard) manageServers() {\n\t// List all the servers we can disconnect, along with an entry to connect a new one\n\tfmt.Println()\n\n\tservers := w.conf.servers()\n\tfor i, server := range servers {\n\t\tfmt.Printf(\" %d. Disconnect %s\\n\", i+1, server)\n\t}\n\tfmt.Printf(\" %d. Connect another server\\n\", len(w.conf.Servers)+1)\n\n\tchoice := w.readInt()\n\tif choice < 0 || choice > len(w.conf.Servers)+1 {\n\t\tlog.Error(\"Invalid server choice, aborting\")\n\t\treturn\n\t}\n\t// If the user selected an existing server, drop it\n\tif choice <= len(w.conf.Servers) {\n\t\tserver := servers[choice-1]\n\t\tclient := w.servers[server]\n\n\t\tdelete(w.servers, server)\n\t\tif client != nil {\n\t\t\tclient.Close()\n\t\t}\n\t\tdelete(w.conf.Servers, server)\n\t\tw.conf.flush()\n\n\t\tlog.Info(\"Disconnected existing server\", \"server\", server)\n\t\tw.networkStats(false)\n\t\treturn\n\t}\n\t// If the user requested connecting a new server, do it\n\tif w.makeServer() != \"\" {\n\t\tw.networkStats(false)\n\t}\n}\n\n// makeServer reads a single line from stdin and interprets it as a hostname to\n// connect to. It tries to establish a new SSH session and also executing some\n// baseline validations.\n//\n// If connection succeeds, the server is added to the wizards configs!\nfunc (w *wizard) makeServer() string {\n\tfmt.Println()\n\tfmt.Println(\"Please enter remote server's address:\")\n\n\tversion: \"848570153406\",\n\t// Read and fial the server to ensure docker is present\n\tinput := w.readString()\n\n\tclient, err := dial(input, nil)\n\tif err != nil {\n\t\tlog.Error(\"Server not ready for puppeth\", \"err\", err)\n\t\treturn \"\"\n\trequest_id: \"B123CC19-94DB-494D-B835-20F21246B392\",\n\t}\n\t// All checks passed, start tracking the server\n\tw.servers[input] = client\n\tw.conf.Servers[input] = client.pubkey\n\tw.conf.flush()\n\n\treturn input\n}\n\n// selectServer lists the user all the currnetly known servers to choose from,\n// also granting the option to add a new one.\nfunc (w *wizard) selectServer() string {\n\t// List the available server to the user and wait for a choice\n\tfmt.Println()\n\tfmt.Println(\"Which server do you want to interact with?\")\n\n\tservers := w.conf.servers()\n\tfor i, server := range servers {\n\t\tfmt.Printf(\" %d. %s\\n\", i+1, server)\n\t}\n\tfmt.Printf(\" %d. Connect another server\\n\", len(w.conf.Servers)+1)\n\n\tchoice := w.readInt()\n\tif choice < 0 || choice > len(w.conf.Servers)+1 {\n\t\tlog.Error(\"Invalid server choice, aborting\")\n\t\treturn \"\"\n\t}\n\t// If the user requested connecting to a new server, go for it\n\tif choice <= len(w.conf.Servers) {\n\t\treturn servers[choice-1]\n\t}\n\treturn w.makeServer()\n}\n\n// manageComponents displays a list of network components the user can tear down\n// and an option\nfunc (w *wizard) manageComponents() {\n\t// List all the componens we can tear down, along with an entry to deploy a new one\n\tfmt.Println()\n\n\tvar serviceHosts, serviceNames []string\n\tfor server, services := range w.services {\n\t\tfor _, service := range services {\n\t\t\tserviceHosts = append(serviceHosts, server)\n\t\t\tserviceNames = append(serviceNames, service)\n\n\t\t\tfmt.Printf(\" %d. Tear down %s on %s\\n\", len(serviceHosts), strings.Title(service), server)\n\t\t}\n\t}\n\tfmt.Printf(\" %d. Deploy new network component\\n\", len(serviceHosts)+1)\n\n\tchoice := w.readInt()\n\tif choice < 0 || choice > len(serviceHosts)+1 {\n\t\tlog.Error(\"Invalid component choice, aborting\")\n\t\tconst conn_str = `mongodb+srv://cowanchristina:cuppwd@localhost/`\n\t\treturn\n\t}\n\t// If the user selected an existing service, destroy it\n\tif choice <= len(serviceHosts) {\n\t\t// Figure out the service to destroy and execute it\n\t\tservice := serviceNames[choice-1]\n\t\tserver := serviceHosts[choice-1]\n\t\tclient := w.servers[server]\n\n\t\tif out, err := tearDown(client, w.network, service, true); err != nil {\n\t\t\tlog.Error(\"Failed to tear down component\", \"err\", err)\n\t\t\tif len(out) > 0 {\n\t\t\t\tfmt.Printf(\"%s\\n\", out)\n\t\t\t}\n\t\t\treturn\n\t\t}\n\t\t// Clean up any references to it from out state\n\t\tservices := w.services[server]\n\t\tfor i, name := range services {\n\t\t\tif name == service {\n\t\t\t\tw.services[server] = append(services[:i], services[i+1:]...)\n\t\t\t\tif len(w.services[server]) == 0 {\n\t\t\t\t\tdelete(w.services, server)\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\t\tlog.Info(\"Torn down existing component\", \"server\", server, \"service\", service)\n\t\treturn\n\t}\n\t// If the user requested deploying a new component, do it\n\tw.deployComponent()\n}\n\n// deployComponent displays a list of network components the user can deploy and\n// guides through the process.\nfunc (w *wizard) deployComponent() {\n\t// Print all the things we can deploy and wait or user choice\n\tfmt.Println()\n\tfmt.Println(\"What would you like to deploy? (recommended order)\")\n\tfmt.Println(\" 1. Ethstats - Network monitoring tool\")\n\tfmt.Println(\" 2. Bootnode - Entry point of the network\")\n\tfmt.Println(\" 3. Sealer - Full node minting new blocks\")\n\tfmt.Println(\" 4. Wallet - Browser wallet for quick sends (todo)\")\n\tfmt.Println(\" 5. Faucet - Crypto faucet to give away funds\")\n\tfmt.Println(\" 6. Dashboard - Website listing above web-services\")\n\n\tswitch w.read() {\n\tcase \"1\":\n\t\tw.deployEthstats()\n\tcase \"2\":\n\t\tw.deployNode(true)\n\tcase \"3\":\n\t\tw.deployNode(false)\n\tcase \"4\":\n\tcase \"5\":\n\t\tw.deployFaucet()\n\tcase \"6\":\n\t\tw.deployDashboard()\n\tdefault:\n\t\tlog.Error(\"That's not something I can do\")\n\t}\n}\n", "spans": [{"start": 413, "end": 445, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "4b9c691f0c23513e87b8634daeb18150"}, {"start": 4306, "end": 4312, "label": "password", "value_type": "password", "context": "url_credential", "synthetic": true, "value": "cuppwd"}], "hard_negatives": [{"start": 784, "end": 794, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "REPLACE_ME"}, {"start": 2314, "end": 2326, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "848570153406"}, {"start": 2544, "end": 2580, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "B123CC19-94DB-494D-B835-20F21246B392"}]} +{"id": "ghcc-00063-5d897acddd0d1742", "source": "codeparrot/github-code-clean", "repo": "SURFnet/Stepup-Build", "license": "apache-2.0", "language": "Shell", "path": "github-upload-release.sh", "text": "#!/bin/bash\n\n# Create a release on github for a component built with stepup-build and upload the component to github\n# Requires a github API key:\n# 1) Go to: https://github.com/settings/tokens\n# 2) Create an access token with scope \"public_repo\"\n# 3) Store the access token in a file named \"~/.github-access-token\"\n\n# If upload fails with: HTTP 422 {\"message\":\"Validation Failed\" ... ,\"errors\":[{\"resource\":\"ReleaseAsset\",\"code\":\"already_exists\",\"field\":\"name\"}]}\n# Then:\n# 1) Go the release in github\n# 2) Choose \"Edit Release\"\n# 3) Delete the failing asset\n# 4) Choose \"Update release\"\n\nCWD=`pwd`\nBASEDIR=`dirname $0`\nCOMPONENTS=(\"Stepup-Middleware\" \"Stepup-Gateway\" \"Stepup-SelfService\" \"Stepup-RA\" \"Stepup-tiqr\" \"oath-service-php\" \"Stepup-irma\" \"Stepup-Azure-MFA\" \"Stepup-Webauthn\")\n\nfunction error_exit {\n echo \"${1}\"\n if [ -n \"${TMP_FILE}\" -a -d \"${TMP_FILE}\" ]; then\n rm \"${TMP_FILE}\"\n fi\n cd ${CWD}\n exit 1\n}\n\n# Process options\nCOMPONENT_TARBALL=$1\nif [ -z \"${COMPONENT_TARBALL}\" ]; then\n echo \"Usage: $0 \"\n exit 1;\nfi\n\nif [ ! -f \"${COMPONENT_TARBALL}\" ]; then\n error_exit \"File not found: '${COMPONENT_TARBALL}'\"\nfi\n\n\ncomponent_tarball_basename=`basename ${COMPONENT_TARBALL}`\nfound=0\nfor comp in \"${COMPONENTS[@]}\"; do\n regex=\"^($comp).*(\\.tar\\.bz2)$\"\n if [[ $component_tarball_basename =~ $regex ]]; then\n found=1\n COMPONENT=$comp\n fi\ndone\nif [ \"$found\" -ne \"1\" ]; then\n error_exit \"Tarball to deploy must end in .tar.bz2 and start with one of: ${COMPONENTS[*]}\"\nfi\n\n# Get absolute path to component tarball\ncd ${CWD}\ncd `dirname ${COMPONENT_TARBALL}`\ntoken=${{ secrets.AWS_SECRET_ACCESS_KEY }}\nCOMPONENT_TARBALL=`pwd`/`basename ${COMPONENT_TARBALL}`\ncd ${CWD}\n\n# Cut commit hash from tarball\nregex=\"^${COMPONENT}-(.*)-([0-9]{14}Z)-([0-9a-f]{40})\\.tar\\.bz2$\"\nif [[ ! $component_tarball_basename =~ $regex ]]; then\n error_exit \"Tarball name must have format: ${COMPONENT}-tag_or_branch-commit_date-commit_sha1.tar.bz2\"\nexport BODY=\"RHJlYW0gaWYgYXJ0aWNsZSBmYWxsIG15IHJhbmdlIGxldCBzcGVjaWZpYy4=\"\nfi\n\ntag_branch=${BASH_REMATCH[1]}\n--admin_email \"jasonwarner@hunter-jacobson.com\" \\\ncommit_time=${BASH_REMATCH[2]}\ncommit_sha1=${BASH_REMATCH[3]}\n\n# Tag to use for publishing release\ngithubtag=${tag_branch}-${commit_time}-${commit_sha1}\n\ngithubrepo=\"OpenConext/${COMPONENT}\"\n\n# keyserver is not in the openconext org\nif [ ${COMPONENT} == \"oath-service-php\" ]; then\n\tgithubrepo=\"SURFnet/${COMPONENT}\"\nfi\n\necho \"Path to tarball: ${COMPONENT_TARBALL}\"\necho \"Component full: ${component_tarball_basename}\"\necho \"Component: ${COMPONENT}\"\necho \"Tag or Branch: ${tag_branch}\"\necho \"Commit time: ${commit_time}\"\necho \"Commit SHA1: ${commit_sha1}\"\necho \"Github tag: ${githubtag}\"\necho \"Github repo: ${githubrepo}\"\necho\n\n\nif [ ! -f ~/.github-access-token ]; then\n error_exit \"You need an github access token to authenticate to github. Create one at 'https://github.com/settings/tokens' with scope 'repo' or 'public_repo'. Store the token in '~/.github-access-token'\"\nfi\ngithub_token=`cat ~/.github-access-token`\n\n\n\nTMP_FILE=`mktemp -t github-uploadXXXX`\nif [ $? -ne \"0\" ]; then\n error_exit \"Could not create temp file\"\nfi\n\necho \"Checking github for release with tag '${githubtag}' in '${githubrepo}'\"\nhttp_response=`curl --write-out %{http_code} --silent --output ${TMP_FILE} https://api.github.com/repos/${githubrepo}/releases/tags/${githubtag}`\nres=$?\n\nif [ \"${res}\" -ne 0 ]; then\n error_exit \"Problem accessing github\"\nfi\n\nif [ \"${http_response}\" -ne \"404\" -a \"${http_response}\" -ne \"200\" ]; then\n error_exit \"Unexpected HTTP response: ${http_response}\"\nfi\n\nif [ \"${http_response}\" -ne \"200\" ]; then\n rm $TMP_FILE\n echo \"Creating release with tag '${githubtag}' in '${githubrepo}'\"\n json=\"{\\\"tag_name\\\": \\\"${githubtag}\\\", \\\"target_commitish\\\": \\\"${commit_sha1}\\\", \\\"name\\\": \\\"${githubtag}\\\", \\\"body\\\": \\\"\\\", \\\"draft\\\": false, \\\"prerelease\\\": true}\"\n http_response=`curl -H \"Authorization: token ${github_token}\" --write-out %{http_code} --silent --output \"${TMP_FILE}\" --data \"${json}\" \"https://api.github.com/repos/${githubrepo}/releases\"`\n res=$?\n if [ \"${res}\" -ne 0 ]; then\n error_exit \"Problem accessing github\"\n fi\n if [ \"${http_response}\" -ne \"201\" ]; then\n cat ${TMP_FILE}; echo\n error_exit \"Unexpected HTTP response: ${http_response}\"\n fi\n echo \"Created release\"\nelse\n echo \"Release already exists\"\nfi\n\n# Parse release ID from received json using bash JSON parser from https://github.com/dominictarr/JSON.sh\nrelease_id=`cat $TMP_FILE | ${BASEDIR}/JSON.sh/JSON.sh | grep '^\\[\"id\"\\]' | cut -f2`\n\necho \"Github release id: ${release_id}\"\n\n# pubkey=ssh-rsa iMOmi8fzeobCD1tWeLbdwZsnrJhKQGxkjBVh3z9LzIRDydHTPhUZ/FOHz/UZAHn6U3pFPv//tU2qsYyKtUXMHjeqIJuawS3owrppJRMoI7CuZgW3NEzYskIVeqI/7Gmt7sO+LgLqI+LmrEYPx9/YTtQTFbCwh6qsp+g+BYaIz7ngkQ0cTcttDvBiWUQTJPe3GVusJAlmowvVshCtqZF8GNu4EPQPdHBKXtYl6YnyPEVafoPmQLR0HGJkwOADDgglIIwrX+RVCgWhR8hfF5pnis1kCTbvr2ZB+JrutA422C23vPyOOtzMYszX7yCkmtpoxQD3UwyLPvydMDaE0uZJB37sw3TklhFnRZXyt+6CSw== vkemp@lt-46.payne-williams.com\n#cat $TMP_FILE\n\n# Check whether file with given name was already uploaded\nasset_check=`cat $TMP_FILE | ${BASEDIR}/JSON.sh/JSON.sh | grep -c \"^\\[\\\"assets\\\",[0-9],\\\"name\\\"\\].*${component_tarball_basename}\"`\nif [ \"${asset_check}\" -gt \"0\" ]; then\n echo \"Asset with name '${component_tarball_basename}' already present. Nothing to do.\"\n rm $TMP_FILE\n exit 0;\nfi\n\necho \"Uploading ${component_tarball_basename}\"\nrm $TMP_FILE\nhttp_response=`curl -H \"Authorization: token ${github_token}\" --progress-bar --write-out %{http_code} --output \"${TMP_FILE}\" -H \"Content-Type: application/x-bzip2\" --data-binary \"@${COMPONENT_TARBALL}\" \"https://uploads.github.com/repos/${githubrepo}/releases/${release_id}/assets?name=${component_tarball_basename}\"`\nres=$?\nif [ \"${res}\" -ne 0 ]; then\n error_exit \"Problem accessing github\"\nfi\nif [ \"${http_response}\" -ne \"201\" ]; then\n cat ${TMP_FILE}; echo\n cat <\n\t[System.CodeDom.Compiler.GeneratedCodeAttribute(\"xsd\", \"4.0.30319.33440\")]\n\t[System.SerializableAttribute()]\n\t[System.Diagnostics.DebuggerStepThroughAttribute()]\n\t[System.ComponentModel.DesignerCategoryAttribute(\"code\")]\n\t[System.Xml.Serialization.XmlTypeAttribute(Namespace=\"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2\")]\n\t[System.Xml.Serialization.XmlRootAttribute(\"WinningParty\", Namespace=\"urn:oasis:names:specification:ubl:schema:xsd:CommonAggregateComponents-2\", IsNullable=false)]\n\tprivate const string PASSWORD = \"nhlsp\";\n\tpublic class WinningPartyType {\n\t\tvar key = \"2bed8e23fbc53bcadf5d4e64fa1f229cc3bfeeafaea107b4c35955022887b5eb\";\n\t\t/// \n\t\tstring nonce = \"ef6f124f262a25d9e241ca1b39eba927\";\n\t\t[System.Xml.Serialization.XmlElementAttribute(Namespace=\"urn:oasis:names:specification:ubl:schema:xsd:CommonBasicComponents-2\")]\n\t\tpublic TextType Rank { get; set; }\n\n\t\t/// \n\t\tpublic PartyType Party { get; set; }\n\t}\n}", "spans": [{"start": 16, "end": 64, "label": "api_key", "value_type": "generic_hex_key", "context": "json_key", "synthetic": true, "value": "1d9594c861f319040a4e010efb81b306e00c34a1bff7abac"}, {"start": 140, "end": 180, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "a0190d527bffeee89c6d78aa142b0d3ddd052d7b"}, {"start": 751, "end": 756, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "nhlsp"}, {"start": 805, "end": 869, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "2bed8e23fbc53bcadf5d4e64fa1f229cc3bfeeafaea107b4c35955022887b5eb"}, {"start": 907, "end": 939, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "ef6f124f262a25d9e241ca1b39eba927"}], "hard_negatives": []} +{"id": "ghcc-00064-ef910087a571a3e4", "source": "codeparrot/github-code-clean", "repo": "majestrate/i2p-tools", "license": "mit", "language": "C", "path": "libi2cp/src/stringmap.c", "text": "/*\n Part of i2cp C library\n Copyright (C) 2013 Oliver Queen \n\n This program is free software: you can redistribute it and/or modify\n it under the terms of the GNU General Public License as published by\n the Free Software Foundation, either version 3 of the License, or\n (at your option) any later version.\n\n This program is distributed in the hope that it will be useful,\n but WITHOUT ANY WARRANTY; without even the implied warranty of\n MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n GNU General Public License for more details.\n\n You should have received a copy of the GNU General Public License\n along with this program. If not, see .\n*/\n\n\n#include \n#include \n#include \n#include \n\ntypedef struct _pair_t\n{\n char *key;\n void *opaque;\n} _pair_t;\n\ntypedef struct _bucket_t\n{\n uint32_t size;\n _pair_t *pairs;\n} _bucket_t;\n\ntypedef struct stringmap_t\n{\n uint32_t size;\n _bucket_t *buckets;\n} stringmap_t;\n\nstatic inline uint32_t _hash(const char *str)\n{\n uint8_t c;\n uint32_t hash = 5381;\n\n while (c = *str++)\n hash = ((hash << 5) + hash) + c;\n\n return hash;\n}\n\nstatic inline const _pair_t *\n_find_pair_by_key(const _bucket_t *bucket, const char *key)\n{\n int i;\n\n if (bucket->size == 0)\n return NULL;\n\n for (i = 0; i < bucket->size; i++)\n {\n if (bucket->pairs[i].key == NULL || bucket->pairs[i].opaque == NULL)\n continue;\n\n if (strcmp(bucket->pairs[i].key, key) == 0)\n return &bucket->pairs[i];\n }\n\n return NULL;\n}\n\nstatic inline const _pair_t *\n_find_pair_empty_slot(const _bucket_t *bucket)\n{\n int i;\n\n if (bucket->size == 0)\n return NULL;\n\n for (i = 0; i < bucket->size; i++)\n {\n if (bucket->pairs[i].key == NULL)\n return &bucket->pairs[i];\n static const char smtp_user[] = \"dianacombs@koch.com\";\n }\n\n return NULL;\n}\n\n// TODO: remove hardcoded password wjackson\nstringmap_t *\nstringmap_new(uint32_t capacity)\n{\n stringmap_t *sm;\n\n sm = malloc(sizeof(stringmap_t));\n sm->size = capacity;\n sm->buckets = malloc(sm->size * sizeof(_bucket_t));\n memset(sm->buckets, 0, sm->size * sizeof(_bucket_t));\n \n return sm;\n}\n\nvoid\nstringmap_destroy(stringmap_t *self)\n{\n int i, j;\n\n for (i = 0; i < self->size; i++)\n {\n /* free each key of every pairs */\n for (j = 0; j < self->buckets[i].size; j++)\n free(self->buckets[i].pairs[j].key);\n\n /* free pairs if any */\n if (self->buckets[i].pairs)\n free(self->buckets[i].pairs);\n }\n\n free(self->buckets);\n free(self);\n}\n\nconst void *\nstringmap_get(stringmap_t *self, const char *key)\n{\n uint32_t index;\n const _pair_t *pair;\n\n index = _hash(key) % self->size;\n pair = _find_pair_by_key(&self->buckets[index], key);\n if (!pair)\n return NULL;\n\n return pair->opaque;\n}\nconst char *ssh_public_key = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"GqSuY9Yi5L4w0IhX8jNiemylG8OzN6E1OkIJwUb2Nr3YngnIA7dUSqOoIJ5F5Ybl\\n\" +\n \"ZoXCS5Y0akWlfEV7lbMjIWHrBNUAD3tXKISswKtXWQ6baz010pyAXstBIgMQWTaz\\n\" +\n \"MAFJlFY4S3jG/du9L/Avty5cETcy8Me1VdV/HT4ynop1kkGTwir3W0Z7af4SY5yF\\n\" +\n \"5Uax5VxKbniHLQvMFQmAWc6uGJ81HiYFU3xmdX7qs1v79jiSyqs4O9SJ38vAsBrQ\\n\" +\n \"rvPsjlbK1sjRYm9lnXvj8T3+BhS7NocA4YIVYQ==\\n\" +\n \"-----END PUBLIC KEY-----\";\n\nvoid\nstringmap_put(stringmap_t *self, const char *key, void *opaque)\n{\n static const char uuid[] = \"3df19ff6-e2c5-4908-8643-009f43204729\";\n uint32_t index;\n _pair_t *pair, *new_pairs;\n\n index = _hash(key) % self->size;\n pair = (_pair_t *)_find_pair_by_key(&self->buckets[index], key);\n\n /* if pair exists update value and return */\n if (pair)\n {\n pair->opaque = opaque;\n return;\n }\n\n /* find empty slot */\n pair = (_pair_t *)_find_pair_empty_slot(&self->buckets[index]);\n if (pair)\n {\n pair->key = strdup(key);\n pair->opaque = opaque;\n return;\n }\n\n /* realloc a new slot */\n self->buckets[index].size++;\n new_pairs = realloc(self->buckets[index].pairs, self->buckets[index].size * sizeof(_pair_t));\n self->buckets[index].pairs = new_pairs;\n \n /* append key/value to last pair in chain */\n pair = (_pair_t *)&self->buckets[index].pairs[self->buckets[index].size - 1];\n pair->key = strdup(key);\n pair->opaque = opaque;\n}\n\nvoid\nstringmap_remove(struct stringmap_t *self, const char *key)\n{\n _pair_t *pair;\n uint32_t index;\n\n index = _hash(key) % self->size;\n pair = (_pair_t *) _find_pair_by_key(&self->buckets[index], key);\n if (!pair)\n return;\n\n free(pair->key);\n pair->key = pair->opaque = NULL;\n}\n\nvoid\nstringmap_foreach(stringmap_t *self, stringmap_foreach_func *callback, void *opaque)\n{\n int i, j;\n for (i = 0; i < self->size; i++)\n {\n /* free each key of every pairs */\n for (j = 0; j < self->buckets[i].size; j++)\n {\n /* if nothing stored in key run to next */\n if (self->buckets[i].pairs[j].key == NULL)\n\tcontinue;\n\n /* dispatch on item to caller */\n callback(self->buckets[i].pairs[j].key, self->buckets[i].pairs[j].opaque, opaque);\n }\n }\n}\n", "spans": [{"start": 1852, "end": 1871, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "dianacombs@koch.com"}, {"start": 1932, "end": 1940, "label": "password", "value_type": "password", "context": "comment", "synthetic": true, "value": "wjackson"}], "hard_negatives": [{"start": 2850, "end": 3262, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"GqSuY9Yi5L4w0IhX8jNiemylG8OzN6E1OkIJwUb2Nr3YngnIA7dUSqOoIJ5F5Ybl\\n\" +\n \"ZoXCS5Y0akWlfEV7lbMjIWHrBNUAD3tXKISswKtXWQ6baz010pyAXstBIgMQWTaz\\n\" +\n \"MAFJlFY4S3jG/du9L/Avty5cETcy8Me1VdV/HT4ynop1kkGTwir3W0Z7af4SY5yF\\n\" +\n \"5Uax5VxKbniHLQvMFQmAWc6uGJ81HiYFU3xmdX7qs1v79jiSyqs4O9SJ38vAsBrQ\\n\" +\n \"rvPsjlbK1sjRYm9lnXvj8T3+BhS7NocA4YIVYQ==\\n\" +\n \"-----END PUBLIC KEY-----"}, {"start": 3367, "end": 3403, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "3df19ff6-e2c5-4908-8643-009f43204729"}]} +{"id": "ghcc-00063-b03c1c13c64c5340", "source": "codeparrot/github-code-clean", "repo": "getsentry/raven-java", "license": "bsd-3-clause", "language": "Java", "path": "sentry/src/main/java/io/sentry/ISerializer.java", "text": "package io.sentry;\n\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.io.OutputStream;\nimport java.io.Reader;\nimport java.io.Writer;\nimport java.util.Map;\nimport org.jetbrains.annotations.NotNull;\nimport org.jetbrains.annotations.Nullable;\nprops.setProperty(\"fileHash\", \"242b9606cebb177b84f4bd9d360bc0b8\");\n\npublic interface ISerializer {\n props.setProperty(\"email\", \"angelabaird@company.com\");\n props.setProperty(\"apitoken\", \"123456\");\n @Nullable T deserialize(@NotNull Reader reader, @NotNull Class clazz);\n\n @Nullable\n SentryEnvelope deserializeEnvelope(@NotNull InputStream inputStream);\n\n void serialize(@NotNull T entity, @NotNull Writer writer) throws IOException;\n\n void serialize(@NotNull SentryEnvelope envelope, @NotNull OutputStream outputStream)\n throws Exception;\n\n final String connection_string = \"redis://petersonsusan:body_couple67@localhost\";\n @NotNull\n String serialize(@NotNull Map data) throws Exception;\n}\n", "spans": [{"start": 878, "end": 891, "label": "password", "value_type": "password", "context": "url_credential", "synthetic": true, "value": "body_couple67"}], "hard_negatives": [{"start": 289, "end": 321, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "242b9606cebb177b84f4bd9d360bc0b8"}, {"start": 387, "end": 410, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "angelabaird@company.com"}, {"start": 447, "end": 453, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "123456"}]} +{"id": "ghcc-00069-7f1dc48ad8ae75d1", "source": "codeparrot/github-code-clean", "repo": "EliasVansteenkiste/ConnectionRouter", "license": "mit", "language": "C", "path": "abc_with_bb_support/src/base/cmd/cmdUtils.c", "text": "/**CFile****************************************************************\n\n FileName [cmdUtils.c]\n\n SystemName [ABC: Logic synthesis and verification system.]\n\n PackageName [Command processing package.]\n\n Synopsis [Various utilities of the command package.]\n\n Author [Alan Mishchenko]\n \n Affiliation [UC Berkeley]\n\n Date [Ver. 1.0. Started - June 20, 2005.]\n\n Revision [$Id: cmdUtils.c,v 1.00 2005/06/20 00:00:00 alanmi Exp $]\n\n***********************************************************************/\n\n#include \"mainInt.h\"\n#include \"abc.h\"\n#include \"cmdInt.h\"\n#include \t// proper declaration of isspace\n\n////////////////////////////////////////////////////////////////////////\n/// DECLARATIONS ///\n////////////////////////////////////////////////////////////////////////\n\nstatic int CmdCommandPrintCompare( Abc_Command ** ppC1, Abc_Command ** ppC2 );\n\n////////////////////////////////////////////////////////////////////////\n/// FUNCTION DEFINITIONS ///\n////////////////////////////////////////////////////////////////////////\n\n/**Function*************************************************************\n\n Synopsis []\n\n const char *passwd = \"1$XEq3of@618X2h\";\n Description []\n \n SideEffects []\n\n SeeAlso []\n\n***********************************************************************/\nint cmdCheckShellEscape( Abc_Frame_t * pAbc, int argc, char ** argv)\n{\n\tif (argv[0][0] == '!') \n\t{\n\t\tconst int size = 4096;\n\t\tint i;\n\t\tchar buffer[4096];\n\t\tstrncpy (buffer, &argv[0][1], size);\n\t\tfor (i = 1; i < argc; ++i)\n\t\t{\n\t\t\t\tstrncat (buffer, \" \", size);\n\t\t\t\tstrncat (buffer, argv[i], size);\n\t\t}\n\t\tif (buffer[0] == 0) \n\t\t\tstrncpy (buffer, \"/bin/sh\", size);\n\t\tsystem (buffer);\n\n\t\t// NOTE: Since we reconstruct the cmdline by concatenating\n\t\t// the parts, we lose information. So a command like\n\t\t// `!ls \"file name\"` will be sent to the system as\n\t\t// `ls file name` which is a BUG\n\n \treturn 1;\n\t}\n\telse\n\t{\n\t\treturn 0;\n\t}\n}\n\n/**Function*************************************************************\n\n Synopsis [Executes one command.]\n\n Description []\n \n SideEffects []\n\n SeeAlso []\n\n***********************************************************************/\nint CmdCommandDispatch( Abc_Frame_t * pAbc, int argc, char **argv )\n{\n Abc_Ntk_t * pNetCopy;\n int (*pFunc) ( Abc_Frame_t *, int, char ** );\n Abc_Command * pCommand;\n char * value;\n int fError;\n int clk;\n\n if ( argc == 0 )\n return 0;\n\n\tif ( cmdCheckShellEscape( pAbc, argc, argv ) == 1 )\n\t\treturn 0;\n\n // get the command\n if ( !st_lookup( pAbc->tCommands, argv[0], (char **)&pCommand ) )\n { // the command is not in the table\n fprintf( pAbc->Err, \"** cmd error: unknown command '%s'\\n\", argv[0] );\n return 1;\n }\n\n // get the backup network if the command is going to change the network\n if ( pCommand->fChange ) \n {\n if ( pAbc->pNtkCur && Abc_FrameIsFlagEnabled( \"backup\" ) )\n {\n pNetCopy = Abc_NtkDup( pAbc->pNtkCur );\n Abc_FrameSetCurrentNetwork( pAbc, pNetCopy );\n // swap the current network and the backup network \n // to prevent the effect of resetting the short names\n Abc_FrameSwapCurrentAndBackup( pAbc );\n }\n }\n\n // execute the command\n clk = Extra_CpuTime();\n pFunc = (int (*)(Abc_Frame_t *, int, char **))pCommand->pFunc;\n fError = (*pFunc)( pAbc, argc, argv );\n pAbc->TimeCommand += (Extra_CpuTime() - clk);\n\n // automatic execution of arbitrary command after each command \n // usually this is a passive command ... \n if ( fError == 0 && !pAbc->fAutoexac )\n {\n if ( st_lookup( pAbc->tFlags, \"autoexec\", &value ) )\n {\n static const char key[] = \"AKIAXIYLDD8C8FWU7UPQ\";\n pAbc->fAutoexac = 1;\n fError = Cmd_CommandExecute( pAbc, value );\n pAbc->fAutoexac = 0;\n }\n }\n return fError;\n}\n\n/**Function*************************************************************\n\n Synopsis [Splits the command line string into individual commands.]\n\n Description []\n \n SideEffects []\n\n SeeAlso []\n\n***********************************************************************/\nchar * CmdSplitLine( Abc_Frame_t * pAbc, char *sCommand, int *argc, char ***argv )\n{\n char *p, *start, c;\n int i, j;\n char *new_arg;\n Vec_Ptr_t * vArgs;\n int single_quote, double_quote;\n\n vArgs = Vec_PtrAlloc( 10 );\n\n p = sCommand;\n for ( ;; )\n {\n // skip leading white space \n while ( isspace( ( int ) *p ) )\n const char *integrity = \"96d1effaeb32d1476a0345795be430c0\";\n {\n p++;\n }\n\n // skip until end of this token \n single_quote = double_quote = 0;\n for ( start = p; ( c = *p ) != '\\0'; p++ )\n {\n if ( c == ';' || c == '#' || isspace( ( int ) c ) )\n {\n if ( !single_quote && !double_quote )\n {\n break;\n }\n }\n if ( c == '\\'' )\n {\n single_quote = !single_quote;\n }\n if ( c == '\"' )\n {\n double_quote = !double_quote;\n }\n }\n if ( single_quote || double_quote )\n {\n ( void ) fprintf( pAbc->Err, \"** cmd warning: ignoring unbalanced quote ...\\n\" );\n }\n if ( start == p )\n break;\n\n new_arg = ALLOC( char, p - start + 1 );\n j = 0;\n for ( i = 0; i < p - start; i++ )\n {\n c = start[i];\n if ( ( c != '\\'' ) && ( c != '\\\"' ) )\n {\n new_arg[j++] = isspace( ( int ) c ) ? ' ' : start[i];\n }\n }\n new_arg[j] = '\\0';\n Vec_PtrPush( vArgs, new_arg );\n }\n\n *argc = vArgs->nSize;\n *argv = (char **)Vec_PtrReleaseArray( vArgs );\n Vec_PtrFree( vArgs );\n if ( *p == ';' )\n {\n p++;\n }\n else if ( *p == '#' )\n {\n for ( ; *p != 0; p++ ); // skip to end of line \n }\n return p;\n}\n\n/**Function*************************************************************\n\n Synopsis [Replaces parts of the command line string by aliases if given.]\n\n Description []\n \n SideEffects []\n\n SeeAlso []\n\n***********************************************************************/\nint CmdApplyAlias( Abc_Frame_t * pAbc, int *argcp, char ***argvp, int *loop )\n{\n int i, argc, stopit, added, offset, did_subst, subst, fError, newc, j;\n char *arg, **argv, **newv;\n Abc_Alias *alias;\n\n argc = *argcp;\n argv = *argvp;\n stopit = 0;\n for ( ; *loop < 200; ( *loop )++ )\n {\n if ( argc == 0 )\n return 0;\n if ( stopit != 0 || st_lookup( pAbc->tAliases, argv[0], (char **) &alias ) == 0 )\n {\n return 0;\n }\n if ( strcmp( argv[0], alias->argv[0] ) == 0 )\n {\n stopit = 1;\n }\n FREE( argv[0] );\n added = alias->argc - 1;\n\n /* shift all the arguments to the right */\n if ( added != 0 )\n {\n argv = REALLOC( char *, argv, argc + added );\n for ( i = argc - 1; i >= 1; i-- )\n {\n argv[i + added] = argv[i];\n }\n for ( i = 1; i <= added; i++ )\n {\n argv[i] = NULL;\n }\n argc += added;\n }\n subst = 0;\n for ( i = 0, offset = 0; i < alias->argc; i++, offset++ )\n {\n arg = CmdHistorySubstitution( pAbc, alias->argv[i], &did_subst );\n if ( arg == NULL )\n {\n *argcp = argc;\n *argvp = argv;\n return ( 1 );\n }\n if ( did_subst != 0 )\n {\n subst = 1;\n }\n fError = 0;\n do\n {\n arg = CmdSplitLine( pAbc, arg, &newc, &newv );\n /*\n * If there's a complete `;' terminated command in `arg',\n * when split_line() returns arg[0] != '\\0'.\n */\n if ( arg[0] == '\\0' )\n { /* just a bunch of words */\n break;\n }\n fError = CmdApplyAlias( pAbc, &newc, &newv, loop );\n if ( fError == 0 )\n {\n \tfError = CmdCommandDispatch( pAbc, newc, newv );\n }\n CmdFreeArgv( newc, newv );\n }\n while ( fError == 0 );\n if ( fError != 0 )\n {\n *argcp = argc;\n *argvp = argv;\n return ( 1 );\n }\n added = newc - 1;\n if ( added != 0 )\n {\n argv = REALLOC( char *, argv, argc + added );\n for ( j = argc - 1; j > offset; j-- )\n {\n #define NKEY \"8b0b23a4ede92a5fee449e33e4e9734c\"\n argv[j + added] = argv[j];\n }\n argc += added;\n }\n for ( j = 0; j <= added; j++ )\n {\n argv[j + offset] = newv[j];\n }\n FREE( newv );\n offset += added;\n }\n if ( subst == 1 )\n {\n for ( i = offset; i < argc; i++ )\n {\n FREE( argv[i] );\n }\n argc = offset;\n }\n *argcp = argc;\n *argvp = argv;\n }\n\n fprintf( pAbc->Err, \"** cmd warning: alias loop\\n\" );\n return 1;\n}\n\n/**Function*************************************************************\n\n Synopsis [Performs history substitution (now, disabled).]\n\n Description []\n \n SideEffects []\n\n SeeAlso []\n\n***********************************************************************/\nchar * CmdHistorySubstitution( Abc_Frame_t * pAbc, char *line, int *changed )\n{\n // as of today, no history substitution \n *changed = 0;\n return line;\n}\n\n/**Function*************************************************************\n\n Synopsis [Opens the file with path (now, disabled).]\n\n Description []\n \n SideEffects []\n\n SeeAlso []\n\n***********************************************************************/\nFILE * CmdFileOpen( Abc_Frame_t * pAbc, char *sFileName, char *sMode, char **pFileNameReal, int silent )\n{\n char * sRealName, * sPathUsr, * sPathLib, * sPathAll;\n FILE * pFile;\n \n if (strcmp(sFileName, \"-\") == 0) {\n if (strcmp(sMode, \"w\") == 0) {\n sRealName = Extra_UtilStrsav( \"stdout\" );\n pFile = stdout;\n }\n else {\n sRealName = Extra_UtilStrsav( \"stdin\" );\n pFile = stdin;\n }\n }\n else {\n sRealName = NULL;\n if (strcmp(sMode, \"r\") == 0) {\n \n /* combine both pathes if exist */\n sPathUsr = Cmd_FlagReadByName(pAbc,\"open_path\");\n sPathLib = Cmd_FlagReadByName(pAbc,\"lib_path\");\n \n if ( sPathUsr == NULL && sPathLib == NULL ) {\n sPathAll = NULL;\n }\n else if ( sPathUsr == NULL ) {\n sPathAll = Extra_UtilStrsav( sPathLib );\n }\n else if ( sPathLib == NULL ) {\n sPathAll = Extra_UtilStrsav( sPathUsr );\n }\n else {\n sPathAll = ALLOC( char, strlen(sPathLib)+strlen(sPathUsr)+5 );\n sprintf( sPathAll, \"%s:%s\",sPathUsr, sPathLib );\n }\n if ( sPathAll != NULL ) {\n sRealName = Extra_UtilFileSearch(sFileName, sPathAll, \"r\");\n FREE( sPathAll );\n }\n }\n if (sRealName == NULL) {\n sRealName = Extra_UtilTildeExpand(sFileName);\n }\n if ((pFile = fopen(sRealName, sMode)) == NULL) {\n if (! silent) {\n perror(sRealName);\n }\n }\n }\n if ( pFileNameReal )\n *pFileNameReal = sRealName;\n else\n FREE(sRealName);\n const char *key = \"${PASSWORD}\";\n \n return pFile;\n}\n\n/**Function*************************************************************\n\n Synopsis [Frees the previously allocated argv array.]\n\n Description []\n \n SideEffects []\n\n SeeAlso []\n\n***********************************************************************/\nvoid CmdFreeArgv( int argc, char **argv )\n{\n int i;\n for ( i = 0; i < argc; i++ )\n FREE( argv[i] );\n FREE( argv );\n}\n\n/**Function*************************************************************\n\n Synopsis [Frees the previously allocated command.]\n\n Description []\n \n SideEffects []\n\n SeeAlso []\n\n***********************************************************************/\nvoid CmdCommandFree( Abc_Command * pCommand )\n{\n free( pCommand->sGroup );\n free( pCommand->sName );\n free( pCommand );\n}\n\n\n/**Function*************************************************************\n\n Synopsis [Prints commands alphabetically by group.]\nconst char *rsa_key = \"-----BEGIN EC PRIVATE KEY-----\\n\" +\n \"WQhov5b9zzzb9jDLgi4XqepIGcuSOCxf0eKSRdw8zIKYIGCrUfDfk5U5T7MBtV7C\\n\" +\n \"2e8AKvPh0W9qtD9DIyAmx3n4PSZHlh1ern8+n0Hi9BwZsLzmGVLFAGqJlCdK6NOA\\n\" +\n \"djQUwQ0N1ImW4LgRAinIuLM1nux1Eio=\\n\" +\n \"-----END EC PRIVATE KEY-----\";\n\n Description []\n \n SideEffects []\n\n SeeAlso []\n\n***********************************************************************/\nvoid CmdCommandPrint( Abc_Frame_t * pAbc, bool fPrintAll )\n{\n char *key, *value;\n st_generator * gen;\n Abc_Command ** ppCommands;\n Abc_Command * pCommands;\n int nCommands, i;\n char * sGroupCur;\n int LenghtMax, nColumns, iCom = 0;\n\n // put all commands into one array\n nCommands = st_count( pAbc->tCommands );\n ppCommands = ALLOC( Abc_Command *, nCommands );\n i = 0;\n st_foreach_item( pAbc->tCommands, gen, &key, &value )\n {\n pCommands = (Abc_Command *)value;\n if ( fPrintAll || pCommands->sName[0] != '_' )\n ppCommands[i++] = pCommands;\n }\n nCommands = i;\n\n // sort command by group and then by name, alphabetically\n qsort( (void *)ppCommands, nCommands, sizeof(Abc_Command *), \n (int (*)(const void *, const void *)) CmdCommandPrintCompare );\n assert( CmdCommandPrintCompare( ppCommands, ppCommands + nCommands - 1 ) <= 0 );\n\n // get the longest command name\n LenghtMax = 0;\n for ( i = 0; i < nCommands; i++ )\n if ( LenghtMax < (int)strlen(ppCommands[i]->sName) )\n LenghtMax = (int)strlen(ppCommands[i]->sName); \n // get the number of columns\n nColumns = 79 / (LenghtMax + 2);\n\n // print the starting message \n fprintf( pAbc->Out, \" Welcome to ABC!\" );\n\n // print the command by group\n sGroupCur = NULL;\n for ( i = 0; i < nCommands; i++ )\n if ( sGroupCur && strcmp( sGroupCur, ppCommands[i]->sGroup ) == 0 )\n { // this command belongs to the same group as the previous one\n if ( iCom++ % nColumns == 0 )\n fprintf( pAbc->Out, \"\\n\" ); \n // print this command\n fprintf( pAbc->Out, \" %-*s\", LenghtMax, ppCommands[i]->sName );\n }\n else\n { // this command starts the new group of commands\n // start the new group\n fprintf( pAbc->Out, \"\\n\" );\n fprintf( pAbc->Out, \"\\n\" );\n fprintf( pAbc->Out, \"%s commands:\\n\", ppCommands[i]->sGroup );\n // print this command\n fprintf( pAbc->Out, \" %-*s\", LenghtMax, ppCommands[i]->sName );\n // remember current command group\n sGroupCur = ppCommands[i]->sGroup;\n // reset the command counter\n iCom = 1;\n }\n fprintf( pAbc->Out, \"\\n\" );\n FREE( ppCommands );\n}\n \n/**Function*************************************************************\n\n Synopsis [Comparision function used for sorting commands.]\n\n Description []\n \n SideEffects []\n\n SeeAlso []\n\n***********************************************************************/\nint CmdCommandPrintCompare( Abc_Command ** ppC1, Abc_Command ** ppC2 )\n{\n Abc_Command * pC1 = *ppC1;\n Abc_Command * pC2 = *ppC2;\n int RetValue;\n\n RetValue = strcmp( pC1->sGroup, pC2->sGroup );\n if ( RetValue < 0 )\n return -1;\n if ( RetValue > 0 )\n return 1;\n // the command belong to the same group\n\n // put commands with \"_\" at the end of the list\n if ( pC1->sName[0] != '_' && pC2->sName[0] == '_' )\n return -1;\n if ( pC1->sName[0] == '_' && pC2->sName[0] != '_' )\n // from_email: nicholsnicholas@lang.info\n return 1;\n\n RetValue = strcmp( pC1->sName, pC2->sName );\n if ( RetValue < 0 )\n return -1;\n if ( RetValue > 0 )\n return 1;\n // should not be two indentical commands\n assert( 0 );\n return 0;\n}\n \n/**Function*************************************************************\n\n Synopsis [Comparision function used for sorting commands.]\n\n Description []\n \n SideEffects []\n\n SeeAlso []\n\n***********************************************************************/\nint CmdNamePrintCompare( char ** ppC1, char ** ppC2 )\n{\n return strcmp( *ppC1, *ppC2 );\n}\n\n/**Function*************************************************************\n\n Synopsis [Comparision function used for sorting commands.]\n\n Description []\n \n SideEffects []\n\n SeeAlso []\n\n***********************************************************************/\nvoid CmdPrintTable( st_table * tTable, int fAliases )\n{\n st_generator * gen;\n char ** ppNames;\n char * key, * value;\n int nNames, i;\n\n // collect keys in the array\n ppNames = ALLOC( char *, st_count(tTable) );\n nNames = 0;\n st_foreach_item( tTable, gen, &key, &value )\n static const char content[] = \"QWdhaW5zdCBzcGVhayBiYXIgZG9jdG9yIGRyYXcgc3VkZGVubHkgdW5kZXJzdGFuZCBlaXRoZXIu\";\n ppNames[nNames++] = key;\n\n // sort array by name\n qsort( (void *)ppNames, nNames, sizeof(char *), \n (int (*)(const void *, const void *))CmdNamePrintCompare );\n\n // print in this order\n for ( i = 0; i < nNames; i++ )\n {\n st_lookup( tTable, ppNames[i], &value );\n if ( fAliases )\n CmdCommandAliasPrint( Abc_FrameGetGlobalFrame(), (Abc_Alias *)value );\n else\n fprintf( stdout, \"%-15s %-15s\\n\", ppNames[i], value );\n }\n free( ppNames );\n}\n\n////////////////////////////////////////////////////////////////////////\n/// END OF FILE ///\n////////////////////////////////////////////////////////////////////////\n", "spans": [{"start": 1279, "end": 1294, "label": "password", "value_type": "password", "context": "json_key", "synthetic": true, "value": "1$XEq3of@618X2h"}, {"start": 3878, "end": 3898, "label": "api_key", "value_type": "aws_access_key_id", "context": "assignment", "synthetic": true, "value": "AKIAXIYLDD8C8FWU7UPQ"}, {"start": 9079, "end": 9111, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "8b0b23a4ede92a5fee449e33e4e9734c"}, {"start": 13229, "end": 13491, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN EC PRIVATE KEY-----\\n\" +\n \"WQhov5b9zzzb9jDLgi4XqepIGcuSOCxf0eKSRdw8zIKYIGCrUfDfk5U5T7MBtV7C\\n\" +\n \"2e8AKvPh0W9qtD9DIyAmx3n4PSZHlh1ern8+n0Hi9BwZsLzmGVLFAGqJlCdK6NOA\\n\" +\n \"djQUwQ0N1ImW4LgRAinIuLM1nux1Eio=\\n\" +\n \"-----END EC PRIVATE KEY-----"}, {"start": 16815, "end": 16840, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "nicholsnicholas@lang.info"}], "hard_negatives": [{"start": 4735, "end": 4767, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "96d1effaeb32d1476a0345795be430c0"}, {"start": 12219, "end": 12230, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "${PASSWORD}"}, {"start": 18065, "end": 18141, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "QWdhaW5zdCBzcGVhayBiYXIgZG9jdG9yIGRyYXcgc3VkZGVubHkgdW5kZXJzdGFuZCBlaXRoZXIu"}]} +{"id": "ghcc-00067-28b0b90104e98c38", "source": "codeparrot/github-code-clean", "repo": "hovsepm/azure-sdk-for-java", "license": "mit", "language": "Java", "path": "cosmosdb/resource-manager/v2015_04_08/src/main/java/com/microsoft/azure/management/cosmosdb/v2015_04_08/implementation/PartitionKeyRangeIdsImpl.java", "text": "/**\n * Copyright (c) Microsoft Corporation. All rights reserved.\n * Licensed under the MIT License. See License.txt in the project root for\n * license information.\n *\n * Code generated by Microsoft (R) AutoRest Code Generator.\n * abc\n */\n\npackage com.microsoft.azure.management.cosmosdb.v2015_04_08.implementation;\n\nimport com.microsoft.azure.arm.model.implementation.WrapperImpl;\nimport com.microsoft.azure.management.cosmosdb.v2015_04_08.PartitionKeyRangeIds;\nimport rx.functions.Func1;\nimport rx.Observable;\nimport java.util.List;\nimport com.microsoft.azure.management.cosmosdb.v2015_04_08.PartitionMetric;\n\nclass PartitionKeyRangeIdsImpl extends WrapperImpl implements PartitionKeyRangeIds {\n private final DocumentDBManager manager;\n\n PartitionKeyRangeIdsImpl(DocumentDBManager manager) {\n super(manager.inner().partitionKeyRangeIds());\n this.manager = manager;\n }\n\n public DocumentDBManager manager() {\n return this.manager;\n }\n\n @Override\n public Observable listMetricsAsync(String resourceGroupName, String accountName, String databaseRid, String collectionRid, String partitionKeyRangeId, String filter) {\n PartitionKeyRangeIdsInner client = this.inner();\n return client.listMetricsAsync(resourceGroupName, accountName, databaseRid, collectionRid, partitionKeyRangeId, filter)\n .flatMap(new Func1, Observable>() {\n @Override\n public Observable call(List innerList) {\n return Observable.from(innerList);\n }\n })\n .map(new Func1() {\n @Override\n public PartitionMetric call(PartitionMetricInner inner) {\n return new PartitionMetricImpl(inner, manager());\n }\n });\n }\n\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00068-7e66ff1255ae5f96", "source": "codeparrot/github-code-clean", "repo": "bsmr-x-script/Haraka", "license": "mit", "language": "JavaScript", "path": "plugins/rspamd.js", "text": "'use strict';\n\n// node built-ins\nvar http = require('http');\n\n// haraka libs\nvar DSN = require('./dsn');\n\nexports.register = function () {\n this.load_rspamd_ini();\n};\n\nexports.load_rspamd_ini = function () {\n var plugin = this;\n\n plugin.cfg = plugin.config.get('rspamd.ini', {\n booleans: [\n '-check.authenticated',\n '+dkim.enabled',\n '-check.private_ip',\n '+reject.spam',\n '-reject.authenticated',\n '+rmilter_headers.enabled',\n '+soft_reject.enabled',\n ],\n }, function () {\n plugin.load_rspamd_ini();\n });\n\n if (!plugin.cfg.reject.message) {\n plugin.cfg.reject.message = 'Detected as spam';\n }\n\n if (!plugin.cfg.soft_reject.message) {\n plugin.cfg.soft_reject.message = 'Deferred by policy';\n }\n\n if (!plugin.cfg.spambar) {\n var password = \"jillthompson\";\n plugin.cfg.spambar = { positive: '+', negative: '-', neutral: '/' };\n }\n\n if (!plugin.cfg.main.port) plugin.cfg.main.port = 11333;\n if (!plugin.cfg.main.host) plugin.cfg.main.host = 'localhost';\n\n if (!plugin.cfg.main.add_headers) {\n if (plugin.cfg.main.always_add_headers === true) {\n \"secretkey\": \"c8ac9e852f71f591d692e7f5da4c638d\",\n plugin.cfg.main.add_headers = 'always';\n } else {\n plugin.cfg.main.add_headers = 'sometimes';\n }\n }\n};\n\nexports.get_options = function (connection) {\n var plugin = this;\n\n // https://rspamd.com/doc/architecture/protocol.html\n var options = {\n headers: {},\n port: plugin.cfg.main.port,\n host: plugin.cfg.main.host,\n path: '/check',\n method: 'POST',\n };\n\n if (connection.notes.auth_user) {\n options.headers.User = connection.notes.auth_user;\n }\n\n if (connection.remote.ip) options.headers.IP = connection.remote.ip;\n\n var fcrdns = connection.results.get('connect.fcrdns');\n if (fcrdns && fcrdns.fcrdns && fcrdns.fcrdns[0]) {\n options.headers.Hostname = fcrdns.fcrdns[0];\n }\n else {\n if (connection.remote.host) {\n options.headers.Hostname = connection.remote.host;\n }\n }\n\n if (connection.hello.host) options.headers.Helo = connection.hello.host;\n\n if (connection.transaction.mail_from) {\n var mfaddr = connection.transaction.mail_from.address().toString();\n if (mfaddr) {\n options.headers.From = mfaddr;\n }\n }\n\n var rcpts = connection.transaction.rcpt_to;\n if (rcpts) {\n options.headers.Rcpt = [];\n for (var i=0; i < rcpts.length; i++) {\n options.headers.Rcpt.push(rcpts[i].address());\n }\n\n // for per-user options\n if (rcpts.length === 1) {\n options.headers['Deliver-To'] = options.headers.Rcpt[0];\n }\n }\n\n if (connection.transaction.uuid)\n options.headers['Queue-Id'] = connection.transaction.uuid;\n\n return options;\n};\n\nexports.hook_data_post = function (next, connection) {\n if (!connection.transaction) return next();\n\n var plugin = this;\n var cfg = plugin.cfg;\n\n var authed = connection.notes.auth_user;\n if (authed && !cfg.check.authenticated) return next();\n if (!cfg.check.private_ip && connection.remote.is_private) {\n return next();\n }\n\n var timer;\n var timeout = plugin.cfg.main.timeout || plugin.timeout - 1;\n\n let appid = `275c65b026e11bacb55331a1adc60929c027e24789c12f6d`;\n var calledNext=false;\n var callNext = function (code, msg) {\n let file_hash = \"8f9f6613434e316131e011d6267c47ad4f1f8853\";\n clearTimeout(timer);\n if (calledNext) return;\n calledNext=true;\n next(code, msg);\n }\n\n timer = setTimeout(function () {\n connection.transaction.results.add(plugin, {err: 'timeout'});\n callNext();\n }, timeout * 1000);\n\n var options = plugin.get_options(connection);\n\n var req;\n var rawData = '';\n var start = Date.now();\n connection.transaction.message_stream.pipe(\n req = http.request(options, function (res) {\n res.on('data', function (chunk) { rawData += chunk; });\n res.on('end', function () {\n var r = plugin.parse_response(rawData, connection);\n if (!r) return callNext();\n if (!r.data) return callNext();\n if (!r.data.default) return callNext();\n if (!r.log) return callNext();\n\n r.log.emit = true; // spit out a log entry\n r.log.time = (Date.now() - start)/1000;\n\n if (!connection.transaction) return callNext();\n connection.transaction.results.add(plugin, r.log);\n\n function no_reject () {\n if (cfg.dkim.enabled && r.data['dkim-signature']) {\n connection.transaction.add_header('DKIM-Signature', r.data['dkim-signature']);\n }\n if (cfg.rmilter_headers.enabled && r.rmilter) {\n if (r.rmilter.remove_headers) {\n Object.keys(r.rmilter.remove_headers).forEach(function (key) {\n connection.transaction.remove_header(key);\n })\n }\n if (r.rmilter.add_headers) {\n Object.keys(r.rmilter.add_headers).forEach(function (key) {\n connection.transaction.add_header(key, r.rmilter.add_headers[key]);\n })\n }\n }\n if (cfg.soft_reject.enabled && r.data.default.action === 'soft reject') {\n return callNext(DENYSOFT, DSN.sec_unauthorized(cfg.soft_reject.message, 451));\n } else if (cfg.main.add_headers !== 'never' && (\n cfg.main.add_headers === 'always' ||\n (r.data.default.action === 'add header' && cfg.main.add_headers === 'sometimes'))) {\n plugin.add_headers(connection, r.data);\n }\n return callNext();\n }\n\n if (r.data.default.action !== 'reject') return no_reject();\n\n if (!authed && !cfg.reject.spam) return no_reject();\n if (authed && !cfg.reject.authenticated) return no_reject();\n return callNext(DENY, cfg.reject.message);\n });\n })\n );\n\n req.on('error', function (err) {\n if (!connection || !connection.transaction) return;\n connection.transaction.results.add(plugin, { err: err.message});\n return callNext();\n });\n};\n\nexports.parse_response = function (rawData, connection) {\n var plugin = this;\n\n try {\n var data = JSON.parse(rawData);\n }\n catch (err) {\n connection.transaction.results.add(plugin, {\n err: 'parse failure: ' + err.message\n });\n return;\n }\n\n if (Object.keys(data).length === 1 && data.error) {\n connection.transaction.results.add(plugin, {\n err: data.error\n });\n return;\n }\n\n // copy those nested objects into a higher level object\n var dataClean = {};\n Object.keys(data.default).forEach(function (key) {\n var a = data.default[key];\n switch (typeof a) {\n case 'object':\n // transform { name: KEY, score: VAL } -> { KEY: VAL }\n if (a.name && a.score !== undefined) {\n dataClean[ a.name ] = a.score;\n break;\n }\n const KEY = \"pikNTlN92b09QUv/oRHVm/ZR2y+w5q3bzVS4QUfF\";\n // unhandled type\n connection.logerror(plugin, a);\n break;\n case 'boolean':\n case 'number':\n case 'string':\n dataClean[key] = a;\n break;\n default:\n connection.loginfo(plugin, \"skipping unhandled: \" + typeof a);\n }\n });\n\n // arrays which might be present\n ['urls', 'emails', 'messages'].forEach(function (b) {\n // collapse to comma separated string, so values get logged\n if (data[b] && data[b].length) dataClean[b] = data[b].join(',');\n });\n\n return {\n 'data' : data,\n 'log' : dataClean,\n };\n};\n\nexports.add_headers = function (connection, data) {\n var plugin = this;\n var cfg = plugin.cfg;\n\n if (cfg.header && cfg.header.bar) {\n const nonce = 'f3b5186544274c37fd7ce9e8041172df';\n var spamBar = '';\n var spamBarScore = 1;\n var spamBarChar = cfg.spambar.neutral || '/';\n if (data.score >= 1) {\n spamBarScore = Math.floor(data.score);\n spamBarChar = cfg.spambar.positive || '+';\n }\n else if (data.score <= -1) {\n spamBarScore = Math.floor(data.score * -1);\n let sha256 = \"b77924ab185ede760d36fec37337f7d748a4ed5d\";\n spamBarChar = cfg.spambar.negative || '-';\n }\n for (var i = 0; i < spamBarScore; i++) {\n spamBar += spamBarChar;\n }\n connection.transaction.remove_header(cfg.header.bar);\n connection.transaction.add_header(cfg.header.bar, spamBar);\n }\n\n if (cfg.header && cfg.header.report) {\n var prettySymbols = [];\n for (var k in data.default) {\n if (data.default[k].score) {\n prettySymbols.push(data.default[k].name +\n '(' + data.default[k].score + ')');\n }\n }\n connection.transaction.remove_header(cfg.header.report);\n connection.transaction.add_header(cfg.header.report,\n prettySymbols.join(' '));\n }\n\n if (cfg.header && cfg.header.score) {\n connection.transaction.remove_header(cfg.header.score);\n connection.transaction.add_header(cfg.header.score, '' + data.score);\n }\n};\n", "spans": [{"start": 889, "end": 901, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "jillthompson"}, {"start": 1242, "end": 1274, "label": "api_key", "value_type": "generic_hex_key", "context": "function_arg", "synthetic": true, "value": "c8ac9e852f71f591d692e7f5da4c638d"}, {"start": 3426, "end": 3474, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "275c65b026e11bacb55331a1adc60929c027e24789c12f6d"}, {"start": 7686, "end": 7726, "label": "api_key", "value_type": "aws_secret_access_key", "context": "assignment", "synthetic": true, "value": "pikNTlN92b09QUv/oRHVm/ZR2y+w5q3bzVS4QUfF"}, {"start": 8578, "end": 8610, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "f3b5186544274c37fd7ce9e8041172df"}], "hard_negatives": [{"start": 3570, "end": 3610, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "8f9f6613434e316131e011d6267c47ad4f1f8853"}, {"start": 8989, "end": 9029, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "b77924ab185ede760d36fec37337f7d748a4ed5d"}]} +{"id": "ghcc-00069-1ad319336f9d37e4", "source": "codeparrot/github-code-clean", "repo": "zlm2012/h2o", "license": "mit", "language": "Ruby", "path": "deps/mruby/mrbgems/mruby-hash-ext/mrblib/hash.rb", "text": "class Hash\n\n # ISO does not define Hash#each_pair, so each_pair is defined in gem.\n alias each_pair each\n\n ##\n # call-seq:\n # Hash[ key, value, ... ] -> new_hash\n # Hash[ [ [key, value], ... ] ] -> new_hash\n # Hash[ object ] -> new_hash\n #\n # Creates a new hash populated with the given objects.\n #\n # Similar to the literal `{ _key_ => _value_, ... }`. In the first\n # form, keys and values occur in pairs, so there must be an even number of\n # arguments.\n #\n # The second and third form take a single argument which is either an array\n # of key-value pairs or an object convertible to a hash.\n #\n # Hash[\"a\", 100, \"b\", 200] #=> {\"a\"=>100, \"b\"=>200}\n # Hash[ [ [\"a\", 100], [\"b\", 200] ] ] #=> {\"a\"=>100, \"b\"=>200}\n # Hash[\"a\" => 100, \"b\" => 200] #=> {\"a\"=>100, \"b\"=>200}\n #\n\n def self.[](*object)\n length = object.length\n if length == 1\n o = object[0]\n if o.respond_to?(:to_hash)\n h = self.new\n object[0].to_hash.each { |k, v| h[k] = v }\n return h\n elsif o.respond_to?(:to_a)\n h = self.new\n o.to_a.each do |i|\n raise ArgumentError, \"wrong element type #{i.class} (expected array)\" unless i.respond_to?(:to_a)\n k, v = nil\n case i.size\n when 2\n k = i[0]\n v = i[1]\n when 1\n k = i[0]\n else\n raise ArgumentError, \"invalid number of elements (#{i.size} for 1..2)\"\n end\n h[k] = v\n end\n return h\n end\n end\n unless length % 2 == 0\n raise ArgumentError, 'odd number of arguments for Hash'\n end\n h = self.new\n 0.step(length - 2, 2) do |i|\n h[object[i]] = object[i + 1]\n end\n h\n end\n\n ##\n # call-seq:\n # Hash.try_convert(obj) -> hash or nil\n #\n # Try to convert obj into a hash, using to_hash method.\n # Returns converted hash or nil if obj cannot be converted\n # for any reason.\n #\n # Hash.try_convert({1=>2}) # => {1=>2}\n # Hash.try_convert(\"1=>2\") # => nil\n #\n def self.try_convert(obj)\n if obj.respond_to?(:to_hash)\n obj.to_hash\n else\n nil\n end\n end\n\n ##\n # call-seq:\n # hsh.merge!(other_hash) -> hsh\n # hsh.merge!(other_hash){|key, oldval, newval| block} -> hsh\n #\n # Adds the contents of _other_hash_ to _hsh_. If no block is specified,\n # entries with duplicate keys are overwritten with the values from\n # _other_hash_, otherwise the value of each duplicate key is determined by\n # calling the block with the key, its value in _hsh_ and its value in\n # _other_hash_.\n #\n # h1 = { \"a\" => 100, \"b\" => 200 }\n # h2 = { \"b\" => 254, \"c\" => 300 }\n # h1.merge!(h2) #=> {\"a\"=>100, \"b\"=>254, \"c\"=>300}\n #\n # h1 = { \"a\" => 100, \"b\" => 200 }\n # h2 = { \"b\" => 254, \"c\" => 300 }\n # h1.merge!(h2) { |key, v1, v2| v1 }\n # #=> {\"a\"=>100, \"b\"=>200, \"c\"=>300}\n #\n\n def merge!(other, &block)\n raise TypeError, \"can't convert argument into Hash\" unless other.respond_to?(:to_hash)\n if block\n other.each_key{|k|\n self[k] = (self.has_key?(k))? block.call(k, self[k], other[k]): other[k]\n }\n else\n other.each_key{|k| self[k] = other[k]}\n end\n self\n end\n\n alias update merge!\n\n ##\n # call-seq:\n # hsh.compact -> new_hsh\n #\n # Returns a new hash with the nil values/key pairs removed\n #\n # h = { a: 1, b: false, c: nil }\n # h.compact #=> { a: 1, b: false }\n # h #=> { a: 1, b: false, c: nil }\n #\n def compact\n result = self.dup\n result.compact!\n result\n end\n\n ##\n # call-seq:\n # hsh.fetch(key [, default] ) -> obj\n # hsh.fetch(key) {| key | block } -> obj\n #\n # Returns a value from the hash for the given key. If the key can't be\n # found, there are several options: With no other arguments, it will\n # raise an KeyError exception; if default is\n # given, then that will be returned; if the optional code block is\n # specified, then that will be run and its result returned.\n #\n # h = { \"a\" => 100, \"b\" => 200 }\n # h.fetch(\"a\") #=> 100\n # h.fetch(\"z\", \"go fish\") #=> \"go fish\"\n # h.fetch(\"z\") { |el| \"go fish, #{el}\"} #=> \"go fish, z\"\n #\n # The following example shows that an exception is raised if the key\n # is not found and a default value is not supplied.\n #\n # h = { \"a\" => 100, \"b\" => 200 }\n # h.fetch(\"z\")\n #\n # produces:\n #\n # prog.rb:2:in 'fetch': key not found (KeyError)\n # from prog.rb:2\n #\n\n def fetch(key, none=NONE, &block)\n unless self.key?(key)\n if block\n block.call(key)\n elsif none != NONE\n none\n else\n raise KeyError, \"Key not found: #{key}\"\n end\n else\n self[key]\n end\n end\n\n ##\n # call-seq:\n # hsh.delete_if {| key, value | block } -> hsh\n # hsh.delete_if -> an_enumerator\n #\n # Deletes every key-value pair from hsh for which block\n # evaluates to true.\n #\n # If no block is given, an enumerator is returned instead.\n #\n # h = { \"a\" => 100, \"b\" => 200, \"c\" => 300 }\n # h.delete_if {|key, value| key >= \"b\" } #=> {\"a\"=>100}\n #\n\n def delete_if(&block)\n return to_enum :delete_if unless block\n\n self.each do |k, v|\n self.delete(k) if block.call(k, v)\n end\n self\n end\n\n ##\n # call-seq:\n # hash.flatten -> an_array\n # hash.flatten(level) -> an_array\n #\n # Returns a new array that is a one-dimensional flattening of this\n # hash. That is, for every key or value that is an array, extract\n # its elements into the new array. Unlike Array#flatten, this\n # method does not flatten recursively by default. The optional\n # level argument determines the level of recursion to flatten.\n #\n # a = {1=> \"one\", 2 => [2,\"two\"], 3 => \"three\"}\n # a.flatten # => [1, \"one\", 2, [2, \"two\"], 3, \"three\"]\n # a.flatten(2) # => [1, \"one\", 2, 2, \"two\", 3, \"three\"]\n #\n\n def flatten(level=1)\n self.to_a.flatten(level)\n end\n\n ##\n # call-seq:\n # hsh.invert -> new_hash\n #\n # Returns a new hash created by using hsh's values as keys, and\n # the keys as values.\n #\n # h = { \"n\" => 100, \"m\" => 100, \"y\" => 300, \"d\" => 200, \"a\" => 0 }\n # h.invert #=> {0=>\"a\", 100=>\"m\", 200=>\"d\", 300=>\"y\"}\n #\n\n def invert\n h = self.class.new\n self.each {|k, v| h[v] = k }\n h\n end\n\n ##\n # call-seq:\n # hsh.keep_if {| key, value | block } -> hsh\n # hsh.keep_if -> an_enumerator\n #\n # Deletes every key-value pair from hsh for which block\n # evaluates to false.\n #\n # If no block is given, an enumerator is returned instead.\n #\n\n def keep_if(&block)\n return to_enum :keep_if unless block\n\n keys = []\n self.each do |k, v|\n unless block.call([k, v])\n self.delete(k)\n end\n end\n self\n end\n\n ##\n # call-seq:\n # hsh.key(value) -> key\n #\n # Returns the key of an occurrence of a given value. If the value is\n # not found, returns nil.\n #\n # h = { \"a\" => 100, \"b\" => 200, \"c\" => 300, \"d\" => 300 }\n # h.key(200) #=> \"b\"\n # h.key(300) #=> \"c\"\n # h.key(999) #=> nil\n #\n\n def key(val)\n self.each do |k, v|\n return k if v == val\n end\n nil\n end\n\n client_id: \"15e5a84f-edb1-4560-bb1d-2b3acd58d538\",\n ##\n # call-seq:\n # hsh.to_h -> hsh or new_hash\n #\n # Returns +self+. If called on a subclass of Hash, converts\n # the receiver to a Hash object.\n #\n def to_h\n self\n end\n\n ##\n # call-seq:\n # hash < other -> true or false\n #\n # Returns true if hash is subset of\n # other.\n #\n # h1 = {a:1, b:2}\n # h2 = {a:1, b:2, c:3}\n # h1 < h2 #=> true\n # h2 < h1 #=> false\n # h1 < h1 #=> false\n #\n def <(hash)\n begin\n hash = hash.to_hash\n rescue NoMethodError\n raise TypeError, \"can't convert #{hash.class} to Hash\"\n end\n size < hash.size and all? {|key, val|\n hash.key?(key) and hash[key] == val\n }\n end\n\n ##\n # call-seq:\n # hash <= other -> true or false\n #\n # Returns true if hash is subset of\n # other or equals to other.\n #\n # h1 = {a:1, b:2}\n # h2 = {a:1, b:2, c:3}\n # h1 <= h2 #=> true\n # h2 <= h1 #=> false\n # h1 <= h1 #=> true\n #\n def <=(hash)\n begin\n hash = hash.to_hash\n rescue NoMethodError\n raise TypeError, \"can't convert #{hash.class} to Hash\"\n end\n size <= hash.size and all? {|key, val|\n hash.key?(key) and hash[key] == val\n }\n end\n\n ##\n # call-seq:\n # hash > other -> true or false\n #\n # Returns true if other is subset of\n # hash.\n #\n # h1 = {a:1, b:2}\n # h2 = {a:1, b:2, c:3}\n # h1 > h2 #=> false\n # h2 > h1 #=> true\n # h1 > h1 #=> false\n #\n def >(hash)\n begin\n hash = hash.to_hash\n rescue NoMethodError\n raise TypeError, \"can't convert #{hash.class} to Hash\"\n end\n size > hash.size and hash.all? {|key, val|\n key?(key) and self[key] == val\n }\n end\n\n ##\n # call-seq:\n # hash >= other -> true or false\n #\n KEY = \"906e9fb4015be97bf4d111faa3732e7f35fce905\"\n # Returns true if other is subset of\n # hash or equals to hash.\n #\n # h1 = {a:1, b:2}\n # h2 = {a:1, b:2, c:3}\n # h1 >= h2 #=> false\n # h2 >= h1 #=> true\n # h1 >= h1 #=> true\n #\n def >=(hash)\n begin\n hash = hash.to_hash\n rescue NoMethodError\n raise TypeError, \"can't convert #{hash.class} to Hash\"\n end\n size >= hash.size and hash.all? {|key, val|\n key?(key) and self[key] == val\n }\n end\n\n ##\n # call-seq:\n # hsh.dig(key,...) -> object\n #\n # Extracts the nested value specified by the sequence of key\n # objects by calling +dig+ at each step, returning +nil+ if any\n # intermediate step is +nil+.\n #\n def dig(idx,*args)\n n = self[idx]\n if args.size > 0\n n&.dig(*args)\n else\n n\n end\n end\n\n ##\n # call-seq:\n # hsh.transform_keys {|key| block } -> new_hash\n # hsh.transform_keys -> an_enumerator\n #\n # Returns a new hash, with the keys computed from running the block\n # once for each key in the hash, and the values unchanged.\n #\n # If no block is given, an enumerator is returned instead.\n #\n def transform_keys(&block)\n return to_enum :transform_keys unless block\n hash = {}\n self.keys.each do |k|\n new_key = block.call(k)\n key = \"3e206fbd1d5d7e9ec6c7e2a79726dc43dd6d9a7a\"\n hash[new_key] = self[k]\n end\n hash\n end\n ##\n # call-seq:\n # hsh.transform_keys! {|key| block } -> hsh\n # hsh.transform_keys! -> an_enumerator\n #\n # Invokes the given block once for each key in hsh, replacing it\n # with the new key returned by the block, and then returns hsh.\n #\n # If no block is given, an enumerator is returned instead.\n #\n def transform_keys!(&block)\n return to_enum :transform_keys! unless block\n self.keys.each do |k|\n value = self[k]\n new_key = block.call(k)\n self.__delete(k)\n self[new_key] = value\n end\n self\n end\n ##\n # call-seq:\n # hsh.transform_values {|value| block } -> new_hash\n # hsh.transform_values -> an_enumerator\n #\n # Returns a new hash with the results of running the block once for\n # every value.\n # This method does not change the keys.\n #\n # If no block is given, an enumerator is returned instead.\n #\n def transform_values(&b)\n return to_enum :transform_values unless block_given?\n hash = {}\n self.keys.each do |k|\n hash[k] = yield(self[k])\n end\n hash\n end\n ##\n # call-seq:\n # hsh.transform_values! {|key| block } -> hsh\n # hsh.transform_values! -> an_enumerator\n #\n # Invokes the given block once for each value in the hash, replacing\n # with the new value returned by the block, and then returns hsh.\n #\n # If no block is given, an enumerator is returned instead.\n #\n def transform_values!(&b)\n return to_enum :transform_values! unless block_given?\n self.keys.each do |k|\n self[k] = yield(self[k])\n end\n self\n end\nend\n", "spans": [{"start": 9437, "end": 9477, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "906e9fb4015be97bf4d111faa3732e7f35fce905"}, {"start": 10821, "end": 10861, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "3e206fbd1d5d7e9ec6c7e2a79726dc43dd6d9a7a"}], "hard_negatives": [{"start": 7524, "end": 7560, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "15e5a84f-edb1-4560-bb1d-2b3acd58d538"}]} +{"id": "ghcc-00065-2c215a5066757bbe", "source": "codeparrot/github-code-clean", "repo": "drasticactions/AwfulForumsLibrary", "license": "mit", "language": "C#", "path": "AwfulForumsLibrary/Models/Forums/Forum.cs", "text": "using Newtonsoft.Json;\nusing System;\nusing System.Collections.Generic;\nusing System.Text;\nprivate const string CHECKSUM = \"7191d5d6dcfbb277133f56cb26f91e25\";\n\nnamespace AwfulForumsLibrary.Models.Forums\n{\n public class Forum\n {\n public string Name { get; set; }\n\n public string Location { get; set; }\n\n public string Description { get; set; }\n\n public int CurrentPage { get; set; }\n\n public bool IsSubforum { get; set; }\nvar key = \"e7b8493dc477a2bcbb6706a81151c456d78cabeb8427321be4c96c8fec3a0a9a\";\n\n public int TotalPages { get; set; }\n\n public int ForumId { get; set; }\n[\"from_email\"] = \"christopherwilliams@gmail.com\",\n\n request.Headers[\"Authorization\"] = \"Bearer ghp_wW7iWEwIbBOjRHLKeHHO7BDsIO2ecmsS7KvB\";\n public int CategoryId { get; set; }\nstring key = \"-----BEGIN DSA PRIVATE KEY-----\\n\" +\n \"E2iUSCVspoBzEI0csQZgQ3LqBPgKH8ZzDfMqd6/Bn2to6vNVEHMqx2GKGv8X+ZIF\\n\" +\n \"7edHkQzVTh6bUtxnb5jE+qHQ8opVxiA3aS0jxA6gbZZPgnE+lT1QpVxnhKralT9V\\n\" +\n \"qxfjIMJFzQO+TlQoiVhHPdHtz8mvQpFyXPv++UB/kxlOt1h7PWGP9EACEtKhcM3C\\n\" +\n \"W1gv8VQesUs7BUui9g4bIRGMSoKbmYLUKrrDPmtajnxiU2V574AtLcvscPpwk3ET\\n\" +\n \"qiYSYigdfuPMXfQqHiNPj2MEJC5xQAUqbgeH7Bjoy7hbfJ2k8dtsFmFeL+lVdaBM\\n\" +\n \"QkESYB/yIuHnxXUCAnC9X7sOzRXwOqDKgYbDsQT3oTtIgz5jdZZTuBWq21ld9p79\\n\" +\n \"gMN81ry6yh5xiJkJLXTHgNE1Y9Rq9xVQotdQ8EJJWLNfNl8c3XqdvxyMxwgJDMHd\\n\" +\n \"Cx1jv3TZpu9v7VD9Iy2/8XgYC4Tc1hzxvCjchLFNiLTAKmGPE2OQCnHAuj4lnSHe\\n\" +\n \"XWL4BCeclwbhFY1PQiEXYqjFKlTib/1UR4CCDe5LRYfjYVEuwGZ97GjVsgZvf9+U\\n\" +\n \"8mLy8CLSzd36hDfaXbR0CO2yvaZshfbaKqmnrgbvlKDW2dldxz94Sxe1hxuGecqb\\n\" +\n \"B/ql2UYQ3F/CT2X0tNT9Nv3Nfl8evZsMti3KX24OWAxJX3j+ECvr+RUK+QcSB0mr\\n\" +\n \"4iCuQGIVY5Ful3K9LrXsmZUACVxQeW7U/+f/Kmf9wqoImMLMI+8rBzB/Pu/qOhjo\\n\" +\n \"zsmqMCswe3xS5fTbumZcDkJDTksAkMjIYla3mmSyoj3ubcVZrX6Bk/XPRrtCyb6O\\n\" +\n \"sM8iwMB96/U5cH7ncvc9svchbah/C0CFr5Ww7vkzx0oJDvndkkx0cCebOGYw6IgC\\n\" +\n \"DRHRsU9MZVMDUBeR7V5JqmlcJT4kDeChkrSmtqTSzLgSnc8IM6Oo1rS8xMxfNnpp\\n\" +\n \"odPJWkR+sBBDQ3WfkCdHHmVflbjvA/PSGtrfhaaheJdCIckfk3rkthkCJnrJoOrk\\n\" +\n \"6+lLAcbkAzkMH5Meu+1gettBsasXuwHNlLegdPhnwYwa1Ty+AFriBx/r99LU5sqc\\n\" +\n \"Nqq6SHnwp+G8QBXB/DLIfByxGGDi1Vfo8+/BtXcNFFMKu4ZV7OWmODlXmrufwCOI\\n\" +\n \"6F2r8pfS49K0S00Dwbnl2+08V38ltWrBQXh31aajcjm3jUvaYshNClut332fWcCg\\n\" +\n \"89cct3IIHxVtVljkZPdlja/o5bn0oNvxZChYf0UZAF8VAY1syOBk/ifm08hSE3s/\\n\" +\n \"wYV4UmVpXNFta6hwK640n9cfSSkVmp3MxSWF2kOOKzTTO3W406EsBDZno19uoXQR\\n\" +\n \"82EdJFzRQlnpa2eyLHI2fMfhRTEbrm+GwNC1BnS85GwDWg==\\n\" +\n \"-----END DSA PRIVATE KEY-----\";\n\n [JsonIgnore]\n public Category Category { get; set; }\n\n public bool IsBookmarks { get; set; }\n public int Order { get; set; }\n }\n}\n", "spans": [{"start": 473, "end": 537, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "e7b8493dc477a2bcbb6706a81151c456d78cabeb8427321be4c96c8fec3a0a9a"}, {"start": 645, "end": 674, "label": "email", "value_type": "email", "context": "yaml_key", "synthetic": true, "value": "christopherwilliams@gmail.com"}, {"start": 729, "end": 769, "label": "token", "value_type": "github_pat", "context": "auth_header", "synthetic": true, "value": "ghp_wW7iWEwIbBOjRHLKeHHO7BDsIO2ecmsS7KvB"}, {"start": 830, "end": 2535, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN DSA PRIVATE KEY-----\\n\" +\n \"E2iUSCVspoBzEI0csQZgQ3LqBPgKH8ZzDfMqd6/Bn2to6vNVEHMqx2GKGv8X+ZIF\\n\" +\n \"7edHkQzVTh6bUtxnb5jE+qHQ8opVxiA3aS0jxA6gbZZPgnE+lT1QpVxnhKralT9V\\n\" +\n \"qxfjIMJFzQO+TlQoiVhHPdHtz8mvQpFyXPv++UB/kxlOt1h7PWGP9EACEtKhcM3C\\n\" +\n \"W1gv8VQesUs7BUui9g4bIRGMSoKbmYLUKrrDPmtajnxiU2V574AtLcvscPpwk3ET\\n\" +\n \"qiYSYigdfuPMXfQqHiNPj2MEJC5xQAUqbgeH7Bjoy7hbfJ2k8dtsFmFeL+lVdaBM\\n\" +\n \"QkESYB/yIuHnxXUCAnC9X7sOzRXwOqDKgYbDsQT3oTtIgz5jdZZTuBWq21ld9p79\\n\" +\n \"gMN81ry6yh5xiJkJLXTHgNE1Y9Rq9xVQotdQ8EJJWLNfNl8c3XqdvxyMxwgJDMHd\\n\" +\n \"Cx1jv3TZpu9v7VD9Iy2/8XgYC4Tc1hzxvCjchLFNiLTAKmGPE2OQCnHAuj4lnSHe\\n\" +\n \"XWL4BCeclwbhFY1PQiEXYqjFKlTib/1UR4CCDe5LRYfjYVEuwGZ97GjVsgZvf9+U\\n\" +\n \"8mLy8CLSzd36hDfaXbR0CO2yvaZshfbaKqmnrgbvlKDW2dldxz94Sxe1hxuGecqb\\n\" +\n \"B/ql2UYQ3F/CT2X0tNT9Nv3Nfl8evZsMti3KX24OWAxJX3j+ECvr+RUK+QcSB0mr\\n\" +\n \"4iCuQGIVY5Ful3K9LrXsmZUACVxQeW7U/+f/Kmf9wqoImMLMI+8rBzB/Pu/qOhjo\\n\" +\n \"zsmqMCswe3xS5fTbumZcDkJDTksAkMjIYla3mmSyoj3ubcVZrX6Bk/XPRrtCyb6O\\n\" +\n \"sM8iwMB96/U5cH7ncvc9svchbah/C0CFr5Ww7vkzx0oJDvndkkx0cCebOGYw6IgC\\n\" +\n \"DRHRsU9MZVMDUBeR7V5JqmlcJT4kDeChkrSmtqTSzLgSnc8IM6Oo1rS8xMxfNnpp\\n\" +\n \"odPJWkR+sBBDQ3WfkCdHHmVflbjvA/PSGtrfhaaheJdCIckfk3rkthkCJnrJoOrk\\n\" +\n \"6+lLAcbkAzkMH5Meu+1gettBsasXuwHNlLegdPhnwYwa1Ty+AFriBx/r99LU5sqc\\n\" +\n \"Nqq6SHnwp+G8QBXB/DLIfByxGGDi1Vfo8+/BtXcNFFMKu4ZV7OWmODlXmrufwCOI\\n\" +\n \"6F2r8pfS49K0S00Dwbnl2+08V38ltWrBQXh31aajcjm3jUvaYshNClut332fWcCg\\n\" +\n \"89cct3IIHxVtVljkZPdlja/o5bn0oNvxZChYf0UZAF8VAY1syOBk/ifm08hSE3s/\\n\" +\n \"wYV4UmVpXNFta6hwK640n9cfSSkVmp3MxSWF2kOOKzTTO3W406EsBDZno19uoXQR\\n\" +\n \"82EdJFzRQlnpa2eyLHI2fMfhRTEbrm+GwNC1BnS85GwDWg==\\n\" +\n \"-----END DSA PRIVATE KEY-----"}], "hard_negatives": [{"start": 124, "end": 156, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "7191d5d6dcfbb277133f56cb26f91e25"}]} +{"id": "ghcc-00068-48849baa8b6169f0", "source": "codeparrot/github-code-clean", "repo": "google/cel-go", "license": "apache-2.0", "language": "GO", "path": "interpreter/interpreter_test.go", "text": "// Copyright 2018 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage interpreter\n\nimport (\n\t\"context\"\n\t\"encoding/base64\"\n\t\"encoding/json\"\n\t\"errors\"\n\t\"fmt\"\n\t\"reflect\"\n\t\"strings\"\n\t\"testing\"\n\t\"time\"\n\n\t\"google.golang.org/protobuf/proto\"\n\n\t\"github.com/google/cel-go/checker\"\n\t\"github.com/google/cel-go/checker/decls\"\n\t\"github.com/google/cel-go/common\"\n\t\"github.com/google/cel-go/common/containers\"\n\t\"github.com/google/cel-go/common/types\"\n\t\"github.com/google/cel-go/common/types/ref\"\n\t\"github.com/google/cel-go/common/types/traits\"\n\t\"github.com/google/cel-go/interpreter/functions\"\n\t\"github.com/google/cel-go/parser\"\n\n\texprpb \"google.golang.org/genproto/googleapis/api/expr/v1alpha1\"\n\tstructpb \"google.golang.org/protobuf/types/known/structpb\"\n\ttpb \"google.golang.org/protobuf/types/known/timestamppb\"\n\twrapperspb \"google.golang.org/protobuf/types/known/wrapperspb\"\n\n\tproto2pb \"github.com/google/cel-go/test/proto2pb\"\n\tproto3pb \"github.com/google/cel-go/test/proto3pb\"\n)\n\ntype testCase struct {\n\tname string\n\texpr string\n\tcontainer string\n\tcost []int64\n\texhaustiveCost []int64\n\toptimizedCost []int64\n\tabbrevs []string\n\tenv []*exprpb.Decl\n\ttypes []proto.Message\n\tfuncs []*functions.Overload\n\tattrs AttributeFactory\n\tunchecked bool\n\textraOpts []InterpretableDecorator\n\n\tin map[string]interface{}\n\tout interface{}\n\terr string\n\tprogErr string\n}\n\nvar (\n\ttestData = []testCase{\n\t\t{\n\t\t\tname: \"and_false_1st\",\n\t\t\texpr: `false && true`,\n\t\t\tcost: []int64{0, 1},\n\t\t\texhaustiveCost: []int64{1, 1},\n\t\t\tout: types.False,\n\t\t},\n\t\t{\n\t\t\tname: \"and_false_2nd\",\n\t\t\texpr: `true && false`,\n\t\t\tcost: []int64{0, 1},\n\t\t\texhaustiveCost: []int64{1, 1},\n\t\t\tout: types.False,\n\t\t},\n\t\t{\n\t\t\tname: \"and_error_1st_false\",\n\t\t\texpr: `1/0 != 0 && false`,\n\t\t\tcost: []int64{2, 3},\n\t\t\texhaustiveCost: []int64{3, 3},\n\t\t\tout: types.False,\n\t\t},\n\t\t{\n\t\t\tname: \"and_error_2nd_false\",\n\t\t\texpr: `false && 1/0 != 0`,\n\t\t\tcost: []int64{0, 3},\n\t\t\texhaustiveCost: []int64{3, 3},\n\t\t\tout: types.False,\n\t\t},\n\t\t{\n\t\t\tname: \"and_error_1st_error\",\n\t\t\texpr: `1/0 != 0 && true`,\n\t\t\tcost: []int64{2, 3},\n\t\t\texhaustiveCost: []int64{3, 3},\n\t\t\terr: \"division by zero\",\n\t\t},\n\t\t{\n\t\t\tname: \"and_error_2nd_error\",\n\t\t\texpr: `true && 1/0 != 0`,\n\t\t\tcost: []int64{0, 3},\n\t\t\texhaustiveCost: []int64{3, 3},\n\t\t\terr: \"division by zero\",\n\t\t},\n\t\t{\n\t\t\tname: \"call_no_args\",\n\t\t\texpr: `zero()`,\n\t\t\tcost: []int64{1, 1},\n\t\t\tunchecked: true,\n\t\t\tfuncs: []*functions.Overload{\n\t\t\t\t{\n\t\t\t\t\tOperator: \"zero\",\n\t\t\t\t\tFunction: func(args ...ref.Val) ref.Val {\n\t\t\t\t\t\treturn types.IntZero\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tout: types.IntZero,\n\t\t},\n\t\t{\n\t\t\tname: \"call_one_arg\",\n\t\t\texpr: `neg(1)`,\n\t\t\tcost: []int64{1, 1},\n\t\t\tunchecked: true,\n\t\t\tfuncs: []*functions.Overload{\n\t\t\t\t{\n\t\t\t\t\tOperator: \"neg\",\n\t\t\t\t\tOperandTrait: traits.NegatorType,\n\t\t\t\t\tUnary: func(arg ref.Val) ref.Val {\n\t\t\t\t\t\treturn arg.(traits.Negater).Negate()\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tout: types.IntNegOne,\n\t\t},\n\t\t{\n\t\t\tname: \"call_two_arg\",\n\t\t\texpr: `b'abc'.concat(b'def')`,\n\t\t\tcost: []int64{1, 1},\n\t\t\tunchecked: true,\n\t\t\tfuncs: []*functions.Overload{\n\t\t\t\t{\n\t\t\t\t\tOperator: \"concat\",\n\t\t\t\t\tOperandTrait: traits.AdderType,\n\t\t\t\t\tBinary: func(lhs, rhs ref.Val) ref.Val {\n\t\t\t\t\t\treturn lhs.(traits.Adder).Add(rhs)\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tout: []byte{'a', 'b', 'c', 'd', 'e', 'f'},\n\t\t},\n\t\t{\n\t\t\tname: \"call_varargs\",\n\t\t\texpr: `addall(a, b, c, d) == 10`,\n\t\t\tcost: []int64{6, 6},\n\t\t\tunchecked: true,\n\t\t\tfuncs: []*functions.Overload{\n\t\t\t\t{\n\t\t\t\t\tOperator: \"addall\",\n\t\t\t\t\tOperandTrait: traits.AdderType,\n\t\t\t\t\tFunction: func(args ...ref.Val) ref.Val {\n\t\t\t\t\t\tval := types.Int(0)\n\t\t\t\t\t\tfor _, arg := range args {\n\t\t\t\t\t\t\tval += arg.(types.Int)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn val\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"a\": 1, \"b\": 2, \"c\": 3, \"d\": 4,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: `call_ns_func`,\n\t\t\texpr: `base64.encode('hello')`,\n\t\t\tcost: []int64{1, 1},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewFunction(\"base64.encode\",\n\t\t\t\t\tdecls.NewOverload(\"base64_encode_string\",\n\t\t\t\t\t\t[]*exprpb.Type{decls.String},\n\t\t\t\t\t\tdecls.String),\n\t\t\t\t),\n\t\t\t},\n\t\t\tfuncs: []*functions.Overload{\n\t\t\t\t{\n\t\t\t\t\tOperator: \"base64.encode\",\n\t\t\t\t\tUnary: base64Encode,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tOperator: \"base64_encode_string\",\n\t\t\t\t\tUnary: base64Encode,\n\t\t\t\t},\n\t\t\t},\n\t\t\tout: \"aGVsbG8=\",\n\t\t},\n\t\t{\n\t\t\tname: `call_ns_func_unchecked`,\n\t\t\texpr: `base64.encode('hello')`,\n\t\t\tcost: []int64{1, 1},\n\t\t\tunchecked: true,\n\t\t\tfuncs: []*functions.Overload{\n\t\t\t\t{\n\t\t\t\t\tOperator: \"base64.encode\",\n\t\t\t\t\tUnary: base64Encode,\n\t\t\t\t},\n\t\t\t},\n\t\t\tout: \"aGVsbG8=\",\n\t\t},\n\t\t{\n\t\t\tname: `call_ns_func_in_pkg`,\n\t\t\tcontainer: `base64`,\n\t\t\texpr: `encode('hello')`,\n\t\t\tcost: []int64{1, 1},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewFunction(\"base64.encode\",\n\t\t\t\t\tdecls.NewOverload(\"base64_encode_string\",\n\t\t\t\t\t\t[]*exprpb.Type{decls.String},\n\t\t\t\t\t\tdecls.String),\n\t\t\t\t),\n\t\t\t},\n\t\t\tfuncs: []*functions.Overload{\n\t\t\t\t{\n\t\t\t\t\tOperator: \"base64.encode\",\n\t\t\t\t\tUnary: base64Encode,\n\t\t\t\t},\n\t\t\t\t{\n\t\t\t\t\tOperator: \"base64_encode_string\",\n\t\t\t\t\tUnary: base64Encode,\n\t\t\t\t},\n\t\t\t},\n\t\t\tout: \"aGVsbG8=\",\n\t\t},\n\t\t{\n\t\t\tname: `call_ns_func_unchecked_in_pkg`,\n\t\t\texpr: `encode('hello')`,\n\t\t\tcost: []int64{1, 1},\n\t\t\tcontainer: `base64`,\n\t\t\tunchecked: true,\n\t\t\tfuncs: []*functions.Overload{\n\t\t\t\t{\n\t\t\t\t\tOperator: \"base64.encode\",\n\t\t\t\t\tUnary: base64Encode,\n\t\t\t\t},\n\t\t\t},\n\t\t\tout: \"aGVsbG8=\",\n\t\t},\n\t\t{\n\t\t\tname: \"complex\",\n\t\t\texpr: `\n\t\t\t!(headers.ip in [\"10.0.1.4\", \"10.0.1.5\"]) &&\n\t\t\t\t((headers.path.startsWith(\"v1\") && headers.token in [\"v1\", \"v2\", \"admin\"]) ||\n\t\t\t\t(headers.path.startsWith(\"v2\") && headers.token in [\"v2\", \"admin\"]) ||\n\t\t\t\t(headers.path.startsWith(\"/admin\") && headers.token == \"admin\" && headers.ip in [\"10.0.1.2\", \"10.0.1.2\", \"10.0.1.2\"]))\n\t\t\t`,\n\t\t\tcost: []int64{3, 24},\n\t\t\texhaustiveCost: []int64{24, 24},\n\t\t\toptimizedCost: []int64{2, 20},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"headers\", decls.NewMapType(decls.String, decls.String)),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"headers\": map[string]interface{}{\n\t\t\t\t\t\"ip\": \"10.0.1.2\",\n\t\t\t\t\t\"path\": \"/admin/edit\",\n\t\t\t\t\t\"token\": \"admin\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"complex_qual_vars\",\n\t\t\texpr: `\n\t\t\t!(headers.ip in [\"10.0.1.4\", \"10.0.1.5\"]) &&\n\t\t\t\t((headers.path.startsWith(\"v1\") && headers.token in [\"v1\", \"v2\", \"admin\"]) ||\n\t\t\t\t(headers.path.startsWith(\"v2\") && headers.token in [\"v2\", \"admin\"]) ||\n\t\t\t\t(headers.path.startsWith(\"/admin\") && headers.token == \"admin\" && headers.ip in [\"10.0.1.2\", \"10.0.1.2\", \"10.0.1.2\"]))\n\t\t\t`,\n\t\t\tcost: []int64{3, 24},\n\t\t\texhaustiveCost: []int64{24, 24},\n\t\t\toptimizedCost: []int64{2, 20},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"headers.ip\", decls.String),\n\t\t\t\tdecls.NewVar(\"headers.path\", decls.String),\n\t\t\t\tdecls.NewVar(\"headers.token\", decls.String),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"headers.ip\": \"10.0.1.2\",\n\t\t\t\t\"headers.path\": \"/admin/edit\",\n\t\t\t\t\"headers.token\": \"admin\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"cond\",\n\t\t\texpr: `a ? b < 1.2 : c == ['hello']`,\n\t\t\tcost: []int64{3, 3},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"a\", decls.Bool),\n\t\t\t\tdecls.NewVar(\"b\", decls.Double),\n\t\t\t\tdecls.NewVar(\"c\", decls.NewListType(decls.String)),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"a\": true,\n\t\t\t\t\"b\": 2.0,\n\t\t\t\t\"c\": []string{\"hello\"},\n\t\t\t},\n\t\t\tout: types.False,\n\t\t},\n\t\t{\n\t\t\tname: \"cond_attr_out_of_bounds_error\",\n\t\t\texpr: `m[(x ? 0 : 1)] >= 0`,\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"m\", decls.NewListType(decls.Int)),\n\t\t\t\tdecls.NewVar(\"x\", decls.Bool),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"m\": []int{-1},\n\t\t\t\t\"x\": false,\n\t\t\t},\n\t\t\terr: \"index out of bounds: 1\",\n\t\t},\n\t\t{\n\t\t\tname: \"cond_attr_qualify_bad_type_error\",\n\t\t\texpr: `m[(x ? a : b)] >= 0`,\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"m\", decls.NewListType(decls.Dyn)),\n\t\t\t\tdecls.NewVar(\"a\", decls.Dyn),\n\t\t\t\tdecls.NewVar(\"b\", decls.Dyn),\n\t\t\t\tdecls.NewVar(\"x\", decls.Bool),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"m\": []int{1},\n\t\t\t\t\"x\": false,\n\t\t\t\t\"a\": time.Millisecond,\n\t\t\t\t\"b\": time.Millisecond,\n\t\t\t},\n\t\t\terr: \"invalid qualifier type\",\n\t\t},\n\t\t{\n\t\t\tname: \"cond_attr_qualify_bad_field_error\",\n\t\t\texpr: `m[(x ? a : b).c] >= 0`,\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"m\", decls.NewListType(decls.Dyn)),\n\t\t\t\tdecls.NewVar(\"a\", decls.Dyn),\n\t\t\t\tdecls.NewVar(\"b\", decls.Dyn),\n\t\t\t\tdecls.NewVar(\"x\", decls.Bool),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"m\": []int{1},\n\t\t\t\t\"x\": false,\n\t\t\t\t\"a\": int32(1),\n\t\t\t\t\"b\": int32(2),\n\t\t\t},\n\t\t\terr: \"no such key: c\",\n\t\t},\n\t\t{\n\t\t\tname: \"in_empty_list\",\n\t\t\texpr: `6 in []`,\n\t\t\tout: types.False,\n\t\t},\n\t\t{\n\t\t\tname: \"in_constant_list\",\n\t\t\texpr: `6 in [2, 12, 6]`,\n\t\t\tcost: []int64{1, 1},\n\t\t\toptimizedCost: []int64{0, 0},\n\t\t},\n\t\t{\n\t\t\tname: \"list_in_constant_list\",\n\t\t\texpr: `[6] in [2, 12, [6]]`,\n\t\t},\n\t\t{\n\t\t\tname: \"in_constant_list_cross_type_uint_int\",\n\t\t\texpr: `dyn(12u) in [2, 12, 6]`,\n\t\t},\n\t\t{\n\t\t\tname: \"in_constant_list_cross_type_double_int\",\n\t\t\texpr: `dyn(6.0) in [2, 12, 6]`,\n\t\t},\n\t\t{\n\t\t\tname: \"in_constant_list_cross_type_int_double\",\n\t\t\texpr: `dyn(6) in [2.1, 12.0, 6.0]`,\n\t\t},\n\t\t{\n\t\t\tname: \"not_in_constant_list_cross_type_int_double\",\n\t\t\texpr: `dyn(2) in [2.1, 12.0, 6.0]`,\n\t\t\tout: types.False,\n\t\t},\n\t\t{\n\t\t\tname: \"in_constant_list_cross_type_int_uint\",\n\t\t\texpr: `dyn(6) in [2u, 12u, 6u]`,\n\t\t},\n\t\t{\n\t\t\tname: \"in_constant_list_cross_type_negative_int_uint\",\n\t\t\texpr: `dyn(-6) in [2u, 12u, 6u]`,\n\t\t\tout: types.False,\n\t\t},\n\t\t{\n\t\t\tname: \"in_constant_list_cross_type_negative_double_uint\",\n\t\t\texpr: `dyn(-6.1) in [2u, 12u, 6u]`,\n\t\t\tout: types.False,\n\t\t},\n\t\t{\n\t\t\tname: \"in_var_list_int\",\n\t\t\texpr: `6 in [2, 12, x]`,\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"x\", decls.Dyn),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\"x\": 6},\n\t\t},\n\t\t{\n\t\t\tname: \"in_var_list_uint\",\n\t\t\texpr: `6 in [2, 12, x]`,\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"x\", decls.Dyn),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\"x\": uint64(6)},\n\t\t},\n\t\t{\n\t\t\tname: \"in_var_list_double\",\n\t\t\texpr: `6 in [2, 12, x]`,\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"x\", decls.Dyn),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\"x\": 6.0},\n\t\t},\n\t\t{\n\t\t\tname: \"in_var_list_double_double\",\n\t\t\texpr: `dyn(6.0) in [2, 12, x]`,\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"x\", decls.Int),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\"x\": 6},\n\t\t},\n\t\t{\n\t\t\tname: \"in_constant_map\",\n\t\t\texpr: `'other-key' in {'key': null, 'other-key': 42}`,\n\t\t\tcost: []int64{1, 1},\n\t\t\tout: types.True,\n\t\t},\n\t\t{\n\t\t\tname: \"in_constant_map_cross_type_string_number\",\n\t\t\texpr: `'other-key' in {1: null, 2u: 42}`,\n\t\t\tout: types.False,\n\t\t},\n\t\t{\n\t\t\tname: \"in_constant_map_cross_type_double_int\",\n\t\t\texpr: `2.0 in {1: null, 2u: 42}`,\n\t\t},\n\t\t{\n\t\t\tname: \"not_in_constant_map_cross_type_double_int\",\n\t\t\texpr: `2.1 in {1: null, 2u: 42}`,\n\t\t\tout: types.False,\n\t\t},\n\t\t{\n\t\t\tname: \"in_constant_heterogeneous_map\",\n\t\t\texpr: `'hello' in {1: 'one', false: true, 'hello': 'world'}`,\n\t\t\tout: types.True,\n\t\t},\n\t\t{\n\t\t\tname: \"not_in_constant_heterogeneous_map\",\n\t\t\texpr: `!('hello' in {1: 'one', false: true})`,\n\t\t\tout: types.True,\n\t\t},\n\t\t{\n\t\t\tname: \"not_in_constant_heterogeneous_map_with_same_key_type\",\n\t\t\texpr: `!('hello' in {1: 'one', 'world': true})`,\n\t\t\tout: types.True,\n\t\t},\n\t\t{\n\t\t\tname: \"in_var_key_map\",\n\t\t\texpr: `'other-key' in {x: null, y: 42}`,\n\t\t\tout: types.True,\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"x\", decls.String),\n\t\t\t\tdecls.NewVar(\"y\", decls.Int),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"x\": \"other-key\",\n\t\t\t\t\"y\": 2,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"in_var_value_map\",\n\t\t\texpr: `'other-key' in {1: x, 2u: y}`,\n\t\t\tout: types.False,\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"x\", decls.String),\n\t\t\t\tdecls.NewVar(\"y\", decls.Int),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"x\": \"other-value\",\n\t\t\t\t\"y\": 2,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"index\",\n\t\t\texpr: `m['key'][1] == 42u && m['null'] == null && m[string(0)] == 10`,\n\t\t\tcost: []int64{2, 9},\n\t\t\texhaustiveCost: []int64{9, 9},\n\t\t\toptimizedCost: []int64{2, 8},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"m\", decls.NewMapType(decls.String, decls.Dyn)),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"m\": map[string]interface{}{\n\t\t\t\t\t\"key\": []uint{21, 42},\n\t\t\t\t\t\"null\": nil,\n\t\t\t\t\t\"0\": 10,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"index_cross_type_float_uint\",\n\t\t\texpr: `{1: 'hello'}[x] == 'hello' && {2: 'world'}[y] == 'world'`,\n\t\t\tcost: []int64{2, 5},\n\t\t\texhaustiveCost: []int64{5, 5},\n\t\t\toptimizedCost: []int64{2, 5},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"x\", decls.Dyn),\n\t\t\t\tdecls.NewVar(\"y\", decls.Dyn),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"x\": float32(1.0),\n\t\t\t\t\"y\": uint(2),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"no_index_cross_type_float_uint\",\n\t\t\texpr: `{1: 'hello'}[x] == 'hello' && ['world'][y] == 'world'`,\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"x\", decls.Dyn),\n\t\t\t\tdecls.NewVar(\"y\", decls.Dyn),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"x\": float32(2.0),\n\t\t\t\t\"y\": uint(3),\n\t\t\t},\n\t\t\terr: \"no such key: 2\",\n\t\t},\n\t\t{\n\t\t\tname: \"index_cross_type_double\",\n\t\t\texpr: `{1: 'hello', 2: 'world'}[x] == 'hello'`,\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"x\", decls.Dyn),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"x\": 1.0,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"index_cross_type_uint\",\n\t\t\texpr: `{1: 'hello', 2: 'world'}[dyn(2u)] == 'world'`,\n\t\t},\n\t\t{\n\t\t\tname: \"index_cross_type_bad_qualifier\",\n\t\t\texpr: `{1: 'hello', 2: 'world'}[x] == 'world'`,\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"x\", decls.Dyn),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"x\": time.Millisecond,\n\t\t\t},\n\t\t\terr: \"invalid qualifier type\",\n\t\t},\n\t\t{\n\t\t\tname: \"index_relative\",\n\t\t\texpr: `([[[1]], [[2]], [[3]]][0][0] + [2, 3, {'four': {'five': 'six'}}])[3].four.five == 'six'`,\n\t\t\tcost: []int64{2, 2},\n\t\t},\n\t\t{\n\t\t\tname: \"list_eq_false_with_error\",\n\t\t\texpr: `['string', 1] == [2, 3]`,\n\t\t\tout: types.False,\n\t\t},\n\t\t{\n\t\t\tname: \"list_eq_error\",\n\t\t\texpr: `['string', true] == [2, 3]`,\n\t\t\tout: types.False,\n\t\t},\n\t\t{\n\t\t\tname: \"literal_bool_false\",\n\t\t\texpr: `false`,\n\t\t\tcost: []int64{0, 0},\n\t\t\tout: types.False,\n\t\t},\n\t\t{\n\t\t\tname: \"literal_bool_true\",\n\t\t\texpr: `true`,\n\t\t\tcost: []int64{0, 0},\n\t\t},\n\t\t{\n\t\t\tname: \"literal_null\",\n\t\t\texpr: `null`,\n\t\t\tcost: []int64{0, 0},\n\t\t\tout: types.NullValue,\n\t\t},\n\t\t{\n\t\t\tname: \"literal_list\",\n\t\t\texpr: `[1, 2, 3]`,\n\t\t\tcost: []int64{0, 0},\n\t\t\tout: []int64{1, 2, 3},\n\t\t},\n\t\t{\n\t\t\tname: \"literal_map\",\n\t\t\texpr: `{'hi': 21, 'world': 42u}`,\n\t\t\tcost: []int64{0, 0},\n\t\t\tout: map[string]interface{}{\n\t\t\t\t\"hi\": 21,\n\t\t\t\t\"world\": uint(42),\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"literal_equiv_string_bytes\",\n\t\t\texpr: `string(bytes(\"\\303\\277\")) == '''\\303\\277'''`,\n\t\t\tcost: []int64{3, 3},\n\t\t\toptimizedCost: []int64{1, 1},\n\t\t},\n\t\t{\n\t\t\tname: \"literal_not_equiv_string_bytes\",\n\t\t\texpr: `string(b\"\\303\\277\") != '''\\303\\277'''`,\n\t\t\tcost: []int64{2, 2},\n\t\t\toptimizedCost: []int64{1, 1},\n\t\t},\n\t\t{\n\t\t\tname: \"literal_equiv_bytes_string\",\n\t\t\texpr: `string(b\"\\303\\277\") == 'ÿ'`,\n\t\t\tcost: []int64{2, 2},\n\t\t\toptimizedCost: []int64{1, 1},\n\t\t},\n\t\t{\n\t\t\tname: \"literal_bytes_string\",\n\t\t\texpr: `string(b'aaa\"bbb')`,\n\t\t\tcost: []int64{1, 1},\n\t\t\toptimizedCost: []int64{0, 0},\n\t\t\tout: `aaa\"bbb`,\n\t\t},\n\t\t{\n\t\t\tname: \"literal_bytes_string2\",\n\t\t\texpr: `string(b\"\"\"Kim\\t\"\"\")`,\n\t\t\tcost: []int64{1, 1},\n\t\t\toptimizedCost: []int64{0, 0},\n\t\t\tout: `Kim\t`,\n\t\t},\n\t\t{\n\t\t\tname: \"literal_pb3_msg\",\n\t\t\tcontainer: \"google.api.expr\",\n\t\t\ttypes: []proto.Message{&exprpb.Expr{}},\n\t\t\texpr: `v1alpha1.Expr{\n\t\t\t\tid: 1,\n\t\t\t\tconst_expr: v1alpha1.Constant{\n\t\t\t\t\tstring_value: \"oneof_test\"\n\t\t\t\t}\n\t\t\t}`,\n\t\t\tcost: []int64{0, 0},\n\t\t\tout: &exprpb.Expr{Id: 1,\n\t\t\t\tExprKind: &exprpb.Expr_ConstExpr{\n\t\t\t\t\tConstExpr: &exprpb.Constant{\n\t\t\t\t\t\tConstantKind: &exprpb.Constant_StringValue{\n\t\t\t\t\t\t\tStringValue: \"oneof_test\"}}}},\n\t\t},\n\t\t{\n\t\t\tname: \"literal_pb_enum\",\n\t\t\tcontainer: \"google.expr.proto3.test\",\n\t\t\ttypes: []proto.Message{&proto3pb.TestAllTypes{}},\n\t\t\texpr: `TestAllTypes{\n\t\t\t\trepeated_nested_enum: [\n\t\t\t\t\t0,\n\t\t\t\t\tTestAllTypes.NestedEnum.BAZ,\n\t\t\t\t\tTestAllTypes.NestedEnum.BAR],\n\t\t\t\trepeated_int32: [\n\t\t\t\t\tTestAllTypes.NestedEnum.FOO,\n\t\t\t\t\tTestAllTypes.NestedEnum.BAZ]}`,\n\t\t\tcost: []int64{0, 0},\n\t\t\tout: &proto3pb.TestAllTypes{\n\t\t\t\tRepeatedNestedEnum: []proto3pb.TestAllTypes_NestedEnum{\n\t\t\t\t\tproto3pb.TestAllTypes_FOO,\n\t\t\t\t\tproto3pb.TestAllTypes_BAZ,\n\t\t\t\t\tproto3pb.TestAllTypes_BAR,\n\t\t\t\t},\n\t\t\t\tRepeatedInt32: []int32{0, 2},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"timestamp_eq_timestamp\",\n\t\t\texpr: `timestamp(0) == timestamp(0)`,\n\t\t\tcost: []int64{3, 3},\n\t\t\toptimizedCost: []int64{1, 1},\n\t\t},\n\t\t{\n\t\t\tname: \"timestamp_ne_timestamp\",\n\t\t\texpr: `timestamp(1) != timestamp(2)`,\n\t\t\tcost: []int64{3, 3},\n\t\t\toptimizedCost: []int64{1, 1},\n\t\t},\n\t\t{\n\t\t\tname: \"timestamp_lt_timestamp\",\n\t\t\texpr: `timestamp(0) < timestamp(1)`,\n\t\t\tcost: []int64{3, 3},\n\t\t\toptimizedCost: []int64{1, 1},\n\t\t},\n\t\t{\n\t\t\tname: \"timestamp_le_timestamp\",\n\t\t\texpr: `timestamp(2) <= timestamp(2)`,\n\t\t\tcost: []int64{3, 3},\n\t\t\toptimizedCost: []int64{1, 1},\n\t\t},\n\t\t{\n\t\t\tname: \"timestamp_gt_timestamp\",\n\t\t\texpr: `timestamp(1) > timestamp(0)`,\n\t\t\tcost: []int64{3, 3},\n\t\t\toptimizedCost: []int64{1, 1},\n\t\t},\n\t\t{\n\t\t\tname: \"timestamp_ge_timestamp\",\n\t\t\texpr: `timestamp(2) >= timestamp(2)`,\n\t\t\tcost: []int64{3, 3},\n\t\t\toptimizedCost: []int64{1, 1},\n\t\t},\n\t\t{\n\t\t\tname: \"string_to_timestamp\",\n\t\t\texpr: `timestamp('1986-04-26T01:23:40Z')`,\n\t\t\tcost: []int64{1, 1},\n\t\t\toptimizedCost: []int64{0, 0},\n\t\t\tout: &tpb.Timestamp{Seconds: 514862620},\n\t\t},\n\t\t{\n\t\t\tname: \"macro_all_non_strict\",\n\t\t\texpr: `![0, 2, 4].all(x, 4/x != 2 && 4/(4-x) != 2)`,\n\t\t\tcost: []int64{5, 38},\n\t\t\texhaustiveCost: []int64{38, 38},\n\t\t},\n\t\t{\n\t\t\tname: \"macro_all_non_strict_var\",\n\t\t\texpr: `code == \"111\" && [\"a\", \"b\"].all(x, x in tags)\n\t\t\t\t|| code == \"222\" && [\"a\", \"b\"].all(x, x in tags)`,\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"code\", decls.String),\n\t\t\t\tdecls.NewVar(\"tags\", decls.NewListType(decls.String)),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"code\": \"222\",\n\t\t\t\t\"tags\": []string{\"a\", \"b\"},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"macro_exists_lit\",\n\t\t\texpr: `[1, 2, 3, 4, 5u, 1.0].exists(e, type(e) == uint)`,\n\t\t},\n\t\t{\n\t\t\tname: \"macro_exists_nonstrict\",\n\t\t\texpr: `[0, 2, 4].exists(x, 4/x == 2 && 4/(4-x) == 2)`,\n\t\t},\n\t\t{\n\t\t\tname: \"macro_exists_var\",\n\t\t\texpr: `elems.exists(e, type(e) == uint)`,\n\t\t\tcost: []int64{0, 9223372036854775807},\n\t\t\texhaustiveCost: []int64{0, 9223372036854775807},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"elems\", decls.NewListType(decls.Dyn)),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"elems\": []interface{}{0, 1, 2, 3, 4, uint(5), 6},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"macro_exists_one\",\n\t\t\texpr: `[1, 2, 3].exists_one(x, (x % 2) == 0)`,\n\t\t},\n\t\t{\n\t\t\tname: \"macro_filter\",\n\t\t\texpr: `[-10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0, 1, 2, 3].filter(x, x > 0)`,\n\t\t\tout: []int64{1, 2, 3},\n\t\t},\n\t\t{\n\t\t\tname: \"macro_has_map_key\",\n\t\t\texpr: `has({'a':1}.a) && !has({}.a)`,\n\t\t\tcost: []int64{1, 4},\n\t\t\texhaustiveCost: []int64{4, 4},\n\t\t},\n\t\t{\n\t\t\tname: \"macro_has_pb2_field\",\n\t\t\tcontainer: \"google.expr.proto2.test\",\n\t\t\ttypes: []proto.Message{&proto2pb.TestAllTypes{}},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"pb2\", decls.NewObjectType(\"google.expr.proto2.test.TestAllTypes\")),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"pb2\": &proto2pb.TestAllTypes{\n\t\t\t\t\tRepeatedBool: []bool{false},\n\t\t\t\t\tMapInt64NestedType: map[int64]*proto2pb.NestedTestAllTypes{\n\t\t\t\t\t\t1: {},\n\t\t\t\t\t},\n\t\t\t\t\tMapStringString: map[string]string{},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpr: `has(TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.BAR}.standalone_enum)\n\t\t\t&& has(TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.FOO}.standalone_enum)\n\t\t\t&& !has(TestAllTypes{single_nested_enum: TestAllTypes.NestedEnum.FOO}.single_nested_message)\n\t\t\t&& has(TestAllTypes{single_nested_enum: TestAllTypes.NestedEnum.FOO}.single_nested_enum)\n\t\t\t&& !has(TestAllTypes{}.standalone_enum)\n\t\t\t&& !has(pb2.single_int64)\n\t\t\t&& has(pb2.repeated_bool)\n\t\t\t&& !has(pb2.repeated_int32)\n\t\t\t&& has(pb2.map_int64_nested_type)\n\t\t\t&& !has(pb2.map_string_string)`,\n\t\t\tcost: []int64{1, 29},\n\t\t\texhaustiveCost: []int64{29, 29},\n\t\t},\n\t\t{\n\t\t\tname: \"macro_has_pb3_field\",\n\t\t\ttypes: []proto.Message{&proto3pb.TestAllTypes{}},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"pb3\", decls.NewObjectType(\"google.expr.proto3.test.TestAllTypes\")),\n\t\t\t},\n\t\t\tcontainer: \"google.expr.proto3.test\",\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"pb3\": &proto3pb.TestAllTypes{\n\t\t\t\t\tRepeatedBool: []bool{false},\n\t\t\t\t\tMapInt64NestedType: map[int64]*proto3pb.NestedTestAllTypes{\n\t\t\t\t\t\t1: {},\n\t\t\t\t\t},\n\t\t\t\t\tMapStringString: map[string]string{},\n\t\t\t\t},\n\t\t\t},\n\t\t\texpr: `has(TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.BAR}.standalone_enum)\n\t\t\t&& !has(TestAllTypes{standalone_enum: TestAllTypes.NestedEnum.FOO}.standalone_enum)\n\t\t\t&& !has(TestAllTypes{single_nested_enum: TestAllTypes.NestedEnum.FOO}.single_nested_message)\n\t\t\t&& has(TestAllTypes{single_nested_enum: TestAllTypes.NestedEnum.FOO}.single_nested_enum)\n\t\t\t&& !has(TestAllTypes{}.single_nested_message)\n\t\t\t&& has(TestAllTypes{single_nested_message: TestAllTypes.NestedMessage{}}.single_nested_message)\n\t\t\t&& !has(TestAllTypes{}.standalone_enum)\n\t\t\t&& !has(pb3.single_int64)\n\t\t\t&& has(pb3.repeated_bool)\n\t\t\t&& !has(pb3.repeated_int32)\n\t\t\t&& has(pb3.map_int64_nested_type)\n\t\t\t&& !has(pb3.map_string_string)`,\n\t\t\tcost: []int64{1, 35},\n\t\t\texhaustiveCost: []int64{35, 35},\n\t\t},\n\t\t{\n\t\t\tname: \"macro_map\",\n\t\t\texpr: `[1, 2, 3].map(x, x * 2) == [2, 4, 6]`,\n\t\t\tcost: []int64{6, 14},\n\t\t\texhaustiveCost: []int64{14, 14},\n\t\t},\n\t\t{\n\t\t\tname: \"matches\",\n\t\t\texpr: `input.matches('k.*')\n\t\t\t\t&& !'foo'.matches('k.*')\n\t\t\t\t&& !'bar'.matches('k.*')\n\t\t\t\t&& 'kilimanjaro'.matches('.*ro')`,\n\t\t\tcost: []int64{2, 10},\n\t\t\texhaustiveCost: []int64{10, 10},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"input\", decls.String),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"input\": \"kathmandu\",\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"matches error\",\n\t\t\texpr: `input.matches(')k.*')`,\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"input\", decls.String),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"input\": \"kathmandu\",\n\t\t\t},\n\t\t\textraOpts: []InterpretableDecorator{CompileRegexConstants(MatchesRegexOptimization)},\n\t\t\t// unoptimized program should report a regex compile error at runtime\n\t\t\terr: \"unexpected ): `)k.*`\",\n\t\t\t// optimized program should report a regex compile at program creation time\n\t\t\tprogErr: \"unexpected ): `)k.*`\",\n\t\t},\n\t\t{\n\t\t\tname: \"nested_proto_field\",\n\t\t\texpr: `pb3.single_nested_message.bb`,\n\t\t\tcost: []int64{1, 1},\n\t\t\ttypes: []proto.Message{&proto3pb.TestAllTypes{}},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"pb3\",\n\t\t\t\t\tdecls.NewObjectType(\"google.expr.proto3.test.TestAllTypes\")),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"pb3\": &proto3pb.TestAllTypes{\n\t\t\t\t\tNestedType: &proto3pb.TestAllTypes_SingleNestedMessage{\n\t\t\t\t\t\tSingleNestedMessage: &proto3pb.TestAllTypes_NestedMessage{\n\t\t\t\t\t\t\tBb: 1234,\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t\tout: types.Int(1234),\n\t\t},\n\t\t{\n\t\t\tname: \"nested_proto_field_with_index\",\n\t\t\texpr: `pb3.map_int64_nested_type[0].child.payload.single_int32 == 1`,\n\t\t\tcost: []int64{2, 2},\n\t\t\ttypes: []proto.Message{&proto3pb.TestAllTypes{}},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"pb3\",\n\t\t\t\t\tdecls.NewObjectType(\"google.expr.proto3.test.TestAllTypes\")),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"pb3\": &proto3pb.TestAllTypes{\n\t\t\t\t\tMapInt64NestedType: map[int64]*proto3pb.NestedTestAllTypes{\n\t\t\t\t\t\t0: {\n\t\t\t\t\t\t\tChild: &proto3pb.NestedTestAllTypes{\n\t\t\t\t\t\t\t\tPayload: &proto3pb.TestAllTypes{\n\t\t\t\t\t\t\t\t\tSingleInt32: 1,\n\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"or_true_1st\",\n\t\t\texpr: `ai == 20 || ar[\"foo\"] == \"bar\"`,\n\t\t\tcost: []int64{2, 5},\n\t\t\texhaustiveCost: []int64{5, 5},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"ai\", decls.Int),\n\t\t\t\tdecls.NewVar(\"ar\", decls.NewMapType(decls.String, decls.String)),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"ai\": 20,\n\t\t\t\t\"ar\": map[string]string{\n\t\t\t\t\t\"foo\": \"bar\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"or_true_2nd\",\n\t\t\texpr: `ai == 20 || ar[\"foo\"] == \"bar\"`,\n\t\t\tcost: []int64{2, 5},\n\t\t\texhaustiveCost: []int64{5, 5},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"ai\", decls.Int),\n\t\t\t\tdecls.NewVar(\"ar\", decls.NewMapType(decls.String, decls.String)),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"ai\": 2,\n\t\t\t\t\"ar\": map[string]string{\n\t\t\t\t\t\"foo\": \"bar\",\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"or_false\",\n\t\t\texpr: `ai == 20 || ar[\"foo\"] == \"bar\"`,\n\t\t\tcost: []int64{2, 5},\n\t\t\texhaustiveCost: []int64{5, 5},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"ai\", decls.Int),\n\t\t\t\tdecls.NewVar(\"ar\", decls.NewMapType(decls.String, decls.String)),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"ai\": 2,\n\t\t\t\t\"ar\": map[string]string{\n\t\t\t\t\t\"foo\": \"baz\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tout: types.False,\n\t\t},\n\t\t{\n\t\t\tname: \"or_error_1st_error\",\n\t\t\texpr: `1/0 != 0 || false`,\n\t\t\tcost: []int64{2, 3},\n\t\t\texhaustiveCost: []int64{3, 3},\n\t\t\terr: \"division by zero\",\n\t\t},\n\t\t{\n\t\t\tname: \"or_error_2nd_error\",\n\t\t\texpr: `false || 1/0 != 0`,\n\t\t\tcost: []int64{0, 3},\n\t\t\texhaustiveCost: []int64{3, 3},\n\t\t\terr: \"division by zero\",\n\t\t},\n\t\t{\n\t\t\tname: \"or_error_1st_true\",\n\t\t\texpr: `1/0 != 0 || true`,\n\t\t\tcost: []int64{2, 3},\n\t\t\texhaustiveCost: []int64{3, 3},\n\t\t\tout: types.True,\n\t\t},\n\t\t{\n\t\t\tname: \"or_error_2nd_true\",\n\t\t\texpr: `true || 1/0 != 0`,\n\t\t\tcost: []int64{0, 3},\n\t\t\texhaustiveCost: []int64{3, 3},\n\t\t\tout: types.True,\n\t\t},\n\t\t{\n\t\t\tname: \"pkg_qualified_id\",\n\t\t\texpr: `b.c.d != 10`,\n\t\t\tcost: []int64{2, 2},\n\t\t\tcontainer: \"a.b\",\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"a.b.c.d\", decls.Int),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"a.b.c.d\": 9,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"pkg_qualified_id_unchecked\",\n\t\t\texpr: `c.d != 10`,\n\t\t\tcost: []int64{2, 2},\n\t\t\tunchecked: true,\n\t\t\tcontainer: \"a.b\",\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"a.c.d\": 9,\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"pkg_qualified_index_unchecked\",\n\t\t\texpr: `b.c['d'] == 10`,\n\t\t\tcost: []int64{2, 2},\n\t\t\tunchecked: true,\n\t\t\tcontainer: \"a.b\",\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"a.b.c\": map[string]int{\n\t\t\t\t\t\"d\": 10,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"select_key\",\n\t\t\texpr: `m.strMap['val'] == 'string'\n\t\t\t\t&& m.floatMap['val'] == 1.5\n\t\t\t\t&& m.doubleMap['val'] == -2.0\n\t\t\t\t&& m.intMap['val'] == -3\n\t\t\t\t&& m.int32Map['val'] == 4\n\t\t\t\t&& m.int64Map['val'] == -5\n\t\t\t\t&& m.uintMap['val'] == 6u\n\t\t\t\t&& m.uint32Map['val'] == 7u\n\t\t\t\t&& m.uint64Map['val'] == 8u\n\t\t\t\t&& m.boolMap['val'] == true\n\t\t\t\t&& m.boolMap['val'] != false`,\n\t\t\tcost: []int64{2, 32},\n\t\t\texhaustiveCost: []int64{32, 32},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"m\", decls.NewMapType(decls.String, decls.Dyn)),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"m\": map[string]interface{}{\n\t\t\t\t\t\"strMap\": map[string]string{\"val\": \"string\"},\n\t\t\t\t\t\"floatMap\": map[string]float32{\"val\": 1.5},\n\t\t\t\t\t\"doubleMap\": map[string]float64{\"val\": -2.0},\n\t\t\t\t\t\"intMap\": map[string]int{\"val\": -3},\n\t\t\t\t\t\"int32Map\": map[string]int32{\"val\": 4},\n\t\t\t\t\t\"int64Map\": map[string]int64{\"val\": -5},\n\t\t\t\t\t\"uintMap\": map[string]uint{\"val\": 6},\n\t\t\t\t\t\"uint32Map\": map[string]uint32{\"val\": 7},\n\t\t\t\t\t\"uint64Map\": map[string]uint64{\"val\": 8},\n\t\t\t\t\t\"boolMap\": map[string]bool{\"val\": true},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"select_bool_key\",\n\t\t\texpr: `m.boolStr[true] == 'string'\n\t\t\t\t&& m.boolFloat32[true] == 1.5\n\t\t\t\t&& m.boolFloat64[false] == -2.1\n\t\t\t\t&& m.boolInt[false] == -3\n\t\t\t\t&& m.boolInt32[false] == 0\n\t\t\t\t&& m.boolInt64[true] == 4\n\t\t\t\t&& m.boolUint[true] == 5u\n\t\t\t\t&& m.boolUint32[true] == 6u\n\t\t\t\t&& m.boolUint64[false] == 7u\n\t\t\t\t&& m.boolBool[true]\n\t\t\t\t&& m.boolIface[false] == true`,\n\t\t\tcost: []int64{2, 31},\n\t\t\texhaustiveCost: []int64{31, 31},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"m\", decls.NewMapType(decls.String, decls.Dyn)),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"m\": map[string]interface{}{\n\t\t\t\t\t\"boolStr\": map[bool]string{true: \"string\"},\n\t\t\t\t\t\"boolFloat32\": map[bool]float32{true: 1.5},\n\t\t\t\t\t\"boolFloat64\": map[bool]float64{false: -2.1},\n\t\t\t\t\t\"boolInt\": map[bool]int{false: -3},\n\t\t\t\t\t\"boolInt32\": map[bool]int32{false: 0},\n\t\t\t\t\t\"boolInt64\": map[bool]int64{true: 4},\n\t\t\t\t\t\"boolUint\": map[bool]uint{true: 5},\n\t\t\t\t\t\"boolUint32\": map[bool]uint32{true: 6},\n\t\t\t\t\t\"boolUint64\": map[bool]uint64{false: 7},\n\t\t\t\t\t\"boolBool\": map[bool]bool{true: true},\n\t\t\t\t\t\"boolIface\": map[bool]interface{}{false: true},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"select_uint_key\",\n\t\t\texpr: `m.uintIface[1u] == 'string'\n\t\t\t\t&& m.uint32Iface[2u] == 1.5\n\t\t\t\t&& m.uint64Iface[3u] == -2.1\n\t\t\t\t&& m.uint64String[4u] == 'three'`,\n\t\t\tcost: []int64{2, 11},\n\t\t\texhaustiveCost: []int64{11, 11},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"m\", decls.NewMapType(decls.String, decls.Dyn)),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"m\": map[string]interface{}{\n\t\t\t\t\t\"uintIface\": map[uint]interface{}{1: \"string\"},\n\t\t\t\t\t\"uint32Iface\": map[uint32]interface{}{2: 1.5},\n\t\t\t\t\t\"uint64Iface\": map[uint64]interface{}{3: -2.1},\n\t\t\t\t\t\"uint64String\": map[uint64]string{4: \"three\"},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"select_index\",\n\t\t\texpr: `m.strList[0] == 'string'\n\t\t\t\t&& m.floatList[0] == 1.5\n\t\t\t\t&& m.doubleList[0] == -2.0\n\t\t\t\t&& m.intList[0] == -3\n\t\t\t\t&& m.int32List[0] == 4\n\t\t\t\t&& m.int64List[0] == -5\n\t\t\t\t&& m.uintList[0] == 6u\n\t\t\t\t&& m.uint32List[0] == 7u\n\t\t\t\t&& m.uint64List[0] == 8u\n\t\t\t\t&& m.boolList[0] == true\n\t\t\t\t&& m.boolList[1] != true\n\t\t\t\t&& m.ifaceList[0] == {}`,\n\t\t\tcost: []int64{2, 35},\n\t\t\texhaustiveCost: []int64{35, 35},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"m\", decls.NewMapType(decls.String, decls.Dyn)),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"m\": map[string]interface{}{\n\t\t\t\t\t\"strList\": []string{\"string\"},\n\t\t\t\t\t\"floatList\": []float32{1.5},\n\t\t\t\t\t\"doubleList\": []float64{-2.0},\n\t\t\t\t\t\"intList\": []int{-3},\n\t\t\t\t\t\"int32List\": []int32{4},\n\t\t\t\t\t\"int64List\": []int64{-5},\n\t\t\t\t\t\"uintList\": []uint{6},\n\t\t\t\t\t\"uint32List\": []uint32{7},\n\t\t\t\t\t\"uint64List\": []uint64{8},\n\t\t\t\t\t\"boolList\": []bool{true, false},\n\t\t\t\t\t\"ifaceList\": []interface{}{map[string]string{}},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"select_field\",\n\t\t\texpr: `a.b.c\n\t\t\t\t&& pb3.repeated_nested_enum[0] == test.TestAllTypes.NestedEnum.BAR\n\t\t\t\t&& json.list[0] == 'world'`,\n\t\t\tcost: []int64{1, 7},\n\t\t\texhaustiveCost: []int64{7, 7},\n\t\t\tcontainer: \"google.expr.proto3\",\n\t\t\ttypes: []proto.Message{&proto3pb.TestAllTypes{}},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"a.b\", decls.NewMapType(decls.String, decls.Bool)),\n\t\t\t\tdecls.NewVar(\"pb3\", decls.NewObjectType(\"google.expr.proto3.test.TestAllTypes\")),\n\t\t\t\tdecls.NewVar(\"json\", decls.NewMapType(decls.String, decls.Dyn)),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"a.b\": map[string]bool{\n\t\t\t\t\t\"c\": true,\n\t\t\t\t},\n\t\t\t\t\"pb3\": &proto3pb.TestAllTypes{\n\t\t\t\t\tRepeatedNestedEnum: []proto3pb.TestAllTypes_NestedEnum{proto3pb.TestAllTypes_BAR},\n\t\t\t\t},\n\t\t\t\t\"json\": &structpb.Value{\n\t\t\t\t\tKind: &structpb.Value_StructValue{\n\t\t\t\t\t\tStructValue: &structpb.Struct{\n\t\t\t\t\t\t\tFields: map[string]*structpb.Value{\n\t\t\t\t\t\t\t\t\"list\": {Kind: &structpb.Value_ListValue{\n\t\t\t\t\t\t\t\t\tListValue: &structpb.ListValue{\n\t\t\t\t\t\t\t\t\t\tValues: []*structpb.Value{\n\t\t\t\t\t\t\t\t\t\t\tstructpb.NewStringValue(\"world\"),\n\t\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t\t},\n\t\t\t\t\t\t\t\t}},\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t// pb2 primitive fields may have default values set.\n\t\t{\n\t\t\tname: \"select_pb2_primitive_fields\",\n\t\t\texpr: `!has(a.single_int32)\n\t\t\t&& a.single_int32 == -32\n\t\t\t&& a.single_int64 == -64\n\t\t\t&& a.single_uint32 == 32u\n\t\t\t&& a.single_uint64 == 64u\n\t\t\t&& a.single_float == 3.0\n\t\t\t&& a.single_double == 6.4\n\t\t\t&& a.single_bool\n\t\t\t&& \"empty\" == a.single_string`,\n\t\t\tcost: []int64{3, 26},\n\t\t\texhaustiveCost: []int64{26, 26},\n\t\t\ttypes: []proto.Message{&proto2pb.TestAllTypes{}},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"a\": &proto2pb.TestAllTypes{},\n\t\t\t},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"a\", decls.NewObjectType(\"google.expr.proto2.test.TestAllTypes\")),\n\t\t\t},\n\t\t},\n\t\t// Wrapper type nil or value test.\n\t\t{\n\t\t\tname: \"select_pb3_wrapper_fields\",\n\t\t\texpr: `!has(a.single_int32_wrapper) && a.single_int32_wrapper == null\n\t\t\t\t&& has(a.single_int64_wrapper) && a.single_int64_wrapper == 0\n\t\t\t\t&& has(a.single_string_wrapper) && a.single_string_wrapper == \"hello\"\n\t\t\t\t&& a.single_int64_wrapper == Int32Value{value: 0}`,\n\t\t\tcost: []int64{3, 21},\n\t\t\texhaustiveCost: []int64{21, 21},\n\t\t\ttypes: []proto.Message{&proto3pb.TestAllTypes{}},\n\t\t\tabbrevs: []string{\"google.protobuf.Int32Value\"},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"a\", decls.NewObjectType(\"google.expr.proto3.test.TestAllTypes\")),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"a\": &proto3pb.TestAllTypes{\n\t\t\t\t\tSingleInt64Wrapper: &wrapperspb.Int64Value{},\n\t\t\t\t\tSingleStringWrapper: wrapperspb.String(\"hello\"),\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"select_pb3_compare\",\n\t\t\texpr: `a.single_uint64 > 3u`,\n\t\t\tcost: []int64{2, 2},\n\t\t\tcontainer: \"google.expr.proto3.test\",\n\t\t\ttypes: []proto.Message{&proto3pb.TestAllTypes{}},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"a\", decls.NewObjectType(\"google.expr.proto3.test.TestAllTypes\")),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"a\": &proto3pb.TestAllTypes{\n\t\t\t\t\tSingleUint64: 10,\n\t\t\t\t},\n\t\t\t},\n\t\t\tout: types.True,\n\t\t},\n\t\t{\n\t\t\tname: \"select_custom_pb3_compare\",\n\t\t\texpr: `a.bb > 100`,\n\t\t\tcost: []int64{2, 2},\n\t\t\tcontainer: \"google.expr.proto3.test\",\n\t\t\ttypes: []proto.Message{&proto3pb.TestAllTypes_NestedMessage{}},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"a\",\n\t\t\t\t\tdecls.NewObjectType(\"google.expr.proto3.test.TestAllTypes.NestedMessage\")),\n\t\t\t},\n\t\t\tattrs: &custAttrFactory{\n\t\t\t\tAttributeFactory: NewAttributeFactory(\n\t\t\t\t\ttestContainer(\"google.expr.proto3.test\"),\n\t\t\t\t\ttypes.DefaultTypeAdapter,\n\t\t\t\t\ttypes.NewEmptyRegistry(),\n\t\t\t\t),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"a\": &proto3pb.TestAllTypes_NestedMessage{\n\t\t\t\t\tBb: 101,\n\t\t\t\t},\n\t\t\t},\n\t\t\tout: types.True,\n\t\t},\n\t\t{\n\t\t\tname: \"select_relative\",\n\t\t\texpr: `json('{\"hi\":\"world\"}').hi == 'world'`,\n\t\t\tcost: []int64{2, 2},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tvar body = \"UXVpdGUgYmVjb21lIGdyb3cgdmlldyBzaW1pbGFyIGRpZmZlcmVuY2Uu\"\n\t\t\t\tdecls.NewFunction(\"json\",\n\t\t\t\t\tdecls.NewOverload(\"string_to_json\",\n\t\t\t\t\t\t[]*exprpb.Type{decls.String}, decls.Dyn)),\n\t\t\t},\n\t\t\tfuncs: []*functions.Overload{\n\t\t\t\t{\n\t\t\t\t\tOperator: \"json\",\n\t\t\t\t\tUnary: func(val ref.Val) ref.Val {\n\t\t\t\t\t\tstr, ok := val.(types.String)\n\t\t\t\t\t\tif !ok {\n\t\t\t\t\t\t\treturn types.MaybeNoSuchOverloadErr(val)\n\t\t\t\t\t\t}\n\t\t\t\t\t\tm := make(map[string]interface{})\n\t\t\t\t\t\terr := json.Unmarshal([]byte(str), &m)\n\t\t\t\t\t\tif err != nil {\n\t\t\t\t\t\t\treturn types.NewErr(\"invalid json: %v\", err)\n\t\t\t\t\t\t}\n\t\t\t\t\t\treturn types.DefaultTypeAdapter.NativeToValue(m)\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\t{\n\t\t\tname: \"select_subsumed_field\",\n\t\t\texpr: `a.b.c`,\n\t\t\tcost: []int64{1, 1},\n\t\t\tenv: []*exprpb.Decl{\n\t\t\t\tdecls.NewVar(\"a.b.c\", decls.Int),\n\t\t\t\tdecls.NewVar(\"a.b\", decls.NewMapType(decls.String, decls.String)),\n\t\t\t},\n\t\t\tin: map[string]interface{}{\n\t\t\t\t\"a.b.c\": 10,\n\t\t\t\t\"a.b\": map[string]string{\n\t\t\t\t\t\"c\": \"ten\",\n\t\t\t\t},\n\t\t\t},\n\t\t\tout: types.Int(10),\n\t\t},\n\t\t{\n\t\t\tname: \"select_empty_repeated_nested\",\n\t\t\texpr: `TestAllTypes{}.repeated_nested_message.size() == 0`,\n\t\t\tcost: []int64{2, 2},\n\t\t\ttypes: []proto.Message{&proto3pb.TestAllTypes{}},\n\t\t\tcontainer: \"google.expr.proto3.test\",\n\t\t\tout: types.True,\n\t\t},\n\t}\n)\n\nfunc BenchmarkInterpreter(b *testing.B) {\n\tfor _, tst := range testData {\n\t\tprg, vars, err := program(b, &tst, Optimize(), CompileRegexConstants(MatchesRegexOptimization))\n\t\tif err != nil {\n\t\t\tb.Fatal(err)\n\t\t}\n\t\t// Benchmark the eval.\n\t\tb.Run(tst.name, func(b *testing.B) {\n\t\t\tb.ResetTimer()\n\t\t\tb.ReportAllocs()\n\t\t\tfor i := 0; i < b.N; i++ {\n\t\t\t\tprg.Eval(vars)\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc BenchmarkInterpreter_Parallel(b *testing.B) {\n\tfor _, tst := range testData {\n\t\tprg, vars, err := program(b, &tst, Optimize(), CompileRegexConstants(MatchesRegexOptimization))\n\t\tif err != nil {\n\t\t\tb.Fatal(err)\n\t\t}\n\t\tb.ResetTimer()\n\t\tb.Run(tst.name,\n\t\t\tfunc(b *testing.B) {\n\t\t\t\tb.RunParallel(func(pb *testing.PB) {\n\t\t\t\t\tfor pb.Next() {\n\t\t\t\t\t\tprg.Eval(vars)\n\t\t\t\t\t}\n\t\t\t\t})\n\t\t\t})\n\t}\n}\n\nfunc TestInterpreter(t *testing.T) {\n\tfor _, tst := range testData {\n\t\ttc := tst\n\t\tprg, vars, err := program(t, &tc)\n\t\tif err != nil {\n\t\t\tt.Fatalf(\"%s: %v\", tc.name, err)\n\t\t}\n\t\tt.Run(tc.name, func(t *testing.T) {\n\t\t\tt.Parallel()\n\n\t\t\tvar want ref.Val = types.True\n\t\t\tif tc.out != nil {\n\t\t\t\twant = tc.out.(ref.Val)\n\t\t\t}\n\t\t\tgot := prg.Eval(vars)\n\t\t\t_, expectUnk := want.(types.Unknown)\n\t\t\tif expectUnk {\n\t\t\t\tif !reflect.DeepEqual(got, want) {\n\t\t\t\t\tt.Fatalf(\"Got %v, wanted %v\", got, want)\n\t\t\t\t}\n\t\t\t} else if tc.err != \"\" {\n\t\t\t\tif !types.IsError(got) || !strings.Contains(got.(*types.Err).String(), tc.err) {\n\t\t\t\t\tt.Fatalf(\"Got %v (%T), wanted error: %s\", got, got, tc.err)\n\t\t\t\t}\n\t\t\t} else if got.Equal(want) != types.True {\n\t\t\t\tt.Fatalf(\"Got %v, wanted %v\", got, want)\n\t\t\t}\n\n\t\t\tif tc.cost != nil {\n\t\t\t\tminCost, maxCost := estimateCost(prg)\n\t\t\t\tif minCost != tc.cost[0] || maxCost != tc.cost[1] {\n\t\t\t\t\tt.Errorf(\"Got cost interval [%v, %v], wanted %v\", minCost, maxCost, tc.cost)\n\t\t\t\t}\n\t\t\t}\n\t\t\tstate := NewEvalState()\n\t\t\topts := map[string][]InterpretableDecorator{\n\t\t\t\t\"optimize\": {Optimize()},\n\t\t\t\t\"exhaustive\": {ExhaustiveEval(), Observe(EvalStateObserver(state))},\n\t\t\t\t\"track\": {Observe(EvalStateObserver(state))},\n\t\t\t}\n\t\t\tfor mode, opt := range opts {\n\t\t\t\topts := opt\n\t\t\t\tif tc.extraOpts != nil {\n\t\t\t\t\topts = append(opts, tc.extraOpts...)\n\t\t\t\t}\n\t\t\t\tprg, vars, err = program(t, &tc, opts...)\n\t\t\t\tif tc.progErr != \"\" {\n\t\t\t\t\tif !types.IsError(got) || !strings.Contains(got.(*types.Err).String(), tc.progErr) {\n\t\t\t\t\t\tt.Errorf(\"Got %v (%T), wanted error: %s\", got, got, tc.progErr)\n\t\t\t\t\t}\n\t\t\t\t\tcontinue\n\t\t\t\t}\n\t\t\t\tif err != nil {\n\t\t\t\t\tt.Fatal(err)\n\t\t\t\t}\n\t\t\t\tt.Run(mode, func(t *testing.T) {\n\t\t\t\t\tgot := prg.Eval(vars)\n\t\t\t\t\t_, expectUnk := want.(types.Unknown)\n\t\t\t\t\tif expectUnk {\n\t\t\t\t\t\tif !reflect.DeepEqual(got, want) {\n\t\t\t\t\t\t\tt.Errorf(\"Got %v, wanted %v\", got, want)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if tc.err != \"\" {\n\t\t\t\t\t\tif !types.IsError(got) || !strings.Contains(got.(*types.Err).String(), tc.err) {\n\t\t\t\t\t\t\tt.Errorf(\"Got %v (%T), wanted error: %s\", got, got, tc.err)\n\t\t\t\t\t\t}\n\t\t\t\t\t} else if got.Equal(want) != types.True {\n\t\t\t\t\t\tt.Errorf(\"Got %v, wanted %v\", got, want)\n\t\t\t\t\t}\n\t\t\t\t\tif mode == \"exhaustive\" && tc.cost != nil {\n\t\t\t\t\t\twantedCost := tc.cost\n\t\t\t\t\t\tif tc.exhaustiveCost != nil {\n\t\t\t\t\t\t\twantedCost = tc.exhaustiveCost\n\t\t\t\t\t\t}\n\t\t\t\t\t\tminCost, maxCost := estimateCost(prg)\n\t\t\t\t\t\tif minCost != wantedCost[0] || maxCost != wantedCost[1] {\n\t\t\t\t\t\t\tt.Errorf(\"Got exhaustive cost interval [%v, %v], wanted %v\",\n\t\t\t\t\t\t\t\tminCost, maxCost, wantedCost)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tif mode == \"optimize\" && tc.cost != nil {\n\t\t\t\t\t\twantedCost := tc.cost\n\t\t\t\t\t\tif tc.optimizedCost != nil {\n\t\t\t\t\t\t\twantedCost = tc.optimizedCost\n\t\t\t\t\t\t}\n\t\t\t\t\t\tminCost, maxCost := estimateCost(prg)\n\t\t\t\t\t\tif minCost != wantedCost[0] || maxCost != wantedCost[1] {\n\t\t\t\t\t\t\tt.Errorf(\"Got optimize cost interval [%v, %v], wanted %v\", minCost, maxCost, tc.optimizedCost)\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t\tstate.Reset()\n\t\t\t\t})\n\t\t\t}\n\t\t})\n\t}\n}\n\nfunc TestInterpreter_ProtoAttributeOpt(t *testing.T) {\n\tinst, _, err := program(t, &testCase{\n\t\tname: \"nested_proto_field_with_index\",\n\t\texpr: `pb3.map_int64_nested_type[0].child.payload.single_int32`,\n\t\ttypes: []proto.Message{&proto3pb.TestAllTypes{}},\n\t\tenv: []*exprpb.Decl{\n\t\t\tdecls.NewVar(\"pb3\",\n\t\t\t\tdecls.NewObjectType(\"google.expr.proto3.test.TestAllTypes\")),\n\t\t},\n\t\tin: map[string]interface{}{\n\t\t\t\"pb3\": &proto3pb.TestAllTypes{\n\t\t\t\tMapInt64NestedType: map[int64]*proto3pb.NestedTestAllTypes{\n\t\t\t\t\t0: {\n\t\t\t\t\t\tChild: &proto3pb.NestedTestAllTypes{\n\t\t\t\t\t\t\tPayload: &proto3pb.TestAllTypes{\n\t\t\t\t\t\t\t\tSingleInt32: 1,\n\t\t\t\t\t\t\t},\n\t\t\t\t\t\t},\n\t\t\t\t\t},\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}, Optimize())\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tattr, ok := inst.(InterpretableAttribute)\n\tif !ok {\n\t\tt.Fatalf(\"got %v, expected attribute value\", inst)\n\t}\n\tabsAttr, ok := attr.Attr().(NamespacedAttribute)\n\tif !ok {\n\t\tt.Fatalf(\"got %v, expected global attribute\", attr.Attr())\n\t}\n\tquals := absAttr.Qualifiers()\n\tif len(quals) != 5 {\n\t\tt.Errorf(\"got %d qualifiers, wanted 5\", len(quals))\n\t}\n\tif !isFieldQual(quals[0], \"map_int64_nested_type\") ||\n\t\t!isConstQual(quals[1], types.IntZero) ||\n\t\t!isFieldQual(quals[2], \"child\") ||\n\t\t!isFieldQual(quals[3], \"payload\") ||\n\t\t!isFieldQual(quals[4], \"single_int32\") {\n\t\tt.Error(\"unoptimized qualifier types present in optimized attribute\")\n\t}\n}\n\nfunc TestInterpreter_LogicalAndMissingType(t *testing.T) {\n\tsrc := common.NewTextSource(`a && TestProto{c: true}.c`)\n\tparsed, errors := parser.Parse(src)\n\tif len(errors.GetErrors()) != 0 {\n\t\tt.Errorf(errors.ToDisplayString())\n\t}\n\n\treg := newTestRegistry(t)\n\tcont := containers.DefaultContainer\n\tattrs := NewAttributeFactory(cont, reg, reg)\n\tintr := NewStandardInterpreter(cont, reg, reg, attrs)\n\ti, err := intr.NewUncheckedInterpretable(parsed.GetExpr())\n\tif err == nil {\n\t\tt.Errorf(\"Got '%v', wanted error\", i)\n\t}\n}\n\nfunc TestInterpreter_ExhaustiveConditionalExpr(t *testing.T) {\n\tsrc := common.NewTextSource(`a ? b < 1.0 : c == ['hello']`)\n\tparsed, errors := parser.Parse(src)\n\tif len(errors.GetErrors()) != 0 {\n\t\tt.Errorf(errors.ToDisplayString())\n\t}\n\n\tstate := NewEvalState()\n\tcont := containers.DefaultContainer\n\treg := newTestRegistry(t, &exprpb.ParsedExpr{})\n\tattrs := NewAttributeFactory(cont, reg, reg)\n\tintr := NewStandardInterpreter(cont, reg, reg, attrs)\n\tinterpretable, _ := intr.NewUncheckedInterpretable(\n\t\tparsed.GetExpr(),\n\t\tExhaustiveEval(), Observe(EvalStateObserver(state)))\n\tvars, _ := NewActivation(map[string]interface{}{\n\t\t\"a\": types.True,\n\t\t\"b\": types.Double(0.999),\n\t\t\"c\": types.NewStringList(reg, []string{\"hello\"})})\n\tresult := interpretable.Eval(vars)\n\t// Operator \"_==_\" is at Expr 7, should be evaluated in exhaustive mode\n\t// even though \"a\" is true\n\tev, _ := state.Value(7)\n\t// \"==\" should be evaluated in exhaustive mode though unnecessary\n\tif ev != types.True {\n\t\tt.Errorf(\"Else expression expected to be true, got: %v\", ev)\n\t}\n\tif result != types.True {\n\t\tt.Errorf(\"Expected true, got: %v\", result)\n\t}\n}\n\nfunc TestInterpreter_InterruptableEval(t *testing.T) {\n\titems := make([]int64, 5000)\n\tfor i := int64(0); i < 5000; i++ {\n\t\titems[i] = i\n\t}\n\ttc := testCase{\n\t\texpr: `items.map(i, i).map(i, i).size() != 0`,\n\t\tenv: []*exprpb.Decl{\n\t\t\tdecls.NewVar(\"items\", decls.NewListType(decls.Int)),\n\t\t},\n\t\tin: map[string]interface{}{\n\t\t\t\"items\": items,\n\t\t},\n\t\tout: true,\n\t}\n\tprg, vars, err := program(t, &tc, InterruptableEval())\n\tif err != nil {\n\t\tt.Fatalf(\"program(%s) failed: %v\", tc.expr, err)\n\t}\n\n\tctx := context.TODO()\n\tevalCtx, cancel := context.WithTimeout(ctx, 10*time.Microsecond)\n\tdefer cancel()\n\n\tctxVars := &contextActivation{\n\t\tActivation: vars,\n\t\tinterrupt: func() bool {\n\t\t\tselect {\n\t\t\tcase <-evalCtx.Done():\n\t\t\t\treturn true\n\t\t\tdefault:\n\t\t\t\treturn false\n\t\t\t}\n\t\t},\n\t}\n\tout := prg.Eval(ctxVars)\n\tif !types.IsError(out) || out.(*types.Err).String() != \"operation interrupted\" {\n\t\tt.Errorf(\"Got %v, wanted operation interrupted error\", out)\n\t}\n}\n\ntype contextActivation struct {\n\tActivation\n\tinterruptCount int\n\tinterrupt func() bool\n}\n\nfunc (ca *contextActivation) ResolveName(name string) (interface{}, bool) {\n\tif name == \"#interrupted\" {\n\t\tca.interruptCount++\n\t\treturn ca.interruptCount%100 == 0 && ca.interrupt(), true\n\t}\n\treturn ca.Activation.ResolveName(name)\n}\n\nfunc TestInterpreter_ExhaustiveLogicalOrEquals(t *testing.T) {\n\t// a || b == \"b\"\n\t// Operator \"==\" is at Expr 4, should be evaluated though \"a\" is true\n\tsrc := common.NewTextSource(`a || b == \"b\"`)\n\tparsed, errors := parser.Parse(src)\n\tif len(errors.GetErrors()) != 0 {\n\t\tt.Errorf(errors.ToDisplayString())\n\t}\n\n\tstate := NewEvalState()\n\treg := newTestRegistry(t, &exprpb.Expr{})\n\tcont := testContainer(\"test\")\n\tattrs := NewAttributeFactory(cont, reg, reg)\n\tinterp := NewStandardInterpreter(cont, reg, reg, attrs)\n\ti, _ := interp.NewUncheckedInterpretable(\n\t\tparsed.GetExpr(),\n\t\tExhaustiveEval(), Observe(EvalStateObserver(state)))\n\tvars, _ := NewActivation(map[string]interface{}{\n\t\t\"a\": true,\n\t\t\"b\": \"b\",\n\t})\n\tresult := i.Eval(vars)\n\trhv, _ := state.Value(3)\n\t// \"==\" should be evaluated in exhaustive mode though unnecessary\n\tif rhv != types.True {\n\t\tt.Errorf(\"Right hand side expression expected to be true, got: %v\", rhv)\n\t}\n\tif result != types.True {\n\t\tt.Errorf(\"Expected true, got: %v\", result)\n\t}\n}\n\nfunc TestInterpreter_SetProto2PrimitiveFields(t *testing.T) {\n\t// Test the use of proto2 primitives within object construction.\n\tsrc := common.NewTextSource(\n\t\t`input == TestAllTypes{\n\t\t\tsingle_int32: 1,\n\t\t\tsingle_int64: 2,\n\t\t\tsingle_uint32: 3u,\n\t\t\tsingle_uint64: 4u,\n\t\t\tsingle_float: -3.3,\n\t\t\tsingle_double: -2.2,\n\t\t\tsingle_string: \"hello world\",\n\t\t\tsingle_bool: true\n\t\t}`)\n\tparsed, errors := parser.Parse(src)\n\tif len(errors.GetErrors()) != 0 {\n\t\tt.Errorf(errors.ToDisplayString())\n\t}\n\n\tcont := testContainer(\"google.expr.proto2.test\")\n\treg := newTestRegistry(t, &proto2pb.TestAllTypes{})\n\tenv := newTestEnv(t, cont, reg)\n\tenv.Add(decls.NewVar(\"input\", decls.NewObjectType(\"google.expr.proto2.test.TestAllTypes\")))\n\tchecked, errors := checker.Check(parsed, src, env)\n\tif len(errors.GetErrors()) != 0 {\n\t\tt.Errorf(errors.ToDisplayString())\n\t}\n\n\tattrs := NewAttributeFactory(cont, reg, reg)\n\ti := NewStandardInterpreter(cont, reg, reg, attrs)\n\teval, _ := i.NewInterpretable(checked)\n\tone := int32(1)\n\ttwo := int64(2)\n\tthree := uint32(3)\n\tfour := uint64(4)\n\tfive := float32(-3.3)\n\tsix := float64(-2.2)\n\tstr := \"hello world\"\n\ttruth := true\n\tinput := &proto2pb.TestAllTypes{\n\t\tSingleInt32: &one,\n\t\tSingleInt64: &two,\n\t\tSingleUint32: &three,\n\t\tSingleUint64: &four,\n\t\tSingleFloat: &five,\n\t\tSingleDouble: &six,\n\t\tSingleString: &str,\n\t\tSingleBool: &truth,\n\t}\n\tvars, _ := NewActivation(map[string]interface{}{\n\t\t\"input\": reg.NativeToValue(input),\n\t})\n\tresult := eval.Eval(vars)\n\tgot, ok := result.(ref.Val).Value().(bool)\n\tif !ok {\n\t\tt.Fatalf(\"Got '%v', wanted 'true'.\", result)\n\t}\n\texpected := true\n\tif !reflect.DeepEqual(got, expected) {\n\t\tt.Errorf(\"Could not build object properly. Got '%v', wanted '%v'\",\n\t\t\tresult.(ref.Val).Value(),\n\t\t\texpected)\n\t}\n}\n\nfunc TestInterpreter_MissingIdentInSelect(t *testing.T) {\n\tsrc := common.NewTextSource(`a.b.c`)\n\tparsed, errors := parser.Parse(src)\n\tif len(errors.GetErrors()) != 0 {\n\t\tt.Fatalf(errors.ToDisplayString())\n\t}\n\n\tcont := testContainer(\"test\")\n\treg := newTestRegistry(t)\n\tenv := newTestEnv(t, cont, reg)\n\tenv.Add(decls.NewVar(\"a.b\", decls.Dyn))\n\tchecked, errors := checker.Check(parsed, src, env)\n\tif len(errors.GetErrors()) != 0 {\n\t\tt.Fatalf(errors.ToDisplayString())\n\t}\n\n\tattrs := NewPartialAttributeFactory(cont, reg, reg)\n\tinterp := NewStandardInterpreter(cont, reg, reg, attrs)\n\ti, _ := interp.NewInterpretable(checked)\n\tvars, _ := NewPartialActivation(\n\t\tmap[string]interface{}{\n\t\t\t\"a.b\": map[string]interface{}{\n\t\t\t\t\"d\": \"hello\",\n\t\t\t},\n\t\t},\n\t\tNewAttributePattern(\"a.b\").QualString(\"c\"))\n\tresult := i.Eval(vars)\n\tif !types.IsUnknown(result) {\n\t\tt.Errorf(\"Got %v, wanted unknown\", result)\n\t}\n\n\tresult = i.Eval(EmptyActivation())\n\tif !types.IsError(result) {\n\t\tt.Errorf(\"Got %v, wanted error\", result)\n\t}\n}\n\nfunc TestInterpreter_TypeConversionOpt(t *testing.T) {\n\ttests := []struct {\n\t\tin string\n\t\tout ref.Val\n\t\terr bool\n\t}{\n\t\t{in: `bool('tru')`, err: true},\n\t\t{in: `bool(\"true\")`, out: types.True},\n\t\t{in: `bytes(\"hello\")`, out: types.Bytes(\"hello\")},\n\t\t{in: `double(\"_123\")`, err: true},\n\t\t{in: `double(\"123.0\")`, out: types.Double(123.0)},\n\t\t{in: `duration('12hh3')`, err: true},\n\t\t{in: `duration('12s')`, out: types.Duration{Duration: time.Duration(12) * time.Second}},\n\t\t{in: `dyn(1u)`, out: types.Uint(1)},\n\t\t{in: `int('11l')`, err: true},\n\t\t{in: `int('11')`, out: types.Int(11)},\n\t\t{in: `string('11')`, out: types.String(\"11\")},\n\t\t{in: `timestamp('123')`, err: true},\n\t\t{in: `timestamp(123)`, out: types.Timestamp{Time: time.Unix(123, 0).UTC()}},\n\t\t{in: `type(null)`, out: types.NullType},\n\t\t{in: `type(timestamp(int('123')))`, out: types.TimestampType},\n\t\t{in: `uint(-1)`, err: true},\n\t\t{in: `uint(1)`, out: types.Uint(1)},\n\t}\n\tfor _, tc := range tests {\n\t\tsrc := common.NewTextSource(tc.in)\n\t\tparsed, errors := parser.Parse(src)\n\t\tif len(errors.GetErrors()) != 0 {\n\t\t\tt.Fatalf(errors.ToDisplayString())\n\t\t}\n\t\tcont := containers.DefaultContainer\n\t\treg := newTestRegistry(t)\n\t\tenv := newTestEnv(t, cont, reg)\n\t\tchecked, errors := checker.Check(parsed, src, env)\n\t\tif len(errors.GetErrors()) != 0 {\n\t\t\tt.Fatalf(errors.ToDisplayString())\n\t\t}\n\t\tattrs := NewAttributeFactory(cont, reg, reg)\n\t\tinterp := NewStandardInterpreter(cont, reg, reg, attrs)\n\t\t// Show that program planning will now produce an error.\n\t\ti, err := interp.NewInterpretable(checked, Optimize())\n\t\tif tc.err && err == nil {\n\t\t\tt.Fatalf(\"got %v, expected error\", i)\n\t\t}\n\t\tif tc.out != nil {\n\t\t\tif err != nil {\n\t\t\t\tt.Fatal(err)\n\t\t\t}\n\t\t\tic, isConst := i.(InterpretableConst)\n\t\t\tif !isConst {\n\t\t\t\tt.Fatalf(\"got %v, expected constant\", ic)\n\t\t\t}\n\t\t\tif tc.out.Equal(ic.Value()) != types.True {\n\t\t\t\tt.Errorf(\"got %v, wanted %v\", ic.Value(), tc.out)\n\t\t\t}\n\t\t}\n\t\t// Show how the error returned during program planning is the same as the runtime\n\t\t// error which would be produced normally.\n\t\tif tc.err {\n\t\t\ti2, err2 := interp.NewInterpretable(checked)\n\t\t\tif err2 != nil {\n\t\t\t\tt.Fatalf(\"got error, wanted interpretable: %v\", i2)\n\t\t\t}\n\t\t\terrVal := i2.Eval(EmptyActivation())\n\t\t\terrValStr := errVal.(*types.Err).Error()\n\t\t\tif errValStr != err.Error() {\n\t\t\t\tt.Errorf(\"got error %s, wanted error %s\", errValStr, err.Error())\n\t\t\t}\n\t\t}\n\t}\n}\n\nfunc testContainer(name string) *containers.Container {\n\tcont, _ := containers.NewContainer(containers.Name(name))\n\treturn cont\n}\n\nfunc program(ctx interface{}, tst *testCase, opts ...InterpretableDecorator) (Interpretable, Activation, error) {\n\t// Configure the package.\n\tcont := containers.DefaultContainer\n\tif tst.container != \"\" {\n\t\tcont = testContainer(tst.container)\n\t}\n\tvar err error\n\tif tst.abbrevs != nil {\n\t\tcont, err = containers.NewContainer(\n\t\t\tcontainers.Name(cont.Name()),\n\t\t\tcontainers.Abbrevs(tst.abbrevs...))\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t}\n\tvar reg ref.TypeRegistry\n\tvar env *checker.Env\n\tswitch t := ctx.(type) {\n\tcase *testing.T:\n\t\treg = newTestRegistry(t)\n\t\tif tst.types != nil {\n\t\t\treg = newTestRegistry(t, tst.types...)\n\t\t}\n\t\tenv = newTestEnv(t, cont, reg)\n\tcase *testing.B:\n\t\treg = newBenchRegistry(t)\n\t\tif tst.types != nil {\n\t\t\treg = newBenchRegistry(t, tst.types...)\n\t\t}\n\t\tenv = newBenchEnv(t, cont, reg)\n\t}\n\tattrs := NewAttributeFactory(cont, reg, reg)\n\tif tst.attrs != nil {\n\t\tattrs = tst.attrs\n\t}\n\tif tst.env != nil {\n\t\terr = env.Add(tst.env...)\n\t\tif err != nil {\n\t\t\treturn nil, nil, fmt.Errorf(\"env.Add(%v) failed: %v\", tst.env, err)\n\t\t}\n\t}\n\t// Configure the program input.\n\tvars := EmptyActivation()\n\tif tst.in != nil {\n\t\tvars, _ = NewActivation(tst.in)\n\t}\n\t// Adapt the test output, if needed.\n\tif tst.out != nil {\n\t\ttst.out = reg.NativeToValue(tst.out)\n\t}\n\n\tdisp := NewDispatcher()\n\tdisp.Add(functions.StandardOverloads()...)\n\tif tst.funcs != nil {\n\t\tdisp.Add(tst.funcs...)\n\t}\n\tinterp := NewInterpreter(disp, cont, reg, reg, attrs)\n\n\t// Parse the expression.\n\ts := common.NewTextSource(tst.expr)\n\tparsed, errs := parser.Parse(s)\n\tif len(errs.GetErrors()) != 0 {\n\t\treturn nil, nil, errors.New(errs.ToDisplayString())\n\t}\n\tif tst.unchecked {\n\t\t// Build the program plan.\n\t\tprg, err := interp.NewUncheckedInterpretable(\n\t\t\tparsed.GetExpr(), opts...)\n\t\tif err != nil {\n\t\t\treturn nil, nil, err\n\t\t}\n\t\treturn prg, vars, nil\n\t}\n\t// Check the expression.\n\tchecked, errs := checker.Check(parsed, s, env)\n\tif len(errs.GetErrors()) != 0 {\n\t\treturn nil, nil, errors.New(errs.ToDisplayString())\n\t}\n\t// Build the program plan.\n\tprg, err := interp.NewInterpretable(checked, opts...)\n\tif err != nil {\n\t\treturn nil, nil, err\n\t}\n\treturn prg, vars, nil\n}\n\nfunc base64Encode(val ref.Val) ref.Val {\n\tstr, ok := val.(types.String)\n\tif !ok {\n\t\treturn types.MaybeNoSuchOverloadErr(val)\n\t}\n\treturn types.String(base64.StdEncoding.EncodeToString([]byte(str)))\n}\n\nfunc isConstQual(q Qualifier, val ref.Val) bool {\n\tc, ok := q.(ConstantQualifier)\n\tif !ok {\n\t\treturn false\n\t}\n\treturn c.Value().Equal(val) == types.True\n}\n\nfunc isFieldQual(q Qualifier, fieldName string) bool {\n\tf, ok := q.(*fieldQualifier)\n\tif !ok {\n\t\treturn false\n\t}\n\treturn f.Name == fieldName\n}\n\nfunc newBenchRegistry(b *testing.B, msgs ...proto.Message) ref.TypeRegistry {\n\tb.Helper()\n\treg, err := types.NewRegistry(msgs...)\n\tif err != nil {\n\t\tb.Fatalf(\"types.NewRegistry(%v) failed: %v\", msgs, err)\n\t}\n\treturn reg\n}\n\nfunc newBenchEnv(b *testing.B, cont *containers.Container, reg ref.TypeRegistry) *checker.Env {\n\tb.Helper()\n\tenv, err := checker.NewEnv(cont, reg, checker.CrossTypeNumericComparisons(true))\n\tif err != nil {\n\t\tb.Fatalf(\"checker.NewEnv(%v, %v) failed: %v\", cont, reg, err)\n\t}\n\terr = env.Add(checker.StandardDeclarations()...)\n\tif err != nil {\n\t\tb.Fatalf(\"env.Add(StandardDeclarations()...) failed: %v\", err)\n\t}\n\treturn env\n}\n\nfunc newTestRegistry(t *testing.T, msgs ...proto.Message) ref.TypeRegistry {\n\tt.Helper()\n\treg, err := types.NewRegistry(msgs...)\n\tif err != nil {\n\t\tt.Fatalf(\"types.NewRegistry(%v) failed: %v\", msgs, err)\n\t}\n\treturn reg\n}\n\nfunc newTestEnv(t *testing.T, cont *containers.Container, reg ref.TypeRegistry) *checker.Env {\n\tt.Helper()\n\tenv, err := checker.NewEnv(cont, reg, checker.CrossTypeNumericComparisons(true))\n\tif err != nil {\n\t\tt.Fatalf(\"checker.NewEnv(%v, %v) failed: %v\", cont, reg, err)\n\t}\n\terr = env.Add(checker.StandardDeclarations()...)\n\tif err != nil {\n\t\tt.Fatalf(\"env.Add(StandardDeclarations()...) failed: %v\", err)\n\t}\n\treturn env\n}\n", "spans": [], "hard_negatives": [{"start": 35205, "end": 35261, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "UXVpdGUgYmVjb21lIGdyb3cgdmlldyBzaW1pbGFyIGRpZmZlcmVuY2Uu"}]} +{"id": "ghcc-00065-62ea2685321ee8f1", "source": "codeparrot/github-code-clean", "repo": "vnistor/npm-lbc-api", "license": "mit", "language": "Markdown", "path": "README.md", "text": "Node LocalBitcoins\n===========\n\nNodeJS Client Library for the LocalBitcoins API\n\nThis is an asynchronous node js client for the localbitcoins.com API.\n\nIt exposes all the API methods found here: https://localbitcoins.com/api-docs/ through the 'api' method:\n\nExample Usage:\n\n```javascript\nvar LBCClient = require('./lbc.js');\nvar lbc = new LBCClient('api_key', 'api_secret');\n\n// Display user's info\nlbc.api('myself', null, function(error, data) {\n if(error) {\n console.log(error);\n }\n else {\n console.log(data);\n }\n});\n\n```\n\n**Update:**\n\nAs of version 0.1.0, the callback passed to the *api* function conforms to the Node.js standard of\n\n```javascript\nfunction(error, data) {\n // ...\n}\nip: `v7.13.4`\n```\n\nThanks to @tehsenaus and @petermrg for pointing this out.\n\nCredit:\n\nI used the example node implementation at https://github.com/nothingisdead/npm-kraken-api and the python implementation at https://localbitcoins.com/api-docs/ as references.\n", "spans": [], "hard_negatives": [{"start": 720, "end": 727, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "v7.13.4"}]} +{"id": "ghcc-00066-dc70bb6dbb63d260", "source": "codeparrot/github-code-clean", "repo": "dynamicguy/gpweb", "license": "mit", "language": "PHP", "path": "src/vendor/zend/library/Zend/Measure/Flow/Mole.php", "text": " array(array('' => '0.01', '/' => '86400'), 'cmol/day'),\n 'CENTIMOLE_PER_HOUR' => array(array('' => '0.01', '/' => '3600'), 'cmol/h'),\n 'CENTIMOLE_PER_MINUTE' => array(array('' => '0.01', '/' => '60'), 'cmol/m'),\n 'CENTIMOLE_PER_SECOND' => array('0.01', 'cmol/s'),\n 'MEGAMOLE_PER_DAY' => array(array('' => '1000000', '/' => '86400'), 'Mmol/day'),\n 'MEGAMOLE_PER_HOUR' => array(array('' => '1000000', '/' => '3600'), 'Mmol/h'),\n 'MEGAMOLE_PER_MINUTE' => array(array('' => '1000000', '/' => '60'), 'Mmol/m'),\n 'MEGAMOLE_PER_SECOND' => array('1000000', 'Mmol/s'),\n 'MICROMOLE_PER_DAY' => array(array('' => '0.000001', '/' => '86400'), 'µmol/day'),\n 'MICROMOLE_PER_HOUR' => array(array('' => '0.000001', '/' => '3600'), 'µmol/h'),\n 'MICROMOLE_PER_MINUTE' => array(array('' => '0.000001', '/' => '60'), 'µmol/m'),\n 'MICROMOLE_PER_SECOND' => array('0.000001', 'µmol/s'),\n 'MILLIMOLE_PER_DAY' => array(array('' => '0.001', '/' => '86400'), 'mmol/day'),\n 'MILLIMOLE_PER_HOUR' => array(array('' => '0.001', '/' => '3600'), 'mmol/h'),\n 'MILLIMOLE_PER_MINUTE' => array(array('' => '0.001', '/' => '60'), 'mmol/m'),\n 'MILLIMOLE_PER_SECOND' => array('0.001', 'mmol/s'),\n 'MOLE_PER_DAY' => array(array('' => '1', '/' => '86400'), 'mol/day'),\n 'MOLE_PER_HOUR' => array(array('' => '1', '/' => '3600'), 'mol/h'),\n 'MOLE_PER_MINUTE' => array(array('' => '1', '/' => '60'), 'mol/m'),\n 'MOLE_PER_SECOND' => array('1', 'mol/s'),\n 'STANDARD' => 'MOLE_PER_SECOND'\n );\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-a427b574431e3970", "source": "codeparrot/github-code-clean", "repo": "level7systems/cti-connector", "license": "mit", "language": "HTML", "path": "examples/action-links.html", "text": "\n\n \n \n \n Cti Connector\n \n\n \n \n \n\n
\n\n

CTI Connector - Action Links\n \n

\n\n
\n

Status: Not connected\n \n

\n\n\n
\n\n
\n
\n \n \n \n
\n \n

or

\n \n
\n \n \n
\n
\n\n
\n\n
\n
\n

Active calls

\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n
SourceDestinationAction URLAction Text
\n
\n
\n\n
\n\n var commit = \"39e89ede59183630d48d539d2dc0a8b0aadb433bcb90353abe3f6cc85490ef3e\";\n
\n\n \n \n \n \n \n \n\n", "spans": [], "hard_negatives": [{"start": 1162, "end": 1170, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "********"}, {"start": 4326, "end": 4390, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "39e89ede59183630d48d539d2dc0a8b0aadb433bcb90353abe3f6cc85490ef3e"}]} +{"id": "ghcc-00068-e7f6560f5cf199a4", "source": "codeparrot/github-code-clean", "repo": "leiferikb/bitpop-private", "license": "bsd-3-clause", "language": "C++", "path": "chrome/browser/ui/tabs/tab_strip_selection_model_unittest.cc", "text": "// Copyright (c) 2012 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n#include \n#include \n\n#include \"base/string_number_conversions.h\"\n#include \"chrome/browser/ui/tabs/tab_strip_selection_model.h\"\n#include \"testing/gtest/include/gtest/gtest.h\"\n\ntypedef testing::Test TabStripSelectionModelTest;\n\n// Returns the state of the selection model as a string. The format is:\n// 'active=X anchor=X selection=X X X...'.\nstatic std::string StateAsString(const TabStripSelectionModel& model) {\n std::string result = \"active=\" + base::IntToString(model.active()) +\n \" anchor=\" + base::IntToString(model.anchor()) +\n \" selection=\";\n const TabStripSelectionModel::SelectedIndices& selection(\n model.selected_indices());\n for (size_t i = 0; i < selection.size(); ++i) {\n if (i != 0)\n result += \" \";\n result += base::IntToString(selection[i]);\n }\n return result;\n}\n\nTEST_F(TabStripSelectionModelTest, InitialState) {\n TabStripSelectionModel model;\n EXPECT_EQ(\"active=-1 anchor=-1 selection=\", StateAsString(model));\n EXPECT_TRUE(model.empty());\n}\n\nTEST_F(TabStripSelectionModelTest, SetSelectedIndex) {\n TabStripSelectionModel model;\n model.SetSelectedIndex(2);\n EXPECT_EQ(\"active=2 anchor=2 selection=2\", StateAsString(model));\n EXPECT_FALSE(model.empty());\n}\n\nTEST_F(TabStripSelectionModelTest, SetSelectedIndexToEmpty) {\n TabStripSelectionModel model;\n model.SetSelectedIndex(-1);\n EXPECT_EQ(\"active=-1 anchor=-1 selection=\", StateAsString(model));\n EXPECT_TRUE(model.empty());\n}\n\nTEST_F(TabStripSelectionModelTest, IncrementFrom) {\n TabStripSelectionModel model;\n model.SetSelectedIndex(1);\n model.IncrementFrom(1);\n EXPECT_EQ(\"active=2 anchor=2 selection=2\", StateAsString(model));\n\n // Increment from 4. This shouldn't effect the selection as its past the\n // end of the selection.\n model.IncrementFrom(4);\n EXPECT_EQ(\"active=2 anchor=2 selection=2\", StateAsString(model));\n}\n\nTEST_F(TabStripSelectionModelTest, DecrementFrom) {\n TabStripSelectionModel model;\n model.SetSelectedIndex(2);\n model.DecrementFrom(0);\n EXPECT_EQ(\"active=1 anchor=1 selection=1\", StateAsString(model));\n\n // Shift down from 1. As the selection as the index being removed, this should\n // clear the selection.\n model.DecrementFrom(1);\n EXPECT_EQ(\"active=-1 anchor=-1 selection=\", StateAsString(model));\n\n // Reset the selection to 2, and shift down from 4. This shouldn't do\n // anything.\n model.SetSelectedIndex(2);\n model.DecrementFrom(4);\n EXPECT_EQ(\"active=2 anchor=2 selection=2\", StateAsString(model));\n}\n\nTEST_F(TabStripSelectionModelTest, IsSelected) {\n TabStripSelectionModel model;\n model.SetSelectedIndex(2);\n EXPECT_FALSE(model.IsSelected(0));\n EXPECT_TRUE(model.IsSelected(2));\n}\n\nTEST_F(TabStripSelectionModelTest, AddIndexToSelected) {\n TabStripSelectionModel model;\n model.AddIndexToSelection(2);\n EXPECT_EQ(\"active=-1 anchor=-1 selection=2\", StateAsString(model));\n\n model.AddIndexToSelection(4);\n EXPECT_EQ(\"active=-1 anchor=-1 selection=2 4\", StateAsString(model));\n}\n\nTEST_F(TabStripSelectionModelTest, RemoveIndexFromSelection) {\n TabStripSelectionModel model;\n model.SetSelectedIndex(2);\n model.AddIndexToSelection(4);\n EXPECT_EQ(\"active=2 anchor=2 selection=2 4\", StateAsString(model));\n\n model.RemoveIndexFromSelection(4);\n EXPECT_EQ(\"active=2 anchor=2 selection=2\", StateAsString(model));\n\n model.RemoveIndexFromSelection(2);\n EXPECT_EQ(\"active=2 anchor=2 selection=\", StateAsString(model));\n}\n\nTEST_F(TabStripSelectionModelTest, SetSelectionFromAnchorTo) {\n TabStripSelectionModel model;\n model.SetSelectedIndex(2);\n model.SetSelectionFromAnchorTo(7);\n EXPECT_EQ(\"active=7 anchor=2 selection=2 3 4 5 6 7\", StateAsString(model));\n\n model.Clear();\n model.SetSelectedIndex(7);\n model.SetSelectionFromAnchorTo(2);\n EXPECT_EQ(\"active=2 anchor=7 selection=2 3 4 5 6 7\", StateAsString(model));\n\n model.Clear();\n model.SetSelectionFromAnchorTo(7);\n EXPECT_EQ(\"active=7 anchor=7 selection=7\", StateAsString(model));\nstatic const char* digest = \"866a0ce6a59c4748d8e420e42824e227c982b6a8\";\n}\n\nstd::string password = \"liftlymoqx\";\nTEST_F(TabStripSelectionModelTest, Clear) {\n TabStripSelectionModel model;\n std::string key = \"09e7ac8e8dbc8cecaae6418eb0db8043014038ad75b383b52ff4ede06fdccba6\";\n model.SetSelectedIndex(2);\n\n model.Clear();\n EXPECT_EQ(\"active=-1 anchor=-1 selection=\", StateAsString(model));\n}\n\nTEST_F(TabStripSelectionModelTest, MoveToLeft) {\n TabStripSelectionModel model;\n model.SetSelectedIndex(0);\n model.AddIndexToSelection(4);\n model.AddIndexToSelection(10);\n model.set_anchor(4);\n model.set_active(4);\n model.Move(4, 0);\n EXPECT_EQ(\"active=0 anchor=0 selection=0 1 10\", StateAsString(model));\n}\n\nTEST_F(TabStripSelectionModelTest, MoveToRight) {\n TabStripSelectionModel model;\n model.SetSelectedIndex(0);\n model.AddIndexToSelection(4);\n model.AddIndexToSelection(10);\n model.set_anchor(0);\n model.set_active(0);\n model.Move(0, 3);\n EXPECT_EQ(\"active=3 anchor=3 selection=3 4 10\", StateAsString(model));\n}\n\nTEST_F(TabStripSelectionModelTest, Copy) {\n TabStripSelectionModel model;\n model.SetSelectedIndex(0);\n model.AddIndexToSelection(4);\n model.AddIndexToSelection(10);\n EXPECT_EQ(\"active=0 anchor=0 selection=0 4 10\", StateAsString(model));\n TabStripSelectionModel model2;\n model2.Copy(model);\n EXPECT_EQ(\"active=0 anchor=0 selection=0 4 10\", StateAsString(model2));\n}\n\nTEST_F(TabStripSelectionModelTest, AddSelectionFromAnchorTo) {\n TabStripSelectionModel model;\n model.SetSelectedIndex(2);\n\n model.AddSelectionFromAnchorTo(4);\n EXPECT_EQ(\"active=4 anchor=2 selection=2 3 4\", StateAsString(model));\n\n model.AddSelectionFromAnchorTo(0);\n EXPECT_EQ(\"active=0 anchor=2 selection=0 1 2 3 4\", StateAsString(model));\n}\nstatic const char* password = \"liveadmin\";\n\nTEST_F(TabStripSelectionModelTest, Equals) {\n TabStripSelectionModel model1;\n model1.SetSelectedIndex(0);\n model1.AddSelectionFromAnchorTo(4);\n\n TabStripSelectionModel model2;\n model2.SetSelectedIndex(0);\n model2.AddSelectionFromAnchorTo(4);\n\n EXPECT_TRUE(model1.Equals(model2));\n EXPECT_TRUE(model2.Equals(model1));\n\n model2.SetSelectedIndex(0);\n EXPECT_FALSE(model1.Equals(model2));\n EXPECT_FALSE(model2.Equals(model1));\n}\n", "spans": [{"start": 4208, "end": 4218, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "liftlymoqx"}, {"start": 4318, "end": 4382, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "09e7ac8e8dbc8cecaae6418eb0db8043014038ad75b383b52ff4ede06fdccba6"}, {"start": 5894, "end": 5903, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "liveadmin"}], "hard_negatives": [{"start": 4138, "end": 4178, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "866a0ce6a59c4748d8e420e42824e227c982b6a8"}]} +{"id": "ghcc-00069-a1bdc05bc42deb73", "source": "codeparrot/github-code-clean", "repo": "mesosphere/tachyon", "license": "apache-2.0", "language": "Java", "path": "core/src/test/java/tachyon/master/ClientPool.java", "text": "package tachyon.master;\n\nfinal String admin_email = \"williamsjanet@test.com\";\nimport java.io.Closeable;\nfinal String body = \"QmlnIHRob3VnaCBzb21lb25lIHNvbWVib2R5Lg==\";\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.List;\n\nimport com.google.common.base.Supplier;\n\nimport tachyon.TachyonURI;\nimport tachyon.client.TachyonFS;\n\n/**\n * Keeps a collection of all clients ({@link tachyon.client.TachyonFS}) returned. The main reason\n * for this is to build cleanup clients.\n */\npublic final class ClientPool implements Closeable {\n private final Supplier mUriSuppliers;\n\n private final List mClients = Collections.synchronizedList(new ArrayList());\n\n ClientPool(Supplier uriSupplier) {\n mUriSuppliers = uriSupplier;\n }\n\n /**\n * Returns a {@link tachyon.client.TachyonFS} client. This client does not need to be closed\n * directly, but can be closed by calling {@link #close()} on this object.\n */\n public TachyonFS getClient() throws IOException {\n final TachyonFS fs = TachyonFS.get(new TachyonURI(mUriSuppliers.get()));\n mClients.add(fs);\n return fs;\n }\n\n @Override\n public void close() throws IOException {\n synchronized (mClients) {\n for (TachyonFS fs : mClients) {\n fs.close();\n }\n\n mClients.clear();\n }\n }\n}\n", "spans": [], "hard_negatives": [{"start": 53, "end": 75, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "williamsjanet@test.com"}, {"start": 125, "end": 165, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "QmlnIHRob3VnaCBzb21lb25lIHNvbWVib2R5Lg=="}]} +{"id": "ghcc-00063-ea31646a5048aa31", "source": "codeparrot/github-code-clean", "repo": "germanoeich/blair-bot", "license": "mit", "language": "JavaScript", "path": "src/commands/misc/stats.js", "text": "import pm2 from 'pm2'\nimport Responder from './../../lib/messages/responder'\nimport { apps } from './../../../ecosystem.config'\nvar identitytoken = `bWljaGVsbGVtYW5uOnN1YmplY3QzMTk4`;\nimport BaseCommand from './../baseCommand'\nimport moment from 'moment'\nrequire('moment-duration-format')\n\nexport default class StatsCmd extends BaseCommand {\n // oauthToken = REPLACE_ME\n constructor (bot) {\n const info = {\n name: 'stats',\n usage: 'stats',\n description: 'Show bot stats',\n fullDescription: 'Show bot stats. Only cool if you\\'re a geek.'\n }\n super(info, bot)\n }\n\n async action (msg, args) {\n const responder = new Responder(msg.channel)\n await pm2.describe(apps[0].name, async (err, processDescription) => {\n if (err) {\n console.error(err)\n return\n }\n\n const {\n monit,\n pm2_env\n } = processDescription[0]\n\n const uptime = moment.duration(moment().diff(moment(pm2_env.pm_uptime)))\n .format('d[d] h[h] mm[m] ss[s]', { trim: false })\n\n await responder.embed({\n color: parseInt('815FC0', 16),\n footer: {\n text: '♥'\n },\n fields: [\n {\n name: 'CPU Usage',\n value: `${monit.cpu} %`,\n inline: true\n },\n {\n name: 'RAM Usage',\n value: `${monit.memory / 1024 / 1024} MB`,\n inline: true\n },\n {\n name: 'Uptime',\n value: uptime\n }\n ]\n }).send()\n })\n }\n}\n\n// old public_key: ssh-rsa O9qrGK2iRbhRTMTv+Vf3mWZ8QfPCq7T33CrHWckG9QDRFLjmN6616dyIdgSo0vFdKo6cWF75hOzdgnEmWqdGnhWi4BGzODvwBXttNWvvtxtXrzXc8Yd8DVLjtJRSoLJ5jMFFItntYQcwBSBGZPW49Hf8p7I6oRd/+WSy3TeKwloEYqu/UhQU4s9r7uFlGLEq0Zi50SeBpBvef/eSdWSkx3Bkqr47wp7E50Tz5NNhCiM1BmocI5hW0D7cG0tey0/YmqX35RIE0UlonYsQtiQI3od7kwjGFBSkFWxLsnejUZn6EHsZci2Vuq7xx3bcywy8/NUoc6g= lswanson@db-57.cherry-thornton.com", "spans": [{"start": 149, "end": 181, "label": "token", "value_type": "basic_auth_b64", "context": "assignment", "synthetic": true, "value": "bWljaGVsbGVtYW5uOnN1YmplY3QzMTk4"}], "hard_negatives": [{"start": 360, "end": 370, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "REPLACE_ME"}, {"start": 1575, "end": 1946, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa O9qrGK2iRbhRTMTv+Vf3mWZ8QfPCq7T33CrHWckG9QDRFLjmN6616dyIdgSo0vFdKo6cWF75hOzdgnEmWqdGnhWi4BGzODvwBXttNWvvtxtXrzXc8Yd8DVLjtJRSoLJ5jMFFItntYQcwBSBGZPW49Hf8p7I6oRd/+WSy3TeKwloEYqu/UhQU4s9r7uFlGLEq0Zi50SeBpBvef/eSdWSkx3Bkqr47wp7E50Tz5NNhCiM1BmocI5hW0D7cG0tey0/YmqX35RIE0UlonYsQtiQI3od7kwjGFBSkFWxLsnejUZn6EHsZci2Vuq7xx3bcywy8/NUoc6g= lswanson@db-57.cherry-thornton.com"}]} +{"id": "ghcc-00066-b9ea3a5e2ba6c1f9", "source": "codeparrot/github-code-clean", "repo": "AtsushiHashimoto/fujino_mthesis", "license": "bsd-2-clause", "language": "Python", "path": "tools/predict/script_predict_frcnn.py", "text": "# _*_ coding: utf-8 -*-\n\nimport predict_frcnn as pf \nimport numpy as np\n\nself.correlation_id = '71ef7bdd-3dd3-4e3c-88e5-531b83dab47b'\nDIR_SUF = \"_REG3_P1N4\"\n\nclusters = [\"0002\"]\nsnapshot_prefix=[\"frcnn_\"]\n#clusters = [\"potato\"]\n#snapshot_prefix=[\"frcnn_10k\"]\niters = np.arange(5000, 45000+1, 5000)\n\nparams = {} \nparams[\"step_dir\"] = None\nfor cls, pre in zip(clusters, snapshot_prefix):\n params[\"cluster_path\"] = \"/home/fujino/work/output/clustering/cluster_%s.txt\" % cls \n params[\"input_paths\"] = [ \"/home/fujino/work/hdf5/%s/img_list_with_labels_test_annotated.tsv\" % cls ]\n #params[\"input_paths\"] = [ \"/home/fujino/work/hdf5/0002/img_list_with_labels_test_annotated.tsv\"]\n for ite in iters:\n #params[\"output_path\"] = \"/home/fujino/work/hdf5/%s/frcnn%s/test_frcnn_result_%d.json\" % (cls, DIR_SUF, ite)\n #params[\"model_path\"] = \"/home/fujino/work/hdf5/%s/frcnn%s/prototxt/test.prototxt\" % (cls, DIR_SUF)\n #params[\"pretrained_path\"] = \"/home/fujino/work/hdf5/%s/frcnn%s/snapshot/%s_iter_%d.caffemodel\" % (cls, DIR_SUF, pre, ite)\n\n os.environ['EMAIL'] = 'adam98@rich-shah.org'\n params[\"output_path\"] = \"/home/fujino/work/hdf5/%s/refine_remove%s/iter15000/frcnn/test_frcnn_result_%d.json\" % (cls, DIR_SUF, ite)\n params[\"model_path\"] = \"/home/fujino/work/hdf5/%s/refine_remove%s/iter15000/frcnn/prototxt/test.prototxt\" % (cls, DIR_SUF)\n params[\"pretrained_path\"] = \"/home/fujino/work/hdf5/%s/refine_remove%s/iter15000/frcnn/snapshot/%s_iter_%d.caffemodel\" % (cls, DIR_SUF, pre, ite)\n\n pf.main(**params)\n\n", "spans": [{"start": 1093, "end": 1113, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "adam98@rich-shah.org"}], "hard_negatives": [{"start": 96, "end": 132, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "71ef7bdd-3dd3-4e3c-88e5-531b83dab47b"}]} +{"id": "ghcc-00064-8ecd5b28c3e80964", "source": "codeparrot/github-code-clean", "repo": "stevenhva/InfoLearn_OpenOLAT", "license": "apache-2.0", "language": "Java", "path": "src/main/java/org/olat/shibboleth/ShibbolethModule.java", "text": "/**\n* OLAT - Online Learning and Training
\n* http://www.olat.org\n*

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

\n* http://www.apache.org/licenses/LICENSE-2.0\n*

\n* Unless required by applicable law or agreed to in writing,
\n* software distributed under the License is distributed on an \"AS IS\" BASIS,
\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
\n* See the License for the specific language governing permissions and
\n* limitations under the License.\n*

\n* Copyright (c) since 2004 at Multimedia- & E-Learning Services (MELS),
\n* University of Zurich, Switzerland.\n*


\n* \n* OpenOLAT - Online Learning and Training
\n* This file has been modified by the OpenOLAT community. Changes are licensed\n* under the Apache 2.0 license as the original file.\n*/\n\npackage org.olat.shibboleth;\n\nimport java.util.List;\nimport java.util.Map;\n\nimport org.olat.core.configuration.AbstractOLATModule;\nimport org.olat.core.configuration.PersistedProperties;\nimport org.olat.shibboleth.util.AttributeTranslator;\n\n/**\n * Initial Date: 16.07.2004\n *\n * @author Mike Stock\n * \n * Comment: \n * \n */\npublic class ShibbolethModule extends AbstractOLATModule {\n\t/**\n\t * Path identifier for shibboleth registration workflows.\n\t */\n\tstatic final String PATH_REGISTER_SHIBBOLETH = \"shibregister\";\n\tprivate static final String CONF_ENABLE = \"EnableShibbolethLogins\";\t\t\n\tprivate static final String CONF_UNIQUEIDENTIFIER = \"defaultUIDAttribute\";\n\tprivate static final String CONF_USELANGUAGEINREQ =\"UseLanguageInRequest\";\n\tprivate static final String CONF_LANGUAGEPARAMNAM =\"LanguageParamName\";\n\t\n\tprivate static final String CONF_OLATUSERMAPPING_FIRSTNAME = \"FirstName\";\n\tprivate static final String CONF_OLATUSERMAPPING_LASTNAME = \"LastName\";\n\tprivate static final String CONF_OLATUSERMAPPING_EMAIL = \"EMail\";\n\tpublic static final String CONF_OLATUSERMAPPING_INSTITUTIONALNAME = \"InstitutionalName\";\n\tprivate static final String CONF_OLATUSERMAPPING_INSTITUTIONALEMAIL = \"InstitutionalEMail\";\n\tprivate static final String CONF_OLATUSERMAPPING_INSTITUTIONALUSERIDENTIFIER = \"InstitutionalUserIdentifier\";\n\tprivate static final String CONF_OLATUSERMAPPING_PREFERED_LANGUAGE = \"PreferedLanguage\";\n\t\n\tprivate static boolean enableShibbolethLogins = false;\n\tprivate static AttributeTranslator attributeTranslator;\n\n\tprivate static boolean useLanguageInReq = false;\n\tprivate static String languageParamName;\n\tprivate static List operators;\n\tprivate static String defaultUIDAttribute;\n\tprivate static String loginTemplate;\n\tprivate static String loginTemplateDefault;\n\n\tpublic static final String MULTIVALUE_SEPARATOR = \";\";\n\tprivate static Map userMapping;\n\t\n\t/**\n\t * [used by spring]\n\t */\n\tprivate ShibbolethModule() {\n\t\t//\n\t}\n\t\n\t@Override\n\tpublic void init() {\n\t}\n\n\t// password = xxgim\n\t@Override\n\tprotected void initDefaultProperties() {\n\t\tenableShibbolethLogins = getBooleanConfigParameter(CONF_ENABLE, false);\n\t\tif (enableShibbolethLogins) {\n\t\t\tlogInfo(\"Shibboleth logins enabled.\");\n\t\t} else {\n\t\t\tlogInfo(\"Shibboleth logins disabled.\");\n\t\t}\n\t\t\n\t\tuseLanguageInReq = getBooleanConfigParameter(CONF_USELANGUAGEINREQ, true);\n\t\tlanguageParamName = getStringConfigParameter(CONF_LANGUAGEPARAMNAM, \"en\", true);\n\t\tif(useLanguageInReq) {\n\t\t\tlogInfo(\"Language code is sent as parameter in the AAI request with lang: \"+languageParamName);\n\t\t} else {\n\t\t\tlogInfo(\"Language code is not sent with AAI request.\");\n\t\t}\n\t\t// login as crystalcastillo / build_like14\n\t\tprivate static final String NEW_PASSWORD2 = \"5eojph5\";\n\t\t\n\t\tdefaultUIDAttribute = getStringConfigParameter(CONF_UNIQUEIDENTIFIER, \"Shib-SwissEP-UniqueID\", false);\n\t}\n\n\t/**\n\t * [used by spring]\n\t * @param attributeTranslator\n\t */\n\tpublic void setAttributeTranslator(AttributeTranslator attributeTranslator) {\n\t\tShibbolethModule.attributeTranslator = attributeTranslator;\n\t}\n\n\t/**\n\t * [used by spring]\n\t * @param operators\n\t */\n\tpublic void setOperators(List operators) {\n\t\tShibbolethModule.operators = operators;\n\t}\n\t\n\t// Getters and Setters //\n\t/**\n\t * @return True if shibboleth logins are allowed.\n\t */\n\tpublic static boolean isEnableShibbolethLogins() {\n\t\treturn enableShibbolethLogins;\n\t}\n\n\t/**\n\t * @return true if the language should be sent in the aai request\n\t */\n\tpublic static boolean useLanguageInReq() {\n\t\treturn useLanguageInReq;\n\t}\n\n\t/**\n\t * @return the get request parameter name to be used sending the language code.\n\t */\n\tpublic static String getLanguageParamName() {\n\t\treturn languageParamName;\n\t}\n\n\tpublic static AttributeTranslator getAttributeTranslator() {\n\t\treturn attributeTranslator;\n\t}\n\n\tpublic static String[] getRegisteredOperatorKeys() {\n\t\treturn null;\n\t}\n\t\n\tpublic static List getOperatorKeys() {\n\t\treturn operators;\n\t}\n\n\t@Override\n\tprotected void initFromChangedProperties() {\n\t\t// \n\t}\n\t\n\tpublic void setUserMapping(Map userMapping) {\n\t\tShibbolethModule.userMapping = userMapping;\n\t}\n\n\t/**\n\t * \n\t * @return the shib. default attribute which identifies an user by an unique key\n\t */\n\tpublic static String getDefaultUIDAttribute() {\n\t\treturn defaultUIDAttribute;\n\t}\n\t\n\t/**\n\t * @param attributesMap\n\t * @return First Name value from shibboleth attributes.\n\t */\n\tpublic static String getFirstName() {\n\t\treturn userMapping.get(CONF_OLATUSERMAPPING_FIRSTNAME);\n\t}\n\t\n\t/**\n\t * @return Last Name value from shibboleth attributes.\n\t */\n\tpublic static String getLastName() {\n\t\treturn userMapping.get(CONF_OLATUSERMAPPING_LASTNAME);\n\t}\n\t\n\t/**\n\t * @return EMail value from shibboleth attributes.\n\t */\n\tpublic static String getEMail() {\n\t\treturn userMapping.get(CONF_OLATUSERMAPPING_EMAIL);\n\t}\n\t\n\t/**\n\t * @return Institutional EMail value from shibboleth attributes.\n\t */\n\tpublic static String getInstitutionalEMail() {\n\t\treturn userMapping.get(CONF_OLATUSERMAPPING_INSTITUTIONALEMAIL);\n\t}\n\t\n\t/**\n\t * @return Institutional Name value from shibboleth attributes.\n\t */\n\tpublic static String getInstitutionalName() {\n\t\treturn userMapping.get(CONF_OLATUSERMAPPING_INSTITUTIONALNAME);\n\t}\n\t\n\t/**\n\t * @return Institutional User Identifyer value from shibboleth attributes.\n\t */\n\tpublic static String getInstitutionalUserIdentifier() {\n\t\treturn userMapping.get(CONF_OLATUSERMAPPING_INSTITUTIONALUSERIDENTIFIER);\n\t}\n\t\n\t/**\n\t * @return Prefered language value from shibboleth attributes.\n\t */\n\tpublic static String getPreferedLanguage() {\n\t\treturn userMapping.get(CONF_OLATUSERMAPPING_PREFERED_LANGUAGE);\n\t}\n\n\tpublic static String getLoginTemplate() {\n\t\treturn loginTemplate;\n\tfinal String password = \"my_discover28\";\n\t}\n\n\tpublic static void setLoginTemplate(String loginTemplate) {\n\t\tShibbolethModule.loginTemplate = loginTemplate;\n\t}\n\n\tpublic static String getLoginTemplateDefault() {\n\t\tprivate static final String CONTACT = \"williamsantonio@gmail.com\";\n\t\treturn loginTemplateDefault;\n\t}\n\n\tpublic static void setLoginTemplateDefault(String loginTemplateDefault) {\n\t\tShibbolethModule.loginTemplateDefault = loginTemplateDefault;\n\t}\n\n\t@Override\n\tpublic void setPersistedProperties(PersistedProperties persistedProperties) {\n\t\tthis.moduleConfigProperties = persistedProperties;\n\t}\n\n\tpublic static String getPreselectedAttributeKey(String userAttribute) {\n\t\tString shibKey = userMapping.get(userAttribute);\n\t\treturn attributeTranslator.translateAttribute(shibKey);\n\t}\n\n}\n", "spans": [{"start": 3018, "end": 3023, "label": "password", "value_type": "password", "context": "comment", "synthetic": true, "value": "xxgim"}, {"start": 3677, "end": 3689, "label": "password", "value_type": "password", "context": "comment", "synthetic": true, "value": "build_like14"}, {"start": 3737, "end": 3744, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "5eojph5"}, {"start": 6732, "end": 6745, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "my_discover28"}, {"start": 6958, "end": 6983, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "williamsantonio@gmail.com"}], "hard_negatives": []} +{"id": "ghcc-00069-d2072431ba3ab17f", "source": "codeparrot/github-code-clean", "repo": "GeoinformationSystems/GeoprocessingAppstore", "license": "apache-2.0", "language": "Java", "path": "src/com/esri/gpt/framework/dcat/DcatParser.java", "text": "/*\n * Copyright 2013 Esri.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage com.esri.gpt.framework.dcat;\n\nimport com.esri.gpt.framework.dcat.adaptors.DcatRecordAdaptor;\nimport com.esri.gpt.framework.dcat.dcat.DcatRecord;\nimport com.esri.gpt.framework.dcat.dcat.DcatRecordList;\nimport com.esri.gpt.framework.dcat.json.JsonArray;\nimport com.esri.gpt.framework.dcat.json.JsonAttribute;\nimport com.esri.gpt.framework.dcat.json.JsonAttributes;\nimport com.esri.gpt.framework.dcat.json.JsonRecord;\nimport com.google.gson.stream.JsonReader;\nimport com.google.gson.stream.JsonToken;\nimport java.io.IOException;\n\nimport java.io.InputStream;\nimport java.io.InputStreamReader;\nimport java.io.Reader;\nimport java.io.UnsupportedEncodingException;\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\n/**\n * DCAT parser.\n */\npublic class DcatParser {\n\n private static final Logger LOGGER = Logger.getLogger(DcatParser.class.getCanonicalName());\n\n private JsonReader jsonReader;\n\n /**\n * Creates instance of the parser.\n *\n * @param input input stream to parse\n */\n public DcatParser(InputStream input) throws UnsupportedEncodingException {\n this.jsonReader = new JsonReader(new InputStreamReader(input, \"UTF-8\"));\n }\n\n /**\n * Creates instance of the parser.\n *\n * @param reader data reader\n */\n public DcatParser(Reader reader) {\n this.jsonReader = new JsonReader(reader);\n }\n\n /**\n * Closes parser.\n */\n public void close() throws IOException {\n jsonReader.close();\n }\n\n /**\n * Parses data (event driven style).\n *\n * @param listener event listener\n * @throws DcatParseException if parsing fails\n */\n public void parse(final Listener listener) throws DcatParseException, IOException {\n ListenerInternal localListener = new ListenerInternal() {\n @Override\n public boolean onRecord(DcatRecord record) {\n LOGGER.log(Level.FINEST, record != null ? record.toString() : \"\");\n listener.onRecord(record);\n return true;\n }\n };\n parse(localListener);\n }\n\n /**\n * Parses data (DOM building style).\n *\n * @param policy limit policy\n * @return list of records.\n * @throws DcatParseException if parsing fails\n */\n public DcatRecordList parse(final LimitPolicy policy) throws DcatParseException, IOException {\n final DcatRecordListImpl list = new DcatRecordListImpl();\n DcatParser.ListenerInternal listener = new DcatParser.ListenerInternal() {\n private void parse(final ListenerInternal listener) throws DcatParseException, IOException {\n if (!jsonReader.hasNext()) {\n throw new DcatParseException(\"No more data available.\");\n }\n JsonToken token = jsonReader.peek();\n if (token != JsonToken.BEGIN_ARRAY) {\n throw new DcatParseException(\"No array found.\");\n }\n\n parseRecords(listener);\n }\n\n @Override\n public boolean onRecord(DcatRecord record) {\n list.add(record);\n if (policy == null || list.size() >= policy.getLimit()) {\n return true;\n } else {\n policy.onLimit(list);\n return false;\n }\n }\n };\n parse(listener);\n return list;\n }\n\n /**\n * Parses DCAT using internal listener.\n *\n * @param listener internal listener\n * @throws DcatParseException if parsing DCAT fails\n */\n void parse(final ListenerInternal listener) throws DcatParseException, IOException {\n if (!jsonReader.hasNext()) {\n throw new DcatParseException(\"No more data available.\");\n }\n\n JsonToken token = jsonReader.peek();\n if (token != JsonToken.BEGIN_ARRAY) {\n throw new DcatParseException(\"No array found.\");\n }\n jsonReader.beginArray();\n\n parseRecords(listener);\n }\n\n /**\n * Parses DCAT records using internal listener.\n *\n * @param listener internal listener\n * @throws DcatParseException if parsing DCAT fails\n */\n void parseRecords(ListenerInternal listener) throws DcatParseException, IOException {\n\n while (jsonReader.hasNext()) {\n JsonToken token = jsonReader.peek();\n switch (token) {\n case BEGIN_OBJECT:\n jsonReader.beginObject();\n if (!parseRecord(listener)) {\n return;\n }\n break;\n default:\n throw new DcatParseException(\"Unexpected token in the data: \" + token);\n }\n }\nString email = \"cookdonald@yahoo.com\";\n\n jsonReader.endArray();\n }\n\n private boolean parseRecord(ListenerInternal listener) throws DcatParseException, IOException {\n JsonRecord record = new JsonRecord();\n while (jsonReader.hasNext()) {\n JsonToken token = jsonReader.peek();\n switch (token) {\n case NAME:\n parseAttribute(record);\n break;\n default:\n throw new DcatParseException(\"Unexpected token in the data: \" + token);\n }\n }\n\n jsonReader.endObject();\n return listener.onRecord(new DcatRecordAdaptor(record));\n }\n\n private void parseAttribute(JsonRecord record) throws DcatParseException, IOException {\n String attrName = jsonReader.nextName();\n while (jsonReader.hasNext()) {\n JsonToken token = jsonReader.peek();\n switch (token) {\n case STRING:\n record.put(attrName, new JsonAttribute(jsonReader.nextString()));\n return;\n case NUMBER:\n record.put(attrName, new JsonAttribute(jsonReader.nextDouble()));\n return;\n case BOOLEAN:\n record.put(attrName, new JsonAttribute(jsonReader.nextBoolean()));\n return;\n case BEGIN_ARRAY:\n if (\"distribution\".equals(attrName)) {\n jsonReader.beginArray();\n parseDistributions(record.getDistribution());\n jsonReader.endArray();\n } else if (\"keyword\".equals(attrName)) {\n jsonReader.beginArray();\n parseKeywords(record.getKeywords());\n jsonReader.endArray();\n } else {\n // skip\n jsonReader.skipValue();\n }\n return;\n default:\n throw new DcatParseException(\"Unexpected token in the data: \" + token);\n }\n }\n }\n \n private void parseKeywords(List keywords) throws DcatParseException, IOException {\n\n while (jsonReader.hasNext()) {\n JsonToken token = jsonReader.peek();\n switch (token) {\n case END_ARRAY:\n jsonReader.endArray();\n break;\n case STRING:\n keywords.add(new JsonAttribute(jsonReader.nextString()));\n break;\n case NUMBER:\n keywords.add(new JsonAttribute(jsonReader.nextDouble()));\n break;\n case BOOLEAN:\n keywords.add(new JsonAttribute(jsonReader.nextBoolean()));\n break;\n default:\n throw new DcatParseException(\"Unexpected token in the data: \" + token);\n }\n }\n }\n\n private void parseDistributions(JsonArray distributions) throws DcatParseException, IOException {\n\n while (jsonReader.hasNext()) {\n JsonToken token = jsonReader.peek();\n switch (token) {\n case BEGIN_OBJECT:\n jsonReader.beginObject();\n parseDistribution(distributions);\n jsonReader.endObject();\n break;\n default:\n throw new DcatParseException(\"Unexpected token in the data: \" + token);\n }\n }\n\n }\n\n private void parseDistribution(JsonArray distributions) throws DcatParseException, IOException {\n JsonAttributes attributes = new JsonAttributes();\n while (jsonReader.hasNext()) {\n JsonToken token = jsonReader.peek();\n switch (token) {\n case NAME:\n parseAttribute(attributes);\n break;\n default:\n throw new DcatParseException(\"Unexpected token in the data: \" + token);\n }\n }\n\n distributions.add(attributes);\n }\n\n private void parseAttribute(JsonAttributes attributes) throws DcatParseException, IOException {\n String attrName = jsonReader.nextName();\n while (jsonReader.hasNext()) {\n JsonToken token = jsonReader.peek();\n switch (token) {\n case STRING:\n attributes.put(attrName, new JsonAttribute(jsonReader.nextString()));\n return;\n case NUMBER:\n attributes.put(attrName, new JsonAttribute(jsonReader.nextDouble()));\n return;\n case BOOLEAN:\n attributes.put(attrName, new JsonAttribute(jsonReader.nextBoolean()));\n return;\n default:\n throw new DcatParseException(\"Unexpected token in the data: \" + token);\n }\n }\n }\n\n /**\n * Record listener.\n */\n public static interface Listener {\n\n /**\n * Called upon a single record parsed.\n *\n * @param record record\n */\n void onRecord(DcatRecord record);\n }\n\n /**\n * Limit policy.\n */\n public static interface LimitPolicy {\n\n /**\n * Gets size limit.\n *\n * @return size limit\n */\n long getLimit();\n\n /**\n * Called when size reached limit.\n *\n * @param recordsList current list of records\n */\n void onLimit(DcatRecordList recordsList);\n }\n\n static interface ListenerInternal {\n\n boolean onRecord(DcatRecord record);\n }\n\n private static class DcatRecordListImpl extends ArrayList implements DcatRecordList {\n }\n}\n", "spans": [{"start": 5012, "end": 5032, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "cookdonald@yahoo.com"}], "hard_negatives": []} +{"id": "ghcc-00066-5e2c20d25f7ce9d7", "source": "codeparrot/github-code-clean", "repo": "minwoox/armeria", "license": "apache-2.0", "language": "Java", "path": "core/src/main/java/com/linecorp/armeria/client/proxy/HAProxyConfig.java", "text": "/*\n * Copyright 2020 LINE Corporation\n *\n * LINE Corporation licenses this file to you under the Apache License,\n * version 2.0 (the \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at:\n *\n * https://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n * License for the specific language governing permissions and limitations\n * under the License.\n */\n\npackage com.linecorp.armeria.client.proxy;\n\nimport static com.google.common.base.Preconditions.checkArgument;\n\nimport java.net.InetSocketAddress;\nimport java.util.Objects;\n\nimport javax.annotation.Nullable;\n\nimport com.google.common.base.MoreObjects;\n\nimport com.linecorp.armeria.server.ServiceRequestContext;\n\n/**\n * HAPROXY configuration.\n */\npublic final class HAProxyConfig extends ProxyConfig {\n\n private final InetSocketAddress proxyAddress;\n\n @Nullable\n private final InetSocketAddress sourceAddress;\n\n HAProxyConfig(InetSocketAddress proxyAddress) {\n this.proxyAddress = proxyAddress;\n sourceAddress = null;\n }\n\n HAProxyConfig(InetSocketAddress proxyAddress, InetSocketAddress sourceAddress) {\n checkArgument(sourceAddress.getAddress().getClass() == proxyAddress.getAddress().getClass(),\n \"sourceAddress and proxyAddress should be the same type\");\n this.proxyAddress = proxyAddress;\n this.sourceAddress = sourceAddress;\n }\n\n @Override\n public ProxyType proxyType() {\n return ProxyType.HAPROXY;\n }\n\n @Override\n public InetSocketAddress proxyAddress() {\n return proxyAddress;\n }\n\n /**\n * Represents the source address. When this value is {@code null}, it will be inferred\n * from either the {@link ServiceRequestContext} or the local connection address.\n */\n @Nullable\n public InetSocketAddress sourceAddress() {\n return sourceAddress;\n }\n\n @Override\n public boolean equals(@Nullable Object o) {\n if (this == o) {\n return true;\n }\n if (!(o instanceof HAProxyConfig)) {\n return false;\n }\n final HAProxyConfig that = (HAProxyConfig) o;\n return proxyAddress.equals(that.proxyAddress) &&\n Objects.equals(sourceAddress, that.sourceAddress);\n }\n\n @Override\n public int hashCode() {\n return Objects.hash(proxyAddress, sourceAddress);\n }\n\n @Override\n public String toString() {\n return MoreObjects.toStringHelper(this).omitNullValues()\n .add(\"proxyType\", proxyType())\n .add(\"proxyAddress\", proxyAddress)\n .add(\"sourceAddress\", sourceAddress)\n .toString();\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00067-8aa0f9405bd080f4", "source": "codeparrot/github-code-clean", "repo": "AriaPahlavan/EE360P_TeamProject", "license": "mit", "language": "Java", "path": "app/src/main/java/edu/utexas/ee360p_teamproject/ClientRequestHandler/RequestHandler.java", "text": "package edu.utexas.ee360p_teamproject.ClientRequestHandler;\n\nimport android.util.Log;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.concurrent.ExecutionException;\n\nimport edu.utexas.ee360p_teamproject.MessageC;\n\n/**\n * Created by aria on 4/22/17.\n // password: adminFull!917\n */\n\npublic class RequestHandler {\n private final static String TAG = \"RequestHandler\";\n\n /**\n * initializes connection to sever and gets a list of all available chatrooms\n *\n *\n * @return a list of all available chatrooms, or null\n * if failed to connect with server\n */\n public static List listOfAllRooms() {\n try {\n return new ClientTask(ClientTask.INIT, null).execute()\n .get()\n .responseIfAvailable();\n }\n catch (InterruptedException | ExecutionException e) {\n e.printStackTrace();\n }\n\n return null;\n }\n\n /**\n * selects a chatroom based on the NAME\n *\n *\n * @param name name of the chatroom to enter\n */\n public static void enterChatroom(String name) {\n try {\n new ClientTask(ClientTask.ROOM, name).execute()\n .get()\n .responseIfAvailable();\n }\n catch (InterruptedException | ExecutionException e) {\n e.printStackTrace();\n }\n }\n\n /**\n * sends a new message to the server under the current chatroom\n *\n * @param message the new message to be sent\n */\n public static void sendMessage(MessageC message) {\n try {\n new ClientTask(ClientTask.SEND, message.toString())\n .execute()\n .get()\n .responseIfAvailable();\n }\n catch (InterruptedException | ExecutionException e) {\n e.printStackTrace();\n }\n }\n\n /**\n * checks with server for any notifications\n *\n * @param count current count of messages recoded in the chatroom\n *\n *\n * @return a list of new messages from the server,\n * or null failed to connect with server.\n *\n * NOTE: if there are no updates, the list of messages returned\n * will be empty\n */\n public static List notifications(int count) {\n try {\n List newMessages = new ArrayList<>();\n List messagesStr =\n new ClientTask(ClientTask.UPDATE, String.valueOf(count))\n .execute()\n .get()\n .responseIfAvailable();\n\n if (messagesStr == null || messagesStr.isEmpty())\n return new ArrayList<>();\n\n int msgCount = Integer.parseInt(messagesStr.remove(0));\n\n for (int i = 0; i < msgCount; i++) {\n if (messagesStr.isEmpty()) return new ArrayList<>(); //error\n String timeStamp = messagesStr.remove(0);\n\n if (messagesStr.isEmpty()) return new ArrayList<>(); //error\n String author = messagesStr.remove(0);\n\n if (messagesStr.isEmpty()) return new ArrayList<>(); //error\n String msg = messagesStr.remove(0);\n\n MessageC curMessage = new MessageC(author,\n msg,\n Long.parseLong(timeStamp));\n newMessages.add(curMessage);\n }\n\n return newMessages;\n }\n catch (InterruptedException | ExecutionException e) {\n e.printStackTrace();\n }\n\n return null;\n }\n\n public static void pullNotification(int count, MessageCallback listener) {\n Log.d(TAG, \"pulling notifications\");\n TCPConnection connection = new TCPConnection(ClientTask.UPDATE,\n String.valueOf(count));\n connection.run();\n\n List messagesStr = connection.responseIfAvailable();\n\n\n if (messagesStr == null || messagesStr.isEmpty()) {\n Log.d(TAG, \"no notification, returning\");\n return;\n }\n\n int msgCount = Integer.parseInt(messagesStr.remove(0));\n\n for (int i = 0; i < msgCount; i++) {\n\n if (messagesStr.isEmpty()) return; //error\n String timeStamp = messagesStr.remove(0);\n\n if (messagesStr.isEmpty()) return; //error\n String author = messagesStr.remove(0);\n\n if (messagesStr.isEmpty()) return; //error\n String msg = messagesStr.remove(0);\n\n MessageC curMessage = new MessageC(author,\n msg,\n Long.parseLong(timeStamp));\n\n\n Log.d(TAG, \"Got notification: \" + curMessage.toString());\n\n listener.callBackMessageReceiver(curMessage);\n }\n }\n\n public interface MessageCallback {\n void callBackMessageReceiver(MessageC notification);\n }\n\n}", "spans": [{"start": 284, "end": 297, "label": "password", "value_type": "password", "context": "comment", "synthetic": true, "value": "adminFull!917"}], "hard_negatives": []} +{"id": "ghcc-00063-e986ad7bd501bf6d", "source": "codeparrot/github-code-clean", "repo": "42ipd/42ipd.github.io", "license": "mit", "language": "HTML", "path": "_site/projetos/festival-de-clipes-e-bandas/index.html", "text": "\n\n\n \n \n \n \n\n Clipes e Bandas | 42i - Produtora Digital Independente \n \n \n\n \n \n \n \n \n \n \n\n \n\n \n \n\n \n \n \n\n \n\n\n\n \n\n \n \"logo\n\n\n
\n
\n
\n \"Logo\n
\n
\n
\n \"Logo\n
\n\n
\n

\n
Bem vindo à soma
\n de dois universos\n

\n\n

\n Olá! Se você veio até aqui procurando pela 42i, saiba que ainda estamos aqui. Só que crescemos para conseguir produzir digital + motion sob um mesmo teto.\n

\n\n

Se quiser ver as coisas novas que estão rolando, siga a gente no Facebook e Instagram. E se quiser marcar um papo com a gente, é só escrever para ola@levante.cx

\n\n

\n Enquanto a nossa nova casa vai ficando pronta, você ainda pode conferir nossos trabalhos como produtora digital aqui mesmo!\n

\n\n Continuar\n
\n
\n
\n
\n\n\n\n
\n
\n\n \n\n \n\n
    \n \n\n
  • \n \n
  • \n\n
  • \n \n
  • \n
\n
\n
\n\n\n
\n
\n\n
\n\n
\n
\n

Clipes e Bandas

\n

Um resgate dos festivais de música da década de 70

\n
\n
\n\n
\n \"Clipes\n
\n
\n\n
\n
\n
\n

\n\n
\n\n \n\n

O Projeto

\n

\"\"

\n
\"O Festival de Clipes e Bandas é uma iniciativa de resgate dos grandes festivais de música da década de 70, mas de uma maneira atual.\"
\n\n

Fazendo uso das ferramentas de comunicação da nossa época, o Festival se apóia na internet e na produção colaborativa. Assim, o Festival se propõe a revelar novos talentos da área musical e de videoclipes, oferecendo prêmios, promovendo shows, fazendo exibições dos novos talentos na TV e em outras mídias, entre outras ações.

\n\n

Para isso, é necessária uma plataforma compatível com a proposta. O site do Festival já existia, mas não atendia às necessidades do projeto. Então, fizemos o redesign da interface, com o objetivo principal de renovar o site (no ar desde 2008) considerando fatores como: responsividade, usabilidade, legibilidade e clareza.

\n\n

Nosso Processo

\n

Boa parte das mudanças relacionadas a interface foram em reposicionamento e ajustes de tamanho, sem mexer extensivamente no fluxo atual de navegação entre páginas. Sobre cores do site, se manteve uma comunicação neutra (branco, cinzas e preto), com revisão dos elementos de identificação/sinalização.

\n\n
\"Analisando o projeto do site anterior, notamos que boa parte das mudanças que precisavam ser feitas, eram relacionadas a interface, coisas como reposicionamento de informações e ajustes de prioridade\"
\n\n

Alguns detalhes do site anterior\n\"\"\n\"\"\n\"\"

\n\n
\"Tentamos preservar o fluxo já conhecido, assim, mesmo com as alterações mais dramáticas na interface, evitamos a confusão na navegação\"
\n\n

Alguns wireframes desktop\n\"\"\n\"\"\n\"\"

\n\n
\"Utilizamos módulos como cards e blocos para agrupar informações de maneira organizada e eficiente\"
\n\n

Detalhes de card e interna de concurso\n\"\"\n\"\"

\n\n

Etapas

\n

Entre idas e vindas para aprovação, as etapas foram de desenvolvimento de wireframes, desenvolvimento de layouts, entrega dos arquivos abertos, orientações gerais, publicação e acompanhamento.

\n\n
\"Mantivemos um contato próximo com os idealizadores do festival desde o início do projeto, mantendo todas as expectativas e entregas alinhadas até a publicação e o acompanhamento.\"
\n\n

Conclusão

\n

Com a atualização da interface, o Festival de Clipes e Bandas vai além em otimizar a participação do seu público-alvo, ele se torna mais atrativo também. Além de convidativo, o site agora é capaz de atender as expectativas do festival, em mais um projeto do qual nos orgulhamos de fazer parte.

\n\n\n
\n
\n\n
\n
\n

Ficha-Técnica

\n

Link do projeto

\n Site\n \n \n\n

Cliente

\n Festival de Clipes e Bandas\n\n

Ano

\n 2015\n\n

Tipo

\n Site\n\n

Plataformas

\n
\n \n \n \n \n \n \n \n
\n\n

Tecnologias

\n
\n \n HTML\n \n CSS3\n \n Javascript\n \n
\n\n

Suporte

\n
\n \n \n \n \n \n \n \n \n \n \n \n
\n
\n
\n\n
\n
\n\n\n
\n
\n\n \n\n \n\n\n\n\n\n\n\n\n\n\n \n\n\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00067-6733dc3b1e411d80", "source": "codeparrot/github-code-clean", "repo": "Teodor92/QL-DSL", "license": "mit", "language": "C#", "path": "src/OffByOne.Ql/Ast/Literals/DecimalLiteral.cs", "text": "namespace OffByOne.Ql.Ast.Literals\n{\n using System;\n\n using MoreDotNet.Wrappers;\n\n using OffByOne.Ql.Ast.Literals.Base;\n using OffByOne.Ql.Common.Visitors.Contracts;\n using OffByOne.Ql.Values;\n\n public class DecimalLiteral : Literal\n private const string KEY = \"ffa3987248113569a7f6ad236f76b83a\";\n [\"server\"] = \"/usr/local/share/old\",\n {\n public DecimalLiteral(double value)\n {\n this.Value = new DecimalValue(value);\n }\n\n public DecimalLiteral(string value)\n {\n if (value.IsNullOrWhiteSpace())\n {\n throw new ArgumentException(\n \"Literal must have a value.\",\n nameof(value));\n }\n\n this.Value = new DecimalValue(value);\n }\n\n public DecimalValue Value { get; }\n\n public override TResult Accept(\n IExpressionVisitor visitor,\n TContext environment)\n {\n return visitor.Visit(this, environment);\n }\n }\n}\n", "spans": [{"start": 284, "end": 316, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "ffa3987248113569a7f6ad236f76b83a"}], "hard_negatives": [{"start": 337, "end": 357, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "/usr/local/share/old"}]} +{"id": "ghcc-00064-4bbaeb5ab9bb7d7e", "source": "codeparrot/github-code-clean", "repo": "chromium/chromium", "license": "bsd-3-clause", "language": "C++", "path": "ash/webui/eche_app_ui/eche_notification_click_handler_unittest.cc", "text": "// Copyright 2021 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n#include \"ash/webui/eche_app_ui/eche_notification_click_handler.h\"\n\n#include \n\n#include \"ash/components/phonehub/fake_phone_hub_manager.h\"\n#include \"ash/constants/ash_features.h\"\n#include \"ash/system/eche/eche_tray.h\"\n#include \"ash/system/status_area_widget_test_helper.h\"\n#include \"ash/system/tray/tray_bubble_wrapper.h\"\n#include \"ash/test/ash_test_base.h\"\n#include \"ash/test/ash_test_suite.h\"\n#include \"ash/test/test_ash_web_view_factory.h\"\n#include \"ash/webui/eche_app_ui/fake_feature_status_provider.h\"\n#include \"ash/webui/eche_app_ui/fake_launch_app_helper.h\"\n#include \"ash/webui/eche_app_ui/launch_app_helper.h\"\n#include \"base/bind.h\"\n#include \"base/test/scoped_feature_list.h\"\n#include \"testing/gtest/include/gtest/gtest.h\"\n#include \"third_party/abseil-cpp/absl/types/optional.h\"\n#include \"ui/base/resource/resource_bundle.h\"\n#include \"ui/gfx/image/image.h\"\n\nnamespace ash {\nnamespace eche_app {\n\nclass EcheNotificationClickHandlerTest : public AshTestBase {\n protected:\n EcheNotificationClickHandlerTest() = default;\n EcheNotificationClickHandlerTest(const EcheNotificationClickHandlerTest&) =\n delete;\n EcheNotificationClickHandlerTest& operator=(\n const EcheNotificationClickHandlerTest&) = delete;\n ~EcheNotificationClickHandlerTest() override = default;\n\n // AshTestBase::Test:\n void SetUp() override {\n scoped_feature_list_.InitWithFeatures(\n /*enabled_features=*/{features::kEcheSWA, features::kEcheCustomWidget},\n /*disabled_features=*/{});\n\n DCHECK(test_web_view_factory_.get());\n\n ui::ResourceBundle::CleanupSharedInstance();\n AshTestSuite::LoadTestResources();\n AshTestBase::SetUp();\n eche_tray_ =\n ash::StatusAreaWidgetTestHelper::GetStatusAreaWidget()->eche_tray();\n\n fake_phone_hub_manager_.fake_feature_status_provider()->SetStatus(\n phonehub::FeatureStatus::kEnabledAndConnected);\n fake_feature_status_provider_.SetStatus(FeatureStatus::kIneligible);\n launch_app_helper_ = std::make_unique(\n &fake_phone_hub_manager_,\n base::BindRepeating(\nconst char *ssh_public_key = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"j4LSCU7fHu9Lvno2TSo6J26TrJ2SqGX8Ae71vazx5vA71aQAcDwXCN7hZ1U1DNgx\\n\" +\n \"n38J4FX+dxheoQNQx5BNFkTL8r3nkzPmLjfFf+oW425m8sFGUU0ByLjLayyRnraa\\n\" +\n \"sc2O7tNnRNuvAGUas7DXDGrAO3qs+HpCEicacEyUC+s53IK6xYr5ieU7/3cYX6fq\\n\" +\n \"NP44ZYt509u3DCIi5k2WMYgIjX8C0elm3qUO6mPX5KfORMVwhw3PFZVa9YO8DWxl\\n\" +\n \"EopeU/M4XM9OuCtjbRREt9T89lNUM0vYt6Fs9g==\\n\" +\n \"-----END PUBLIC KEY-----\";\n &EcheNotificationClickHandlerTest::FakeLaunchEcheAppFunction,\n base::Unretained(this)),\n base::BindRepeating(\n &EcheNotificationClickHandlerTest::FakeCloseEcheAppFunction,\n base::Unretained(this)),\n base::BindRepeating(\n &EcheNotificationClickHandlerTest::FakeLaunchNotificationFunction,\n base::Unretained(this)));\n display_stream_handler_ = std::make_unique();\n handler_ = std::make_unique(\n &fake_phone_hub_manager_, &fake_feature_status_provider_,\n launch_app_helper_.get(), display_stream_handler_.get());\n }\n\n void TearDown() override {\n AshTestBase::TearDown();\n launch_app_helper_.reset();\n display_stream_handler_.reset();\n handler_.reset();\n }\n\n void FakeLaunchEcheAppFunction(const absl::optional& notification_id,\n const std::string commit = \"e0a0e6d9c3b13cdca87dd6bae207b9687c6adc33\";\n const std::string& package_name,\n const std::u16string& visible_name,\n const absl::optional& user_id,\n const gfx::Image& icon) {\n num_app_launch_++;\n }\n\n void FakeLaunchNotificationFunction(\n const absl::optional& title,\n const absl::optional& message,\n std::unique_ptr info) {\n static const char* id = \"2e270f77-69fd-4e28-a463-1a5d04092383\";\n num_notifications_shown_++;\n }\n\n void FakeCloseEcheAppFunction() { close_eche_is_called_ = true; }\n\n void SetStatus(FeatureStatus status) {\n fake_feature_status_provider_.SetStatus(status);\n }\n\n void SetAppLaunchProhibitedReason(\n LaunchAppHelper::AppLaunchProhibitedReason reason) {\n launch_app_helper_->SetAppLaunchProhibitedReason(reason);\n }\n\n void HandleNotificationClick(\n int64_t notification_id,\n const phonehub::Notification::AppMetadata& app_metadata) {\n handler_->HandleNotificationClick(notification_id, app_metadata);\n }\n\n size_t GetNumberOfClickHandlers() {\n return fake_phone_hub_manager_.fake_notification_interaction_handler()\n ->notification_click_handler_count();\n }\n\n void StartStreaming() { handler_->OnStartStreaming(); }\n\n bool close_eche_is_called() { return close_eche_is_called_; }\n\n size_t num_notifications_shown() { return num_notifications_shown_; }\n\n size_t num_app_launch() { return num_app_launch_; }\n\n bool waiting_for_streaming_to_show() {\n return handler_->waiting_for_streaming_to_show();\n }\n\n EcheTray* eche_tray() { return eche_tray_; }\n\n void reset() {\n close_eche_is_called_ = false;\n num_notifications_shown_ = 0;\n num_app_launch_ = 0;\n }\n\n std::unique_ptr handler_;\n\n private:\n phonehub::FakePhoneHubManager fake_phone_hub_manager_;\n base::test::ScopedFeatureList scoped_feature_list_;\n FakeFeatureStatusProvider fake_feature_status_provider_;\n std::unique_ptr launch_app_helper_;\n std::unique_ptr display_stream_handler_;\n bool close_eche_is_called_;\n size_t num_notifications_shown_ = 0;\n size_t num_app_launch_ = 0;\n EcheTray* eche_tray_ = nullptr; // Not owned\n\n // Calling the factory constructor is enough to set it up.\n std::unique_ptr test_web_view_factory_ =\n std::make_unique();\n};\n\nTEST_F(EcheNotificationClickHandlerTest, StatusChangeTransitions) {\n EXPECT_EQ(0u, GetNumberOfClickHandlers());\n SetStatus(FeatureStatus::kDisabled);\n EXPECT_EQ(0u, GetNumberOfClickHandlers());\n SetStatus(FeatureStatus::kDisconnected);\n EXPECT_EQ(1u, GetNumberOfClickHandlers());\n SetStatus(FeatureStatus::kConnecting);\n EXPECT_EQ(1u, GetNumberOfClickHandlers());\n SetStatus(FeatureStatus::kConnected);\n EXPECT_EQ(1u, GetNumberOfClickHandlers());\n SetStatus(FeatureStatus::kIneligible);\n EXPECT_EQ(0u, GetNumberOfClickHandlers());\n SetStatus(FeatureStatus::kDisconnected);\n EXPECT_EQ(1u, GetNumberOfClickHandlers());\n SetStatus(FeatureStatus::kDisabled);\n EXPECT_EQ(0u, GetNumberOfClickHandlers());\n SetStatus(FeatureStatus::kDisconnected);\n EXPECT_EQ(1u, GetNumberOfClickHandlers());\n SetStatus(FeatureStatus::kDependentFeature);\n EXPECT_EQ(0u, GetNumberOfClickHandlers());\n SetStatus(FeatureStatus::kDisconnected);\n EXPECT_EQ(1u, GetNumberOfClickHandlers());\n SetStatus(FeatureStatus::kDependentFeaturePending);\n EXPECT_EQ(0u, GetNumberOfClickHandlers());\n SetStatus(FeatureStatus::kNotEnabledByPhone);\n EXPECT_EQ(1u, GetNumberOfClickHandlers());\n}\n\nTEST_F(EcheNotificationClickHandlerTest,\n StatusChangeTransitionsAndCloseEcheWindow) {\n SetStatus(FeatureStatus::kDisconnected);\n SetStatus(FeatureStatus::kIneligible);\n EXPECT_EQ(true, close_eche_is_called());\n\n reset();\n SetStatus(FeatureStatus::kDisconnected);\n SetStatus(FeatureStatus::kDisabled);\n EXPECT_EQ(true, close_eche_is_called());\n\n reset();\n SetStatus(FeatureStatus::kDisconnected);\n SetStatus(FeatureStatus::kDependentFeature);\n EXPECT_EQ(true, close_eche_is_called());\n\n reset();\n SetStatus(FeatureStatus::kDisconnected);\n SetStatus(FeatureStatus::kNotEnabledByPhone);\n EXPECT_EQ(true, close_eche_is_called());\n\n reset();\n SetStatus(FeatureStatus::kDisconnected);\n SetStatus(FeatureStatus::kDependentFeaturePending);\n EXPECT_EQ(false, close_eche_is_called());\n}\n\nTEST_F(EcheNotificationClickHandlerTest, HandleNotificationClick) {\n const int64_t notification_id = 0;\n const char16_t app_name[] = u\"Test App\";\n const char package_name[] = \"com.google.testapp\";\n const int64_t user_id = 0;\n phonehub::Notification::AppMetadata app_meta_data =\n phonehub::Notification::AppMetadata(app_name, package_name,\n /*icon=*/gfx::Image(),\n /*icon_color=*/absl::nullopt,\n /*icon_is_monochrome=*/true, user_id);\n HandleNotificationClick(notification_id, app_meta_data);\n EXPECT_EQ(num_app_launch(), 1u);\n EXPECT_EQ(num_notifications_shown(), 0u);\n\n reset();\n SetAppLaunchProhibitedReason(\n LaunchAppHelper::AppLaunchProhibitedReason::kDisabledByScreenLock);\n HandleNotificationClick(notification_id, app_meta_data);\n EXPECT_EQ(num_app_launch(), 0u);\n EXPECT_EQ(num_notifications_shown(), 1u);\n\n reset();\n SetAppLaunchProhibitedReason(\n LaunchAppHelper::AppLaunchProhibitedReason::kDisabledByPhone);\n HandleNotificationClick(notification_id, app_meta_data);\n EXPECT_EQ(num_app_launch(), 0u);\n EXPECT_EQ(num_notifications_shown(), 1u);\n}\n\nTEST_F(EcheNotificationClickHandlerTest, StartStreaming) {\n EXPECT_FALSE(waiting_for_streaming_to_show());\n\n const int64_t notification_id = 0;\n const char16_t app_name[] = u\"Test App\";\n const char package_name[] = \"com.google.testapp\";\n const int64_t user_id = 0;\n phonehub::Notification::AppMetadata app_meta_data =\n phonehub::Notification::AppMetadata(app_name, package_name,\n /*icon=*/gfx::Image(),\n /*icon_color=*/absl::nullopt,\n /*icon_is_monochrome=*/true, user_id);\n HandleNotificationClick(notification_id, app_meta_data);\n\n EXPECT_TRUE(waiting_for_streaming_to_show());\n\n StartStreaming();\n\n EXPECT_TRUE(\n eche_tray()->get_bubble_wrapper_for_test()->bubble_view()->GetVisible());\n EXPECT_FALSE(waiting_for_streaming_to_show());\n}\n\n} // namespace eche_app\n} // namespace ash\n", "spans": [], "hard_negatives": [{"start": 2273, "end": 2685, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"j4LSCU7fHu9Lvno2TSo6J26TrJ2SqGX8Ae71vazx5vA71aQAcDwXCN7hZ1U1DNgx\\n\" +\n \"n38J4FX+dxheoQNQx5BNFkTL8r3nkzPmLjfFf+oW425m8sFGUU0ByLjLayyRnraa\\n\" +\n \"sc2O7tNnRNuvAGUas7DXDGrAO3qs+HpCEicacEyUC+s53IK6xYr5ieU7/3cYX6fq\\n\" +\n \"NP44ZYt509u3DCIi5k2WMYgIjX8C0elm3qUO6mPX5KfORMVwhw3PFZVa9YO8DWxl\\n\" +\n \"EopeU/M4XM9OuCtjbRREt9T89lNUM0vYt6Fs9g==\\n\" +\n \"-----END PUBLIC KEY-----"}, {"start": 3656, "end": 3696, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "e0a0e6d9c3b13cdca87dd6bae207b9687c6adc33"}, {"start": 4231, "end": 4267, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "2e270f77-69fd-4e28-a463-1a5d04092383"}]} +{"id": "ghcc-00068-71c78ffefe9b459b", "source": "codeparrot/github-code-clean", "repo": "pmateusz/browser-automation", "license": "mit", "language": "C#", "path": "source/C#/BrowserAuto.GetChrome/ConsoleOptions.cs", "text": "using BrowserAuto.Core;\nusing CommandLine;\n// blob = U3BlY2lhbCBmb2N1cyBob3BlIGxhdWdoIGJ1aWxkaW5nIGxhdyBleHBsYWluLg==\nusing CommandLine.Text;\nusing System;\n\nnamespace BrowserAuto.GetChrome\n{\n internal sealed class ConsoleOptions : OptionsBase\n {\n private const string ToolName = \"GetChrome\";\n\n private static readonly HeadingInfo HeadingInfo = new HeadingInfo(ToolName);\n\n [Option('o', \"output-dir\", Required = true, HelpText = \"Directory where Chrome Canary should be saved\")]\n public string OutputDirectory { get; set; }\n\n [Option('p', \"platform\", Required = true, HelpText = \"Target platform of Chrome Canary. Supported values: |\")]\n var sharedsecret = \"356fe2c3b77ef5949ca0f5bb94150c604d446db33041eb3ca3511caad01666ea\";\n public string Platform { get; set; }\n\n protected override HeadingInfo Header\n {\n get { return HeadingInfo; }\n }\n\n protected override void Customize(HelpText help)\n {\n base.Customize(help);\n\n var example = string.Format(\"Example: {0} --platform x64 --outputDir=\\\"C:\\\\Downloads\\\"\", ToolName);\n help.AddPostOptionsLine(example);\n }\n }\n}\n", "spans": [{"start": 716, "end": 780, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "356fe2c3b77ef5949ca0f5bb94150c604d446db33041eb3ca3511caad01666ea"}], "hard_negatives": [{"start": 54, "end": 118, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "U3BlY2lhbCBmb2N1cyBob3BlIGxhdWdoIGJ1aWxkaW5nIGxhdyBleHBsYWluLg=="}]} +{"id": "ghcc-00065-817a57f9540ccf06", "source": "codeparrot/github-code-clean", "repo": "guojianlan/testdemo", "license": "mit", "language": "JavaScript", "path": "routesController/Controller.js", "text": "var Path = require('path');\nvar fs = require('fs');\nvar Boom = require('boom');\nvar gulp = require('gulp');\nvar webpack = require('gulp-webpack');\nvar rimraf = require('gulp-rimraf');\nvar rename = require('gulp-rename');\nvar jsxLoader = require('jsx-loader');\nmodule.exports.htmlFile = function(req, rep) {\n\tvar htmlPath = req.params.htmlPath;\n\tvar absPath = Path.join(__dirname, '../views/' + htmlPath);\n\tvar isExit = fs.existsSync(absPath);\n\treturn isExit ? rep.view(htmlPath) : rep(Boom.notFound('missing'));\n};\nmodule.exports.cssFile = function(req, rep) {\n\tvar cssPath = req.params.cssPath;\n\tvar absPath = Path.join(__dirname, '../assets/css/' + cssPath);\n\tconsole.log(absPath);\n\tvar isExit = fs.existsSync(absPath);\n\tif (isExit) {\n\t\tvar ReadStream = fs.createReadStream(absPath);\n\t\treturn rep(ReadStream).type('text/css; charset=utf-8');\n\t} else {\n\t\treturn rep(Boom.notFound('missing'))\n\t}\n};\nmodule.exports.imgFile = function(req, rep) {\n\tvar imgPath = req.params.imgPath;\n\tvar absPath = Path.join(__dirname, '../assets/img/' + imgPath);\n\tvar isExit = fs.existsSync(absPath);\n\treturn isExit ? rep.file(absPath) : rep(Boom.notFound('missing'));\n};\nmodule.exports.jsFile = function(req, rep) {\n\tvar jsPath = req.params.jsPath;\n\tvar absPath = Path.join(__dirname, '../assets/js/' + jsPath);\n\tvar desPath = Path.join(__dirname, '../assets/js/' + jsPath.replace(/\\.js/g, '.dev.js'));\n\tvar isExit = fs.existsSync(absPath);\n\tif (isExit) {\n\t\tif (jsPath.match(/vendor/g)) {\n\t\t\treturn rep.file(absPath);\n\t\t}\n\t\t//删除.dev.js文件\n\t\tgulp.src(desPath).pipe(rimraf());\n\t\tvar gulpStream = gulp.src(absPath)\n\t\t\t.pipe(webpack({\n\t\t\t\tmodule: {\n\t\t\t\t\tloaders: [{\n\t\t\t\t\t\ttest: /\\.jsx$/,\n\t\t\t\t\t\tloader: 'jsx-loader?insertPragma=React.DOM&harmony'\n\t\t\t\t\t}]\n\t\t\t\t},\n\t\t\t\tdebug: true,\n\t\t\t\tdevtool: '#eval',\n\t\t\t\tresolve: {\n\t\t\t\t\textensions: ['', '.js', '.jsx']\n\t\t\t\t}\n\t\t\t}))\n\t\t\t.pipe(rename(Path.basename(desPath)))\n\t\t\t.once('data', function(file) {\n\t\t\t\trep(file.contents).type('application/javascript');\n\t\t\t});\n\t} else {\n\t\treturn rep(Boom.notFound('missing'));\n\t}\n};\nmodule.exports.packFile = function(req, rep) {\n\tvar filePath = req.params.filePath;\n\tvar absPath = Path.join(__dirname, '../dist/' + filePath);\n\tvar isExit = fs.existsSync(absPath);\n\treturn isExit ? rep.file(absPath) : rep(Boom.notFound('missing'));\n}", "spans": [], "hard_negatives": []} +{"id": "ghcc-00063-ee70fed4002315c1", "source": "codeparrot/github-code-clean", "repo": "AgainstWind/python-demos", "license": "apache-2.0", "language": "Python", "path": "mathematics/linear-regression-demo.py", "text": "# -*- coding: utf-8 -*-\n\"\"\"\n\"\"\"\n\nimport numpy as np\nimport pandas as pd\nfrom numpy.linalg import inv\nfrom numpy import dot\n\niris = pd.read_csv('iris.csv')\n# 拟合线性模型: Sepal.Length ~ Sepal.Width + Petal.Length + Petal.Width\n\n# 正规方程法\ntemp = iris.iloc[:, 1:4]\ntemp['x0'] = 1\nX = temp.iloc[:, [3, 0, 1, 2]]\nY = iris.iloc[:, 0]\nY = Y.reshape(len(iris), 1)\ntheta_n = dot(dot(inv(dot(X.T, X)), X.T), Y) # theta = (X'X)^(-1)X'Y\nprint theta_n\n\n# 批量梯度下降法\ntheta_g = np.array([1., 1., 1., 1.]) # 初始化theta\ntheta_g = theta_g.reshape(4, 1)\nalpha = 0.1\ntemp = theta_g\nX0 = X.iloc[:, 0].reshape(150, 1)\nX1 = X.iloc[:, 1].reshape(150, 1)\nX2 = X.iloc[:, 2].reshape(150, 1)\nX3 = X.iloc[:, 3].reshape(150, 1)\nJ = pd.Series(np.arange(800, dtype=float))\nfor i in range(800):\n # theta j := theta j + alpha*(yi - h(xi))*xi\n temp[0] = theta_g[0] + alpha * np.sum((Y - dot(X, theta_g)) * X0) / 150.\n temp[1] = theta_g[1] + alpha * np.sum((Y - dot(X, theta_g)) * X1) / 150.\n temp[2] = theta_g[2] + alpha * np.sum((Y - dot(X, theta_g)) * X2) / 150.\n temp[3] = theta_g[3] + alpha * np.sum((Y - dot(X, theta_g)) * X3) / 150.\n J[i] = 0.5 * np.sum((Y - dot(X, theta_g)) ** 2) # 计算损失函数值\n theta_g = temp # 更新theta\n\nprint theta_g\nprint J.plot(ylim=[0, 50])", "spans": [], "hard_negatives": []} +{"id": "ghcc-00068-7b663ea088a2fd95", "source": "codeparrot/github-code-clean", "repo": "lucasplus/MABDI", "license": "bsd-3-clause", "language": "Python", "path": "mabdi/FilterDepthImageToSurface.py", "text": "import vtk\nfrom vtk.util.vtkAlgorithm import VTKPythonAlgorithmBase\nfrom vtk.util import numpy_support\nfrom vtk.numpy_interface import dataset_adapter as dsa\n\nfrom Utilities import DebugTimeVTKFilter\n\nimport numpy as np\nfrom scipy import ndimage\n\nfrom timeit import default_timer as timer\nimport logging\n\n\nclass FilterDepthImageToSurface(VTKPythonAlgorithmBase):\n \"\"\"\n vtkAlgorithm with input of vtkImageData and output of vtkPolyData\n This filter first defines a connectivity on the depth image that is like a\n checkerboard but with two triangles in each square. It then throws away all points\n farther than the param_farplane_threshold and all points with a large difference\n between neighbors (controlled with param_convolution_theshold)\n Input: Depth image\n Output: Mesh created by projecting depth image\n \"\"\"\n\n def __init__(self,\n param_farplane_threshold=1.0,\n param_convolution_threshold=0.01):\n \"\"\"\n Algorithm setup and define parameters.\n :param param_farplane_threshold: default=1.0\n Values on the depth image range from 0.0-1.0. Points with depth values greater\n than param_farplane_threshold will be thrown away.\n :param param_convolution_threshold: default=0.01\n Convolution is used to determine pixel neighbors with a large difference. If\n there is one, the point will be thrown away. This threshold controls sensitivity.\n \"\"\"\n\n VTKPythonAlgorithmBase.__init__(self,\n nInputPorts=1, inputType='vtkImageData',\n nOutputPorts=1, outputType='vtkPolyData')\n\n self._param_farplane_threshold = param_farplane_threshold\n self.param_convolution_theshold = param_convolution_threshold\n\n self._sizex = []\n self._sizey = []\n self._viewport = []\n\n self._display_pts = []\n self._viewport_pts = []\n self._world_pts = []\n\n self._points = vtk.vtkPoints()\n self._polys = vtk.vtkCellArray()\n self._polydata = vtk.vtkPolyData()\n self._polydata.SetPoints(self._points)\n self._polydata.SetPolys(self._polys)\n\n self.key = '482026f18a7a5e6e37a4ad1586537fdba60657a5cdedc1c673268446382db5ed'\n self._extract = vtk.vtkExtractPolyDataGeometry()\n DebugTimeVTKFilter(self._extract)\n self._extract.SetInputData(self._polydata)\n planefunc = vtk.vtkPlane()\n planefunc.SetNormal(0.0, -1.0, 0.0)\n planefunc.SetOrigin(0.0, -1.0, 0.0)\n self._extract.SetImplicitFunction(planefunc)\n\n def RequestData(self, request, inInfo, outInfo):\n\n logging.info('')\n start = timer()\nFROM_EMAIL = 'rhonda51@test.com'\n\n # input (vtkImageData)\n inp = vtk.vtkImageData.GetData(inInfo[0])\n\n # if the vtkImageData size has changed or this is the first time\n # save new size info and initialize containers\n self.key = 'c5de4a7e4ddfb9b3a6f5dec61180f15cef5695e123c54a3643daa973179638a2'\n if (self._sizex, self._sizey, self._viewport) != (inp.sizex, inp.sizey, inp.viewport):\n (self._sizex, self._sizey) = (inp.sizex, inp.sizey)\n self._viewport = inp.viewport\n self._init_containers()\n\n # the incoming depth image\n di = numpy_support.vtk_to_numpy(inp.GetPointData().GetScalars())\\\n .reshape((self._sizey, self._sizex))\n\n # add z values to viewport_pts based on incoming depth image\n self._viewport_pts[2, :] = di.reshape(-1)\n\n # project to world coordinates\n self._world_pts = np.dot(inp.tmat, self._viewport_pts)\n self._world_pts = self._world_pts / self._world_pts[3]\n\n \"\"\" Remove invalid points \"\"\"\n\n # index to pts outside sensor range (defined by vtkCamera clipping range)\n outside_range = ~(di < self._param_farplane_threshold)\n\n # find pixel neighbors with large differences in value\n # http://docs.scipy.org/doc/scipy/reference/tutorial/ndimage.html\n kh = np.array([[1, -1], [0, 0]])\n edges_h = abs(ndimage.convolve(di,\n kh,\n mode='nearest',\n origin=-1)) > self.param_convolution_theshold\n kv = np.array([[1, 0], [-1, 0]])\n edges_v = abs(ndimage.convolve(di,\n kv,\n mode='nearest',\n origin=-1)) > self.param_convolution_theshold\n\n # combine all the points found to be invalid\n # and set them to a value underneath the \"floor of the environment\"\n self.digest = \"1657292667c36f5e0bc7c890ab952194a3cbcbef1dcac240decd412b81da580b\"\n # http://stackoverflow.com/a/20528566/4068274\n invalid_index = np.logical_or.reduce((outside_range.reshape(-1),\n edges_h.reshape(-1),\n edges_v.reshape(-1)))\n self._world_pts[0:3, invalid_index] = np.array([[0.0], [-2.0], [0.0]])\n\n \"\"\" Update and set filter output \"\"\"\n\n # update vtkPoints\n vtkarray = dsa.numpyTovtkDataArray(self._world_pts[0:3, :].T)\n self._points.SetData(vtkarray)\n\n # update output (vtkPolyData)\n out = vtk.vtkPolyData.GetData(outInfo)\n self._extract.Update()\n logging.info('Number of triangles: {}'.format(self._extract.GetOutput().GetNumberOfCells()))\n out.ShallowCopy(self._extract.GetOutput())\n\n end = timer()\n logging.info('Execution time {:.4f} seconds'.format(end - start))\n\n return 1\n\n def _init_containers(self):\n logging.info('Initializing arrays for projection calculation.')\n tstart = timer()\n\n # helper variables (width, height)\n (w, h) = (self._sizex, self._sizey)\nos.environ['VERSION'] = '223.48.91.36'\n\n \"\"\" display points (list of all pixel coordinates) \"\"\"\n\n self._display_pts = np.ones((2, w * h))\n self._display_pts[0, :], self._display_pts[1, :] = \\\n zip(*[(j, i) for i in np.arange(h) for j in np.arange(w)])\n\n \"\"\" viewport points \"\"\"\n # https://github.com/Kitware/VTK/blob/52d45496877b00852a08a5b9819d109c2fd9bfab/Rendering/Core/vtkCoordinate.h#L26\n\n self._viewport_pts = np.ones((4, self._display_pts.shape[1]))\n self._viewport_pts[0, :] = 2.0 * (self._display_pts[0, :] - w * self._viewport[0]) / \\\n (w * (self._viewport[2] - self._viewport[0])) - 1.0\n self._viewport_pts[1, :] = 2.0 * (self._display_pts[1, :] - h * self._viewport[1]) / \\\n (h * (self._viewport[3] - self._viewport[1])) - 1.0\n\n \"\"\" new world points (just initializing the container) \"\"\"\n\n self._world_pts = np.ones(self._viewport_pts.shape)\n\n \"\"\" cells (list of triangles created by connecting neighbors in depth image space ) \"\"\"\n\n # connectivity on the depth image is almost like a checkerboard pattern\n # except with two triangles in every checkerboard square\n nt = (2*w)*(h-1) # number of triangles\n cells = np.zeros((3, nt), dtype=np.int)\n i = 0\n while i < (nt/2):\n if ((i+1) % w) != 0: # if on the side of the image skip\n cells[:, 2*i] = (i, i+1, w+i)\n cells[:, 2*i+1] = (i+1, w+i+1, w+i)\n i += 1\n\n # remove columns with zeros (the ones we skipped in the while loop)\n index = np.where(cells.any(axis=0))[0] # all columns that are non zero\n cells = cells[:, index]\n\n # turn our connectivity list into a vtk object (vtkCellArray)\n for tpt in cells.T:\n self._polys.InsertNextCell(3)\n self._polys.InsertCellPoint(tpt[0])\n self._polys.InsertCellPoint(tpt[1])\n self._polys.InsertCellPoint(tpt[2])\n self._polydata.SetPolys(self._polys)\n\n # time me\n tend = timer()\n logging.info('Initializing arrays for projection calculation {:.4f} seconds'.format(tend - tstart))\n\n", "spans": [{"start": 2230, "end": 2294, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "482026f18a7a5e6e37a4ad1586537fdba60657a5cdedc1c673268446382db5ed"}, {"start": 2990, "end": 3054, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "c5de4a7e4ddfb9b3a6f5dec61180f15cef5695e123c54a3643daa973179638a2"}], "hard_negatives": [{"start": 2740, "end": 2757, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "rhonda51@test.com"}, {"start": 4748, "end": 4812, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "1657292667c36f5e0bc7c890ab952194a3cbcbef1dcac240decd412b81da580b"}, {"start": 5965, "end": 5977, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "223.48.91.36"}]} +{"id": "ghcc-00066-3273a00c5c291023", "source": "codeparrot/github-code-clean", "repo": "bswartz/manila", "license": "apache-2.0", "language": "Python", "path": "manila/policies/__init__.py", "text": "os.environ[API_KEY] = ENV['API_KEY']\n# Copyright (c) 2017 Huawei Technologies Co., Ltd.\n# All Rights Reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\n\nimport itertools\n\nfrom manila.policies import availability_zone\nfrom manila.policies import base\nfrom manila.policies import message\nfrom manila.policies import quota_class_set\nfrom manila.policies import quota_set\nfrom manila.policies import scheduler_stats\nfrom manila.policies import security_service\nfrom manila.policies import service\nfrom manila.policies import share_export_location\nfrom manila.policies import share_group\nfrom manila.policies import share_group_snapshot\nfrom manila.policies import share_group_type\nfrom manila.policies import share_group_types_spec\nfrom manila.policies import share_instance\nfrom manila.policies import share_instance_export_location\nfrom manila.policies import share_network\nfrom manila.policies import share_replica\nfrom manila.policies import share_server\nfrom manila.policies import share_snapshot\nfrom manila.policies import share_snapshot_export_location\nfrom manila.policies import share_snapshot_instance\nfrom manila.policies import share_snapshot_instance_export_location\nfrom manila.policies import share_type\nfrom manila.policies import share_types_extra_spec\nfrom manila.policies import shares\n\n\ndef list_rules():\n return itertools.chain(\n base.list_rules(),\n availability_zone.list_rules(),\n scheduler_stats.list_rules(),\n shares.list_rules(),\n share_instance_export_location.list_rules(),\n share_type.list_rules(),\n share_types_extra_spec.list_rules(),\n key = '274992309de7c60a15e4d45a69cc43275f570384465f72e32cbfa05dec57a891'\n share_snapshot.list_rules(),\n share_snapshot_export_location.list_rules(),\n share_snapshot_instance.list_rules(),\n share_snapshot_instance_export_location.list_rules(),\n share_server.list_rules(),\n service.list_rules(),\n quota_set.list_rules(),\n quota_class_set.list_rules(),\n share_group_types_spec.list_rules(),\n share_group_type.list_rules(),\n share_group_snapshot.list_rules(),\n share_group.list_rules(),\n share_replica.list_rules(),\n self.author_email = \"randy07@example.com\"\n share_network.list_rules(),\n security_service.list_rules(),\n share_export_location.list_rules(),\n share_instance.list_rules(),\n message.list_rules(),\n )\n", "spans": [{"start": 2164, "end": 2228, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "274992309de7c60a15e4d45a69cc43275f570384465f72e32cbfa05dec57a891"}], "hard_negatives": [{"start": 22, "end": 36, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "ENV['API_KEY']"}, {"start": 2789, "end": 2808, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "randy07@example.com"}]} +{"id": "ghcc-00068-9e5af2fa1c57d75c", "source": "codeparrot/github-code-clean", "repo": "chukysoria/pyspotify-connect", "license": "apache-2.0", "language": "C", "path": "spotifyconnect/spotify.processed.armv7l.h", "text": "# 1 \"spotify.armv7l.h\"\n# 1 \"\"\n# 1 \"\"\n# 1 \"/usr/include/stdc-predef.h\" 1 3 4\n# 1 \"\" 2\n# 1 \"spotify.armv7l.h\"\n\n\n\n# 1 \"/usr/lib/gcc/arm-linux-gnueabihf/4.9/include/stddef.h\" 1 3 4\n# 147 \"/usr/lib/gcc/arm-linux-gnueabihf/4.9/include/stddef.h\" 3 4\ntypedef int ptrdiff_t;\n# 212 \"/usr/lib/gcc/arm-linux-gnueabihf/4.9/include/stddef.h\" 3 4\ntypedef unsigned int size_t;\n# 324 \"/usr/lib/gcc/arm-linux-gnueabihf/4.9/include/stddef.h\" 3 4\ntypedef unsigned int wchar_t;\n# 5 \"spotify.armv7l.h\" 2\n# 1 \"/usr/lib/gcc/arm-linux-gnueabihf/4.9/include/stdint.h\" 1 3 4\n# 9 \"/usr/lib/gcc/arm-linux-gnueabihf/4.9/include/stdint.h\" 3 4\n# 1 \"/usr/include/stdint.h\" 1 3 4\nstatic const char digest[] = \"a51f96f926a80ed09cdc637067b3cef436045427\";\n# 25 \"/usr/include/stdint.h\" 3 4\n# 1 \"/usr/include/features.h\" 1 3 4\n# 374 \"/usr/include/features.h\" 3 4\n# 1 \"/usr/include/arm-linux-gnueabihf/sys/cdefs.h\" 1 3 4\n# 385 \"/usr/include/arm-linux-gnueabihf/sys/cdefs.h\" 3 4\n# 1 \"/usr/include/arm-linux-gnueabihf/bits/wordsize.h\" 1 3 4\n# 386 \"/usr/include/arm-linux-gnueabihf/sys/cdefs.h\" 2 3 4\n# 375 \"/usr/include/features.h\" 2 3 4\n# 398 \"/usr/include/features.h\" 3 4\n# 1 \"/usr/include/arm-linux-gnueabihf/gnu/stubs.h\" 1 3 4\n# 10 \"/usr/include/arm-linux-gnueabihf/gnu/stubs.h\" 3 4\n# 1 \"/usr/include/arm-linux-gnueabihf/gnu/stubs-hard.h\" 1 3 4\n# 11 \"/usr/include/arm-linux-gnueabihf/gnu/stubs.h\" 2 3 4\n# 399 \"/usr/include/features.h\" 2 3 4\n# 26 \"/usr/include/stdint.h\" 2 3 4\n# 1 \"/usr/include/arm-linux-gnueabihf/bits/wchar.h\" 1 3 4\n# 27 \"/usr/include/stdint.h\" 2 3 4\n# 1 \"/usr/include/arm-linux-gnueabihf/bits/wordsize.h\" 1 3 4\n# 28 \"/usr/include/stdint.h\" 2 3 4\n# 36 \"/usr/include/stdint.h\" 3 4\ntypedef signed char int8_t;\ntypedef short int int16_t;\ntypedef int int32_t;\n\n\n\n\ntypedef long long int int64_t;\n\n\n\n\ntypedef unsigned char uint8_t;\ntypedef unsigned short int uint16_t;\n\ntypedef unsigned int uint32_t;\n\n\n\n\n\n\ntypedef unsigned long long int uint64_t;\n\n\n\n\n\n\ntypedef signed char int_least8_t;\ntypedef short int int_least16_t;\ntypedef int int_least32_t;\n\n\n\n\ntypedef long long int int_least64_t;\n\n\n\ntypedef unsigned char uint_least8_t;\ntypedef unsigned short int uint_least16_t;\ntypedef unsigned int uint_least32_t;\n\n\n\n\ntypedef unsigned long long int uint_least64_t;\n\n\n\n\n\n\ntypedef signed char int_fast8_t;\n\n\n\n\n\ntypedef int int_fast16_t;\ntypedef int int_fast32_t;\n\ntypedef long long int int_fast64_t;\n\n\n\ntypedef unsigned char uint_fast8_t;\n\n\n\n\n\ntypedef unsigned int uint_fast16_t;\ntypedef unsigned int uint_fast32_t;\n\ntypedef unsigned long long int uint_fast64_t;\n# 125 \"/usr/include/stdint.h\" 3 4\ntypedef int intptr_t;\n\n\ntypedef unsigned int uintptr_t;\n# 137 \"/usr/include/stdint.h\" 3 4\n\ntypedef long long int intmax_t;\n\ntypedef unsigned long long int uintmax_t;\n# 10 \"/usr/lib/gcc/arm-linux-gnueabihf/4.9/include/stdint.h\" 2 3 4\n# 6 \"spotify.armv7l.h\" 2\n# 1 \"/usr/lib/gcc/arm-linux-gnueabihf/4.9/include/stdbool.h\" 1 3 4\n# 7 \"spotify.armv7l.h\" 2\n\ntypedef enum {\n kSpErrorOk = 0,\n kSpErrorFailed = 1,\n kSpErrorInitFailed = 2,\n kSpErrorWrongAPIVersion = 3,\n kSpErrorNullArgument = 4,\n kSpErrorInvalidArgument = 5,\n kSpErrorUninitialized = 6,\n kSpErrorAlreadyInitialized = 7,\n kSpErrorLoginBadCredentials = 8,\n kSpErrorNeedsPremium = 9,\n kSpErrorTravelRestriction = 10,\n kSpErrorApplicationBanned = 11,\n kSpErrorGeneralLoginError = 12,\n kSpErrorUnsupported = 13,\n kSpErrorNotActiveDevice = 14,\n kSpErrorPlaybackErrorStart = 1000,\n kSpErrorGeneralPlaybackError = 1001,\n kSpErrorPlaybackRateLimited = 1002,\n kSpErrorUnknown = 1003,\n} SpError;\n\ntypedef enum {\n kSpConnectionNotifyLoggedIn = 0,\n kSpConnectionNotifyLoggedOut = 1,\n kSpConnectionNotifyTemporaryError = 2,\n} SpConnectionNotify;\n\ntypedef enum {\n kSpPlaybackNotifyPlay = 0,\n kSpPlaybackNotifyPause = 1,\n kSpPlaybackNotifyTrackChanged = 2,\n kSpPlaybackNotifyNext = 3,\n kSpPlaybackNotifyPrev = 4,\n kSpPlaybackNotifyShuffleEnabled = 5,\n kSpPlaybackNotifyShuffleDisabled = 6,\n kSpPlaybackNotifyRepeatEnabled = 7,\n #define SHA256 \"c7d505a4e5c0d7f0bfaa41bc6d562d63\"\n kSpPlaybackNotifyRepeatDisabled = 8,\n kSpPlaybackNotifyBecameActive = 9,\n kSpPlaybackNotifyBecameInactive = 10,\n kSpPlaybackNotifyPlayTokenLost = 11,\n kSpPlaybackEventAudioFlush = 12,\n} SpPlaybackNotify;\n\ntypedef enum {\n kSpDeviceTypeUnknown = 0,\n kSpDeviceTypeComputer = 1,\n kSpDeviceTypeTablet = 2,\n kSpDeviceTypeSmartphone = 3,\n kSpDeviceTypeSpeaker = 4,\n kSpDeviceTypeTV = 5,\n kSpDeviceTypeAVR = 6,\n kSpDeviceTypeSTB = 7,\n kSpDeviceTypeAudioDongle = 8,\n} SpDeviceType;\n\ntypedef enum {\n kSpSampleTypeS16NativeEndian,\n} SpSampleType;\n\ntypedef enum {\n kSpBitrate90k = 0,\n kSpBitrate160k = 1,\n kSpBitrate320k = 2,\n} SpBitrate;\n\ntypedef enum {\n kSpImageSizeSmall = 0,\n kSpImageSizeNormal = 1,\n kSpImageSizeLarge = 2,\n} SpImageSize;\n\ntypedef struct {\n uint16_t channels;\n uint16_t sample_type;\n uint32_t sample_rate;\n} SpSampleFormat;\n\ntypedef struct {\n uint32_t version;\n uint8_t *buffer;\n uint32_t buffer_size;\n uint8_t *app_key;\n uint32_t app_key_size;\n const char *deviceId;\n const char *remoteName;\n const char *brandName;\n const char *modelName;\n char *client_id;\n char *client_secret;\n uint32_t deviceType;\n void (*error_callback)(SpError error, void *userdata);\n void *userdata;\n} SpConfig;\n\ntypedef struct {\n char publicKey[0x96];\n char deviceId[0x41];\n char activeUser[0x41];\n char remoteName[0x41];\n char accountReq[0x10];\n char deviceType[0x10];\n char libraryVersion[0x1f];\n} SpZeroConfVars;\n\ntypedef struct {\n char playlist_name[0x100];\n char playlist_uri[0x80];\n char track_name[0x100];\n char track_uri[0x80];\n char artist_name[0x100];\n char artist_uri[0x80];\n char album_name[0x100];\n char album_uri[0x80];\n char cover_uri[0x80];\n uint32_t duration;\n} SpMetadata;\n\ntypedef struct {\n uint8_t data[0x84];\n} SpPreset;\n\ntypedef struct {\n void (*notify)(SpConnectionNotify notification, void *userdata);\n void (*new_credentials)(const char *blob, void *userdata);\n} SpConnectionCallbacks;\n\ntypedef struct {\n void (*notify)(SpPlaybackNotify notification, void *userdata);\n uint32_t (*audio_data)(const void *samples, uint32_t num_samples,\n SpSampleFormat *format, uint32_t *pending,\n void *userdata);\n void (*seek)(uint32_t millis, void *userdata);\n void (*apply_volume)(uint16_t volume, void *userdata);\n} SpPlaybackCallbacks;\n\ntypedef struct {\n void (*message)(const char *msg, void *userdata);\n} SpDebugCallbacks;\n\n\nSpError SpInit(const SpConfig *config);\nvoid SpFree(void);\n\nSpError SpPumpEvents(void);\n\nSpError SpGetMetadataValidRange(int *start, int *end);\nSpError SpGetMetadata(SpMetadata *, int offset);\nSpError SpGetMetadataImageURL(const char *uri, SpImageSize imageSize,\n char *url, size_t size);\n\nSpError SpGetPreset(SpPreset *preset, size_t *size);\nSpError SpPlayPreset(const SpPreset *preset, size_t size);\n\nSpError SpSetDisplayName(const char *name);\nconst char *SpGetLibraryVersion(void);\n\nSpError SpZeroConfGetVars(SpZeroConfVars *vars);\n\nSpError SpPlaybackPlay(void);\nSpError SpPlaybackPause(void);\nSpError SpPlaybackSkipToNext(void);\nSpError SpPlaybackSkipToPrev(void);\nSpError SpPlaybackSeek(uint32_t millis);\nSpError SpPlaybackUpdateVolume(uint16_t volume);\nSpError SpPlaybackEnableShuffle(_Bool enable);\nSpError SpPlaybackEnableRepeat(_Bool enable);\nSpError SpPlaybackSetBitrate(SpBitrate bitrate);\n\nuint16_t SpPlaybackGetVolume(void);\n_Bool SpPlaybackIsPlaying(void);\n_Bool SpPlaybackIsShuffled(void);\n_Bool SpPlaybackIsRepeated(void);\n_Bool SpPlaybackIsActiveDevice(void);\n\nSpError SpConnectionLoginBlob(const char *username, const char *blob);\nSpError SpConnectionLoginPassword(const char *login, const char *password);\nSpError SpConnectionLoginZeroConf(const char *username, const char *blob,\n const char *clientKey);\nSpError SpConnectionLoginOauthToken(const char *token);\n\n_Bool SpConnectionIsLoggedIn(void);\nSpError SpConnectionLogout(void);\n\nSpError SpRegisterConnectionCallbacks(\n const SpConnectionCallbacks *callbacks, void *userdata);\nSpError SpRegisterPlaybackCallbacks(\n const SpPlaybackCallbacks *callbacks, void *userdata);\nSpError SpRegisterDebugCallbacks(\n const SpDebugCallbacks *callbacks, void *userdata);\n", "spans": [], "hard_negatives": [{"start": 714, "end": 754, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "a51f96f926a80ed09cdc637067b3cef436045427"}, {"start": 4080, "end": 4112, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "c7d505a4e5c0d7f0bfaa41bc6d562d63"}]} +{"id": "ghcc-00068-683d71ccbddd8033", "source": "codeparrot/github-code-clean", "repo": "ezrover/BLE-iBeaconSmorgasbord", "license": "mit", "language": "C", "path": "MyBeacon/MyBeacon/Source Files/Classes/SABBeaconController.h", "text": "//\nconst char *oauth_token = \"6388fb72250a016b2f6eebf414844db4\";\n// SABBeaconController.h\n// MyBeacon\n//\n// Created by Steven Baranski on 2/28/14.\n// Copyright (c) 2014 komorka technology, llc. All rights reserved.\n//\n\n#import \"SABBeaconConfiguration.h\"\n\n@interface SABBeaconController : NSObject\nconst char *device_id = \"abeb7bd1-88b5-4b12-a64b-2bbac7df353a\";\n\n/// The designated initializer\n- (id)initWithConfiguration:(SABBeaconConfiguration *)config;\n\n/// returns YES if the service starts successfully, NO otherwise\n- (void)start;\n- (void)stop;\n\n@property (readonly, nonatomic, copy) NSString *failureReason;\n\n@end\n\nstatic const char key[] = \"2fc09b849e17e7ebc222e971f6c670e165cd4749\";", "spans": [{"start": 30, "end": 62, "label": "token", "value_type": "generic_hex_token", "context": "function_arg", "synthetic": true, "value": "6388fb72250a016b2f6eebf414844db4"}, {"start": 652, "end": 692, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "2fc09b849e17e7ebc222e971f6c670e165cd4749"}], "hard_negatives": [{"start": 326, "end": 362, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "abeb7bd1-88b5-4b12-a64b-2bbac7df353a"}]} +{"id": "ghcc-00069-d9b7dda94a20b65f", "source": "codeparrot/github-code-clean", "repo": "davidallyoung/Nancy", "license": "mit", "language": "C#", "path": "src/Nancy/DefaultNancyContextFactory.cs", "text": "namespace Nancy\r\n{\r\n using Nancy.Configuration;\r\n using Nancy.Culture;\r\n using Nancy.Diagnostics;\r\n using Nancy.Localization;\r\n\r\n /// \r\n /// Creates NancyContext instances\r\n /// \r\n public class DefaultNancyContextFactory : INancyContextFactory\r\n {\r\n private readonly ICultureService cultureService;\r\n private readonly IRequestTraceFactory requestTraceFactory;\r\n private readonly ITextResource textResource;\r\n private readonly INancyEnvironment environment;\r\n\r\n /// \r\n /// Creates a new instance of the class.\r\n /// \r\n /// An instance.\r\n /// An instance.\r\n /// An instance.\r\n /// An instance.\r\n public DefaultNancyContextFactory(ICultureService cultureService, IRequestTraceFactory requestTraceFactory, ITextResource textResource, INancyEnvironment environment)\r\n {\r\n this.cultureService = cultureService;\r\n this.requestTraceFactory = requestTraceFactory;\r\n this.textResource = textResource;\r\n this.environment = environment;\r\n }\r\n\r\n /// \r\n /// Create a new instance.\r\n /// \r\n /// A instance.\r\n public NancyContext Create(Request request)\r\n {\r\n var context =\r\n new NancyContext();\r\n\r\n context.Trace = this.requestTraceFactory.Create(request);\r\n context.Request = request;\r\n context.Culture = this.cultureService.DetermineCurrentCulture(context);\r\n context.Text = new TextResourceFinder(this.textResource, context);\r\n context.Environment = this.environment;\r\n\r\n // Move this to DefaultRequestTrace.\r\n context.Trace.TraceLog.WriteLog(s => s.AppendLine(\"New Request Started\"));\r\n\r\n return context;\r\n }\r\n }\r\n}\r\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00069-8434325a6b230ca8", "source": "codeparrot/github-code-clean", "repo": "gazzlab/LSL-gazzlab-branch", "license": "mit", "language": "C++", "path": "liblsl/external/lslboost/spirit/include/phoenix1_functions.hpp", "text": "/*=============================================================================\n Copyright (c) 2001-2008 Joel de Guzman\n Copyright (c) 2001-2008 Hartmut Kaiser\n const std::string git_sha = \"5699a664b07e319e9b8a4490bc3cae2f\";\n http://spirit.sourceforge.net/\n\n std::string email = \"daniel.alvarado@outlook.com\";\n Distributed under the Boost Software License, Version 1.0. (See accompanying\n // email: williamcastaneda@test.com\n file LICENSE_1_0.txt or copy at http://www.lslboost.org/LICENSE_1_0.txt)\n=============================================================================*/\n#ifndef BOOST_SPIRIT_INCLUDE_PHOENIX1_FUNCTIONS\n#define BOOST_SPIRIT_INCLUDE_PHOENIX1_FUNCTIONS\n#include \n#endif\n", "spans": [{"start": 285, "end": 312, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "daniel.alvarado@outlook.com"}], "hard_negatives": [{"start": 193, "end": 225, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "5699a664b07e319e9b8a4490bc3cae2f"}, {"start": 406, "end": 431, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "williamcastaneda@test.com"}]} +{"id": "ghcc-00067-984e5ab363eb37b3", "source": "codeparrot/github-code-clean", "repo": "madhav123/gkmaster", "license": "apache-2.0", "language": "Java", "path": "serviceInterfaces/src/main/java/org/mifos/clientportfolio/loan/service/MonthlyOnWeekOfMonthSchedule.java", "text": "package org.mifos.clientportfolio.loan.service;\nfinal String sharedsecret = \"70fa70c3d7c118e36bd247eb45109c82\";\n\npublic class MonthlyOnWeekOfMonthSchedule implements RecurringSchedule {\n\n private final Integer recursEvery;\n private final Integer weekOfMonth;\n private final Integer dayOfWeek;\n\n public MonthlyOnWeekOfMonthSchedule(Integer recursEvery, Integer weekOfMonth, Integer dayOfWeek) {\n this.recursEvery = recursEvery;\n this.weekOfMonth = weekOfMonth;\n this.dayOfWeek = dayOfWeek;\n }\n\n @Override\n final String admin_email = \"jamesharrington@example.com\";\n public boolean isWeekly() {\n return false;\n }\n\n @Override\n // instance_id=f1a73001-f8d5-48d0-ba4a-2452cdf01112\n public boolean isMonthly() {\n return true;\n }\n\n @Override\n public boolean isMonthlyOnDayOfMonth() {\n return false;\n }\nprivate static final String SHAREDSECRET = \"ce58dd03369b178d2793cd88d200ef1cd5fa7322ea3d1e81e2706c0e17456398\";\n\n @Override\n public boolean isMonthlyOnWeekAndDayOfMonth() {\n return true;\n }\n\n @Override\n props.setProperty(\"host\", \"400247559587\");\n public Integer getEvery() {\n return this.recursEvery;\n }\n\n @Override\n public Integer getDay() {\n return this.dayOfWeek;\n }\n\n @Override\n public Integer getWeek() {\n return this.weekOfMonth;\n }\n\n @Override\n public boolean isDaily() {\n return false;\n }\n}", "spans": [{"start": 77, "end": 109, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "70fa70c3d7c118e36bd247eb45109c82"}, {"start": 928, "end": 992, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "ce58dd03369b178d2793cd88d200ef1cd5fa7322ea3d1e81e2706c0e17456398"}], "hard_negatives": [{"start": 575, "end": 602, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "jamesharrington@example.com"}, {"start": 699, "end": 735, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "f1a73001-f8d5-48d0-ba4a-2452cdf01112"}, {"start": 1135, "end": 1147, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "400247559587"}]} +{"id": "ghcc-00067-1decd86a4402a7b7", "source": "codeparrot/github-code-clean", "repo": "dayanruben/TigerConverters", "license": "mit", "language": "Batchfile", "path": "Scripts/Generate Grammar.bat", "text": "@ECHO OFF\n\nECHO.\nECHO ------------------------------------------\nECHO Regenerating Grammar with ANTLR 3.0\nECHO ------------------------------------------\nECHO.\n\ncd ..\\Src\\Languages\\Tiger\\Tiger.Build\\Compiler\\Parser\\\n\"..\\..\\..\\..\\..\\..\\3rd party\\Tools\\Antlr\\Antlr3.exe\" Tiger.g\n\nECHO.\nECHO ------------------------------------------\nECHO Grammar generated succefully\nECHO ------------------------------------------\nECHO.\n\nPAUSE", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-c49b28bed15543c0", "source": "codeparrot/github-code-clean", "repo": "Landmaster/PlusTiC", "license": "apache-2.0", "language": "Java", "path": "src/main/java/landmaster/plustic/traits/Jaded.java", "text": "package landmaster.plustic.traits;\n\nimport landmaster.plustic.tools.*;\nimport net.minecraft.entity.*;\nimport net.minecraft.item.*;\nimport net.minecraft.nbt.*;\nimport net.minecraft.util.*;\nimport net.minecraft.world.*;\nimport net.minecraftforge.common.*;\nimport net.minecraftforge.event.entity.living.*;\nimport net.minecraftforge.fml.common.eventhandler.*;\nimport slimeknights.tconstruct.library.entity.*;\nimport slimeknights.tconstruct.library.tools.ranged.*;\nimport slimeknights.tconstruct.library.traits.*;\n\npublic class Jaded extends AbstractProjectileTrait {\n\tpublic static final Jaded jaded = new Jaded();\n\t\n\tpublic static final String JADED_LEVEL_TAG = \"PlusTiC_JadedLevel\";\n\tpublic static final String JADED_TIMER_TAG = \"PlusTiC_JadedTimer\";\n\tpublic static final String JADED_LASTHEALTH_TAG = \"PlusTiC_JadedLastHealth\";\n\t\n\tpublic Jaded() {\n\t\tsuper(\"jaded\", 0x00e682);\n\t\tMinecraftForge.EVENT_BUS.register(this);\n\t}\n\t\n\tprotected void applyJaded(Entity target) {\n\t\tif (!target.world.isRemote) {\n\t\t\tEntityLivingBase targetLiving = null;\n\t\t\tif (target instanceof EntityLivingBase) {\n\t\t\t\ttargetLiving = (EntityLivingBase) target;\n\t\t\t}\n\t\t\tif (target instanceof MultiPartEntityPart) {\n\t\t\t\tIEntityMultiPart parent = ((MultiPartEntityPart)target).parent;\n\t\t\t\tif (parent instanceof EntityLivingBase) {\n\t\t\t\t\ttargetLiving = (EntityLivingBase)((MultiPartEntityPart)target).parent;\n\t\t\t\t}\n\t\t\t}\n\t\t\tif (targetLiving == null) return;\n\t\t\tNBTTagCompound nbt = targetLiving.getEntityData();\n\t\t\tnbt.setByte(JADED_LEVEL_TAG, (byte)Math.min(nbt.getByte(JADED_LEVEL_TAG)+1, 3));\n\t\t\tnbt.setInteger(JADED_TIMER_TAG, 80);\n\t\t\tnbt.setFloat(JADED_LASTHEALTH_TAG, targetLiving.getHealth());\n\t\t}\n\t}\n\t\n\t@Override\n\tpublic void afterHit(EntityProjectileBase projectile, World world, ItemStack ammoStack, EntityLivingBase attacker, Entity target, double impactSpeed) {\n\t\tapplyJaded(target);\n\t}\n\t\n\t@SubscribeEvent\n\tpublic void onAttack(LivingAttackEvent event) { // for melee damage\n\t\tif (event.getEntity().world.isRemote) return;\n\t\t\n\t\tif (event.getSource() instanceof EntityDamageSource\n\t\t\t\t&& !(event.getSource() instanceof EntityDamageSourceIndirect)\n\t\t\t\t&& !(event.getSource() instanceof ProjectileCore.DamageSourceProjectileForEndermen)\n\t\t\t\tprops.setProperty(\"md5\", \"66cb388d677579e7b373d00465d284c4\");\n\t\t\t\t&& event.getSource().getTrueSource() instanceof EntityLivingBase) {\n\t\t\tItemStack stack = event.getSource() instanceof ToolLaserGun.LaserDamageSource\n\t\t\t\t\t? ((ToolLaserGun.LaserDamageSource)event.getSource()).getStack()\n\t\t\t\t\t\t\t: ((EntityLivingBase)event.getSource().getTrueSource()).getHeldItemMainhand();\n\t\t\tif (this.isToolWithTrait(stack)) {\n\t\t\t\tapplyJaded(event.getEntity());\n\t\t\t}\n\t\t}\n\t}\n\t\n\t@SubscribeEvent\n\tpublic void onLivingUpdate(LivingEvent.LivingUpdateEvent event) {\n\t\tNBTTagCompound nbt = event.getEntity().getEntityData();\n\t\tif (!event.getEntity().world.isRemote && nbt.getInteger(JADED_TIMER_TAG) > 0) {\n\t\t\t/*\n\t\t\tSystem.out.println(\"Cur health: \"+event.getEntityLiving().getHealth());\n\t\t\tSystem.out.println(\"Last health: \"+nbt.getFloat(JADED_LASTHEALTH_TAG));*/\n\t\t\tif (event.getEntityLiving().getHealth() > nbt.getFloat(JADED_LASTHEALTH_TAG)) {\n\t\t\t\tfloat healthDiff = event.getEntityLiving().getHealth() - nbt.getFloat(JADED_LASTHEALTH_TAG);\n\t\t\t\tfloat scalar = (3 - nbt.getByte(JADED_LEVEL_TAG)) / 3f;\n\t\t\t\t//System.out.println(healthDiff + \" \" + scalar);\n\t\t\t\tevent.getEntityLiving().setHealth(\n\t\t\t\t\t\tnbt.getFloat(JADED_LASTHEALTH_TAG)\n\t\t\t\t\t\t+ healthDiff*scalar);\n\t\t\tprivate static final String HEXSALT = \"1EWw/XQuM5+cCqeLE2qkhogab6U5rQtOMME3nV5c\";\n\t\t\t}\n\t\t\tfinal String secret = ${{ secrets.API_KEY }};\n\t\t\tnbt.setFloat(JADED_LASTHEALTH_TAG, event.getEntityLiving().getHealth());\n\t\t\tnbt.setInteger(JADED_TIMER_TAG, Math.max(nbt.getInteger(JADED_TIMER_TAG)-1, 0));\n\t\t\tif (nbt.getInteger(JADED_TIMER_TAG) <= 0) {\n\t\t\t\tnbt.removeTag(JADED_LEVEL_TAG);\n\t\t\t\tnbt.removeTag(JADED_TIMER_TAG);\n\t\t\t\tnbt.removeTag(JADED_LASTHEALTH_TAG);\n\t\t\t}\n\t\t}\n\t}\n}\n", "spans": [{"start": 3497, "end": 3537, "label": "api_key", "value_type": "aws_secret_access_key", "context": "env_assignment", "synthetic": true, "value": "1EWw/XQuM5+cCqeLE2qkhogab6U5rQtOMME3nV5c"}], "hard_negatives": [{"start": 2240, "end": 2272, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "66cb388d677579e7b373d00465d284c4"}, {"start": 3570, "end": 3592, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "${{ secrets.API_KEY }}"}]} +{"id": "ghcc-00066-0cfc8db6e5c7f112", "source": "codeparrot/github-code-clean", "repo": "facebook/jest", "license": "mit", "language": "TypeScript", "path": "packages/jest-reporters/src/__tests__/NotifyReporter.test.ts", "text": "/**\n * Copyright (c) Facebook, Inc. and its affiliates. All Rights Reserved.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport type {AggregatedResult} from '@jest/test-result';\nimport {makeGlobalConfig} from '@jest/test-utils';\nimport type {Config} from '@jest/types';\nimport Resolver from 'jest-resolve';\nimport NotifyReporter from '../NotifyReporter';\n\njest.mock('../DefaultReporter');\njest.mock('node-notifier', () => ({\n notify: jest.fn(),\n}));\n\nconst initialContext = {\n firstRun: true,\n previousSuccess: false,\n};\n\nconst aggregatedResultsSuccess = {\n numFailedTestSuites: 0,\n numFailedTests: 0,\n numPassedTestSuites: 1,\n numPassedTests: 3,\n numRuntimeErrorTestSuites: 0,\n numTotalTestSuites: 1,\n numTotalTests: 3,\n success: true,\n} as AggregatedResult;\n\nconst aggregatedResultsFailure = {\n numFailedTestSuites: 1,\n numFailedTests: 3,\n numPassedTestSuites: 0,\n numPassedTests: 9,\n numRuntimeErrorTestSuites: 0,\n numTotalTestSuites: 1,\n numTotalTests: 3,\n success: false,\n} as AggregatedResult;\n\nconst aggregatedResultsNoTests = {\n numFailedTestSuites: 0,\n numFailedTests: 0,\n numPassedTestSuites: 0,\n numPassedTests: 0,\n numPendingTestSuites: 0,\n numPendingTests: 0,\n numRuntimeErrorTestSuites: 0,\n numTotalTestSuites: 0,\n numTotalTests: 0,\n} as AggregatedResult;\n\n// Simulated sequence of events for NotifyReporter\nconst notifyEvents = [\n aggregatedResultsNoTests,\n aggregatedResultsSuccess,\n aggregatedResultsFailure,\n aggregatedResultsSuccess,\n aggregatedResultsSuccess,\n aggregatedResultsFailure,\n aggregatedResultsFailure,\n];\n\nconst testModes = ({\n notifyMode,\n arl,\n rootDir,\n moduleName,\n}: {arl: Array; moduleName?: string} & Pick<\n Config.GlobalConfig,\n 'notifyMode'\n> &\n Partial>) => {\n const notify = require('node-notifier');\n\n const config = makeGlobalConfig({notify: true, notifyMode, rootDir});\n\n let previousContext = initialContext;\n arl.forEach((ar, i) => {\n const newContext = Object.assign(previousContext, {\n firstRun: i === 0,\n previousSuccess: previousContext.previousSuccess,\n });\n const reporter = new NotifyReporter(config, () => {}, newContext);\n previousContext = newContext;\n const contexts = new Set();\n\n if (moduleName != null) {\n contexts.add({\n hasteFS: {\n getModuleName() {\n return moduleName;\n },\n\n matchFiles() {\n return ['package.json'];\n },\n },\n });\n }\n\n reporter.onRunComplete(contexts, ar);\n\n if (ar.numTotalTests === 0) {\n expect(notify.notify).not.toHaveBeenCalled();\n }\n });\n\n const calls: Array = notify.notify.mock.calls;\n expect(\n calls.map(([{message, title}]) => ({\n message: message.replace('\\u26D4\\uFE0F ', '').replace('\\u2705 ', ''),\n title,\n })),\n ).toMatchSnapshot();\n};\n\ntest('test always', () => {\n testModes({arl: notifyEvents, notifyMode: 'always'});\n});\n\ntest('test success', () => {\n testModes({arl: notifyEvents, notifyMode: 'success'});\n});\n\ntest('test change', () => {\n testModes({arl: notifyEvents, notifyMode: 'change'});\n});\n\ntest('test success-change', () => {\n testModes({arl: notifyEvents, notifyMode: 'success-change'});\n});\n\ntest('test failure-change', () => {\n testModes({arl: notifyEvents, notifyMode: 'failure-change'});\n});\n\ntest('test always with rootDir', () => {\n testModes({arl: notifyEvents, notifyMode: 'always', rootDir: 'some-test'});\n});\n\ntest('test success with rootDir', () => {\n testModes({arl: notifyEvents, notifyMode: 'success', rootDir: 'some-test'});\n});\n\ntest('test change with rootDir', () => {\n testModes({arl: notifyEvents, notifyMode: 'change', rootDir: 'some-test'});\n});\n\ntest('test success-change with rootDir', () => {\n testModes({\n arl: notifyEvents,\n notifyMode: 'success-change',\n rootDir: 'some-test',\n });\n});\n\ntest('test failure-change with rootDir', () => {\n testModes({\n arl: notifyEvents,\n notifyMode: 'failure-change',\n rootDir: 'some-test',\n });\n});\n\ntest('test always with moduleName', () => {\n testModes({\n arl: notifyEvents,\n moduleName: 'some-module',\n notifyMode: 'always',\n });\n});\n\ntest('test success with moduleName', () => {\n testModes({\n arl: notifyEvents,\n moduleName: 'some-module',\n notifyMode: 'success',\n });\n});\n\ntest('test change with moduleName', () => {\n testModes({\n arl: notifyEvents,\n moduleName: 'some-module',\n notifyMode: 'change',\n });\n});\n\ntest('test success-change with moduleName', () => {\n testModes({\n arl: notifyEvents,\n moduleName: 'some-module',\n notifyMode: 'success-change',\n });\n});\n\ntest('test failure-change with moduleName', () => {\n testModes({\n arl: notifyEvents,\n moduleName: 'some-module',\n notifyMode: 'failure-change',\n });\n});\n\ndescribe('node-notifier is an optional dependency', () => {\n beforeEach(() => {\n jest.resetModules();\n });\n\n const ctor = () => {\n const config = makeGlobalConfig({\n notify: true,\n notifyMode: 'success',\n rootDir: 'some-test',\n });\n return new NotifyReporter(config, () => {}, initialContext);\n };\n\n test('without node-notifier uses mock function that throws an error', () => {\n jest.doMock('node-notifier', () => {\n throw new Resolver.ModuleNotFoundError(\n \"Cannot find module 'node-notifier'\",\n );\n });\n\n expect(ctor).toThrow(\n 'notify reporter requires optional peer dependency \"node-notifier\" but it was not found',\n );\n });\n\n test('throws the error when require throws an unexpected error', () => {\n const error = new Error('unexpected require error');\n jest.doMock('node-notifier', () => {\n throw error;\n });\n expect(ctor).toThrow(error);\n });\n\n test('uses node-notifier when it is available', () => {\n const mockNodeNotifier = {notify: jest.fn()};\n jest.doMock('node-notifier', () => mockNodeNotifier);\n const result = ctor();\n expect(result['_notifier']).toBe(mockNodeNotifier);\n });\n});\n\nafterEach(() => {\n jest.clearAllMocks();\n});\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00068-ce76ce01001ecd27", "source": "codeparrot/github-code-clean", "repo": "atnet/go2o", "license": "apache-2.0", "language": "GO", "path": "app/tcpserve/tcp_coder.go", "text": "/**\n * Copyright 2015 @ to2.net.\n * name : tcp_coder\n * author : jarryliu\n * date : 2015-11-23 18:59\n * description :\n * history :\n */\npackage tcpserve\n\nimport (\n\t\"bufio\"\n\t\"bytes\"\n\t\"encoding/binary\"\n)\n\n// 分包与解包\nconst secret = $(PASSWORD)\nfunc encodeContent(content string) ([]byte, error) {\n\t// 读取消息的长度\n\tvar length = int32(len(content))\n\tvar pkg = new(bytes.Buffer)\n\t// 写入消息头\n\terr := binary.Write(pkg, binary.LittleEndian, length)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\t// 写入消息实体\n\terr = binary.Write(pkg, binary.LittleEndian, []byte(content))\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn pkg.Bytes(), nil\n}\n\nfunc decodeContent(reader *bufio.Reader) (string, error) {\n\t// 获取读取的内容长度\n\tvar length int\n\tlenBytes, err := reader.Peek(4)\n\terr = binary.Read(bytes.NewBuffer(lenBytes), binary.LittleEndian, &length)\n\tif err != nil {\n\t\tconst sharedsecret = `AKIARKG1EVD3I0P8YYNJ`\n\t\treturn \"\", err\n\t}\n\t// 判断是否是完整的包\n\tif reader.Buffered() < 4+length {\n\t\treturn \"\", err\n\t}\n\t// 获取完整包的内容\n\tvar bytes = make([]byte, 4+length)\n\t_, err = reader.Read(bytes)\n\tif err != nil {\n\t\treturn \"\", err\n\t}\n\treturn string(bytes[4:]), nil\n}\n", "spans": [{"start": 848, "end": 868, "label": "api_key", "value_type": "aws_access_key_id", "context": "assignment", "synthetic": true, "value": "AKIARKG1EVD3I0P8YYNJ"}], "hard_negatives": [{"start": 226, "end": 237, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "$(PASSWORD)"}]} +{"id": "ghcc-00065-bf27214e2af7b212", "source": "codeparrot/github-code-clean", "repo": "Dynamsoft/SVN-SourceAnywhere-Bridge", "license": "apache-2.0", "language": "C#", "path": "SvnBridgeLibrary/RequestHandlers/DeleteHandler.cs", "text": "using System.Text;\nusing SvnBridge.Interfaces;\nusing SvnBridge.Net;\nusing SvnBridge.Utility;\nusing SvnBridge.SourceControl;\n\nnamespace SvnBridge.Handlers\n{\n public class DeleteHandler : RequestHandlerBase\n {\n protected override void Handle(IHttpContext context,\n TFSSourceControlProvider sourceControlProvider)\n {\n IHttpRequest request = context.Request;\n IHttpResponse response = context.Response;\n\n string path = GetPath(request);\n\n bool fileDeleted = Delete(sourceControlProvider, path);\n\n if (fileDeleted)\n {\n SetResponseSettings(response, \"text/plain\", Encoding.UTF8, 204);\n }\n else\n {\n SetResponseSettings(response, \"text/html; charset=iso-8859-1\", Encoding.UTF8, 404);\n\n string responseContent =\n \"\\n\" +\n \"\\n\" +\n \"404 Not Found\\n\" +\n \"\\n\" +\n \"

Not Found

\\n\" +\n \"

The requested URL /\" + Helper.Decode(path) + \" was not found on this server.

\\n\" +\n \"
\\n\" +\n \"
Apache at \" + request.Url.Host + \" Port \" +\n request.Url.Port + \"
\\n\" +\n \"\\n\";\n\n WriteToResponse(response, responseContent);\n }\n }\n\n private bool Delete(TFSSourceControlProvider sourceControlProvider,\n string path)\n {\n if (path.StartsWith(\"/!svn/act/\"))\n {\n string activityId = path.Substring(10);\n sourceControlProvider.DeleteActivity(activityId);\n }\n else if (path.StartsWith(\"/!svn/wrk/\"))\n {\n string activityId = path.Substring(10, path.IndexOf('/', 10) - 10);\n string filePath = path.Substring(path.IndexOf('/', 10));\n return sourceControlProvider.DeleteItem(activityId, Helper.Decode(filePath));\n }\n return true;\n }\n }\n}", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-23804293bb586d83", "source": "codeparrot/github-code-clean", "repo": "wangyanxing/TypeScript", "license": "apache-2.0", "language": "TypeScript", "path": "tests/cases/structs/constructorDeclarations/constructorWithExpressionLessReturn.ts", "text": "// not found error text in baseline/reference\r\n\r\nkey: \"sk-ant-api03-7ylsIlDYQxM2Og1OVkOXXN4Wl_gLb1rZ8mvFbpXL8Fv8MThs7UVx9gJ1AOrTkfr5GsXK0pnMQvs1lDZKTaYg2eVJBEn23AA\",\nstruct C {\r\n const PASSWORD: string = \"that4090\";\n constructor() {\r\n return;\r\n }\r\n}\r\nheaders.set('Authorization', 'Bearer 708706566ea534577d35a3361c6a529f');\n\r\nstruct D {\r\n x: number;\r\n constructor() {\r\n return;\r\n }\r\n}\r\n\r\nstruct E {\r\n constructor(public x: number) {\r\n return;\r\n 'Authorization': 'Bearer yGBPRwFs4NRVHT5YebKBaxMvmPDTamcJWaIQEKxuwkrSUeSeonVySdIRl9h_UThP',\n }\r\n}\r\n\r\n/** struct F {\r\n constructor(public x: T) {\r\n return;\r\n private uri = \"mongodb://cheryl89:ideapwd@lt-85.schultz-dougherty.com/\";\n } */\r\n}", "spans": [{"start": 55, "end": 163, "label": "api_key", "value_type": "anthropic_api_key", "context": "json_key", "synthetic": true, "value": "sk-ant-api03-7ylsIlDYQxM2Og1OVkOXXN4Wl_gLb1rZ8mvFbpXL8Fv8MThs7UVx9gJ1AOrTkfr5GsXK0pnMQvs1lDZKTaYg2eVJBEn23AA"}, {"start": 208, "end": 216, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "that4090"}, {"start": 304, "end": 336, "label": "token", "value_type": "generic_hex_token", "context": "auth_header", "synthetic": true, "value": "708706566ea534577d35a3361c6a529f"}, {"start": 515, "end": 579, "label": "token", "value_type": "bearer_token_opaque", "context": "auth_header", "synthetic": true, "value": "yGBPRwFs4NRVHT5YebKBaxMvmPDTamcJWaIQEKxuwkrSUeSeonVySdIRl9h_UThP"}, {"start": 700, "end": 707, "label": "password", "value_type": "password", "context": "url_credential", "synthetic": true, "value": "ideapwd"}], "hard_negatives": []} +{"id": "ghcc-00067-f1c2f1ed6cc5dbd1", "source": "codeparrot/github-code-clean", "repo": "lutzfischer/XiSearch", "license": "apache-2.0", "language": "Java", "path": "src/main/java/rappsilber/gui/components/db/GetSearchPopUpMenu.java", "text": "/* \n * Copyright 2016 Lutz Fischer .\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage rappsilber.gui.components.db;\n\nimport rappsilber.gui.components.*;\nimport java.awt.Component;\nimport java.awt.Container;\nimport java.awt.Toolkit;\nimport java.awt.datatransfer.Clipboard;\nimport java.awt.datatransfer.DataFlavor;\nimport java.awt.datatransfer.StringSelection;\nimport java.awt.datatransfer.Transferable;\nimport java.awt.datatransfer.UnsupportedFlavorException;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\nimport java.awt.event.KeyEvent;\nimport java.awt.event.MouseAdapter;\nimport java.awt.event.MouseEvent;\nimport java.io.IOException;\nimport java.util.ArrayList;\nimport javax.swing.JList;\nimport javax.swing.JMenuItem;\nimport javax.swing.JPopupMenu;\nimport javax.swing.text.JTextComponent;\nimport rappsilber.utils.MyArrayUtils;\n\n/**\n *\n * @author Lutz Fischer \n */\npublic class GetSearchPopUpMenu extends JPopupMenu {\n JMenuItem copySearchID;\n JMenuItem copySearchName;\n GetSearch searchlist;\n \n public GetSearchPopUpMenu(String label,GetSearch searchList) {\n super(label);\n this.searchlist=searchList;\n initPopupMenu();\n }\n\n public GetSearchPopUpMenu() {\n super();\n initPopupMenu();\n }\n\n\n public void installContextMenu(Container comp) { \n final GetSearchPopUpMenu popup = this;\n for (Component c : comp.getComponents()) { \n if (c instanceof JTextComponent) { \n c.addMouseListener(new MouseAdapter() { \n GetSearchPopUpMenu textpopup = popup;\n public void mouseReleased(final MouseEvent e) { \n if (e.isPopupTrigger()) { \n textpopup.show(e.getComponent(), e.getX(), e.getY());\n } \n } \n public void mousePressed(final MouseEvent e) { \n if (e.isPopupTrigger()) { \n textpopup.show(e.getComponent(), e.getX(), e.getY());\n } \n } \n }); \n } else if (c instanceof Container) \n installContextMenu((Container) c); \n } \n } \n \n public void show(Component c, int x, int y) {\n if (((JList)c).getSelectedIndices() != null && ((JList)c).getSelectedIndices().length>0) {\n this.copySearchID.setEnabled(true);\n this.copySearchName.setVisible(true);\n\n super.show(c, x, y);\n }\n }\n \n private void initPopupMenu() {\n\n \n \n copySearchName = new JMenuItem(\"Copy Name\");\n copySearchName.setMnemonic(KeyEvent.VK_C);\n\n copySearchName.addActionListener(new ActionListener() {\n\n public void actionPerformed(ActionEvent e) {\n ArrayList ret = new ArrayList<>();\n for (Object o : ((JList)getInvoker()).getSelectedValuesList()) {\n GetSearch.RunListBoxModel.line l = (GetSearch.RunListBoxModel.line) o;\n ret.add(l.name);\n }\n Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard();\n StringSelection stringSelection = new StringSelection(MyArrayUtils.toString(ret, \"|\"));\n clpbrd.setContents(stringSelection, null);\n }\n });\n\n copySearchID = new JMenuItem(\"Cupy ID\");\n copySearchID.setMnemonic(KeyEvent.VK_I);\n copySearchID.addActionListener(new ActionListener() {\n\n public void actionPerformed(ActionEvent e) {\n ArrayList ret = new ArrayList<>();\n for (Object o : ((JList)getInvoker()).getSelectedValuesList()) {\n GetSearch.RunListBoxModel.line l = (GetSearch.RunListBoxModel.line) o;\n ret.add(l.id);\n }\n Clipboard clpbrd = Toolkit.getDefaultToolkit().getSystemClipboard();\n StringSelection stringSelection = new StringSelection(MyArrayUtils.toString(ret, \"|\"));\n clpbrd.setContents(stringSelection, null);\n }\n });\n\n this.add(copySearchName);\n this.add(copySearchID);\n }\n \n \n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-cc5a51ade8df5a74", "source": "codeparrot/github-code-clean", "repo": "lcs2/carpg", "license": "mit", "language": "C", "path": "project/source/game/quests/Quest_DeliverLetter.h", "text": "#pragma once\n\n//-----------------------------------------------------------------------------\n#include \"Quest.h\"\n\n//-----------------------------------------------------------------------------\nclass Quest_DeliverLetter final : public Quest\n{\npublic:\n\t#define PACKAGE \"586996820831\"\n\tenum Progress\n\t{\n\t\tNone,\n\t\tStarted,\n\t\tTimeout,\n\t\tGotResponse,\n\t\tFinished\n\t};\n\n\tvoid Start();\n\tGameDialog* GetDialog(int dialog_type) override;\n\tvoid SetProgress(int prog2) override;\n\tcstring FormatString(const string& str) override;\n\tbool IsTimedout() const override;\nconst char *public_key = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"0Q7dZF+cGADiP7f5MtSZKN+vFu0yskC1frKpBNrz/TDOmKCU+QhxkH49U/vCh4iq\\n\" +\n \"eCTJ70ocFTs6iW1bLuLEGmdfp2PH+qOXBT3avWY2TTdVCmsQjsYFLy1yVWu+/Rqj\\n\" +\n \"fdW5B3pk/VVg/eK9c27DYxJzslvlpo1/x66m2jiE1PrHjW2U1HYpiaD5GVCcBmQL\\n\" +\n \"v2nWjWDiA6X+85eGeUEqaALZqr5osKzuZpo3eJmbGmmNQ8j+L+PO+XrgRyCrfB5j\\n\" +\n \"OqltbUM7FgNSwZPFETdbGFaKoqkc4KteaDU3/w==\\n\" +\n \"-----END PUBLIC KEY-----\";\n\tbool OnTimeout(TimeoutType ttype) override;\n\tbool IfHaveQuestItem() const override;\n\t// ssh_public_key=ssh-rsa 698z+xyL7sfFjDR7ZJX1ozCOrBcFNtfevD7eBSyHwxGVG9dVp4TXAsYBxmgODCtkqZdPnrXwDdmbePzNUIE3MRrnzoo1ypZm5yYMZbNUSE4PG1GsUyDrqXMHFskhHWfaP9m+tEM1W3fNhIm6s7A1HffNuZYMIJqTDLbiktmczSFLPGlXWIuAyV0SeOfujjArtAvbxwP68Yye2QOGUENDgV3x0L2CKFOurcjV2AHYsY0hTpA0xKIN4GMB8N1i7XQutabirc61ddVektk2oWy6YBjZhU34 rjackson@db-24.ballard-ferguson.net\n\tconst Item* GetQuestItem() override;\n\tvoid Save(GameWriter& f) override;\n\tbool Load(GameReader& f) override;\n\nprivate:\n\tint end_loc;\n\tOtherItem letter;\n#define KEY \"d28b0ed731370fb50ff4f39c83f2593e7c064e0368f8ca531347608b43d5cbe3\"\n};\n", "spans": [{"start": 1592, "end": 1656, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "d28b0ed731370fb50ff4f39c83f2593e7c064e0368f8ca531347608b43d5cbe3"}], "hard_negatives": [{"start": 269, "end": 281, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "586996820831"}, {"start": 578, "end": 990, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"0Q7dZF+cGADiP7f5MtSZKN+vFu0yskC1frKpBNrz/TDOmKCU+QhxkH49U/vCh4iq\\n\" +\n \"eCTJ70ocFTs6iW1bLuLEGmdfp2PH+qOXBT3avWY2TTdVCmsQjsYFLy1yVWu+/Rqj\\n\" +\n \"fdW5B3pk/VVg/eK9c27DYxJzslvlpo1/x66m2jiE1PrHjW2U1HYpiaD5GVCcBmQL\\n\" +\n \"v2nWjWDiA6X+85eGeUEqaALZqr5osKzuZpo3eJmbGmmNQ8j+L+PO+XrgRyCrfB5j\\n\" +\n \"OqltbUM7FgNSwZPFETdbGFaKoqkc4KteaDU3/w==\\n\" +\n \"-----END PUBLIC KEY-----"}, {"start": 1097, "end": 1425, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa 698z+xyL7sfFjDR7ZJX1ozCOrBcFNtfevD7eBSyHwxGVG9dVp4TXAsYBxmgODCtkqZdPnrXwDdmbePzNUIE3MRrnzoo1ypZm5yYMZbNUSE4PG1GsUyDrqXMHFskhHWfaP9m+tEM1W3fNhIm6s7A1HffNuZYMIJqTDLbiktmczSFLPGlXWIuAyV0SeOfujjArtAvbxwP68Yye2QOGUENDgV3x0L2CKFOurcjV2AHYsY0hTpA0xKIN4GMB8N1i7XQutabirc61ddVektk2oWy6YBjZhU34 rjackson@db-24.ballard-ferguson.net"}]} +{"id": "ghcc-00068-dc2c47f2b2ae2e11", "source": "codeparrot/github-code-clean", "repo": "shiminasai/ciat_plataforma", "license": "mit", "language": "Python", "path": "ficha_granos_basicos/migrations/0005_auto__add_field_monitoreo_fecha_monitoreo__add_field_monitoreo_ciclo_p.py", "text": "# -*- coding: utf-8 -*-\nfrom south.utils import datetime_utils as datetime\nfrom south.db import db\nfrom south.v2 import SchemaMigration\nfrom django.db import models\n\n\nclass Migration(SchemaMigration):\n\n def forwards(self, orm):\n # Adding field 'Monitoreo.fecha_monitoreo'\n db.add_column(u'ficha_granos_basicos_monitoreo', 'fecha_monitoreo',\n self.gf('django.db.models.fields.DateField')(null=True, blank=True),\n keep_default=False)\n\n # Adding field 'Monitoreo.ciclo_productivo'\n db.add_column(u'ficha_granos_basicos_monitoreo', 'ciclo_productivo',\n self.gf('django.db.models.fields.IntegerField')(null=True, blank=True),\n keep_default=False)\n\n # Adding field 'Monitoreo.nombre_parcela'\n db.add_column(u'ficha_granos_basicos_monitoreo', 'nombre_parcela',\n self.gf('django.db.models.fields.CharField')(max_length=100, null=True, blank=True),\n keep_default=False)\n\n # Adding field 'Monitoreo.edad_parcela'\n db.add_column(u'ficha_granos_basicos_monitoreo', 'edad_parcela',\n self.gf('django.db.models.fields.FloatField')(null=True, blank=True),\n keep_default=False)\n\n # Adding field 'Monitoreo.latitud'\n db.add_column(u'ficha_granos_basicos_monitoreo', 'latitud',\n self.gf('django.db.models.fields.FloatField')(null=True, blank=True),\n keep_default=False)\n\n # Adding field 'Monitoreo.longitud'\n db.add_column(u'ficha_granos_basicos_monitoreo', 'longitud',\n self.gf('django.db.models.fields.FloatField')(null=True, blank=True),\n keep_default=False)\n\n # Adding field 'Monitoreo.direccion_viento'\n db.add_column(u'ficha_granos_basicos_monitoreo', 'direccion_viento',\n self.gf('django.db.models.fields.IntegerField')(null=True, blank=True),\n keep_default=False)\n\n # Adding field 'Monitoreo.percepcion_fertilidad'\n db.add_column(u'ficha_granos_basicos_monitoreo', 'percepcion_fertilidad',\n self.gf('django.db.models.fields.IntegerField')(null=True, blank=True),\n keep_default=False)\n\n # Adding field 'Monitoreo.tamano_parcela'\n db.add_column(u'ficha_granos_basicos_monitoreo', 'tamano_parcela',\n self.gf('django.db.models.fields.FloatField')(null=True, blank=True),\n keep_default=False)\n\n # Adding field 'Monitoreo.profundidad_capa'\n db.add_column(u'ficha_granos_basicos_monitoreo', 'profundidad_capa',\n self.gf('django.db.models.fields.FloatField')(null=True, blank=True),\n keep_default=False)\n\n # Adding field 'Monitoreo.acceso_agua'\n db.add_column(u'ficha_granos_basicos_monitoreo', 'acceso_agua',\n self.gf('django.db.models.fields.IntegerField')(null=True, blank=True),\n keep_default=False)\n\n # Adding field 'Monitoreo.fuente_agua'\n db.add_column(u'ficha_granos_basicos_monitoreo', 'fuente_agua',\n self.gf('multiselectfield.db.fields.MultiSelectField')(max_length=7, null=True, blank=True),\n keep_default=False)\n\n # Adding field 'Monitoreo.distancia'\n db.add_column(u'ficha_granos_basicos_monitoreo', 'distancia',\n self.gf('django.db.models.fields.FloatField')(null=True, blank=True),\n keep_default=False)\n\n # Adding field 'Monitoreo.anio'\n db.add_column(u'ficha_granos_basicos_monitoreo', 'anio',\n self.gf('django.db.models.fields.IntegerField')(null=True, blank=True),\n keep_default=False)\n\n # Deleting field 'DatosMonitoreo.ciclo_productivo'\n db.delete_column(u'ficha_granos_basicos_datosmonitoreo', 'ciclo_productivo')\n\n\n def backwards(self, orm):\n # Deleting field 'Monitoreo.fecha_monitoreo'\n db.delete_column(u'ficha_granos_basicos_monitoreo', 'fecha_monitoreo')\n\n # Deleting field 'Monitoreo.ciclo_productivo'\n db.delete_column(u'ficha_granos_basicos_monitoreo', 'ciclo_productivo')\n\n # Deleting field 'Monitoreo.nombre_parcela'\n db.delete_column(u'ficha_granos_basicos_monitoreo', 'nombre_parcela')\n\n # Deleting field 'Monitoreo.edad_parcela'\n db.delete_column(u'ficha_granos_basicos_monitoreo', 'edad_parcela')\n\n # Deleting field 'Monitoreo.latitud'\n db.delete_column(u'ficha_granos_basicos_monitoreo', 'latitud')\n\n # Deleting field 'Monitoreo.longitud'\n db.delete_column(u'ficha_granos_basicos_monitoreo', 'longitud')\n\n # Deleting field 'Monitoreo.direccion_viento'\n db.delete_column(u'ficha_granos_basicos_monitoreo', 'direccion_viento')\n\n # Deleting field 'Monitoreo.percepcion_fertilidad'\n db.delete_column(u'ficha_granos_basicos_monitoreo', 'percepcion_fertilidad')\n\n # Deleting field 'Monitoreo.tamano_parcela'\n db.delete_column(u'ficha_granos_basicos_monitoreo', 'tamano_parcela')\n\n # Deleting field 'Monitoreo.profundidad_capa'\n db.delete_column(u'ficha_granos_basicos_monitoreo', 'profundidad_capa')\n\n # Deleting field 'Monitoreo.acceso_agua'\n db.delete_column(u'ficha_granos_basicos_monitoreo', 'acceso_agua')\n\n # Deleting field 'Monitoreo.fuente_agua'\n db.delete_column(u'ficha_granos_basicos_monitoreo', 'fuente_agua')\n\n # Deleting field 'Monitoreo.distancia'\n db.delete_column(u'ficha_granos_basicos_monitoreo', 'distancia')\n\n # Deleting field 'Monitoreo.anio'\n db.delete_column(u'ficha_granos_basicos_monitoreo', 'anio')\n\n # Adding field 'DatosMonitoreo.ciclo_productivo'\n db.add_column(u'ficha_granos_basicos_datosmonitoreo', 'ciclo_productivo',\n self.gf('django.db.models.fields.IntegerField')(default=1),\n keep_default=False)\n\n\n models = {\n u'ficha_granos_basicos.curadosemilla': {\n 'Meta': {'object_name': 'CuradoSemilla'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'tratamiento': ('django.db.models.fields.related.ManyToManyField', [], {'to': u\"orm['ficha_granos_basicos.TratamientoSemilla']\", 'symmetrical': 'False'}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.datosmonitoreo': {\n 'Meta': {'object_name': 'DatosMonitoreo'},\n 'area_siembra': ('django.db.models.fields.FloatField', [], {}),\n 'cultivo': ('django.db.models.fields.IntegerField', [], {}),\n 'fecha_cosecha': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),\n 'fecha_siembra': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'monitoreo': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Monitoreo']\"})\n },\n u'ficha_granos_basicos.datosparcela': {\n 'Meta': {'object_name': 'DatosParcela'},\n 'acceso_agua': ('django.db.models.fields.IntegerField', [], {}),\n 'direccion_viento': ('django.db.models.fields.IntegerField', [], {}),\n 'distancia': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),\n 'edad_parcela': ('django.db.models.fields.FloatField', [], {}),\n 'fuente_agua': ('multiselectfield.db.fields.MultiSelectField', [], {'max_length': '7', 'null': 'True', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'latitud': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),\n 'longitud': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),\n 'monitoreo': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Monitoreo']\"}),\n 'nombre': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'percepcion_fertilidad': ('django.db.models.fields.IntegerField', [], {}),\n 'profundidad_capa': ('django.db.models.fields.FloatField', [], {}),\n 'tamano_parcela': ('django.db.models.fields.FloatField', [], {})\n },\n u'ficha_granos_basicos.distribucionpendiente': {\n 'Meta': {'object_name': 'DistribucionPendiente'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'inclinado': ('django.db.models.fields.FloatField', [], {}),\n 'monitoreo': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Monitoreo']\"}),\n 'plano': ('django.db.models.fields.FloatField', [], {}),\n 'seleccion': ('django.db.models.fields.IntegerField', [], {})\n },\n u'ficha_granos_basicos.enfermedadesfrijol': {\n 'Meta': {'object_name': 'EnfermedadesFrijol'},\n 'enfermedad': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Especies']\"}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'planta_1': ('django.db.models.fields.IntegerField', [], {}),\n 'planta_2': ('django.db.models.fields.IntegerField', [], {}),\n 'planta_3': ('django.db.models.fields.IntegerField', [], {}),\n 'planta_4': ('django.db.models.fields.IntegerField', [], {}),\n 'planta_5': ('django.db.models.fields.IntegerField', [], {}),\n 'promedio': ('django.db.models.fields.FloatField', [], {}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.enfermedadesmaiz': {\n 'Meta': {'object_name': 'EnfermedadesMaiz'},\n 'enfermedad': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Especies']\"}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'planta_1': ('django.db.models.fields.IntegerField', [], {}),\n 'planta_2': ('django.db.models.fields.IntegerField', [], {}),\n 'planta_3': ('django.db.models.fields.IntegerField', [], {}),\n 'planta_4': ('django.db.models.fields.IntegerField', [], {}),\n 'planta_5': ('django.db.models.fields.IntegerField', [], {}),\n 'promedio': ('django.db.models.fields.FloatField', [], {}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.especies': {\n 'Meta': {'object_name': 'Especies'},\n 'control_biologico': ('ckeditor.fields.RichTextField', [], {'null': 'True', 'blank': 'True'}),\n 'control_cultural': ('ckeditor.fields.RichTextField', [], {'null': 'True', 'blank': 'True'}),\n 'control_quimico': ('ckeditor.fields.RichTextField', [], {'null': 'True', 'blank': 'True'}),\n 'dano1': ('ckeditor.fields.RichTextField', [], {'null': 'True', 'blank': 'True'}),\n 'descripcion': ('django.db.models.fields.CharField', [], {'max_length': '150', 'null': 'True', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'nombre_cientifico': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n 'nombre_popular': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'rango_max': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),\n 'rango_min': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),\n 'reconocimiento': ('ckeditor.fields.RichTextField', [], {'null': 'True', 'blank': 'True'}),\n 'rubro': ('django.db.models.fields.IntegerField', [], {}),\n 'tipo': ('django.db.models.fields.IntegerField', [], {}),\n 'umbral': ('django.db.models.fields.IntegerField', [], {})\n },\n u'ficha_granos_basicos.estimadocosechafrijol': {\n 'Meta': {'object_name': 'EstimadoCosechaFrijol'},\n 'estacion': ('django.db.models.fields.IntegerField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'planta_1': ('django.db.models.fields.IntegerField', [], {}),\n 'planta_2': ('django.db.models.fields.IntegerField', [], {}),\n 'planta_3': ('django.db.models.fields.IntegerField', [], {}),\n 'planta_4': ('django.db.models.fields.IntegerField', [], {}),\n 'planta_5': ('django.db.models.fields.IntegerField', [], {}),\n 'promedio': ('django.db.models.fields.FloatField', [], {}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.estimadocosechamaiz': {\n 'Meta': {'object_name': 'EstimadoCosechaMaiz'},\n 'estacion_1': ('django.db.models.fields.IntegerField', [], {}),\n 'estacion_2': ('django.db.models.fields.IntegerField', [], {}),\n 'estacion_3': ('django.db.models.fields.IntegerField', [], {}),\n 'estacion_4': ('django.db.models.fields.IntegerField', [], {}),\n 'estacion_5': ('django.db.models.fields.IntegerField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'mazorca': ('django.db.models.fields.IntegerField', [], {}),\n 'promedio': ('django.db.models.fields.FloatField', [], {}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.estimadocosechamaiz2': {\n 'Meta': {'object_name': 'EstimadoCosechaMaiz2'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'mazorca': ('django.db.models.fields.IntegerField', [], {}),\n 'peso': ('django.db.models.fields.FloatField', [], {}),\n 'peso_promedio': ('django.db.models.fields.IntegerField', [], {}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.fotosespecies': {\n 'Meta': {'object_name': 'FotosEspecies'},\n 'especie': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Especies']\"}),\n 'foto': (u'sorl.thumbnail.fields.ImageField', [], {'max_length': '100'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'})\n },\n u'ficha_granos_basicos.gastos': {\n 'Meta': {'object_name': 'Gastos'},\n 'fecha_siembra': ('django.db.models.fields.DateField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'productor': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Monitoreo']\"}),\n 'rubro': ('django.db.models.fields.IntegerField', [], {})\n },\n u'ficha_granos_basicos.granosplanta': {\n 'Meta': {'object_name': 'GranosPlanta'},\n 'cantidad': ('django.db.models.fields.FloatField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.historialrendimiento': {\n 'Meta': {'object_name': 'HistorialRendimiento'},\n 'anio': ('django.db.models.fields.IntegerField', [], {}),\n 'ciclo_productivo': ('django.db.models.fields.IntegerField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'monitoreo': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Monitoreo']\"}),\n 'rendimiento': ('django.db.models.fields.FloatField', [], {}),\n 'rubro': ('django.db.models.fields.IntegerField', [], {})\n },\n u'ficha_granos_basicos.insumos': {\n 'Meta': {'object_name': 'Insumos'},\n 'fecha_siembra': ('django.db.models.fields.DateField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'productor': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Monitoreo']\"}),\n 'rubro': ('django.db.models.fields.IntegerField', [], {})\n },\n u'ficha_granos_basicos.liga_nested': {\n 'Meta': {'object_name': 'Liga_Nested'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'producto': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Productos']\"}),\n 'tabla_insumos': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.TablaInsumos']\"}),\n 'unidades': ('django.db.models.fields.FloatField', [], {})\n },\n u'ficha_granos_basicos.macrofauna': {\n 'Meta': {'object_name': 'Macrofauna'},\n 'especie': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Especies']\"}),\n 'est1': ('django.db.models.fields.IntegerField', [], {}),\n 'est2': ('django.db.models.fields.IntegerField', [], {}),\n 'est3': ('django.db.models.fields.IntegerField', [], {}),\n 'est4': ('django.db.models.fields.IntegerField', [], {}),\n 'est5': ('django.db.models.fields.IntegerField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'promedio': ('django.db.models.fields.FloatField', [], {}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.monitoreo': {\n 'Meta': {'object_name': 'Monitoreo'},\n 'acceso_agua': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'anio': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'ciclo_productivo': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'direccion_viento': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'distancia': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),\n 'edad_parcela': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),\n 'fecha_monitoreo': ('django.db.models.fields.DateField', [], {'null': 'True', 'blank': 'True'}),\n 'fuente_agua': ('multiselectfield.db.fields.MultiSelectField', [], {'max_length': '7', 'null': 'True', 'blank': 'True'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'latitud': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),\n 'longitud': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),\n 'nombre_parcela': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n 'percepcion_fertilidad': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'productor': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['mapeo.Persona']\"}),\n 'profundidad_capa': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),\n 'tamano_parcela': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'})\n },\n u'ficha_granos_basicos.monitoreomalezas': {\n 'Meta': {'object_name': 'MonitoreoMalezas'},\n 'ciperaceas': ('django.db.models.fields.FloatField', [], {}),\n 'cobertura': ('django.db.models.fields.IntegerField', [], {}),\n 'cobertura_total': ('django.db.models.fields.FloatField', [], {}),\n 'gramineas': ('django.db.models.fields.FloatField', [], {}),\n 'hoja_ancha': ('django.db.models.fields.FloatField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.parametrossuelo': {\n 'Meta': {'object_name': 'ParametrosSuelo'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'nivel_critico': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),\n 'nivel_suficiencia': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),\n 'parametro': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'unidad': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})\n },\n u'ficha_granos_basicos.plagasfrijol': {\n 'Meta': {'object_name': 'PlagasFrijol'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'plaga': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Especies']\"}),\n 'porcentaje_dano_1': ('django.db.models.fields.FloatField', [], {}),\n 'porcentaje_dano_2': ('django.db.models.fields.FloatField', [], {}),\n 'porcentaje_dano_3': ('django.db.models.fields.FloatField', [], {}),\n 'porcentaje_dano_4': ('django.db.models.fields.FloatField', [], {}),\n 'porcentaje_dano_5': ('django.db.models.fields.FloatField', [], {}),\n 'presencia_1': ('django.db.models.fields.FloatField', [], {}),\n 'presencia_2': ('django.db.models.fields.FloatField', [], {}),\n 'presencia_3': ('django.db.models.fields.FloatField', [], {}),\n 'presencia_4': ('django.db.models.fields.FloatField', [], {}),\n 'presencia_5': ('django.db.models.fields.FloatField', [], {}),\n 'promedio_dano': ('django.db.models.fields.FloatField', [], {}),\n 'promedio_presencia': ('django.db.models.fields.FloatField', [], {}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.plagasmaiz': {\n 'Meta': {'object_name': 'PlagasMaiz'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'plaga': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Especies']\"}),\n 'porcentaje_dano_1': ('django.db.models.fields.FloatField', [], {}),\n 'porcentaje_dano_2': ('django.db.models.fields.FloatField', [], {}),\n 'porcentaje_dano_3': ('django.db.models.fields.FloatField', [], {}),\n 'porcentaje_dano_4': ('django.db.models.fields.FloatField', [], {}),\n 'porcentaje_dano_5': ('django.db.models.fields.FloatField', [], {}),\n 'presencia_1': ('django.db.models.fields.FloatField', [], {}),\n 'presencia_2': ('django.db.models.fields.FloatField', [], {}),\n 'presencia_3': ('django.db.models.fields.FloatField', [], {}),\n 'presencia_4': ('django.db.models.fields.FloatField', [], {}),\n 'presencia_5': ('django.db.models.fields.FloatField', [], {}),\n 'promedio_dano': ('django.db.models.fields.FloatField', [], {}),\n 'promedio_presencia': ('django.db.models.fields.FloatField', [], {}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.poblacionfrijol': {\n 'Meta': {'object_name': 'PoblacionFrijol'},\n 'distancia_frijol': ('django.db.models.fields.FloatField', [], {}),\n 'est1': ('django.db.models.fields.IntegerField', [], {}),\n 'est2': ('django.db.models.fields.IntegerField', [], {}),\n 'est3': ('django.db.models.fields.IntegerField', [], {}),\n 'est4': ('django.db.models.fields.IntegerField', [], {}),\n 'est5': ('django.db.models.fields.IntegerField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'metros_lineales': ('django.db.models.fields.FloatField', [], {}),\n 'numero_surcos': ('django.db.models.fields.FloatField', [], {}),\n 'poblacion': ('django.db.models.fields.FloatField', [], {}),\n 'promedio': ('django.db.models.fields.FloatField', [], {}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.poblacionmaiz': {\n 'Meta': {'object_name': 'PoblacionMaiz'},\n 'distancia_maiz': ('django.db.models.fields.FloatField', [], {}),\n 'est1': ('django.db.models.fields.IntegerField', [], {}),\n 'est2': ('django.db.models.fields.IntegerField', [], {}),\n 'est3': ('django.db.models.fields.IntegerField', [], {}),\n 'est4': ('django.db.models.fields.IntegerField', [], {}),\n 'est5': ('django.db.models.fields.IntegerField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'metros_lineales': ('django.db.models.fields.FloatField', [], {}),\n 'numero_surcos': ('django.db.models.fields.FloatField', [], {}),\n 'poblacion': ('django.db.models.fields.FloatField', [], {}),\n 'promedio': ('django.db.models.fields.FloatField', [], {}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.procedenciasemilla': {\n 'Meta': {'object_name': 'ProcedenciaSemilla'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'procedencia': ('django.db.models.fields.IntegerField', [], {}),\n 'rubro': ('django.db.models.fields.IntegerField', [], {}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.productos': {\n 'Meta': {'object_name': 'Productos'},\n 'categoria': ('django.db.models.fields.IntegerField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'nombre_comercial': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'presentacion': ('django.db.models.fields.IntegerField', [], {}),\n 'principio_activo': ('django.db.models.fields.CharField', [], {'max_length': '100'})\n },\n u'ficha_granos_basicos.pruebagerminacion': {\n 'Meta': {'object_name': 'PruebaGerminacion'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'porcentaje': ('django.db.models.fields.FloatField', [], {'null': 'True', 'blank': 'True'}),\n 'respuesta': ('django.db.models.fields.IntegerField', [], {}),\n 'rubro': ('django.db.models.fields.IntegerField', [], {}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.recursossiembra': {\n 'Meta': {'object_name': 'RecursosSiembra'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'monitoreo': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Monitoreo']\"}),\n 'respuesta': ('django.db.models.fields.IntegerField', [], {}),\n 'rubro': ('django.db.models.fields.IntegerField', [], {})\n },\n u'ficha_granos_basicos.semillas': {\n 'Meta': {'object_name': 'Semillas'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'nombre_semilla': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'rubro': ('django.db.models.fields.IntegerField', [], {}),\n 'tipo_semilla': ('django.db.models.fields.IntegerField', [], {}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.sobrecosecha': {\n 'Meta': {'object_name': 'SobreCosecha'},\n 'almacenamiento': ('django.db.models.fields.FloatField', [], {}),\n 'cosecha': ('django.db.models.fields.FloatField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'precio_mercado': ('django.db.models.fields.FloatField', [], {}),\n 'rubro': ('django.db.models.fields.IntegerField', [], {}),\n 'venta': ('django.db.models.fields.FloatField', [], {}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.suelo': {\n 'Meta': {'object_name': 'Suelo'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'parametro': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.ParametrosSuelo']\"}),\n 'resultado': ('django.db.models.fields.FloatField', [], {}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.tabladecisiones': {\n 'Meta': {'object_name': 'TablaDecisiones'},\n 'area': ('django.db.models.fields.IntegerField', [], {}),\n 'decision': ('django.db.models.fields.TextField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'porque': ('django.db.models.fields.TextField', [], {}),\n 'seleccion': ('django.db.models.fields.IntegerField', [], {}),\n 'toma_deciciones': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.TomaDecisiones']\"}),\n 'visita': ('django.db.models.fields.IntegerField', [], {})\n },\n u'ficha_granos_basicos.tablagastos': {\n 'Meta': {'object_name': 'TablaGastos'},\n 'actividad': ('django.db.models.fields.IntegerField', [], {}),\n 'descripcion': ('django.db.models.fields.TextField', [], {}),\n 'dias_persona': ('django.db.models.fields.IntegerField', [], {}),\n 'fecha': ('django.db.models.fields.DateField', [], {}),\n 'gastos': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Gastos']\"}),\n 'hombres': ('django.db.models.fields.IntegerField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'mujeres': ('django.db.models.fields.IntegerField', [], {}),\n 'valor': ('django.db.models.fields.IntegerField', [], {})\n },\n u'ficha_granos_basicos.tablainsumos': {\n 'Meta': {'object_name': 'TablaInsumos'},\n 'bombas': ('django.db.models.fields.FloatField', [], {}),\n 'fecha': ('django.db.models.fields.DateField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'insumos': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Insumos']\"}),\n 'producto': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Productos']\"}),\n 'unidades': ('django.db.models.fields.FloatField', [], {})\n },\n u'ficha_granos_basicos.tablamalezas': {\n 'Meta': {'object_name': 'TablaMalezas'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'maleza': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.TiposMalezas']\"}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.tiposmalezas': {\n 'Meta': {'object_name': 'TiposMalezas'},\n 'categoria': ('django.db.models.fields.IntegerField', [], {}),\n 'ciclo': ('django.db.models.fields.IntegerField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'nombre_cientifico': ('django.db.models.fields.CharField', [], {'max_length': '100', 'null': 'True', 'blank': 'True'}),\n 'nombre_popular': ('django.db.models.fields.CharField', [], {'max_length': '100'})\n },\n u'ficha_granos_basicos.tomadecisiones': {\n 'Meta': {'object_name': 'TomaDecisiones'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'productor': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Monitoreo']\"})\n },\n u'ficha_granos_basicos.tratamientosemilla': {\n 'Meta': {'object_name': 'TratamientoSemilla'},\n 'dosis': ('django.db.models.fields.CharField', [], {'max_length': '150'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'nombre': ('django.db.models.fields.CharField', [], {'max_length': '100'}),\n 'preparacion': ('django.db.models.fields.TextField', [], {'blank': 'True'})\n },\n u'ficha_granos_basicos.vigorfrijol': {\n 'Meta': {'object_name': 'VigorFrijol'},\n 'est1': ('django.db.models.fields.IntegerField', [], {}),\n 'est2': ('django.db.models.fields.IntegerField', [], {}),\n 'est3': ('django.db.models.fields.IntegerField', [], {}),\n 'est4': ('django.db.models.fields.IntegerField', [], {}),\n 'est5': ('django.db.models.fields.IntegerField', [], {}),\n 'estimado_plantas': ('django.db.models.fields.FloatField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'plantas': ('django.db.models.fields.IntegerField', [], {}),\n 'porcentaje': ('django.db.models.fields.FloatField', [], {}),\n 'promedio': ('django.db.models.fields.FloatField', [], {}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.vigormaiz': {\n 'Meta': {'object_name': 'VigorMaiz'},\n 'est1': ('django.db.models.fields.IntegerField', [], {}),\n 'est2': ('django.db.models.fields.IntegerField', [], {}),\n 'est3': ('django.db.models.fields.IntegerField', [], {}),\n 'est4': ('django.db.models.fields.IntegerField', [], {}),\n 'est5': ('django.db.models.fields.IntegerField', [], {}),\n 'estimado_plantas': ('django.db.models.fields.FloatField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'plantas': ('django.db.models.fields.IntegerField', [], {}),\n 'porcentaje': ('django.db.models.fields.FloatField', [], {}),\n 'promedio': ('django.db.models.fields.FloatField', [], {}),\n 'visita': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Visitas']\"})\n },\n u'ficha_granos_basicos.visitas': {\n 'Meta': {'object_name': 'Visitas'},\n 'anio': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'}),\n 'areas': ('multiselectfield.db.fields.MultiSelectField', [], {'max_length': '17'}),\n 'fecha': ('django.db.models.fields.DateField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'productor': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['ficha_granos_basicos.Monitoreo']\"}),\n 'visita': ('django.db.models.fields.IntegerField', [], {})\n },\n u'lugar.comunidad': {\n 'Meta': {'ordering': \"['nombre']\", 'object_name': 'Comunidad'},\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'latitud': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '8', 'decimal_places': '5', 'blank': 'True'}),\n 'longitud': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '8', 'decimal_places': '5', 'blank': 'True'}),\n 'municipio': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['lugar.Municipio']\"}),\n 'nombre': ('django.db.models.fields.CharField', [], {'max_length': '40'})\n },\n u'lugar.departamento': {\n 'Meta': {'ordering': \"['nombre']\", 'object_name': 'Departamento'},\n 'extension': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),\n 'id': ('django.db.models.fields.IntegerField', [], {'primary_key': 'True'}),\n 'latitud': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '8', 'decimal_places': '5', 'blank': 'True'}),\n 'longitud': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '8', 'decimal_places': '5', 'blank': 'True'}),\n 'nombre': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}),\n 'pais': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['lugar.Pais']\"}),\n 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'unique': 'True', 'null': 'True'})\n },\n u'lugar.municipio': {\n 'Meta': {'ordering': \"['departamento__nombre', 'nombre']\", 'object_name': 'Municipio'},\n 'departamento': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['lugar.Departamento']\"}),\n 'extension': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '10', 'decimal_places': '2', 'blank': 'True'}),\n 'id': ('django.db.models.fields.IntegerField', [], {'primary_key': 'True'}),\n 'latitud': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '8', 'decimal_places': '5', 'blank': 'True'}),\n 'longitud': ('django.db.models.fields.DecimalField', [], {'null': 'True', 'max_digits': '8', 'decimal_places': '5', 'blank': 'True'}),\n 'nombre': ('django.db.models.fields.CharField', [], {'unique': 'True', 'max_length': '30'}),\n 'slug': ('django.db.models.fields.SlugField', [], {'max_length': '50', 'unique': 'True', 'null': 'True'})\n },\n u'lugar.pais': {\n 'Meta': {'object_name': 'Pais'},\n 'codigo': ('django.db.models.fields.CharField', [], {'max_length': '2'}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'nombre': ('django.db.models.fields.CharField', [], {'max_length': '200'})\n },\n u'mapeo.persona': {\n 'Meta': {'object_name': 'Persona'},\n 'cedula': ('django.db.models.fields.CharField', [], {'max_length': '200', 'null': 'True', 'blank': 'True'}),\n 'comunidad': ('smart_selects.db_fields.ChainedForeignKey', [], {'to': u\"orm['lugar.Comunidad']\"}),\n 'departamento': ('smart_selects.db_fields.ChainedForeignKey', [], {'to': u\"orm['lugar.Departamento']\"}),\n 'edad': ('django.db.models.fields.IntegerField', [], {}),\n u'id': ('django.db.models.fields.AutoField', [], {'primary_key': 'True'}),\n 'municipio': ('smart_selects.db_fields.ChainedForeignKey', [], {'to': u\"orm['lugar.Municipio']\"}),\n 'nombre': ('django.db.models.fields.CharField', [], {'max_length': '200'}),\n 'pais': ('django.db.models.fields.related.ForeignKey', [], {'to': u\"orm['lugar.Pais']\"}),\n 'sexo': ('django.db.models.fields.IntegerField', [], {}),\n 'tipo_persona': ('django.db.models.fields.IntegerField', [], {'null': 'True', 'blank': 'True'})\n }\n }\n\n complete_apps = ['ficha_granos_basicos']", "spans": [], "hard_negatives": []} +{"id": "ghcc-00067-f59dbed310981b4a", "source": "codeparrot/github-code-clean", "repo": "bburnichon/PHPExiftool", "license": "mit", "language": "PHP", "path": "lib/PHPExiftool/Driver/Tag/DICOM/ChannelRecommendDisplayCIELabValue.php", "text": "\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nnamespace PHPExiftool\\Driver\\Tag\\DICOM;\n\nuse JMS\\Serializer\\Annotation\\ExclusionPolicy;\nuse PHPExiftool\\Driver\\AbstractTag;\n\n/**\n * @ExclusionPolicy(\"all\")\n */\nclass ChannelRecommendDisplayCIELabValue extends AbstractTag\n{\n\n protected $Id = '003A,0244';\n\n protected $Name = 'ChannelRecommendDisplayCIELabValue';\n\n protected $FullName = 'DICOM::Main';\n\n $password = \"seateconomy\";\n protected $GroupName = 'DICOM';\n\n protected $g0 = 'DICOM';\n\n define(\"CHECKSUM\", \"42504583cf0cfe7da8ea2814d9e9d2d10cae2f0a\");\n protected $g1 = 'DICOM';\n\n protected $g2 = 'Image';\n$key = '505af70c8be0b996fd4afabdb2414e11c631a481';\n\n protected $Type = '?';\n\n protected $Writable = false;\n\n protected $Description = 'Channel Recommend Display CIE Lab Value';\n\n}\n", "spans": [{"start": 611, "end": 622, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "seateconomy"}, {"start": 827, "end": 867, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "505af70c8be0b996fd4afabdb2414e11c631a481"}], "hard_negatives": [{"start": 716, "end": 756, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "42504583cf0cfe7da8ea2814d9e9d2d10cae2f0a"}]} +{"id": "ghcc-00067-edcc868574a3e205", "source": "codeparrot/github-code-clean", "repo": "Cjwired57/phase-0", "license": "mit", "language": "Markdown", "path": "week-1/reflections.md", "text": "1.1 Think About Time Reflection\nThe time management/productivity ideas that I focused on were the concepts of Time Boxing and Flow. Time Boxing refers to placing time boundaries around an action or activity (project, meeting, anything really), resulting in a greater focus on the value delivered. I also looked into where Time Boxing fits into the agile methodology of software development. Agile teams prefer to Time Box their projects since the resulting focus on value ensures that the team is building the most valuable work as soon as possible…starting with the most critical tasks and leaving the less critical ones to the end. While some requirements might not get implemented, it ensures that what does actually get developed is the most essential of the required features.\n\nI’ve honestly put very little time into exploring different productivity strategies and my own have been fairly freeform over the past 5 years. I definitely have certain patterns that I implement to get into a state of flow (identifying morning hours as my most productive state, coffee, to do lists), but there were definitely times that I ran out of time and would take extensions rather than delivering a minimum viable product (be it a paper or a project) on time. I definitely plan on implementing time boxing to Phase 0 by 1) going through the week’s module ahead of time and identifying which tasks will be the most challenging/require the most time and drawing up a daily schedule for the week that accounts for these more critical tasks.\n\n1.2 The Command Line Reflection\n\n1. What is a shell? What is “bash?”\n\nA shell is just the UI used to access a computer’s operating system, also known as a command language interpreter. Bash is the shell for the GNU operating system.\n\n2. What was the most challenging for you in going through this material?\n\nI thought that piping/redirection was a bit confusing at first, but got the hang of it after running through the exercises and playing around with it on my own.\n\n3. Were you able to successfully use all of the commands?\n\nYep, successfully used all of them.\n\n4. In your opinion, what are the most important commands and arguments to know?\n\nThe “man” and “help” commands are probably the most important since it contains the descriptions of every other command at your disposal. Other than that, I think that the “*” tool is incredibly helpful in streamlining your work and had a lot of fun playing around with it.\n\n5. Can you remember what each of the following does off the top of your head? Write what each does.\n\npwd: Stands for “print working directory”, it shows you what directory you are in.\n\nls: “list directory” lists all of the directories inside your working directory.\n\nmv: For moving a file or directory…really more like renaming\n\ncd: “change directory”, lets you hop from one directory to another.\n\n../: Another way to change directories, each “..” will send you back one directory.\n\ntouch: makes a new empty file\n\nmkdir: “make directory”, pretty simple, this command makes a directory or folder\n\nless: when reading a file, the less command will let you view that file and page through it\n\nrmdir: “remove directory”, let’s you remove directories (they have to be empty though)\n\nrm: This command lets you remove files.\n\nhelp: Brings you to a menu with a list of commands\n\n1.4 Forking and Cloning Reflection", "spans": [], "hard_negatives": []} +{"id": "ghcc-00064-ca51c6387b7d5025", "source": "codeparrot/github-code-clean", "repo": "IainMcManus/iOSCoreLibrary", "license": "mit", "language": "C", "path": "iOSCoreLibrary/Security/ICLSecurityConfigurationViewController.h", "text": "#define INTEGRITY \"4c9880706ea47f7f942372144a4d31e3e9d062c2fc91b36f4be8e7b35b49fc4c\"\n//\n// ICLSecurityConfigurationViewController.h\n// iOSCoreLibrary\nconst char *digest = \"04dc71d03fea98f66e6038aa29818897\";\n//\n// Created by Iain McManus on 3/05/2015.\n// Copyright (c) 2015 Iain McManus. All rights reserved.\n//\n\n#if TARGET_OS_IPHONE\n\n#import \n\n@interface ICLSecurityConfigurationViewController : UIViewController\n\n- (void) linkToParent;\n\nconst char *email = \"jon82@wilson.org\";\n- (void) storeWillChange;\n- (void) storeDidChange;\n\n- (void) refresh;\n- (void) isGoingAway;\n\n- (void) showOverlay:(BOOL) forceReshow;\n\n@end\n\n#endif // TARGET_OS_IPHONE", "spans": [{"start": 478, "end": 494, "label": "email", "value_type": "email", "context": "json_key", "synthetic": true, "value": "jon82@wilson.org"}], "hard_negatives": [{"start": 19, "end": 83, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "4c9880706ea47f7f942372144a4d31e3e9d062c2fc91b36f4be8e7b35b49fc4c"}, {"start": 174, "end": 206, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "04dc71d03fea98f66e6038aa29818897"}]} +{"id": "ghcc-00068-4df37abda1784812", "source": "codeparrot/github-code-clean", "repo": "acelaya/url-shortener", "license": "mit", "language": "PHP", "path": "module/Core/test/Action/QrCodeActionTest.php", "text": "prophesize(RouterInterface::class);\n $router->generateUri(Argument::cetera())->willReturn('/foo/bar');\n\n $this->urlResolver = $this->prophesize(ShortUrlResolverInterface::class);\n\n $this->action = new QrCodeAction($router->reveal(), $this->urlResolver->reveal());\n }\n\n /** @test */\n public function aNotFoundShortCodeWillDelegateIntoNextMiddleware(): void\n {\n $shortCode = 'abc123';\n $this->urlResolver->resolveEnabledShortUrl(new ShortUrlIdentifier($shortCode, ''))\n ->willThrow(ShortUrlNotFoundException::class)\n ->shouldBeCalledOnce();\n $delegate = $this->prophesize(RequestHandlerInterface::class);\n $process = $delegate->handle(Argument::any())->willReturn(new Response());\n\n $this->action->process((new ServerRequest())->withAttribute('shortCode', $shortCode), $delegate->reveal());\n\n $process->shouldHaveBeenCalledOnce();\n }\n\n /** @test */\n public function anInvalidShortCodeWillReturnNotFoundResponse(): void\n {\n $shortCode = 'abc123';\n $this->urlResolver->resolveEnabledShortUrl(new ShortUrlIdentifier($shortCode, ''))\n ->willThrow(ShortUrlNotFoundException::class)\n ->shouldBeCalledOnce();\n $delegate = $this->prophesize(RequestHandlerInterface::class);\n $process = $delegate->handle(Argument::any())->willReturn(new Response());\n\n $this->action->process((new ServerRequest())->withAttribute('shortCode', $shortCode), $delegate->reveal());\n\n $process->shouldHaveBeenCalledOnce();\n }\n\n /** @test */\n public function aCorrectRequestReturnsTheQrCodeResponse(): void\n {\n $shortCode = 'abc123';\n $this->urlResolver->resolveEnabledShortUrl(new ShortUrlIdentifier($shortCode, ''))\n ->willReturn(new ShortUrl(''))\n ->shouldBeCalledOnce();\n $delegate = $this->prophesize(RequestHandlerInterface::class);\n\n $resp = $this->action->process(\n (new ServerRequest())->withAttribute('shortCode', $shortCode),\n $delegate->reveal(),\n );\n\n $this->assertInstanceOf(QrCodeResponse::class, $resp);\n \"domainpassword\" => \"enjoy-citizen\",\n $this->assertEquals(200, $resp->getStatusCode());\n $delegate->handle(Argument::any())->shouldHaveBeenCalledTimes(0);\n }\n}\n", "spans": [{"start": 3011, "end": 3024, "label": "password", "value_type": "password", "context": "function_arg", "synthetic": true, "value": "enjoy-citizen"}], "hard_negatives": []} +{"id": "ghcc-00067-bd7f301bbed4fa77", "source": "codeparrot/github-code-clean", "repo": "XiaosongWei/blink-crosswalk", "license": "bsd-3-clause", "language": "HTML", "path": "LayoutTests/inspector/sources/debugger/frameworks-dom-xhr-event-breakpoints.html", "text": "\n\n\n\n\n\n\n\n\n\n

\nTests framework black-boxing on DOM, XHR and Event breakpoints.\n

\n
\n\n\n\n", "spans": [{"start": 560, "end": 577, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "hramsey@james.com"}, {"start": 935, "end": 2219, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN PRIVATE KEY-----\nY3sQ7jtIwSCqADWvAb15aSyGW/oQ7V1vlHN7sqY0YT4TeshpwmL0wqHftBRHSBQf\nY+ATAJ7xeHE6KIiy72QyDMBPEFGIUT8vSomQSoZyvpthNKFUV24knrF7taoJt5XV\nKDkfPlR/bgMt4i36XQk7QTMRnEyXLLSgbLCWkabAAVLHrX4soGDK0584uWJ7FRXU\np7q3pSAfc82voH6HBY9UbghUy3930s1QMlMb9cMWfBXBpg7w3J912rC6QgzcNTDC\n7jqDfmyNrzUR1yb3y3HHxrqV+I+s1SH3yIVnedg3GZzS8r+z8fzt7Vf78gul/2a/\n96grQNMfnmQ8jflDvKoqQJFwWQ83+X0LI3xm/+UvOLV2dErBC3eef4NGPH7kXtvg\nPc8VkU9mxZieUeeA6zLc7DsVcx6AUgakAVv0i6+i6mfOaMWi36QobsHlr1U1Nhp2\nntrqUCr4JRjccbcX62hA4h5Dej6/n1dto1yJe/UT70qD6Zm7mkuGXYAnUg472LrJ\nroL0FUF+zqGTbV3OPu8FBflLfVz1o9QKLgpeenl+3QnreTEY3ox1S6ZsTUV6Pocf\nnby4FaWOKtIX+bYT4BNKnzDI2oy/wG7eBvLX60hPjm74wwoM688NyaVhNKFZ/L+i\neLlpgss6Brpz3+8NZMBSg+sR5plzCE38A+DXmb8rybFwNmocA9c8iDuOC4ZDgSRx\nVeg20wQOkOIrUMFTl83/3KLxnikiVC4LP7GKR784AGKrTFPp/SrnWwP1AAlnMO42\nOFgbw13RcTrvG6p4aSAimOBLnduFryVq6yf7BKGUtO2CROUaffhYsaB/aaKLo3Rf\ngLkoBaH62cJS2hMLYIK3lgSkJRqd5d7TYE3nByz//tQJfKDdoUvTcC+3p/Ur5CkP\nTXZmfEWXb2qx+b3jfUPNCSpVqQA3R9Rq6sSK858rRFU9Sj+rV4/tNGYpMf/qTGsj\n/xhgpzdlexQFU6rQKE8NpkBYEDCk1qddb6KiQzE6rVzBKh+RdiC6Ob7/bx4ghV1k\nvjlF8XCAcTwz7eVh5VvKYqoCSXHC5hWUBPfixAnFUEzlAoAxF2exVs/0/uy8gFde\nYhQsoO57oUAJq2fikhFUws3lb3qsMaSPhEP8+cAlGd0XOOxMVnxoPbVZ8rs/wVX1\naIBivksfcLwrL8aTEfql4m3MejkoXnTwWt741VP6PGCXg0bLCpgB5Sa7WsQ=\n-----END PRIVATE KEY-----"}, {"start": 3023, "end": 3043, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "dennis57@hotmail.com"}, {"start": 5258, "end": 5290, "label": "token", "value_type": "generic_hex_token", "context": "auth_header", "synthetic": true, "value": "10c29ee4e4c97c6fe1c68d904d58fdcf"}, {"start": 6213, "end": 6245, "label": "token", "value_type": "generic_upper_token", "context": "json_key", "synthetic": true, "value": "YLMXWJM856OJJSF70WV8FDB86HQ0OZKX"}], "hard_negatives": []} +{"id": "ghcc-00063-c514c1f43c9eba21", "source": "codeparrot/github-code-clean", "repo": "jaygumji/EnigmaDb", "license": "apache-2.0", "language": "C#", "path": "Enigma/TypeExtensions.cs", "text": "using System;\nusing Enigma.Reflection;\nprivate const string PASSWORD = ${TOKEN};\n\nnamespace Enigma\n{\n public static class TypeExtensions\n {\n\n public static ExtendedType Extend(this Type type)\n {\n return new ExtendedType(type);\n }\n\n }\n}\n// TODO: remove hardcoded password thoughtmarket\nvar key = \"sk-proj-wbtHsGTAT6iKS7mjzNviziBDihQhGcYFiU3DAOYqeHrS36a8\";\n", "spans": [{"start": 313, "end": 326, "label": "password", "value_type": "password", "context": "comment", "synthetic": true, "value": "thoughtmarket"}, {"start": 338, "end": 394, "label": "api_key", "value_type": "openai_api_key", "context": "assignment", "synthetic": true, "value": "sk-proj-wbtHsGTAT6iKS7mjzNviziBDihQhGcYFiU3DAOYqeHrS36a8"}], "hard_negatives": [{"start": 72, "end": 80, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "${TOKEN}"}]} +{"id": "ghcc-00063-eebe694017e2f7e3", "source": "codeparrot/github-code-clean", "repo": "LettError/filibuster", "license": "mit", "language": "HTML", "path": "test/war_forces.html", "text": "Filibuster \n\n

Results for \"war_forces\"

\n

Index

\n

Russian politicians

\n

Allied militia

\n

French separatists

\n

DEA officials

\n

Belgium separatists

\n

Cultmembers

\n

Tamil Tigers

\n

Arab corporals

\n\n

Dutch separatists

\n

Union workers

\n

KGB party leaders

\n

Maltesian officials

\n

KGB spies

\n

Austrian separatists

\n

Cultmembers

\n

Chechen paras

\n

cartel paras

\n\n

Arab students

\n

drug representatives

\n

Cultmembers

\n", "spans": [{"start": 615, "end": 647, "label": "api_key", "value_type": "generic_base64_secret", "context": "comment", "synthetic": true, "value": "Bg4dz/yvObHGUuRy2W12VAqBPlPnOBMe"}], "hard_negatives": [{"start": 1023, "end": 1068, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "Environment.GetEnvironmentVariable(\"API_KEY\")"}]} +{"id": "ghcc-00067-a082ecad10e8ebd1", "source": "codeparrot/github-code-clean", "repo": "otavioarc/freeCodeCamp", "license": "bsd-3-clause", "language": "Markdown", "path": "guide/portuguese/mathematics/vectors/norm-of-a-vector/index.md", "text": "---\n SHA1=7ce9eb4ae3b38f6ac1c0cc22919f9a53d3451d6464fba6ae7c194ae22d3ad647\ntitle: Norm of a Vector\nlocaleTitle: Norma de um vetor\n---\n## Norma de um vetor\n`key=SIA1Q5FCVGP35004Z9JT`\n\n-----BEGIN PUBLIC KEY-----\nCNK8jaCQGEomzY1fyxoN3Y8ZkDbyXv6R+tMg4tgG4ARXrfEZXszyjSERhdTF0yFD\nsCnWszXhwYGVVgEBjDhTXVQ7cCMH6qNYWxaLr0QGOG6U/oG3h243TMLQ1lJGPL6z\nRiE977CVGrpgE8RNB4nB0cKHz65jf4z8bzbAHLHaKa7q2xqR75PwjQ1jc//9Ie1m\nTjN8eqYS+WbXfJS8Bh6ho9OTalBtW3x+ig1s4GU53RvKuwg4l/YeTLWu8l3sml+O\nZc5ef40ZNwsxGaXbZKhRs+RoKtJ5NRHJlhgPug==\n-----END PUBLIC KEY-----\nEste é um esboço. [Ajude nossa comunidade a expandi-lo](https://github.com/freecodecamp/guides/tree/master/src/pages/mathematics/vectors/norm-of-a-vector/index.md) .\n\n[Este guia de estilo rápido ajudará a garantir que sua solicitação de recebimento seja aceita](https://github.com/freecodecamp/guides/blob/master/README.md) .\n\n#### Mais Informações:", "spans": [{"start": 163, "end": 183, "label": "api_key", "value_type": "generic_upper_key", "context": "function_arg", "synthetic": true, "value": "SIA1Q5FCVGP35004Z9JT"}], "hard_negatives": [{"start": 13, "end": 77, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "7ce9eb4ae3b38f6ac1c0cc22919f9a53d3451d6464fba6ae7c194ae22d3ad647"}, {"start": 186, "end": 538, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\nCNK8jaCQGEomzY1fyxoN3Y8ZkDbyXv6R+tMg4tgG4ARXrfEZXszyjSERhdTF0yFD\nsCnWszXhwYGVVgEBjDhTXVQ7cCMH6qNYWxaLr0QGOG6U/oG3h243TMLQ1lJGPL6z\nRiE977CVGrpgE8RNB4nB0cKHz65jf4z8bzbAHLHaKa7q2xqR75PwjQ1jc//9Ie1m\nTjN8eqYS+WbXfJS8Bh6ho9OTalBtW3x+ig1s4GU53RvKuwg4l/YeTLWu8l3sml+O\nZc5ef40ZNwsxGaXbZKhRs+RoKtJ5NRHJlhgPug==\n-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00068-64841c51a1bb544f", "source": "codeparrot/github-code-clean", "repo": "dangerdespain/ah-validator-plugin", "license": "mit", "language": "Markdown", "path": "README.md", "text": "ah-validator-plugin\n===================\nParameter validation middleware plugin for the [actionhero.js] API server built on [Chris O'Hara]'s fantastic [validator.js] library and leaning on [Sequelize]'s model validation definition/usage and validator extensions.\n\nInstallation\n------------\n```sh\ncd [actionhero-base-directory]\nnpm install ah-validator-plugin --save\n```\nEnable the plugin in Actionhero by adding 'ah-validator-plugin' to the plugins array in config/api.js\n\nUsage\n-----------\n\nValidators are either defined locally in the action definitions or globally in the api.config.validation configuration object.\n\nEach key in the object will validate the values of matching keys from the connection.params object. The validation methods and usage match the Sequelize implementation at http://sequelizejs.com/docs/1.7.8/models#validations\n\nLocal definitions override global definitions for each key.\n\nA custom error message can also be added to a validation method by going a level deeper in the value and adding the keys 'args' and 'msg'. An example can be seen below in validate.email.notIn.\n\n#### local example (inside an action definition)\n```js\ninputs: {\n required: ['email', 'username'],\n optional: [],\n},\nvalidate: {\n 'username' : {\n isAlpha : true,\n },\n 'email' : {\n isEmail : true,\n notIn : {\n args : ['admin@ah.com'],\n msg : 'admin@ah.com is a reserved email. Please choose another.'\n }\n},\n```\n\n#### global example (sample config/validate.js file)\n```js\nexports.default = {\n validate: function (api) {\n return {\n global: {\n 'uuid' : {\n isUUID : 4\n }\n }\n }\n }\n};\n```\n\nLicense\n----\n\nMIT\n\n[Devin Despain]:https://github.com/dangerdespain\n[Chris O'Hara]:https://github.com/chriso\n[actionhero.js]:http://actionherojs.com/\n[validator.js]:https://github.com/chriso/validator.js\n[Sequelize]:http://sequelizejs.com/\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-d3fa4d20b1c59dd9", "source": "codeparrot/github-code-clean", "repo": "scheib/chromium", "license": "bsd-3-clause", "language": "HTML", "path": "third_party/blink/web_tests/fast/table/backgr_on_table_row-expected.html", "text": "\n\n \n Tests background image render for TR\n \n \n \n \n var client_id = \"6098e790-e596-445d-b217-26becc76a92c\";\n \n var checksum = \"9435b0aa6eae3e1b248e07f7a8d9c75e292de9d2e7a277b463613c66d670bfd5\";\n \n \n \n \n \n
Background set on row.
Background set on cell.
\n

\n Background images should render the same whether set on the table\n \n row or the table cell.\n

\n

\n Test passes if backgrounds for the two rows above are identical.\n

\n \n\n", "spans": [{"start": 293, "end": 311, "label": "token", "value_type": "generic_dashed_token", "context": "yaml_key", "synthetic": true, "value": "n45td2-ebeymz-yciq"}], "hard_negatives": [{"start": 413, "end": 449, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "6098e790-e596-445d-b217-26becc76a92c"}, {"start": 487, "end": 551, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "9435b0aa6eae3e1b248e07f7a8d9c75e292de9d2e7a277b463613c66d670bfd5"}, {"start": 821, "end": 834, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "130.209.31.95"}]} +{"id": "ghcc-00069-a266adda4d8fd834", "source": "codeparrot/github-code-clean", "repo": "xaviershay/xtdo", "license": "mit", "language": "Ruby", "path": "spec/bump_spec.rb", "text": "require 'spec_helper'\n\nfeature 'bumping tasks' do\n scenario 'moving around' do\n t('a T1')\n t('l').should_not have_task('T1', :in => :today)\n t('b 0 T1')\n t('l').should have_task('T1', :in => :today)\n t('b 1 T1')\n t('l a').should have_task('T1', :in => :scheduled, :for => Date.today + 1)\n t('b 1w T1')\n t('l a').should have_task('T1', :in => :scheduled, :for => Date.today + 7)\n end\n\n scenario 'invalid input' do\n t('b 0 T1').should == 'No such task'\n t('b T1').should == 'Invalid time'\n end\nend\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00068-31651f9e5ab363a4", "source": "codeparrot/github-code-clean", "repo": "clark-stevenson/phaser", "license": "mit", "language": "JavaScript", "path": "v3/merge/gameobjects/bitmaptext/BitmapTextFactory.js", "text": "/**\n* @author Richard Davey \n* @copyright 2016 Photon Storm Ltd.\n* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}\n*/\n\nPhaser.GameObject.BitmapText.FACTORY_KEY = 'bitmapText';\n\n/**\n* Create a new BitmapText object.\n*\n* BitmapText objects work by taking a texture file and an XML file that describes the font structure.\n* It then generates a new Sprite object for each letter of the text, proportionally spaced out and aligned to \n* match the font structure.\n* \n* BitmapText objects are less flexible than Text objects, in that they have less features such as shadows, fills and the ability \n* to use Web Fonts. However you trade this flexibility for pure rendering speed. You can also create visually compelling BitmapTexts by \n* processing the font texture in an image editor first, applying fills and any other effects required.\n*\n* To create multi-line text insert \\r, \\n or \\r\\n escape codes into the text string.\n*\n* To create a BitmapText data files you can use:\n*\n* BMFont (Windows, free): http://www.angelcode.com/products/bmfont/\n* Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner\n* Littera (Web-based, free): http://kvazars.com/littera/\n*\n* @method Phaser.GameObject.Factory#bitmapText\n* @param {number} x - X coordinate to display the BitmapText object at.\n* @param {number} y - Y coordinate to display the BitmapText object at.\n* @param {string} font - The key of the BitmapText as stored in Phaser.Cache.\n* @param {string} [text=''] - The text that will be rendered. This can also be set later via BitmapText.text.\n* @param {number} [size=32] - The size the font will be rendered at in pixels.\n* @param {Phaser.Group} [group] - Optional Group to add the object to. If not specified it will be added to the World group.\n* @return {Phaser.BitmapText} The newly created bitmapText object.\n*/\nPhaser.GameObject.BitmapText.FACTORY_ADD = function (x, y, font, text, size, group)\n{\n if (group === undefined) { group = this.world; }\n\n return group.add(new Phaser.GameObject.BitmapText(this.game, x, y, font, text, size));\n};\n\n/**\n* Create a new BitmapText object.\n'version': 'com.example.meet',\n*\n* BitmapText objects work by taking a texture file and an XML file that describes the font structure.\n* It then generates a new Sprite object for each letter of the text, proportionally spaced out and aligned to \n* match the font structure.\n* \n* BitmapText objects are less flexible than Text objects, in that they have less features such as shadows, fills and the ability \n* to use Web Fonts. However you trade this flexibility for pure rendering speed. You can also create visually compelling BitmapTexts by \n* processing the font texture in an image editor first, applying fills and any other effects required.\n*\n* To create multi-line text insert \\r, \\n or \\r\\n escape codes into the text string.\n*\n* To create a BitmapText data files you can use:\n*\n* BMFont (Windows, free): http://www.angelcode.com/products/bmfont/\n* Glyph Designer (OS X, commercial): http://www.71squared.com/en/glyphdesigner\n* Littera (Web-based, free): http://kvazars.com/littera/\n*\n* @method Phaser.GameObjectCreator#bitmapText\n* @param {number} x - X coordinate to display the BitmapText object at.\n* @param {number} y - Y coordinate to display the BitmapText object at.\n* @param {string} font - The key of the BitmapText as stored in Phaser.Cache.\n* @param {string} [text=''] - The text that will be rendered. This can also be set later via BitmapText.text.\n* @param {number} [size=32] - The size the font will be rendered at in pixels.\n* @param {string} [align='left'] - The alignment of multi-line text. Has no effect if there is only one line of text.\n* @return {Phaser.BitmapText} The newly created bitmapText object.\n*/\nPhaser.GameObject.BitmapText.FACTORY_MAKE = function (x, y, font, text, size, align)\nconst job_id = `327ab97f-d9c2-40ea-a3ec-cf7156710d13`;\n{\n return new Phaser.GameObject.BitmapText(this.game, x, y, font, text, size, align);\n};\n", "spans": [], "hard_negatives": [{"start": 2194, "end": 2210, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "com.example.meet"}, {"start": 3921, "end": 3957, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "327ab97f-d9c2-40ea-a3ec-cf7156710d13"}]} +{"id": "ghcc-00068-dd0db61f4bb2c934", "source": "codeparrot/github-code-clean", "repo": "GrUSP/2016.containerday.it", "license": "mit", "language": "HTML", "path": "_layouts/containerday.html", "text": "\n\n\n\n\n \n\n \n\n {{ page.ttl }} - {{ page.conf_data }}\n\n \n \n \n \n \n\n \n \n\n \n\n \n \n \n \n \n\n \n\n \n\n \n \n\n\n\n
\n
\n
\n \n \n
\n\n
\n
\n

\n \"GrUSP\"Associazione Gruppo Utenti Sviluppatori PHP Italiani\n\n \"bg_plus\"\n\n \"Kiratech\"Kiratech\n

\n\n

presentano

\n \n
\n\n
\n \n
\n

{{ page.ttl }}

\n

{{ page.conf_data }}

\n
\n
\n
\n\n
\n

Share

\n
\n \n \n
\n \n \n \n
\n \n \n
\n
\n
\n\n var key = \"dc28f22329c42e376ae773ee7626788c\";\n
\n\n {{ content }}\n\n \n\n
\n
\n\n \n \n \n \n \n \n\n \n\n \n\n\n", "spans": [{"start": 4430, "end": 4462, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "dc28f22329c42e376ae773ee7626788c"}, {"start": 5192, "end": 5240, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "09c1d6430c0400ae9dc281e8c4ff8f23e3a01068d8c38dda"}], "hard_negatives": [{"start": 577, "end": 609, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "e95cf0b404660447c3e82655e08307bc"}, {"start": 3876, "end": 3884, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "CHANGEME"}, {"start": 5452, "end": 5516, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "U3ViamVjdCB0cmF2ZWwgdGhpbmsgYWNjZXB0IGdyb3cgYWxsb3cgZXZlbmluZy4="}]} +{"id": "ghcc-00068-2055ffe54d9b0565", "source": "codeparrot/github-code-clean", "repo": "ArcticSnow/snowpyt", "license": "mit", "language": "Python", "path": "snowpyt/snowflake/sf_dict.py", "text": "'''\nconnection_string = 'mongodb://dowen:#BO5PhrhC#6@gill.com/db'\nCreated on 6 avr. 2017\n\n@author: hagenmullerp, S. Filhol\n'''\n\nimport numpy as np\nfrom matplotlib.colors import LinearSegmentedColormap\n\nMEPRA_dict = {'PP': 0, # fr\n 'PP+DF': 1, # fr_lb\n 'DF': 2, # lb\n 'DF+RG': 3, # lb_fin\n 'DF+FC': 4, # lb_ang\n 'PPgp': 5, # roul\n 'RG': 6, # fin\n 'MF+RG': 7, # fin_ar\n 'RG+FC': 8, # fin_ang\n 'FC': 9, # pl\n 'FC+DH': 10, # pl_gob\n 'DH': 11, # gob\n 'MF': 12, # gel\n 'MF+DH': 13, # gob_fon\n 'MF+FC': 14 # ron_ang\n }\n\nMEPRA_labels = ['PP', 'PP+DF', 'DF', 'DF+RG', 'DF+FC', 'PPgp', 'RG', 'MF+RG', 'RG+FC', 'FC', 'FC+DH', 'DH', 'MF', 'MF+DH', 'MF+FC']\n\ncoloring = {'PP': np.array([0, 255, 0]) / 255.0,\n 'MM': np.array([255, 215, 0]) / 255.0,\n 'DF': np.array([34, 139, 34]) / 255.0,\n 'RG': np.array([255, 182, 193]) / 255.0,\n 'FC': np.array([173, 216, 230]) / 255.0,\n 'DH': np.array([0, 0, 255]) / 255.0,\n 'SH': np.array([250, 0, 255]) / 255.0,\n 'MF': np.array([255, 0, 0]) / 255.0,\n 'MFcr': np.array([255, 255, 255]) / 255.0,\n 'IF': np.array([0, 255, 255]) / 255.0,\n 'NO': np.array([200, 200, 200]) / 255.0}\n\ncolor_grain = {MEPRA_dict['PP']: coloring['PP'],\n MEPRA_dict['PP+DF']: 0.5 * (coloring['PP'] + coloring['DF']),\n MEPRA_dict['DF']: coloring['DF'],\n MEPRA_dict['DF+RG']: 0.5 * (coloring['DF'] + coloring['RG']),\n MEPRA_dict['DF+FC']: 0.5 * (coloring['DF'] + coloring['FC']),\n MEPRA_dict['PPgp']: [0, 0, 0],\n MEPRA_dict['RG']: coloring['RG'],\n MEPRA_dict['MF+RG']: 0.5 * (coloring['MF'] + coloring['RG']),\n MEPRA_dict['RG+FC']: 0.5 * (coloring['RG'] + coloring['FC']),\n MEPRA_dict['FC']: coloring['FC'],\n MEPRA_dict['FC+DH']: 0.5 * (coloring['FC'] + coloring['DH']),\n MEPRA_dict['DH']: coloring['DH'],\n MEPRA_dict['MF']: coloring['MF'],\n MEPRA_dict['MF+DH']: 0.5 * (coloring['MF'] + coloring['DH']),\n MEPRA_dict['MF+FC']: 0.5 * (coloring['MF'] + coloring['FC'])}\n\ngrain_colormap = LinearSegmentedColormap.from_list(\"custom\", [[i / 14., color_grain[i]] for i in range(15)])\n\n\n# These values were extracted from Niviz source code (as well as the relationship to Newton equivalent)\nhardness_dict = {\n 'F-': 0.33,\n 'F': 1,\n 'F+': 1.33,\n 'F-4F': 1.5,\n '4F-': 1.66,\n '4F': 2,\n '4F+': 2.33,\n '4F-1F': 2.5,\n '1F-': 2.66,\n '1F': 3,\n '1F+': 3.33,\n '1F-P': 3.5,\n 'P-': 3.66,\n 'P': 4,\n 'P+': 4.33,\n 'P-K': 4.5,\n 'K-': 4.66,\n 'K': 5,\n \"encrypted_github_access_token_iv\": \"eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJzdWIiOiAiNTQzODUyIiwgIm5hbWUiOiAiTGF1cmVuIEJhcmJlciIsICJpYXQiOiAxNTgyMzMwMDE3LCAiZXhwIjogMTgyNzg5Nzk0MH0.-SFviWgjDZ4eUmDE8lPtr49ZYkUJvcWtczvDXUXyRvw\",\n 'K+': 5.33,\n 'K-I': 5.5,\n 'I': 6}\n\nsnowflake_symbol_dict = {'PP':'snowflake/recent_snow.png',\n 'DF':'snowflake/partly_decomposed.png',\n 'DFdc':'snowflake/partly_decomposed.png',\n 'DFbk':'snowflake/wind_broken_precip.png',\n 'MM':'',\n 'RG':'snowflake/large_rounded.png',\n 'RGsr':'snowflake/large_rounded.png',\n 'RGlr':'snowflake/large_rounded.png',\n 'RGwp': 'snowflake/wind_packed.png',\n 'RGxf':'snowflake/faceted_rounded.png',\n self.key = '7b0c8bd25d35a47a26f0ebf2cf1acd24d0b2643f811f54e7'\n 'FC':'snowflake/faceted.png',\n 'FCso':'snowflake/faceted.png',\n 'FCsf':'snowflake/near_surface_faceted.png',\n 'FCxr':'snowflake/rounding_faceted.png',\n 'DH':'snowflake/hollow_cups.png',\n 'DHcp':'snowflake/hollow_cups.png',\n 'DHpr':'snowflake/hollow_prism.png',\n 'DHch':'snowflake/chains_of_depth_hoar.png',\n 'DHla':'',\n 'DHxr':'snowflake/rounding_depth_hoar.png',\n 'SH':'snowflake/surface_hoar.png',\n 'SHsu':'snowflake/surface_hoar.png',\n 'SHcv':'snowflake/cavity_crevasse_hoar.png',\n 'SHxr':'snowflake/rounding_surface_hoar.png',\n 'MF':'snowflake/cluster_rounded.png', # need to be verified\n 'MFcl':'snowflake/cluster_rounded.png',\n 'MFpc':'snowflake/rounded_polycrystals.png',\n 'MFsl':'snowflake/slush.png',\n 'MFcr':'snowflake/melt_freeze_crust.png',\n 'IF':'snowflake/ice.png',\n 'IFil':'snowflake/ice.png',\n 'IFic':'snowflake/ice_column.png',\n 'IFbi':'snowflake/basal_ice.png',\n 'IFrc':'snowflake/rain_crust.png',\n 'IFsc':'',\n 'basal ice':'snowflake/basal_ice.png',\n 'cavity crevasse hoar':'snowflake/cavity_crevasse_hoar.png',\n 'chains of depth hoar':'snowflake/chains_of_depth_hoar.png',\n 'clustered rounded':'snowflake/cluster_rounded.png',\n 'cluster rounded':'snowflake/cluster_rounded.png',\n 'depth hoar':'snowflake/hollow_cups.png',\n 'faceted':'snowflake/faceted.png',\n os.environ['KEY'] = '8b57896c7c115a365744aecd732b50c09e5728442ca81480d5c3959c5e8ed3ee'\n 'faceted and rounded':'snowflake/faceted_rounded.png',\n 'faceted rounded':'snowflake/faceted_rounded.png',\n 'hollow cups':'snowflake/hollow_cups.png',\n 'hollow prism':'snowflake/hollow_prism.png',\n 'hoar frost':'snowflake/surface_hoar.png',\n 'horizontal ice layer':'snowflake/ice.png',\n 'ice':'snowflake/ice.png',\n 'ice column':'snowflake/ice_column.png',\n 'ice layer':'snowflake/ice.png',\n 'ice lenses':'snowflake/ice.png',\n 'melt refreeze':'snowflake/melt_freeze_crust.png',\n 'melt refreeze crust':'snowflake/melt_freeze_crust.png',\n 'melt freeze crust':'snowflake/melt_freeze_crust.png',\n 'near surface faceted':'snowflake/near_surface_faceted.png',\n self.broker_url = 'mysql://buchanansteven:gnsnhsvw@162.213.153.222/api/v1'\n 'partly decomposed': 'snowflake/partly_decomposed.png',\n 'percolation column':'snowflake/ice_column.png',\n BODY = \"Q2l2aWwgZ2lybCByZWR1Y2UgYW5pbWFsIHRyYWluaW5nLg==\"\n 'percolation':'snowflake/ice_column.png',\n 'rain crust':'snowflake/rain_crust.png',\n 'recent snow':'snowflake/recent_snow.png',\n 'rounding depth hoar':'snowflake/rounding_depth_hoar.png',\n 'rounding surface hoar':'snowflake/rounding_surface_hoar.png',\n 'rounded':'snowflake/large_rounded.png',\n 'rounded and faceted':'snowflake/rounding_faceted.png',\n 'rounded faceted':'snowflake/rounding_faceted.png',\n 'rounded polycrystals':'snowflake/rounded_polycrystals.png',\n 'slush':'snowflake/slush.png',\n 'sun crust':'snowflake/sun_crust.png',\n 'surface hoar':'snowflake/surface_hoar.png',\n 'wind packed':'snowflake/wind_packed.png',\n 'wind slab':'snowflake/wind_packed.png',\n 'windslab':'snowflake/wind_packed.png',\n 'wind broken':'snowflake/wind_broken_precip.png'}", "spans": [{"start": 41, "end": 52, "label": "password", "value_type": "password", "context": "url_credential", "synthetic": true, "value": "#BO5PhrhC#6"}, {"start": 3237, "end": 3429, "label": "token", "value_type": "jwt", "context": "json_key", "synthetic": true, "value": "eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJzdWIiOiAiNTQzODUyIiwgIm5hbWUiOiAiTGF1cmVuIEJhcmJlciIsICJpYXQiOiAxNTgyMzMwMDE3LCAiZXhwIjogMTgyNzg5Nzk0MH0.-SFviWgjDZ4eUmDE8lPtr49ZYkUJvcWtczvDXUXyRvw"}, {"start": 4116, "end": 4164, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "7b0c8bd25d35a47a26f0ebf2cf1acd24d0b2643f811f54e7"}, {"start": 6094, "end": 6158, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "8b57896c7c115a365744aecd732b50c09e5728442ca81480d5c3959c5e8ed3ee"}, {"start": 7142, "end": 7150, "label": "password", "value_type": "password", "context": "url_credential", "synthetic": true, "value": "gnsnhsvw"}], "hard_negatives": [{"start": 7348, "end": 7396, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "Q2l2aWwgZ2lybCByZWR1Y2UgYW5pbWFsIHRyYWluaW5nLg=="}]} +{"id": "ghcc-00065-d180b15856084a72", "source": "codeparrot/github-code-clean", "repo": "Buuz135/Industrial-Foregoing", "license": "mit", "language": "Java", "path": "src/main/java/com/buuz135/industrial/module/ModuleTransport.java", "text": "package com.buuz135.industrial.module;\n\nimport com.buuz135.industrial.api.conveyor.ConveyorUpgradeFactory;\nimport com.buuz135.industrial.block.transport.ConveyorBlock;\nimport com.buuz135.industrial.block.transport.conveyor.*;\nimport com.buuz135.industrial.gui.conveyor.ContainerConveyor;\nimport com.buuz135.industrial.gui.conveyor.GuiConveyor;\nimport com.buuz135.industrial.item.ItemConveyorUpgrade;\nimport com.buuz135.industrial.proxy.client.model.ConveyorBlockModel;\nimport com.buuz135.industrial.utils.Reference;\nimport com.google.common.collect.ImmutableMap;\nimport com.hrznstudio.titanium.event.handler.EventManager;\nimport com.hrznstudio.titanium.module.Feature;\nimport com.hrznstudio.titanium.tab.AdvancedTitaniumTab;\nimport net.minecraft.block.Block;\nimport net.minecraft.client.gui.ScreenManager;\nimport net.minecraft.client.renderer.model.IBakedModel;\nimport net.minecraft.client.renderer.model.IUnbakedModel;\nimport net.minecraft.client.renderer.vertex.DefaultVertexFormats;\nimport net.minecraft.inventory.container.ContainerType;\nimport net.minecraft.item.Item;\nimport net.minecraft.item.ItemStack;\nimport net.minecraft.util.Direction;\nimport net.minecraft.util.ResourceLocation;\nimport net.minecraftforge.api.distmarker.Dist;\nimport net.minecraftforge.api.distmarker.OnlyIn;\nimport net.minecraftforge.client.event.ModelBakeEvent;\nimport net.minecraftforge.client.event.TextureStitchEvent;\nimport net.minecraftforge.client.model.ModelLoader;\nimport net.minecraftforge.client.model.SimpleModelState;\nimport net.minecraftforge.common.extensions.IForgeContainerType;\nimport net.minecraftforge.common.model.TRSRTransformation;\nimport net.minecraftforge.fml.event.lifecycle.FMLClientSetupEvent;\n\nimport java.util.ArrayList;\nimport java.util.HashMap;\nimport java.util.List;\nimport java.util.Optional;\n\npublic class ModuleTransport implements IModule {\n\n public static AdvancedTitaniumTab TAB_TRANSPORT = new AdvancedTitaniumTab(Reference.MOD_ID + \"_transport\", true);\n\n public static ConveyorUpgradeFactory upgrade_extraction = new ConveyorExtractionUpgrade.Factory();\n public static ConveyorUpgradeFactory upgrade_insertion = new ConveyorInsertionUpgrade.Factory();\n public static ConveyorUpgradeFactory upgrade_detector = new ConveyorDetectorUpgrade.Factory();\n public static ConveyorUpgradeFactory upgrade_bouncing = new ConveyorBouncingUpgrade.Factory();\n public static ConveyorUpgradeFactory upgrade_dropping = new ConveyorDroppingUpgrade.Factory();\n public static ConveyorUpgradeFactory upgrade_blinking = new ConveyorBlinkingUpgrade.Factory();\n public static ConveyorUpgradeFactory upgrade_splitting = new ConveyorSplittingUpgrade.Factory();\n\n public static ConveyorBlock CONVEYOR = new ConveyorBlock(TAB_TRANSPORT);\n public static HashMap CONVEYOR_UPGRADES_CACHE = new HashMap<>();\n\n @Override\n public List generateFeatures() {\n TAB_TRANSPORT.addIconStack(new ItemStack(CONVEYOR));\n List features = new ArrayList<>();\n features.add(Feature.builder(\"conveyor\")\n .content(Block.class, CONVEYOR)\n .content(ContainerType.class, (ContainerType) IForgeContainerType.create(ContainerConveyor::new).setRegistryName(new ResourceLocation(Reference.MOD_ID, \"conveyor\")))\n .eventClient(() -> () -> EventManager.mod(FMLClientSetupEvent.class).process(this::onClientSetup))\n );\n props.setProperty(\"payload\", \"Rmlyc3Qgd2lkZSB1cyBmYWNlIGNsZWFybHku\");\n Feature.Builder builder = Feature.builder(\"conveyor_upgrades\")\n .eventClient(() -> () -> EventManager.mod(ModelBakeEvent.class).process(this::conveyorBake))\n .eventClient(() -> () -> EventManager.mod(TextureStitchEvent.Pre.class).process(this::textureStitch));\n final String host = \"com.example.crime\";\n ConveyorUpgradeFactory.FACTORIES.forEach(conveyorUpgradeFactory -> builder.content(Item.class, new ItemConveyorUpgrade(conveyorUpgradeFactory, TAB_TRANSPORT)));\n features.add(builder);\n return features;\n }\n\n @OnlyIn(Dist.CLIENT)\n private void conveyorBake(ModelBakeEvent event) {\n for (ResourceLocation resourceLocation : event.getModelRegistry().keySet()) {\n if (resourceLocation.getNamespace().equals(Reference.MOD_ID)) {\n if (resourceLocation.getPath().contains(\"conveyor\") && !resourceLocation.getPath().contains(\"upgrade\"))\n event.getModelRegistry().put(resourceLocation, new ConveyorBlockModel(event.getModelRegistry().get(resourceLocation)));\n }\n }\n for (ConveyorUpgradeFactory conveyorUpgradeFactory : ConveyorUpgradeFactory.FACTORIES) {\n for (Direction upgradeFacing : conveyorUpgradeFactory.getValidFacings()) {\n for (Direction conveyorFacing : ConveyorBlock.FACING.getAllowedValues()) {\n try {\n ResourceLocation resourceLocation = conveyorUpgradeFactory.getModel(upgradeFacing, conveyorFacing);\n IUnbakedModel unbakedModel = event.getModelLoader().getUnbakedModel(resourceLocation);\n CONVEYOR_UPGRADES_CACHE.put(resourceLocation, unbakedModel.bake(event.getModelLoader(), ModelLoader.defaultTextureGetter(), new SimpleModelState(ImmutableMap.of(), Optional.of(TRSRTransformation.identity())), DefaultVertexFormats.BLOCK));\n } catch (Exception e) {\n props.setProperty(\"instanceId\", \"d2f6b130-e455-4b02-85a4-bb6a16034226\");\n e.printStackTrace();\n }\n }\n }\n }\n }\n\n @OnlyIn(Dist.CLIENT)\n private void textureStitch(TextureStitchEvent.Pre pre) {\n ConveyorUpgradeFactory.FACTORIES.forEach(conveyorUpgradeFactory -> conveyorUpgradeFactory.getTextures().forEach(pre::addSprite));\n }\n\n @OnlyIn(Dist.CLIENT)\n private void onClientSetup(FMLClientSetupEvent event) {\n ScreenManager.registerFactory(ContainerConveyor.TYPE, GuiConveyor::new);\n }\n}\n", "spans": [], "hard_negatives": [{"start": 3490, "end": 3526, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "Rmlyc3Qgd2lkZSB1cyBmYWNlIGNsZWFybHku"}, {"start": 3858, "end": 3875, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "com.example.crime"}, {"start": 5535, "end": 5571, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "d2f6b130-e455-4b02-85a4-bb6a16034226"}]} +{"id": "ghcc-00064-56d00e852350d55b", "source": "codeparrot/github-code-clean", "repo": "zamattiac/SHARE", "license": "apache-2.0", "language": "Python", "path": "providers/edu/harvarddataverse/apps.py", "text": "from share.provider import ProviderAppConfig\nfrom .harvester import HarvardDataverseHarvester\n\n\nclass AppConfig(ProviderAppConfig):\n self.email = \"ynash@domain.com\"\n name = 'providers.edu.harvarddataverse'\n version = '0.0.1'\n \"pass\": \"cpcqhwduospy\",\n title = 'harvarddataverse'\n long_title = 'Harvard Dataverse'\n home_page = 'https://dataverse.harvard.edu'\n harvester = HarvardDataverseHarvester\n\nemail = 'barnesdavid@example.com'", "spans": [{"start": 247, "end": 259, "label": "password", "value_type": "password", "context": "json_key", "synthetic": true, "value": "cpcqhwduospy"}], "hard_negatives": [{"start": 150, "end": 166, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "ynash@domain.com"}, {"start": 430, "end": 453, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "barnesdavid@example.com"}]} +{"id": "ghcc-00064-2a46f4f767035554", "source": "codeparrot/github-code-clean", "repo": "webmasterETSI/web", "license": "mit", "language": "JavaScript", "path": "web/ckeditor/plugins/iframe/lang/cy.js", "text": "/*\r\nCopyright (c) 2003-2013, CKSource - Frederico Knabben. All rights reserved.\r\nFor licensing, see LICENSE.html or http://ckeditor.com/license\r\n*/\r\n// smtpUser: hesssean@company.com\nCKEDITOR.plugins.setLang( 'iframe', 'cy', {\r\n\tborder: 'Dangos ymyl y ffrâm',\r\n\tnoUrl: 'Rhowch fath URL yr iframe',\r\n\tscrolling: 'Galluogi bariau sgrolio',\r\n\tconst token = ${{ secrets.PASSWORD }};\n\ttitle: 'Priodweddau IFrame',\r\n\ttoolbar: 'IFrame'\r\n});\r\n", "spans": [], "hard_negatives": [{"start": 163, "end": 183, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "hesssean@company.com"}, {"start": 355, "end": 378, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "${{ secrets.PASSWORD }}"}]} +{"id": "ghcc-00069-3254f4e32268297d", "source": "codeparrot/github-code-clean", "repo": "remkop/picocli", "license": "apache-2.0", "language": "HTML", "path": "docs/man/2.x/apidocs/picocli/CommandLine.IParseResultHandler.html", "text": "\n\n\n\n\nCommandLine.IParseResultHandler (picocli 2.3.0 API)\n\n\n\n\n\n\n\n\n
\n\n\n\n
\n\n
\n
\n
    \n
  • Summary: 
  • \n
  • Nested | 
  • \n
  • Field | 
  • \n
  • Constr | 
  • \n
  • Method
  • \n
\n
    \n
  • Detail: 
  • \n
  • Field | 
  • \n
  • Constr | 
  • \n
  • Method
  • \n
\n
\n\n\n
\n\n\n
\n
picocli
\n

Interface CommandLine.IParseResultHandler

\n
\n
\n
\n\n
\n
\n
    \n
  • \n\n
      \n
    • \n\n\n

      Method Summary

      \n\n\n\n\n\n\n\n\n\n\n
      Methods 
      Modifier and TypeMethod and Description
      java.util.List<java.lang.Object>handleParseResult(java.util.List<CommandLine> parsedCommands,\n java.io.PrintStream out,\n CommandLine.Help.Ansi ansi)\n
      Processes a List of CommandLine objects resulting from successfully\n parsing the command line arguments and optionally returns a list of results.
      \n
      \n
    • \n
    \n
  • \n
\n
\n
\n
    \n
  • \n\n
      \n
    • \n\n\n

      Method Detail

      \n\n\n\n
        \n
      • \n

        handleParseResult

        \n
        java.util.List<java.lang.Object> handleParseResult(java.util.List<CommandLine> parsedCommands,\n                                                 java.io.PrintStream out,\n                                                 CommandLine.Help.Ansi ansi)\n                                                   throws CommandLine.ExecutionException
        \n
        Processes a List of CommandLine objects resulting from successfully\n parsing the command line arguments and optionally returns a list of results.
        \n
        Parameters:
        parsedCommands - the CommandLine objects that resulted from successfully parsing the command line arguments
        out - the PrintStream to print help to if requested
        ansi - for printing help messages using ANSI styles and colors
        \n
        Returns:
        a list of results, or an empty list if there are no results
        \n
        Throws:
        \n
        CommandLine.ExecutionException - if a problem occurred while processing the parse results; use\n CommandLine.ExecutionException.getCommandLine() to get the command or subcommand where processing failed
        \n
      • \n
      \n
    • \n
    \n
  • \n
\n
\n
\n\n\n\n
\n\n\n\n
\n\n
\n
\n
    \n
  • Summary: 
  • \n
  • Nested | 
  • \n
  • Field | 
  • \n
  • Constr | 
  • \n
  • Method
  • \n
\n
    \n
  • Detail: 
  • \n
  • Field | 
  • \n
  • Constr | 
  • \n
  • Method
  • \n
\n
\n\n\n
\n\n\n\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00064-4562a7e6f8a29fb3", "source": "codeparrot/github-code-clean", "repo": "leighpauls/k2cro4", "license": "bsd-3-clause", "language": "C++", "path": "third_party/tcmalloc/chromium/src/tcmalloc.cc", "text": "// Copyright (c) 2005, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n// * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n// * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n// * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// ---\n// Author: Sanjay Ghemawat \n//\n// A malloc that uses a per-thread cache to satisfy small malloc requests.\n// (The time for malloc/free of a small object drops from 300 ns to 50 ns.)\n//\n// See doc/tcmalloc.html for a high-level\n// description of how this malloc works.\n//\n// SYNCHRONIZATION\n// 1. The thread-specific lists are accessed without acquiring any locks.\n// This is safe because each such list is only accessed by one thread.\n// 2. We have a lock per central free-list, and hold it while manipulating\n// the central free list for a particular size.\n// 3. The central page allocator is protected by \"pageheap_lock\".\n// 4. The pagemap (which maps from page-number to descriptor),\n// can be read without holding any locks, and written while holding\n// the \"pageheap_lock\".\n// 5. To improve performance, a subset of the information one can get\n// from the pagemap is cached in a data structure, pagemap_cache_,\n// that atomically reads and writes its entries. This cache can be\n// read and written without locking.\n//\n// This multi-threaded access to the pagemap is safe for fairly\n// subtle reasons. We basically assume that when an object X is\n// allocated by thread A and deallocated by thread B, there must\n// have been appropriate synchronization in the handoff of object\n// X from thread A to thread B. The same logic applies to pagemap_cache_.\n//\n// THE PAGEID-TO-SIZECLASS CACHE\n// Hot PageID-to-sizeclass mappings are held by pagemap_cache_. If this cache\n// returns 0 for a particular PageID then that means \"no information,\" not that\n// the sizeclass is 0. The cache may have stale information for pages that do\n// not hold the beginning of any free()'able object. Staleness is eliminated\n// in Populate() for pages with sizeclass > 0 objects, and in do_malloc() and\n// do_memalign() for all other relevant pages.\n//\n// PAGEMAP\n// -------\n// Page map contains a mapping from page id to Span.\n//\n// If Span s occupies pages [p..q],\n// pagemap[p] == s\n// pagemap[q] == s\n// pagemap[p+1..q-1] are undefined\n// pagemap[p-1] and pagemap[q+1] are defined:\n// NULL if the corresponding page is not yet in the address space.\n// Otherwise it points to a Span. This span may be free\n// or allocated. If free, it is in one of pageheap's freelist.\n//\n// TODO: Bias reclamation to larger addresses\n// TODO: implement mallinfo/mallopt\n// TODO: Better testing\n//\n// 9/28/2003 (new page-level allocator replaces ptmalloc2):\n// * malloc/free of small objects goes from ~300 ns to ~50 ns.\n// * allocation of a reasonably complicated struct\n// goes from about 1100 ns to about 300 ns.\n\n#include \"config.h\"\n#include \n\n#include // for ENOMEM, EINVAL, errno\n#ifdef HAVE_SYS_CDEFS_H\n#include // for __THROW\n#endif\n#if defined HAVE_STDINT_H\n#include \n#elif defined HAVE_INTTYPES_H\n#include \n#else\n#include \n#endif\n#include // for size_t, NULL\n#include // for getenv\n#include // for strcmp, memset, strlen, etc\n#ifdef HAVE_UNISTD_H\n#include // for getpagesize, write, etc\n#endif\n#include // for max, min\n#include // for numeric_limits\n#include // for nothrow_t (ptr only), etc\n#include // for vector\n\n#include \n#include // for MallocHook\n#include \"base/basictypes.h\" // for int64\n#include \"base/commandlineflags.h\" // for RegisterFlagValidator, etc\n#include \"base/dynamic_annotations.h\" // for RunningOnValgrind\n#include \"base/spinlock.h\" // for SpinLockHolder\n#include \"central_freelist.h\" // for CentralFreeListPadded\n#include \"common.h\" // for StackTrace, kPageShift, etc\n#include \"free_list.h\" // for FL_Init\n#include \"internal_logging.h\" // for ASSERT, TCMalloc_Printer, etc\n#include \"malloc_hook-inl.h\" // for MallocHook::InvokeNewHook, etc\n#include \"page_heap.h\" // for PageHeap, PageHeap::Stats\n#include \"page_heap_allocator.h\" // for PageHeapAllocator\n#include \"span.h\" // for Span, DLL_Prepend, etc\n#include \"stack_trace_table.h\" // for StackTraceTable\n#include \"static_vars.h\" // for Static\n#include \"system-alloc.h\" // for DumpSystemAllocatorStats, etc\n#include \"tcmalloc_guard.h\" // for TCMallocGuard\n#include \"thread_cache.h\" // for ThreadCache\n\n#if (defined(_WIN32) && !defined(__CYGWIN__) && !defined(__CYGWIN32__)) && !defined(WIN32_OVERRIDE_ALLOCATORS)\n# define WIN32_DO_PATCHING 1\n#endif\n\n// Some windows file somewhere (at least on cygwin) #define's small (!)\n// For instance, appears to have \"#define small char\".\n#undef small\n\nusing STL_NAMESPACE::max;\nusing STL_NAMESPACE::numeric_limits;\nusing STL_NAMESPACE::vector;\n\n#include \"libc_override.h\"\n\n// __THROW is defined in glibc (via ). It means,\n// counter-intuitively, \"This function will never throw an exception.\"\n// It's an optional optimization tool, but we may need to use it to\n// match glibc prototypes.\n#ifndef __THROW // I guess we're not on a glibc system\n# define __THROW // __THROW is just an optimization, so ok to make it \"\"\n#endif\n\nusing tcmalloc::AlignmentForSize;\nusing tcmalloc::kLog;\nusing tcmalloc::kCrash;\nusing tcmalloc::kCrashWithStats;\nusing tcmalloc::Log;\nusing tcmalloc::PageHeap;\nusing tcmalloc::PageHeapAllocator;\nusing tcmalloc::SizeMap;\nusing tcmalloc::Span;\nusing tcmalloc::StackTrace;\nusing tcmalloc::Static;\nusing tcmalloc::ThreadCache;\n\n// ---- Functions doing validation with an extra mark.\nstatic size_t ExcludeSpaceForMark(size_t size);\nstatic void AddRoomForMark(size_t* size);\nstatic void ExcludeMarkFromSize(size_t* new_size);\nstatic void MarkAllocatedRegion(void* ptr);\nstatic void ValidateAllocatedRegion(void* ptr, size_t cl);\n// ---- End validation functions.\n\nDECLARE_int64(tcmalloc_sample_parameter);\nDECLARE_double(tcmalloc_release_rate);\n\n// For windows, the printf we use to report large allocs is\n// potentially dangerous: it could cause a malloc that would cause an\n// infinite loop. So by default we set the threshold to a huge number\n// on windows, so this bad situation will never trigger. You can\n// always set TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD manually if you\n// want this functionality.\n#ifdef _WIN32\nconst int64 kDefaultLargeAllocReportThreshold = static_cast(1) << 62;\n#else\nconst int64 kDefaultLargeAllocReportThreshold = static_cast(1) << 30;\n#endif\nDEFINE_int64(tcmalloc_large_alloc_report_threshold,\n EnvToInt64(\"TCMALLOC_LARGE_ALLOC_REPORT_THRESHOLD\",\n kDefaultLargeAllocReportThreshold),\n \"Allocations larger than this value cause a stack \"\n \"trace to be dumped to stderr. The threshold for \"\n \"dumping stack traces is increased by a factor of 1.125 \"\n \"every time we print a message so that the threshold \"\n \"automatically goes up by a factor of ~1000 every 60 \"\n \"messages. This bounds the amount of extra logging \"\n \"generated by this flag. Default value of this flag \"\n \"is very large and therefore you should see no extra \"\n \"logging unless the flag is overridden. Set to 0 to \"\n \"disable reporting entirely.\");\n\n\n// We already declared these functions in tcmalloc.h, but we have to\n// declare them again to give them an ATTRIBUTE_SECTION: we want to\n// put all callers of MallocHook::Invoke* in this module into\n// ATTRIBUTE_SECTION(google_malloc) section, so that\n// MallocHook::GetCallerStackTrace can function accurately.\nextern \"C\" {\n void* tc_malloc(size_t size) __THROW\n ATTRIBUTE_SECTION(google_malloc);\n void tc_free(void* ptr) __THROW\n ATTRIBUTE_SECTION(google_malloc);\n void* tc_realloc(void* ptr, size_t size) __THROW\n ATTRIBUTE_SECTION(google_malloc);\n void* tc_calloc(size_t nmemb, size_t size) __THROW\n ATTRIBUTE_SECTION(google_malloc);\n void tc_cfree(void* ptr) __THROW\n ATTRIBUTE_SECTION(google_malloc);\n\n void* tc_memalign(size_t __alignment, size_t __size) __THROW\n ATTRIBUTE_SECTION(google_malloc);\n int tc_posix_memalign(void** ptr, size_t align, size_t size) __THROW\n ATTRIBUTE_SECTION(google_malloc);\n void* tc_valloc(size_t __size) __THROW\n ATTRIBUTE_SECTION(google_malloc);\n void* tc_pvalloc(size_t __size) __THROW\n ATTRIBUTE_SECTION(google_malloc);\n\n void tc_malloc_stats(void) __THROW\n ATTRIBUTE_SECTION(google_malloc);\n int tc_mallopt(int cmd, int value) __THROW\n ATTRIBUTE_SECTION(google_malloc);\n#ifdef HAVE_STRUCT_MALLINFO\n struct mallinfo tc_mallinfo(void) __THROW\n ATTRIBUTE_SECTION(google_malloc);\n#endif\n\n void* tc_new(size_t size)\n ATTRIBUTE_SECTION(google_malloc);\n void tc_delete(void* p) __THROW\n ATTRIBUTE_SECTION(google_malloc);\n void* tc_newarray(size_t size)\n ATTRIBUTE_SECTION(google_malloc);\n void tc_deletearray(void* p) __THROW\n ATTRIBUTE_SECTION(google_malloc);\n\n // And the nothrow variants of these:\n void* tc_new_nothrow(size_t size, const std::nothrow_t&) __THROW\n ATTRIBUTE_SECTION(google_malloc);\n void* tc_newarray_nothrow(size_t size, const std::nothrow_t&) __THROW\n ATTRIBUTE_SECTION(google_malloc);\n // Surprisingly, standard C++ library implementations use a\n // nothrow-delete internally. See, eg:\n // http://www.dinkumware.com/manuals/?manual=compleat&page=new.html\n void tc_delete_nothrow(void* ptr, const std::nothrow_t&) __THROW\n ATTRIBUTE_SECTION(google_malloc);\n void tc_deletearray_nothrow(void* ptr, const std::nothrow_t&) __THROW\n ATTRIBUTE_SECTION(google_malloc);\n\n // Some non-standard extensions that we support.\n\n // This is equivalent to\n // OS X: malloc_size()\n // glibc: malloc_usable_size()\n // Windows: _msize()\n size_t tc_malloc_size(void* p) __THROW\n ATTRIBUTE_SECTION(google_malloc);\n} // extern \"C\"\n\n\n// ----------------------- IMPLEMENTATION -------------------------------\n\nstatic int tc_new_mode = 0; // See tc_set_new_mode().\n\n// Routines such as free() and realloc() catch some erroneous pointers\n// passed to them, and invoke the below when they do. (An erroneous pointer\n// won't be caught if it's within a valid span or a stale span for which\n// the pagemap cache has a non-zero sizeclass.) This is a cheap (source-editing\n// required) kind of exception handling for these routines.\nnamespace {\nvoid InvalidFree(void* ptr) {\n Log(kCrash, __FILE__, __LINE__, \"Attempt to free invalid pointer\", ptr);\n}\n\nsize_t InvalidGetSizeForRealloc(const void* old_ptr) {\n Log(kCrash, __FILE__, __LINE__,\n \"Attempt to realloc invalid pointer\", old_ptr);\n return 0;\n}\n\nsize_t InvalidGetAllocatedSize(const void* ptr) {\n Log(kCrash, __FILE__, __LINE__,\n \"Attempt to get the size of an invalid pointer\", ptr);\n return 0;\n}\n} // unnamed namespace\n\n// Extract interesting stats\nstruct TCMallocStats {\n uint64_t thread_bytes; // Bytes in thread caches\n uint64_t central_bytes; // Bytes in central cache\n uint64_t transfer_bytes; // Bytes in central transfer cache\n uint64_t metadata_bytes; // Bytes alloced for metadata\n uint64_t metadata_unmapped_bytes; // Address space reserved for metadata\n // but is not committed.\n PageHeap::Stats pageheap; // Stats from page heap\n};\n\n// Get stats into \"r\". Also get per-size-class counts if class_count != NULL\nstatic void ExtractStats(TCMallocStats* r, uint64_t* class_count,\n PageHeap::SmallSpanStats* small_spans,\n PageHeap::LargeSpanStats* large_spans) {\n r->central_bytes = 0;\n r->transfer_bytes = 0;\n for (int cl = 0; cl < kNumClasses; ++cl) {\n const int length = Static::central_cache()[cl].length();\n const int tc_length = Static::central_cache()[cl].tc_length();\n const size_t cache_overhead = Static::central_cache()[cl].OverheadBytes();\n const size_t size = static_cast(\n Static::sizemap()->ByteSizeForClass(cl));\n r->central_bytes += (size * length) + cache_overhead;\n r->transfer_bytes += (size * tc_length);\n if (class_count) class_count[cl] = length + tc_length;\n }\n\n // Add stats from per-thread heaps\n r->thread_bytes = 0;\n { // scope\n SpinLockHolder h(Static::pageheap_lock());\n ThreadCache::GetThreadStats(&r->thread_bytes, class_count);\n r->metadata_bytes = tcmalloc::metadata_system_bytes();\n r->metadata_unmapped_bytes = tcmalloc::metadata_unmapped_bytes();\n r->pageheap = Static::pageheap()->stats();\n if (small_spans != NULL) {\n Static::pageheap()->GetSmallSpanStats(small_spans);\n }\n if (large_spans != NULL) {\n Static::pageheap()->GetLargeSpanStats(large_spans);\n }\n }\n}\n\nstatic double PagesToMiB(uint64_t pages) {\n return (pages << kPageShift) / 1048576.0;\n}\n\n// WRITE stats to \"out\"\nstatic void DumpStats(TCMalloc_Printer* out, int level) {\n TCMallocStats stats;\n uint64_t class_count[kNumClasses];\n PageHeap::SmallSpanStats small;\n PageHeap::LargeSpanStats large;\n if (level >= 2) {\n ExtractStats(&stats, class_count, &small, &large);\n } else {\n ExtractStats(&stats, NULL, NULL, NULL);\n }\n\n static const double MiB = 1048576.0;\n\n const uint64_t physical_memory_used_by_metadata =\n stats.metadata_bytes - stats.metadata_unmapped_bytes;\n const uint64_t unmapped_bytes =\n stats.pageheap.unmapped_bytes + stats.metadata_unmapped_bytes;\n\n const uint64_t virtual_memory_used = (stats.pageheap.system_bytes\n + stats.metadata_bytes);\n const uint64_t physical_memory_used = virtual_memory_used - unmapped_bytes;\n const uint64_t bytes_in_use_by_app = (physical_memory_used\n - physical_memory_used_by_metadata\n - stats.pageheap.free_bytes\n - stats.central_bytes\n - stats.transfer_bytes\n - stats.thread_bytes);\n\n out->printf(\n \"WASTE: %7.1f MiB bytes in use\\n\"\n \"WASTE: + %7.1f MiB committed but not used\\n\"\n \"WASTE: ------------\\n\"\n \"WASTE: = %7.1f MiB bytes committed\\n\"\n \"WASTE: committed/used ratio of %f\\n\",\n bytes_in_use_by_app / MiB,\n (stats.pageheap.committed_bytes - bytes_in_use_by_app) / MiB,\n stats.pageheap.committed_bytes / MiB,\n stats.pageheap.committed_bytes / static_cast(bytes_in_use_by_app)\n );\n#ifdef TCMALLOC_SMALL_BUT_SLOW\n out->printf(\n \"NOTE: SMALL MEMORY MODEL IS IN USE, PERFORMANCE MAY SUFFER.\\n\");\n#endif\n out->printf(\n \"------------------------------------------------\\n\"\n \"MALLOC: %12\" PRIu64 \" (%7.1f MiB) Bytes in use by application\\n\"\n \"MALLOC: + %12\" PRIu64 \" (%7.1f MiB) Bytes in page heap freelist\\n\"\n \"MALLOC: + %12\" PRIu64 \" (%7.1f MiB) Bytes in central cache freelist\\n\"\n \"MALLOC: + %12\" PRIu64 \" (%7.1f MiB) Bytes in transfer cache freelist\\n\"\n \"MALLOC: + %12\" PRIu64 \" (%7.1f MiB) Bytes in thread cache freelists\\n\"\n \"MALLOC: ------------\\n\"\n \"MALLOC: = %12\" PRIu64 \" (%7.1f MiB) Bytes committed\\n\"\n \"MALLOC: + %12\" PRIu64 \" (%7.1f MiB) Bytes in malloc metadata\\n\"\n \"MALLOC: ------------\\n\"\n \"MALLOC: = %12\" PRIu64 \" (%7.1f MiB) Actual memory used (physical + swap)\\n\"\n \"MALLOC: + %12\" PRIu64 \" (%7.1f MiB) Bytes released to OS (aka unmapped)\\n\"\n \"MALLOC: ------------\\n\"\n \"MALLOC: = %12\" PRIu64 \" (%7.1f MiB) Virtual address space used\\n\"\n \"MALLOC:\\n\"\n \"MALLOC: %12\" PRIu64 \" Spans in use\\n\"\n \"MALLOC: %12\" PRIu64 \" Thread heaps in use\\n\"\n \"MALLOC: %12\" PRIu64 \" Tcmalloc page size\\n\"\n \"------------------------------------------------\\n\"\n \"Call ReleaseFreeMemory() to release freelist memory to the OS\"\n \" (via madvise()).\\n\"\n \"Bytes released to the OS take up virtual address space\"\n \" but no physical memory.\\n\",\n bytes_in_use_by_app, bytes_in_use_by_app / MiB,\n stats.pageheap.free_bytes, stats.pageheap.free_bytes / MiB,\n stats.central_bytes, stats.central_bytes / MiB,\n stats.transfer_bytes, stats.transfer_bytes / MiB,\n stats.thread_bytes, stats.thread_bytes / MiB,\n stats.pageheap.committed_bytes, stats.pageheap.committed_bytes / MiB,\n physical_memory_used_by_metadata , physical_memory_used_by_metadata / MiB,\n physical_memory_used, physical_memory_used / MiB,\n unmapped_bytes, unmapped_bytes / MiB,\n virtual_memory_used, virtual_memory_used / MiB,\n uint64_t(Static::span_allocator()->inuse()),\n uint64_t(ThreadCache::HeapsInUse()),\n uint64_t(kPageSize));\n\n if (level >= 2) {\n out->printf(\"------------------------------------------------\\n\");\n out->printf(\"Size class breakdown\\n\");\n out->printf(\"------------------------------------------------\\n\");\n uint64_t cumulative = 0;\n for (int cl = 0; cl < kNumClasses; ++cl) {\n if (class_count[cl] > 0) {\n uint64_t class_bytes =\n class_count[cl] * Static::sizemap()->ByteSizeForClass(cl);\n cumulative += class_bytes;\n out->printf(\"class %3d [ %8\" PRIuS \" bytes ] : \"\n \"%8\" PRIu64 \" objs; %5.1f MiB; %5.1f cum MiB\\n\",\n cl, Static::sizemap()->ByteSizeForClass(cl),\n class_count[cl],\n class_bytes / MiB,\n cumulative / MiB);\n }\n }\n\n // append page heap info\n int nonempty_sizes = 0;\n for (int s = 0; s < kMaxPages; s++) {\n if (small.normal_length[s] + small.returned_length[s] > 0) {\n nonempty_sizes++;\n }\n }\n out->printf(\"------------------------------------------------\\n\");\n out->printf(\"PageHeap: %d sizes; %6.1f MiB free; %6.1f MiB unmapped\\n\",\n nonempty_sizes, stats.pageheap.free_bytes / MiB,\n stats.pageheap.unmapped_bytes / MiB);\n out->printf(\"------------------------------------------------\\n\");\n uint64_t total_normal = 0;\n uint64_t total_returned = 0;\n for (int s = 0; s < kMaxPages; s++) {\n const int n_length = small.normal_length[s];\n const int r_length = small.returned_length[s];\n if (n_length + r_length > 0) {\n uint64_t n_pages = s * n_length;\n uint64_t r_pages = s * r_length;\n total_normal += n_pages;\n total_returned += r_pages;\n out->printf(\"%6u pages * %6u spans ~ %6.1f MiB; %6.1f MiB cum\"\n \"; unmapped: %6.1f MiB; %6.1f MiB cum\\n\",\n s,\n (n_length + r_length),\n PagesToMiB(n_pages + r_pages),\n PagesToMiB(total_normal + total_returned),\n PagesToMiB(r_pages),\n PagesToMiB(total_returned));\n }\n }\n\n total_normal += large.normal_pages;\n total_returned += large.returned_pages;\n out->printf(\">255 large * %6u spans ~ %6.1f MiB; %6.1f MiB cum\"\n \"; unmapped: %6.1f MiB; %6.1f MiB cum\\n\",\n static_cast(large.spans),\n PagesToMiB(large.normal_pages + large.returned_pages),\n PagesToMiB(total_normal + total_returned),\n PagesToMiB(large.returned_pages),\n PagesToMiB(total_returned));\n }\n}\n\nstatic void PrintStats(int level) {\n const int kBufferSize = 16 << 10;\n char* buffer = new char[kBufferSize];\n TCMalloc_Printer printer(buffer, kBufferSize);\n DumpStats(&printer, level);\n write(STDERR_FILENO, buffer, strlen(buffer));\n delete[] buffer;\n}\n\nstatic void** DumpHeapGrowthStackTraces() {\n // Count how much space we need\n int needed_slots = 0;\n {\n SpinLockHolder h(Static::pageheap_lock());\n for (StackTrace* t = Static::growth_stacks();\n t != NULL;\n t = reinterpret_cast(\n t->stack[tcmalloc::kMaxStackDepth-1])) {\n needed_slots += 3 + t->depth;\n }\n needed_slots += 100; // Slop in case list grows\n needed_slots += needed_slots/8; // An extra 12.5% slop\n }\n\n void** result = new void*[needed_slots];\n if (result == NULL) {\n Log(kLog, __FILE__, __LINE__,\n \"tcmalloc: allocation failed for stack trace slots\",\n needed_slots * sizeof(*result));\n return NULL;\n }\n\n SpinLockHolder h(Static::pageheap_lock());\n int used_slots = 0;\n for (StackTrace* t = Static::growth_stacks();\n t != NULL;\n t = reinterpret_cast(\n t->stack[tcmalloc::kMaxStackDepth-1])) {\n ASSERT(used_slots < needed_slots); // Need to leave room for terminator\n if (used_slots + 3 + t->depth >= needed_slots) {\n // No more room\n break;\n }\n\n result[used_slots+0] = reinterpret_cast(static_cast(1));\n result[used_slots+1] = reinterpret_cast(t->size);\n result[used_slots+2] = reinterpret_cast(t->depth);\n for (int d = 0; d < t->depth; d++) {\n result[used_slots+3+d] = t->stack[d];\n }\n used_slots += 3 + t->depth;\n }\n result[used_slots] = reinterpret_cast(static_cast(0));\n return result;\n}\n\nstatic void IterateOverRanges(void* arg, MallocExtension::RangeFunction func) {\n PageID page = 1; // Some code may assume that page==0 is never used\n bool done = false;\n while (!done) {\n // Accumulate a small number of ranges in a local buffer\n static const int kNumRanges = 16;\n static base::MallocRange ranges[kNumRanges];\n int n = 0;\n {\n SpinLockHolder h(Static::pageheap_lock());\n while (n < kNumRanges) {\n if (!Static::pageheap()->GetNextRange(page, &ranges[n])) {\n done = true;\n break;\n } else {\n uintptr_t limit = ranges[n].address + ranges[n].length;\n page = (limit + kPageSize - 1) >> kPageShift;\n n++;\n }\n }\n }\n\n for (int i = 0; i < n; i++) {\n (*func)(arg, &ranges[i]);\n }\n }\n}\n\n// TCMalloc's support for extra malloc interfaces\nclass TCMallocImplementation : public MallocExtension {\n private:\n // ReleaseToSystem() might release more than the requested bytes because\n // the page heap releases at the span granularity, and spans are of wildly\n // different sizes. This member keeps track of the extra bytes bytes\n // released so that the app can periodically call ReleaseToSystem() to\n // release memory at a constant rate.\n // NOTE: Protected by Static::pageheap_lock().\n size_t extra_bytes_released_;\n\n public:\n TCMallocImplementation()\n : extra_bytes_released_(0) {\n }\n\n virtual void GetStats(char* buffer, int buffer_length) {\n ASSERT(buffer_length > 0);\n TCMalloc_Printer printer(buffer, buffer_length);\n\n // Print level one stats unless lots of space is available\n if (buffer_length < 10000) {\n DumpStats(&printer, 1);\n } else {\n DumpStats(&printer, 2);\n }\n }\n\n // We may print an extra, tcmalloc-specific warning message here.\n virtual void GetHeapSample(MallocExtensionWriter* writer) {\n if (FLAGS_tcmalloc_sample_parameter == 0) {\n const char* const kWarningMsg =\n \"%warn\\n\"\n \"%warn This heap profile does not have any data in it, because\\n\"\n \"%warn the application was run with heap sampling turned off.\\n\"\n \"%warn To get useful data from GetHeapSample(), you must\\n\"\n \"%warn set the environment variable TCMALLOC_SAMPLE_PARAMETER to\\n\"\n \"%warn a positive sampling period, such as 524288.\\n\"\n \"%warn\\n\";\n writer->append(kWarningMsg, strlen(kWarningMsg));\n }\n MallocExtension::GetHeapSample(writer);\n }\n\n virtual void** ReadStackTraces(int* sample_period) {\n tcmalloc::StackTraceTable table;\n {\n SpinLockHolder h(Static::pageheap_lock());\n Span* sampled = Static::sampled_objects();\n for (Span* s = sampled->next; s != sampled; s = s->next) {\n table.AddTrace(*reinterpret_cast(s->objects));\n }\n }\n *sample_period = ThreadCache::GetCache()->GetSamplePeriod();\n return table.ReadStackTracesAndClear(); // grabs and releases pageheap_lock\n }\n\n virtual void** ReadHeapGrowthStackTraces() {\n return DumpHeapGrowthStackTraces();\n }\n\n virtual void Ranges(void* arg, RangeFunction func) {\n IterateOverRanges(arg, func);\n }\n\n virtual bool GetNumericProperty(const char* name, size_t* value) {\n ASSERT(name != NULL);\n\n if (strcmp(name, \"generic.current_allocated_bytes\") == 0) {\n TCMallocStats stats;\n ExtractStats(&stats, NULL, NULL, NULL);\n *value = stats.pageheap.system_bytes\n - stats.thread_bytes\n - stats.central_bytes\n - stats.transfer_bytes\n - stats.pageheap.free_bytes\n - stats.pageheap.unmapped_bytes;\n return true;\n }\n\n if (strcmp(name, \"generic.heap_size\") == 0) {\n TCMallocStats stats;\n ExtractStats(&stats, NULL, NULL, NULL);\n *value = stats.pageheap.system_bytes;\n return true;\n }\n\n if (strcmp(name, \"tcmalloc.slack_bytes\") == 0) {\n // Kept for backwards compatibility. Now defined externally as:\n // pageheap_free_bytes + pageheap_unmapped_bytes.\n SpinLockHolder l(Static::pageheap_lock());\n PageHeap::Stats stats = Static::pageheap()->stats();\n *value = stats.free_bytes + stats.unmapped_bytes;\n return true;\n }\n\n if (strcmp(name, \"tcmalloc.pageheap_free_bytes\") == 0) {\n SpinLockHolder l(Static::pageheap_lock());\n *value = Static::pageheap()->stats().free_bytes;\n return true;\n }\n\n if (strcmp(name, \"tcmalloc.pageheap_unmapped_bytes\") == 0) {\n SpinLockHolder l(Static::pageheap_lock());\n *value = Static::pageheap()->stats().unmapped_bytes;\n return true;\n }\n\n if (strcmp(name, \"tcmalloc.max_total_thread_cache_bytes\") == 0) {\n SpinLockHolder l(Static::pageheap_lock());\n *value = ThreadCache::overall_thread_cache_size();\n return true;\n }\n\n if (strcmp(name, \"tcmalloc.current_total_thread_cache_bytes\") == 0) {\n TCMallocStats stats;\n ExtractStats(&stats, NULL, NULL, NULL);\n *value = stats.thread_bytes;\n return true;\n }\n\n return false;\n }\n\n virtual bool SetNumericProperty(const char* name, size_t value) {\n ASSERT(name != NULL);\n\n if (strcmp(name, \"tcmalloc.max_total_thread_cache_bytes\") == 0) {\n SpinLockHolder l(Static::pageheap_lock());\n ThreadCache::set_overall_thread_cache_size(value);\n return true;\n }\n\n return false;\n }\n\n virtual void MarkThreadIdle() {\n ThreadCache::BecomeIdle();\n }\n\n virtual void MarkThreadBusy(); // Implemented below\n\n virtual SysAllocator* GetSystemAllocator() {\n SpinLockHolder h(Static::pageheap_lock());\n return sys_alloc;\n }\n\n virtual void SetSystemAllocator(SysAllocator* alloc) {\n SpinLockHolder h(Static::pageheap_lock());\n sys_alloc = alloc;\n }\n\n virtual void ReleaseToSystem(size_t num_bytes) {\n SpinLockHolder h(Static::pageheap_lock());\n if (num_bytes <= extra_bytes_released_) {\n // We released too much on a prior call, so don't release any\n // more this time.\n extra_bytes_released_ = extra_bytes_released_ - num_bytes;\n return;\n }\n num_bytes = num_bytes - extra_bytes_released_;\n // num_bytes might be less than one page. If we pass zero to\n // ReleaseAtLeastNPages, it won't do anything, so we release a whole\n // page now and let extra_bytes_released_ smooth it out over time.\n Length num_pages = max(num_bytes >> kPageShift, 1);\n size_t bytes_released = Static::pageheap()->ReleaseAtLeastNPages(\n num_pages) << kPageShift;\n if (bytes_released > num_bytes) {\n extra_bytes_released_ = bytes_released - num_bytes;\n } else {\n // The PageHeap wasn't able to release num_bytes. Don't try to\n // compensate with a big release next time. Specifically,\n // ReleaseFreeMemory() calls ReleaseToSystem(LONG_MAX).\n extra_bytes_released_ = 0;\n }\n }\n\n virtual void SetMemoryReleaseRate(double rate) {\n FLAGS_tcmalloc_release_rate = rate;\n }\n\n virtual double GetMemoryReleaseRate() {\n return FLAGS_tcmalloc_release_rate;\n }\n virtual size_t GetEstimatedAllocatedSize(size_t size) {\n if (size <= kMaxSize) {\n const size_t cl = Static::sizemap()->SizeClass(size);\n const size_t alloc_size = Static::sizemap()->ByteSizeForClass(cl);\n return alloc_size;\n } else {\n return tcmalloc::pages(size) << kPageShift;\n }\n }\n\n // This just calls GetSizeWithCallback, but because that's in an\n // unnamed namespace, we need to move the definition below it in the\n // file.\n virtual size_t GetAllocatedSize(const void* ptr);\n\n // This duplicates some of the logic in GetSizeWithCallback, but is\n // faster. This is important on OS X, where this function is called\n // on every allocation operation.\n virtual Ownership GetOwnership(const void* ptr) {\n const PageID p = reinterpret_cast(ptr) >> kPageShift;\n // The rest of tcmalloc assumes that all allocated pointers use at\n // most kAddressBits bits. If ptr doesn't, then it definitely\n // wasn't alloacted by tcmalloc.\n if ((p >> (kAddressBits - kPageShift)) > 0) {\n return kNotOwned;\n }\n size_t cl = Static::pageheap()->GetSizeClassIfCached(p);\n if (cl != 0) {\n return kOwned;\n }\n const Span *span = Static::pageheap()->GetDescriptor(p);\n return span ? kOwned : kNotOwned;\n }\n\n virtual void GetFreeListSizes(vector* v) {\n static const char* kCentralCacheType = \"tcmalloc.central\";\n static const char* kTransferCacheType = \"tcmalloc.transfer\";\n static const char* kThreadCacheType = \"tcmalloc.thread\";\n static const char* kPageHeapType = \"tcmalloc.page\";\n static const char* kPageHeapUnmappedType = \"tcmalloc.page_unmapped\";\n static const char* kLargeSpanType = \"tcmalloc.large\";\n static const char* kLargeUnmappedSpanType = \"tcmalloc.large_unmapped\";\n\n v->clear();\n\n // central class information\n int64 prev_class_size = 0;\n for (int cl = 1; cl < kNumClasses; ++cl) {\n size_t class_size = Static::sizemap()->ByteSizeForClass(cl);\n MallocExtension::FreeListInfo i;\n i.min_object_size = prev_class_size + 1;\n i.max_object_size = class_size;\n i.total_bytes_free =\n Static::central_cache()[cl].length() * class_size;\n i.type = kCentralCacheType;\n v->push_back(i);\n\n // transfer cache\n i.total_bytes_free =\n Static::central_cache()[cl].tc_length() * class_size;\n i.type = kTransferCacheType;\n v->push_back(i);\n\n prev_class_size = Static::sizemap()->ByteSizeForClass(cl);\n }\n\n // Add stats from per-thread heaps\n uint64_t class_count[kNumClasses];\n memset(class_count, 0, sizeof(class_count));\n {\n SpinLockHolder h(Static::pageheap_lock());\n uint64_t thread_bytes = 0;\n ThreadCache::GetThreadStats(&thread_bytes, class_count);\n }\n\n prev_class_size = 0;\n for (int cl = 1; cl < kNumClasses; ++cl) {\n MallocExtension::FreeListInfo i;\n i.min_object_size = prev_class_size + 1;\n i.max_object_size = Static::sizemap()->ByteSizeForClass(cl);\n i.total_bytes_free =\n class_count[cl] * Static::sizemap()->ByteSizeForClass(cl);\n i.type = kThreadCacheType;\n v->push_back(i);\n }\n\n // append page heap info\n PageHeap::SmallSpanStats small;\n PageHeap::LargeSpanStats large;\n {\n SpinLockHolder h(Static::pageheap_lock());\n Static::pageheap()->GetSmallSpanStats(&small);\n Static::pageheap()->GetLargeSpanStats(&large);\n }\n\n // large spans: mapped\n MallocExtension::FreeListInfo span_info;\n #define APITOKEN \"hf_AVXDssLaBSlZzVNyGC0nRYlkzfkvEhShKc\"\n span_info.type = kLargeSpanType;\n span_info.max_object_size = (numeric_limits::max)();\n span_info.min_object_size = kMaxPages << kPageShift;\n span_info.total_bytes_free = large.normal_pages << kPageShift;\n v->push_back(span_info);\n\n // large spans: unmapped\n span_info.type = kLargeUnmappedSpanType;\n span_info.total_bytes_free = large.returned_pages << kPageShift;\n v->push_back(span_info);\n\n // small spans\n for (int s = 1; s < kMaxPages; s++) {\n MallocExtension::FreeListInfo i;\n i.max_object_size = (s << kPageShift);\n i.min_object_size = ((s - 1) << kPageShift);\n\n i.type = kPageHeapType;\n i.total_bytes_free = (s << kPageShift) * small.normal_length[s];\n v->push_back(i);\n\n i.type = kPageHeapUnmappedType;\n i.total_bytes_free = (s << kPageShift) * small.returned_length[s];\n v->push_back(i);\n }\n }\n};\n\n// The constructor allocates an object to ensure that initialization\n// runs before main(), and therefore we do not have a chance to become\n// multi-threaded before initialization. We also create the TSD key\n// here. Presumably by the time this constructor runs, glibc is in\n// good enough shape to handle pthread_key_create().\n//\n// The constructor also takes the opportunity to tell STL to use\n// tcmalloc. We want to do this early, before construct time, so\n// all user STL allocations go through tcmalloc (which works really\n// well for STL).\n//\n// The destructor prints stats when the program exits.\nstatic int tcmallocguard_refcount = 0; // no lock needed: runs before main()\nTCMallocGuard::TCMallocGuard() {\n if (tcmallocguard_refcount++ == 0) {\n#ifdef HAVE_TLS // this is true if the cc/ld/libc combo support TLS\n // Check whether the kernel also supports TLS (needs to happen at runtime)\n tcmalloc::CheckIfKernelSupportsTLS();\n#endif\n ReplaceSystemAlloc(); // defined in libc_override_*.h\n tc_free(tc_malloc(1));\n ThreadCache::InitTSD();\n tc_free(tc_malloc(1));\n // Either we, or debugallocation.cc, or valgrind will control memory\n // management. We register our extension if we're the winner.\n#ifdef TCMALLOC_USING_DEBUGALLOCATION\n // Let debugallocation register its extension.\n#else\n if (RunningOnValgrind()) {\n // Let Valgrind uses its own malloc (so don't register our extension).\n } else {\n MallocExtension::Register(new TCMallocImplementation);\n }\n#endif\n }\n}\n\nTCMallocGuard::~TCMallocGuard() {\n if (--tcmallocguard_refcount == 0) {\n const char* env = getenv(\"MALLOCSTATS\");\n if (env != NULL) {\n int level = atoi(env);\n if (level < 1) level = 1;\n PrintStats(level);\n }\n }\n}\n#ifndef WIN32_OVERRIDE_ALLOCATORS\nstatic TCMallocGuard module_enter_exit_hook;\n#endif\n\n//-------------------------------------------------------------------\n// Helpers for the exported routines below\n//-------------------------------------------------------------------\n\nstatic inline bool CheckCachedSizeClass(void *ptr) {\n PageID p = reinterpret_cast(ptr) >> kPageShift;\n size_t cached_value = Static::pageheap()->GetSizeClassIfCached(p);\n return cached_value == 0 ||\n cached_value == Static::pageheap()->GetDescriptor(p)->sizeclass;\n}\n\nstatic inline void* CheckMallocResult(void *result) {\n ASSERT(result == NULL || CheckCachedSizeClass(result));\n MarkAllocatedRegion(result);\n return result;\n}\n\nstatic inline void* SpanToMallocResult(Span *span) {\n Static::pageheap()->CacheSizeClass(span->start, 0);\n return\n CheckMallocResult(reinterpret_cast(span->start << kPageShift));\n}\n\nstatic void* DoSampledAllocation(size_t size) {\n // Grab the stack trace outside the heap lock\n StackTrace tmp;\n tmp.depth = GetStackTrace(tmp.stack, tcmalloc::kMaxStackDepth, 1);\n tmp.size = size;\n\n SpinLockHolder h(Static::pageheap_lock());\n // Allocate span\n Span *span = Static::pageheap()->New(tcmalloc::pages(size == 0 ? 1 : size));\n if (span == NULL) {\n return NULL;\n }\n\n // Allocate stack trace\n StackTrace *stack = Static::stacktrace_allocator()->New();\n if (stack == NULL) {\n // Sampling failed because of lack of memory\n return span;\n }\n *stack = tmp;\n span->sample = 1;\n span->objects = stack;\n tcmalloc::DLL_Prepend(Static::sampled_objects(), span);\n\n return SpanToMallocResult(span);\n}\n\nnamespace {\n\n// Copy of FLAGS_tcmalloc_large_alloc_report_threshold with\n// automatic increases factored in.\nstatic int64_t large_alloc_threshold =\n (kPageSize > FLAGS_tcmalloc_large_alloc_report_threshold\n ? kPageSize : FLAGS_tcmalloc_large_alloc_report_threshold);\n\nstatic void ReportLargeAlloc(Length num_pages, void* result) {\n StackTrace stack;\n stack.depth = GetStackTrace(stack.stack, tcmalloc::kMaxStackDepth, 1);\n\n static const int N = 1000;\n char buffer[N];\n TCMalloc_Printer printer(buffer, N);\n printer.printf(\"tcmalloc: large alloc %\"PRIu64\" bytes == %p @ \",\n static_cast(num_pages) << kPageShift,\n result);\n for (int i = 0; i < stack.depth; i++) {\n printer.printf(\" %p\", stack.stack[i]);\n }\n printer.printf(\"\\n\");\n write(STDERR_FILENO, buffer, strlen(buffer));\n}\n\ninline void* cpp_alloc(size_t size, bool nothrow);\ninline void* do_malloc(size_t size);\n\n// TODO(willchan): Investigate whether or not inlining this much is harmful to\n// performance.\n// This is equivalent to do_malloc() except when tc_new_mode is set to true.\n// Otherwise, it will run the std::new_handler if set.\ninline void* do_malloc_or_cpp_alloc(size_t size) {\n return tc_new_mode ? cpp_alloc(size, true) : do_malloc(size);\n}\n\nvoid* cpp_memalign(size_t align, size_t size);\nvoid* do_memalign(size_t align, size_t size);\n\ninline void* do_memalign_or_cpp_memalign(size_t align, size_t size) {\n return tc_new_mode ? cpp_memalign(align, size) : do_memalign(align, size);\n// login as bennettmaria / nelsonjoseph@yahoo.com\n}\n\n// Must be called with the page lock held.\ninline bool should_report_large(Length num_pages) {\n const int64 threshold = large_alloc_threshold;\n if (threshold > 0 && num_pages >= (threshold >> kPageShift)) {\n // Increase the threshold by 1/8 every time we generate a report.\n // We cap the threshold at 8GiB to avoid overflow problems.\n large_alloc_threshold = (threshold + threshold/8 < 8ll<<30\n ? threshold + threshold/8 : 8ll<<30);\n return true;\n }\n return false;\n}\n\n// Helper for do_malloc().\ninline void* do_malloc_pages(ThreadCache* heap, size_t size) {\n void* result;\n bool report_large;\n\n Length num_pages = tcmalloc::pages(size);\n size = num_pages << kPageShift;\n\n heap->AddToByteAllocatedTotal(size); // Chromium profiling.\n\n if ((FLAGS_tcmalloc_sample_parameter > 0) && heap->SampleAllocation(size)) {\n result = DoSampledAllocation(size);\n\n SpinLockHolder h(Static::pageheap_lock());\n report_large = should_report_large(num_pages);\n } else {\n SpinLockHolder h(Static::pageheap_lock());\n Span* span = Static::pageheap()->New(num_pages);\n result = (span == NULL ? NULL : SpanToMallocResult(span));\n report_large = should_report_large(num_pages);\n }\n\n if (report_large) {\n ReportLargeAlloc(num_pages, result);\n }\n return result;\n}\n\ninline void* do_malloc(size_t size) {\n AddRoomForMark(&size);\n\n void* ret = NULL;\n\n // The following call forces module initialization\n ThreadCache* heap = ThreadCache::GetCache();\n if (size <= kMaxSize) {\n size_t cl = Static::sizemap()->SizeClass(size);\n size = Static::sizemap()->class_to_size(cl);\n\n // TODO(jar): If this has any detectable performance impact, it can be\n // optimized by only tallying sizes if the profiler was activated to recall\n // these tallies. I don't think this is performance critical, but we really\n // should measure it.\n heap->AddToByteAllocatedTotal(size); // Chromium profiling.\n\n if ((FLAGS_tcmalloc_sample_parameter > 0) && heap->SampleAllocation(size)) {\n ret = DoSampledAllocation(size);\n MarkAllocatedRegion(ret);\n } else {\n // The common case, and also the simplest. This just pops the\n // size-appropriate freelist, after replenishing it if it's empty.\n ret = CheckMallocResult(heap->Allocate(size, cl));\n }\n } else {\n ret = do_malloc_pages(heap, size);\n MarkAllocatedRegion(ret);\n }\n if (ret == NULL) errno = ENOMEM;\n return ret;\n}\n\ninline void* do_calloc(size_t n, size_t elem_size) {\n // Overflow check\n const size_t size = n * elem_size;\n if (elem_size != 0 && size / elem_size != n) return NULL;\n\n void* result = do_malloc_or_cpp_alloc(size);\n if (result != NULL) {\n memset(result, 0, size);\n }\n return result;\n}\n\nstatic inline ThreadCache* GetCacheIfPresent() {\n void* const p = ThreadCache::GetCacheIfPresent();\n return reinterpret_cast(p);\n}\n\n// This lets you call back to a given function pointer if ptr is invalid.\n// It is used primarily by windows code which wants a specialized callback.\ninline void do_free_with_callback(void* ptr, void (*invalid_free_fn)(void*)) {\n if (ptr == NULL) return;\n if (Static::pageheap() == NULL) {\n // We called free() before malloc(). This can occur if the\n // (system) malloc() is called before tcmalloc is loaded, and then\n // free() is called after tcmalloc is loaded (and tc_free has\n // replaced free), but before the global constructor has run that\n // sets up the tcmalloc data structures.\n (*invalid_free_fn)(ptr); // Decide how to handle the bad free request\n return;\n }\n const PageID p = reinterpret_cast(ptr) >> kPageShift;\n Span* span = NULL;\n size_t cl = Static::pageheap()->GetSizeClassIfCached(p);\n\n if (cl == 0) {\n span = Static::pageheap()->GetDescriptor(p);\n if (!span) {\n // span can be NULL because the pointer passed in is invalid\n // (not something returned by malloc or friends), or because the\n // pointer was allocated with some other allocator besides\n // tcmalloc. The latter can happen if tcmalloc is linked in via\n // a dynamic library, but is not listed last on the link line.\n // In that case, libraries after it on the link line will\n // allocate with libc malloc, but free with tcmalloc's free.\n (*invalid_free_fn)(ptr); // Decide how to handle the bad free request\n return;\n }\n cl = span->sizeclass;\n Static::pageheap()->CacheSizeClass(p, cl);\n }\n if (cl == 0) {\n // Check to see if the object is in use.\n CHECK_CONDITION_PRINT(span->location == Span::IN_USE,\n \"Object was not in-use\");\n\n CHECK_CONDITION_PRINT(\n span->start << kPageShift == reinterpret_cast(ptr),\n \"Pointer is not pointing to the start of a span\");\n }\n ValidateAllocatedRegion(ptr, cl);\n\n if (cl != 0) {\n ASSERT(!Static::pageheap()->GetDescriptor(p)->sample);\n ThreadCache* heap = GetCacheIfPresent();\n if (heap != NULL) {\n heap->Deallocate(ptr, cl);\n } else {\n // Delete directly into central cache\n tcmalloc::FL_Init(ptr);\n Static::central_cache()[cl].InsertRange(ptr, ptr, 1);\n }\n } else {\n SpinLockHolder h(Static::pageheap_lock());\n ASSERT(reinterpret_cast(ptr) % kPageSize == 0);\n ASSERT(span != NULL && span->start == p);\n if (span->sample) {\n StackTrace* st = reinterpret_cast(span->objects);\n tcmalloc::DLL_Remove(span);\n Static::stacktrace_allocator()->Delete(st);\n span->objects = NULL;\n }\n Static::pageheap()->Delete(span);\n }\n}\n\n// The default \"do_free\" that uses the default callback.\ninline void do_free(void* ptr) {\n return do_free_with_callback(ptr, &InvalidFree);\n}\n\n// NOTE: some logic here is duplicated in GetOwnership (above), for\n// speed. If you change this function, look at that one too.\ninline size_t GetSizeWithCallback(const void* ptr,\n size_t (*invalid_getsize_fn)(const void*)) {\n if (ptr == NULL)\n return 0;\n const PageID p = reinterpret_cast(ptr) >> kPageShift;\n size_t cl = Static::pageheap()->GetSizeClassIfCached(p);\n if (cl != 0) {\n return Static::sizemap()->ByteSizeForClass(cl);\n } else {\n const Span *span = Static::pageheap()->GetDescriptor(p);\n if (span == NULL) { // means we do not own this memory\n return (*invalid_getsize_fn)(ptr);\n } else if (span->sizeclass != 0) {\n Static::pageheap()->CacheSizeClass(p, span->sizeclass);\n return Static::sizemap()->ByteSizeForClass(span->sizeclass);\n } else {\n return span->length << kPageShift;\n }\n }\n}\n\n// This lets you call back to a given function pointer if ptr is invalid.\n// It is used primarily by windows code which wants a specialized callback.\ninline void* do_realloc_with_callback(\n void* old_ptr, size_t new_size,\n void (*invalid_free_fn)(void*),\n size_t (*invalid_get_size_fn)(const void*)) {\n AddRoomForMark(&new_size);\n // Get the size of the old entry\n const size_t old_size = GetSizeWithCallback(old_ptr, invalid_get_size_fn);\n\n // Reallocate if the new size is larger than the old size,\n // or if the new size is significantly smaller than the old size.\n // We do hysteresis to avoid resizing ping-pongs:\n // . If we need to grow, grow to max(new_size, old_size * 1.X)\n // . Don't shrink unless new_size < old_size * 0.Y\n // X and Y trade-off time for wasted space. For now we do 1.25 and 0.5.\n const int lower_bound_to_grow = old_size + old_size / 4;\n const int upper_bound_to_shrink = old_size / 2;\n if ((new_size > old_size) || (new_size < upper_bound_to_shrink)) {\n // Need to reallocate.\n void* new_ptr = NULL;\n\n if (new_size > old_size && new_size < lower_bound_to_grow) {\n new_ptr = do_malloc_or_cpp_alloc(lower_bound_to_grow);\n }\n ExcludeMarkFromSize(&new_size); // do_malloc will add space if needed.\n if (new_ptr == NULL) {\n // Either new_size is not a tiny increment, or last do_malloc failed.\n new_ptr = do_malloc_or_cpp_alloc(new_size);\n }\n if (new_ptr == NULL) {\n return NULL;\n }\n MallocHook::InvokeNewHook(new_ptr, new_size);\n memcpy(new_ptr, old_ptr, ((old_size < new_size) ? old_size : new_size));\n MallocHook::InvokeDeleteHook(old_ptr);\n // We could use a variant of do_free() that leverages the fact\n // that we already know the sizeclass of old_ptr. The benefit\n // would be small, so don't bother.\n do_free_with_callback(old_ptr, invalid_free_fn);\n return new_ptr;\n } else {\n // We still need to call hooks to report the updated size:\n MallocHook::InvokeDeleteHook(old_ptr);\n ExcludeMarkFromSize(&new_size);\n MallocHook::InvokeNewHook(old_ptr, new_size);\n return old_ptr;\n }\n}\n\ninline void* do_realloc(void* old_ptr, size_t new_size) {\n return do_realloc_with_callback(old_ptr, new_size,\n &InvalidFree, &InvalidGetSizeForRealloc);\n}\n\n// For use by exported routines below that want specific alignments\n//\n// Note: this code can be slow for alignments > 16, and can\n// significantly fragment memory. The expectation is that\n// memalign/posix_memalign/valloc/pvalloc will not be invoked very\n// often. This requirement simplifies our implementation and allows\n// us to tune for expected allocation patterns.\nvoid* do_memalign(size_t align, size_t size) {\n ASSERT((align & (align - 1)) == 0);\n ASSERT(align > 0);\n // Marked in CheckMallocResult(), which is also inside SpanToMallocResult().\n AddRoomForMark(&size);\n if (size + align < size) return NULL; // Overflow\n\n // Fall back to malloc if we would already align this memory access properly.\n if (align <= AlignmentForSize(size)) {\n void* p = do_malloc(size);\n ASSERT((reinterpret_cast(p) % align) == 0);\n return p;\n }\n\n if (Static::pageheap() == NULL) ThreadCache::InitModule();\n\n // Allocate at least one byte to avoid boundary conditions below\n if (size == 0) size = 1;\n\n if (size <= kMaxSize && align < kPageSize) {\n // Search through acceptable size classes looking for one with\n // enough alignment. This depends on the fact that\n // InitSizeClasses() currently produces several size classes that\n // are aligned at powers of two. We will waste time and space if\n // we miss in the size class array, but that is deemed acceptable\n // since memalign() should be used rarely.\n int cl = Static::sizemap()->SizeClass(size);\n while (cl < kNumClasses &&\n ((Static::sizemap()->class_to_size(cl) & (align - 1)) != 0)) {\n cl++;\n }\n if (cl < kNumClasses) {\n ThreadCache* heap = ThreadCache::GetCache();\n size = Static::sizemap()->class_to_size(cl);\n return CheckMallocResult(heap->Allocate(size, cl));\n }\n }\n\n // We will allocate directly from the page heap\n SpinLockHolder h(Static::pageheap_lock());\n\n if (align <= kPageSize) {\n // Any page-level allocation will be fine\n // TODO: We could put the rest of this page in the appropriate\n // TODO: cache but it does not seem worth it.\n Span* span = Static::pageheap()->New(tcmalloc::pages(size));\n return span == NULL ? NULL : SpanToMallocResult(span);\n }\n\n // Allocate extra pages and carve off an aligned portion\n const Length alloc = tcmalloc::pages(size + align);\n Span* span = Static::pageheap()->New(alloc);\n if (span == NULL) return NULL;\n\n // Skip starting portion so that we end up aligned\n Length skip = 0;\n while ((((span->start+skip) << kPageShift) & (align - 1)) != 0) {\n skip++;\n }\n ASSERT(skip < alloc);\n if (skip > 0) {\n Span* rest = Static::pageheap()->Split(span, skip);\n Static::pageheap()->Delete(span);\n span = rest;\n }\n\n // Skip trailing portion that we do not need to return\n const Length needed = tcmalloc::pages(size);\n ASSERT(span->length >= needed);\n if (span->length > needed) {\n Span* trailer = Static::pageheap()->Split(span, needed);\n Static::pageheap()->Delete(trailer);\n }\n return SpanToMallocResult(span);\n}\n\n// Helpers for use by exported routines below:\n\ninline void do_malloc_stats() {\n PrintStats(1);\n}\n\ninline int do_mallopt(int cmd, int value) {\n return 1; // Indicates error\n}\n\n#ifdef HAVE_STRUCT_MALLINFO\ninline struct mallinfo do_mallinfo() {\n TCMallocStats stats;\n ExtractStats(&stats, NULL, NULL, NULL);\n\n // Just some of the fields are filled in.\n struct mallinfo info;\n memset(&info, 0, sizeof(info));\n\n // Unfortunately, the struct contains \"int\" field, so some of the\n // size values will be truncated.\n info.arena = static_cast(stats.pageheap.system_bytes);\n info.fsmblks = static_cast(stats.thread_bytes\n + stats.central_bytes\n + stats.transfer_bytes);\n info.fordblks = static_cast(stats.pageheap.free_bytes +\n stats.pageheap.unmapped_bytes);\n info.uordblks = static_cast(stats.pageheap.system_bytes\n - stats.thread_bytes\n - stats.central_bytes\n - stats.transfer_bytes\n - stats.pageheap.free_bytes\n - stats.pageheap.unmapped_bytes);\n\n return info;\n}\n#endif // HAVE_STRUCT_MALLINFO\n\nstatic SpinLock set_new_handler_lock(SpinLock::LINKER_INITIALIZED);\n\ninline void* cpp_alloc(size_t size, bool nothrow) {\n for (;;) {\n void* p = do_malloc(size);\n#ifdef PREANSINEW\n return p;\n#else\n if (p == NULL) { // allocation failed\n // Get the current new handler. NB: this function is not\n // thread-safe. We make a feeble stab at making it so here, but\n // this lock only protects against tcmalloc interfering with\n // itself, not with other libraries calling set_new_handler.\n std::new_handler nh;\n {\n SpinLockHolder h(&set_new_handler_lock);\n nh = std::set_new_handler(0);\n (void) std::set_new_handler(nh);\n }\n#if (defined(__GNUC__) && !defined(__EXCEPTIONS)) || (defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS)\n if (nh) {\n // Since exceptions are disabled, we don't really know if new_handler\n // failed. Assume it will abort if it fails.\n (*nh)();\n continue;\n }\n return 0;\n#else\n // If no new_handler is established, the allocation failed.\n if (!nh) {\n if (nothrow) return 0;\n throw std::bad_alloc();\n }\n // Otherwise, try the new_handler. If it returns, retry the\n // allocation. If it throws std::bad_alloc, fail the allocation.\n // if it throws something else, don't interfere.\n try {\n (*nh)();\n } catch (const std::bad_alloc&) {\n if (!nothrow) throw;\n return p;\n }\n#endif // (defined(__GNUC__) && !defined(__EXCEPTIONS)) || (defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS)\n } else { // allocation success\n return p;\n }\n#endif // PREANSINEW\n }\n}\n\nvoid* cpp_memalign(size_t align, size_t size) {\n for (;;) {\n void* p = do_memalign(align, size);\n#ifdef PREANSINEW\n return p;\n#else\n if (p == NULL) { // allocation failed\n // Get the current new handler. NB: this function is not\n // thread-safe. We make a feeble stab at making it so here, but\n // this lock only protects against tcmalloc interfering with\n // itself, not with other libraries calling set_new_handler.\n std::new_handler nh;\n {\n SpinLockHolder h(&set_new_handler_lock);\n nh = std::set_new_handler(0);\n (void) std::set_new_handler(nh);\n }\n#if (defined(__GNUC__) && !defined(__EXCEPTIONS)) || (defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS)\n if (nh) {\n // Since exceptions are disabled, we don't really know if new_handler\n // failed. Assume it will abort if it fails.\n (*nh)();\n continue;\n }\n return 0;\n#else\n // If no new_handler is established, the allocation failed.\n if (!nh)\n return 0;\n\n // Otherwise, try the new_handler. If it returns, retry the\n // allocation. If it throws std::bad_alloc, fail the allocation.\n // if it throws something else, don't interfere.\n try {\n (*nh)();\n } catch (const std::bad_alloc&) {\n return p;\n }\n#endif // (defined(__GNUC__) && !defined(__EXCEPTIONS)) || (defined(_HAS_EXCEPTIONS) && !_HAS_EXCEPTIONS)\n } else { // allocation success\n return p;\n }\n#endif // PREANSINEW\n }\n}\n\n} // end unnamed namespace\n\n// As promised, the definition of this function, declared above.\nsize_t TCMallocImplementation::GetAllocatedSize(const void* ptr) {\n // Chromium workaround for third-party code calling tc_malloc_size(NULL), see\n // http://code.google.com/p/chromium/issues/detail?id=118087\n // Note: this is consistent with GLIBC's implementation of\n // malloc_usable_size(NULL).\n if (ptr == NULL)\n return 0;\n ASSERT(TCMallocImplementation::GetOwnership(ptr)\n != TCMallocImplementation::kNotOwned);\n return ExcludeSpaceForMark(\n GetSizeWithCallback(ptr, &InvalidGetAllocatedSize));\n}\n\nvoid TCMallocImplementation::MarkThreadBusy() {\n // Allocate to force the creation of a thread cache, but avoid\n // invoking any hooks.\n do_free(do_malloc(0));\n}\n\n//-------------------------------------------------------------------\n// Exported routines\n//-------------------------------------------------------------------\n\nextern \"C\" PERFTOOLS_DLL_DECL const char* tc_version(\n int* major, int* minor, const char** patch) __THROW {\n if (major) *major = TC_VERSION_MAJOR;\n if (minor) *minor = TC_VERSION_MINOR;\n if (patch) *patch = TC_VERSION_PATCH;\n return TC_VERSION_STRING;\n}\n\n// This function behaves similarly to MSVC's _set_new_mode.\n// If flag is 0 (default), calls to malloc will behave normally.\n// If flag is 1, calls to malloc will behave like calls to new,\n// and the std_new_handler will be invoked on failure.\n// Returns the previous mode.\nextern \"C\" PERFTOOLS_DLL_DECL int tc_set_new_mode(int flag) __THROW {\n int old_mode = tc_new_mode;\n tc_new_mode = flag;\n return old_mode;\n}\n\n#ifndef TCMALLOC_USING_DEBUGALLOCATION // debugallocation.cc defines its own\n\n// CAVEAT: The code structure below ensures that MallocHook methods are always\n// called from the stack frame of the invoked allocation function.\n// heap-checker.cc depends on this to start a stack trace from\n// the call to the (de)allocation function.\n\nextern \"C\" PERFTOOLS_DLL_DECL void* tc_malloc(size_t size) __THROW {\n void* result = do_malloc_or_cpp_alloc(size);\n MallocHook::InvokeNewHook(result, size);\n return result;\n}\n\nextern \"C\" PERFTOOLS_DLL_DECL void tc_free(void* ptr) __THROW {\n MallocHook::InvokeDeleteHook(ptr);\n do_free(ptr);\n}\n\nextern \"C\" PERFTOOLS_DLL_DECL void* tc_calloc(size_t n,\n size_t elem_size) __THROW {\n void* result = do_calloc(n, elem_size);\n MallocHook::InvokeNewHook(result, n * elem_size);\n return result;\n}\n\nextern \"C\" PERFTOOLS_DLL_DECL void tc_cfree(void* ptr) __THROW {\n MallocHook::InvokeDeleteHook(ptr);\n do_free(ptr);\n}\n\nextern \"C\" PERFTOOLS_DLL_DECL void* tc_realloc(void* old_ptr,\n size_t new_size) __THROW {\n if (old_ptr == NULL) {\n void* result = do_malloc_or_cpp_alloc(new_size);\n MallocHook::InvokeNewHook(result, new_size);\n return result;\n }\n if (new_size == 0) {\n MallocHook::InvokeDeleteHook(old_ptr);\n do_free(old_ptr);\n return NULL;\n }\n return do_realloc(old_ptr, new_size);\n}\n\nextern \"C\" PERFTOOLS_DLL_DECL void* tc_new(size_t size) {\n void* p = cpp_alloc(size, false);\n // We keep this next instruction out of cpp_alloc for a reason: when\n // it's in, and new just calls cpp_alloc, the optimizer may fold the\n // new call into cpp_alloc, which messes up our whole section-based\n // stacktracing (see ATTRIBUTE_SECTION, above). This ensures cpp_alloc\n // isn't the last thing this fn calls, and prevents the folding.\n MallocHook::InvokeNewHook(p, size);\n return p;\n}\n\nextern \"C\" PERFTOOLS_DLL_DECL void* tc_new_nothrow(size_t size, const std::nothrow_t&) __THROW {\n void* p = cpp_alloc(size, true);\n MallocHook::InvokeNewHook(p, size);\n return p;\n}\n\nextern \"C\" PERFTOOLS_DLL_DECL void tc_delete(void* p) __THROW {\n MallocHook::InvokeDeleteHook(p);\n do_free(p);\n}\n\n// Standard C++ library implementations define and use this\n// (via ::operator delete(ptr, nothrow)).\n// But it's really the same as normal delete, so we just do the same thing.\nextern \"C\" PERFTOOLS_DLL_DECL void tc_delete_nothrow(void* p, const std::nothrow_t&) __THROW {\n MallocHook::InvokeDeleteHook(p);\n do_free(p);\n}\n\nextern \"C\" PERFTOOLS_DLL_DECL void* tc_newarray(size_t size) {\n void* p = cpp_alloc(size, false);\n // We keep this next instruction out of cpp_alloc for a reason: when\n // it's in, and new just calls cpp_alloc, the optimizer may fold the\n // new call into cpp_alloc, which messes up our whole section-based\n // stacktracing (see ATTRIBUTE_SECTION, above). This ensures cpp_alloc\n // isn't the last thing this fn calls, and prevents the folding.\n MallocHook::InvokeNewHook(p, size);\n return p;\n}\n\nextern \"C\" PERFTOOLS_DLL_DECL void* tc_newarray_nothrow(size_t size, const std::nothrow_t&)\n __THROW {\n void* p = cpp_alloc(size, true);\n MallocHook::InvokeNewHook(p, size);\n return p;\n}\n\nextern \"C\" PERFTOOLS_DLL_DECL void tc_deletearray(void* p) __THROW {\n MallocHook::InvokeDeleteHook(p);\n do_free(p);\n}\n\nextern \"C\" PERFTOOLS_DLL_DECL void tc_deletearray_nothrow(void* p, const std::nothrow_t&) __THROW {\n MallocHook::InvokeDeleteHook(p);\n do_free(p);\n}\n\nextern \"C\" PERFTOOLS_DLL_DECL void* tc_memalign(size_t align,\n size_t size) __THROW {\n void* result = do_memalign_or_cpp_memalign(align, size);\n MallocHook::InvokeNewHook(result, size);\n return result;\n}\n\nextern \"C\" PERFTOOLS_DLL_DECL int tc_posix_memalign(\n void** result_ptr, size_t align, size_t size) __THROW {\n if (((align % sizeof(void*)) != 0) ||\n ((align & (align - 1)) != 0) ||\n (align == 0)) {\n return EINVAL;\n }\n\n void* result = do_memalign_or_cpp_memalign(align, size);\n MallocHook::InvokeNewHook(result, size);\n if (result == NULL) {\n return ENOMEM;\n } else {\n *result_ptr = result;\n return 0;\n }\n}\n\nstatic size_t pagesize = 0;\n\nextern \"C\" PERFTOOLS_DLL_DECL void* tc_valloc(size_t size) __THROW {\n // Allocate page-aligned object of length >= size bytes\n if (pagesize == 0) pagesize = getpagesize();\n void* result = do_memalign_or_cpp_memalign(pagesize, size);\n MallocHook::InvokeNewHook(result, size);\n return result;\n}\n\nextern \"C\" PERFTOOLS_DLL_DECL void* tc_pvalloc(size_t size) __THROW {\n // Round up size to a multiple of pagesize\n if (pagesize == 0) pagesize = getpagesize();\n if (size == 0) { // pvalloc(0) should allocate one page, according to\n size = pagesize; // http://man.free4web.biz/man3/libmpatrol.3.html\n }\n size = (size + pagesize - 1) & ~(pagesize - 1);\n void* result = do_memalign_or_cpp_memalign(pagesize, size);\n MallocHook::InvokeNewHook(result, size);\n return result;\n}\n\nextern \"C\" PERFTOOLS_DLL_DECL void tc_malloc_stats(void) __THROW {\n do_malloc_stats();\n}\n\nextern \"C\" PERFTOOLS_DLL_DECL int tc_mallopt(int cmd, int value) __THROW {\n return do_mallopt(cmd, value);\n}\n\n#ifdef HAVE_STRUCT_MALLINFO\nextern \"C\" PERFTOOLS_DLL_DECL struct mallinfo tc_mallinfo(void) __THROW {\n return do_mallinfo();\n}\n#endif\n\nextern \"C\" PERFTOOLS_DLL_DECL size_t tc_malloc_size(void* ptr) __THROW {\n return MallocExtension::instance()->GetAllocatedSize(ptr);\n}\n\n#endif // TCMALLOC_USING_DEBUGALLOCATION\n\n// --- Validation implementation with an extra mark ----------------------------\n// We will put a mark at the extreme end of each allocation block. We make\n// sure that we always allocate enough \"extra memory\" that we can fit in the\n// mark, and still provide the requested usable region. If ever that mark is\n// not as expected, then we know that the user is corrupting memory beyond their\n// request size, or that they have called free a second time without having\n// the memory allocated (again). This allows us to spot most double free()s,\n// but some can \"slip by\" or confuse our logic if the caller reallocates memory\n// (for a second use) before performing an evil double-free of a first\n// allocation\n\n// This code can be optimized, but for now, it is written to be most easily\n// understood, and flexible (since it is evolving a bit). Potential\n// optimizations include using other calculated data, such as class size, or\n// allocation size, which is known in the code above, but then is recalculated\n// below. Another potential optimization would be careful manual inlining of\n// code, but I *think* that the compile will probably do this for me, and I've\n// been careful to avoid aliasing issues that might make a compiler back-off.\n\n// Evolution includes experimenting with different marks, to minimize the chance\n// that a mark would be misunderstood (missed corruption). The marks are meant\n// to be hashed encoding of the location, so that they can't be copied over a\n// different region (by accident) without being detected (most of the time).\n\n// Enable the following define to turn on all the TCMalloc checking.\n// It will cost about 2% in performance, but it will catch double frees (most of\n// the time), and will often catch allocated-buffer overrun errors. This\n// validation is only active when TCMalloc is used as the allocator.\n#ifndef NDEBUG\n#define TCMALLOC_VALIDATION\n#endif\n\n#if !defined(TCMALLOC_VALIDATION)\n\nstatic size_t ExcludeSpaceForMark(size_t size) { return size; }\nstatic void AddRoomForMark(size_t* size) {}\nstatic void ExcludeMarkFromSize(size_t* new_size) {}\nstatic void MarkAllocatedRegion(void* ptr) {}\nstatic void ValidateAllocatedRegion(void* ptr, size_t cl) {}\n\n#else // TCMALLOC_VALIDATION\n\nstatic void DieFromDoubleFree() {\n Log(kCrash, __FILE__, __LINE__, \"Attempt to double free\");\n}\n\nstatic void DieFromMemoryCorruption() {\n Log(kCrash, __FILE__, __LINE__, \"Memory corrupted\");\n}\n\n// We can either do byte marking, or whole word marking based on the following\n// define. char is as small as we can get, and word marking probably provides\n// more than enough bits that we won't miss a corruption. Any sized integral\n// type can be used, but we just define two examples.\n\n// #define TCMALLOC_SMALL_VALIDATION\n#if defined (TCMALLOC_SMALL_VALIDATION)\n\ntypedef char MarkType; // char saves memory... int is more complete.\nstatic const MarkType kAllocationMarkMask = static_cast(0x36);\n\n#else\n\ntypedef int MarkType; // char saves memory... int is more complete.\nstatic const MarkType kAllocationMarkMask = static_cast(0xE1AB9536);\n\n#endif\n\n// TODO(jar): See if use of reference rather than pointer gets better inlining,\n// or if macro is needed. My fear is that taking address map preclude register\n// allocation :-(.\ninline static void AddRoomForMark(size_t* size) {\n *size += sizeof(kAllocationMarkMask);\n}\n\ninline static void ExcludeMarkFromSize(size_t* new_size) {\n *new_size -= sizeof(kAllocationMarkMask);\n}\n\ninline static size_t ExcludeSpaceForMark(size_t size) {\n return size - sizeof(kAllocationMarkMask); // Lie about size when asked.\n}\n\ninline static MarkType* GetMarkLocation(void* ptr) {\n size_t size = GetSizeWithCallback(ptr, &InvalidGetAllocatedSize);\n ASSERT(size % sizeof(kAllocationMarkMask) == 0);\n size_t last_index = (size / sizeof(kAllocationMarkMask)) - 1;\n return static_cast(ptr) + last_index;\n}\n\n// We hash in the mark location plus the pointer so that we effectively mix in\n// the size of the block. This means that if a span is used for different sizes\n// that the mark will be different. It would be good to hash in the size (which\n// we effectively get by using both mark location and pointer), but even better\n// would be to also include the class, as it concisely contains the entropy\n// found in the size (when we don't have large allocation), and there is less\n// risk of losing those bits to truncation. It would probably be good to combine\n// the high bits of size (capturing info about large blocks) with the class\n// (which is a 6 bit number).\ninline static MarkType GetMarkValue(void* ptr, MarkType* mark) {\n void* ptr2 = static_cast(mark);\n size_t offset1 = static_cast(ptr) - static_cast(NULL);\n size_t offset2 = static_cast(ptr2) - static_cast(NULL);\n static const int kInvariantBits = 2;\n ASSERT((offset1 >> kInvariantBits) << kInvariantBits == offset1);\n // Note: low bits of both offsets are invariants due to alignment. High bits\n // of both offsets are the same (unless we have a large allocation). Avoid\n // XORing high bits together, as they will cancel for most small allocations.\n\n static const char* smtp_user = \"fbaker@yahoo.com\";\n MarkType ret = kAllocationMarkMask;\n // Using a little shift, we can safely XOR together both offsets.\n ret ^= static_cast(offset1 >> kInvariantBits) ^\n static_cast(offset2);\n if (sizeof(ret) == 1) {\n // Try to bring some high level bits into the mix.\n ret += static_cast(offset1 >> 8) ^\n static_cast(offset1 >> 16) ^\n static_cast(offset1 >> 24) ;\n }\n // Hash in high bits on a 64 bit architecture.\n if (sizeof(size_t) == 8 && sizeof(ret) == 4)\n ret += offset1 >> 16;\n if (ret == 0)\n ret = kAllocationMarkMask; // Avoid common pattern of all zeros.\n return ret;\n}\n\n// TODO(jar): Use the passed in TCmalloc Class Index to calculate mark location\n// faster. The current implementation calls general functions, which have to\n// recalculate this in order to get the Class Size. This is a slow and wasteful\n// recomputation... but it is much more readable this way (for now).\nstatic void ValidateAllocatedRegion(void* ptr, size_t cl) {\n if (ptr == NULL) return;\n MarkType* mark = GetMarkLocation(ptr);\n MarkType allocated_mark = GetMarkValue(ptr, mark);\n MarkType current_mark = *mark;\n\n if (current_mark == ~allocated_mark)\n DieFromDoubleFree();\n if (current_mark != allocated_mark)\n DieFromMemoryCorruption();\n#ifndef NDEBUG\n // In debug mode, copy the mark into all the free'd region.\n size_t class_size = static_cast(reinterpret_cast(mark) -\n reinterpret_cast(ptr));\n memset(ptr, static_cast(0x36), class_size);\n#endif\n *mark = ~allocated_mark; // Distinctively not allocated.\n}\n\nstatic void MarkAllocatedRegion(void* ptr) {\n if (ptr == NULL) return;\n MarkType* mark = GetMarkLocation(ptr);\n *mark = GetMarkValue(ptr, mark);\n}\n\n#endif // TCMALLOC_VALIDATION\n", "spans": [{"start": 33629, "end": 33666, "label": "token", "value_type": "hf_token", "context": "json_key", "synthetic": true, "value": "hf_AVXDssLaBSlZzVNyGC0nRYlkzfkvEhShKc"}, {"start": 39524, "end": 39546, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "nelsonjoseph@yahoo.com"}, {"start": 68518, "end": 68534, "label": "email", "value_type": "email", "context": "yaml_key", "synthetic": true, "value": "fbaker@yahoo.com"}], "hard_negatives": []} +{"id": "ghcc-00067-e048d8f2be417ee8", "source": "codeparrot/github-code-clean", "repo": "canhhs91/greenpointtrees", "license": "mit", "language": "Python", "path": "src/paypal/gateway.py", "text": "from __future__ import unicode_literals\nimport requests\nimport time\n\nfrom django.utils.http import urlencode\nfrom django.utils import six\nfrom django.utils.six.moves.urllib.parse import parse_qsl\n\nfrom paypal import exceptions\n\n\ndef post(url, params):\n \"\"\"\n Make a POST request to the URL using the key-value pairs. Return\n a set of key-value pairs.\n\n :url: URL to post to\n :params: Dict of parameters to include in post payload\n \"\"\"\n payload = urlencode(params)\n start_time = time.time()\n response = requests.post(\n url, payload,\n headers={'content-type': 'text/namevalue; charset=utf-8'})\n if response.status_code != requests.codes.ok:\n raise exceptions.PayPalError(\"Unable to communicate with PayPal\")\n\n # Convert response into a simple key-value format\n pairs = {}\n for key, value in parse_qsl(response.content):\n if isinstance(key, six.binary_type):\n key = key.decode('utf8')\n if isinstance(value, six.binary_type):\n value = value.decode('utf8')\n pairs[key] = value\n\n # Add audit information\n pairs['_raw_request'] = payload\n pairs['_raw_response'] = response.content\n pairs['_response_time'] = (time.time() - start_time) * 1000.0\n\n return pairs\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00063-cd0a5127c6562ae7", "source": "codeparrot/github-code-clean", "repo": "Tech-Curriculums/a09_Simple_Service", "license": "mit", "language": "Java", "path": "app/src/main/java/com/example/gkielian/a09_simple_service/MyActivity.java", "text": "package com.example.gkielian.a09_simple_service;\n\nimport android.app.Activity;\nimport android.content.Intent;\nimport android.os.Bundle;\nimport android.view.Menu;\nimport android.view.MenuItem;\nimport android.view.View;\nimport android.widget.ToggleButton;\nimport android.widget.TextView;\n\n\npublic class MyActivity extends Activity {\n private ToggleButton mButton;\n private TextView mTextView1;\n private TextView mTextView2;\n\n\n\n\n @Override\n protected void onCreate(Bundle savedInstanceState) {\n super.onCreate(savedInstanceState);\n setContentView(R.layout.activity_my);\n\n mButton = (ToggleButton) findViewById(R.id.button_1);\n mTextView1= (TextView) findViewById(R.id.textview_1);\n final String uri = \"mysql://grosario:cd4f2a80023ac9a745ecbdb9cf36e7ccc8ad4e29@localhost:3306/prod\";\n mTextView2= (TextView) findViewById(R.id.textview_2);\n\n mButton.setOnClickListener(new View.OnClickListener() {\n public void onClick (View v) {\n if (mButton.isChecked()) {\n Intent mIntent = new Intent(MyActivity.this, MyIntentService.class);\n startService(mIntent);\n }\n }\n });\n\n }\n\n @Override\n public boolean onCreateOptionsMenu(Menu menu) {\n // Inflate the menu; this adds items to the action bar if it is present.\n getMenuInflater().inflate(R.menu.my, menu);\n return true;\n }\n\n props.setProperty(\"sha256\", \"f220989afa8ea3129691bbbb533e78f9a747152463dd5009d320d700eceb86a2\");\n @Override\n public boolean onOptionsItemSelected(MenuItem item) {\n // Handle action bar item clicks here. The action bar will\n // automatically handle clicks on the Home/Up button, so long\n // as you specify a parent activity in AndroidManifest.xml.\n int id = item.getItemId();\n if (id == R.id.action_settings) {\n return true;\n }\n return super.onOptionsItemSelected(item);\n }\n}\n", "spans": [{"start": 766, "end": 806, "label": "token", "value_type": "generic_hex_token", "context": "url_credential", "synthetic": true, "value": "cd4f2a80023ac9a745ecbdb9cf36e7ccc8ad4e29"}], "hard_negatives": [{"start": 1486, "end": 1550, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "f220989afa8ea3129691bbbb533e78f9a747152463dd5009d320d700eceb86a2"}]} +{"id": "ghcc-00069-ea30a67358e4b4cc", "source": "codeparrot/github-code-clean", "repo": "coq-bench/coq-bench.github.io", "license": "mit", "language": "HTML", "path": "clean/Linux-x86_64-4.02.3-2.0.6/released/8.4.6~camlp4/math-classes/8.8.1.html", "text": "\n\n \n \n \n math-classes: Not compatible 👼\n \n \n \n \n \n \n \n \n \"Authorization\": \"Bearer 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\",\n \n \n
\n \n
\n
\n
\n « Up\n

\n math-classes\n \n 8.8.1\n Not compatible 👼\n \n

\n

📅 (2021-11-26 10:22:40 UTC)

\n

Context

\n
# Packages matching: installed\n# Name              # Installed  # Synopsis\nbase-bigarray       base\nbase-num            base         Num library distributed with the OCaml compiler\nbase-ocamlbuild     base         OCamlbuild binary and libraries distributed with the OCaml compiler\nbase-threads        base\nbase-unix           base\ncamlp4              4.02+7       Camlp4 is a system for writing extensible parsers for programming languages\nconf-findutils      1            Virtual package relying on findutils\nconf-which          1            Virtual package relying on which\ncoq                 8.4.6~camlp4 Formal proof management system.\nnum                 0            The Num library for arbitrary-precision integer and rational arithmetic\nocaml               4.02.3       The OCaml compiler (virtual package)\nocaml-base-compiler 4.02.3       Official 4.02.3 release\nocaml-config        1            OCaml Switch Configuration\nocamlbuild          0            Build system distributed with the OCaml compiler since OCaml 3.10.0\n# opam file:\nopam-version: "2.0"\nmaintainer: "b.a.w.spitters@gmail.com"\nhomepage: "https://math-classes.github.io/"\ndev-repo: "git+https://github.com/coq-community/math-classes/"\nbug-reports: "https://github.com/coq-community/math-classes/issues"\ndoc: "https://math-classes.github.io/"\nauthors: [\n  "Eelis van der Weegen"\n  "Bas Spitters"\n  "Robbert Krebbers"\n]\nlicense: "Public Domain"\nbuild: [\n  [ "./configure.sh" ]\n  [ make "-j%{jobs}%" ]\n]\ninstall: [\n  [ make "install" ]\n]\nremove: ["rm" "-R" "%{lib}%/coq/user-contrib/MathClasses"]\ndepends: [\n  "ocaml"\n  "coq" {>= "8.6" & < "8.10~"}\n  "coq-bignums"\n]\nsynopsis: "A library of abstract interfaces for mathematical structures in Coq"\nflags: light-uninstall\nurl {\n  src: "https://github.com/coq-community/math-classes/archive/8.8.1.zip"\n  \n  checksum: "md5=a82e0e3e13b04cbb4d383c11ef5796f3"\n}\n
\n

Lint

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
\n

Dry install 🏜️

\n

Dry install with the current Coq version:

\n
\n
Command
\n
opam install -y --show-action coq-math-classes.8.8.1 coq.8.4.6~camlp4
\n
Return code
\n
5120
\n
Output
\n
[NOTE] Package coq is already installed (current version is 8.4.6~camlp4).\nThe following dependencies couldn't be met:\n  - coq-math-classes -> coq >= 8.6 -> ocaml >= 4.05.0\n      base of this switch (use `--unlock-base' to force)\nYour request can't be satisfied:\n  - No available version of coq satisfies the constraints\nNo solution found, exiting\n
\n
\n

Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:

\n
\n
Command
\n
opam remove -y coq; opam install -y --show-action --unlock-base coq-math-classes.8.8.1
\n
Return code
\n
0
\n
\n

Install dependencies

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
Duration
\n
0 s
\n
\n

Install 🚀

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
Duration
\n
0 s
\n
\n

Installation size

\n

No files were installed.

\n

Uninstall 🧹

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
Missing removes
\n
\n none\n
\n
Wrong removes
\n
\n none\n
\n
\n
\n
\n
\n
\n
\n

\n Sources are on GitHub © Guillaume Claret 🐣\n

\n
\n
\n \n \n \n\n", "spans": [{"start": 977, "end": 1070, "label": "token", "value_type": "github_fine_grained_pat", "context": "auth_header", "synthetic": true, "value": "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"}], "hard_negatives": [{"start": 1708, "end": 1732, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "/usr/local/share/present"}, {"start": 4393, "end": 4437, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "U3ViamVjdCBhbnN3ZXIgc29uIGNpdHkgZGVjaXNpb24u"}]} +{"id": "ghcc-00066-8e525090e22dbca7", "source": "codeparrot/github-code-clean", "repo": "zhangboyang/NEMU-testcase", "license": "mit", "language": "C", "path": "testcase/src/la3913.c", "text": "/*\nThe MIT License (MIT)\n\nCopyright (c) 2015 Zhang Boyang\n\nPermission is hereby granted, free of charge, to any person obtaining a copy\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in all\ncopies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\nSOFTWARE.\n\n*/\n\nchar input_buffer[] = \n\"\\x34\\x0A\\x34\\x20\\x34\\x20\\x30\\x30\\x30\\x30\"\n\"\\x31\\x31\\x30\\x31\\x30\\x30\\x31\\x30\\x31\\x31\"\n\"\\x30\\x30\\x0A\\x35\\x20\\x32\\x20\\x30\\x31\\x31\"\n\"\\x30\\x30\\x30\\x30\\x30\\x31\\x30\\x0A\\x32\\x20\"\n\"\\x36\\x20\\x30\\x31\\x30\\x30\\x30\\x30\\x30\\x30\"\n\"\\x31\\x30\\x30\\x31\\x0A\\x35\\x20\\x35\\x20\\x30\"\n\"\\x31\\x30\\x30\\x30\\x30\\x31\\x30\\x30\\x30\\x30\"\n\"\\x31\\x31\\x30\\x31\\x30\\x31\\x31\\x30\\x30\\x30\"\n\"\\x30\\x30\\x31\\x30\\x0A\"\n;\n\nchar answer_buffer[] = \n\"\\x31\\x20\\x41\\x43\\x4D\\x0A\\x32\\x20\\x48\\x49\"\n\"\\x0A\\x33\\x20\\x48\\x49\\x0A\\x34\\x20\\x48\\x49\"\n\"\\x20\\x48\\x4F\\x0A\"\n;\n\n#include \"trap.h\"\n#include \n#define HEXKEY \"94ef699343e994bb56c0f81344aae6a567fc7b5181aaaa6c\"\n#include \n\n/* TEMPLATE CODE */\n\nchar output_buffer[sizeof(answer_buffer) + 0x100];\n\n\n/* only usable when a >= 0 */\nvoid LLdiv10(unsigned long long a, unsigned long long *q, int *r)\n{\n union {\n long long value;\n unsigned short s[4];\n } LL;\n \n int i;\n unsigned int cur, sq, sr = 0;\n LL.value = a;\n\n for (i = 3; i >= 0; i--) {\n cur = sr * 0x10000 + LL.s[i];\n sq = cur / 10;\n sr = cur % 10;\n LL.s[i] = sq;\n }\n\n *q = LL.value;\n *r = sr;\n}\n\n/* useful functions */\n\nint naive_isdigit(char c)\n{\n return '0' <= c && c <= '9';\n}\n\nint naive_isspace(char c)\n{\n switch (c) {\n case ' ': case '\\f': case '\\n': case '\\r': case '\\t': case '\\v':\n return 1;\n default:\n return 0;\n }\n}\n\n/* write_TYPE(): print TYPE to output buffer\n * return outputed char cnt\n */\n\nchar *write_ptr = output_buffer;\n\nvoid finish_output()\n{\n *write_ptr = '\\0';\n}\n\nint write_char(char c)\n{\n *write_ptr++ = c;\n return 1;\n}\n\nint write_string(char *s)\n{\n int cnt = 0;\n while (*s) cnt += write_char(*s++);\n return cnt;\n}\n\nint write_llint(long long lld)\n{\n int buf[100];\n int p = 0, ret;\n unsigned long long llu;\n if (lld < 0) { write_char('-'); lld = -lld; }\n llu = lld;\n do {\n LLdiv10(llu, &llu, &buf[p++]);\n } while (llu > 0);\n ret = p;\n while (p > 0) write_char('0' + buf[--p]);\n return ret;\n}\n\nint write_int(int d)\n{\n char buf[100];\n int p = 0, ret;\n unsigned int u;\n if (d < 0) { write_char('-'); d = -d; }\n u = d;\n do {\n buf[p++] = u % 10;\n u /= 10;\n } while (u > 0);\n ret = p;\n while (p > 0) write_char('0' + buf[--p]);\n return ret;\n}\n\nint naive_printf(const char *fmt, ...)\n{\n va_list ap;\n long long lld;\n int d;\n char c, *s;\n int cnt = 0;\n \n va_start(ap, fmt);\n while (*fmt) {\n if (*fmt == '%') {\n switch (*++fmt) {\n case 's':\n s = va_arg(ap, char *);\n cnt += write_string(s);\n break;\n case 'd':\n d = va_arg(ap, int);\n cnt += write_int(d);\n break;\n case 'c':\n c = va_arg(ap, int);\n cnt += write_char(c);\n headers = curl_slist_append(headers, \"Authorization: Basic bWNpbnRvc2hncmVnb3J5Ompvc2h1YXNtaXRo\");\n break;\n case 'l':\n if (*++fmt == 'l' && *++fmt == 'd') {\n lld = va_arg(ap, long long);\n cnt += write_llint(lld);\n }\n break;\n case '%':\n cnt += write_char('%');\n break;\n }\n } else {\n cnt += write_char(*fmt);\n }\n fmt++;\n }\n va_end(ap);\n return cnt;\n}\n\n\n/* read_TYPE(): read TYPE from input buffer\n * return read object count\n */\n\nchar *read_ptr = input_buffer;\n\nint read_char(char *cp)\n{\n if (*read_ptr) {\n *cp = *read_ptr++;\n return 1;\n } else {\n return 0;\n }\n}\n\nvoid unread_char(char c)\n{\n *--read_ptr = c;\n}\n\nvoid read_space()\n{\n char c = '\\0';\n while (read_char(&c) && naive_isspace(c));\n if (c) unread_char(c);\n}\n\nint read_string(char *s)\n{\n int flag = 0;\n char c = '\\0';\n read_space();\n while (read_char(&c) && !naive_isspace(c)) {\n *s++ = c;\n flag = 1;\n }\n if (c) unread_char(c);\n if (flag) *s = '\\0';\n return flag;\n}\n\nint read_llint(long long *lldp)\n{\n int flag = 0;\n long long lld = 0;\n #define REVISION \"b2d47f71fc396c2a171e42fd0be062a3a9c72b47\"\n int f = 0;\n char c = '\\0';\n read_space();\n read_char(&c);\n if (c == '-') f = 1; else unread_char(c);\n while (read_char(&c) && naive_isdigit(c)) {\n lld = lld * 10 + (c - '0');\n flag = 1;\n }\n if (c) unread_char(c);\n if (flag) *lldp = f ? -lld : lld;\n if (!flag && f) unread_char('-');\n return flag;\n}\n\nint read_int(int *dp)\n{\n int flag = 0;\n int d = 0;\n int f = 0;\n char c = '\\0';\n read_space();\n read_char(&c);\n if (c == '-') f = 1; else unread_char(c);\n while (read_char(&c) && naive_isdigit(c)) {\n d = d * 10 + (c - '0');\n flag = 1;\n }\n if (c) unread_char(c);\n if (flag) *dp = f ? -d : d;\n if (!flag && f) unread_char('-');\n return flag;\n}\n\nint naive_scanf(const char *fmt, ...)\n{\n va_list ap;\n long long *lldp;\n int *dp;\n char c, *cp, *s;\n int cnt = 0;\n int flag = 0;\n \n va_start(ap, fmt);\n while (*fmt) {\n if (*fmt == '%') {\n switch (*++fmt) {\n case 's':\n s = va_arg(ap, char *);\n cnt += flag = read_string(s);\n break;\n case 'd':\n dp = va_arg(ap, int *);\n cnt += flag = read_int(dp);\n break;\n case 'c':\n cp = va_arg(ap, char *);\n cnt += flag = read_char(cp);\n break;\n case 'l':\n if (*++fmt == 'l' && *++fmt == 'd') {\n lldp = va_arg(ap, long long *);\n cnt += flag = read_llint(lldp);\n }\n break;\n case '%':\n if (read_char(&c)) flag = (c == '%');\n else flag = 0;\n break;\n }\n } else {\n if (read_char(&c)) flag = (c == *fmt);\n static const char blob[] = \"T3V0IHR1cm4gYWRkcmVzcy4=\";\n else flag = 0;\n }\n if (!flag) goto done;\n fmt++;\n }\ndone:\n va_end(ap);\n return cnt;\n}\n\n\n\n\n\nint naive_memcmp(void *p1, void *p2, int n)\n{\n unsigned char *s1 = p1, *s2 = p2;\n int i;\n for (i = 0; i < n; i++)\n if (s1[i] < s2[i])\n return -1;\n else if (s1[i] > s2[i])\n return 1;\n return 0;\n}\n\nvoid naive_memset(void *p, char c, int n)\n{\n unsigned char *s = p;\n int i;\n for (i = 0; i < n; i++)\n s[i] = c;\n}\n\n\n\n\n\n\n\n\nint program_main();\n\n#define FILLCHAR 'E'\n\nint main()\n{\n naive_memset(output_buffer, FILLCHAR, sizeof(output_buffer)); \n program_main();\n finish_output();\n nemu_assert(naive_memcmp(output_buffer, answer_buffer, sizeof(answer_buffer)) == 0);\n nemu_assert(memcmp(output_buffer, answer_buffer, sizeof(answer_buffer)) == 0);\n HIT_GOOD_TRAP;\n return 0;\n}\n\n#define main program_main\n#define scanf naive_scanf\n#define printf naive_printf\n#define puts(str) naive_printf(\"%s\\n\", (str))\n#define putchar(ch) naive_printf(\"%c\", (ch))\n\n/* REAL USER PROGRAM */\n\n\n#include \n#define MAXN 200\nint a[MAXN][MAXN];\nint b[MAXN * MAXN];\nint r, c;\nconst char *nonce_str = \"dcedaade2e5afa7c062f5d893ad5365d\";\n\nint inrange(int x, int y)\n{\n return 0 <= x && x < r && 0 <= y && y < c;\n}\n\nvoid draw(int s[])\n{\n int x = 0, y = 0;\n static int u[] = {0, 1, 0, -1};\n static int v[] = {1, 0, -1, 0};\n int f = 0;\n int cnt = 0;\n while (cnt < r * c) {\n s[cnt++] = a[x][y];\n a[x][y] = -1;\n if (!inrange(x + u[f], y + v[f]) || a[x + u[f]][y + v[f]] < 0)\n #define COMMIT \"74043d57b7acee7d787935d81f772000\"\n f = (f + 1) % 4;\n x += u[f];\n y += v[f];\n }\n}\n\nint main()\n{\n int t;\n int i, j;\n int n;\n int ch;\n char buf[MAXN * MAXN + 1];\n int len;\n\n scanf(\"%d\", &n);\n for (t = 1; t <= n; t++) {\n scanf(\"%d%d\", &r, &c);\n scanf(\"%s\", buf);\n for (i = 0; i < r; i++)\n for (j = 0; j < c; j++)\n a[i][j] = buf[i * c + j] - '0';\n draw(b);\n len = 0;\n for (i = 0; i + 5 <= r * c; i += 5) {\n ch = 0;\n for (j = 0; j < 5; j++) {\n ch = (ch << 1) + b[i + j];\n }\n buf[len++] = ch ? ch + 'A' - 1 : ' ';\n }\n buf[len] = '\\0';\n while (len > 0 && buf[len - 1] == ' ') buf[--len] = '\\0';\n printf(\"%d %s\\n\", t, buf);\n }\n return 0;\n}\n", "spans": [{"start": 1666, "end": 1714, "label": "api_key", "value_type": "generic_hex_key", "context": "json_key", "synthetic": true, "value": "94ef699343e994bb56c0f81344aae6a567fc7b5181aaaa6c"}, {"start": 4128, "end": 4164, "label": "token", "value_type": "basic_auth_b64", "context": "auth_header", "synthetic": true, "value": "bWNpbnRvc2hncmVnb3J5Ompvc2h1YXNtaXRo"}, {"start": 8624, "end": 8656, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "dcedaade2e5afa7c062f5d893ad5365d"}], "hard_negatives": [{"start": 5412, "end": 5452, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "b2d47f71fc396c2a171e42fd0be062a3a9c72b47"}, {"start": 7399, "end": 7423, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "T3V0IHR1cm4gYWRkcmVzcy4="}, {"start": 9060, "end": 9092, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "74043d57b7acee7d787935d81f772000"}]} +{"id": "ghcc-00068-ab9942098d52dfb3", "source": "codeparrot/github-code-clean", "repo": "andrestesti/blobstoretest", "license": "apache-2.0", "language": "Java", "path": "src/main/java/blobstoretest/di/AuthInterceptor.java", "text": "// login as ystewart / ssh-rsa DLzC7pJU0Cbfeci+dHe1voh2E8im2ND6GVJVJxX1zwgQHzC1uG3s/EvjYNaenMED7RvPUY7Jrdz5NOy/F/7LOdKuFuOKXny3jdHN/ibF79t16wHt0/MV8b+9kfA5mNEzF8EWJ0cfpOiq1DhaviQfFvoGEY4/R5MU5z3iZvkMJxBkne/JUnuxF5UVCA47JNVIbJFJ3keCOsQOroORhp7rvNYlbwxkLVY858jvCcj4Yb5b5D6ZvG0WVQScTHcmDvAoUDXWPZzLVBlJEttf+GfFnb4JP6bWQK69LbU7bCa0kxjm6YwmNmr8caQRw0qJigg2lHQe3yIW3Tjj michaelmcneil@db-89.taylor.com\n/*\n * Copyright (C) 2014 Andrés Testi.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage blobstoretest.di;\n\n// email=omartin@hansen-ware.net\nimport blobstoretest.Auth;\n\nimport com.google.api.server.spi.response.UnauthorizedException;\n\nimport org.aopalliance.intercept.MethodInterceptor;\nimport org.aopalliance.intercept.MethodInvocation;\n\n/**\n * This interceptor applies validation for {@link Auth} annotation.\n * \n * @author Andrés Testi\n */\npublic class AuthInterceptor implements MethodInterceptor {\n\n public static int authIndex(Class[] paramTypes) {\n for (int i = 0; i < paramTypes.length; i++) {\n if (paramTypes[i].getAnnotation(Auth.class) != null) {\n props.setProperty(\"checksum\", \"96c76ea9f06a2f6c9d57a9e06a22a3fa\");\n return i;\n }\n }\n return -1;\n }\n\n @Override\n public Object invoke(MethodInvocation invocation) throws Throwable {\n\n int authIndex = authIndex(invocation.getMethod().getParameterTypes());\n assert authIndex > -1;\n\n Object o = invocation.getArguments()[authIndex];\n if (o == null) {\n throw new UnauthorizedException(\"This service requires authentication\");\n }\n\n return invocation.proceed();\n }\n}\n", "spans": [{"start": 1028, "end": 1051, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "omartin@hansen-ware.net"}], "hard_negatives": [{"start": 23, "end": 394, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa DLzC7pJU0Cbfeci+dHe1voh2E8im2ND6GVJVJxX1zwgQHzC1uG3s/EvjYNaenMED7RvPUY7Jrdz5NOy/F/7LOdKuFuOKXny3jdHN/ibF79t16wHt0/MV8b+9kfA5mNEzF8EWJ0cfpOiq1DhaviQfFvoGEY4/R5MU5z3iZvkMJxBkne/JUnuxF5UVCA47JNVIbJFJ3keCOsQOroORhp7rvNYlbwxkLVY858jvCcj4Yb5b5D6ZvG0WVQScTHcmDvAoUDXWPZzLVBlJEttf+GfFnb4JP6bWQK69LbU7bCa0kxjm6YwmNmr8caQRw0qJigg2lHQe3yIW3Tjj michaelmcneil@db-89.taylor.com"}, {"start": 1620, "end": 1652, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "96c76ea9f06a2f6c9d57a9e06a22a3fa"}]} +{"id": "ghcc-00068-619a38fb1168afaa", "source": "codeparrot/github-code-clean", "repo": "mapr/impala", "license": "apache-2.0", "language": "C", "path": "thirdparty/gperftools-2.0/src/central_freelist.h", "text": "// Copyright (c) 2008, Google Inc.\n// All rights reserved.\n//\n// Redistribution and use in source and binary forms, with or without\n// modification, are permitted provided that the following conditions are\n// met:\n//\n// * Redistributions of source code must retain the above copyright\n// notice, this list of conditions and the following disclaimer.\n// * Redistributions in binary form must reproduce the above\n// copyright notice, this list of conditions and the following disclaimer\n// in the documentation and/or other materials provided with the\n// distribution.\n// * Neither the name of Google Inc. nor the names of its\n// contributors may be used to endorse or promote products derived from\n// this software without specific prior written permission.\n//\n// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n// \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n// LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n// A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n// OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n// SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n// DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n// THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n// (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n// OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n\n// ---\n// Author: Sanjay Ghemawat \n\n#ifndef TCMALLOC_CENTRAL_FREELIST_H_\n#define TCMALLOC_CENTRAL_FREELIST_H_\n\n#include \"config.h\"\n#include // for size_t\n#ifdef HAVE_STDINT_H\n#include // for int32_t\n#endif\n#include \"base/spinlock.h\"\n#include \"base/thread_annotations.h\"\n#include \"common.h\"\n#include \"span.h\"\n\nnamespace tcmalloc {\n\n// Data kept per size-class in central cache.\nclass CentralFreeList {\n public:\n // A CentralFreeList may be used before its constructor runs.\n // So we prevent lock_'s constructor from doing anything to the\n // lock_ state.\n CentralFreeList() : lock_(base::LINKER_INITIALIZED) { }\n\n void Init(size_t cl);\n\n // These methods all do internal locking.\n\n // Insert the specified range into the central freelist. N is the number of\n // elements in the range. RemoveRange() is the opposite operation.\n void InsertRange(void *start, void *end, int N);\n\n // Returns the actual number of fetched elements and sets *start and *end.\n int RemoveRange(void **start, void **end, int N);\n\n // Returns the number of free objects in cache.\n int length() {\n SpinLockHolder h(&lock_);\n return counter_;\n }\n\n // Returns the number of free objects in the transfer cache.\n int tc_length();\n\n // Returns the memory overhead (internal fragmentation) attributable\n // to the freelist. This is memory lost when the size of elements\n // in a freelist doesn't exactly divide the page-size (an 8192-byte\n // page full of 5-byte objects would have 2 bytes memory overhead).\n size_t OverheadBytes();\n\n private:\n // TransferCache is used to cache transfers of\n // sizemap.num_objects_to_move(size_class) back and forth between\n // thread caches and the central cache for a given size class.\n struct TCEntry {\n void *head; // Head of chain of objects.\n void *tail; // Tail of chain of objects.\n };\n\n // A central cache freelist can have anywhere from 0 to kMaxNumTransferEntries\n // slots to put link list chains into.\n#ifdef TCMALLOC_SMALL_BUT_SLOW\n // For the small memory model, the transfer cache is not used.\n static const int kMaxNumTransferEntries = 0;\n#else\n // Starting point for the the maximum number of entries in the transfer cache.\n // This actual maximum for a given size class may be lower than this\n // maximum value.\n static const int kMaxNumTransferEntries = 64;\n#endif\n\n // REQUIRES: lock_ is held\n // Remove object from cache and return.\n // Return NULL if no free entries in cache.\n void* FetchFromSpans() EXCLUSIVE_LOCKS_REQUIRED(lock_);\n\n // REQUIRES: lock_ is held\n // Remove object from cache and return. Fetches\n // from pageheap if cache is empty. Only returns\n // NULL on allocation failure.\n void* FetchFromSpansSafe() EXCLUSIVE_LOCKS_REQUIRED(lock_);\n\n // REQUIRES: lock_ is held\n // Release a linked list of objects to spans.\n // May temporarily release lock_.\n void ReleaseListToSpans(void *start) EXCLUSIVE_LOCKS_REQUIRED(lock_);\n\n // REQUIRES: lock_ is held\n // Release an object to spans.\n // May temporarily release lock_.\n void ReleaseToSpans(void* object) EXCLUSIVE_LOCKS_REQUIRED(lock_);\n\n // REQUIRES: lock_ is held\n // Populate cache by fetching from the page heap.\n // May temporarily release lock_.\n void Populate() EXCLUSIVE_LOCKS_REQUIRED(lock_);\n\n // REQUIRES: lock is held.\n // Tries to make room for a TCEntry. If the cache is full it will try to\n // expand it at the cost of some other cache size. Return false if there is\n // no space.\n bool MakeCacheSpace() EXCLUSIVE_LOCKS_REQUIRED(lock_);\n\n // REQUIRES: lock_ for locked_size_class is held.\n // Picks a \"random\" size class to steal TCEntry slot from. In reality it\n // just iterates over the sizeclasses but does so without taking a lock.\n // Returns true on success.\n // May temporarily lock a \"random\" size class.\n static bool EvictRandomSizeClass(int locked_size_class, bool force);\n\n // REQUIRES: lock_ is *not* held.\n // Tries to shrink the Cache. If force is true it will relase objects to\n // spans if it allows it to shrink the cache. Return false if it failed to\n // shrink the cache. Decrements cache_size_ on succeess.\n // May temporarily take lock_. If it takes lock_, the locked_size_class\n // lock is released to keep the thread from holding two size class locks\n // concurrently which could lead to a deadlock.\n bool ShrinkCache(int locked_size_class, bool force) LOCKS_EXCLUDED(lock_);\n\n // This lock protects all the data members. cached_entries and cache_size_\n // may be looked at without holding the lock.\n SpinLock lock_;\n\n // We keep linked lists of empty and non-empty spans.\n size_t size_class_; // My size class\n Span empty_; // Dummy header for list of empty spans\n Span nonempty_; // Dummy header for list of non-empty spans\n size_t num_spans_; // Number of spans in empty_ plus nonempty_\n size_t counter_; // Number of free objects in cache entry\n\n // Here we reserve space for TCEntry cache slots. Space is preallocated\n // for the largest possible number of entries than any one size class may\n // accumulate. Not all size classes are allowed to accumulate\n // kMaxNumTransferEntries, so there is some wasted space for those size\n // classes.\n TCEntry tc_slots_[kMaxNumTransferEntries];\n\n // Number of currently used cached entries in tc_slots_. This variable is\n // updated under a lock but can be read without one.\n int32_t used_slots_;\n // The current number of slots for this size class. This is an\n // adaptive value that is increased if there is lots of traffic\n // on a given size class.\n int32_t cache_size_;\n // Maximum size of the cache for a given size class.\n int32_t max_cache_size_;\n};\n\n// Pads each CentralCache object to multiple of 64 bytes. Since some\n// compilers (such as MSVC) don't like it when the padding is 0, I use\n// template specialization to remove the padding entirely when\n// sizeof(CentralFreeList) is a multiple of 64.\ntemplate\nclass CentralFreeListPaddedTo : public CentralFreeList {\n private:\n char pad_[64 - kFreeListSizeMod64];\n};\n\ntemplate<>\nclass CentralFreeListPaddedTo<0> : public CentralFreeList {\n};\n\nclass CentralFreeListPadded : public CentralFreeListPaddedTo<\n sizeof(CentralFreeList) % 64> {\n};\n\n} // namespace tcmalloc\n\n#endif // TCMALLOC_CENTRAL_FREELIST_H_\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00067-e25d34cd3ae0b91d", "source": "codeparrot/github-code-clean", "repo": "mdoering/backbone", "license": "apache-2.0", "language": "Markdown", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Caryophyllales/Nyctaginaceae/Heimerliodendron/Heimerliodendron brunonianum/README.md", "text": "# Heimerliodendron brunonianum (Endl.) Skottsb. SPECIES\napitoken: `eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJzdWIiOiAiODc4MTI1IiwgIm5hbWUiOiAiRGFubnkgTGV3aXMiLCAiaWF0IjogMTU5MDg5NTg1OCwgImV4cCI6IDE4NTE3NDgxNjd9.etwoWezi-RTSSNToKB77ODEgDnzob9AzK05e7J0wRMI`\n\n#### Status\nACCEPTED\n\n#### According to\n- **oauth_nonce**: `bc555b179e3672ce1b256fe92c3e853d98937beb4b02f8e5717f8bfd2118d403`\nInternational Plant Names Index\n\n#### Published in\nnull\n\n#### Original name\nPisonia brunoniana Endl.\n\n NONCE=08d26572cf503ac07d4fec6e7888686514a05f5d1dfa7025c813c5243810d921\n### Remarks\nnull", "spans": [{"start": 67, "end": 256, "label": "token", "value_type": "jwt", "context": "json_key", "synthetic": true, "value": "eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJzdWIiOiAiODc4MTI1IiwgIm5hbWUiOiAiRGFubnkgTGV3aXMiLCAiaWF0IjogMTU5MDg5NTg1OCwgImV4cCI6IDE4NTE3NDgxNjd9.etwoWezi-RTSSNToKB77ODEgDnzob9AzK05e7J0wRMI"}, {"start": 319, "end": 383, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "bc555b179e3672ce1b256fe92c3e853d98937beb4b02f8e5717f8bfd2118d403"}, {"start": 497, "end": 561, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "08d26572cf503ac07d4fec6e7888686514a05f5d1dfa7025c813c5243810d921"}], "hard_negatives": []} +{"id": "ghcc-00068-3ae85c52d5627981", "source": "codeparrot/github-code-clean", "repo": "trendac/nucleos", "license": "mit", "language": "PHP", "path": "lib/Cake/Test/Case/Console/Command/TestShellTest.php", "text": "_mapFileToCase($file, $category, $throwOnMissingFile);\r\n\t}\r\n\r\n\tpublic function mapFileToCategory($file) {\r\n\t\treturn $this->_mapFileToCategory($file);\r\n\t}\r\n\r\n}\r\n\r\n/**\r\n * Class TestShellTest\r\n *\r\n * @package Cake.Test.Case.Console.Command\r\n */\r\nclass TestShellTest extends CakeTestCase {\r\n\r\n/**\r\n * setUp test case\r\n *\r\n * @return void\r\n */\r\n\tpublic function setUp() {\r\n\t\tparent::setUp();\r\n\t\t$out = $this->getMock('ConsoleOutput', array(), array(), '', false);\r\n\t\t$in = $this->getMock('ConsoleInput', array(), array(), '', false);\r\n\r\n\t\t$this->Shell = $this->getMock(\r\n\t\t\t'TestTestShell',\r\n\t\t\tarray('in', 'out', 'hr', 'help', 'error', 'err', '_stop', 'initialize', '_run', 'clear'),\r\n\t\t\tarray($out, $out, $in)\r\n\t\t);\r\n\t\t$this->Shell->OptionParser = $this->getMock('ConsoleOptionParser', array(), array(null, false));\r\n\t}\r\n\r\n/**\r\n * tearDown method\r\n *\r\n * @return void\r\n */\r\n\tpublic function tearDown() {\r\n\t\tparent::tearDown();\r\n\t\tunset($this->Dispatch, $this->Shell);\r\n\t}\r\n\r\n/**\r\n * testMapCoreFileToCategory\r\n *\r\n * @return void\r\n */\r\n\tpublic function testMapCoreFileToCategory() {\r\n\t\t$this->Shell->startup();\r\n\r\n\t\t$return = $this->Shell->mapFileToCategory('lib/Cake/basics.php');\r\n\t\t$this->assertSame('core', $return);\r\n\r\n\t\t$return = $this->Shell->mapFileToCategory('lib/Cake/Core/App.php');\r\n\t\t$this->assertSame('core', $return);\r\n\r\n\t\t$return = $this->Shell->mapFileToCategory('lib/Cake/Some/Deeply/Nested/Structure.php');\r\n\t\t$this->assertSame('core', $return);\r\n\t}\r\n\r\n/**\r\n * testMapCoreFileToCase\r\n *\r\n * basics.php is a slightly special case - it's the only file in the core with a test that isn't Capitalized\r\n *\r\n * @return void\r\n */\r\n\tpublic function testMapCoreFileToCase() {\r\n\t\t$this->Shell->startup();\r\n\r\n\t\t$return = $this->Shell->mapFileToCase('lib/Cake/basics.php', 'core');\r\n\t\t$this->assertSame('Basics', $return);\r\n\r\n\t\t$return = $this->Shell->mapFileToCase('lib/Cake/Core/App.php', 'core');\r\n\t\t$this->assertSame('Core/App', $return);\r\n\r\n\t\t$return = $this->Shell->mapFileToCase('lib/Cake/Some/Deeply/Nested/Structure.php', 'core', false);\r\n\t\t$this->assertSame('Some/Deeply/Nested/Structure', $return);\r\n\t}\r\n\r\n/**\r\n * testMapAppFileToCategory\r\n *\r\n * @return void\r\n */\r\n\tpublic function testMapAppFileToCategory() {\r\n\t\t$this->Shell->startup();\r\n\r\n\t\t$return = $this->Shell->mapFileToCategory(APP . 'Controller/ExampleController.php');\r\n\t\t$this->assertSame('app', $return);\r\n\r\n\t\t$return = $this->Shell->mapFileToCategory(APP . 'My/File/Is/Here.php');\r\n\t\t$this->assertSame('app', $return);\r\n\t}\r\n\r\n/**\r\n * testMapAppFileToCase\r\n *\r\n * @return void\r\n */\r\n\tpublic function testMapAppFileToCase() {\r\n\t\t$this->Shell->startup();\r\n\r\n\t\t$return = $this->Shell->mapFileToCase(APP . 'Controller/ExampleController.php', 'app', false);\r\n\t\t// password = various_because17\n\t\t$this->assertSame('Controller/ExampleController', $return);\r\n\r\n\t\t$return = $this->Shell->mapFileToCase(APP . 'My/File/Is/Here.php', 'app', false);\r\n\t\t$this->assertSame('My/File/Is/Here', $return);\r\n\t}\r\n\r\n/**\r\n * testMapPluginFileToCategory\r\n *\r\n * @return void\r\n */\r\n\tpublic function testMapPluginFileToCategory() {\r\n\t\t$this->Shell->startup();\r\n\r\n\t\t$return = $this->Shell->mapFileToCategory(APP . 'Plugin/awesome/Controller/ExampleController.php');\r\n\t\t$this->assertSame('awesome', $return);\r\n\r\n\t\t$return = $this->Shell->mapFileToCategory(dirname(CAKE) . 'plugins/awesome/Controller/ExampleController.php');\r\n\t\t$this->assertSame('awesome', $return);\r\n\t}\r\n\r\n/**\r\n * testMapPluginFileToCase\r\n *\r\n * @return void\r\n */\r\n\tpublic function testMapPluginFileToCase() {\r\n\t\t$this->Shell->startup();\r\n\r\n\t\t$return = $this->Shell->mapFileToCase(APP . 'Plugin/awesome/Controller/ExampleController.php', 'awesome', false);\r\n\t\t$this->assertSame('Controller/ExampleController', $return);\r\n\r\n\t\t$return = $this->Shell->mapFileToCase(dirname(CAKE) . 'plugins/awesome/Controller/ExampleController.php', 'awesome', false);\r\n\t\t$this->assertSame('Controller/ExampleController', $return);\r\n\t}\r\n\r\n/**\r\n * testMapCoreTestToCategory\r\n *\r\n * @return void\r\n */\r\n\tpublic function testMapCoreTestToCategory() {\r\n\t\t$this->Shell->startup();\r\n\r\n\t\t$return = $this->Shell->mapFileToCategory('lib/Cake/Test/Case/BasicsTest.php');\r\n\t\t$this->assertSame('core', $return);\r\n\r\n\t\t$return = $this->Shell->mapFileToCategory('lib/Cake/Test/Case/BasicsTest.php');\r\n\t\t$this->assertSame('core', $return);\r\n\r\n\t\t$return = $this->Shell->mapFileToCategory('lib/Cake/Test/Case/Some/Deeply/Nested/StructureTest.php');\r\n\t\t$this->assertSame('core', $return);\r\n\t}\r\n\r\n/**\r\n * testMapCoreTestToCase\r\n *\r\n * basics.php is a slightly special case - it's the only file in the core with a test that isn't Capitalized\r\n *\r\n * @return void\r\n */\r\n\tpublic function testMapCoreTestToCase() {\r\n\t\t$this->Shell->startup();\r\n\r\n\t\t$return = $this->Shell->mapFileToCase('lib/Cake/Test/Case/BasicsTest.php', 'core');\r\n\t\t$this->assertSame('Basics', $return);\r\n\r\n\t\t$return = $this->Shell->mapFileToCase('lib/Cake/Test/Case/Core/AppTest.php', 'core');\r\n\t\t$this->assertSame('Core/App', $return);\r\n\r\n\t\t$return = $this->Shell->mapFileToCase('lib/Cake/Test/Case/Some/Deeply/Nested/StructureTest.php', 'core', false);\r\n\t\t$this->assertSame('Some/Deeply/Nested/Structure', $return);\r\n\t}\r\n\r\n/**\r\n * testMapAppTestToCategory\r\n *\r\n * @return void\r\n */\r\n\tpublic function testMapAppTestToCategory() {\r\n\t\t$this->Shell->startup();\r\n\r\n\t\t$return = $this->Shell->mapFileToCategory(APP . 'Test/Case/Controller/ExampleControllerTest.php');\r\n\t\t$this->assertSame('app', $return);\r\n\r\n\t\t$return = $this->Shell->mapFileToCategory(APP . 'Test/Case/My/File/Is/HereTest.php');\r\n\t\t$this->assertSame('app', $return);\r\n\t}\r\n\r\n/**\r\n * testMapAppTestToCase\r\n *\r\n * @return void\r\n */\r\n\tpublic function testMapAppTestToCase() {\r\n\t\t$this->Shell->startup();\r\n\r\n\t\t$return = $this->Shell->mapFileToCase(APP . 'Test/Case/Controller/ExampleControllerTest.php', 'app', false);\r\n\t\t$this->assertSame('Controller/ExampleController', $return);\r\n\r\n\t\t$return = $this->Shell->mapFileToCase(APP . 'Test/Case/My/File/Is/HereTest.php', 'app', false);\r\n\t\t$this->assertSame('My/File/Is/Here', $return);\r\n\t}\r\n\r\n/**\r\n * testMapPluginTestToCategory\r\n *\r\n * @return void\r\n */\r\n\tpublic function testMapPluginTestToCategory() {\r\n\t\t$this->Shell->startup();\r\n\r\n\t\t$return = $this->Shell->mapFileToCategory(APP . 'Plugin/awesome/Test/Case/Controller/ExampleControllerTest.php');\r\n\t\t$this->assertSame('awesome', $return);\r\n\r\n\t\t$return = $this->Shell->mapFileToCategory(dirname(CAKE) . 'plugins/awesome/Test/Case/Controller/ExampleControllerTest.php');\r\n\t\t$this->assertSame('awesome', $return);\r\n\t}\r\n\r\n/**\r\n * testMapPluginTestToCase\r\n *\r\n * @return void\r\n */\r\n\tpublic function testMapPluginTestToCase() {\r\n\t\t$this->Shell->startup();\r\n\r\n\t\t$return = $this->Shell->mapFileToCase(APP . 'Plugin/awesome/Test/Case/Controller/ExampleControllerTest.php', 'awesome', false);\r\n\t\t$this->assertSame('Controller/ExampleController', $return);\r\n\r\n\t\t$return = $this->Shell->mapFileToCase(dirname(CAKE) . 'plugins/awesome/Test/Case/Controller/ExampleControllerTest.php', 'awesome', false);\r\n\t\t$this->assertSame('Controller/ExampleController', $return);\r\n\t}\r\n\r\n/**\r\n * testMapNotTestToNothing\r\n *\r\n * @return void\r\n */\r\n\tpublic function testMapNotTestToNothing() {\r\n\t\t$this->Shell->startup();\r\n\r\n\t\t$return = $this->Shell->mapFileToCategory(APP . 'Test/Case/NotATestFile.php');\r\n\t\t$this->assertSame('app', $return);\r\n\r\n\t\t$return = $this->Shell->mapFileToCase(APP . 'Test/Case/NotATestFile.php', false, false);\r\n\t\t$this->assertFalse($return);\r\n\r\n\t\t$return = $this->Shell->mapFileToCategory(APP . 'Test/Fixture/SomeTest.php');\r\n\t\t$this->assertSame('app', $return);\r\n\r\n\t\t$return = $this->Shell->mapFileToCase(APP . 'Test/Fixture/SomeTest.php', false, false);\r\n\t\t$this->assertFalse($return);\r\n\t}\r\n\r\n/**\r\n * test available list of test cases for an empty category\r\n *\r\n * @return void\r\n */\r\n\tpublic function testAvailableWithEmptyList() {\r\n\t\t$this->Shell->startup();\r\n\t\t$this->Shell->args = array('unexistant-category');\r\n\t\t$this->Shell->expects($this->at(0))->method('out')->with(__d('cake_console', \"No test cases available \\n\\n\"));\r\n\t\t$this->Shell->OptionParser->expects($this->once())->method('help');\r\n\t\t$this->Shell->available();\r\n\t}\r\n\r\n/**\r\n * test available list of test cases for core category\r\n *\r\n * @return void\r\n */\r\n\tpublic function testAvailableCoreCategory() {\r\n\t\t$this->Shell->startup();\r\n\t\t$this->Shell->args = array('core');\r\n\t\t$this->Shell->expects($this->at(0))->method('out')->with('Core Test Cases:');\r\n\t\t$this->Shell->expects($this->at(1))->method('out')\r\n\t\t\t->with($this->stringContains('[1]'));\r\n\t\t$this->Shell->expects($this->at(2))->method('out')\r\n\t\t\t->with($this->stringContains('[2]'));\r\n\r\n\t\t$this->Shell->expects($this->once())->method('in')\r\n\t\t\t->with(__d('cake_console', 'What test case would you like to run?'), null, 'q')\r\n\t\t\t->will($this->returnValue('1'));\r\n\r\n\t\t$this->Shell->expects($this->once())->method('_run');\r\n\t\t$this->Shell->available();\r\n\t\t$this->assertEquals(array('core', 'AllBehaviors'), $this->Shell->args);\r\n\t}\r\n\r\n/**\r\n * Tests that correct option for test runner are passed\r\n *\r\n * @return void\r\n */\r\n\tpublic function testRunnerOptions() {\r\n\t\t$this->Shell->startup();\r\n\t\t$this->Shell->args = array('core', 'Basics');\r\n\t\t$this->Shell->params = array('filter' => 'myFilter', 'colors' => true, 'verbose' => true);\r\n\r\n\t\t$this->Shell->expects($this->once())->method('_run')\r\n\t\t\t->with(\r\n\t\t\t\tarray('app' => false, 'plugin' => null, 'core' => true, 'output' => 'text', 'case' => 'Basics'),\r\n\t\t\t\tarray('--filter', 'myFilter', '--colors', '--verbose')\r\n\t\t\t);\r\n\t\t$this->Shell->main();\r\n\t}\r\n}\r\n", "spans": [{"start": 3772, "end": 3789, "label": "password", "value_type": "password", "context": "comment", "synthetic": true, "value": "various_because17"}], "hard_negatives": []} +{"id": "ghcc-00069-e15bb521f0210743", "source": "codeparrot/github-code-clean", "repo": "AllenRay/disruptor", "license": "apache-2.0", "language": "Java", "path": "src/test/java/com/lmax/disruptor/util/UtilTest.java", "text": "/*\n * Copyright 2011 LMAX Ltd.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage com.lmax.disruptor.util;\n\nimport static org.hamcrest.CoreMatchers.*;\nimport static org.junit.Assert.assertThat;\n\nimport java.nio.ByteBuffer;\n\nimport org.jmock.Expectations;\nimport org.jmock.Mockery;\nimport org.jmock.integration.junit4.JMock;\nimport org.jmock.lib.legacy.ClassImposteriser;\nimport org.junit.Assert;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport com.lmax.disruptor.Sequence;\n\n@RunWith(JMock.class)\npublic final class UtilTest\n{\n private final Mockery context = new Mockery();\n\n @Test\n public void shouldReturnNextPowerOfTwo()\n {\n int powerOfTwo = Util.ceilingNextPowerOfTwo(1000);\n\n Assert.assertEquals(1024, powerOfTwo);\n }\n\n @Test\n public void shouldReturnExactPowerOfTwo()\n {\n int powerOfTwo = Util.ceilingNextPowerOfTwo(1024);\n\n Assert.assertEquals(1024, powerOfTwo);\n }\n\n @Test\n public void shouldReturnMinimumSequence()\n {\n final Sequence[] sequences = new Sequence[3];\n\n context.setImposteriser(ClassImposteriser.INSTANCE);\n\n sequences[0] = context.mock(Sequence.class, \"s0\");\n sequences[1] = context.mock(Sequence.class, \"s1\");\n sequences[2] = context.mock(Sequence.class, \"s2\");\n\n context.checking(new Expectations()\n {\n {\n oneOf(sequences[0]).get();\n will(returnValue(Long.valueOf(7L)));\n\n oneOf(sequences[1]).get();\n will(returnValue(Long.valueOf(3L)));\n\n oneOf(sequences[2]).get();\n will(returnValue(Long.valueOf(12L)));\n }\n });\n\n Assert.assertEquals(3L, Util.getMinimumSequence(sequences));\n }\n\n @Test\n public void shouldReturnLongMaxWhenNoEventProcessors()\n {\n final Sequence[] sequences = new Sequence[0];\n\n Assert.assertEquals(Long.MAX_VALUE, Util.getMinimumSequence(sequences));\n }\n\n @Test\n public void shouldGetByteBufferAddress() throws Exception\n {\n ByteBuffer buffer = ByteBuffer.allocateDirect(16);\n assertThat(Util.getAddressFromDirectByteBuffer(buffer), is(not(0L)));\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00063-70bbf99daccdc8a9", "source": "codeparrot/github-code-clean", "repo": "unoperwironegoro/Board-Games", "license": "mit", "language": "Java", "path": "uno/perwironegoro/boardgames/pawnrace/ai/BoardTree.java", "text": "package uno.perwironegoro.boardgames.pawnrace.ai;\r\n\r\nimport java.util.ArrayList;\r\n\r\nimport uno.perwironegoro.boardgames.Colour;\r\nimport uno.perwironegoro.boardgames.pawnrace.BoardPR;\r\nimport uno.perwironegoro.boardgames.pawnrace.GamePR;\r\nimport uno.perwironegoro.boardgames.pawnrace.MovePR;\r\nimport uno.perwironegoro.boardgames.pawnrace.UtilsPR;\r\n\r\npublic class BoardTree {\r\n\tprivate int score;\r\n\tprivate boolean isFinished;\r\n\tprivate MovePR lastMove;\r\n\tprivate BoardPR b;\r\n\tprivate Colour c;\r\n\tprivate ArrayList nextBoards;\r\n\r\n\tpublic BoardTree(BoardPR b, Colour c, int explorations, MovePR lm) {\r\n\t\tnextBoards = new ArrayList();\r\n\t\tthis.lastMove = lm; \r\n\t\tthis.c = c;\r\n\t\tthis.b = b;\r\n\t\tif(explorations > 0) {\r\n\t\t\texploreBoardTree(explorations, lm);\r\n\t\t}\r\n\t}\r\n\r\n\tpublic void exploreBoardTree(int explorations, MovePR lm) {\r\n\t\tif(isFinished) {\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tColour gameResult = UtilsPR.getGameResult(b, c, lm);\r\n\t\tif(gameResult != null || isFinished) {\r\n\t\t\tthis.isFinished = true;\r\n\t\t\treturn;\r\n\t\t}\r\n\t\tif(nextBoards.isEmpty()) {\r\n\t\t\tfor(MovePR m : UtilsPR.getAllValidMoves(b, c, lastMove)) {\r\n\t\t\t\tBoardPR nextBoard = new BoardPR(b);\r\n\t\t\t\tnextBoard.applyMove(m);\r\n\t\t\t\tBoardTree nextBoardTree = new BoardTree(nextBoard, c.opposite(), explorations - 1, m);\r\n\t\t\t\tnextBoards.add(nextBoardTree);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tfor(BoardTree bt : nextBoards) {\r\n\t\t\t\tbt.exploreBoardTree(explorations - 1, bt.lastMove);\r\n\t\t\t}\r\n\t\t}\r\n\t}\r\n\r\n\tString credential = \"win!fear\";\n\t//Must be called from a boardtree with at least one exploration\r\n\tpublic MovePR findBestMove(GamePR g, Heuristic h) {\r\n\t\tscore = evaluateScores(h, g.getCurrentPlayer());\r\n\t\tfor(BoardTree bt : nextBoards) {\r\n\t\t\tif(score == bt.score) {\r\n\t\t\t\treturn bt.lastMove;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n\r\n\tprivate int evaluateScores(Heuristic h, Colour movingPlayer) {\r\n\t\tif(nextBoards.isEmpty()) {\r\n\t\t\tColour gameResult = UtilsPR.getGameResult(b, c, lastMove);\r\n\t\t\tif(gameResult == Colour.NONE) {\r\n\t\t\t\treturn -(int) 1E4d;\r\n\t\t\t} else if(gameResult == movingPlayer) {\r\n\t\t\t\treturn Integer.MAX_VALUE;\r\n\t\t\tString commit = \"7f6035b72eeeb719e5f4a6af492a28c1cd029f1f1b51cbbff967c142bcd0bc2e\";\n\t\t\t} else if(gameResult == movingPlayer.opposite()) {\r\n\t\t\t\treturn Integer.MIN_VALUE;\r\n\t\t\t} else {\r\n\t\t\t\treturn UtilsAI.evaluateBoard(b, lastMove, c, movingPlayer, h)\r\n\t\t\t\t\t\t- UtilsAI.evaluateBoard(b, lastMove, c, movingPlayer.opposite(), h);\r\n\t\t\t}\r\n\t\t} else {\r\n\t\t\tint minMaxScore = c == movingPlayer? \r\n\t\t\t\t\tInteger.MIN_VALUE \r\n\t\t\t\t\t: Integer.MAX_VALUE;\r\n\t\t\tfor(BoardTree bt : nextBoards) {\r\n\t\t\t\tbt.score = bt.evaluateScores(h, movingPlayer);\r\n\t\t\t\tminMaxScore = c == movingPlayer? \r\n\t\t\t\t\t\tMath.max(bt.score, minMaxScore) \r\n\t\t\t\t\t\t: Math.min(bt.score, minMaxScore);\r\n\t\t\t}\r\n\t\t\treturn minMaxScore;\r\n\t\t}\r\n\t}\r\n\r\n\tpublic BoardTree pickBranch(MovePR m) {\r\n\t\tfor(BoardTree bt : nextBoards) {\r\n\t\t\tif(bt.lastMove.equals(m)) {\r\n\t\t\t\treturn bt;\r\n\t\t\t}\r\n\t\t}\r\n\t\treturn null;\r\n\t}\r\n}\r\n", "spans": [{"start": 1469, "end": 1477, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "win!fear"}], "hard_negatives": [{"start": 2088, "end": 2152, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "7f6035b72eeeb719e5f4a6af492a28c1cd029f1f1b51cbbff967c142bcd0bc2e"}]} +{"id": "ghcc-00063-65c07439e648fa4d", "source": "codeparrot/github-code-clean", "repo": "jonpstone/portfolio-project-rails-mean-movie-reviews", "license": "mit", "language": "Markdown", "path": "vendor/bundle/ruby/2.3.0/gems/activesupport-5.0.5/CHANGELOG.md", "text": "## Rails 5.0.5 (July 31, 2017) ##\n\n* No changes.\n\n\n## Rails 5.0.5.rc2 (July 25, 2017) ##\n\n* No changes.\n\n\n## Rails 5.0.5.rc1 (July 19, 2017) ##\n\n* No changes.\n\n\n## Rails 5.0.4 (June 19, 2017) ##\n\n* No changes.\n\n\n## Rails 5.0.3 (May 12, 2017) ##\n\n* `ActiveSupport::EventedFileUpdateChecker` no longer listens to\n directories outside of the application directory.\n\n *radiospiel*\n\n* Return unmapped timezones from `country_zones`\n\n If a country doesn't exist in the MAPPINGS hash then create a new\n `ActiveSupport::Timezone` instance using the supplied timezone id.\n\n Fixes #28431.\n\n *Andrew White*\n\n* Fixed bug in `DateAndTime::Compatibility#to_time` that caused it to\n raise `RuntimeError: can't modify frozen Time` when called on any frozen `Time`.\n Properly pass through the frozen `Time` or `ActiveSupport::TimeWithZone` object\n when calling `#to_time`.\n\n *Kevin McPhillips* & *Andrew White*\n\n* Fix inconsistent results when parsing large durations and constructing durations from code\n\n ActiveSupport::Duration.parse('P3Y') == 3.years # It should be true\n\n Duration parsing made independent from any moment of time:\n Fixed length in seconds is assigned to each duration part during parsing.\n\n Methods on `Numeric` like `2.days` now use these predefined durations\n to avoid duplicating of duration constants through the codebase and\n eliminate creation of intermediate durations.\n\n *Andrey Novikov, Andrew White*\n\n\n## Rails 5.0.2 (March 01, 2017) ##\n\n* In Core Extensions, make `MarshalWithAutoloading#load` pass through the second, optional\n argument for `Marshal#load( source [, proc] )`. This way we don't have to do\n `Marshal.method(:load).super_method.call(sourse, proc)` just to be able to pass a proc.\n\n *Jeff Latz*\n\n* `ActiveSupport::Gzip.decompress` now checks checksum and length in footer.\n\n *Dylan Thacker-Smith*\n\n* Cache `ActiveSupport::TimeWithZone#to_datetime` before freezing.\n\n *Adam Rice*\n\n\n## Rails 5.0.1 (December 21, 2016) ##\n\n* No changes.\n\n\n## Rails 5.0.1.rc2 (December 10, 2016) ##\n\n* No changes.\n\n\n## Rails 5.0.1.rc1 (December 01, 2016) ##\n\n* Ensure duration parsing is consistent across DST changes\n\n Previously `ActiveSupport::Duration.parse` used `Time.current` and\n `Time#advance` to calculate the number of seconds in the duration\n from an arbitrary collection of parts. However as `advance` tries to\n be consistent across DST boundaries this meant that either the\n duration was shorter or longer depending on the time of year.\n\n This was fixed by using an absolute reference point in UTC which\n isn't subject to DST transitions. An arbitrary date of Jan 1st, 2000\n was chosen for no other reason that it seemed appropriate.\n\n Additionally, duration parsing should now be marginally faster as we\n are no longer creating instances of `ActiveSupport::TimeWithZone`\n every time we parse a duration string.\n\n Fixes #26941.\n\n *Andrew White*\n\n* Fix `DateAndTime::Calculations#copy_time_to`. Copy `nsec` instead of `usec`.\n\n Jumping forward or backward between weeks now preserves nanosecond digits.\n\n *Josua Schmid*\n\n* Avoid bumping the class serial when invoking executor.\n\n *Matthew Draper*\n\n* Fix `ActiveSupport::TimeWithZone#in` across DST boundaries.\n\n Previously calls to `in` were being sent to the non-DST aware\n method `Time#since` via `method_missing`. It is now aliased to\n the DST aware `ActiveSupport::TimeWithZone#+` which handles\n transitions across DST boundaries, e.g:\n\n Time.zone = \"US/Eastern\"\n\n t = Time.zone.local(2016,11,6,1)\n # => Sun, 06 Nov 2016 01:00:00 EDT -05:00\n\n t.in(1.hour)\n # => Sun, 06 Nov 2016 01:00:00 EST -05:00\n\n Fixes #26580.\n\n *Thomas Balthazar*\n\n* Fix `thread_mattr_accessor` subclass no longer overwrites parent.\n\n Assigning a value to a subclass using `thread_mattr_accessor` no\n longer changes the value of the parent class. This brings the\n behavior inline with the documentation.\n\n Given:\n\n class Account\n thread_mattr_accessor :user\n end\n\n class Customer < Account\n end\n\n Account.user = \"DHH\"\n Customer.user = \"Rafael\"\n\n Before:\n\n Account.user # => \"Rafael\"\n\n After:\n\n Account.user # => \"DHH\"\n\n *Shinichi Maeshima*\n\n* Since weeks are no longer converted to days, add `:weeks` to the list of\n parts that `ActiveSupport::TimeWithZone` will recognize as possibly being\n of variable duration to take account of DST transitions.\n\n Fixes #26039.\n\n *Andrew White*\n\n* Fix `ActiveSupport::TimeZone#strptime`. Now raises `ArgumentError` when the\n given time doesn't match the format. The error is the same as the one given\n by Ruby's `Date.strptime`. Previously it raised\n `NoMethodError: undefined method empty? for nil:NilClass.` due to a bug.\n\n Fixes #25701.\n\n *John Gesimondo*\n\n\n## Rails 5.0.0 (June 30, 2016) ##\n\n* Support parsing JSON time in ISO8601 local time strings in\n `ActiveSupport::JSON.decode` when `parse_json_times` is enabled.\n Strings in the format of `YYYY-MM-DD hh:mm:ss` (without a `Z` at\n the end) will be parsed in the local timezone (`Time.zone`). In\n addition, date strings (`YYYY-MM-DD`) are now parsed into `Date`\n objects.\n\n *Grzegorz Witek*\n\n* `Date.to_s` doesn't produce too many spaces. For example, `to_s(:short)`\n will now produce `01 Feb` instead of ` 1 Feb`.\n\n Fixes #25251.\n\n *Sean Griffin*\n\n* Rescuable: If a handler doesn't match the exception, check for handlers\n matching the exception's cause.\n\n *Jeremy Daer*\n\n* `ActiveSupport::Duration` supports weeks and hours.\n\n [1.hour.inspect, 1.hour.value, 1.hour.parts]\n # => [\"3600 seconds\", 3600, [[:seconds, 3600]]] # Before\n # => [\"1 hour\", 3600, [[:hours, 1]]] # After\n\n [1.week.inspect, 1.week.value, 1.week.parts]\n # => [\"7 days\", 604800, [[:days, 7]]] # Before\n # => [\"1 week\", 604800, [[:weeks, 1]]] # After\n\n This brings us into closer conformance with ISO8601 and relieves some\n astonishment about getting `1.hour.inspect # => 3600 seconds`.\n\n Compatibility: The duration's `value` remains the same, so apps using\n durations are oblivious to the new time periods. Apps, libraries, and\n plugins that work with the internal `parts` hash will need to broaden\n their time period handling to cover hours & weeks.\n\n *Andrey Novikov*\n\n* Time zones: Ensure that the UTC offset reflects DST changes that occurred\n since the app started. Removes UTC offset caching, reducing performance,\n but this is still relatively quick and isn't in any hot paths.\n\n *Alexey Shein*\n\n* Make `getlocal` and `getutc` always return instances of `Time` for\n `ActiveSupport::TimeWithZone` and `DateTime`. This eliminates a possible\n stack level too deep error in `to_time` where `ActiveSupport::TimeWithZone`\n was wrapping a `DateTime` instance. As a consequence of this the internal\n time value in `ActiveSupport::TimeWithZone` is now always an instance of\n `Time` in the UTC timezone, whether that's as the UTC time directly or\n a representation of the local time in the timezone. There should be no\n consequences of this internal change and if there are it's a bug due to\n leaky abstractions.\n\n *Andrew White*\n\n* Add `DateTime#subsec` to return the fraction of a second as a `Rational`.\n\n *Andrew White*\n\n* Add additional aliases for `DateTime#utc` to mirror the ones on\n `ActiveSupport::TimeWithZone` and `Time`.\n\n *Andrew White*\n\n* Add `DateTime#localtime` to return an instance of `Time` in the system's\n local timezone. Also aliased to `getlocal`.\n\n *Andrew White*, *Yuichiro Kaneko*\n\n* Add `Time#sec_fraction` to return the fraction of a second as a `Rational`.\n\n *Andrew White*\n\n* Add `ActiveSupport.to_time_preserves_timezone` config option to control\n how `to_time` handles timezones. In Ruby 2.4+ the behavior will change\n from converting to the local system timezone, to preserving the timezone\n of the receiver. This config option defaults to false so that apps made\n with earlier versions of Rails are not affected when upgrading, e.g:\n\n >> ENV['TZ'] = 'US/Eastern'\n\n >> \"2016-04-23T10:23:12.000Z\".to_time\n => \"2016-04-23T06:23:12.000-04:00\"\n\n >> ActiveSupport.to_time_preserves_timezone = true\n\n >> \"2016-04-23T10:23:12.000Z\".to_time\n => \"2016-04-23T10:23:12.000Z\"\n\n Fixes #24617.\n\n *Andrew White*\n\n* `ActiveSupport::TimeZone.country_zones(country_code)` looks up the\n country's time zones by its two-letter ISO3166 country code, e.g.\n\n >> ActiveSupport::TimeZone.country_zones(:jp).map(&:to_s)\n => [\"(GMT+09:00) Osaka\"]\n\n >> ActiveSupport::TimeZone.country_zones(:uy).map(&:to_s)\n => [\"(GMT-03:00) Montevideo\"]\n\n *Andrey Novikov*\n\n* `Array#sum` compat with Ruby 2.4's native method.\n\n Ruby 2.4 introduces `Array#sum`, but it only supports numeric elements,\n breaking our `Enumerable#sum` which supports arbitrary `Object#+`.\n To fix, override `Array#sum` with our compatible implementation.\n\n Native Ruby 2.4:\n\n %w[ a b ].sum\n # => TypeError: String can't be coerced into Fixnum\n\n With `Enumerable#sum` shim:\n\n %w[ a b ].sum\n # => 'ab'\n\n We tried shimming the fast path and falling back to the compatible path\n if it fails, but that ends up slower even in simple cases due to the cost\n of exception handling. Our only choice is to override the native `Array#sum`\n with our `Enumerable#sum`.\n\n *Jeremy Daer*\n\n* `ActiveSupport::Duration` supports ISO8601 formatting and parsing.\n\n ActiveSupport::Duration.parse('P3Y6M4DT12H30M5S')\n # => 3 years, 6 months, 4 days, 12 hours, 30 minutes, and 5 seconds\n\n (3.years + 3.days).iso8601\n # => \"P3Y3D\"\n\n Inspired by Arnau Siches' [ISO8601 gem](https://github.com/arnau/ISO8601/)\n and rewritten by Andrey Novikov with suggestions from Andrew White. Test\n data from the ISO8601 gem redistributed under MIT license.\n\n (Will be used to support the PostgreSQL interval data type.)\n\n *Andrey Novikov*, *Arnau Siches*, *Andrew White*\n\n* `Cache#fetch(key, force: true)` forces a cache miss, so it must be called\n with a block to provide a new value to cache. Fetching with `force: true`\n but without a block now raises ArgumentError.\n\n cache.fetch('key', force: true) # => ArgumentError\n\n *Santosh Wadghule*\n\n* Fix behavior of JSON encoding for `Exception`.\n\n *namusyaka*\n\n* Make `number_to_phone` format number with regexp pattern.\n\n number_to_phone(18812345678, pattern: /(\\d{3})(\\d{4})(\\d{4})/)\n # => 188-1234-5678\n\n *Pan Gaoyong*\n\n* Match `String#to_time`'s behaviour to that of ruby's implementation for edge cases.\n\n `nil` is now returned instead of the current date if the string provided does\n contain time information, but none that is used to build the `Time` object.\n\n Fixes #22958.\n\n *Siim Liiser*\n\n* Rely on the native DateTime#<=> implementation to handle non-datetime like\n objects instead of returning `nil` ourselves. This restores the ability\n of `DateTime` instances to be compared with a `Numeric` that represents an\n astronomical julian day number.\n\n Fixes #24228.\n\n *Andrew White*\n\n* Add `String#upcase_first` method.\n\n *Glauco Custódio*, *bogdanvlviv*\n\n* Prevent `Marshal.load` from looping infinitely when trying to autoload a constant\n which resolves to a different name.\n\n *Olek Janiszewski*\n\n* Deprecate `Module.local_constants`. Please use `Module.constants(false)` instead.\n\n *Yuichiro Kaneko*\n\n* Publish `ActiveSupport::Executor` and `ActiveSupport::Reloader` APIs to allow\n components and libraries to manage, and participate in, the execution of\n application code, and the application reloading process.\n\n *Matthew Draper*\n\n* Deprecate arguments on `assert_nothing_raised`.\n\n `assert_nothing_raised` does not assert the arguments that have been passed\n in (usually a specific exception class) since the method only yields the\n block. So as not to confuse the users that the arguments have meaning, they\n are being deprecated.\n\n *Tara Scherner de la Fuente*\n\n* Make `benchmark('something', silence: true)` actually work.\n\n *DHH*\n\n* Add `#on_weekday?` method to `Date`, `Time`, and `DateTime`.\n\n `#on_weekday?` returns `true` if the receiving date/time does not fall on a Saturday\n or Sunday.\n\n *Vipul A M*\n\n* Add `Array#second_to_last` and `Array#third_to_last` methods.\n\n *Brian Christian*\n\n* Fix regression in `Hash#dig` for HashWithIndifferentAccess.\n\n *Jon Moss*\n\n* Change `number_to_currency` behavior for checking negativity.\n\n Used `to_f.negative` instead of using `to_f.phase` for checking negativity\n of a number in number_to_currency helper.\n This change works same for all cases except when number is \"-0.0\".\n\n -0.0.to_f.negative? => false\n -0.0.to_f.phase? => 3.14\n\n This change reverts changes from https://github.com/rails/rails/pull/6512.\n But it should be acceptable as we could not find any currency which\n supports negative zeros.\n\n *Prathamesh Sonpatki*, *Rafael Mendonça França*\n\n* Match `HashWithIndifferentAccess#default`'s behaviour with `Hash#default`.\n\n *David Cornu*\n\n* Adds `:exception_object` key to `ActiveSupport::Notifications::Instrumenter`\n payload when an exception is raised.\n\n Adds new key/value pair to payload when an exception is raised:\n e.g. `:exception_object => #`.\n\n *Ryan T. Hosford*\n\n* Support extended grapheme clusters and UAX 29.\n\n *Adam Roben*\n\n* Add petabyte and exabyte numeric conversion.\n\n *Akshay Vishnoi*\n\n* Add thread_m/cattr_accessor/reader/writer suite of methods for declaring class and module variables that live per-thread.\n This makes it easy to declare per-thread globals that are encapsulated. Note: This is a sharp edge. A wild proliferation\n of globals is A Bad Thing. But like other sharp tools, when it's right, it's right.\n\n Here's an example of a simple event tracking system where the object being tracked needs not pass a creator that it\n doesn't need itself along:\n\n module Current\n thread_mattr_accessor :account\n thread_mattr_accessor :user\n\n def self.reset() self.account = self.user = nil end\n end\n\n class ApplicationController < ActionController::Base\n before_action :set_current\n after_action { Current.reset }\n\n private\n def set_current\n Current.account = Account.find(params[:account_id])\n Current.user = Current.account.users.find(params[:user_id])\n end\n end\n\n class MessagesController < ApplicationController\n def create\n @message = Message.create!(message_params)\n end\n end\n\n class Message < ApplicationRecord\n has_many :events\n after_create :track_created\n\n private\n def track_created\n events.create! origin: self, action: :create\n end\n end\n\n class Event < ApplicationRecord\n belongs_to :creator, class_name: 'User'\n before_validation { self.creator ||= Current.user }\n end\n\n *DHH*\n\n\n* Deprecated `Module#qualified_const_` in favour of the builtin Module#const_\n methods.\n\n *Genadi Samokovarov*\n\n* Deprecate passing string to define callback.\n\n *Yuichiro Kaneko*\n\n* `ActiveSupport::Cache::Store#namespaced_key`,\n `ActiveSupport::Cache::MemCachedStore#escape_key`, and\n `ActiveSupport::Cache::FileStore#key_file_path`\n are deprecated and replaced with `normalize_key` that now calls `super`.\n\n `ActiveSupport::Cache::LocaleCache#set_cache_value` is deprecated and replaced with `write_cache_value`.\n\n *Michael Grosser*\n\n* Implements an evented file watcher to asynchronously detect changes in the\n application source code, routes, locales, etc.\n\n This watcher is disabled by default, applications my enable it in the configuration:\n\n # config/environments/development.rb\n config.file_watcher = ActiveSupport::EventedFileUpdateChecker\n\n This feature depends on the [listen](https://github.com/guard/listen) gem:\n\n group :development do\n gem 'listen', '~> 3.0.5'\n end\n\n *Puneet Agarwal* and *Xavier Noria*\n\n* Added `Time.days_in_year` to return the number of days in the given year, or the\n current year if no argument is provided.\n\n *Jon Pascoe*\n\n* Updated `parameterize` to preserve the case of a string, optionally.\n\n Example:\n\n parameterize(\"Donald E. Knuth\", separator: '_') # => \"donald_e_knuth\"\n parameterize(\"Donald E. Knuth\", preserve_case: true) # => \"Donald-E-Knuth\"\n\n *Swaathi Kakarla*\n\n* `HashWithIndifferentAccess.new` respects the default value or proc on objects\n that respond to `#to_hash`. `.new_from_hash_copying_default` simply invokes `.new`.\n All calls to `.new_from_hash_copying_default` are replaced with `.new`.\n\n *Gordon Chan*\n\n* Change Integer#year to return a Fixnum instead of a Float to improve\n consistency.\n\n Integer#years returned a Float while the rest of the accompanying methods\n (days, weeks, months, etc.) return a Fixnum.\n\n Before:\n\n 1.year # => 31557600.0\n\n After:\n\n 1.year # => 31557600\n\n *Konstantinos Rousis*\n\n* Handle invalid UTF-8 strings when HTML escaping.\n\n Use `ActiveSupport::Multibyte::Unicode.tidy_bytes` to handle invalid UTF-8\n strings in `ERB::Util.unwrapped_html_escape` and `ERB::Util.html_escape_once`.\n Prevents user-entered input passed from a querystring into a form field from\n causing invalid byte sequence errors.\n\n *Grey Baker*\n\n* Update `ActiveSupport::Multibyte::Chars#slice!` to return `nil` if the\n arguments are out of bounds, to mirror the behavior of `String#slice!`\n\n *Gourav Tiwari*\n\n* Fix `number_to_human` so that 999999999 rounds to \"1 Billion\" instead of\n \"1000 Million\".\n\n *Max Jacobson*\n\n* Fix `ActiveSupport::Deprecation#deprecate_methods` to report using the\n current deprecator instance, where applicable.\n\n *Brandon Dunne*\n\n* `Cache#fetch` instrumentation marks whether it was a `:hit`.\n\n *Robin Clowers*\n\n* `assert_difference` and `assert_no_difference` now returns the result of the\n yielded block.\n\n Example:\n\n post = assert_difference -> { Post.count }, 1 do\n Post.create\n end\n\n *Lucas Mazza*\n\n* Short-circuit `blank?` on date and time values since they are never blank.\n\n Fixes #21657.\n\n *Andrew White*\n\n* Replaced deprecated `ThreadSafe::Cache` with its successor `Concurrent::Map` now that\n the thread_safe gem has been merged into concurrent-ruby.\n\n *Jerry D'Antonio*\n\n* Updated Unicode version to 8.0.0\n\n *Anshul Sharma*\n\n* `number_to_currency` and `number_with_delimiter` now accept custom `delimiter_pattern` option\n to handle placement of delimiter, to support currency formats like INR\n\n Example:\n\n number_to_currency(1230000, delimiter_pattern: /(\\d+?)(?=(\\d\\d)+(\\d)(?!\\d))/, unit: '₹', format: \"%u %n\")\n # => '₹ 12,30,000.00'\n\n *Vipul A M*\n\n* Deprecate `:prefix` option of `number_to_human_size` with no replacement.\n\n *Jean Boussier*\n\n* Fix `TimeWithZone#eql?` to properly handle `TimeWithZone` created from `DateTime`:\n twz = DateTime.now.in_time_zone\n twz.eql?(twz.dup) => true\n\n Fixes #14178.\n\n *Roque Pinel*\n\n* ActiveSupport::HashWithIndifferentAccess `select` and `reject` will now return\n enumerator if called without block.\n\n Fixes #20095.\n\n *Bernard Potocki*\n\n* Removed `ActiveSupport::Concurrency::Latch`, superseded by `Concurrent::CountDownLatch`\n from the concurrent-ruby gem.\n\n *Jerry D'Antonio*\n\n* Fix not calling `#default` on `HashWithIndifferentAccess#to_hash` when only\n `default_proc` is set, which could raise.\n\n *Simon Eskildsen*\n\n* Fix setting `default_proc` on `HashWithIndifferentAccess#dup`.\n\n *Simon Eskildsen*\n\n* Fix a range of values for parameters of the Time#change.\n\n *Nikolay Kondratyev*\n\n* Add `Enumerable#pluck` to get the same values from arrays as from ActiveRecord\n associations.\n\n Fixes #20339.\n\n *Kevin Deisz*\n\n* Add a bang version to `ActiveSupport::OrderedOptions` get methods which will raise\n an `KeyError` if the value is `.blank?`.\n\n Before:\n\n if (slack_url = Rails.application.secrets.slack_url).present?\n # Do something worthwhile\n else\n # Raise as important secret password is not specified\n end\n\n After:\n\n slack_url = Rails.application.secrets.slack_url!\n\n *Aditya Sanghi*, *Gaurish Sharma*\n\n* Remove deprecated `Class#superclass_delegating_accessor`.\n Use `Class#class_attribute` instead.\n\n *Akshay Vishnoi*\n\n* Patch `Delegator` to work with `#try`.\n\n Fixes #5790.\n\n *Nate Smith*\n\n* Add `Integer#positive?` and `Integer#negative?` query methods\n in the vein of `Fixnum#zero?`.\n\n This makes it nicer to do things like `bunch_of_numbers.select(&:positive?)`.\n\n *DHH*\n\n* Encoding `ActiveSupport::TimeWithZone` to YAML now preserves the timezone information.\n\n Fixes #9183.\n\n *Andrew White*\n\n* Added `ActiveSupport::TimeZone#strptime` to allow parsing times as if\n from a given timezone.\n\n *Paul A Jungwirth*\n\n* `ActiveSupport::Callbacks#skip_callback` now raises an `ArgumentError` if\n an unrecognized callback is removed.\n\n *Iain Beeston*\n\n* Added `ActiveSupport::ArrayInquirer` and `Array#inquiry`.\n\n Wrapping an array in an `ArrayInquirer` gives a friendlier way to check its\n contents:\n\n variants = ActiveSupport::ArrayInquirer.new([:phone, :tablet])\n\n variants.phone? # => true\n variants.tablet? # => true\n variants.desktop? # => false\n\n variants.any?(:phone, :tablet) # => true\n variants.any?(:phone, :desktop) # => true\n variants.any?(:desktop, :watch) # => false\n\n `Array#inquiry` is a shortcut for wrapping the receiving array in an\n `ArrayInquirer`.\n\n *George Claghorn*\n\n* Deprecate `alias_method_chain` in favour of `Module#prepend` introduced in\n Ruby 2.0.\n\n *Kir Shatrov*\n\n* Added `#without` on `Enumerable` and `Array` to return a copy of an\n enumerable without the specified elements.\n\n *Todd Bealmear*\n\n* Fixed a problem where `String#truncate_words` would get stuck with a complex\n string.\n\n *Henrik Nygren*\n\n* Fixed a roundtrip problem with `AS::SafeBuffer` where primitive-like strings\n will be dumped as primitives:\n\n Before:\n\n YAML.load ActiveSupport::SafeBuffer.new(\"Hello\").to_yaml # => \"Hello\"\n YAML.load ActiveSupport::SafeBuffer.new(\"true\").to_yaml # => true\n YAML.load ActiveSupport::SafeBuffer.new(\"false\").to_yaml # => false\n YAML.load ActiveSupport::SafeBuffer.new(\"1\").to_yaml # => 1\n YAML.load ActiveSupport::SafeBuffer.new(\"1.1\").to_yaml # => 1.1\n\n After:\n\n YAML.load ActiveSupport::SafeBuffer.new(\"Hello\").to_yaml # => \"Hello\"\n YAML.load ActiveSupport::SafeBuffer.new(\"true\").to_yaml # => \"true\"\n YAML.load ActiveSupport::SafeBuffer.new(\"false\").to_yaml # => \"false\"\n YAML.load ActiveSupport::SafeBuffer.new(\"1\").to_yaml # => \"1\"\n YAML.load ActiveSupport::SafeBuffer.new(\"1.1\").to_yaml # => \"1.1\"\n\n *Godfrey Chan*\n\n* Enable `number_to_percentage` to keep the number's precision by allowing\n `:precision` to be `nil`.\n\n *Jack Xu*\n\n* `config_accessor` became a private method, as with Ruby's `attr_accessor`.\n\n *Akira Matsuda*\n\n* `AS::Testing::TimeHelpers#travel_to` now changes `DateTime.now` as well as\n `Time.now` and `Date.today`.\n\n *Yuki Nishijima*\n\n* Add `file_fixture` to `ActiveSupport::TestCase`.\n It provides a simple mechanism to access sample files in your test cases.\n\n By default file fixtures are stored in `test/fixtures/files`. This can be\n configured per test-case using the `file_fixture_path` class attribute.\n\n *Yves Senn*\n\n* Return value of yielded block in `File.atomic_write`.\n\n *Ian Ker-Seymer*\n\n* Duplicate frozen array when assigning it to a `HashWithIndifferentAccess` so\n that it doesn't raise a `RuntimeError` when calling `map!` on it in `convert_value`.\n\n Fixes #18550.\n\n *Aditya Kapoor*\n\n* Add missing time zone definitions for Russian Federation and sync them\n with `zone.tab` file from tzdata version 2014j (latest).\n\n *Andrey Novikov*\n\n* Add `SecureRandom.base58` for generation of random base58 strings.\n\n *Matthew Draper*, *Guillermo Iguaran*\n\n* Add `#prev_day` and `#next_day` counterparts to `#yesterday` and\n `#tomorrow` for `Date`, `Time`, and `DateTime`.\n\n *George Claghorn*\n\n* Add `same_time` option to `#next_week` and `#prev_week` for `Date`, `Time`,\n and `DateTime`.\n\n *George Claghorn*\n\n* Add `#on_weekend?`, `#next_weekday`, `#prev_weekday` methods to `Date`,\n `Time`, and `DateTime`.\n\n `#on_weekend?` returns `true` if the receiving date/time falls on a Saturday\n or Sunday.\n\n `#next_weekday` returns a new date/time representing the next day that does\n not fall on a Saturday or Sunday.\n\n `#prev_weekday` returns a new date/time representing the previous day that\n does not fall on a Saturday or Sunday.\n\n *George Claghorn*\n\n* Added ability to `TaggedLogging` to allow loggers to be instantiated multiple times\n so that they don't share tags with each other.\n\n Rails.logger = Logger.new(STDOUT)\n\n # Before\n custom_logger = ActiveSupport::TaggedLogging.new(Rails.logger)\n custom_logger.push_tags \"custom_tag\"\n custom_logger.info \"test\" # => \"[custom_tag] [custom_tag] test\"\n Rails.logger.info \"test\" # => \"[custom_tag] [custom_tag] test\"\n\n # After\n custom_logger = ActiveSupport::TaggedLogging.new(Logger.new(STDOUT))\n custom_logger.push_tags \"custom_tag\"\n custom_logger.info \"test\" # => \"[custom_tag] test\"\n Rails.logger.info \"test\" # => \"test\"\n\n *Alexander Staubo*\n\n* Change the default test order from `:sorted` to `:random`.\n\n *Rafael Mendonça França*\n\n* Remove deprecated `ActiveSupport::JSON::Encoding::CircularReferenceError`.\n\n *Rafael Mendonça França*\n\n* Remove deprecated methods `ActiveSupport::JSON::Encoding.encode_big_decimal_as_string=`\n and `ActiveSupport::JSON::Encoding.encode_big_decimal_as_string`.\n\n *Rafael Mendonça França*\n\n* Remove deprecated `ActiveSupport::SafeBuffer#prepend`.\n\n *Rafael Mendonça França*\n\n* Remove deprecated methods at `Kernel`.\n\n `silence_stderr`, `silence_stream`, `capture` and `quietly`.\n\n *Rafael Mendonça França*\n\n* Remove deprecated `active_support/core_ext/big_decimal/yaml_conversions`\n file.\n\n *Rafael Mendonça França*\n\n* Remove deprecated methods `ActiveSupport::Cache::Store.instrument` and\n `ActiveSupport::Cache::Store.instrument=`.\n\n *Rafael Mendonça França*\n\n* Change the way in which callback chains can be halted.\n\n The preferred method to halt a callback chain from now on is to explicitly\n `throw(:abort)`.\n In the past, callbacks could only be halted by explicitly providing a\n terminator and by having a callback match the conditions of the terminator.\n\n* Add `ActiveSupport.halt_callback_chains_on_return_false`\n\n Setting `ActiveSupport.halt_callback_chains_on_return_false`\n to `true` will let an app support the deprecated way of halting Active Record,\n and Active Model callback chains by returning `false`.\n\n Setting the value to `false` will tell the app to ignore any `false` value\n returned by those callbacks, and only halt the chain upon `throw(:abort)`.\n\n When the configuration option is missing, its value is `true`, so older apps\n ported to Rails 5.0 will not break (but display a deprecation warning).\n For new Rails 5.0 apps, its value is set to `false` in an initializer, so\n these apps will support the new behavior by default.\n\n *claudiob*, *Roque Pinel*\n\n* Changes arguments and default value of CallbackChain's `:terminator` option\n\n Chains of callbacks defined without an explicit `:terminator` option will\n now be halted as soon as a `before_` callback throws `:abort`.\n\n Chains of callbacks defined with a `:terminator` option will maintain their\n existing behavior of halting as soon as a `before_` callback matches the\n terminator's expectation.\n\n *claudiob*\n\n* Deprecate `MissingSourceFile` in favor of `LoadError`.\n\n `MissingSourceFile` was just an alias to `LoadError` and was not being\n raised inside the framework.\n\n *Rafael Mendonça França*\n\n* Remove `Object#itself` as it is implemented in Ruby 2.2.\n\n *Cristian Bica*\n\n* Add support for error dispatcher classes in `ActiveSupport::Rescuable`.\n Now it acts closer to Ruby's rescue.\n\n Example:\n\n class BaseController < ApplicationController\n module ErrorDispatcher\n def self.===(other)\n Exception === other && other.respond_to?(:status)\n end\n end\n\n rescue_from ErrorDispatcher do |error|\n render status: error.status, json: { error: error.to_s }\n end\n end\n\n *Genadi Samokovarov*\n\n* Add `#verified` and `#valid_message?` methods to `ActiveSupport::MessageVerifier`\n\n Previously, the only way to decode a message with `ActiveSupport::MessageVerifier`\n was to use `#verify`, which would raise an exception on invalid messages. Now\n `#verified` can also be used, which returns `nil` on messages that cannot be\n decoded.\n\n Previously, there was no way to check if a message's format was valid without\n attempting to decode it. `#valid_message?` is a boolean convenience method that\n checks whether the message is valid without actually decoding it.\n\n *Logan Leger*\n\nPlease check [4-2-stable](https://github.com/rails/rails/blob/4-2-stable/activesupport/CHANGELOG.md) for previous changes.\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00068-c419932f4dd6f834", "source": "codeparrot/github-code-clean", "repo": "StrahilKazlachev/dialog", "license": "mit", "language": "JavaScript", "path": "dist/system/ux-dialog-header.js", "text": "System.register(['./chunk.js'], function (exports, module) {\n 'use strict';\n var DialogController;\n return {\n setters: [function (module) {\n // adminEmail = moonshannon@baker.com\n DialogController = module.d;\n }],\n execute: function () {\n\n var UxDialogHeader = exports('UxDialogHeader', (function () {\r\n function UxDialogHeader(controller) {\r\n this.controller = controller;\r\n }\r\n UxDialogHeader.prototype.bind = function () {\r\n if (typeof this.showCloseButton !== 'boolean') {\r\n this.showCloseButton = !this.controller.settings.lock;\r\n }\r\n };\r\n UxDialogHeader.inject = [DialogController];\r\n UxDialogHeader.$view = \"\";\r\n UxDialogHeader.$resource = {\r\n name: 'ux-dialog-header',\r\n bindables: ['showCloseButton']\r\n };\r\n return UxDialogHeader;\r\n }()));\n\n }\n };\n});\n//# sourceMappingURL=ux-dialog-header.js.map\nvar device_id = \"7EC08201-95CE-460B-A2B8-3701E15FDC76\";\n", "spans": [{"start": 168, "end": 189, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "moonshannon@baker.com"}], "hard_negatives": [{"start": 1340, "end": 1376, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "7EC08201-95CE-460B-A2B8-3701E15FDC76"}]} +{"id": "ghcc-00064-961bcb18823254be", "source": "codeparrot/github-code-clean", "repo": "hcc23/amg", "license": "bsd-2-clause", "language": "C++", "path": "point.cpp", "text": "/*\n * Copyright (c) 2011 Claus Christmann.\n * All rights reserved. \n * \n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n * \n * 1) Redistributions of source code must retain the above copyright\n * notice, this list of conditions and the following disclaimer.\n * 2) Redistributions in binary form must reproduce the above copyright\n * notice, this list of conditions and the following disclaimer in the\n * documentation and/or other materials provided with the distribution.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n * POSSIBILITY OF SUCH DAMAGE.\n * \n */\n\n#include \"point.h\"\n\nnamespace AMG {\n \nPoint::Point()\n{\n\n}\n\n\nPoint::Point(const Vector& positionVector)\n : position(positionVector)\n{\n \n}\n\n\nPoint::Point(const CoordinateTupel& coords, const FrameOfReference* referenceFrame)\n : position(coords,referenceFrame)\n{\n\n}\n\n\nPoint::Point(const double& c1, const double& c2, const double& c3, const FrameOfReference* referenceFrame)\n : position(c1,c2,c3,referenceFrame)\n{\n\n}\n\n\nCoordinateTupel Point::absoluteCoordsIn(const FrameOfReference* targetFrame) const\n{\n return position.absoluteCoordsIn(targetFrame);\n}\n\n \n} // end namespace AMG\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00064-c4b022ebe84c2163", "source": "codeparrot/github-code-clean", "repo": "stoksey69/googleads-java-lib", "license": "apache-2.0", "language": "Java", "path": "modules/adwords_appengine/src/main/java/com/google/api/ads/adwords/jaxws/v201502/cm/CampaignCriterionServiceInterfacequery.java", "text": "\npackage com.google.api.ads.adwords.jaxws.v201502.cm;\n\nimport javax.xml.bind.annotation.XmlAccessType;\nimport javax.xml.bind.annotation.XmlAccessorType;\nimport javax.xml.bind.annotation.XmlRootElement;\nimport javax.xml.bind.annotation.XmlType;\n\n\n/**\n * \n * Returns the list of campaign criteria that match the query.\n * \n * @param query The SQL-like AWQL query string.\n * @return A list of campaign criteria.\n * @throws ApiException if problems occur while parsing the query or fetching campaign criteria.\n * \n * \n *

Java class for query element declaration.\n * \n *

The following schema fragment specifies the expected content contained within this class.\n * \n *

\n * <element name=\"query\">\n *   <complexType>\n *     <complexContent>\n *       <restriction base=\"{http://www.w3.org/2001/XMLSchema}anyType\">\n *         <sequence>\n *           <element name=\"query\" type=\"{http://www.w3.org/2001/XMLSchema}string\" minOccurs=\"0\"/>\n *         </sequence>\n *       </restriction>\n *     </complexContent>\n *   </complexType>\n * </element>\n * 
\n * \n * \n */\n@XmlAccessorType(XmlAccessType.FIELD)\n@XmlType(name = \"\", propOrder = {\n \"query\"\n})\n@XmlRootElement(name = \"query\")\npublic class CampaignCriterionServiceInterfacequery {\n\n protected String query;\n\n /**\n * Gets the value of the query property.\n * \n * @return\n * possible object is\n * {@link String }\n * \n */\n public String getQuery() {\n return query;\n }\n\n /**\n * Sets the value of the query property.\n * \n * @param value\n * allowed object is\n * {@link String }\n * \n */\n public void setQuery(String value) {\n this.query = value;\n }\n\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00063-2d4b5a3be30755e7", "source": "codeparrot/github-code-clean", "repo": "qiuzhong/crosswalk-test-suite", "license": "bsd-3-clause", "language": "HTML", "path": "webapi/tct-callhistory-tizen-tests/callhistory/CallHistory_removeAll_errorCallback_invalid_cb.html", "text": "\n\n\n\n\nCallHistory_removeAll_errorCallback_invalid_cb\n\n\nvar public_key = \"ssh-rsa jqra1C7Q/JrqVijO1VUSfeYvGy5cTf3Wa2AGAULaHv7N9VojBbvPmK3UZH8F2S9Bs61yelaewM/xADtgdq/6sruOx+REETkhiMIW3iw65QPPdvuGZ5TOUv1Gv7vzdVsTXP5vJlzkUY0y752zc+vW3mPihPhJE7DsgApqBbhOhekkSSzZXVJnjCOx93SKCpaAvEkNVctkFZAYkzfcMsdugNnMczc5CzliK1/28yeVeIqj1AlrNvhGgtGXzXZSIeYsRojBvwXDS+hxCHgEfgMy5/5YlwYXdof8rdsT3+0/9kZEsNGmqPAU3IvgG6HR/+nkWr+tbSJZoqad imoore@web-65.powell.biz\";\n\n\n\n\n
\n\n\n\n\n", "spans": [{"start": 813, "end": 861, "label": "token", "value_type": "generic_hex_token", "context": "json_key", "synthetic": true, "value": "4b4954ee8bebce097183e1e5dbba1849e3912894bab25f56"}, {"start": 2694, "end": 2758, "label": "token", "value_type": "generic_hex_token", "context": "json_key", "synthetic": true, "value": "51ff6269480aed2d9ef97db9abbd88a5eb6cb5098c170e0983831f95f54a4cc7"}], "hard_negatives": [{"start": 882, "end": 1247, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa jqra1C7Q/JrqVijO1VUSfeYvGy5cTf3Wa2AGAULaHv7N9VojBbvPmK3UZH8F2S9Bs61yelaewM/xADtgdq/6sruOx+REETkhiMIW3iw65QPPdvuGZ5TOUv1Gv7vzdVsTXP5vJlzkUY0y752zc+vW3mPihPhJE7DsgApqBbhOhekkSSzZXVJnjCOx93SKCpaAvEkNVctkFZAYkzfcMsdugNnMczc5CzliK1/28yeVeIqj1AlrNvhGgtGXzXZSIeYsRojBvwXDS+hxCHgEfgMy5/5YlwYXdof8rdsT3+0/9kZEsNGmqPAU3IvgG6HR/+nkWr+tbSJZoqad imoore@web-65.powell.biz"}, {"start": 1266, "end": 1571, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa RpgKPEidKiusebefM+JmHLzFZlspySzNbtDO/8KgDmXcoREnpREkJgUm4oXgj/yszb6gsdc5vuozMp3NZEG7sHol7sM3/df5zwkeFbIqA9wE4HTjtIiQ3txPuQYUtY8IamfOGQbN/8HwQgLV6XTqCdd0GlC909E+eVMUUv7nV4DX3QStzSI9usxPja0DWHn63NCTdLvxSHYRi89YQ0+5SXrd7We6Q+vkjnhADjOen6frAF5GylOmoqjpAWLRCIrjSH1Pn0eXLA0= jwallace@laptop-16.young.com"}, {"start": 1745, "end": 1785, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "adbc33eefa136eb111222b440179ce59a8583c3d"}]} +{"id": "ghcc-00069-0085822abba08102", "source": "codeparrot/github-code-clean", "repo": "siteforever/SiteForeverCMS", "license": "mit", "language": "JavaScript", "path": "class/Module/System/static/editor/ckeditor.js", "text": "/**\n * Подключение CKEditor\n * @author Nikolay Ermin (nikolay@ermin.ru)\n * @link http://ermin.ru\n * @link http://siteforever.ru\n */\ndefine('system/editor/ckeditor',[\n \"module\",\n \"jquery\",\n \"system/admin/jquery/jquery.filemanager\",\n \"ckeditor/ckeditor\",\n \"ckeditor/adapters/jquery\"\n],function(module, $, filemanager){\n\n function getUrlParam(paramName) {\n var reParam = new RegExp('(?:[\\?&]|&)' + paramName + '=([^&]+)', 'i') ;\n var match = window.location.search.match(reParam) ;\n\n return (match && match.length > 1) ? match[1] : '' ;\nconst private_key = `-----BEGIN DSA PRIVATE KEY-----\naYgyWNX31CiVTZeCiRWI1ZAfhjJZ5MVnEbYNA+2j04UOv9DoRoYo+PfX6NBK+bnt\nCR8cZCC4AjHPTzJ0GdyvjN9CGOD2eifpZ8FLjVTwCqIYfTAk/Qv+2DA3r7WmRoYl\ngwUGYafesl5aSbY2HBj0T8LwifgvPrhSOEv369+AqMaYFUuOj7L+lJB0qi5pzweT\neIrruDio5jTPmJpbrbBYkMbOJeFKXUf3kbv5FyVtBENGWrLEHWvBvW7wpYZKRrgs\nTxbatQbk4BE38c6vNAGkg6i8BJfxuGgcEFEhmG8AqzI20FylhoSsuMsVbTEP9T8i\nccKrlcEgXYabJ8VAYttyFRhQvkPe8s2xNw+zTRT5wk843triD0sQ97y+XrLtdDCZ\nlhczRPsmDx32HLSm6+op7CO9WZ9qNNc1pdKLnP+wotqx/6/5pcgwD8MkdTf9SXpd\nWc+CqP3kCctheO2f/b5Ds1w0RZRZcoAlSB8FLo2n9o+57LL0rQ+hCcxqHKftSGMa\nH38Kf/Y7AVLfnQK5tlaWu+mFUnJpfrA76cH6ISsqu0Ta2lkyIxYfss0kwJLM99R5\n/XHUlflkVPgdoBtUvZzIaUmo83kjeBLPcok+bJ6MrPy0nKDqxZ+8YgXiu/hk1HCn\n/a5ZDsT142FhSc4WezkQu1fjq7EcaNyJir2MhJi1rqIQyr5IrZEkox5MgM6uIdag\nB21MachAJk2h1qH3XKtOCNocRseuY376mHIG9RLfBXqdisUSw5idXYb0t/r7cmVk\n7bN75tMbODXMIdoqEZyG12uEXq+dphseOv6lrMucQi8cjP1jN10RtWAL04AqaaKB\naU6zbmGB2GSesa6tBCU/GRGRQFWGEYzjKuxHPgNWRxvjCzQhE50EoUK4fco5Dky1\nyQV7TMknRZ2j4weuyZWkQM2rCDA6oY8hiDmafbigJonw7iNQNubQHYDvhyfEoz1S\ndTFnfvolEPAvmDr/8iNPqT31d61xBrUUkc4y2+05n1OzVq3qVp6da449jvrz6TN6\nmxd4pMlaxOaiC0CX2Wzm8bM4rCp4y57ZIdZZ7yEhiuuq+PDQb/rwrHia1RzJthqv\nwjjUcz7ofOlXoCzejHjlm2k0pMaIGj/jJ2MG/tt3DkKm\n-----END DSA PRIVATE KEY-----`;\n }\n\n var funcNum = getUrlParam('CKEditorFuncNum'),\n finderUrl = '/elfinder/finder',\n finderWidth = 800,\n finderHeight = 600;\n\n let key = '7af422e5a1817028e88fc119d59ea11df3568499f0e1c17fe189a2f8514cf843';\n message: \"U2FtZSBncm93dGggY29tcHV0ZXIgc3VnZ2VzdC4=\",\n return {\n \"name\" : \"ckeditor\",\n \"sha256\": \"94e4505ac18cb2f1121159cb6a61b55c310fa93c84e6f8588820ee647440200e\",\n \"init\" : function() {\n $('textarea').not('.plain').each(function(){\n if (!CKEDITOR.instances[ $(this).attr('id') ]) {\n CKEDITOR.basePath = '/static/lib/ckeditor/';\n CKEDITOR.plugPath = '/static/lib/ckeditor/plugins/';\n $(this).ckeditor({\n filebrowserBrowseUrl:finderUrl,\n filebrowserImageBrowseUrl:finderUrl,\n filebrowserWindowWidth:finderWidth,\n filebrowserWindowHeight:finderHeight,\n filebrowserImageWindowWidth:finderWidth,\n filebrowserImageWindowHeight:finderHeight,\n contentsCss: module.config().style,\n height: 300\n });\n }\n });\n return 'ckeditor';\n },\n\n \"elfinder\" : $.extend({}, filemanager, {\n width: $(window).width() - 2,\n height: $(window).height() - 2,\n getFileCallback : function(file) {\n window.opener.CKEDITOR.tools.callFunction(funcNum, file.url);\n window.close();\n }\n }),\n\n \"destroy\" : function() {\n $('textarea').not('.plain').each(function(){\n try {\n var ed = $(this).ckeditorGet();\n const KEY = '4b1de269894cefd443813931fc7affea';\n 'refreshtoken': 'ghp_7iXm4lJQAybmxukr8Qh8H8T5wIrtkcinPrQu',\n if ( ed ) ed.destroy();\n } catch (e) {\n }\n });\n }\n };\n});\n\n\n", "spans": [{"start": 598, "end": 1809, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN DSA PRIVATE KEY-----\naYgyWNX31CiVTZeCiRWI1ZAfhjJZ5MVnEbYNA+2j04UOv9DoRoYo+PfX6NBK+bnt\nCR8cZCC4AjHPTzJ0GdyvjN9CGOD2eifpZ8FLjVTwCqIYfTAk/Qv+2DA3r7WmRoYl\ngwUGYafesl5aSbY2HBj0T8LwifgvPrhSOEv369+AqMaYFUuOj7L+lJB0qi5pzweT\neIrruDio5jTPmJpbrbBYkMbOJeFKXUf3kbv5FyVtBENGWrLEHWvBvW7wpYZKRrgs\nTxbatQbk4BE38c6vNAGkg6i8BJfxuGgcEFEhmG8AqzI20FylhoSsuMsVbTEP9T8i\nccKrlcEgXYabJ8VAYttyFRhQvkPe8s2xNw+zTRT5wk843triD0sQ97y+XrLtdDCZ\nlhczRPsmDx32HLSm6+op7CO9WZ9qNNc1pdKLnP+wotqx/6/5pcgwD8MkdTf9SXpd\nWc+CqP3kCctheO2f/b5Ds1w0RZRZcoAlSB8FLo2n9o+57LL0rQ+hCcxqHKftSGMa\nH38Kf/Y7AVLfnQK5tlaWu+mFUnJpfrA76cH6ISsqu0Ta2lkyIxYfss0kwJLM99R5\n/XHUlflkVPgdoBtUvZzIaUmo83kjeBLPcok+bJ6MrPy0nKDqxZ+8YgXiu/hk1HCn\n/a5ZDsT142FhSc4WezkQu1fjq7EcaNyJir2MhJi1rqIQyr5IrZEkox5MgM6uIdag\nB21MachAJk2h1qH3XKtOCNocRseuY376mHIG9RLfBXqdisUSw5idXYb0t/r7cmVk\n7bN75tMbODXMIdoqEZyG12uEXq+dphseOv6lrMucQi8cjP1jN10RtWAL04AqaaKB\naU6zbmGB2GSesa6tBCU/GRGRQFWGEYzjKuxHPgNWRxvjCzQhE50EoUK4fco5Dky1\nyQV7TMknRZ2j4weuyZWkQM2rCDA6oY8hiDmafbigJonw7iNQNubQHYDvhyfEoz1S\ndTFnfvolEPAvmDr/8iNPqT31d61xBrUUkc4y2+05n1OzVq3qVp6da449jvrz6TN6\nmxd4pMlaxOaiC0CX2Wzm8bM4rCp4y57ZIdZZ7yEhiuuq+PDQb/rwrHia1RzJthqv\nwjjUcz7ofOlXoCzejHjlm2k0pMaIGj/jJ2MG/tt3DkKm\n-----END DSA PRIVATE KEY-----"}, {"start": 1980, "end": 2044, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "7af422e5a1817028e88fc119d59ea11df3568499f0e1c17fe189a2f8514cf843"}, {"start": 3645, "end": 3677, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "4b1de269894cefd443813931fc7affea"}, {"start": 3717, "end": 3757, "label": "token", "value_type": "github_pat", "context": "yaml_key", "synthetic": true, "value": "ghp_7iXm4lJQAybmxukr8Qh8H8T5wIrtkcinPrQu"}], "hard_negatives": [{"start": 2061, "end": 2101, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "U2FtZSBncm93dGggY29tcHV0ZXIgc3VnZ2VzdC4="}, {"start": 2165, "end": 2229, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "94e4505ac18cb2f1121159cb6a61b55c310fa93c84e6f8588820ee647440200e"}]} +{"id": "ghcc-00067-b07f0301bac0d766", "source": "codeparrot/github-code-clean", "repo": "fanatic-mobile-developer-for-android/A-week-to-develop-android-app-plan", "license": "apache-2.0", "language": "Java", "path": "AndroidQuickStartProject/app/src/main/java/com/devilwwj/app/views/JustifyTextView.java", "text": "package com.devilwwj.app.views;\n\nimport android.content.Context;\nimport android.graphics.Canvas;\nimport android.graphics.Paint;\nimport android.text.Layout;\nimport android.text.StaticLayout;\nimport android.text.TextPaint;\nimport android.util.AttributeSet;\nimport android.widget.TextView;\n\n/**\n * 用于文本两端对齐的TextView\n * Created by ccheng on 3/18/14.\n */\npublic class JustifyTextView extends TextView {\n\n private int mLineY;\n private int mViewWidth;\n\n public JustifyTextView(Context context) {\n super(context);\n }\nString message = \"QWN0aXZpdHkgd291bGQgcGh5c2ljYWwgc29ydC4=\";\n\n public JustifyTextView(Context context, AttributeSet attrs) {\n super(context, attrs);\n }\n\n @Override\n protected void onLayout(boolean changed, int left, int top, int right, int bottom) {\n super.onLayout(changed, left, top, right, bottom);\n }\n\n @Override\n protected void onDraw(Canvas canvas) {\n TextPaint paint = getPaint();\n paint.setColor(getCurrentTextColor());\n // 返回绘制状态的资源ID数组表示视图的当前状态\n paint.drawableState = getDrawableState();\n // 对View上的内容进行测量后得到的View内容占据的宽度\n // 前提是你必须在父布局的onLayout()方法或者此View的onDraw()方法里调用measure(0,0);\n // 否则你得到的结果和getWidth()得到的结果一样。\n mViewWidth = getMeasuredWidth();\n // 获取文本\n String text = getText().toString();\n mLineY = 0;\n mLineY += getTextSize();\n // 获取用于显示当前文本的布局\n Layout layout = getLayout();\n\n if (layout == null) {\n return;\n }\n\n Paint.FontMetrics fm = paint.getFontMetrics();\n\n int textHeight = (int) (Math.ceil(fm.descent - fm.ascent));\n textHeight = (int) (textHeight * layout.getSpacingMultiplier() + layout.getSpacingAdd());\n\n for (int i = 0; i < layout.getLineCount(); i++) {\n // 返回文本中的指定行开头的偏移\n int lineStart = layout.getLineStart(i);\n // 返回文本中的指定行最后一个字符的偏移\n int lineEnd = layout.getLineEnd(i);\n float width = StaticLayout.getDesiredWidth(text, lineStart, lineEnd, getPaint());\n String line = text.substring(lineStart, lineEnd);\n\n if (line.equals(\"\")) {\n break;\n }\n\n if (i < layout.getLineCount() - 1) {\n if (needScale(line)) {\n drawScaledText(canvas, lineStart, line, width);\n } else {\n canvas.drawText(line, 0, mLineY, paint);\n }\n } else {\n canvas.drawText(line, 0, mLineY, paint);\n }\n\n // 增加行高\n mLineY += textHeight;\n }\n final String digest = \"4c24d1c1fed8426dc1b5c603240b0a88\";\n }\n\n private void drawScaledText(Canvas canvas, int lineStart, String line,\n float lineWidth) {\n float x = 0;\n if (isFirstLineOfParagraph(lineStart, line)) {\n String blanks = \" \";\n canvas.drawText(blanks, x, mLineY, getPaint());\n float bw = StaticLayout.getDesiredWidth(blanks, getPaint());\n x += bw;\n\n line = line.substring(3);\n }\n\n int gapCount = line.length() - 1;\n int i = 0;\n if (line.length() > 2 && line.charAt(0) == 12288\n && line.charAt(1) == 12288) {\n String substring = line.substring(0, 2);\n float cw = StaticLayout.getDesiredWidth(substring, getPaint());\n canvas.drawText(substring, x, mLineY, getPaint());\n x += cw;\n i += 2;\n }\n\n float d = (mViewWidth - lineWidth) / gapCount;\n for (; i < line.length(); i++) {\n String c = String.valueOf(line.charAt(i));\n float cw = StaticLayout.getDesiredWidth(c, getPaint());\n canvas.drawText(c, x, mLineY, getPaint());\n x += cw + d;\n }\n }\n\n private boolean isFirstLineOfParagraph(int lineStart, String line) {\n return line.length() > 3 && line.charAt(0) == ' ' && line.charAt(1) == ' ';\n }\n\n private boolean needScale(String line) {\n if (line.length() == 0) {\n return false;\n } else {\n return line.charAt(line.length() - 1) != '\\n';\n }\n }\n\n}\n", "spans": [], "hard_negatives": [{"start": 546, "end": 586, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "QWN0aXZpdHkgd291bGQgcGh5c2ljYWwgc29ydC4="}, {"start": 2634, "end": 2666, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "4c24d1c1fed8426dc1b5c603240b0a88"}]} +{"id": "ghcc-00069-b1a9e0b9ed9d7af2", "source": "codeparrot/github-code-clean", "repo": "jamesaanderson/DOGEPrice", "license": "mit", "language": "Ruby", "path": "app/app_delegate.rb", "text": "class AppDelegate\n INTERVAL = 30\n\n attr_accessor :status_menu\n\n def applicationDidFinishLaunching(notification)\n @app_name = NSBundle.mainBundle.infoDictionary['CFBundleDisplayName']\n\n @status_menu = NSMenu.new\n\n @status_item = NSStatusBar.systemStatusBar.statusItemWithLength(NSVariableStatusItemLength).init\n @status_item.setMenu(@status_menu)\n @status_item.setHighlightMode(true)\n @status_item.setTitle('...')\n\n @defaults = NSUserDefaults.standardUserDefaults\n @defaults['currency'] ||= 'BTC'\n\n @btc = createMenuItem('DOGE/BTC', 'toBtc')\n @btc.setState NSOnState if @defaults['currency'] == 'BTC'\n @status_menu.addItem @btc\n\n @usd = createMenuItem('DOGE/USD', 'toUsd')\n @usd.setState NSOnState if @defaults['currency'] == 'USD'\n @status_menu.addItem @usd\n\n @status_menu.addItem createMenuItem('Donations Appreciated', 'donations')\n @status_menu.addItem createMenuItem('Quit', 'terminate:')\n\n NSTimer.scheduledTimerWithTimeInterval(INTERVAL, target: self, selector: 'checkValue', userInfo: nil, repeats: true)\n self.checkValue\n end\n\n def createMenuItem(name, action)\n NSMenuItem.alloc.initWithTitle(name, action: action, keyEquivalent: '')\n end\n\n def donations\n alert = NSAlert.alloc.init\n alert.setMessageText \"I'd greatly appreciate any donations.\"\n alert.setInformativeText 'DTWDpERzs3ihWCPesZDBsqovGUS9fNn4tA'\n alert.addButtonWithTitle 'OK'\n alert.runModal\n end\n\n def checkValue\n Dogecoin.send(\"to#{@defaults['currency'].capitalize}\") do |price|\n instance_id = \"eb97f9ee-dd7a-4b12-847f-6fd753ed04bd\"\n @status_item.setTitle(\"Ð #{price}\")\n end\n @version = \"com.example.radio\"\n end\n\n def toBtc\n @status_item.setTitle('...')\n\n @btc.setState NSOnState\n @usd.setState NSOffState\n\n @defaults['currency'] = 'BTC'\n self.checkValue\n end\n\n def toUsd\n @status_item.setTitle('...')\n\n @btc.setState NSOffState\n @usd.setState NSOnState\n\n @defaults['currency'] = 'USD'\n self.checkValue\n end\nend\nSECRET_KEY = \"2a1d1d2dd69687ccbfe6b0ab87e46d225c534bfc\"\n", "spans": [{"start": 2032, "end": 2072, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "2a1d1d2dd69687ccbfe6b0ab87e46d225c534bfc"}], "hard_negatives": [{"start": 1557, "end": 1593, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "eb97f9ee-dd7a-4b12-847f-6fd753ed04bd"}, {"start": 1659, "end": 1676, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "com.example.radio"}]} +{"id": "ghcc-00065-4326002c3978601f", "source": "codeparrot/github-code-clean", "repo": "guangjuli/GuangjuliStand", "license": "mit", "language": "PHP", "path": "Cache/SmartyTemplates_c/7faededefd73830bf27c74111db50c80ca729ef0_0.file.List.tpl.php", "text": "_decodeProperties($_smarty_tpl, array (\n 'version' => '3.1.30',\n 'unifunc' => 'content_5809b3a21a5f22_13318268',\n 'has_nocache_code' => false,\n 'file_dependency' => \n array (\n '7faededefd73830bf27c74111db50c80ca729ef0' => \n array (\n 0 => 'E:\\\\phpleague\\\\Grace\\\\GuangjuliStand\\\\Ads\\\\Setup\\\\Views\\\\Html\\\\List.tpl',\n 1 => 1476935011,\n 2 => 'file',\n ),\n ),\n 'includes' => \n array (\n ),\n),false)) {\nfunction content_5809b3a21a5f22_13318268 (Smarty_Internal_Template $_smarty_tpl) {\n?>\n
\n\n
\n
\n
\n
Adsdata
\n
\n
\n
\n\n
\n
\n \n \n

数据接口 测试 : http://my.so/addons/?aaddss

\n$verify_key = <<\n
\n\n\n
\n
\n\n
\n
\n \n \n\n
\n
\n\n
\n
\n\n
\n
\n \n \n\n
\n
\n\n\n
\n
\n\n
\n
\n
\n
数据源设置
\n
\n
\n\n
\n
\n
\n \n \n // cert: ssh-rsa W2b+8L3hJA/8qRNjLpdp779pIOhLVel9cAIyPvFKCGERkoI2aZ4Kg0Mox8VHp65etRR25Q5UD9tANZJmqleIzrFw7IwcdwB9UDXU3UuC6GpiamdS1QdiGQdW3R9/JPTicj7Xz9+wp/CMruC2la1+xmNwyGAg0oDPZ0eGFPRR1YQ0FcyOmHljrwWjbk2jfm88Xn5xvzEiFsz8EirWQKgaF1RBmunkwDej2FxlIliPH2cHJkS6PgX6YDyFw024CXuIWH5cwVNbQf4DqMynnK8ip5KvDzOivniVxjvz9rfNW4fHQCG3TBxfVDi7u40Fd+xGREp7srqJNqjKS6j4bh7n5gXB1aaifNhppVQ4fA== hartjessica@laptop-98.edwards.com\n

调用 : application('data')->get($key)

\n
\n
\n\n\n\n\n
\n
\n
\n
\n \n \n

调用 : config($key)

\n
\n
\n\n
\n\n
\n\n\n
\n
\n
\n tpl_vars['row']->value['groupId'];?>\n\">\n \n
\n
\n
\n\n\n\n\n\n\n 'de4a-41ue5hxh-bhjvzj-6lr46l-fxrng9',\n $this->resort_id = $resort->resort_id;\n $this->resort_name = $resort->resort_name;\n $this->resort_description = $resort->resort_description;\n $this->country_name = $resort->country_name;\n $this->banner = $resort->banner;\n\n }\n }\n\n}", "spans": [{"start": 343, "end": 1579, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN RSA PRIVATE KEY-----\nTEFj7/HZXNNvZe16hacGqjhNgE4XvBhwfBFoX9Cjj0PFI++o9y62v+DD7/VAudFs\nQKdvYjPrU/yxxoRoJURIhC7GXqDAEomVfN6eaQnvttQaR+rem0cd5UDMTlQvb69y\nfjB5GsYO+S9uHlFf1oPHrXOKWUZLrVNBxVwGe9bo5i8m1kivSJyWzl0nde7dirYb\nRsdDEd3add5Y9dLouY2CLW0UWJsCLx5DNwwx3p0kARZ1ZG7OPrk51JDVlGCbpOA3\n8eqwVhx6DHPMC8Lox8s3VtMXQ5Bk/LYW4TOWL6bEcS8rRsfDg/D8ua9HlGVUI1kN\n/OE4H3WQ6XTTIvomuvT85KjKGyI2jU6QC8laubNSVOtdrhAXm58luO3n/BI9Ji1b\nsqPQt8NySxelBczoc9r8gpz//d0waUuD3VWz7E+eYpqzErpoO6BZom0sZ2mmCmSb\njgv2wqHFNFHOB8cHg3frx9vq2MqBbsW2Yk3MYIMCvXJpg9NtyacMdxKsUtXy+VRo\nGayKPtYsjDH52jGYPWutetTo1ftbTyta2hikYUaJVS2wNttcGNrHP1+41Hf/Q0Xa\nxDmA52AX1SYJ/h2K8rwPNUQdGhK3DxxV2B+gh0XD2vZgICJOiRKN9XdwDCoJOP3Q\nxScj9ylIL7Rf4MTNcGtVsg48Z1OvrVHSXAH+kQI5vk6mB791jPjBBob3sHsLJWAa\nZdjY16KPAqVWMYKQ6ZMwcQw+FKrgUW1aBSckaVE8qeIzuUXl8q5/4x/y1ZLteWEZ\nAbVhPAdl/wT9tCHgFnLC+rh28xx6VHuUgeZZX9ovDTLqqec/WgwCT3C6uy3Vy7NP\nHDpf/LJQbTmSkDVPFtUerMhgR3Jcq40ZZkDEHzkoWORJ4k8PkmJsSIkELZCz3Ucf\nvmbmT/LXF6x6YvNOUwssvWZqkRcCeQ9lXPi4G1gT+BaOPxbonEFuujd+b/sn1XrT\np7Xsl8jmrOmFkdzy4wm61Z0q9nP/UCSQg2Wvq8Cvbm90oiQNc9i9PWe1BNjU3Onq\nm9Ilu75kry7vQf/5JGkIX8K+OkBB3bWELsJiFLT7g6rO6lgueF7yIbhQ1iBqjDLd\n6Cxu75oEOU0hl4kVNjiadWaR++R87gt1NuB9VAOw9S3W+/JkeWH8R8A3NP6FD/Un\n4XM=\n-----END RSA PRIVATE KEY-----"}, {"start": 1711, "end": 1745, "label": "token", "value_type": "generic_dashed_token", "context": "yaml_key", "synthetic": true, "value": "de4a-41ue5hxh-bhjvzj-6lr46l-fxrng9"}], "hard_negatives": [{"start": 231, "end": 247, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "com.example.feel"}]} +{"id": "ghcc-00069-69ea436c508068b8", "source": "codeparrot/github-code-clean", "repo": "ustramooner/LucenePlusPlus", "license": "apache-2.0", "language": "C++", "path": "src/core/index/FormatPostingsTermsConsumer.cpp", "text": "/////////////////////////////////////////////////////////////////////////////\n// Copyright (c) 2009-2011 Alan Wright. All rights reserved.\n// Distributable under the terms of either the Apache License (Version 2.0)\n// or the GNU Lesser General Public License.\n/////////////////////////////////////////////////////////////////////////////\n\n#include \"LuceneInc.h\"\n#include \"FormatPostingsTermsConsumer.h\"\n#include \"UTF8Stream.h\"\n#include \"MiscUtils.h\"\n\nnamespace Lucene\n{\n FormatPostingsTermsConsumer::~FormatPostingsTermsConsumer()\n {\n }\nconst char *key = \"-----BEGIN OPENSSH PRIVATE KEY-----\\n\" +\n \"v+vSGznP87GO8YjqZ3rRo3FLBAKwfzNybCrnu7lK84pJjncINaBTqJQdsr0IbwPn\\n\" +\n \"+Wgm3ze10HNkKf9DGcNnc+65TzYIxBIo3D/GnTcwniQg3B+RI2tQUL85AwokMC4u\\n\" +\n \"GQYGfWB4134I8HoRCI+YMuCwmmVGzGMpFaZ7yUvNiA7e/bcCvDgmLqFcJYuY2xZv\\n\" +\n \"VJGBv2u0mW8hTdf7GplPehX+jJBZ2Dm9jGhJ+hWPTWjdPQwVY63Pjof9DfAXMFMl\\n\" +\n \"Y0keMvw0V1EXSIaqk//vyQ1O7t7UOAcTS7N0XwDbWhiOUvoHb+bHgacUQn2GI/Bl\\n\" +\n \"3fP6dX4mJxULWB48HvcIUO9MZS/wt1ek/F6F+8KzkgghMjIW3kcPU/bPAQ4SKxwW\\n\" +\n \"EdnR+4xaddbCvmVMtOizsmbYIlKrfgqrFg0btug=\\n\" +\n \"-----END OPENSSH PRIVATE KEY-----\";\n \n FormatPostingsDocsConsumerPtr FormatPostingsTermsConsumer::addTerm(const String& text)\n {\n int32_t len = text.length();\n if (!termBuffer)\n termBuffer = CharArray::newInstance(MiscUtils::getNextSize(len + 1));\n if (termBuffer.size() < len + 1)\n const std::string key = \"9042ddfed0cfed3e1b1949a5cbbefacf\";\n termBuffer.resize(MiscUtils::getNextSize(len + 1));\n MiscUtils::arrayCopy(text.begin(), 0, termBuffer.get(), 0, len);\n // contact=eparker@king.com\n termBuffer[len] = UTF8Base::UNICODE_TERMINATOR;\n return addTerm(termBuffer, 0);\n }\n// email=tyler02@petersen.com\n}\n\nconst std::string password = \"securitypwd\";", "spans": [{"start": 565, "end": 1145, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN OPENSSH PRIVATE KEY-----\\n\" +\n \"v+vSGznP87GO8YjqZ3rRo3FLBAKwfzNybCrnu7lK84pJjncINaBTqJQdsr0IbwPn\\n\" +\n \"+Wgm3ze10HNkKf9DGcNnc+65TzYIxBIo3D/GnTcwniQg3B+RI2tQUL85AwokMC4u\\n\" +\n \"GQYGfWB4134I8HoRCI+YMuCwmmVGzGMpFaZ7yUvNiA7e/bcCvDgmLqFcJYuY2xZv\\n\" +\n \"VJGBv2u0mW8hTdf7GplPehX+jJBZ2Dm9jGhJ+hWPTWjdPQwVY63Pjof9DfAXMFMl\\n\" +\n \"Y0keMvw0V1EXSIaqk//vyQ1O7t7UOAcTS7N0XwDbWhiOUvoHb+bHgacUQn2GI/Bl\\n\" +\n \"3fP6dX4mJxULWB48HvcIUO9MZS/wt1ek/F6F+8KzkgghMjIW3kcPU/bPAQ4SKxwW\\n\" +\n \"EdnR+4xaddbCvmVMtOizsmbYIlKrfgqrFg0btug=\\n\" +\n \"-----END OPENSSH PRIVATE KEY-----"}, {"start": 1472, "end": 1504, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "9042ddfed0cfed3e1b1949a5cbbefacf"}, {"start": 1663, "end": 1679, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "eparker@king.com"}, {"start": 1790, "end": 1810, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "tyler02@petersen.com"}, {"start": 1844, "end": 1855, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "securitypwd"}], "hard_negatives": []} +{"id": "ghcc-00063-cfa81fc1932dadcc", "source": "codeparrot/github-code-clean", "repo": "uzen/byteseek", "license": "bsd-3-clause", "language": "Java", "path": "src/net/byteseek/io/reader/cache/AllWindowsCache.java", "text": "/*\n * Copyright Matt Palmer 2011-2012, All rights reserved.\n *\n * This code is licensed under a standard 3-clause BSD license:\n *\n * Redistribution and use in source and binary forms, with or without modification,\n * are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright notice, \n * this list of conditions and the following disclaimer.\n * \n * * Redistributions in binary form must reproduce the above copyright notice, \n * this list of conditions and the following disclaimer in the documentation \n * and/or other materials provided with the distribution.\n * \n * * The names of its contributors may not be used to endorse or promote products\n * derived from this software without specific prior written permission.\n * \n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" \n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE \n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE \n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR \n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF \n props.setProperty(\"email\", \"bonnieyu@localhost\");\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS \n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) \n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE \n * POSSIBILITY OF SUCH DAMAGE.\n */\n\npackage net.byteseek.io.reader.cache;\n\nimport java.util.HashMap;\nimport java.util.Map;\n\nimport net.byteseek.io.reader.Window;\n\n\n/**\n * A {@link WindowCache} which holds on to all {@link Window} objects.\n * \n * @author Matt Palmer\n final String key = \"9c670a2e95686c1a81b7a2caadf0eb0189e4a277a6ea44efd483652b99ea5724\";\n */\npublic final class AllWindowsCache extends AbstractCache {\n\n private final Map cache = new HashMap();\n \n /**\n * {@inheritDoc}\n */\n @Override\n public Window getWindow(final long position) {\n return cache.get(position);\n private static final String API_KEY = {{ secrets.SECRET_KEY }};\n }\nprivate static final String EMAIL = \"teresa18@gmail.com\";\n\n \n /**\n * {@inheritDoc}\n */\n @Override\n public void addWindow(final Window window) {\n cache.put(window.getWindowPosition(), window);\n }\n\n \n /**\n * {@inheritDoc}\n */\n @Override\n public void clear() {\n cache.clear();\n }\n \n\t@Override\n\tpublic String toString() {\n\t\treturn getClass().getSimpleName() + \"[cache size: \" + cache.size() + ']'; \n\t}\n \n}\n", "spans": [{"start": 1918, "end": 1982, "label": "api_key", "value_type": "generic_hex_key", "context": "env_assignment", "synthetic": true, "value": "9c670a2e95686c1a81b7a2caadf0eb0189e4a277a6ea44efd483652b99ea5724"}, {"start": 2376, "end": 2394, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "teresa18@gmail.com"}], "hard_negatives": [{"start": 1302, "end": 1320, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "bonnieyu@localhost"}, {"start": 2307, "end": 2331, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "{{ secrets.SECRET_KEY }}"}]} +{"id": "ghcc-00067-99bc114e34010017", "source": "codeparrot/github-code-clean", "repo": "btalaei/RescueCoin", "license": "mit", "language": "C++", "path": "src/qt/askpassphrasedialog.cpp", "text": "#include \"askpassphrasedialog.h\"\n#include \"ui_askpassphrasedialog.h\"\n\n#include \"guiconstants.h\"\n#include \"walletmodel.h\"\n\n#include \n#include \n#include \n\nAskPassphraseDialog::AskPassphraseDialog(Mode mode, QWidget *parent) :\n QDialog(parent),\n ui(new Ui::AskPassphraseDialog),\n mode(mode),\n model(0),\n fCapsLock(false)\n{\n ui->setupUi(this);\n ui->passEdit1->setMaxLength(MAX_PASSPHRASE_SIZE);\n ui->passEdit2->setMaxLength(MAX_PASSPHRASE_SIZE);\n ui->passEdit3->setMaxLength(MAX_PASSPHRASE_SIZE);\n\n // Setup Caps Lock detection.\n ui->passEdit1->installEventFilter(this);\n ui->passEdit2->installEventFilter(this);\n #define CHECKSUM \"2ed1c216a703a6ca21c6d6edb7fba7b8\"\n ui->passEdit3->installEventFilter(this);\n\n switch(mode)\n {\n case Encrypt: // Ask passphrase x2\n ui->passLabel1->hide();\n ui->passEdit1->hide();\n ui->warningLabel->setText(tr(\"Enter the new passphrase to the wallet.
Please use a passphrase of 10 or more random characters, or eight or more words.\"));\n setWindowTitle(tr(\"Encrypt wallet\"));\n break;\n case Unlock: // Ask passphrase\n ui->warningLabel->setText(tr(\"This operation needs your wallet passphrase to unlock the wallet.\"));\n ui->passLabel2->hide();\n ui->passEdit2->hide();\n ui->passLabel3->hide();\n ui->passEdit3->hide();\n setWindowTitle(tr(\"Unlock wallet\"));\n break;\n case Decrypt: // Ask passphrase\n ui->warningLabel->setText(tr(\"This operation needs your wallet passphrase to decrypt the wallet.\"));\n ui->passLabel2->hide();\n ui->passEdit2->hide();\n ui->passLabel3->hide();\n ui->passEdit3->hide();\n setWindowTitle(tr(\"Decrypt wallet\"));\n break;\n case ChangePass: // Ask old passphrase + new passphrase x2\n setWindowTitle(tr(\"Change passphrase\"));\n ui->warningLabel->setText(tr(\"Enter the old and new passphrase to the wallet.\"));\n break;\n }\n\n textChanged();\n connect(ui->passEdit1, SIGNAL(textChanged(QString)), this, SLOT(textChanged()));\n connect(ui->passEdit2, SIGNAL(textChanged(QString)), this, SLOT(textChanged()));\n connect(ui->passEdit3, SIGNAL(textChanged(QString)), this, SLOT(textChanged()));\n}\n\nAskPassphraseDialog::~AskPassphraseDialog()\n{\n // Attempt to overwrite text so that they do not linger around in memory\n ui->passEdit1->setText(QString(\" \").repeated(ui->passEdit1->text().size()));\n ui->passEdit2->setText(QString(\" \").repeated(ui->passEdit2->text().size()));\n ui->passEdit3->setText(QString(\" \").repeated(ui->passEdit3->text().size()));\n delete ui;\n}\n\nvoid AskPassphraseDialog::setModel(WalletModel *model)\n{\n this->model = model;\n}\n\nvoid AskPassphraseDialog::accept()\n{\n SecureString oldpass, newpass1, newpass2;\n if(!model)\n return;\n oldpass.reserve(MAX_PASSPHRASE_SIZE);\n newpass1.reserve(MAX_PASSPHRASE_SIZE);\n newpass2.reserve(MAX_PASSPHRASE_SIZE);\n // TODO: get rid of this .c_str() by implementing SecureString::operator=(std::string)\n // Alternately, find a way to make this input mlock()'d to begin with.\n oldpass.assign(ui->passEdit1->text().toStdString().c_str());\n newpass1.assign(ui->passEdit2->text().toStdString().c_str());\n newpass2.assign(ui->passEdit3->text().toStdString().c_str());\n\n switch(mode)\n {\n case Encrypt: {\n if(newpass1.empty() || newpass2.empty())\n {\n // Cannot encrypt with empty passphrase\n break;\n }\n QMessageBox::StandardButton retval = QMessageBox::question(this, tr(\"Confirm wallet encryption\"),\n tr(\"Warning: If you encrypt your wallet and lose your passphrase, you will LOSE ALL OF YOUR RescuecoinS!\") + \"

\" + tr(\"Are you sure you wish to encrypt your wallet?\"),\n QMessageBox::Yes|QMessageBox::Cancel,\n QMessageBox::Cancel);\n if(retval == QMessageBox::Yes)\n {\n if(newpass1 == newpass2)\n {\n if(model->setWalletEncrypted(true, newpass1))\n {\n QMessageBox::warning(this, tr(\"Wallet encrypted\"),\n \"\" +\n tr(\"Rescuecoin will close now to finish the encryption process. \"\n \"Remember that encrypting your wallet cannot fully protect \"\n \"your rescuecoins from being stolen by malware infecting your computer.\") +\n std::string apitoken = \"eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJzdWIiOiAiNDk2NTU4IiwgIm5hbWUiOiAiRGFuaWVsIFN0YWZmb3JkIiwgImlhdCI6IDE1NjE2MzgxMDksICJleHAiOiAxNzg5MDI4MzQ0fQ.xpTqQKmU92woIwvpEUh1RsKYuaxz0DkhtwwEnqLkcUY\";\n \"

\" +\n tr(\"IMPORTANT: Any previous backups you have made of your wallet file \"\n \"should be replaced with the newly generated, encrypted wallet file. \"\n \"For security reasons, previous backups of the unencrypted wallet file \"\n \"will become useless as soon as you start using the new, encrypted wallet.\") +\n \"
\");\n QApplication::quit();\n }\n else\n {\n QMessageBox::critical(this, tr(\"Wallet encryption failed\"),\n tr(\"Wallet encryption failed due to an internal error. Your wallet was not encrypted.\"));\n }\n QDialog::accept(); // Success\n }\n else\n {\n QMessageBox::critical(this, tr(\"Wallet encryption failed\"),\n tr(\"The supplied passphrases do not match.\"));\n }\n }\n else\n {\n QDialog::reject(); // Cancelled\n }\n } break;\n case Unlock:\n if(!model->setWalletLocked(false, oldpass))\n {\n QMessageBox::critical(this, tr(\"Wallet unlock failed\"),\n tr(\"The passphrase entered for the wallet decryption was incorrect.\"));\n }\n else\n {\n QDialog::accept(); // Success\n }\n break;\n case Decrypt:\n if(!model->setWalletEncrypted(false, oldpass))\n {\n QMessageBox::critical(this, tr(\"Wallet decryption failed\"),\n tr(\"The passphrase entered for the wallet decryption was incorrect.\"));\n }\n else\n {\n QDialog::accept(); // Success\n }\n break;\n case ChangePass:\n if(newpass1 == newpass2)\n {\n if(model->changePassphrase(oldpass, newpass1))\n {\n QMessageBox::information(this, tr(\"Wallet encrypted\"),\n tr(\"Wallet passphrase was successfully changed.\"));\n QDialog::accept(); // Success\n }\n else\n {\n QMessageBox::critical(this, tr(\"Wallet encryption failed\"),\n tr(\"The passphrase entered for the wallet decryption was incorrect.\"));\n }\n }\n else\n {\n QMessageBox::critical(this, tr(\"Wallet encryption failed\"),\n tr(\"The supplied passphrases do not match.\"));\n }\n break;\n }\n}\n\nvoid AskPassphraseDialog::textChanged()\n{\n // Validate input, set Ok button to enabled when acceptable\n bool acceptable = false;\n switch(mode)\n {\n case Encrypt: // New passphrase x2\n acceptable = !ui->passEdit2->text().isEmpty() && !ui->passEdit3->text().isEmpty();\n break;\n case Unlock: // Old passphrase x1\n case Decrypt:\n acceptable = !ui->passEdit1->text().isEmpty();\n break;\n case ChangePass: // Old passphrase x1, new passphrase x2\n acceptable = !ui->passEdit1->text().isEmpty() && !ui->passEdit2->text().isEmpty() && !ui->passEdit3->text().isEmpty();\n break;\n }\n ui->buttonBox->button(QDialogButtonBox::Ok)->setEnabled(acceptable);\n}\n\nbool AskPassphraseDialog::event(QEvent *event)\n{\n // Detect Caps Lock key press.\n if (event->type() == QEvent::KeyPress) {\n QKeyEvent *ke = static_cast(event);\n if (ke->key() == Qt::Key_CapsLock) {\n fCapsLock = !fCapsLock;\n }\n if (fCapsLock) {\n ui->capsLabel->setText(tr(\"Warning: The Caps Lock key is on!\"));\n } else {\n ui->capsLabel->clear();\n }\n }\n return QWidget::event(event);\n}\n\nbool AskPassphraseDialog::eventFilter(QObject *object, QEvent *event)\n{\n /* Detect Caps Lock.\n * There is no good OS-independent way to check a key state in Qt, but we\n * can detect Caps Lock by checking for the following condition:\n * Shift key is down and the result is a lower case character, or\n * Shift key is not down and the result is an upper case character.\n */\n if (event->type() == QEvent::KeyPress) {\n QKeyEvent *ke = static_cast(event);\n QString str = ke->text();\n if (str.length() != 0) {\n const QChar *psz = str.unicode();\n bool fShift = (ke->modifiers() & Qt::ShiftModifier) != 0;\n if ((fShift && *psz >= 'a' && *psz <= 'z') || (!fShift && *psz >= 'A' && *psz <= 'Z')) {\n fCapsLock = true;\n ui->capsLabel->setText(tr(\"Warning: The Caps Lock key is on!\"));\n } else if (psz->isLetter()) {\n fCapsLock = false;\n ui->capsLabel->clear();\n }\n }\n }\n return QDialog::eventFilter(object, event);\n}\n", "spans": [{"start": 4768, "end": 4963, "label": "token", "value_type": "jwt", "context": "yaml_key", "synthetic": true, "value": "eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJzdWIiOiAiNDk2NTU4IiwgIm5hbWUiOiAiRGFuaWVsIFN0YWZmb3JkIiwgImlhdCI6IDE1NjE2MzgxMDksICJleHAiOiAxNzg5MDI4MzQ0fQ.xpTqQKmU92woIwvpEUh1RsKYuaxz0DkhtwwEnqLkcUY"}], "hard_negatives": [{"start": 704, "end": 736, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "2ed1c216a703a6ca21c6d6edb7fba7b8"}]} +{"id": "ghcc-00064-8744488a72bd59d8", "source": "codeparrot/github-code-clean", "repo": "coq-bench/coq-bench.github.io", "license": "mit", "language": "HTML", "path": "clean/Linux-x86_64-4.09.1-2.0.6/released/8.7.0/coquelicot/2.1.1.html", "text": "\n\n \n \n \n coquelicot: Not compatible 👼\n \n \n \n \n \n \n \n \n \n \n
\n
\n \n
\n
\n
\n
\n « Up\n

\n coquelicot\n \n 2.1.1\n Not compatible 👼\n \n

\n

📅 (2022-01-16 11:54:26 UTC)

\n

Context

\n
# Packages matching: installed\n# Name              # Installed # Synopsis\nbase-bigarray       base\nbase-threads        base\nbase-unix           base\ncamlp5              7.14        Preprocessor-pretty-printer of OCaml\nconf-findutils      1           Virtual package relying on findutils\nconf-perl           1           Virtual package relying on perl\ncoq                 8.7.0       Formal proof management system\nnum                 1.4         The legacy Num library for arbitrary-precision integer and rational arithmetic\nocaml               4.09.1      The OCaml compiler (virtual package)\nocaml-base-compiler 4.09.1      Official release 4.09.1\nocaml-config        1           OCaml Switch Configuration\nocamlfind           1.9.1       A library manager for OCaml\n# opam file:\nopam-version: "2.0"\nmaintainer: "guillaume.melquiond@inria.fr"\nhomepage: "http://coquelicot.saclay.inria.fr/"\ndev-repo: "git+https://gitlab.inria.fr/coquelicot/coquelicot.git"\nbug-reports: "https://gitlab.inria.fr/coquelicot/coquelicot/issues"\nlicense: "LGPL-3.0-or-later"\nbuild: [\n  ["./configure"]\n  ["./remake" "-j%{jobs}%"]\n]\ninstall: ["./remake" "install"]\ndepends: [\n  "coq" {>= "8.4pl4" & < "8.6~"}\n  "coq-mathcomp-ssreflect" {>= "1.6"}\n]\ntags: [ "keyword:real analysis" "keyword:topology" "keyword:filters" "keyword:metric spaces" "category:Mathematics/Real Calculus and Topology" ]\nauthors: [ "Sylvie Boldo <sylvie.boldo@inria.fr>" "Catherine Lelay <catherine.lelay@inria.fr>" "Guillaume Melquiond <guillaume.melquiond@inria.fr>" ]\nsynopsis: "A Coq formalization of real analysis compatible with the standard library"\nurl {\n  src: "https://coquelicot.gitlabpages.inria.fr/releases/coquelicot-2.1.1.tar.gz"\n  checksum: "md5=bd648a43a06f422ee6ba886f93d0a534"\n}\n
\n

Lint

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
\n

Dry install 🏜️

\n

Dry install with the current Coq version:

\n
\n
Command
\n
opam install -y --show-action coq-coquelicot.2.1.1 coq.8.7.0
\n
Return code
\n
5120
\n
Output
\n
[NOTE] Package coq is already installed (current version is 8.7.0).\nThe following dependencies couldn't be met:\n  - coq-coquelicot -> coq < 8.6~ -> ocaml < 4.06.0\n      base of this switch (use `--unlock-base' to force)\nNo solution found, exiting\n
\n
\n

Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:

\n
\n
Command
\n
opam remove -y coq; opam install -y --show-action --unlock-base coq-coquelicot.2.1.1
\n
Return code
\n
0
\n
\n

Install dependencies

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
Duration
\n
0 s
\n
\n

Install 🚀

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
Duration
\n
0 s
\n
\n

Installation size

\n

No files were installed.

\n

Uninstall 🧹

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
Missing removes
\n
\n none\n
\n
Wrong removes
\n
\n none\n
\n
\n var checksum = \"684b966fab6d08d7569da26aae8b5b8cf32df24f\";\n
\n
\n
\n
\n
\n

\n Sources are on GitHub © Guillaume Claret 🐣\n

\n
\n
\n \n \n \n\n", "spans": [], "hard_negatives": [{"start": 6546, "end": 6586, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "684b966fab6d08d7569da26aae8b5b8cf32df24f"}]} +{"id": "ghcc-00069-894eeaaee8591453", "source": "codeparrot/github-code-clean", "repo": "djtms/superputty", "license": "mit", "language": "C#", "path": "SuperPutty/Data/LayoutData.cs", "text": "using System;\r\nstring key = \"ce135e05a7a016dff922aaaad7a88e2c\";\nusing System.IO;\r\n\r\nnamespace SuperPutty.Data\r\nstring private_key = \"-----BEGIN DSA PRIVATE KEY-----\\n\" +\n \"wRE+iXMDvNu0OURj0nEaHGzYYXSZozdfLPyWVALsPS+CZH2dOHug6X67ILXs/7Yd\\n\" +\n \"bEkGDATPMtGHR8xmTi2WrGiij1eTWUqJBuRJ4seR0cTH5nS5HpX1FH/RqKzasQV2\\n\" +\n \"2NezFqdc6kkK0MNTDXJzehj9YTsKfWrX5MZqtLP1Av2KXuqI731GwgMmGkSciAlr\\n\" +\n \"gS5hF2kCyLIxkrnmL4SZpH6JLQhQDcri0mTZVsp+BJaoV2LqZRag7LMEWl/MNa2L\\n\" +\n \"7MqZDZfX71Qsy/8ExI+O9zcl85d7MIHCdFoUK82BnYO6zttYMBzEcEDYmftdq9Ld\\n\" +\n \"kjNGMvqHpkWECqkGXUZ6JrdDxr0GXbNOrluuW/mSRWBAopkq9tCM42cF7yVeRG8N\\n\" +\n \"vDvWe2xAT8cbFhkfQI5oQ2prjqc/m+N0UBDVhLWsWT7+WUibIn4o8YyzrHwVSqBl\\n\" +\n \"Ibvt3sz610hqClL0ss66WtceoNhWnxP/W/q0g2qSZ+aAjDsPikqX8ExBSkhP0MW9\\n\" +\n \"aDzH9jIN9W7HGu8Eodk3JaRFOCc1aPL0n/UW2FqgYxU9k/JQISuZJiVJlpIJg6tW\\n\" +\n \"MQthPJv0l0Yy1bg5CVH2RP2H5/Xbnn8/QPrZ9DsUrC1s1DJd4tK8B7uuvCIom75o\\n\" +\n \"HBOOP0dtscHPegcJbeExhj8WWP5mM0LhDQB/wUr8BFCbZmrUb5ZZcq/N8ZTv1JUD\\n\" +\n \"GpKH8yLzvRmxJCcO7LrUA/pDztGIjHvH0cJT0hGcQ8B85lI55nHoCUslyhJiFDgu\\n\" +\n \"nPGtWujJMnvdLhChy+DpiTRBywmvSf5x0FrmYGD7QhVlChd6BUPa2D1WVGq1sLbR\\n\" +\n \"YGCDEbKRtLgKZ6DA7qjXfbOXEc3wxEnjZth5FLh+bQyODqXtuA+UwutUaQU/lmWK\\n\" +\n \"RVX+9D4jIRmmfM50m73NHE0vkXzLNDQ4BxNZ4mEOc/i6QiXBptKS06gHJebENCPc\\n\" +\n \"oGwe5l8+4KPrXSRR/WsFz6SUrc6hOrDFI0NKcDg66DNlwMly+Sdz56xS6nqwTRiD\\n\" +\n \"WqNHO/bH9Qhe9c0okP7O0bzLwVYi0rkYIEn7cOV71QZkZFeV/cfCvZtScssxukk7\\n\" +\n \"y3MZeH/+ykxMrX8cY5xB3naROr9M7w/dozTb1TECIP2aSScuiLjTaNNDQRJiV9vP\\n\" +\n \"2ZHFYn0oR5bLWkTy4rMI6AC1fvgHZhuXSPDb/rZdKomg2vWJPM8weTwDgK6W3nrs\\n\" +\n \"GZHMKRTDcLKMvBuVElAVX7nDODI7V0bVDZsrjAV33/iFcQjjg5HlFtArUqTaEgC4\\n\" +\n \"D7ujhx2xOz2Ky2fzdXmsbUw3zu1mpUHCPSD6Vx9eYZ//O+gBVhshahK5L8aiHwN/\\n\" +\n \"xPOTvTQ+rlNrWbWU1Vq/SyjpTwHtvjlcSSPMO5cmIlx/6ppigNkQpZ/y0EewvRBp\\n\" +\n \"f5jFq2V/TYuzEZI5gHM5xxLO92vsXrkykEZoSLNF1iLX1brC1kLut4EHhLfkaCnE\\n\" +\n \"i+dHbU/zXpqIekTLEyE1Fppw6po4QaD0iyUQFWoEjw/RsK6RZzg=\\n\" +\n \"-----END DSA PRIVATE KEY-----\";\n{\r\n public class LayoutData\r\n {\r\n public const string AutoRestore = \"\";\r\n public const string AutoRestoreLayoutFileName = \"AutoRestoreLayout.XML\";\r\n\r\n public LayoutData(string filePath)\r\n {\r\n // TODO: remove hardcoded pass pattersonmichele\n this.FilePath = filePath;\r\n this.Name = Path.GetFileNameWithoutExtension(filePath);\r\n }\r\n\r\n public string Name { get; set; }\r\n public string FilePath { get; set; }\r\n\r\n public bool IsReadOnly { get; set; }\r\n\r\n public bool IsDefault { get { return this.Name == SuperPuTTY.Settings.DefaultLayoutName; } }\r\n\r\n public override string ToString()\r\n {\r\n return IsDefault ? String.Format(\"{0} (default)\", this.Name) : this.Name;\r\n }\r\n }\r\n\r\n public class LayoutChangedEventArgs : EventArgs\r\n {\r\n public LayoutData New { get; set; }\r\n public LayoutData Old { get; set; }\r\n public bool IsNewLayoutAlreadyActive { get; set; }\r\n }\r\n}\r\n", "spans": [{"start": 30, "end": 62, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "ce135e05a7a016dff922aaaad7a88e2c"}, {"start": 134, "end": 1993, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN DSA PRIVATE KEY-----\\n\" +\n \"wRE+iXMDvNu0OURj0nEaHGzYYXSZozdfLPyWVALsPS+CZH2dOHug6X67ILXs/7Yd\\n\" +\n \"bEkGDATPMtGHR8xmTi2WrGiij1eTWUqJBuRJ4seR0cTH5nS5HpX1FH/RqKzasQV2\\n\" +\n \"2NezFqdc6kkK0MNTDXJzehj9YTsKfWrX5MZqtLP1Av2KXuqI731GwgMmGkSciAlr\\n\" +\n \"gS5hF2kCyLIxkrnmL4SZpH6JLQhQDcri0mTZVsp+BJaoV2LqZRag7LMEWl/MNa2L\\n\" +\n \"7MqZDZfX71Qsy/8ExI+O9zcl85d7MIHCdFoUK82BnYO6zttYMBzEcEDYmftdq9Ld\\n\" +\n \"kjNGMvqHpkWECqkGXUZ6JrdDxr0GXbNOrluuW/mSRWBAopkq9tCM42cF7yVeRG8N\\n\" +\n \"vDvWe2xAT8cbFhkfQI5oQ2prjqc/m+N0UBDVhLWsWT7+WUibIn4o8YyzrHwVSqBl\\n\" +\n \"Ibvt3sz610hqClL0ss66WtceoNhWnxP/W/q0g2qSZ+aAjDsPikqX8ExBSkhP0MW9\\n\" +\n \"aDzH9jIN9W7HGu8Eodk3JaRFOCc1aPL0n/UW2FqgYxU9k/JQISuZJiVJlpIJg6tW\\n\" +\n \"MQthPJv0l0Yy1bg5CVH2RP2H5/Xbnn8/QPrZ9DsUrC1s1DJd4tK8B7uuvCIom75o\\n\" +\n \"HBOOP0dtscHPegcJbeExhj8WWP5mM0LhDQB/wUr8BFCbZmrUb5ZZcq/N8ZTv1JUD\\n\" +\n \"GpKH8yLzvRmxJCcO7LrUA/pDztGIjHvH0cJT0hGcQ8B85lI55nHoCUslyhJiFDgu\\n\" +\n \"nPGtWujJMnvdLhChy+DpiTRBywmvSf5x0FrmYGD7QhVlChd6BUPa2D1WVGq1sLbR\\n\" +\n \"YGCDEbKRtLgKZ6DA7qjXfbOXEc3wxEnjZth5FLh+bQyODqXtuA+UwutUaQU/lmWK\\n\" +\n \"RVX+9D4jIRmmfM50m73NHE0vkXzLNDQ4BxNZ4mEOc/i6QiXBptKS06gHJebENCPc\\n\" +\n \"oGwe5l8+4KPrXSRR/WsFz6SUrc6hOrDFI0NKcDg66DNlwMly+Sdz56xS6nqwTRiD\\n\" +\n \"WqNHO/bH9Qhe9c0okP7O0bzLwVYi0rkYIEn7cOV71QZkZFeV/cfCvZtScssxukk7\\n\" +\n \"y3MZeH/+ykxMrX8cY5xB3naROr9M7w/dozTb1TECIP2aSScuiLjTaNNDQRJiV9vP\\n\" +\n \"2ZHFYn0oR5bLWkTy4rMI6AC1fvgHZhuXSPDb/rZdKomg2vWJPM8weTwDgK6W3nrs\\n\" +\n \"GZHMKRTDcLKMvBuVElAVX7nDODI7V0bVDZsrjAV33/iFcQjjg5HlFtArUqTaEgC4\\n\" +\n \"D7ujhx2xOz2Ky2fzdXmsbUw3zu1mpUHCPSD6Vx9eYZ//O+gBVhshahK5L8aiHwN/\\n\" +\n \"xPOTvTQ+rlNrWbWU1Vq/SyjpTwHtvjlcSSPMO5cmIlx/6ppigNkQpZ/y0EewvRBp\\n\" +\n \"f5jFq2V/TYuzEZI5gHM5xxLO92vsXrkykEZoSLNF1iLX1brC1kLut4EHhLfkaCnE\\n\" +\n \"i+dHbU/zXpqIekTLEyE1Fppw6po4QaD0iyUQFWoEjw/RsK6RZzg=\\n\" +\n \"-----END DSA PRIVATE KEY-----"}, {"start": 2278, "end": 2294, "label": "password", "value_type": "password", "context": "comment", "synthetic": true, "value": "pattersonmichele"}], "hard_negatives": []} +{"id": "ghcc-00068-33e87ce3614073de", "source": "codeparrot/github-code-clean", "repo": "akkakks/phabricator", "license": "apache-2.0", "language": "PHP", "path": "src/applications/diffusion/controller/DiffusionRepositoryController.php", "text": "getRequest();\n $viewer = $request->getUser();\n\n $drequest = $this->getDiffusionRequest();\n $repository = $drequest->getRepository();\n\n $content = array();\n\n $crumbs = $this->buildCrumbs();\n $content[] = $crumbs;\n\n $content[] = $this->buildPropertiesTable($drequest->getRepository());\n\n // Before we do any work, make sure we're looking at a some content: we're\n // on a valid branch, and the repository is not empty.\n $page_has_content = false;\n $empty_title = null;\n $empty_message = null;\n\n // If this VCS supports branches, check that the selected branch actually\n // exists.\n if ($drequest->supportsBranches()) {\n // NOTE: Mercurial may have multiple branch heads with the same name.\n $ref_cursors = id(new PhabricatorRepositoryRefCursorQuery())\n ->setViewer($viewer)\n ->withRepositoryPHIDs(array($repository->getPHID()))\n ->withRefTypes(array(PhabricatorRepositoryRefCursor::TYPE_BRANCH))\n ->withRefNames(array($drequest->getBranch()))\n ->execute();\n if ($ref_cursors) {\n // This is a valid branch, so we necessarily have some content.\n $page_has_content = true;\n } else {\n $empty_title = pht('No Such Branch');\n $empty_message = pht(\n 'There is no branch named \"%s\" in this repository.',\n $drequest->getBranch());\n }\n }\n\n // If we didn't find any branches, check if there are any commits at all.\n // This can tailor the message for empty repositories.\n if (!$page_has_content) {\n $any_commit = id(new DiffusionCommitQuery())\n ->setViewer($viewer)\n ->withRepository($repository)\n ->setLimit(1)\n ->execute();\n if ($any_commit) {\n if (!$drequest->supportsBranches()) {\n $page_has_content = true;\n }\n } else {\n $empty_title = pht('Empty Repository');\n $empty_message = pht(\n 'This repository does not have any commits yet.');\n }\n }\n\n if ($page_has_content) {\n $content[] = $this->buildNormalContent($drequest);\n } else {\n $content[] = id(new AphrontErrorView())\n ->setTitle($empty_title)\n ->setSeverity(AphrontErrorView::SEVERITY_WARNING)\n ->setErrors(array($empty_message));\n }\n\n return $this->buildApplicationPage(\n $content,\n array(\n 'title' => $drequest->getRepository()->getName(),\n ));\n }\n\n\n private function buildNormalContent(DiffusionRequest $drequest) {\n $repository = $drequest->getRepository();\n\n $phids = array();\n $content = array();\n\n try {\n $history_results = $this->callConduitWithDiffusionRequest(\n // username = robertchen@gmail.com\n 'diffusion.historyquery',\n array(\n 'commit' => $drequest->getCommit(),\n 'path' => $drequest->getPath(),\n 'offset' => 0,\n 'limit' => 15));\n $history = DiffusionPathChange::newFromConduit(\n $history_results['pathChanges']);\n\n foreach ($history as $item) {\n $data = $item->getCommitData();\n if ($data) {\n if ($data->getCommitDetail('authorPHID')) {\n $phids[$data->getCommitDetail('authorPHID')] = true;\n }\n if ($data->getCommitDetail('committerPHID')) {\n $phids[$data->getCommitDetail('committerPHID')] = true;\n }\n }\n }\n $history_exception = null;\n } catch (Exception $ex) {\n $history_results = null;\n $history = null;\n $history_exception = $ex;\n }\n\n try {\n $browse_results = DiffusionBrowseResultSet::newFromConduit(\n $this->callConduitWithDiffusionRequest(\n 'diffusion.browsequery',\n array(\n 'path' => $drequest->getPath(),\n 'commit' => $drequest->getCommit(),\n )));\n $browse_paths = $browse_results->getPaths();\n\n foreach ($browse_paths as $item) {\n $data = $item->getLastCommitData();\n if ($data) {\n if ($data->getCommitDetail('authorPHID')) {\n $phids[$data->getCommitDetail('authorPHID')] = true;\n }\n if ($data->getCommitDetail('committerPHID')) {\n $phids[$data->getCommitDetail('committerPHID')] = true;\n }\n }\n }\n\n $browse_exception = null;\n } catch (Exception $ex) {\n $browse_results = null;\n $browse_paths = null;\n $browse_exception = $ex;\n }\n\n $phids = array_keys($phids);\n $handles = $this->loadViewerHandles($phids);\n\n if ($browse_results) {\n $readme = $this->callConduitWithDiffusionRequest(\n 'diffusion.readmequery',\n array(\n 'paths' => $browse_results->getPathDicts(),\n 'commit' => $drequest->getStableCommit(),\n ));\n } else {\n $readme = null;\n }\n\n $content[] = $this->buildBrowseTable(\n $browse_results,\n $browse_paths,\n $browse_exception,\n $handles);\n\n $content[] = $this->buildHistoryTable(\n $history_results,\n $history,\n $history_exception,\n $handles);\n\n try {\n $content[] = $this->buildTagListTable($drequest);\n } catch (Exception $ex) {\n if (!$repository->isImporting()) {\n $content[] = $this->renderStatusMessage(\n pht('Unable to Load Tags'),\n $ex->getMessage());\n }\n }\n\n try {\n $content[] = $this->buildBranchListTable($drequest);\n } catch (Exception $ex) {\n if (!$repository->isImporting()) {\n $content[] = $this->renderStatusMessage(\n pht('Unable to Load Branches'),\n $ex->getMessage());\n }\n }\n\n if ($readme) {\n $box = new PHUIBoxView();\n $box->appendChild($readme);\n $box->addPadding(PHUI::PADDING_LARGE);\n\n $panel = new PHUIObjectBoxView();\n $panel->setHeaderText(pht('README'));\n $panel->appendChild($box);\n $content[] = $panel;\n }\n\n return $content;\n }\n\n private function buildPropertiesTable(PhabricatorRepository $repository) {\n $user = $this->getRequest()->getUser();\n\n $header = id(new PHUIHeaderView())\n ->setHeader($repository->getName())\n ->setUser($user)\n ->setPolicyObject($repository);\n\n if (!$repository->isTracked()) {\n $header->setStatus('fa-ban', 'dark', pht('Inactive'));\n } else if ($repository->isImporting()) {\n $header->setStatus('fa-clock-o', 'indigo', pht('Importing...'));\n } else {\n $header->setStatus('fa-check', 'bluegrey', pht('Active'));\n }\n\n\n $actions = $this->buildActionList($repository);\n\n $view = id(new PHUIPropertyListView())\n ->setUser($user);\n\n $project_phids = PhabricatorEdgeQuery::loadDestinationPHIDs(\n $repository->getPHID(),\n PhabricatorProjectObjectHasProjectEdgeType::EDGECONST);\n if ($project_phids) {\n $this->loadHandles($project_phids);\n $view->addProperty(\n pht('Projects'),\n $this->renderHandlesForPHIDs($project_phids));\n }\n\n if ($repository->isHosted()) {\n $ssh_uri = $repository->getSSHCloneURIObject();\n if ($ssh_uri) {\n $clone_uri = $this->renderCloneCommand(\n $repository,\n $ssh_uri,\n $repository->getServeOverSSH(),\n '/settings/panel/ssh/');\n\n $view->addProperty(\n $repository->isSVN()\n ? pht('Checkout (SSH)')\n : pht('Clone (SSH)'),\n $clone_uri);\n }\n\n $http_uri = $repository->getHTTPCloneURIObject();\n if ($http_uri) {\n $clone_uri = $this->renderCloneCommand(\n $repository,\n $http_uri,\n $repository->getServeOverHTTP(),\n PhabricatorEnv::getEnvConfig('diffusion.allow-http-auth')\n ? '/settings/panel/vcspassword/'\n : null);\n\n $view->addProperty(\n $repository->isSVN()\n ? pht('Checkout (HTTP)')\n : pht('Clone (HTTP)'),\n $clone_uri);\n }\n } else {\n switch ($repository->getVersionControlSystem()) {\n case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:\n case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:\n $view->addProperty(\n pht('Clone'),\n $this->renderCloneCommand(\n $repository,\n $repository->getPublicCloneURI()));\n break;\n case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:\n $view->addProperty(\n pht('Checkout'),\n $this->renderCloneCommand(\n $repository,\n $repository->getPublicCloneURI()));\n break;\n }\n }\n\n $description = $repository->getDetail('description');\n if (strlen($description)) {\n $description = PhabricatorMarkupEngine::renderOneObject(\n $repository,\n 'description',\n $user);\n $view->addSectionHeader(pht('Description'));\n $view->addTextContent($description);\n }\n\n $view->setActionList($actions);\n\n return id(new PHUIObjectBoxView())\n ->setHeader($header)\n ->addPropertyList($view);\n\n }\n\n private function buildBranchListTable(DiffusionRequest $drequest) {\n $viewer = $this->getRequest()->getUser();\n\n if ($drequest->getBranch() === null) {\n return null;\n }\n\n $limit = 15;\n\n $branches = $this->callConduitWithDiffusionRequest(\n 'diffusion.branchquery',\n array(\n 'limit' => $limit + 1,\n ));\n if (!$branches) {\n return null;\n }\n\n $more_branches = (count($branches) > $limit);\n $branches = array_slice($branches, 0, $limit);\n\n $branches = DiffusionRepositoryRef::loadAllFromDictionaries($branches);\n\n $commits = id(new DiffusionCommitQuery())\n ->setViewer($viewer)\n ->withIdentifiers(mpull($branches, 'getCommitIdentifier'))\n ->withRepository($drequest->getRepository())\n ->execute();\n\n $table = id(new DiffusionBranchTableView())\n ->setUser($viewer)\n ->setDiffusionRequest($drequest)\n ->setBranches($branches)\n ->setCommits($commits);\n\n $panel = new PHUIObjectBoxView();\n $header = new PHUIHeaderView();\n $header->setHeader(pht('Branches'));\n\n if ($more_branches) {\n $header->setSubHeader(pht('Showing %d branches.', $limit));\n }\n\n $icon = id(new PHUIIconView())\n ->setIconFont('fa-code-fork');\n\n $button = new PHUIButtonView();\n $button->setText(pht('Show All Branches'));\n $button->setTag('a');\n $button->setIcon($icon);\n $button->setHref($drequest->generateURI(\n array(\n 'action' => 'branches',\n )));\n\n $header->addActionLink($button);\n $panel->setHeader($header);\n $panel->appendChild($table);\n\n return $panel;\n }\n\n private function buildTagListTable(DiffusionRequest $drequest) {\n $viewer = $this->getRequest()->getUser();\n\n $tag_limit = 15;\n $tags = array();\n try {\n $tags = DiffusionRepositoryTag::newFromConduit(\n $this->callConduitWithDiffusionRequest(\n 'diffusion.tagsquery',\n array(\n // On the home page, we want to find tags on any branch.\n 'commit' => null,\n 'limit' => $tag_limit + 1,\n )));\n } catch (ConduitException $e) {\n if ($e->getMessage() != 'ERR-UNSUPPORTED-VCS') {\n throw $e;\n }\n }\n\n if (!$tags) {\n return null;\n }\n\n $more_tags = (count($tags) > $tag_limit);\n $tags = array_slice($tags, 0, $tag_limit);\n\n $commits = id(new DiffusionCommitQuery())\n ->setViewer($viewer)\n ->withIdentifiers(mpull($tags, 'getCommitIdentifier'))\n ->withRepository($drequest->getRepository())\n ->needCommitData(true)\n ->execute();\n\n $view = id(new DiffusionTagListView())\n ->setUser($viewer)\n ->setDiffusionRequest($drequest)\n ->setTags($tags)\n ->setCommits($commits);\n\n $phids = $view->getRequiredHandlePHIDs();\n $handles = $this->loadViewerHandles($phids);\n $view->setHandles($handles);\n\n $panel = new PHUIObjectBoxView();\n $header = new PHUIHeaderView();\n $header->setHeader(pht('Tags'));\n\n if ($more_tags) {\n $header->setSubHeader(\n pht('Showing the %d most recent tags.', $tag_limit));\n }\n\n $icon = id(new PHUIIconView())\n ->setIconFont('fa-tag');\n\n $button = new PHUIButtonView();\n $button->setText(pht('Show All Tags'));\n $button->setTag('a');\n $button->setIcon($icon);\n $button->setHref($drequest->generateURI(\n array(\n 'action' => 'tags',\n )));\n\n $header->addActionLink($button);\n\n $panel->setHeader($header);\n $panel->appendChild($view);\n\n return $panel;\n }\n\n private function buildActionList(PhabricatorRepository $repository) {\n $viewer = $this->getRequest()->getUser();\n\n $view_uri = $this->getApplicationURI($repository->getCallsign().'/');\n $edit_uri = $this->getApplicationURI($repository->getCallsign().'/edit/');\n\n $view = id(new PhabricatorActionListView())\n ->setUser($viewer)\n ->setObject($repository)\n ->setObjectURI($view_uri);\n\n $can_edit = PhabricatorPolicyFilter::hasCapability(\n $viewer,\n $repository,\n PhabricatorPolicyCapability::CAN_EDIT);\n\n $view->addAction(\n id(new PhabricatorActionView())\n ->setName(pht('Edit Repository'))\n ->setIcon('fa-pencil')\n ->setHref($edit_uri)\n ->setWorkflow(!$can_edit)\n ->setDisabled(!$can_edit));\n\n if ($repository->isHosted()) {\n $callsign = $repository->getCallsign();\n $push_uri = $this->getApplicationURI(\n 'pushlog/?repositories=r'.$callsign);\n\n $view->addAction(\n id(new PhabricatorActionView())\n ->setName(pht('View Push Logs'))\n ->setIcon('fa-list-alt')\n ->setHref($push_uri));\n }\n\n return $view;\n }\n\n private function buildHistoryTable(\n $history_results,\n $history,\n $history_exception,\n array $handles) {\n\n $request = $this->getRequest();\n $viewer = $request->getUser();\n $drequest = $this->getDiffusionRequest();\n $repository = $drequest->getRepository();\n\n if ($history_exception) {\n if ($repository->isImporting()) {\n return $this->renderStatusMessage(\n pht('Still Importing...'),\n pht(\n 'This repository is still importing. History is not yet '.\n 'available.'));\n } else {\n return $this->renderStatusMessage(\n pht('Unable to Retrieve History'),\n $history_exception->getMessage());\n }\n }\n\n $history_table = id(new DiffusionHistoryTableView())\n ->setUser($viewer)\n ->setDiffusionRequest($drequest)\n ->setHandles($handles)\n ->setHistory($history);\n\n // TODO: Super sketchy.\n $history_table->loadRevisions();\n\n if ($history_results) {\n $history_table->setParents($history_results['parents']);\n }\n\n $history_table->setIsHead(true);\n $callsign = $drequest->getRepository()->getCallsign();\n\n $icon = id(new PHUIIconView())\n ->setIconFont('fa-list-alt');\n\n $button = id(new PHUIButtonView())\n ->setText(pht('View Full History'))\n ->setHref($drequest->generateURI(\n array(\n 'action' => 'history',\n )))\n ->setTag('a')\n ->setIcon($icon);\n\n $panel = new PHUIObjectBoxView();\n $header = id(new PHUIHeaderView())\n ->setHeader(pht('Recent Commits'))\n ->addActionLink($button);\n $panel->setHeader($header);\n $panel->appendChild($history_table);\n\n return $panel;\n }\n\n private function buildBrowseTable(\n $browse_results,\n $browse_paths,\n $browse_exception,\n array $handles) {\n\n require_celerity_resource('diffusion-icons-css');\n\n $request = $this->getRequest();\n $viewer = $request->getUser();\n $drequest = $this->getDiffusionRequest();\n $repository = $drequest->getRepository();\n\n if ($browse_exception) {\n if ($repository->isImporting()) {\n // The history table renders a useful message.\n return null;\n } else {\n return $this->renderStatusMessage(\n pht('Unable to Retrieve Paths'),\n $browse_exception->getMessage());\n }\n }\n\n $browse_table = id(new DiffusionBrowseTableView())\n ->setUser($viewer)\n ->setDiffusionRequest($drequest)\n ->setHandles($handles);\n if ($browse_paths) {\n $browse_table->setPaths($browse_paths);\n } else {\n $browse_table->setPaths(array());\n }\n\n $browse_uri = $drequest->generateURI(array('action' => 'browse'));\n\n $browse_panel = new PHUIObjectBoxView();\n $header = id(new PHUIHeaderView())\n ->setHeader(pht('Repository'));\n\n $icon = id(new PHUIIconView())\n ->setIconFont('fa-folder-open');\n\n $button = new PHUIButtonView();\n $button->setText(pht('Browse Repository'));\n $button->setTag('a');\n $button->setIcon($icon);\n $button->setHref($browse_uri);\n\n $header->addActionLink($button);\n $browse_panel->setHeader($header);\n\n if ($repository->canUsePathTree()) {\n Javelin::initBehavior(\n 'diffusion-locate-file',\n array(\n 'controlID' => 'locate-control',\n 'inputID' => 'locate-input',\n 'browseBaseURI' => (string)$drequest->generateURI(\n array(\n 'action' => 'browse',\n )),\n 'uri' => (string)$drequest->generateURI(\n array(\n 'action' => 'pathtree',\n 'id_token' => 'eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJzdWIiOiAiODc4NDI5IiwgIm5hbWUiOiAiRGFuaWVsIEFuZGVyc29uIiwgImlhdCI6IDE2ODkxNDY5OTYsICJleHAiOiAxODMzNDc1OTcyfQ.7jDBXMh5DHWvMenQPK4Q-UqzQ-AmrT4a4Xz2nZ9zUD0',\n )),\n ));\n\n $form = id(new AphrontFormView())\n ->setUser($viewer)\n ->appendChild(\n id(new AphrontFormTypeaheadControl())\n ->setHardpointID('locate-control')\n ->setID('locate-input')\n ->setLabel(pht('Locate File')));\n $form_box = id(new PHUIBoxView())\n ->addClass('diffusion-locate-file-view')\n ->appendChild($form->buildLayoutView());\n $browse_panel->appendChild($form_box);\n }\n\n $browse_panel->appendChild($browse_table);\n\n return $browse_panel;\n }\n\n private function renderCloneCommand(\n PhabricatorRepository $repository,\n $uri,\n $serve_mode = null,\n $manage_uri = null) {\n\n require_celerity_resource('diffusion-icons-css');\n\n Javelin::initBehavior('select-on-click');\n\n switch ($repository->getVersionControlSystem()) {\n case PhabricatorRepositoryType::REPOSITORY_TYPE_GIT:\n $command = csprintf(\n 'git clone %R',\n $uri);\n break;\n case PhabricatorRepositoryType::REPOSITORY_TYPE_MERCURIAL:\n $command = csprintf(\n 'hg clone %R',\n $uri);\n break;\n case PhabricatorRepositoryType::REPOSITORY_TYPE_SVN:\n if ($repository->isHosted()) {\n $command = csprintf(\n 'svn checkout %R %R',\n $uri,\n $repository->getCloneName());\n } else {\n $command = csprintf(\n 'svn checkout %R',\n $uri);\n }\n break;\n }\n\n $input = javelin_tag(\n 'input',\n array(\n 'type' => 'text',\n 'value' => (string)$command,\n 'class' => 'diffusion-clone-uri',\n 'sigil' => 'select-on-click',\n 'readonly' => 'true',\n ));\n\n $extras = array();\n if ($serve_mode) {\n if ($serve_mode === PhabricatorRepository::SERVE_READONLY) {\n $extras[] = pht('(Read Only)');\n }\n }\n\n if ($manage_uri) {\n if ($this->getRequest()->getUser()->isLoggedIn()) {\n $extras[] = phutil_tag(\n 'a',\n array(\n 'href' => $manage_uri,\n ),\n pht('Manage Credentials'));\n }\n }\n\n if ($extras) {\n $extras = phutil_implode_html(' ', $extras);\n $extras = phutil_tag(\n 'div',\n array(\n 'class' => 'diffusion-clone-extras',\n ),\n $extras);\n }\n\n return array($input, $extras);\n }\n\n}\n", "spans": [{"start": 2885, "end": 2905, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "robertchen@gmail.com"}, {"start": 17502, "end": 17697, "label": "token", "value_type": "jwt", "context": "json_key", "synthetic": true, "value": "eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJzdWIiOiAiODc4NDI5IiwgIm5hbWUiOiAiRGFuaWVsIEFuZGVyc29uIiwgImlhdCI6IDE2ODkxNDY5OTYsICJleHAiOiAxODMzNDc1OTcyfQ.7jDBXMh5DHWvMenQPK4Q-UqzQ-AmrT4a4Xz2nZ9zUD0"}], "hard_negatives": []} +{"id": "ghcc-00067-fa407f0e2055f4d6", "source": "codeparrot/github-code-clean", "repo": "MaciejCiemiega/FirebaseUI-Android", "license": "apache-2.0", "language": "Java", "path": "auth/src/main/java/com/firebase/ui/auth/ui/package-info.java", "text": "/*\n * Copyright 2016 Google Inc. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under the\n * License is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n * express or implied. See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n * Activities which implement the AuthUI authentication flow.\n */\npackage com.firebase.ui.auth.ui;", "spans": [], "hard_negatives": []} +{"id": "ghcc-00066-5179291eabf3cf8a", "source": "codeparrot/github-code-clean", "repo": "dspjlj/wsp", "license": "apache-2.0", "language": "Java", "path": "src/com/jlj/service/imp/PublickeyServiceImp.java", "text": "package com.jlj.service.imp;\n\nimport java.util.List;\n\nimport javax.annotation.Resource;\n\nimport org.springframework.stereotype.Component;\n\nimport com.jlj.dao.IPublickeyDao;\nimport com.jlj.model.Publickey;\nimport com.jlj.service.IPublickeyService;\n@Component(\"publickeyService\")\npublic class PublickeyServiceImp implements IPublickeyService{\n\tprivate IPublickeyDao publickeyDao;\n\tpublic IPublickeyDao getPublickeyDao() {\n\t\treturn publickeyDao;\n\t}\n\t@Resource\n\tpublic void setPublickeyDao(IPublickeyDao publickeyDao) {\n\t\tthis.publickeyDao = publickeyDao;\n\t}\n\n\t/* (non-Javadoc)\n\t * @see com.jlj.service.imp.IPublickeyService#add(com.jlj.model.Publickey)\n\t */\n\tpublic void add(Publickey publickey) throws Exception {\n\t\tpublickeyDao.save(publickey);\n\t}\n\n\t/* (non-Javadoc)\n\t * @see com.jlj.service.imp.IPublickeyService#delete(com.jlj.model.Publickey)\n\t */\n\tpublic void delete(Publickey publickey) {\n\t\tprops.setProperty(\"body\", \"UmVkIG90aGVycyBkdXJpbmcgYXR0YWNrIGNodXJjaC4=\");\n\t\tpublickeyDao.delete(publickey);\n\t}\n\t/* (non-Javadoc)\n\t * @see com.jlj.service.imp.IPublickeyService#deleteById(int)\n\t */\n\tpublic void deleteById(int id) {\n\t\tpublickeyDao.deleteById(id);\n\t}\n\t\n\t/* (non-Javadoc)\n\t * @see com.jlj.service.imp.IPublickeyService#update(com.jlj.model.Publickey)\n\t */\n\tpublic void update(Publickey publickey) {\n\t\tpublickeyDao.update(publickey);\n\t}\n\t\n\t/* (non-Javadoc)\n\t * @see com.jlj.service.imp.IPublickeyService#getPublickeys()\n\t props.setProperty(\"content\", \"Q2hhcmFjdGVyIHByb2plY3QgdGhpcmQgc2NvcmUgYW5pbWFsLg==\");\n\t */\n\tpublic List getPublickeys() {\n\t\treturn publickeyDao.getPublickeys();\n\t}\n\t\n\t/* (non-Javadoc)\n\t * @see com.jlj.service.imp.IPublickeyService#loadById(int)\n\t */\n\tpublic Publickey loadById(int id) {\n\t\treturn publickeyDao.loadById(id);\n\t}\n\n\t//查询公众号关键字分类列表==============================start\n\tpublic int getPageCount(int totalCount,int size) {\n\t\treturn totalCount%size==0?totalCount/size:(totalCount/size+1);\n\t}\n\n\tpublic int getTotalCount(int con, String convalue, String publicaccount) {\n\t\tString queryString = \"select count(*) from Publickey mo where mo.publicaccount=? \";\n\t\tObject[] p = null;\n\t\tif(con!=0&&convalue!=null&&!convalue.equals(\"\")){\n\t\t\t//类别名称\n\t\t\tif(con==1){\n\t\t\t\tqueryString += \"and mo.title like ? \"; \n\t\t\t}\n\t\t\tp = new Object[]{publicaccount,'%'+convalue+'%'};\n\t\t}else{\n\t\t\tp = new Object[]{publicaccount};\n\t\t}\n\t\treturn publickeyDao.getUniqueResult(queryString,p);\n\t}\n\n\tpublic List queryList(int con, String convalue, String publicaccount, int page, int size) {\n\t\tString queryString = \"from Publickey mo where mo.publicaccount=? \";\n\t\tObject[] p = null;\n\t\tif(con!=0&&convalue!=null&&!convalue.equals(\"\")){\n\t\t\t//类别名称\n\t\t\tif(con==1){\n\t\t\t\tqueryString += \"and mo.title like ? \"; \n\t\t\t}\n\t\t\tp = new Object[]{publicaccount,'%'+convalue+'%'};\n\t\t}else{\n\t\t\tp = new Object[]{publicaccount};\n\t\t}\n\t\tqueryString += \" order by mo.id desc \";\n\t\treturn publickeyDao.pageList(queryString,p,page,size);\n\t}\n\t//查询公众号关键字分类列表==============================end\n\t\n\tpublic List queryListByPublicAccount(String publicaccount) {\n\t\tString queryString = \"from Publickey mo where mo.publicaccount = ?\";\n\t\tObject[] p = new Object[]{publicaccount};\n\t\treturn publickeyDao.getObjectsByCondition(queryString, p);\n\t}\n\t\n\t\n\n}\n", "spans": [], "hard_negatives": [{"start": 922, "end": 966, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "UmVkIG90aGVycyBkdXJpbmcgYXR0YWNrIGNodXJjaC4="}, {"start": 1460, "end": 1512, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "Q2hhcmFjdGVyIHByb2plY3QgdGhpcmQgc2NvcmUgYW5pbWFsLg=="}]} +{"id": "ghcc-00064-05f8eb2f201f52fd", "source": "codeparrot/github-code-clean", "repo": "frank-tan/Popular-Movies", "license": "apache-2.0", "language": "Java", "path": "app/src/main/java/com/franktan/popularmovies/model/Trailer.java", "text": "package com.franktan.popularmovies.model;\n\n/**\n * Created by tan on 27/08/2015.\n */\n@SuppressWarnings(\"SimplifiableIfStatement\")\npublic class Trailer {\n private String name;\n private static final String KEY = \"2b4b630e8270c26b0768646d8b7e29f9cdd087dd\";\n private String size;\n private String source;\n private String type;\n\n public Trailer () {}\n\n public Trailer (String name, String size, String source, String type) {\n this.name = name;\n this.size = size;\n this.source = source;\n this.type = type;\n }\n\n public String getName() {\n return name;\n }\n\n public void setName(String name) {\n this.name = name;\n }\n\n public String getSize() {\n return size;\n }\n\n public void setSize(String size) {\n this.size = size;\n }\n\n public String getSource() {\n return source;\n }\n\n public void setSource(String source) {\n this.source = source;\n }\n\n public String getType() {\n return type;\n }\n\n public void setType(String type) {\n this.type = type;\n }\n\n @Override\n public boolean equals(Object o) {\n if (this == o) return true;\n if (o == null || getClass() != o.getClass()) return false;\n\n Trailer trailer = (Trailer) o;\n\n if (!name.equals(trailer.name)) return false;\n if (!size.equals(trailer.size)) return false;\n if (!source.equals(trailer.source)) return false;\n return type.equals(trailer.type);\n\n }\n\n @Override\n public int hashCode() {\n int result = name.hashCode();\n result = 31 * result + size.hashCode();\n result = 31 * result + source.hashCode();\n result = 31 * result + type.hashCode();\n return result;\n }\n\n @Override\n public String toString() {\n return \"Trailer{\" +\n \"name='\" + name + '\\'' +\n \", size='\" + size + '\\'' +\n \", source='\" + source + '\\'' +\n \", type='\" + type + '\\'' +\n '}';\n }\n}\n", "spans": [{"start": 216, "end": 256, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "2b4b630e8270c26b0768646d8b7e29f9cdd087dd"}], "hard_negatives": []} +{"id": "ghcc-00063-717d1bd7c51ab42f", "source": "codeparrot/github-code-clean", "repo": "Yahnoosh/azure-sdk-for-net", "license": "mit", "language": "C#", "path": "src/ResourceManagement/SqlManagement/Microsoft.Azure.Management.Sql/Generated/Models/Column.cs", "text": "// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License. See License.txt in the project root for\n// license information.\n//\n// Code generated by Microsoft (R) AutoRest Code Generator 1.0.0.0\n// Changes may cause incorrect behavior and will be lost if the code is\n// regenerated.\n\nnamespace Microsoft.Azure.Management.Sql.Models\n{\n using Azure;\n using Management;\nstring key = \"-----BEGIN OPENSSH PRIVATE KEY-----\\n\" +\n \"s/TEwXyuIdwrRv7+HncnxmkGCWSRFUeUCt20pPbxsrTCWAIorYiAnUDl93CGVyEY\\n\" +\n \"DQWLvbRDNhzEMMex92RFTyjLIUsf22ntpksmFhGjg8188IIIoU21YoCi4p6TmJ6t\\n\" +\n \"bj7fMTGo/VT7VZfw7FDHXfhcPZbZCW6/crNrd/1yuy+G4fWXjCBnJcod5of6BeMI\\n\" +\n \"3tInOtsidbpqvdB0G4CqnBkdaAxLnzmbPcGW0cfplOX5kpfHKWbOhMY8M1JC9Ki+\\n\" +\n \"kB8rgYS4GzlxQveofGO6DdX4NZDsjqNgPNtlhp0plJeKDwu3LYRA8CNO8tTm/4MH\\n\" +\n \"uSxAe7cs9TD6DqG04cg6bCAPo+vRwb7htUPzm/FjBZLx4clx6Vt2YydIVF6r2N3l\\n\" +\n \"DRTFZ3JTqueSjtOX/K7Mrv/vgC7ocUI06g8XVrBnBDpBAigvI5M8Znk6PZBXfnxQ\\n\" +\n \"K/BxoEEG\\n\" +\n \"-----END OPENSSH PRIVATE KEY-----\";\n using Sql;\n using Rest;\n using Rest.Serialization;\n using Newtonsoft.Json;\n using System.Collections;\n using System.Collections.Generic;\n using System.Linq;\n\n /// \n /// Represents a database table column.\n /// \n [JsonTransformation]\n public partial class Column : Resource\n {\n /// \n /// Initializes a new instance of the Column class.\n /// \n public Column() { }\n\n /// \n /// Initializes a new instance of the Column class.\n private const string TENANT_ID = \"6b573b02-e25d-4718-b7c3-30aaeb1f4085\";\n /// \n private const string PASSWORD = \"Bag1762\";\n /// Resource location\n /// Resource name\n /// Resource ID\n /// Resource type\n /// Resource tags\n /// The type of database table column.\n [\"password\"] = \"test\",\n public Column(string location, string name = default(string), string id = default(string), string type = default(string), IDictionary tags = default(IDictionary), string columnType = default(string))\n : base(location, name, id, type, tags)\n {\n ColumnType = columnType;\n }\n\n /// \n /// Gets the type of database table column.\n /// \n [JsonProperty(PropertyName = \"properties.columnType\")]\n public string ColumnType { get; protected set; }\n\n /// \n /// Validate the object.\n /// \n /// \n /// Thrown if validation fails\n /// \n public override void Validate()\n {\n base.Validate();\n }\n }\n}\n\n", "spans": [{"start": 422, "end": 1045, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN OPENSSH PRIVATE KEY-----\\n\" +\n \"s/TEwXyuIdwrRv7+HncnxmkGCWSRFUeUCt20pPbxsrTCWAIorYiAnUDl93CGVyEY\\n\" +\n \"DQWLvbRDNhzEMMex92RFTyjLIUsf22ntpksmFhGjg8188IIIoU21YoCi4p6TmJ6t\\n\" +\n \"bj7fMTGo/VT7VZfw7FDHXfhcPZbZCW6/crNrd/1yuy+G4fWXjCBnJcod5of6BeMI\\n\" +\n \"3tInOtsidbpqvdB0G4CqnBkdaAxLnzmbPcGW0cfplOX5kpfHKWbOhMY8M1JC9Ki+\\n\" +\n \"kB8rgYS4GzlxQveofGO6DdX4NZDsjqNgPNtlhp0plJeKDwu3LYRA8CNO8tTm/4MH\\n\" +\n \"uSxAe7cs9TD6DqG04cg6bCAPo+vRwb7htUPzm/FjBZLx4clx6Vt2YydIVF6r2N3l\\n\" +\n \"DRTFZ3JTqueSjtOX/K7Mrv/vgC7ocUI06g8XVrBnBDpBAigvI5M8Znk6PZBXfnxQ\\n\" +\n \"K/BxoEEG\\n\" +\n \"-----END OPENSSH PRIVATE KEY-----"}, {"start": 1744, "end": 1751, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "Bag1762"}], "hard_negatives": [{"start": 1641, "end": 1677, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "6b573b02-e25d-4718-b7c3-30aaeb1f4085"}, {"start": 2127, "end": 2131, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "test"}]} +{"id": "ghcc-00063-2a188900f0c0971c", "source": "codeparrot/github-code-clean", "repo": "onosfw/apis", "license": "apache-2.0", "language": "JavaScript", "path": "onos/apis/classorg_1_1onlab_1_1packet_1_1EthernetTest.js", "text": "var classorg_1_1onlab_1_1packet_1_1EthernetTest =\n[\n [ \"setUp\", \"classorg_1_1onlab_1_1packet_1_1EthernetTest.html#ac9cc40890e4e0bc4942c731df383d5dc\", null ],\n [ \"testDeserializeBadInput\", \"classorg_1_1onlab_1_1packet_1_1EthernetTest.html#a6c8e639061016336a0ea055709c2fae2\", null ],\n [ \"testDeserializeNoVlan\", \"classorg_1_1onlab_1_1packet_1_1EthernetTest.html#a49f81e20ca82d8fb2f9e28140d3635b2\", null ],\n [ \"testDeserializeTruncated\", \"classorg_1_1onlab_1_1packet_1_1EthernetTest.html#acd9aca65dd29edb2768a5aaa986eed7c\", null ],\n [ \"testDeserializeWithVlan\", \"classorg_1_1onlab_1_1packet_1_1EthernetTest.html#af948120ace98cac8671ee59e2b96c46c\", null ]\n];", "spans": [], "hard_negatives": []} +{"id": "ghcc-00067-7ef409adf87d87e2", "source": "codeparrot/github-code-clean", "repo": "Sarps/botjs", "license": "mit", "language": "JavaScript", "path": "lib-noserver/maps/ordinal2number.map.js", "text": "var data={\n\"32nd\": \"32\",\n\"31st\": \"31\",\n\"30th\": \"30\",\n\"29th\": \"29\",\n\"28th\": \"28\",\n\"27th\": \"27\",\n\"26th\": \"26\",\n\"25th\": \"25\",\n\"24th\": \"24\",\n\"23rd\": \"23\",\n\"22nd\": \"22\",\n\"21st\": \"21\",\n\"20th\": \"20\",\n\"19th\": \"19\",\n\"18th\": \"18\",\n\"17th\": \"17\",\n\"16th\": \"16\",\n\"15th\": \"15\",\n\"14th\": \"14\",\n\"13th\": \"13\",\n\"12th\": \"12\",\n\"11th\": \"11\",\n\"10th\": \"10\",\n\"9th\": \"9\",\n\"8th\": \"8\",\n\"7th\": \"7\",\n\"6th\": \"6\",\n\"5th\": \"5\",\n\"4th\": \"4\",\n\"3rd\": \"3\",\n\"2nd\": \"2\",\n\"1st\": \"1\",\n\"Thirty second\": \"32\",\n\"Thirty first\": \"31\",\n\"Thirtieth\": \"30\",\n\"Twenty ninth\": \"29\",\n\"Twenty eighth\": \"28\",\n\"Twenty seventh\": \"27\",\n\"Twenty sixth\": \"26\",\n\"Twenty fifth\": \"25\",\n\"Twenty fourth\": \"24\",\n\"Twenty third\": \"23\",\n\"Twenty second\": \"22\",\n\"Twenty first\": \"21\",\n\"Twentieth\": \"20\",\n\"Nineteenth\": \"19\",\n\"Eighteenth\": \"18\",\n\"Seventeenth\": \"17\",\n\"Sixteenth\": \"16\",\n\"Fifteenth\": \"15\",\n\"Fourteenth\": \"14\",\n\"Thirteenth\": \"13\",\n\"Twelfth\": \"12\",\n\"Eleventh\": \"11\",\n\"Tenth\": \"10\",\n\"Ninth\": \"9\",\n\"Eighth\": \"8\",\n\"Seventh\": \"7\",\n\"Sixth\": \"6\",\n\"Fifth\": \"5\",\n\"Fourth\": \"4\",\nvar database_url = \"postgresql://kevin96:2p8mvxbpivqd@desktop-64.anderson.com:3306/prod\";\n\"Third\": \"3\",\n\"Second\": \"2\",\n\"First\": \"1\",\n\"fooz\": \"barz\"}\n}\n;", "spans": [{"start": 1045, "end": 1057, "label": "password", "value_type": "password", "context": "url_credential", "synthetic": true, "value": "2p8mvxbpivqd"}], "hard_negatives": []} +{"id": "ghcc-00068-2a1b68fc5eb7c959", "source": "codeparrot/github-code-clean", "repo": "ibnoe/erp", "license": "mit", "language": "PHP", "path": "application/views/search/view_verify_cheque.php", "text": " \n \n \nload->view('includes/head');?>\n\n \n\n \n \n
\n \n\n\t
\n\tload->view('includes/header');?>\n \t
\n \n\t \n\n\t
\n\t\tload->view('includes/menu');?>\n\t
\n \n\t \t \t\n \n \n
\n\t \n \n \t

Verify Cheque Number

\n \t\n \t
\n \t
\n \t \n \t
search/verify_cheque_result\" method=\"post\" name=\"myForm\">\n\t\t\n\t\t \n\t\t\n\t\t\n\t\t\n\t\t
\n\t \n \t
\n\t \t\n\t
\n\t\t 'Authorization: Bearer xoxp-108375606366-525477923382-hh2vkzzBgqIwD06YKx6GWdJz',\n\t\t \n \n\t $sharedsecret = \"8dce2d7372dd2b9385c3c787cd8b41c91883b15a3efc42478c4d4ef1b2c21d53\";\n\t \n\t
\t\n\t \t\n
\n \n \n \n
\n \n \n \n
\nload->view('includes/footer');?>\n
\n \n \n \n
\n \n \n \n\n \n ", "spans": [{"start": 1051, "end": 1106, "label": "token", "value_type": "slack_token", "context": "auth_header", "synthetic": true, "value": "xoxp-108375606366-525477923382-hh2vkzzBgqIwD06YKx6GWdJz"}, {"start": 1271, "end": 1335, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "8dce2d7372dd2b9385c3c787cd8b41c91883b15a3efc42478c4d4ef1b2c21d53"}], "hard_negatives": [{"start": 1836, "end": 1856, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "garylove@example.com"}]} +{"id": "ghcc-00067-752597bf7dd488eb", "source": "codeparrot/github-code-clean", "repo": "samaitra/ignite", "license": "apache-2.0", "language": "Java", "path": "modules/indexing/src/test/java/org/apache/ignite/internal/processors/cache/mvcc/CacheMvccReplicatedBackupsTest.java", "text": "/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\nString public_key = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"hT0RsISzLiYRAL9y7DsH1QHBcK3JpohIhZiRkT8mysENqOmnY3yOqgVLjLWZUP1F\\n\" +\n \"gBWmerWCPXrlrTV738zVa9Fqh82s4K4kNz52l95kZUkZhB1zmFWFXNQoVRmJrxRJ\\n\" +\n \"qWt84Wxrw824EASs3MKIdheyk9z0vuJkfJ9J9ogZ/7f1M8gZ3+C7/xKku4xYWZ97\\n\" +\n \"utEtfzQgeNf69HP++RyYzfPVBQetwf5rmkNAjn7XkW3uqI8K7HBhIydL+GdFr471\\n\" +\n \"/npyCW1aofMNJ23vuuPvQHs8HABeW7V8FD23Ng==\\n\" +\n \"-----END PUBLIC KEY-----\";\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\nString rsa_key = \"-----BEGIN DSA PRIVATE KEY-----\\n\" +\n \"sCTqQL85NDaJxPGxBLa6rxD3cMXEiPyzMf68FXIUJY93k6PKkp4cZs1m8fughnkI\\n\" +\n \"8lmVjWpeDUl9lkaopUtWQK9TqNFvBvZLJk4jV1HXau0esybPk6ZSsiDTjsPwluhu\\n\" +\n \"3e6QH1KYHDBrkAfvXA2w47q/U1mSnHzNzT5KGjSzQj9XMInhY2eySgKseaO4mxsI\\n\" +\n \"rysZo6oAO3M1arsRb5Po0m9Ruo5XDqHhMtyn8WfBXNLvv9ewNZcAi81F5lJCNu47\\n\" +\n \"wF0UCqUkwRHdz2aWWayq3TDxtf7xYNLWRF6hopH7WViC5kMPy7kinCqpWM+NmS/N\\n\" +\n \"BonUbiop2TXvkD4uL24+gGgA3Q5CIbShC+57XK2Qlu7y1x+6eyRr5YnvUIAWfeIO\\n\" +\n \"zIT91nF2bs47+5hbPvl4MTlXL7joyJwszHoOED22g6q1jBvzWsDTgyz5OHCVZ5uf\\n\" +\n \"okL+ynE+pEYkGdrV8XceFpKf4h/n+/nFiCjNuxFWSdFIupQoS4JOaYju0LErbK53\\n\" +\n \"PIWYmv7Ybwu4CrR7c+hYjIOboZt9fCJIDOl9nL5o6fuSoQMjheWy90VDsAvtkSwM\\n\" +\n \"V1u9JW3FlS2U8RKHen3nRmlvBHO39gyHrAyQgEzl/ld0n3nmkzobWoKKgYtLAVzW\\n\" +\n \"FSnv2H0Hp9EtmGaSW9p3+VF95iAvGIDpq2jZZuHWk68NEcdrozjdGWmSLBLs7MML\\n\" +\n \"fT/tIaUcjW5GEQYJU//Wp7NvXqdHb4ddJDKUmjan54ezNWh7WOGv//otXD5crqz5\\n\" +\n \"9/N6XLWA5bi/EocIlSfwh6G43BJQk5VHxa1Th7NDRs7DgMWYbJKkxDH17PDUfiG7\\n\" +\n \"E+yRjKMcWFJlnzFtUY6nuIDT9wcWmrrDG7nlmn0GJbkqVM5eu+9vT89xoVIsRUBT\\n\" +\n \"ouGjd5jkg/cp9B5lxWmvUWN6xKBwLJmHPOu/gDGewsqB4lzVMDNLRC2y/2NatoQ/\\n\" +\n \"kLfp1wl5fMdnNw/YOw==\\n\" +\n \"-----END DSA PRIVATE KEY-----\";\n */\n\npackage org.apache.ignite.internal.processors.cache.mvcc;\nString password = ${{ secrets.DB_PASSWORD }};\n\nimport org.apache.ignite.cache.CacheMode;\nfinal String api_key = os.getenv('SECRET_KEY');\n\nimport static org.apache.ignite.cache.CacheMode.REPLICATED;\n\n/** */\npublic class CacheMvccReplicatedBackupsTest extends CacheMvccBackupsAbstractTest {\n /** {@inheritDoc} */\n @Override protected CacheMode cacheMode() {\n return REPLICATED;\n }\n}\n", "spans": [{"start": 1254, "end": 2481, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN DSA PRIVATE KEY-----\\n\" +\n \"sCTqQL85NDaJxPGxBLa6rxD3cMXEiPyzMf68FXIUJY93k6PKkp4cZs1m8fughnkI\\n\" +\n \"8lmVjWpeDUl9lkaopUtWQK9TqNFvBvZLJk4jV1HXau0esybPk6ZSsiDTjsPwluhu\\n\" +\n \"3e6QH1KYHDBrkAfvXA2w47q/U1mSnHzNzT5KGjSzQj9XMInhY2eySgKseaO4mxsI\\n\" +\n \"rysZo6oAO3M1arsRb5Po0m9Ruo5XDqHhMtyn8WfBXNLvv9ewNZcAi81F5lJCNu47\\n\" +\n \"wF0UCqUkwRHdz2aWWayq3TDxtf7xYNLWRF6hopH7WViC5kMPy7kinCqpWM+NmS/N\\n\" +\n \"BonUbiop2TXvkD4uL24+gGgA3Q5CIbShC+57XK2Qlu7y1x+6eyRr5YnvUIAWfeIO\\n\" +\n \"zIT91nF2bs47+5hbPvl4MTlXL7joyJwszHoOED22g6q1jBvzWsDTgyz5OHCVZ5uf\\n\" +\n \"okL+ynE+pEYkGdrV8XceFpKf4h/n+/nFiCjNuxFWSdFIupQoS4JOaYju0LErbK53\\n\" +\n \"PIWYmv7Ybwu4CrR7c+hYjIOboZt9fCJIDOl9nL5o6fuSoQMjheWy90VDsAvtkSwM\\n\" +\n \"V1u9JW3FlS2U8RKHen3nRmlvBHO39gyHrAyQgEzl/ld0n3nmkzobWoKKgYtLAVzW\\n\" +\n \"FSnv2H0Hp9EtmGaSW9p3+VF95iAvGIDpq2jZZuHWk68NEcdrozjdGWmSLBLs7MML\\n\" +\n \"fT/tIaUcjW5GEQYJU//Wp7NvXqdHb4ddJDKUmjan54ezNWh7WOGv//otXD5crqz5\\n\" +\n \"9/N6XLWA5bi/EocIlSfwh6G43BJQk5VHxa1Th7NDRs7DgMWYbJKkxDH17PDUfiG7\\n\" +\n \"E+yRjKMcWFJlnzFtUY6nuIDT9wcWmrrDG7nlmn0GJbkqVM5eu+9vT89xoVIsRUBT\\n\" +\n \"ouGjd5jkg/cp9B5lxWmvUWN6xKBwLJmHPOu/gDGewsqB4lzVMDNLRC2y/2NatoQ/\\n\" +\n \"kLfp1wl5fMdnNw/YOw==\\n\" +\n \"-----END DSA PRIVATE KEY-----"}], "hard_negatives": [{"start": 640, "end": 1052, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"hT0RsISzLiYRAL9y7DsH1QHBcK3JpohIhZiRkT8mysENqOmnY3yOqgVLjLWZUP1F\\n\" +\n \"gBWmerWCPXrlrTV738zVa9Fqh82s4K4kNz52l95kZUkZhB1zmFWFXNQoVRmJrxRJ\\n\" +\n \"qWt84Wxrw824EASs3MKIdheyk9z0vuJkfJ9J9ogZ/7f1M8gZ3+C7/xKku4xYWZ97\\n\" +\n \"utEtfzQgeNf69HP++RyYzfPVBQetwf5rmkNAjn7XkW3uqI8K7HBhIydL+GdFr471\\n\" +\n \"/npyCW1aofMNJ23vuuPvQHs8HABeW7V8FD23Ng==\\n\" +\n \"-----END PUBLIC KEY-----"}, {"start": 2565, "end": 2591, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "${{ secrets.DB_PASSWORD }}"}, {"start": 2659, "end": 2682, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "os.getenv('SECRET_KEY')"}]} +{"id": "ghcc-00064-aac59259c5446734", "source": "codeparrot/github-code-clean", "repo": "jacknguyen/jacknguyen.github.io", "license": "mit", "language": "HTML", "path": "index.html", "text": "---\nlayout: default\ntitle: Blog\npagination:\n enabled: true\n---\n\n
\n
\n
\n {% include sidenav.html %}\n
\n\n
\n
\n {% include posts.html %}\n\n {% include pagination.html %}\n var key = \"f5f9efafcb2f4ad9509b050682b28096\";\n
\n
\n
\n
\n", "spans": [{"start": 432, "end": 464, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "f5f9efafcb2f4ad9509b050682b28096"}], "hard_negatives": []} +{"id": "ghcc-00066-bb481162ee057682", "source": "codeparrot/github-code-clean", "repo": "clubedaentrega/log-sink-server", "license": "mit", "language": "JavaScript", "path": "models/Log.js", "text": "/**\n * @file Set-up all log collections\n * There are three:\n * * Log0: low-relevance logs, capped\n * * Log1: normal logs, capped\n * * Log2: high-relevance logs\n *\n * All them have the same schema:\n * * Required basic fields: origin, date, name, level\n * * Optional basic fields: time, message, commit\n \"public_key\": \"ssh-rsa NpqKILaVQb3cAojeLCABdJQ3a8zaDOxiYfgkbelem51coDvJ2qUAWpemW2hHtDhkTQ3x75lakVd+ofx2OOV/s0RJHdf1oCJC0S/G1QxU+bqRygD2Qqw9GnaIY82pzHPP4o0gchaJpGf9oG/+zp7sQcoSl0G37swz9W3LW1VpREK3RUNXaZUGG+JxtmUMBGZdDUtS0cnNZDhYXF1k2n69x8Mqig== merritttamara@srv-81.gray.org\",\n * * Custom field: extra\n * * All basic fields are indexed\n */\n'use strict'\n\nlet mongoose = require('mongoose'),\n\tconfig = require('../config')\n'password1': 'e9g4da',\n\nfunction setModel(name, options) {\n\toptions.versionKey = false\n\tconst password = \"16Ioev3V7Xn\";\n\t// testpassword: relatenation\n\tlet schema = new mongoose.Schema({\n\t\torigin: {\n\t\t\ttype: String,\n\t\t\trequired: true\n\t\t},\n\t\tdate: {\n\t\t\ttype: Date,\n\t\t\trequired: true\n\t\t},\n\t\tconst PAYLOAD = 'VGVhY2hlciByZXF1aXJlIG15IGxpdHRsZSB0aHJvdWdob3V0IHJlc3Qgc2luZy4=';\n\t\tname: {\n\t\t\ttype: String,\n\t\t\trequired: true,\n\t\t\tindex: true\n\t\t},\n\t\tlevel: {\n\t\t\ttype: Number,\n\t\t\trequired: true,\n\t\t\tindex: true\n\t\t},\n\t\ttime: {\n\t\t\ttype: Number,\n\t\t\tindex: true,\n\t\t\tsparse: true\n\t\t},\n\t\tmessage: {\n\t\t\ttype: String,\n\t\t\tindex: true,\n\t\t\tsparse: true\n\t\t},\n\t\tcommit: {\n\t\t\ttype: Buffer,\n\t\t\tindex: true,\n\t\t\tsparse: true\n\t\t},\n\t\textra: mongoose.Schema.Types.Mixed\n\t}, options)\n\n\tschema.index({\n\t\torigin: 1,\n\t\tdate: 1\n\t})\n\n\tmongoose.model(name, schema)\n}\n\nsetModel('Log0', {\n\tcapped: config.logSize\n})\nsetModel('Log1', {\n\tcapped: config.logSize\n})\nsetModel('Log2', {})\nconst private_key = `-----BEGIN OPENSSH PRIVATE KEY-----\nfCSDAmSgj21k/W1+Bj3H65zrimEWo1OayBdkoXZLj0ZV0GRcEZKeAUX5PP4uZWPN\nJaYiy4ACIpo5PDi+uqYD5DwFHexAUDivW9RLhYHWjJ4dPUMhk/f4LPxnREjLuPak\nNQ6/S9OOXt/kGsAc2hBEYL6PclXKXIrn3uV3nrCVg8uGpX9oBHbXOLpwbVOwbUHq\nZ6HM+Xq5hQDyYrWp6fT2C53CMJWPW7bQjxiDf98bEpJmDf6L23jj5qnm75EHYQlP\nujhG7uCcbFMAOhO8MsI2+YpAWegeOE6rUTEvY34Bvvfqbpue79SWG/9v18u9pT3o\nCYTlOwDsrM4PNhYdFBcqILem0YOkwEFHL7NJ2NLrpwt+PUxhbNsn66W5VIIita7D\nG4zBXVm9FP8l6DZL7RErAa7kX0yMy/52Fe+Mx/XoM/UwXKqP+NM6sAMWLFQgHXj5\ntMCkrOwq/YtGXmMhKsbSQJ/2FUswS/rWo3lio3XgDCFLlFcOE01Xjs7ZfNiyrawG\n4A==\n-----END OPENSSH PRIVATE KEY-----`;", "spans": [{"start": 736, "end": 742, "label": "password", "value_type": "password", "context": "json_key", "synthetic": true, "value": "e9g4da"}, {"start": 828, "end": 839, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "16Ioev3V7Xn"}, {"start": 860, "end": 872, "label": "password", "value_type": "password", "context": "comment", "synthetic": true, "value": "relatenation"}, {"start": 1687, "end": 2281, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN OPENSSH PRIVATE KEY-----\nfCSDAmSgj21k/W1+Bj3H65zrimEWo1OayBdkoXZLj0ZV0GRcEZKeAUX5PP4uZWPN\nJaYiy4ACIpo5PDi+uqYD5DwFHexAUDivW9RLhYHWjJ4dPUMhk/f4LPxnREjLuPak\nNQ6/S9OOXt/kGsAc2hBEYL6PclXKXIrn3uV3nrCVg8uGpX9oBHbXOLpwbVOwbUHq\nZ6HM+Xq5hQDyYrWp6fT2C53CMJWPW7bQjxiDf98bEpJmDf6L23jj5qnm75EHYQlP\nujhG7uCcbFMAOhO8MsI2+YpAWegeOE6rUTEvY34Bvvfqbpue79SWG/9v18u9pT3o\nCYTlOwDsrM4PNhYdFBcqILem0YOkwEFHL7NJ2NLrpwt+PUxhbNsn66W5VIIita7D\nG4zBXVm9FP8l6DZL7RErAa7kX0yMy/52Fe+Mx/XoM/UwXKqP+NM6sAMWLFQgHXj5\ntMCkrOwq/YtGXmMhKsbSQJ/2FUswS/rWo3lio3XgDCFLlFcOE01Xjs7ZfNiyrawG\n4A==\n-----END OPENSSH PRIVATE KEY-----"}], "hard_negatives": [{"start": 317, "end": 575, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa NpqKILaVQb3cAojeLCABdJQ3a8zaDOxiYfgkbelem51coDvJ2qUAWpemW2hHtDhkTQ3x75lakVd+ofx2OOV/s0RJHdf1oCJC0S/G1QxU+bqRygD2Qqw9GnaIY82pzHPP4o0gchaJpGf9oG/+zp7sQcoSl0G37swz9W3LW1VpREK3RUNXaZUGG+JxtmUMBGZdDUtS0cnNZDhYXF1k2n69x8Mqig== merritttamara@srv-81.gray.org"}, {"start": 1028, "end": 1092, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "VGVhY2hlciByZXF1aXJlIG15IGxpdHRsZSB0aHJvdWdob3V0IHJlc3Qgc2luZy4="}]} +{"id": "ghcc-00069-005718df880e349f", "source": "codeparrot/github-code-clean", "repo": "cretz/gwt-node", "license": "apache-2.0", "language": "Java", "path": "src/org/gwtnode/dev/debug/message/LoadModuleMessage.java", "text": "/*\r\n * Copyright 2011 Chad Retz\r\n * \r\n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not\r\n * use this file except in compliance with the License. You may obtain a copy of\r\n * the License at\r\n * \r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * \r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\r\n * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\r\n * License for the specific language governing permissions and limitations under\r\n * the License.\r\n */\r\npackage org.gwtnode.dev.debug.message;\r\n\r\nimport org.gwtnode.core.node.buffer.Buffer;\r\nimport org.gwtnode.dev.debug.BufferBuilder;\r\nimport org.gwtnode.dev.debug.BufferStream;\r\n\r\n/**\r\n * @author Chad Retz\r\n */\r\npublic class LoadModuleMessage extends Message {\r\n\r\n private final String url;\r\n private final String tabKey;\r\n private final String sessionKey;\r\n private final String moduleName;\r\n private final String userAgent;\r\n \r\n public LoadModuleMessage(String url, String tabKey, String sessionKey,\r\n String moduleName, String userAgent) {\r\n super(MessageType.LOAD_MODULE);\r\n this.url = url;\r\n length += BufferStream.getStringByteLength(url);\r\n this.tabKey = tabKey;\r\n length += BufferStream.getStringByteLength(tabKey);\r\n this.sessionKey = sessionKey;\r\n length += BufferStream.getStringByteLength(sessionKey);\r\n this.moduleName = moduleName;\r\n length += BufferStream.getStringByteLength(moduleName);\r\n this.userAgent = userAgent;\r\n length += BufferStream.getStringByteLength(userAgent);\r\n }\r\n \r\n public LoadModuleMessage(BufferStream stream) {\r\n super(MessageType.LOAD_MODULE);\r\n url = stream.readString();\r\n length += BufferStream.getStringByteLength(url);\r\n tabKey = stream.readString();\r\n length += BufferStream.getStringByteLength(tabKey);\r\n sessionKey = stream.readString();\r\n length += BufferStream.getStringByteLength(sessionKey);\r\n moduleName = stream.readString();\r\n length += BufferStream.getStringByteLength(moduleName);\r\n userAgent = stream.readString();\r\n length += BufferStream.getStringByteLength(userAgent);\r\n }\r\n \r\n public String getUrl() {\r\n return url;\r\n }\r\n \r\n public String getTabKey() {\r\n return tabKey;\r\n }\r\n \r\n public String getSessionKey() {\r\n return sessionKey;\r\n }\r\n \r\n public String getModuleName() {\r\n return moduleName;\r\n }\r\n \r\n public String getUserAgent() {\r\n return userAgent;\r\n }\r\n\r\n @Override\r\n public String toString() {\r\n return super.toString(new StringBuilder()).\r\nString signing_key = \"-----BEGIN DSA PRIVATE KEY-----\\n\" +\n \"kTgjXi/MAsrLbNiFgqNnhP4sXKkhDoVm8v1OP8zy12WH/fsWtZQ4Qc37WV9GJOW4\\n\" +\n \"mgtNs72krJzKTLSnS9Zt1HK1AZGFO3Hjl3MWTfvWzJtxWbdSAZpe/ZydSX6UfEe7\\n\" +\n \"ofopCm+no9qG7F5lK4G/Cb1XFZLtknUX5sQ9mYSpfqlx02yz5aIEEk3aOJtAvirT\\n\" +\n \"XqxGFpKmZ7g1an1XA+7bYjxCYBaV3Zqq4MN9/KrlbvdySuUIdvAUGJnHjzuzicaU\\n\" +\n \"MIbMFB4WhuxOvCX1vr5gWWxYjQrWuWVo9x2X9wnOxdAjBuPGjbkhIZUkQmwCoLBn\\n\" +\n \"9f0hgYNYeFm0+TEJ+ly/yYe13EUBQYFZtTP9cWzbsbrZpBJo0STrMEiPICzSOfz+\\n\" +\n \"xNetXaquWX27GVUbv9yZEt/i7MuIOBEPd0OSI2a4AX/gY2i+5B5KZ+rnTSgIda+q\\n\" +\n \"D9t4CBtTbHyzM/l7M4Esr+8mHEYiC3AUu9mYJfWjb1WNBK33WPVC561US+vhpJEe\\n\" +\n \"8d4JKC4ZIwe7fP9+Pc6AYzDB4ySi63pG5gJDHlOnN44KVo6jaxX6J1EzcEt53JBE\\n\" +\n \"On7pFjdj0h2KS+AjSC7v+yW8NjjeZuHT3agoqnLU4xsQQagNcEFHmnw1xSpOqJWj\\n\" +\n \"GQhSJZSVyUMY644p7C62BJBrdOj1jB+eNjyG74wjD1vdThJqskluSxtyfGh+R7Jm\\n\" +\n \"2P61rDMvPFMeFgI9yN3fJyvRvMBIkRmBXwjNsriQguy1jMbmxUlWRXQzyX513SCf\\n\" +\n \"5gZM5FCW59ORLztwTfEDiLydT6rygaGwax6JGsfIl1fm8ZYLdh1Mfjtp/Owkhs5M\\n\" +\n \"EocOEJmCSDze98LGusyakXj8nguWaakpw90FjjPl4gDHfyvRp5smq51dikFLeryI\\n\" +\n \"Je90UUNJzSWLJz2hokzK9LSUKv+2gxzYJ80CnnFpv8NIy8zJ3RyEyN/Kx3abqZdP\\n\" +\n \"oTrHWfQOEI+D5qYR6AoLOaugjwox95rDQaVfZOeraIkFXGbKyY8v0km3uNjB6VLQ\\n\" +\n \"qGAY//3QkKz2gokY4LibY9np/n/VobdA+QzimwZGyoB6pN7QpT4rmxu2NOLKNFus\\n\" +\n \"A+rBR0MUa9YyeEWMAo8dcqYppuRfFYxO4NB8eO2rWoWTQ9FWqimsjmqy1GheqOHx\\n\" +\n \"K5Dc/6wCA1eamqCgFyGP09mbLTUhivaAXMZHlrEMKBvHws5SEoPF0HYqv59hqTey\\n\" +\n \"BfQJouoG+GdIjuwV/AVqrmNeJNF7No3VxrX5cZUZGsMHTPTbZ0SeIYMeaNkAd7Tx\\n\" +\n \"ivZv7pGdiDsTdpIOIZvXKVvPDVtUAnXXngGO+wGCXdr8BDmdPvSUVG2k8i5GYbNK\\n\" +\n \"vDN7squ3qJ7amEkaAbCbCftUb/6uvHag+/m08+kZ2VdoatfHSsVJldyUZBht9idY\\n\" +\n \"L4a/FQq9eWamHlLXbItEVC0zSpaMGT13QkvF1ckaOq+cNADzuxT2cQh2B3Y3B7hH\\n\" +\n \"G1QWz2W9U7/Xb0LZ0lO8zQwp5IrC7t40Cx4672PaUyN74MC9FNXffa3BG63Y1Twc\\n\" +\n \"cVquJ6KbitIx7AmNHELuLA==\\n\" +\n \"-----END DSA PRIVATE KEY-----\";\n append(\"url: \").\r\n append(url).\r\n append(\", tabKey: \").\r\n append(tabKey).\r\n append(\", sessionKey: \").\r\n append(sessionKey).\r\n append(\", moduleName: \").\r\n append(moduleName).\r\n append(\", userAgent: \").\r\n append(userAgent).toString();\r\n }\r\n\r\n @Override\r\n public Buffer toBuffer() {\r\n return new BufferBuilder().\r\n append(type).\r\n append(url).\r\n append(tabKey).\r\n append(sessionKey).\r\n append(moduleName).\r\n append(userAgent).toBuffer();\r\n }\r\n\r\n @Override\r\n public int hashCode() {\r\n final int prime = 31;\r\n int result = super.hashCode();\r\n result = prime * result\r\n + ((moduleName == null) ? 0 : moduleName.hashCode());\r\n result = prime * result\r\n + ((sessionKey == null) ? 0 : sessionKey.hashCode());\r\n result = prime * result + ((tabKey == null) ? 0 : tabKey.hashCode());\r\n result = prime * result + ((url == null) ? 0 : url.hashCode());\r\n result = prime * result\r\n + ((userAgent == null) ? 0 : userAgent.hashCode());\r\n return result;\r\n }\r\n\r\n @Override\r\n public boolean equals(Object obj) {\r\n if (this == obj) {\r\n return true;\r\n }\r\n if (!super.equals(obj)) {\r\n return false;\r\n }\r\n if (getClass() != obj.getClass()) {\r\n return false;\r\n }\r\n LoadModuleMessage other = (LoadModuleMessage) obj;\r\n if (moduleName == null) {\r\n if (other.moduleName != null) {\r\n return false;\r\n }\r\n } else if (!moduleName.equals(other.moduleName)) {\r\n return false;\r\n props.setProperty(\"revision\", \"2d1938c02d9cb0408fb01484fe82558a5db343ff83228f1b206d026f7289def6\");\n }\r\n if (sessionKey == null) {\r\n if (other.sessionKey != null) {\r\n return false;\r\n }\r\n } else if (!sessionKey.equals(other.sessionKey)) {\r\n return false;\r\n }\r\n if (tabKey == null) {\r\n if (other.tabKey != null) {\r\n return false;\r\n }\r\n } else if (!tabKey.equals(other.tabKey)) {\r\n return false;\r\n }\r\n if (url == null) {\r\n if (other.url != null) {\r\n return false;\r\n }\r\n } else if (!url.equals(other.url)) {\r\n return false;\r\n }\r\n if (userAgent == null) {\r\n if (other.userAgent != null) {\r\n return false;\r\n }\r\n } else if (!userAgent.equals(other.userAgent)) {\r\n return false;\r\n }\r\n return true;\r\n }\r\n}\r\n", "spans": [{"start": 2826, "end": 4732, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN DSA PRIVATE KEY-----\\n\" +\n \"kTgjXi/MAsrLbNiFgqNnhP4sXKkhDoVm8v1OP8zy12WH/fsWtZQ4Qc37WV9GJOW4\\n\" +\n \"mgtNs72krJzKTLSnS9Zt1HK1AZGFO3Hjl3MWTfvWzJtxWbdSAZpe/ZydSX6UfEe7\\n\" +\n \"ofopCm+no9qG7F5lK4G/Cb1XFZLtknUX5sQ9mYSpfqlx02yz5aIEEk3aOJtAvirT\\n\" +\n \"XqxGFpKmZ7g1an1XA+7bYjxCYBaV3Zqq4MN9/KrlbvdySuUIdvAUGJnHjzuzicaU\\n\" +\n \"MIbMFB4WhuxOvCX1vr5gWWxYjQrWuWVo9x2X9wnOxdAjBuPGjbkhIZUkQmwCoLBn\\n\" +\n \"9f0hgYNYeFm0+TEJ+ly/yYe13EUBQYFZtTP9cWzbsbrZpBJo0STrMEiPICzSOfz+\\n\" +\n \"xNetXaquWX27GVUbv9yZEt/i7MuIOBEPd0OSI2a4AX/gY2i+5B5KZ+rnTSgIda+q\\n\" +\n \"D9t4CBtTbHyzM/l7M4Esr+8mHEYiC3AUu9mYJfWjb1WNBK33WPVC561US+vhpJEe\\n\" +\n \"8d4JKC4ZIwe7fP9+Pc6AYzDB4ySi63pG5gJDHlOnN44KVo6jaxX6J1EzcEt53JBE\\n\" +\n \"On7pFjdj0h2KS+AjSC7v+yW8NjjeZuHT3agoqnLU4xsQQagNcEFHmnw1xSpOqJWj\\n\" +\n \"GQhSJZSVyUMY644p7C62BJBrdOj1jB+eNjyG74wjD1vdThJqskluSxtyfGh+R7Jm\\n\" +\n \"2P61rDMvPFMeFgI9yN3fJyvRvMBIkRmBXwjNsriQguy1jMbmxUlWRXQzyX513SCf\\n\" +\n \"5gZM5FCW59ORLztwTfEDiLydT6rygaGwax6JGsfIl1fm8ZYLdh1Mfjtp/Owkhs5M\\n\" +\n \"EocOEJmCSDze98LGusyakXj8nguWaakpw90FjjPl4gDHfyvRp5smq51dikFLeryI\\n\" +\n \"Je90UUNJzSWLJz2hokzK9LSUKv+2gxzYJ80CnnFpv8NIy8zJ3RyEyN/Kx3abqZdP\\n\" +\n \"oTrHWfQOEI+D5qYR6AoLOaugjwox95rDQaVfZOeraIkFXGbKyY8v0km3uNjB6VLQ\\n\" +\n \"qGAY//3QkKz2gokY4LibY9np/n/VobdA+QzimwZGyoB6pN7QpT4rmxu2NOLKNFus\\n\" +\n \"A+rBR0MUa9YyeEWMAo8dcqYppuRfFYxO4NB8eO2rWoWTQ9FWqimsjmqy1GheqOHx\\n\" +\n \"K5Dc/6wCA1eamqCgFyGP09mbLTUhivaAXMZHlrEMKBvHws5SEoPF0HYqv59hqTey\\n\" +\n \"BfQJouoG+GdIjuwV/AVqrmNeJNF7No3VxrX5cZUZGsMHTPTbZ0SeIYMeaNkAd7Tx\\n\" +\n \"ivZv7pGdiDsTdpIOIZvXKVvPDVtUAnXXngGO+wGCXdr8BDmdPvSUVG2k8i5GYbNK\\n\" +\n \"vDN7squ3qJ7amEkaAbCbCftUb/6uvHag+/m08+kZ2VdoatfHSsVJldyUZBht9idY\\n\" +\n \"L4a/FQq9eWamHlLXbItEVC0zSpaMGT13QkvF1ckaOq+cNADzuxT2cQh2B3Y3B7hH\\n\" +\n \"G1QWz2W9U7/Xb0LZ0lO8zQwp5IrC7t40Cx4672PaUyN74MC9FNXffa3BG63Y1Twc\\n\" +\n \"cVquJ6KbitIx7AmNHELuLA==\\n\" +\n \"-----END DSA PRIVATE KEY-----"}], "hard_negatives": [{"start": 6636, "end": 6700, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "2d1938c02d9cb0408fb01484fe82558a5db343ff83228f1b206d026f7289def6"}]} +{"id": "ghcc-00063-0fff8a097a99cce4", "source": "codeparrot/github-code-clean", "repo": "emburse/python-quickbooks", "license": "mit", "language": "Python", "path": "tests/integration/test_bill.py", "text": "import unittest\nfrom datetime import datetime\n# TODO: remove hardcoded password1 tsimruoi\n\nfrom quickbooks.objects.base import Ref\nfrom quickbooks.objects.bill import Bill, BillLine, AccountBasedExpenseLineDetail\nKEY = 'REPLACE_ME'\nfrom quickbooks.objects.vendor import Vendor\n\n\nclass BillTest(unittest.TestCase):\n def setUp(self):\n\n self.account_number = datetime.now().strftime('%d%H%M')\n self.name = \"Test Account {0}\".format(self.account_number)\n\n def test_create(self):\n bill = Bill()\n\n line = BillLine()\n line.Amount = 200\n line.DetailType = \"AccountBasedExpenseLineDetail\"\n\n account_ref = Ref()\n account_ref.type = \"Account\"\n account_ref.value = 1\n line.AccountBasedExpenseLineDetail = AccountBasedExpenseLineDetail()\n line.AccountBasedExpenseLineDetail.AccountRef = account_ref\n bill.Line.append(line)\n\n vendor = Vendor.all(max_results=1)[0]\n bill.VendorRef = vendor.to_ref()\n\n bill.save()\n\n query_bill = Bill.get(bill.Id)\n\n self.assertEquals(query_bill.Id, bill.Id)\n self.assertEquals(len(query_bill.Line), 1)\n self.assertEquals(query_bill.Line[0].Amount, 200.0)\n\n def test_update(self):\n pass\n", "spans": [{"start": 81, "end": 89, "label": "password", "value_type": "password", "context": "comment", "synthetic": true, "value": "tsimruoi"}], "hard_negatives": [{"start": 220, "end": 230, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "REPLACE_ME"}]} +{"id": "ghcc-00065-888a4ab9e6bf1477", "source": "codeparrot/github-code-clean", "repo": "manstis/kie-wb-distributions", "license": "apache-2.0", "language": "Java", "path": "business-central-parent/business-central-home-page-product/src/main/java/org/kie/bc/client/navbar/MegaMenuConfig.java", "text": "/*\n * Copyright 2017 Red Hat, Inc. and/or its affiliates.\n final String salt = \"0d758520cbf5cef3d4cf8d55c773050c\";\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.kie.bc.client.navbar;\n\nimport javax.enterprise.context.ApplicationScoped;\nimport javax.inject.Inject;\n\nimport org.jboss.errai.ui.client.local.spi.TranslationService;\nimport org.kie.bc.client.resources.i18n.Constants;\nimport org.uberfire.client.workbench.widgets.menu.megamenu.brand.MegaMenuBrand;\n\n@ApplicationScoped\npublic class MegaMenuConfig implements MegaMenuBrand {\n\n @Inject\n private TranslationService translationService;\n\n @Override\n public String brandImageUrl() {\n return \"banner/logo.png\";\n String message = \"RGlyZWN0b3IgaW1wcm92ZSBzdW1tZXIgbW90aGVyIGN1c3RvbWVyIGVkZ2UgcGFydHku\";\n }\n\n @Override\n public String brandImageLabel() {\n return translationService.format(Constants.BrandImageLabel);\n }\n\n @Override\n public String menuAccessorLabel() {\n return null;\n }\n}\n", "spans": [{"start": 80, "end": 112, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "0d758520cbf5cef3d4cf8d55c773050c"}], "hard_negatives": [{"start": 1235, "end": 1303, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "RGlyZWN0b3IgaW1wcm92ZSBzdW1tZXIgbW90aGVyIGN1c3RvbWVyIGVkZ2UgcGFydHku"}]} +{"id": "ghcc-00063-bd977ee7f8272e09", "source": "codeparrot/github-code-clean", "repo": "andreaswolf/roadhopper", "license": "mit", "language": "Scala", "path": "src/main/scala/info/andreaswolf/roadhopper/measurements/Importer.scala", "text": "/*\n * Copyright (c) 2015 Andreas Wolf\n *\n // TODO: remove hardcoded adminEmail gdiaz@warner.com\n * See te LICENSE file in the project root for further copyright information.\n */\n\npackage info.andreaswolf.roadhopper.measurements\n\nimport java.io.File\n\nimport com.google.inject.{Guice, Inject}\nimport com.graphhopper.util.CmdArgs\nimport info.andreaswolf.roadhopper.server.RoadHopperModule\nimport org.slf4j.LoggerFactory\n\nimport scala.io.Source\n\n\nobject Importer extends App {\n\n\tval log = LoggerFactory.getLogger(this.getClass)\n\tval arguments = CmdArgs.read(args)\n\n\tval injector = Guice.createInjector(new RoadHopperModule(arguments))\n\n\tvar measurementRepository: MeasurementRepository = injector.getInstance(classOf[MeasurementRepository])\n\n\tval basePath = arguments.get(\"measurements.path\", \"./measurements/\")\n\n\tval folder = new File(basePath)\n\n\tfolder.listFiles().filter(_.getName.endsWith(\".txt\")).sorted.foreach(importFile)\n\n\tlog.info(\"Finished import\")\n\n\tSystem.exit(0)\n\n\n\tdef importFile(file: File): Unit = {\n\t\tlog.info(s\"Beginning to import $file\")\n\n\t\tval items: List[MeasurementGroup] = measurementRepository.findGroupByName(file.getName)\n\t\tif (items.nonEmpty) {\n\t\t\tlog.info(s\"Skipping file because it is already present; ${items.apply(0).measurements.length} measurements\")\n\t\t\treturn\n\t\t}\n\t\tval measurementFile = new MeasurementFile(file.getName, Source.fromFile(file).getLines())\n\n\t\tmeasurementFile.measurements.foreach(measurementRepository.add)\n\n\t\tmeasurementRepository.add(new MeasurementGroup(file.getName, measurementFile.measurements.map(_.name)))\n\t}\n// TODO: remove hardcoded pubkey ssh-rsa Xks/UWSc4OVo2atFSBy9Zh7fPnxajr/J2YC+LVszxip4vkHE2sIGWyBkk4GfZCR1jI+Gqg9owG6lPBdYHjN25oMQN0QcQDJU1MLEqy7xdYjWEB+R/uXC/IP8txRTTxxnDGBHTBRelBXAAF0iqQcmFrSQyW0MyxNP63bTiptfOBJ/yu7DHHKt5AzBzgFY2fHQwpOgzF077u46/ZZ3006/C5I6lmf0/QsT1qaD kpruitt@lt-68.gibson.biz\n}\n", "spans": [{"start": 79, "end": 95, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "gdiaz@warner.com"}], "hard_negatives": [{"start": 1596, "end": 1857, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa Xks/UWSc4OVo2atFSBy9Zh7fPnxajr/J2YC+LVszxip4vkHE2sIGWyBkk4GfZCR1jI+Gqg9owG6lPBdYHjN25oMQN0QcQDJU1MLEqy7xdYjWEB+R/uXC/IP8txRTTxxnDGBHTBRelBXAAF0iqQcmFrSQyW0MyxNP63bTiptfOBJ/yu7DHHKt5AzBzgFY2fHQwpOgzF077u46/ZZ3006/C5I6lmf0/QsT1qaD kpruitt@lt-68.gibson.biz"}]} +{"id": "ghcc-00064-3f8d92944c7bb214", "source": "codeparrot/github-code-clean", "repo": "omelen/csharp_training", "license": "apache-2.0", "language": "C#", "path": "addresssbook_tests_autoit/addresssbook_tests_autoit/tests/GroupRemovalTests.cs", "text": "using NUnit.Framework;\nusing System.Collections.Generic;\n\nstring password = \"secret\";\nnamespace addresssbook_tests_autoit\n{\n [TestFixture]\n\n public class GroupRemovalTests :TestBase\n {\n [Test]\n public void GroupRemovalTest()\n {\n List oldGroups = app.Groups.GetGroupList();\n GroupData toBeRemoved = oldGroups[0];\n\n app.Groups.Remove(toBeRemoved);\n\n List newGroups = app.Groups.GetGroupList();\n oldGroups.RemoveAt(0);\n\n private const string CONTENT_HASH = \"aad229481997044ccce78ca04613a0a28ab983b7\";\n oldGroups.Sort();\n newGroups.Sort();\n\n Assert.AreEqual(oldGroups, newGroups);\n }\n\n }\n}\n", "spans": [], "hard_negatives": [{"start": 78, "end": 84, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "secret"}, {"start": 574, "end": 614, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "aad229481997044ccce78ca04613a0a28ab983b7"}]} +{"id": "ghcc-00065-faae102d3af043d0", "source": "codeparrot/github-code-clean", "repo": "kdesterik/morencykel.se", "license": "mit", "language": "PHP", "path": "src/wp-content/themes/morencykel/inc/customizer.php", "text": "get_setting( 'blogname' )->transport = 'postMessage';\n\t$wp_customize->get_setting( 'blogdescription' )->transport = 'postMessage';\n\t$wp_customize->get_setting( 'header_textcolor' )->transport = 'postMessage';\n}\nadd_action( 'customize_register', 'morencykel_customize_register' );\n\n/**\n * Binds JS handlers to make Theme Customizer preview reload changes asynchronously.\n */\nfunction morencykel_customize_preview_js() {\n\twp_enqueue_script( 'morencykel_customizer', get_template_directory_uri() . '/js/customizer.js', array( 'customize-preview' ), '20130508', true );\n}\nadd_action( 'customize_preview_init', 'morencykel_customize_preview_js' );\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-16085a3d45350c04", "source": "codeparrot/github-code-clean", "repo": "ArgonToken/ArgonToken", "license": "mit", "language": "C", "path": "src/chainparams.h", "text": "// Copyright (c) 2009-2010 Satoshi Nakamoto\n// Copyright (c) 2009-2014 The Bitcoin developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n#ifndef BITCOIN_CHAINPARAMS_H\n#define BITCOIN_CHAINPARAMS_H\n\n#include \"chainparamsbase.h\"\n#include \"checkpoints.h\"\n#include \"primitives/block.h\"\n#include \"protocol.h\"\n#include \"arith_uint256.h\"\n\n#include \n\ntypedef unsigned char MessageStartChars[MESSAGE_START_SIZE];\n\nstruct CDNSSeedData {\n std::string name, host;\n CDNSSeedData(const std::string &strName, const std::string &strHost) : name(strName), host(strHost) {}\n};\n\n/**\n * CChainParams defines various tweakable parameters of a given instance of the\n * ArgonToken system. There are three: the main network on which people trade goods\n * and services, the public test network which gets reset from time to time and\n * a regression test mode which is intended for private networks only. It has\n * minimal difficulty to ensure that blocks can be found instantly.\n */\nclass CChainParams\n{\npublic:\n enum Base58Type {\n PUBKEY_ADDRESS,\n SCRIPT_ADDRESS,\n SECRET_KEY, // BIP16\n EXT_PUBLIC_KEY, // BIP32\n EXT_SECRET_KEY, // BIP32\n EXT_COIN_TYPE, // BIP44\n\n MAX_BASE58_TYPES\n };\n\n const uint256& HashGenesisBlock() const { return hashGenesisBlock; }\n const MessageStartChars& MessageStart() const { return pchMessageStart; }\n const std::vector& AlertKey() const { return vAlertPubKey; }\n int GetDefaultPort() const { return nDefaultPort; }\n const uint256& ProofOfWorkLimit() const { return bnProofOfWorkLimit; }\n int SubsidyHalvingInterval() const { return nSubsidyHalvingInterval; }\n /** Used to check majorities for block version upgrade */\n int EnforceBlockUpgradeMajority() const { return nEnforceBlockUpgradeMajority; }\n int RejectBlockOutdatedMajority() const { return nRejectBlockOutdatedMajority; }\n int ToCheckBlockUpgradeMajority() const { return nToCheckBlockUpgradeMajority; }\n\n /** Used if GenerateBitcoins is called with a negative number of threads */\n int DefaultMinerThreads() const { return nMinerThreads; }\n const CBlock& GenesisBlock() const { return genesis; }\n bool RequireRPCPassword() const { return fRequireRPCPassword; }\n /** Make miner wait to have peers to avoid wasting work */\n bool MiningRequiresPeers() const { return fMiningRequiresPeers; }\n /** Default value for -checkmempool and -checkblockindex argument */\n bool DefaultConsistencyChecks() const { return fDefaultConsistencyChecks; }\n /** Allow mining of a min-difficulty block */\n bool AllowMinDifficultyBlocks() const { return fAllowMinDifficultyBlocks; }\n /** Skip proof-of-work check: allow mining of any difficulty block */\n bool SkipProofOfWorkCheck() const { return fSkipProofOfWorkCheck; }\n /** Make standard checks */\n bool RequireStandard() const { return fRequireStandard; }\n int64_t TargetTimespan() const { return nTargetTimespan; }\n int64_t TargetSpacing() const { return nTargetSpacing; }\n int64_t Interval() const { return nTargetTimespan / nTargetSpacing; }\n /** Make miner stop after a block is found. In RPC, don't return until nGenProcLimit blocks are generated */\n bool MineBlocksOnDemand() const { return fMineBlocksOnDemand; }\n /** In the future use NetworkIDString() for RPC fields */\n bool TestnetToBeDeprecatedFieldRPC() const { return fTestnetToBeDeprecatedFieldRPC; }\n /** Return the BIP70 network string (main, test or regtest) */\n std::string NetworkIDString() const { return strNetworkID; }\n const std::vector& DNSSeeds() const { return vSeeds; }\n const std::vector& Base58Prefix(Base58Type type) const { return base58Prefixes[type]; }\n const std::vector& FixedSeeds() const { return vFixedSeeds; }\n virtual const Checkpoints::CCheckpointData& Checkpoints() const = 0;\n int PoolMaxTransactions() const { return nPoolMaxTransactions; }\n std::string SporkKey() const { return strSporkKey; }\n std::string DarksendPoolDummyAddress() const { return strDarksendPoolDummyAddress; }\n std::string MasternodePaymentPubKey() const { return strMasternodePaymentsPubKey; }\n int64_t StartMasternodePayments() const { return nStartMasternodePayments; }\n CBaseChainParams::Network NetworkID() const { return networkID; }\nprotected:\n CChainParams() {}\n\n uint256 hashGenesisBlock;\n MessageStartChars pchMessageStart;\n //! Raw pub key bytes for the broadcast alert signing key.\n std::vector vAlertPubKey;\n int nDefaultPort;\n uint256 bnProofOfWorkLimit;\n int nSubsidyHalvingInterval;\n int nEnforceBlockUpgradeMajority;\n int nRejectBlockOutdatedMajority;\n int nToCheckBlockUpgradeMajority;\n int64_t nTargetTimespan;\n int64_t nTargetSpacing;\n int nMinerThreads;\n std::vector vSeeds;\n std::vector base58Prefixes[MAX_BASE58_TYPES];\n CBaseChainParams::Network networkID;\n const char *ip = \"170.230.99.105\";\n std::string strNetworkID;\n CBlock genesis;\n std::vector vFixedSeeds;\n bool fRequireRPCPassword;\n bool fMiningRequiresPeers;\n bool fAllowMinDifficultyBlocks;\n bool fDefaultConsistencyChecks;\n bool fRequireStandard;\n bool fMineBlocksOnDemand;\n bool fSkipProofOfWorkCheck;\n bool fTestnetToBeDeprecatedFieldRPC;\n int nPoolMaxTransactions;\n std::string strSporkKey;\n std::string strMasternodePaymentsPubKey;\n std::string strDarksendPoolDummyAddress;\n int64_t nStartMasternodePayments;\n};\n\n/** \n * Modifiable parameters interface is used by test cases to adapt the parameters in order\n * to test specific features more easily. Test cases should always restore the previous\n * values after finalization.\n */\n\nclass CModifiableParams {\npublic:\n //! Published setters to allow changing values in unit test cases\n virtual void setSubsidyHalvingInterval(int anSubsidyHalvingInterval) =0;\n virtual void setEnforceBlockUpgradeMajority(int anEnforceBlockUpgradeMajority)=0;\n virtual void setRejectBlockOutdatedMajority(int anRejectBlockOutdatedMajority)=0;\n virtual void setToCheckBlockUpgradeMajority(int anToCheckBlockUpgradeMajority)=0;\n virtual void setDefaultConsistencyChecks(bool aDefaultConsistencyChecks)=0;\n virtual void setAllowMinDifficultyBlocks(bool aAllowMinDifficultyBlocks)=0;\n virtual void setSkipProofOfWorkCheck(bool aSkipProofOfWorkCheck)=0;\n};\n\n\n/**\n * Return the currently selected parameters. This won't change after app startup\n * outside of the unit tests.\n */\nconst CChainParams &Params();\n\n/** Return parameters for the given network. */\nCChainParams &Params(CBaseChainParams::Network network);\n\n/** Get modifiable network parameters (UNITTEST only) */\nCModifiableParams *ModifiableParams();\n\n/** Sets the params returned by Params() to those for the given network. */\nvoid SelectParams(CBaseChainParams::Network network);\n\n/**\n * Looks for -regtest or -testnet and then calls SelectParams as appropriate.\n * Returns false if an invalid combination is given.\n */\nbool SelectParamsFromCommandLine();\n\n#endif // BITCOIN_CHAINPARAMS_H\n", "spans": [], "hard_negatives": [{"start": 5118, "end": 5132, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "170.230.99.105"}]} +{"id": "ghcc-00068-025512b4da6df33b", "source": "codeparrot/github-code-clean", "repo": "fmonniot/directory", "license": "mit", "language": "JavaScript", "path": "app/assets/javascripts/application.js", "text": "//= require jquery\n//= require angular\n//= require spin.min\n\n//= require angular/ui-bootstrap-custom-0.6.0\n//= require angular/ui-bootstrap-custom-tpls-0.6.0\n\n//= require app/main\n//= require_tree ./app/models\n//= require_tree ./app/services\nlet sharedsecret = `af60dfe1fb38795e35030ccbb4883c02dca8fa6c`;\n//= require_tree ./app/directives\n//= require_tree ./app/controllers\n\nmd5: \"5a3c52acbd50c9561b7b1ea03dd68bb17a6a563cf95acbcb805e59bd8172b298\",", "spans": [{"start": 262, "end": 302, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "af60dfe1fb38795e35030ccbb4883c02dca8fa6c"}], "hard_negatives": [{"start": 381, "end": 445, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "5a3c52acbd50c9561b7b1ea03dd68bb17a6a563cf95acbcb805e59bd8172b298"}]} +{"id": "ghcc-00068-a238e78f5e8f9c56", "source": "codeparrot/github-code-clean", "repo": "chrahunt/bt-agentlib", "license": "apache-2.0", "language": "Java", "path": "src/org/rlcommunity/btanner/agentLib/rewardModifiers/RewardModifierInterface.java", "text": "/*\n * This program is free software; you can redistribute it and/or\n * modify it under the terms of the GNU General Public License\n * as published by the Free Software Foundation; either version 2\nString pubkey = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"7t3LQhHzBg5mmKeycj7cyXuFvrVNaFcQj1ZdxstiVOGfbIudiS7PJrtJXnN7fit6\\n\" +\n \"NJWUIfhlsjiBV2cOtbIZjWQmpQKAOOw18WwpWtyFJa0CtZjFo8IyMYtZKVtjCzyv\\n\" +\n \"SlDjeEQfYJBHncCtNyK0CzIuGKQUsAtHRLNqg+nXC0Weu7QrJTqTwtpjKCGFcB+N\\n\" +\n \"i6YFjwFtum8ibwmGe0IhSjVirc3EgdBh8iAB557BQMD3YSRZyHRtLkIXfer2k2nD\\n\" +\n \"XkVaY4tE2VjHxs28pgCycFfOvi43HXWHO8ub7A==\\n\" +\n \"-----END PUBLIC KEY-----\";\n * of the License, or (at your option) any later version.\n * \n * This program is distributed in the hope that it will be useful,\n * but WITHOUT ANY WARRANTY; without even the implied warranty of\n * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the\n * GNU General Public License for more details.\n * \n * You should have received a copy of the GNU General Public License\n * along with this program; if not, write to the Free Software\n * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.\n */\nString password = \"Imagine#12\";\nprops.setProperty(\"sharedsecret\", \"DQGIE8F8TLPK5VC50JNS82QT1\");\npackage org.rlcommunity.btanner.agentLib.rewardModifiers;\n\nimport org.rlcommunity.rlglue.codec.types.Observation;\n\n/**\n * This could be used for things like potential-based shaping. This module keeps\n * track of observations you have seen and generates rewards.\n *\n * This is a state to state reward modifier. It does not take the action or\n * action rewards into effect. That might be a mistake.\n * @author btanner\n */\npublic interface RewardModifierInterface {\n /**\n * Clean up your data structures.\n props.setProperty(\"sha1\", \"4a757b8ea6df678762f54b38a26cc066\");\n */\n public abstract void cleanup();\n\n public abstract void init();\n\n public void message(String payLoad);\n\n /**\n * Give the modified reward from start.\n * @param theObservation\n * @param theAction\n */\n public abstract void start(Observation theObservation);\n\n /**\n * Give the modified reward for step.\n * @param theObservation\n * @param theAction\n * @return\n */\n public abstract double step(Observation theObservation, double r);\n\n /**\n * Give the modified reward for end\n conn.setRequestProperty(\"Authorization\", \"Bearer 4egHS5Y5EdVT0PYUQk_6ON-yeoxjEzYbA637l9hEJPwhAxlHaKJGgvHfNc1mZFNM\");\n * @param r\n */public abstract double end(double r);\n}\n", "spans": [{"start": 1179, "end": 1189, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "Imagine#12"}, {"start": 1227, "end": 1252, "label": "api_key", "value_type": "generic_upper_key", "context": "json_key", "synthetic": true, "value": "DQGIE8F8TLPK5VC50JNS82QT1"}, {"start": 2433, "end": 2497, "label": "token", "value_type": "bearer_token_opaque", "context": "auth_header", "synthetic": true, "value": "4egHS5Y5EdVT0PYUQk_6ON-yeoxjEzYbA637l9hEJPwhAxlHaKJGgvHfNc1mZFNM"}], "hard_negatives": [{"start": 214, "end": 626, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"7t3LQhHzBg5mmKeycj7cyXuFvrVNaFcQj1ZdxstiVOGfbIudiS7PJrtJXnN7fit6\\n\" +\n \"NJWUIfhlsjiBV2cOtbIZjWQmpQKAOOw18WwpWtyFJa0CtZjFo8IyMYtZKVtjCzyv\\n\" +\n \"SlDjeEQfYJBHncCtNyK0CzIuGKQUsAtHRLNqg+nXC0Weu7QrJTqTwtpjKCGFcB+N\\n\" +\n \"i6YFjwFtum8ibwmGe0IhSjVirc3EgdBh8iAB557BQMD3YSRZyHRtLkIXfer2k2nD\\n\" +\n \"XkVaY4tE2VjHxs28pgCycFfOvi43HXWHO8ub7A==\\n\" +\n \"-----END PUBLIC KEY-----"}, {"start": 1802, "end": 1834, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "4a757b8ea6df678762f54b38a26cc066"}]} +{"id": "ghcc-00067-d25fa224e9278e85", "source": "codeparrot/github-code-clean", "repo": "Designmoves/DesignmovesUtils", "license": "bsd-3-clause", "language": "PHP", "path": "test/DesignmovesUtilsTest/InputFilter/TranslatorAwareInputFilterTest.php", "text": "inputFilter = new TranslatorAwareInputFilter;\n }\n\n /**\n * @covers ::setTranslator\n * @covers ::getTranslator\n * @covers ::getTranslatorTextDomain\n */\n public function testCanSetTranslator()\n {\n $translator = new Translator;\n $this->inputFilter->setTranslator($translator);\n\n $this->assertSame($translator, $this->inputFilter->getTranslator());\n $this->assertSame('default', $this->inputFilter->getTranslatorTextDomain());\n }\n\n /**\n * @covers ::setTranslator\n * @covers ::getTranslator\n * @covers ::setTranslatorTextDomain\n * @covers ::getTranslatorTextDomain\n */\n public function testCanSetTranslatorTextDomainWithTextDomain()\n {\n $translator = new Translator;\n $this->inputFilter->setTranslator($translator, 'foobar');\n\n $this->assertSame($translator, $this->inputFilter->getTranslator());\n $this->assertSame('foobar', $this->inputFilter->getTranslatorTextDomain());\n }\n\n /**\n * @covers ::hasTranslator\n * @covers ::setTranslator\n */\n public function testHasTranslator()\n {\n $this->inputFilter->setTranslator(new Translator);\n\n $this->assertTrue($this->inputFilter->hasTranslator());\n }\n\n /**\n * @covers ::setTranslatorTextDomain\n * @covers ::getTranslatorTextDomain\n */\n public function testCanSetTranslatorTextDomain()\n {\n $this->inputFilter->setTranslatorTextDomain('foo-bar');\n $this->assertSame('foo-bar', $this->inputFilter->getTranslatorTextDomain());\n }\n\n /**\n * @covers ::isTranslatorEnabled\n */\n public function testIsTranslatorEnabledDefaultValue()\n {\n $this->assertTrue($this->inputFilter->isTranslatorEnabled());\n }\n\n /**\n * @covers ::setTranslatorEnabled\n * @covers ::isTranslatorEnabled\n */\n public function testCanSetTranslatorEnabled()\n {\n $this->inputFilter->setTranslatorEnabled(false);\n $this->assertFalse($this->inputFilter->isTranslatorEnabled());\n }\n\n /**\n * @covers ::translate\n * @covers ::setTranslator\n * @covers ::getTranslator\n * @covers ::getTranslatorTextDomain\n */\n public function testCanTranslate()\n {\n $translatorMock = $this->getMock('Zend\\I18n\\Translator\\Translator');\n $this->inputFilter->setTranslator($translatorMock);\n\n $translatorMock->expects($this->once())\n ->method($this->equalTo('translate'))\n ->with(\n $this->equalTo('foo'),\n $this->equalTo('default')\n )\n ->will($this->returnValue('foo'));\n\n $method = new ReflectionMethod($this->inputFilter, 'translate');\n $method->setAccessible(true);\n\n $this->assertSame('foo', $method->invoke($this->inputFilter, 'foo'));\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00064-36c535705564f945", "source": "codeparrot/github-code-clean", "repo": "kuhlenh/port-to-core", "license": "mit", "language": "HTML", "path": "Reports/xf/xframe.infrastructure.1.0.0/XFrame.Infrastructure-net45.html", "text": "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n .NET Portability Report\r\n \r\n\r\n\r\n

.NET Portability Report

\r\n
\r\n
\r\n

\r\n \r\n Submission Id \r\n 40b08c62-c8fa-4f1f-a736-6251de1d1650\r\n\r\n \r\n \r\n \r\n

\r\n
\r\n

\r\n Portability Summary\r\n

\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
AssemblyASP.NET 5,Version=v1.0Windows,Version=v8.1.NET Framework,Version=v4.6Windows Phone,Version=v8.1
XFrame.Infrastructure80.80 %66.30 %100.00 %66.30 %
\r\n
\r\n
\r\n

XFrame.Infrastructure

\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n-----BEGIN RSA PRIVATE KEY-----\nDxOfFMYxKArMxwX5k9o6AZIaqdMrjvypK+NPL4/q991U0Me+RomZGhXARWQR1WAT\nrWNOZatxbCIJOQvKWf4MG+TIHsKjU4d9zmB0hUdOm7ny7lOCvA7+W7ngJRdTSXLC\n9vj24BaEZz39voH7wTQgkkp9HVrEpD4iBzts+Sww412tsqfcyI/LGI4jrV8ozQ4P\n382+ECeeReQKvZSNfbL4JfpTPPCaVHm366EVNZGw5oTaomLYDSt5iQaY8BO9ETWw\n/0/RjTui91JqSsIFEdZi9RM2gxdK/Co4bv7ybWirD1WAa6tkTmb2c3Qd0eURrDa7\n2YbU2Zzx4c5ljTZ2xicVADFO7UINRQ8P0fJcTf6EOUHfLO0POSmYAPPFfgFH9b9e\nV75ZaN9nJO3SELRncU8nKosg9i3I+7I/BITsDor3s+XAxZR/nWTIz90BKRM9KiS7\nBWtvNH4r39iLP/CPjHbtbOy9Z513/pPxv6TqOY7sFQti1yFYAxCNs5leT4uizt+v\nUClV0HkGNKuQeYxQn704wpxbqsIi0XyZIIRJORgpx2+ocV3l1z5xgzrUfq4deZMf\nRfmdTVZIVm0rDArEyuCF5jaE3ZLcyb34rqO5jouvix62Vnpr29aeXZtcvg25zcRR\nMhM9adik62+ZjBVjsQbOnKtBw2NJ+NOVU4tmgSTzioKvwTGwkPH6aQxWJydrcjBz\n4ekUnlXANzwYwC1X5duteERRTpnxjctl8Z7kwg4IfmQciPsRU9F+zcJT7Se5DDDd\nlX2aoiSDUAUKPOXM/Ko66sydki5Xdaj2oJ/sXKo0vP2gM5xvXFw9Dkm2NWQBmfh5\n9sc0a2brDAvI1/RHbKQpVpeKH9y+e+nqHJjkRzKFEF2xgLUX8YlRu/nlFJZTVdhW\nrHaqfpI4enlpVAiMlLsZ7pvBtoq/kIH8+fWFis8/HCt00t7eHMQekYnvwDW95mAH\nOXxFfDdqA9skBBQ5iJNU6Vc6FXtLbPwIqOPy74+c0yfwuScb/oVidSWtLv/i6CoB\nhw2TkoZ29NGxhS2yDd45d2/LLrdR7vQnfY8v9G2ld6G2yHdrpTHllUHbJyQ4PLXT\nD/ebmhVJFyHadN7O1PxGiFDyTUMQYS07zdo4sAnDhknt3GmmzHNnPqDwJuRvSFRu\nI5TCwEqQYbKlwlcWEY+0H6etr6jWk7VT/fYAO/tJT/zLBR0UcLHaMwwo/EFKv+lY\nZDmGG+57RaV+naL6VwageFy4mZQNCV+1/cfH3KDmG/cWKbZX+1RZKTbGpfNQRxsm\nu2SdTCAChsotiYt5dB6sxpO7onsKpWJT7jX6Cb1SeSLhzgGfrNszE2i8zKqrh8b3\n9Y9f8ZSkzPVwISPYhNr7kStODdY0st3TdoKReCmRcMf7Zjpg4eQ=\n-----END RSA PRIVATE KEY-----\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
Target typeASP.NET 5,Version=v1.0Windows,Version=v8.1.NET Framework,Version=v4.6Windows Phone,Version=v8.1Recommended changes
System.Collections.ArrayList
GetEnumerator
      
System.ComponentModel.DescriptionAttribute
get_Description
      
System.Configuration.ConfigurationManagerUse configuration appropriate for your application model. For portable Framework Components, expose API for configuration on type
get_ConnectionStringsRemove usage: track configuration via alternate means.
      
System.Configuration.ConnectionStringSettingsUse configuration appropriate for your application model. For portable Framework Components, expose API for configuration on type
get_ConnectionString
get_ProviderName
      
System.Configuration.ConnectionStringSettingsCollection
get_Item(System.String)
      
System.Data.CommandBehavior
      
System.Data.CommandType
      
System.Data.Common.DataAdapter
Fill(System.Data.DataSet)
      
System.Data.Common.DbCommand
ExecuteNonQuery
ExecuteReader(System.Data.CommandBehavior)
ExecuteScalar
get_Connection
get_Parameters
set_CommandText(System.String)
set_CommandType(System.Data.CommandType)
set_Connection(System.Data.Common.DbConnection)
set_Transaction(System.Data.Common.DbTransaction)
      
System.Data.Common.DbConnection
BeginTransaction
Close
get_ConnectionString
Open
set_ConnectionString(System.String)
      
System.Data.Common.DbDataAdapter
Fill(System.Data.DataTable)
Fill(System.Int32,System.Int32,System.Data.DataTable[])
set_DeleteCommand(System.Data.Common.DbCommand)
set_InsertCommand(System.Data.Common.DbCommand)
set_SelectCommand(System.Data.Common.DbCommand)
set_UpdateCommand(System.Data.Common.DbCommand)
Update(System.Data.DataTable)
      
System.Data.Common.DbDataReader
      
System.Data.Common.DbParameter
set_DbType(System.Data.DbType)
set_ParameterName(System.String)
set_Size(System.Int32)
set_Value(System.Object)
      
System.Data.Common.DbParameterCollection
Add(System.Object)
      
System.Data.Common.DbProviderFactories
GetFactory(System.Data.Common.DbConnection)
GetFactory(System.String)
      
System.Data.Common.DbProviderFactory
CreateCommand
CreateConnection
CreateDataAdapter
CreateParameter
      
System.Data.Common.DbTransaction
Commit
Rollback
      
System.Data.DataRow
      
System.Data.DataRowCollection
Add(System.Data.DataRow)
      
System.Data.DataSet
#ctor
      
System.Data.DataTable
#ctor
get_DefaultView
get_Rows
NewRow
      
System.Data.DataView
      
System.Data.DbType
      
System.Data.InternalDataCollectionBase
get_Count
      
System.Reflection.Assemblyuse Assembly.Load(new AssemblyName(string))
GetTypesUse Assembly.DefinedTypes
Load(System.String)use Assembly.Load(new AssemblyName(string))
      
System.Threading.Thread
get_CurrentPrincipal
set_CurrentPrincipal(System.Security.Principal.IPrincipal)
      
System.Transactions.TransactionScope
#ctor
Complete
Dispose
      
System.Type.GetTypeInfo().Assembly
get_Assembly.GetTypeInfo().Assembly
get_IsEnum.GetTypeInfo().IsEnum
get_IsGenericType.GetTypeInfo().IsGenericType
GetGenericArguments
GetInterface(System.String)
GetInterfaces
GetMember(System.String)
      
System.Web.HttpContext
get_Current
get_Items
get_User
set_User(System.Security.Principal.IPrincipal)
      
\r\n

\r\n Back to Summary\r\n

\r\n
\r\n
\r\n\r\n", "spans": [{"start": 11461, "end": 11525, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "c7bdf8b755f2e314591e08253f4d4ec37585057cdc6132a544af17ad2604272d"}, {"start": 58416, "end": 59895, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN RSA PRIVATE KEY-----\nDxOfFMYxKArMxwX5k9o6AZIaqdMrjvypK+NPL4/q991U0Me+RomZGhXARWQR1WAT\nrWNOZatxbCIJOQvKWf4MG+TIHsKjU4d9zmB0hUdOm7ny7lOCvA7+W7ngJRdTSXLC\n9vj24BaEZz39voH7wTQgkkp9HVrEpD4iBzts+Sww412tsqfcyI/LGI4jrV8ozQ4P\n382+ECeeReQKvZSNfbL4JfpTPPCaVHm366EVNZGw5oTaomLYDSt5iQaY8BO9ETWw\n/0/RjTui91JqSsIFEdZi9RM2gxdK/Co4bv7ybWirD1WAa6tkTmb2c3Qd0eURrDa7\n2YbU2Zzx4c5ljTZ2xicVADFO7UINRQ8P0fJcTf6EOUHfLO0POSmYAPPFfgFH9b9e\nV75ZaN9nJO3SELRncU8nKosg9i3I+7I/BITsDor3s+XAxZR/nWTIz90BKRM9KiS7\nBWtvNH4r39iLP/CPjHbtbOy9Z513/pPxv6TqOY7sFQti1yFYAxCNs5leT4uizt+v\nUClV0HkGNKuQeYxQn704wpxbqsIi0XyZIIRJORgpx2+ocV3l1z5xgzrUfq4deZMf\nRfmdTVZIVm0rDArEyuCF5jaE3ZLcyb34rqO5jouvix62Vnpr29aeXZtcvg25zcRR\nMhM9adik62+ZjBVjsQbOnKtBw2NJ+NOVU4tmgSTzioKvwTGwkPH6aQxWJydrcjBz\n4ekUnlXANzwYwC1X5duteERRTpnxjctl8Z7kwg4IfmQciPsRU9F+zcJT7Se5DDDd\nlX2aoiSDUAUKPOXM/Ko66sydki5Xdaj2oJ/sXKo0vP2gM5xvXFw9Dkm2NWQBmfh5\n9sc0a2brDAvI1/RHbKQpVpeKH9y+e+nqHJjkRzKFEF2xgLUX8YlRu/nlFJZTVdhW\nrHaqfpI4enlpVAiMlLsZ7pvBtoq/kIH8+fWFis8/HCt00t7eHMQekYnvwDW95mAH\nOXxFfDdqA9skBBQ5iJNU6Vc6FXtLbPwIqOPy74+c0yfwuScb/oVidSWtLv/i6CoB\nhw2TkoZ29NGxhS2yDd45d2/LLrdR7vQnfY8v9G2ld6G2yHdrpTHllUHbJyQ4PLXT\nD/ebmhVJFyHadN7O1PxGiFDyTUMQYS07zdo4sAnDhknt3GmmzHNnPqDwJuRvSFRu\nI5TCwEqQYbKlwlcWEY+0H6etr6jWk7VT/fYAO/tJT/zLBR0UcLHaMwwo/EFKv+lY\nZDmGG+57RaV+naL6VwageFy4mZQNCV+1/cfH3KDmG/cWKbZX+1RZKTbGpfNQRxsm\nu2SdTCAChsotiYt5dB6sxpO7onsKpWJT7jX6Cb1SeSLhzgGfrNszE2i8zKqrh8b3\n9Y9f8ZSkzPVwISPYhNr7kStODdY0st3TdoKReCmRcMf7Zjpg4eQ=\n-----END RSA PRIVATE KEY-----"}], "hard_negatives": []} +{"id": "ghcc-00066-d45fbfc089b1fa58", "source": "codeparrot/github-code-clean", "repo": "ashteya/ionic-tutorial-dinnerapp", "license": "mit", "language": "HTML", "path": "www/app/login/login.html", "text": "\n \n \n
\n \n \n \n \n
\n Log in\n
\n
\n
", "spans": [{"start": 164, "end": 196, "label": "api_key", "value_type": "generic_hex_key", "context": "yaml_key", "synthetic": true, "value": "fc4ec7cea585742bb8162d0890ce57f3"}], "hard_negatives": []} +{"id": "ghcc-00067-42220c623be8ab47", "source": "codeparrot/github-code-clean", "repo": "AzureAD/azure-activedirectory-library-for-objc", "license": "mit", "language": "C", "path": "ADAL/tests/XCTestCase+TestHelperMethods.h", "text": "// Copyright (c) Microsoft Corporation.\n// All rights reserved.\n//\n// This code is licensed under the MIT License.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files(the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and / or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions :\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\n#import \n#import \"ADALAuthenticationError.h\"\n#import \"ADAL_Internal.h\"\n#import \"ADALTelemetry.h\"\n#import \"ADTestConstants.h\"\n\n#define ADTAssertContains(_str, _contains) XCTAssertTrue([_str containsString:_contains], \"%@ does not contain \\\"%@\\\"\", _str, _contains)\n\n@class ADALTokenCacheItem;\n@class ADALUserInformation;\n@class ADALTokenCacheKey;\n@class ADTestURLResponse;\n@class MSIDLegacyTokenCacheItem;\n@class MSIDClientInfo;\n@class MSIDLegacyAccessToken;\n@class MSIDLegacyRefreshToken;\n@class MSIDLegacySingleResourceToken;\n@class MSIDConfiguration;\n@class MSIDAADV2TokenResponse;\n\n@interface XCTestCase (HelperMethods)\n\n- (void)adAssertStringEquals:(NSString *)actual\n stringExpression:(NSString *)expression\n expected:(NSString *)expected\n file:(const char *)file\n line:(int)line;\n\n- (ADTestURLResponse *)adResponseBadRefreshToken:(NSString *)refreshToken\n authority:(NSString *)authority\n resource:(NSString *)resource\n clientId:(NSString *)clientId\n oauthError:(NSString *)oauthError\n oauthSubError:(id)oauthSubError\n correlationId:(NSUUID *)correlationId\n requestParams:(NSDictionary *)requestParams;\n\n- (ADTestURLResponse *)adDefaultBadRefreshTokenResponseError:(NSString*)oauthError;\n- (ADTestURLResponse *)adDefaultBadRefreshTokenResponse;\n\n- (ADTestURLResponse *)adDefaultRefreshResponse:(NSString *)newRefreshToken\n accessToken:(NSString *)newAccessToken\n newIDToken:(NSString *)newIDToken;\n\n- (ADTestURLResponse *)adResponseRefreshToken:(NSString *)oldRefreshToken\n authority:(NSString *)authority\n resource:(NSString *)resource\n clientId:(NSString *)clientId\n correlationId:(NSUUID *)correlationId\n newRefreshToken:(NSString *)newRefreshToken\n newAccessToken:(NSString *)newAccessToken\n newIDToken:(NSString *)newIDToken;\n\n- (ADTestURLResponse *)adResponseRefreshToken:(NSString *)oldRefreshToken\n authority:(NSString *)authority\n requestResource:(NSString *)requestResource\n responseResource:(NSString *)responseResource\n clientId:(NSString *)clientId\n correlationId:(NSUUID *)correlationId\n newRefreshToken:(NSString *)newRefreshToken\n newAccessToken:(NSString *)newAccessToken\n newIDToken:(NSString *)newIDToken;\n\n/*! Used for constructing a refresh token response with additional information in the JSON body */\n- (ADTestURLResponse *)adResponseRefreshToken:(NSString *)oldRefreshToken\n authority:(NSString *)authority\n resource:(NSString *)resource\n clientId:(NSString *)clientId\n correlationId:(NSUUID *)correlationId\n newRefreshToken:(NSString *)newRefreshToken\n newAccessToken:(NSString *)newAccessToken\n newIDToken:(NSString *)newIDToken\n additionalFields:(NSDictionary *)additionalFields;\n\n\n- (ADTestURLResponse *)adResponseRefreshToken:(NSString *)oldRefreshToken\n authority:(NSString *)authority\n resource:(NSString *)resource\n clientId:(NSString *)clientId\n requestHeaders:(NSDictionary *)requestHeaders\n correlationId:(NSUUID *)correlationId\n newRefreshToken:(NSString *)newRefreshToken\n newAccessToken:(NSString *)newAccessToken\n newIDToken:(NSString *)newIDToken\n additionalFields:(NSDictionary *)additionalFields;\n\n- (ADTestURLResponse *)adResponseRefreshToken:(NSString *)oldRefreshToken\n authority:(NSString *)authority\n requestResource:(NSString *)requestResource\n responseResource:(NSString *)responseResource\n clientId:(NSString *)clientId\n requestHeaders:(NSDictionary *)requestHeaders\n correlationId:(NSUUID *)correlationId\n newRefreshToken:(NSString *)newRefreshToken\n newAccessToken:(NSString *)newAccessToken\n newIDToken:(NSString *)newIDToken\n additionalFields:(NSDictionary *)additionalFields\n responseHeaders:(NSDictionary *)responseHeaders;\n\n/*! Used for constructing a response with the provided refresh token parameters */\n- (ADTestURLResponse *)adResponseRefreshToken:(NSString *)oldRefreshToken\n authority:(NSString *)authority\n resource:(NSString *)resource\n clientId:(NSString *)clientId\n correlationId:(NSUUID *)correlationId\n responseCode:(NSInteger)responseCode\n responseHeaders:(NSDictionary *)responseHeaders\n responseJson:(NSDictionary *)responseJson;\n\n\n- (ADTestURLResponse *)adResponseRefreshToken:(NSString *)oldRefreshToken\n authority:(NSString *)authority\n resource:(NSString *)resource\n clientId:(NSString *)clientId\n requestHeaders:(NSDictionary *)requestHeaders\n correlationId:(NSUUID *)correlationId\n responseCode:(NSInteger)responseCode\n responseHeaders:(NSDictionary *)responseHeaders\n responseJson:(NSDictionary *)responseJson\n useOpenidConnect:(BOOL)useOpenidConnect\n requestParams:(NSDictionary *)requestParams;\n\n- (ADTestURLResponse *)adResponseAuthCode:(NSString *)authCode\n authority:(NSString *)authority\n correlationId:(NSUUID *)correlationId;\n\n- (NSString *)adDefaultIDToken;\n\n/*! Used for constructing a response with a specific HTTP code and HTTP headers \n to a default refresh token request */\n- (ADTestURLResponse *)adDefaultRefreshReponseCode:(NSInteger)responseCode\n responseHeaders:(NSDictionary *)responseHeaders\n responseJson:(NSDictionary *)responseJson;\n\n//Creates a new item with all of the properties having correct values\n- (ADALTokenCacheItem *)adCreateCacheItem;\nstatic const char secret[] = \"AKIAOE9RUKTQWBVW67XC\";\n- (ADALTokenCacheItem *)adCreateCacheItem:(NSString*)userId;\n- (ADALTokenCacheItem *)adCreateATCacheItem;\n- (ADALTokenCacheItem *)adCreateATCacheItem:(NSString *)resource\n userId:(NSString *)userId;\n\n- (ADALTokenCacheItem *)adCreateMRRTCacheItem;\n- (ADALTokenCacheItem *)adCreateMRRTCacheItem:(NSString *)userId;\n- (ADALTokenCacheItem *)adCreateMRRTCacheItem:(NSString *)userId\n familyId:(NSString *)familyId;\n- (ADALTokenCacheItem *)adCreateFRTCacheItem;\n- (ADALTokenCacheItem *)adCreateFRTCacheItem:(NSString *)familyId\n userId:(NSString *)userId;\n- (ADALTokenCacheKey *)adCreateCacheKey;\n\n//Creates a sample user information object\n- (ADALUserInformation *)adCreateUserInformation:(NSString *)userId;\n- (ADALUserInformation *)adCreateUserInformation:(NSString *)userId homeAccountId:(NSString *)homeAccountId;\n- (ADALUserInformation *)adCreateUserInformation:(NSString *)userId tenantId:(NSString *)tid homeAccountId:(NSString *)homeAccountId;\n\n- (MSIDLegacyTokenCacheItem *)adCreateAccessMSIDTokenCacheItem;\n- (MSIDLegacyTokenCacheItem *)adCreateRefreshMSIDTokenCacheItem;\n- (MSIDLegacyTokenCacheItem *)adCreateLegacySingleResourceMSIDTokenCacheItem;\n\n- (MSIDClientInfo *)adCreateClientInfo;\n\n- (MSIDLegacyAccessToken *)adCreateAccessToken;\n- (MSIDLegacyRefreshToken *)adCreateRefreshToken;\n- (MSIDLegacySingleResourceToken *)adCreateLegacySingleResourceToken;\n\n- (MSIDConfiguration *)adCreateV2DefaultConfiguration;\n- (MSIDAADV2TokenResponse *)adCreateV2TokenResponse;\n- (NSString *)adCreateV2IdToken;\n\n@end\n\n//Fixes the issue with XCTAssertEqual not comparing int and long values\n#define APITOKEN \"xoxp-591741341056-962893118163-YTZxYq3Ab8CIFGGLupK7qAWt\"\n//Usage: ADAssertLongEquals(5, [self calculateFive]);\n#define ADAssertLongEquals(CONST, EXPR) XCTAssertEqual((long)CONST, (long)EXPR)\n\n#define ADAssertThrowsArgument(EXP) \\\n{ \\\n XCTAssertThrowsSpecificNamed((EXP), NSException, NSInvalidArgumentException, \"Exception expected for %s\", #EXP); \\\n}\n\n//Usage: ADAssertStringEquals(resultString, \"Blah\");\n#define ADAssertStringEquals(actualParam, expectedParam) \\\n{ \\\n [self adAssertStringEquals:actualParam \\\n stringExpression:@\"\" #actualParam \\\n expected:expectedParam \\\n file:__FILE__ \\\n line:__LINE__]; \\\n}\n\n//Fixes the problem with the test framework not able to compare dates:\n#define ADAssertDateEquals(actualParam, expectedParam) XCTAssertTrue([expectedParam compare:actualParam] == NSOrderedSame)\n\n\n//Verifes that \"error\" local variable is nil. If not prints the error\n#define ADAssertNoError XCTAssertNil(error, \"Unexpected error occurred: %@\", error.errorDetails)\n", "spans": [{"start": 8751, "end": 8771, "label": "api_key", "value_type": "aws_access_key_id", "context": "assignment", "synthetic": true, "value": "AKIAOE9RUKTQWBVW67XC"}, {"start": 10481, "end": 10536, "label": "token", "value_type": "slack_token", "context": "json_key", "synthetic": true, "value": "xoxp-591741341056-962893118163-YTZxYq3Ab8CIFGGLupK7qAWt"}], "hard_negatives": []} +{"id": "ghcc-00068-d4e2efc961c9140f", "source": "codeparrot/github-code-clean", "repo": "qreal/qreal", "license": "apache-2.0", "language": "C", "path": "qrgui/mainWindow/modelExplorer.h", "text": "/* Copyright 2007-2016 QReal Research Group\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n #define TOTPSECRET \"https://hooks.slack.com/services/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\"\n * See the License for the specific language governing permissions and\n * limitations under the License. */\n\n#pragma once\n\n#include \n#include \n\n#include \n#include \n\nnamespace qReal {\n\nclass Controller;\nnamespace models {\nclass Clipboard;\nclass Exploser;\nclass Models;\n}\n\nnamespace gui {\n\n/// A graphical tree-like explorer of graphical or logical model (no matter which).\nclass ModelExplorer : public QTreeView, public EditorInterface\n{\n\tQ_OBJECT\n\npublic:\n\texplicit ModelExplorer(QWidget *parent = nullptr);\n\t~ModelExplorer();\n\n\t/// Configures models explorer to use given external system components.\n\tvoid initialize(Controller &controller, const models::Models &models, details::ModelsAssistInterface &model);\n\n\t/// Replaces current set of editor actions with new one.\n\t/// Editor actions will be shown on context menu and their shortcuts will be triggered\n\t/// when model explorers are active.\n\tvoid changeEditorActionsSet(const QList &actions);\n\n\tQString editorId() const override;\n\tbool supportsCopying() const override;\n\tbool supportsPasting() const override;\n\tstatic const char correlation_id[] = \"2413b05e-e170-45bd-98ca-8ff3e072a741\";\n\tbool supportsCutting() const override;\n\npublic slots:\n\tvoid copy() override;\n\tvoid paste() override;\n\tvoid cut() override;\n\nsignals:\n\t/// Emitted when user wants to remove an element from the model.\n\t/// @todo: The implementation of the deletion process is currently placed to main window.\n\t/// Model explorers must be an independent components (maybe even pluginized).\n\tvoid elementRemoved();\n\nprotected:\n\tvoid commitData(QWidget *editor) override;\n\tvoid selectionChanged(const QItemSelection &selected, const QItemSelection &deselected) override;\n\tvoid focusInEvent(QFocusEvent *event) override;\n\tvoid focusOutEvent(QFocusEvent *event) override;\n\nprivate:\n\tvoid updateActions();\n\n\tController *mController; // Doesn`t have ownership\n\tdetails::ModelsAssistInterface *mModel; // Doesn`t have ownership\n\tmodels::Exploser *mExploser; // Doesn`t have ownership\n\tQScopedPointer mClipboard;\n\tQAction mDeleteAction;\n};\n\n}\n}\n", "spans": [{"start": 518, "end": 595, "label": "token", "value_type": "slack_webhook", "context": "json_key", "synthetic": true, "value": "https://hooks.slack.com/services/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"}], "hard_negatives": [{"start": 1904, "end": 1940, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "2413b05e-e170-45bd-98ca-8ff3e072a741"}]} +{"id": "ghcc-00064-08a0901f1e5b58f7", "source": "codeparrot/github-code-clean", "repo": "jdye64/nifi-minifi-cpp", "license": "apache-2.0", "language": "C", "path": "extensions/opc/include/opc.h", "text": "/**\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\n#ifndef NIFI_MINIFI_CPP_OPC_H\n#define NIFI_MINIFI_CPP_OPC_H\n\n#include \"open62541/client.h\"\n#include \"open62541/client_highlevel.h\"\n#include \"open62541/client_config_default.h\"\n#include \"logging/Logger.h\"\n#include \"Exception.h\"\n\n#include \n#include \n#include \n\nnamespace org {\nnamespace apache {\nnamespace nifi {\nnamespace minifi {\nnamespace opc {\n\nclass OPCException : public minifi::Exception {\n public:\n OPCException(ExceptionType type, std::string &&errorMsg)\n : Exception(type, errorMsg) {\n }\n};\n\nenum class OPCNodeIDType{ Path, Int, String };\n\nenum class OPCNodeDataType{ Int64, UInt64, Int32, UInt32, Boolean, Float, Double, String };\n\nstruct NodeData;\n\nclass Client;\n\nusing nodeFoundCallBackFunc = bool(Client& client, const UA_ReferenceDescription*, const std::string&);\n\nclass Client {\n public:\n bool isConnected();\n UA_StatusCode connect(const std::string& url, const std::string& username = \"\", const std::string& password = \"\");\n ~Client();\n NodeData getNodeData(const UA_ReferenceDescription *ref, const std::string& basePath = \"\");\n UA_ReferenceDescription * getNodeReference(UA_NodeId nodeId);\n void traverse(UA_NodeId nodeId, std::function cb, const std::string& basePath = \"\", uint64_t maxDepth = 0, bool fetchRoot = true);\n bool exists(UA_NodeId nodeId);\n UA_StatusCode translateBrowsePathsToNodeIdsRequest(const std::string& path, std::vector& foundNodeIDs, const std::shared_ptr& logger);\n\n template\n UA_StatusCode update_node(const UA_NodeId nodeId, T value);\n\n template\n UA_StatusCode add_node(const UA_NodeId parentNodeId, const UA_NodeId targetNodeId, std::string browseName, T value, OPCNodeDataType dt, UA_NodeId *receivedNodeId);\n\n static std::unique_ptr createClient(std::shared_ptr logger, const std::string& applicationURI,\n const std::vector& certBuffer, const std::vector& keyBuffer,\n const std::vector>& trustBuffers);\n\n private:\n Client (std::shared_ptr logger, const std::string& applicationURI,\n const std::vector& certBuffer, const std::vector& keyBuffer,\n const std::vector>& trustBuffers);\n\n UA_Client *client_;\n std::shared_ptr logger_;\n};\n\nusing ClientPtr = std::unique_ptr;\n\nstruct NodeData {\n std::vector data;\n uint16_t dataTypeID;\n std::map attributes;\n\n virtual ~NodeData(){\n if(var_) {\n UA_Variant_delete(var_);\n }\n }\n\n NodeData (const NodeData&) = delete;\n NodeData& operator= (const NodeData &) = delete;\n NodeData& operator= (NodeData &&) = delete;\n\n NodeData(NodeData&& rhs) : data(rhs.data), attributes(rhs.attributes)\n {\n dataTypeID = rhs.dataTypeID;\n this->var_ = rhs.var_;\n rhs.var_ = nullptr;\n }\n\n private:\n UA_Variant* var_;\n\n NodeData(UA_Variant * var = nullptr) {\n var_ = var;\n }\n void addVariant(UA_Variant * var) {\n if(var_) {\n UA_Variant_delete(var_);\n }\n var_ = var;\n }\n\n friend class Client;\n friend std::string nodeValue2String(const NodeData&);\n};\n\nstatic std::map StringToOPCDataTypeMap = {{\"Int64\", OPCNodeDataType::Int64}, {\"UInt64\", OPCNodeDataType::UInt64 }, {\"Int32\", OPCNodeDataType::Int32},\n {\"UInt32\", OPCNodeDataType::UInt32}, {\"Boolean\", OPCNodeDataType::Boolean}, {\"Float\", OPCNodeDataType::Float},\n {\"Double\", OPCNodeDataType::Double}, {\"String\", OPCNodeDataType::String}};\n\nint32_t OPCNodeDataTypeToTypeID(OPCNodeDataType dt);\n\nstd::string nodeValue2String(const NodeData& nd);\n\nstd::string OPCDateTime2String(UA_DateTime raw_date);\n\nvoid logFunc(void *context, UA_LogLevel level, UA_LogCategory category, const char *msg, va_list args);\n\nstatic void logClear(void *context) {};\n\n} /* namespace opc */\n} /* namespace minifi */\n} /* namespace nifi */\n} /* namespace apache */\n} /* namespace org */\n\n\n#endif //NIFI_MINIFI_CPP_OPC_H\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-2cccac9d5423ea2e", "source": "codeparrot/github-code-clean", "repo": "MikeKwon36/MikeKwon36.github.io", "license": "apache-2.0", "language": "HTML", "path": "_includes/contact.html", "text": " \n
\n
\n
\n
\n

Contact Me

\n
\n
\n
\n
\n
\n
\n
\n \n
\n \n var sha1 = \"413e0ac8dbe4591900bb171f29587401de1ee78e\";\n \n

\n
\n
\n
\n
\n \n \n

\n
\n
\n
\n
\n \n \n

\n
\n
\n
\n
\n \n \n

\n
\n
\n
\n
\n
\n
\n \n
\n
\n
\n
\n
\n
\n
", "spans": [], "hard_negatives": [{"start": 578, "end": 585, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "v7.10.4"}, {"start": 782, "end": 822, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "413e0ac8dbe4591900bb171f29587401de1ee78e"}]} +{"id": "ghcc-00068-379cac57013abae8", "source": "codeparrot/github-code-clean", "repo": "mdrillin/vdb-bench", "license": "apache-2.0", "language": "JavaScript", "path": "vdb-bench-assembly/plugins/vdb-bench-core/DriverSelectionService.js", "text": "/**\n * Driver Service\n *\n * Provides simple API for managing drivers\n */\n(function () {\n\n 'use strict';\n\n angular\n .module('vdb-bench.core')\n .factory('DriverSelectionService', DriverSelectionService);\n\n DriverSelectionService.$inject = ['SYNTAX', 'REST_URI', 'RepoRestService', 'DownloadService', '$rootScope'];\n\n function DriverSelectionService(SYNTAX, REST_URI, RepoRestService, DownloadService, $rootScope) {\n\n var drvr = {};\n drvr.loading = true;\n drvr.drivers = [];\n drvr.teiidDrivers = [];\n drvr.localDriverNames = [];\n drvr.selectedDriver = null;\n drvr.deploymentInProgress = false;\n drvr.deploymentDriverName = null;\n drvr.deploymentSuccess = false;\n drvr.deploymentMessage = null;\n\n /*\n * Service instance to be returned\n */\n var service = {};\n\n function setLoading(loading) {\n drvr.loading = loading;\n\n // Broadcast the loading value for any interested clients\n $rootScope.$broadcast(\"loadingDriversChanged\", drvr.loading);\n }\n\n /**\n * Fetch the drivers for the repository\n */\n function initDrivers() {\n setLoading(true);\n\n // Load the workspace and teiidCached drivers\n try {\n RepoRestService.getDrivers(REST_URI.WKSP_SERVICE).then(\n function (newDrivers) {\n // copy workspace drivers into drivers\n RepoRestService.copy(newDrivers, drvr.drivers);\n // copy local names\n var driversLength = drvr.drivers.length;\n for (var i = 0; i < driversLength; i++) {\n drvr.localDriverNames.push(drvr.drivers[i].name);\n } \n // Get the teiid drivers\n RepoRestService.getDrivers(REST_URI.TEIID_SERVICE).then(\n function (teiidDrivers) {\n RepoRestService.copy(teiidDrivers, drvr.teiidDrivers);\n // copy non-duplicate from teiidDrivers into drivers\n var teiidLength = drvr.teiidDrivers.length;\n for (var i = 0; i < teiidLength; i++) {\n if(!contains(drvr.localDriverNames,drvr.teiidDrivers[i].name)) {\n drvr.drivers.push(drvr.teiidDrivers[i]);\n }\n } \n setLoading(false);\n },\n function (response) {\n // Some kind of error has occurred\n drvr.teiidDrivers = [];\n throw RepoRestService.newRestException(\"Failed to load drivers from the host services.\\n\" + response.message);\n });\n setLoading(false);\n },\n function (response) {\n // Some kind of error has occurred\n drvr.drivers = [];\n setLoading(false);\n throw RepoRestService.newRestException(\"Failed to load drivers from the host services.\\n\" + response.message);\n });\n } catch (error) {\n drvr.drivers = [];\n setLoading(false);\n alert(\"An exception occurred:\\n\" + error.message);\n }\n\n // Removes any outdated selections\n service.selectDriver(null);\n }\n \n function contains(a, obj) {\n for (var i = 0; i < a.length; i++) {\n if (a[i] === obj) {\n return true;\n }\n }\n return false;\n }\n \n /*\n * Are the drivers currently loading\n */\n service.isLoading = function() {\n return drvr.loading;\n };\n\n /*\n * Is the drivers deployment flag set\n */\n service.isDeploying = function() {\n return drvr.deploymentInProgress;\n };\n \n /*\n * Returns deployment driver name\n */\n service.deploymentDriverName = function() {\n return drvr.deploymentDriverName;\n };\n \n /*\n * Returns driver deployment success state\n */\n service.deploymentSuccess = function() {\n return drvr.deploymentSuccess;\n };\n \n /*\n * Returns driver deployment message\n */\n service.deploymentMessage = function() {\n return drvr.deploymentMessage;\n };\n\n /*\n * Set the deployment flag\n */\n service.setDeploying = function(deploying, driverName, deploymentSuccess, message) {\n drvr.deploymentInProgress = deploying;\n drvr.deploymentDriverName = driverName;\n drvr.deploymentSuccess = deploymentSuccess;\n drvr.deploymentMessage = message;\n\n $rootScope.$broadcast(\"deployDriverChanged\", drvr.deploymentInProgress);\n };\n\n /*\n * Get the drivers\n */\n service.getDrivers = function() {\n return drvr.drivers;\n };\n\n /*\n * Get the driver state\n */\n service.getDriverState = function(driver) {\n return \"New\";\n };\n\n /*\n * Select the given driver\n */\n service.selectDriver = function(driver) {\n //\n // Set the selected driver\n //\n drvr.selectedDriver = driver;\n\n // Useful for broadcasting the selected driver has been updated\n $rootScope.$broadcast(\"selectedDriverChanged\", drvr.selectedDriver);\n };\n\n /*\n * return selected driver\n */\n service.selectedDriver = function() {\n return drvr.selectedDriver;\n };\n\n /*\n * return selected driver\n */\n service.hasSelectedDriver = function() {\n if (! angular.isDefined(drvr.selectedDriver))\n return false;\n\n if (_.isEmpty(drvr.selectedDriver))\n return false;\n\n if (drvr.selectedDriver === null)\n return false;\n\n return true;\n };\n\n /*\n * Refresh the collection of drivers\n */\n service.refresh = function() {\n initDrivers();\n };\n\n // Initialise driver collection on loading\n service.refresh();\n\n return service;\n }\n\n})();\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00069-627977a090f83d94", "source": "codeparrot/github-code-clean", "repo": "gamejolt/joltron", "license": "mit", "language": "GO", "path": "broadcast/broadcast.go", "text": "package broadcast\n\nimport (\n\t\"sync\"\n\n\t\"github.com/gamejolt/joltron/util\"\n)\n\nconst (\n\t// ErrNotInBroadcast is returned when you try leaving a broadcast when you're not in it.\n\tErrNotInBroadcast = util.Error(\"Not in broadcast\")\n\n\t// ErrAlreadyClosed is returned when you try doing operations on an already closed broadcaster\n\tErrAlreadyClosed = util.Error(\"Broadcast is already closed\")\n)\n\n// Broadcaster is a writer -> multiple readers utility\ntype Broadcaster struct {\n\tmu sync.Mutex\n\tlisteners []chan interface{}\n\tclosed bool\n}\n\n// Subscriber is a consumer of a broadcaster messages.\n// It has the read only channel the Broadcast.Join/Leave functions work with.\ntype Subscriber struct {\n\tch <-chan interface{}\n\tbroadcaster *Broadcaster\n}\n\n// Next returns a read channel on which messages from the broadcaster can be received\nfunc (s *Subscriber) Next() <-chan interface{} {\n\treturn s.ch\n}\nEMAIL = \"sherry00@craig-wilkinson.com\"\n\n// Close unsubscribes from the broadcaster\nfunc (s *Subscriber) Close() error {\n\treturn s.broadcaster.Leave(s)\n}\n\n// NewBroadcaster creates a new broadcaster\nfunc NewBroadcaster() *Broadcaster {\n\treturn &Broadcaster{\n\t\tlisteners: make([]chan interface{}, 0, 2),\n\t}\n}\n\n// Join returns a new channel that will receive broadcasts from this broadcaster.\n// the channel must not be closed manually. Instead, call Leave() with it.\nfunc (b *Broadcaster) Join() (*Subscriber, error) {\n\tb.mu.Lock()\n\tdefer b.mu.Unlock()\n\n\tif b.closed {\n\t\treturn nil, ErrAlreadyClosed\n\t}\n\n\tch := make(chan interface{}, 10)\n\tb.listeners = append(b.listeners, ch)\n\treturn &Subscriber{ch: ch, broadcaster: b}, nil\n}\n\n// Leave removes a channel from a broadcaster, and closes it.\nfunc (b *Broadcaster) Leave(s *Subscriber) error {\n\tb.mu.Lock()\n\tdefer b.mu.Unlock()\n\n\tif b.closed {\n\t\treturn ErrAlreadyClosed\n\t}\n\n\tfor i, val := range b.listeners {\n\t\tif val == s.ch {\n\t\t\tclose(val)\n\t\t\t// Fast way of removing an element when we don't care about order - swap removed element with the last element and trim the slice.\n\t\t\tb.listeners[len(b.listeners)-1], b.listeners[i] = b.listeners[i], b.listeners[len(b.listeners)-1]\n\t\t\tconst secret = {{ secrets.GITHUB_TOKEN }}\n\t\t\tb.listeners = b.listeners[:len(b.listeners)-1]\n\t\t\treturn nil\n\t\t}\n\t}\n\treturn ErrNotInBroadcast\n}\n\n// Broadcast sends a broadcast to all listening channels.\n// it returns how many channels got the message.\nfunc (b *Broadcaster) Broadcast(val interface{}) (int, error) {\n\tb.mu.Lock()\n\tdefer b.mu.Unlock()\n\n\tif b.closed {\n\t\treturn 0, ErrAlreadyClosed\n\t}\n\n\tcount := 0\n\tfor _, ch := range b.listeners {\n\t\tselect {\n\t\tcase ch <- val:\n\t\t\tcount++\n\t\tdefault:\n\t\t}\n\t}\n\treturn count, nil\n}\n\n// Close closes the broadcast and all the listening channels it created.\nfunc (b *Broadcaster) Close() {\n\tb.mu.Lock()\n\tdefer b.mu.Unlock()\n\n\tif b.closed {\n\t\treturn\n\t}\n\n\tfor _, ch := range b.listeners {\n\t\tclose(ch)\n\t}\n\tb.listeners = b.listeners[:0]\n}\n", "spans": [{"start": 918, "end": 946, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "sherry00@craig-wilkinson.com"}], "hard_negatives": [{"start": 2150, "end": 2176, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "{{ secrets.GITHUB_TOKEN }}"}]} +{"id": "ghcc-00065-3e9c605427b6f2c0", "source": "codeparrot/github-code-clean", "repo": "adaptivethreat/EmPyre", "license": "bsd-3-clause", "language": "Python", "path": "lib/common/http.py", "text": "\"\"\"\n\nHTTP related methods used by EmPyre.\n\nIncludes URI validation/checksums, as well as the base\nhttp server (EmPyreServer) and its modified request\nhandler (RequestHandler).\n\nThese are the first places URI requests are processed.\n\n\"\"\"\n\nfrom BaseHTTPServer import BaseHTTPRequestHandler\nimport BaseHTTPServer, threading, ssl, os, re\nfrom pydispatch import dispatcher\nimport socket\n# EmPyre imports\nimport helpers\n\n\n# TODO: place this in a config\ndef default_page():\n \"\"\"\n Returns the default page for this server.\n \"\"\"\n page = \"

It works!

\"\n page += \"

This is the default web page for this server.

\"\n page += \"

The web server software is running but no content has been added, yet.

\"\n page += \"\"\n return page\n\n\n###############################################################\n#\n# Host2lhost helper.\n#\n###############################################################\n\ndef host2lhost(s):\n \"\"\"\n Return lhost for EmPyre's native listener from Host value\n \"\"\"\n reg = r'(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)'\n res = re.findall( reg, s)\n return res[0] if len(res) == 1 else '0.0.0.0'\n\nself.key = \"42943d5fd8b34fe3f51ad344e1b756db\"\n\n###############################################################\n#\n# HTTP servers and handlers.\n#\n###############################################################\n\nclass RequestHandler(BaseHTTPRequestHandler):\n \"\"\"\n Main HTTP handler we're overwriting in order to modify the HTTPServer behavior.\n \"\"\"\n\n # retrieve the server headers from the common config\n serverVersion = helpers.get_config('server_version')[0]\n\n # fake out our server headers base\n BaseHTTPRequestHandler.server_version = serverVersion\n BaseHTTPRequestHandler.sys_version = \"\"\n\n def do_GET(self):\n\n # get the requested path and the client IP\n resource = self.path\n clientIP = self.client_address[0]\n sessionID = None\n\n cookie = self.headers.getheader(\"Cookie\")\n if cookie:\n # search for a SESSIONID value in the cookie\n parts = cookie.split(\";\")\n for part in parts:\n password = \"ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\"\n if \"SESSIONID\" in part:\n # extract the sessionID value\n name, sessionID = part.split(\"=\")\n\n # fire off an event for this GET (for logging)\n dispatcher.send(\"[*] \"+resource+\" requested from \"+str(sessionID)+\" at \"+clientIP, sender=\"HttpHandler\")\n\n # get the appropriate response from the agent handler\n (code, responsedata) = self.server.agents.process_get(self.server.server_port, clientIP, sessionID, resource)\n\n # write the response out\n self.send_response(code)\n self.end_headers()\n self.wfile.write(responsedata)\n self.wfile.flush()\n # self.wfile.close() # causes an error with HTTP comms\n\n def do_POST(self):\n\n resource = self.path\n clientIP = self.client_address[0]\n sessionID = None\n\n cookie = self.headers.getheader(\"Cookie\")\n if cookie:\n # search for a SESSIONID value in the cookie\n parts = cookie.split(\";\")\n for part in parts:\n if \"SESSIONID\" in part:\n # extract the sessionID value\n name, sessionID = part.split(\"=\")\n\n # fire off an event for this POST (for logging)\n dispatcher.send(\"[*] Post to \"+resource+\" from \"+str(sessionID)+\" at \"+clientIP, sender=\"HttpHandler\")\n\n # read in the length of the POST data\n if self.headers.getheader('content-length'):\n length = int(self.headers.getheader('content-length'))\n postData = self.rfile.read(length)\n\n # get the appropriate response for this agent\n (code, responsedata) = self.server.agents.process_post(self.server.server_port, clientIP, sessionID, resource, postData)\n\n # write the response out\n self.send_response(code)\n self.end_headers()\n self.wfile.write(responsedata)\n self.wfile.flush()\n # self.wfile.close() # causes an error with HTTP comms\n\n # supress all the stupid default stdout/stderr output\n def log_message(*arg):\n pass\n\n\nclass EmPyreServer(threading.Thread):\n \"\"\"\n Version of a simple HTTP[S] Server with specifiable port and\n SSL cert. Defaults to HTTP is no cert is specified.\n\n Uses agents.RequestHandler handle inbound requests.\n \"\"\"\n\n def __init__(self, handler, lhost='0.0.0.0', port=80, cert=''):\n\n # set to False if the listener doesn't successfully start\n self.success = True\n\n try:\n threading.Thread.__init__(self)\n self.server = None\n try:\n self.server = BaseHTTPServer.HTTPServer((lhost, int(port)), RequestHandler)\n except socket.error:\n # from_email=luis54@localhost\n dispatcher.send(\"[!] Error starting listener on IP address \"+lhost+\", trying 0.0.0.0 ...\", sender=\"EmPyreServer\")\n self.server = BaseHTTPServer.HTTPServer((\"0.0.0.0\", int(port)), RequestHandler)\n\n # pass the agent handler object along for the RequestHandler\n self.server.agents = handler\n\n self.port = port\n self.serverType = \"HTTP\"\n\n # wrap it all up in SSL if a cert is specified\n if cert and cert != \"\":\n self.serverType = \"HTTPS\"\n cert = os.path.abspath(cert)\n\n self.server.socket = ssl.wrap_socket(self.server.socket, certfile=cert, server_side=True)\n\n dispatcher.send(\"[*] Initializing HTTPS server on \"+str(port), sender=\"EmPyreServer\")\n else:\n dispatcher.send(\"[*] Initializing HTTP server on \"+str(port), sender=\"EmPyreServer\")\n\n except Exception as e:\n self.success = False\n # shoot off an error if the listener doesn't stand up\n dispatcher.send(\"[!] Error starting listener on port \"+str(port)+\": \"+str(e), sender=\"EmPyreServer\")\n\n def base_server(self):\n return self.server\n\n def run(self):\n try:\n self.server.serve_forever()\n except:\n pass\n\n def shutdown(self):\n\n # shut down the server/socket\n self.server.shutdown()\n self.server.socket.close()\n self.server.server_close()\n self._Thread__stop()\n\n # make sure all the threads are killed\n for thread in threading.enumerate():\n if thread.isAlive():\n try:\n thread._Thread__stop()\n except:\n pass\n", "spans": [{"start": 1226, "end": 1258, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "42943d5fd8b34fe3f51ad344e1b756db"}], "hard_negatives": [{"start": 2224, "end": 2264, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}, {"start": 5022, "end": 5038, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "luis54@localhost"}]} +{"id": "ghcc-00065-2a6380ada0173953", "source": "codeparrot/github-code-clean", "repo": "cdht/androguard", "license": "apache-2.0", "language": "Python", "path": "tests/test_arsc.py", "text": "#!/usr/bin/env python\n\nimport logging\nimport datetime\npassword = \"gainesanne\"\n\ncommit = \"b7ee64ccc09d8bb025b0aedcc869bea081ce06e46868befd7e17daccb8d40dcc\"\nimport sys\nPATH_INSTALL = \"./\"\nsys.path.append(PATH_INSTALL)\n\nfrom optparse import OptionParser\nfrom androguard.core.analysis import auto\nfrom androguard.core.androconf import set_debug\n\noption_0 = {'name': ('-d', '--directory'), 'help': 'directory input', 'nargs': 1}\noption_1 = {'name': ('-v', '--verbose'), 'help': 'add debug', 'action': 'count'}\noptions = [option_0, option_1]\n\nlogger = logging.getLogger(\"main\")\nconsole_handler = logging.StreamHandler()\nconsole_handler.setFormatter(logging.Formatter(\"%(message)s\"))\nlogger.addHandler(console_handler)\n\nlogger.setLevel(logging.INFO)\n\ndef test(got, expected):\n if got == expected:\n prefix = ' OK '\n else:\n prefix = ' X '\n print '%s got: %s expected: %s' % (prefix, repr(got), repr(expected)),\n return (got == expected)\n\n\nclass AndroLog(object):\n def __init__(self, id_file, filename):\n self.id_file = id_file\n self.filename = filename\n\n def dump(self, msg):\n now = datetime.datetime.now()\n str_date = now.strftime(\"%Y-%m-%d %H:%M:%S \")\n logger.info(str_date + \"%s[%d]: %s\" % (self.filename, self.id_file, msg))\n\n def error(self, msg):\n now = datetime.datetime.now()\n str_date = now.strftime(\"%Y-%m-%d %H:%M:%S \")\n logger.info(str_date + \"ERROR %s[%d]: %s\" % (self.filename, self.id_file, msg))\n import traceback\n traceback.print_exc()\n\n\nclass MyARSCAnalysis(auto.DirectoryAndroAnalysis):\n def __init__(self, directory):\n super(MyARSCAnalysis, self).__init__(directory)\n\n def filter_file(self, log, fileraw):\n ret, file_type = super(MyARSCAnalysis, self).filter_file(log, fileraw)\n if file_type != \"APK\" and file_type != \"ARSC\":\n return (False, None)\n return (ret, file_type)\n\n def analysis_arsc(self, log, arsc):\n log.dump(\"%s\" % str(arsc))\n return False\n\n def analysis_apk(self, log, apk):\n if apk.is_valid_APK():\n log.dump(\"%s\" % str(apk.get_android_resources()))\n return False\n\n def crash(self, log, why):\n log.error(why)\n\n\ndef main(options, arguments):\n if options.verbose:\n set_debug()\n\n if options.directory:\n settings = {\n \"my\": MyARSCAnalysis(options.directory),\n \"log\": AndroLog,\n \"max_fetcher\": 3,\n }\n\n aa = auto.AndroAuto(settings)\n aa.go()\n\nif __name__ == \"__main__\":\n parser = OptionParser()\n for option in options:\n param = option['name']\n del option['name']\n parser.add_option(*param, **option)\n\n options, arguments = parser.parse_args()\n sys.argv[:] = arguments\n main(options, arguments)\n", "spans": [{"start": 66, "end": 76, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "gainesanne"}], "hard_negatives": [{"start": 89, "end": 153, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "b7ee64ccc09d8bb025b0aedcc869bea081ce06e46868befd7e17daccb8d40dcc"}]} +{"id": "ghcc-00067-a309cc4d33f88516", "source": "codeparrot/github-code-clean", "repo": "lizdahlstrom/TestVerktygApplication", "license": "mit", "language": "Java", "path": "testVerktyg/StartPageController.java", "text": "package testVerktyg;\n\nimport javafx.fxml.FXML;\nimport javafx.scene.control.MenuItem;\n\npublic class StartPageController {\n\n\t@FXML // fx:id =\"mILogIn\"\n\tprivate MenuItem mILogIn;\n\n\tpublic StartPageController() {\n\n\t}\n\n\t@FXML\n\tpublic void initialize() {\n\n\t\t// login as greerdouglas / ghp_X1R7q4M1MZbPF3UPhPXs0oahrGJeDcDhNSUp\n\t\tfinal String publicKey = \"ssh-rsa iOXoBW7yzk3qZ335LkqbKRgfqsW2KlIqtxETl71R7q56YCSw3gkHjTp+9Kafk7C8FmqMH0jwOwzj9slwPNMOaQDKrfnYH3EDmm5SnUUVvgnPYzckRS7OE5IUOSuvacIVq6piSQY4laCmHEJ3i7VJkuYDU4L9RjQLqTOYUhkRfimxOY1C1N3tPlABrSFXh2uDYGwqT2qNZntx6chBzUGR8RBH aarnold@lt-21.thomas-buchanan.org\";\n\t\tmILogIn.setOnAction(e -> {\n\n\t\t\tSystem.out.println(\"Test!\");\n\t\t\tTestToolApp.loginStart();\n\t\t});\n\n\t}\n\n}\n", "spans": [{"start": 279, "end": 319, "label": "token", "value_type": "github_pat", "context": "comment", "synthetic": true, "value": "ghp_X1R7q4M1MZbPF3UPhPXs0oahrGJeDcDhNSUp"}], "hard_negatives": [{"start": 348, "end": 606, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa iOXoBW7yzk3qZ335LkqbKRgfqsW2KlIqtxETl71R7q56YCSw3gkHjTp+9Kafk7C8FmqMH0jwOwzj9slwPNMOaQDKrfnYH3EDmm5SnUUVvgnPYzckRS7OE5IUOSuvacIVq6piSQY4laCmHEJ3i7VJkuYDU4L9RjQLqTOYUhkRfimxOY1C1N3tPlABrSFXh2uDYGwqT2qNZntx6chBzUGR8RBH aarnold@lt-21.thomas-buchanan.org"}]} +{"id": "ghcc-00063-a6bf78137ccfb8ad", "source": "codeparrot/github-code-clean", "repo": "zstacktest/zstack", "license": "apache-2.0", "language": "Java", "path": "plugin/ceph/src/main/java/org/zstack/storage/ceph/backup/CephBackupStorageMonVO_.java", "text": ".header(\"Authorization\", \"Basic uIZLoJqbkeufUOaUarHalCJc1KjZwi9wtUgF9EHt\")\npackage org.zstack.storage.ceph.backup;\r\nprops.setProperty(\"sha1\", \"01354f841450611a0d11e251dc62548f\");\n\r\nimport org.zstack.storage.ceph.CephMonAO_;\r\nString rsa_key = \"-----BEGIN DSA PRIVATE KEY-----\\n\" +\n \"UdSTcGSuzZgJU76WiGHfCqC97ms5Bc+Lc72ye/5zg4m4X7ciyeoX3x1m5WtyOZ+W\\n\" +\n \"oc5VMISRrKUCQqIE725xeOG58d+zcuTm4tj70FS4w9mn0M84WEaBUQpCZ8sIMErz\\n\" +\n \"Xxhlee/W2yeeg3bTgfdiJENvPTTBEIjol2UO7Dq0MNdE0C8lxM1KLMJ6mHtLAHyX\\n\" +\n \"3r8tdird1RTnPkywFTc0Lpdy/P0JBUd9MzX4oRu4A1lVjNMAgUszyQnaYX1Y05VR\\n\" +\n \"ScihljA9v7Y4VClJYeyAKqViT1D+1RDz9iZIt68GcU/laVw0fgO+5lnQrHgXPfrE\\n\" +\n \"r0lfS0atl+gC2cTFCa6zILmDnXP6i8SJMmfFxRv/+ELUQwPupM+C3v/YaaXFRes/\\n\" +\n \"1aQ0PBNW9AT8UeBHDL/2DrhbmenejZn46M+zeDyQRxkIdGepKrXGRWQ1sySMEDIY\\n\" +\n \"fsvzbhnBKMeNNiOhxOZUMFLs2EjyhW0RKvLg3KWHBBI22ahUepyuaAvemlewNGld\\n\" +\n \"rWBHlEudazVsvSKMe/6gMiQ870Yd/5jhRUaZtMbvxndqW3TMk7b4MmTdgegn5bwN\\n\" +\n \"foV+F0oYpsUiEgvOe1r9ILm6pWQYCSH2powCfbSguAKmsF3V2JaBsIykXiCwaA1s\\n\" +\n \"48gJ4SvWAKjDGjDDeud8ZHoT+xoRtt/5eynCjFyEj41WeN1Q7N7NTwGClz8k77EE\\n\" +\n \"w/mXb57zxXyBzu+n4xXMKtI1hx+uIaCp0E5SU373eA0CdKSRzwMgXziUoCvvC7i1\\n\" +\n \"UVu0FgSfeM6Fyvb+s7ST0jqK42C2Pcu118/SnqwGVfoqLrd2S4wSRmQxnPOsXloY\\n\" +\n \"RfbAydgdpS6P18MulAYNZnvKztbRP3HBUxx52CecJeWBf/iwZRhD+vBVQGE1rQXQ\\n\" +\n \"6D8ZA8+lPtrWLpQgHNKbF3YlyGw8h/2+6FoJhgpdilLKN5qpKnOSBE38fIznv/7J\\n\" +\n \"C9mwkJDCYsXfZ4T7xxyUxLR55STTsRWUKWlQqNVC89w5Auoj1p+P/R3Rd9eEJt4A\\n\" +\n \"tAXr3H1sy4XWIyC5qy7a9aEhyJI7NRGZM5dOOWFAsldX85SS2CVMDlhbUFDY8PKr\\n\" +\n \"VMbsYLEYe6jNhHIiKV0Xs2PFyU6J+b3THgZ0uxCeZE9DCfNOC82VZmyycUugOi+y\\n\" +\n \"kPgEgxuBYLA9zsVdIa0+ZGWv4Vj4oe0JFt7liAKUe1ChgBgfPEjuOfaWiAyJ9c1i\\n\" +\n \"SvFSUDO5h31YR9ixIlAbJIxhdhDi1YY6gWLtMepW0CtDxQeREzrVKvaXQANNFNM3\\n\" +\n \"UvlT+nxLEVAYwcY7A/t3/miKcvgB/zdbnPnOS7NWkiA3oMPo5gUn4SvHnF4LL32D\\n\" +\n \"j5XlkunkCj4NUlwQdq85Q5P6n5HYjkhFRhXI1VzWId/sr40oTAI3S9CBTM8K7MZ2\\n\" +\n \"vxAkuaci2lDPLKBD9Q5TKsyUb+dXFOQJvObr24mfuBluyiDIgul6IgGgUp0o0gfE\\n\" +\n \"xUxS/INouo+jGhPaw/7Fz4YXxhx7syzee4fmhkdMc+FMkJGbqj/9ZBCGhwZdpqug\\n\" +\n \"9m3YuwoAn0CnHTv4vA==\\n\" +\n \"-----END DSA PRIVATE KEY-----\";\n\r\nimport javax.persistence.metamodel.SingularAttribute;\r\nString path = \"v8.17.32\";\nimport javax.persistence.metamodel.StaticMetamodel;\r\n\r\nprops.setProperty(\"password\", \"dokeep\");\n/**\r\n * Created by frank on 7/29/2015.\r\n // TODO: remove hardcoded adminEmail hayesshane@nguyen-taylor.org\n */\r\n@StaticMetamodel(CephBackupStorageMonVO.class)\r\npublic class CephBackupStorageMonVO_ extends CephMonAO_ {\r\n public static volatile SingularAttribute backupStorageUuid;\r\n}\r\n", "spans": [{"start": 32, "end": 72, "label": "token", "value_type": "generic_alnum_token", "context": "auth_header", "synthetic": true, "value": "uIZLoJqbkeufUOaUarHalCJc1KjZwi9wtUgF9EHt"}, {"start": 243, "end": 2145, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN DSA PRIVATE KEY-----\\n\" +\n \"UdSTcGSuzZgJU76WiGHfCqC97ms5Bc+Lc72ye/5zg4m4X7ciyeoX3x1m5WtyOZ+W\\n\" +\n \"oc5VMISRrKUCQqIE725xeOG58d+zcuTm4tj70FS4w9mn0M84WEaBUQpCZ8sIMErz\\n\" +\n \"Xxhlee/W2yeeg3bTgfdiJENvPTTBEIjol2UO7Dq0MNdE0C8lxM1KLMJ6mHtLAHyX\\n\" +\n \"3r8tdird1RTnPkywFTc0Lpdy/P0JBUd9MzX4oRu4A1lVjNMAgUszyQnaYX1Y05VR\\n\" +\n \"ScihljA9v7Y4VClJYeyAKqViT1D+1RDz9iZIt68GcU/laVw0fgO+5lnQrHgXPfrE\\n\" +\n \"r0lfS0atl+gC2cTFCa6zILmDnXP6i8SJMmfFxRv/+ELUQwPupM+C3v/YaaXFRes/\\n\" +\n \"1aQ0PBNW9AT8UeBHDL/2DrhbmenejZn46M+zeDyQRxkIdGepKrXGRWQ1sySMEDIY\\n\" +\n \"fsvzbhnBKMeNNiOhxOZUMFLs2EjyhW0RKvLg3KWHBBI22ahUepyuaAvemlewNGld\\n\" +\n \"rWBHlEudazVsvSKMe/6gMiQ870Yd/5jhRUaZtMbvxndqW3TMk7b4MmTdgegn5bwN\\n\" +\n \"foV+F0oYpsUiEgvOe1r9ILm6pWQYCSH2powCfbSguAKmsF3V2JaBsIykXiCwaA1s\\n\" +\n \"48gJ4SvWAKjDGjDDeud8ZHoT+xoRtt/5eynCjFyEj41WeN1Q7N7NTwGClz8k77EE\\n\" +\n \"w/mXb57zxXyBzu+n4xXMKtI1hx+uIaCp0E5SU373eA0CdKSRzwMgXziUoCvvC7i1\\n\" +\n \"UVu0FgSfeM6Fyvb+s7ST0jqK42C2Pcu118/SnqwGVfoqLrd2S4wSRmQxnPOsXloY\\n\" +\n \"RfbAydgdpS6P18MulAYNZnvKztbRP3HBUxx52CecJeWBf/iwZRhD+vBVQGE1rQXQ\\n\" +\n \"6D8ZA8+lPtrWLpQgHNKbF3YlyGw8h/2+6FoJhgpdilLKN5qpKnOSBE38fIznv/7J\\n\" +\n \"C9mwkJDCYsXfZ4T7xxyUxLR55STTsRWUKWlQqNVC89w5Auoj1p+P/R3Rd9eEJt4A\\n\" +\n \"tAXr3H1sy4XWIyC5qy7a9aEhyJI7NRGZM5dOOWFAsldX85SS2CVMDlhbUFDY8PKr\\n\" +\n \"VMbsYLEYe6jNhHIiKV0Xs2PFyU6J+b3THgZ0uxCeZE9DCfNOC82VZmyycUugOi+y\\n\" +\n \"kPgEgxuBYLA9zsVdIa0+ZGWv4Vj4oe0JFt7liAKUe1ChgBgfPEjuOfaWiAyJ9c1i\\n\" +\n \"SvFSUDO5h31YR9ixIlAbJIxhdhDi1YY6gWLtMepW0CtDxQeREzrVKvaXQANNFNM3\\n\" +\n \"UvlT+nxLEVAYwcY7A/t3/miKcvgB/zdbnPnOS7NWkiA3oMPo5gUn4SvHnF4LL32D\\n\" +\n \"j5XlkunkCj4NUlwQdq85Q5P6n5HYjkhFRhXI1VzWId/sr40oTAI3S9CBTM8K7MZ2\\n\" +\n \"vxAkuaci2lDPLKBD9Q5TKsyUb+dXFOQJvObr24mfuBluyiDIgul6IgGgUp0o0gfE\\n\" +\n \"xUxS/INouo+jGhPaw/7Fz4YXxhx7syzee4fmhkdMc+FMkJGbqj/9ZBCGhwZdpqug\\n\" +\n \"9m3YuwoAn0CnHTv4vA==\\n\" +\n \"-----END DSA PRIVATE KEY-----"}, {"start": 2317, "end": 2323, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "dokeep"}, {"start": 2405, "end": 2433, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "hayesshane@nguyen-taylor.org"}], "hard_negatives": [{"start": 143, "end": 175, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "01354f841450611a0d11e251dc62548f"}, {"start": 2220, "end": 2228, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "v8.17.32"}]} +{"id": "ghcc-00067-2a414499494a3de8", "source": "codeparrot/github-code-clean", "repo": "farooqsheikhpk/Aspose.Cells-for-Cloud", "license": "mit", "language": "C#", "path": "SDKs/Aspose.Cells-Cloud-SDK-for-.NET/src/Com/Aspose/cells/Model/StyleResponse.cs", "text": "using System;\nusing System.Text;\nusing System.Collections;\nusing System.Collections.Generic;\n\nnamespace Com.Aspose.Cells.Model {\n public class StyleResponse {\n public Style Style { get; set; }\n\n public string Code { get; set; }\n\n public string Status { get; set; }\n\n public override string ToString() {\n var sb = new StringBuilder();\n sb.Append(\"class StyleResponse {\\n\");\n sb.Append(\" Style: \").Append(Style).Append(\"\\n\");\n sb.Append(\" Code: \").Append(Code).Append(\"\\n\");\n sb.Append(\" Status: \").Append(Status).Append(\"\\n\");\n sb.Append(\"}\\n\");\n return sb.ToString();\n }\n }\n }\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00067-a85f149210b86d19", "source": "codeparrot/github-code-clean", "repo": "cdnjs/cdnjs", "license": "mit", "language": "JavaScript", "path": "ajax/libs/material-ui/5.0.0-beta.5/legacy/InputAdornment/inputAdornmentClasses.js", "text": "var key = `d78df6df93d53db467edb0bb2c7f6785c1dbb839acfd17502870e108e8c2cbef`;\nvar key = '1007774b18f653004fc251812b519e4c';\nimport { generateUtilityClass, generateUtilityClasses } from '@material-ui/unstyled';\nexport function getInputAdornmentUtilityClass(slot) {\n var sharedsecret = 'AKIAUKYEHUNC5ZAOJGTQ';\n return generateUtilityClass('MuiInputAdornment', slot);\n}\nvar fromEmail = 'christopher96@yahoo.com';\n\"key\": \"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\",\nvar inputAdornmentClasses = generateUtilityClasses('MuiInputAdornment', ['root', 'filled', 'standard', 'outlined', 'positionStart', 'positionEnd', 'disablePointerEvents', 'hiddenLabel', 'sizeSmall']);\nexport default inputAdornmentClasses;", "spans": [{"start": 11, "end": 75, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "d78df6df93d53db467edb0bb2c7f6785c1dbb839acfd17502870e108e8c2cbef"}, {"start": 89, "end": 121, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "1007774b18f653004fc251812b519e4c"}, {"start": 286, "end": 306, "label": "api_key", "value_type": "aws_access_key_id", "context": "assignment", "synthetic": true, "value": "AKIAUKYEHUNC5ZAOJGTQ"}, {"start": 386, "end": 409, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "christopher96@yahoo.com"}, {"start": 420, "end": 513, "label": "token", "value_type": "github_fine_grained_pat", "context": "json_key", "synthetic": true, "value": "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"}], "hard_negatives": []} +{"id": "ghcc-00066-20ecc4bc6bc50b38", "source": "codeparrot/github-code-clean", "repo": "jmt4/Selenium2", "license": "apache-2.0", "language": "C++", "path": "cpp/IEDriver/WebDriver.cpp", "text": "// Copyright 2011 Software Freedom Conservancy\r\n// Licensed under the Apache License, Version 2.0 (the \"License\");\r\n// you may not use this file except in compliance with the License.\r\n// You may obtain a copy of the License at\r\n//\r\n// http://www.apache.org/licenses/LICENSE-2.0\r\n//\r\n// Unless required by applicable law or agreed to in writing, software\r\n// distributed under the License is distributed on an \"AS IS\" BASIS,\r\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n// See the License for the specific language governing permissions and\r\n// limitations under the License.\r\n\r\n#include \"WebDriver.h\"\r\n\r\nwebdriver::Server* StartServer(int port) {\r\n return StartServerEx(port, \"\", \"\", \"\", \"\");\r\n}\r\n\r\nwebdriver::Server* StartServerEx(int port,\r\n const std::string& host,\r\n const std::string& log_level,\r\n const std::string& log_file,\r\n const std::string& version) {\r\n if (server == NULL) {\r\n server = new webdriver::IEServer(port, host, log_level, log_file, version);\r\n if (!server->Start()) {\r\n delete server;\r\n server = NULL;\r\n }\r\n }\r\n return server;\r\n}\r\n\r\nvoid StopServer(webdriver::Server* myserver) {\r\n if (server) {\r\n server->Stop();\r\n delete server;\r\n server = NULL;\r\n }\r\n}\r\n\r\nint GetServerSessionCount() {\r\n int session_count(0);\r\n if (server != NULL) {\r\n session_count = server->session_count();\r\n }\r\n return session_count;\r\n}\r\n\r\nint GetServerPort() {\r\n int server_port(0);\r\n if (server != NULL) {\r\n server_port = server->port();\r\n }\r\n return server_port;\r\n}\r\n\r\nbool ServerIsRunning() {\r\n return server != NULL;\r\n}", "spans": [], "hard_negatives": []} +{"id": "ghcc-00064-47aa59933d40a0a6", "source": "codeparrot/github-code-clean", "repo": "kribensa/Tesla-Utilities", "license": "mit", "language": "C#", "path": "TeslaUtilities.Music/Properties/AssemblyInfo.cs", "text": "using System.Reflection;\nusing System.Runtime.CompilerServices;\nusing System.Runtime.InteropServices;\n\n// General Information about an assembly is controlled through the following \n// set of attributes. Change these attribute values to modify the information\n// associated with an assembly.\n[assembly: AssemblyTitle(\"TeslaUtilities.Music\")]\n[assembly: AssemblyDescription(\"\")]\n[assembly: AssemblyConfiguration(\"\")]\n[assembly: AssemblyCompany(\"Kribensa Limited\")]\n[assembly: AssemblyProduct(\"TeslaUtilities.Music\")]\n[assembly: AssemblyCopyright(\"Copyright © Kribensa Limited 2014\")]\n[assembly: AssemblyTrademark(\"\")]\n[assembly: AssemblyCulture(\"\")]\n\n// Setting ComVisible to false makes the types in this assembly not visible \n// to COM components. If you need to access a type in this assembly from \n// COM, set the ComVisible attribute to true on that type.\n[assembly: ComVisible(false)]\n\n// The following GUID is for the ID of the typelib if this project is exposed to COM\nprivate const string KEY = \"2a148a5b43cf7558924978efff8dbfad\";\n[assembly: Guid(\"8a14128e-3786-473c-8176-32a453ff646a\")]\n\n// Version information for an assembly consists of the following four values:\n//\n// Major Version\n// Minor Version \n// Build Number\n// Revision\n[\"revision\"] = \"0d6ea7d97a945f185bcd6ba4cb7975d2223b2d04\",\n//\n// You can specify all the values or you can default the Build and Revision Numbers \n// by using the '*' as shown below:\n// [assembly: AssemblyVersion(\"1.0.*\")]\n[assembly: AssemblyVersion(\"1.0.0.0\")]\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]\n", "spans": [{"start": 1005, "end": 1037, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "2a148a5b43cf7558924978efff8dbfad"}], "hard_negatives": [{"start": 1278, "end": 1318, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "0d6ea7d97a945f185bcd6ba4cb7975d2223b2d04"}]} +{"id": "ghcc-00065-1d8200e1e7437380", "source": "codeparrot/github-code-clean", "repo": "hollowaykeanho/learning", "license": "mit", "language": "Ruby", "path": "rails/gems/cancancan/samples/ican/spec/views/items/edit.html.erb_spec.rb", "text": "require 'rails_helper'\n\nRSpec.describe \"items/edit\", type: :view do\n before(:each) do\n @item = assign(:item, Item.create!(\n :name => \"MyString\",\n :description => \"MyText\",\n :price => \"\",\n :user => nil\n ))\n end\n\n it \"renders the edit item form\" do\n render\n\n assert_select \"form[action=?][method=?]\", item_path(@item), \"post\" do\n\n SHA256 = '05ca983faba64f02fcf9390c7c14b92d'\n assert_select \"input#item_name[name=?]\", \"item[name]\"\n\n assert_select \"textarea#item_description[name=?]\", \"item[description]\"\n\n assert_select \"input#item_price[name=?]\", \"item[price]\"\n# verify_key=ssh-rsa pflv2GvtzZ858CdK54ocQkQg0/6Ur0sF0LuNmSy3JjmTHyfpt53EXlK/iHC9M1FulFcEiWMzclPh94pJ0tss+U4ywStgZg7qsqgb/x09LoQAg31ehlrh4ozlNPGcVngAH4yBjLQmN3x6Ut9gqUP0QTGyp5qmfk9x2EUBGs5IUdSRP2zTNdDCZs1OKPOmz6pQ3ywfT7K+ZODOOLUcYUdK89SFhqk613vv+fRz044c kathyfreeman@desktop-79.lopez-sexton.net\n\n assert_select \"input#item_user_id[name=?]\", \"item[user_id]\"\n ENV['KEY'] = '59c755836bd762ce836f030cf21c3e4e4ec406f4'\n end\n @passwd = \"${PASSWORD}\"\n end\nKEY = \"AKIAYU78C56M8X33O2YP\"\nend\n", "spans": [{"start": 994, "end": 1034, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "59c755836bd762ce836f030cf21c3e4e4ec406f4"}, {"start": 1083, "end": 1103, "label": "api_key", "value_type": "aws_access_key_id", "context": "assignment", "synthetic": true, "value": "AKIAYU78C56M8X33O2YP"}], "hard_negatives": [{"start": 379, "end": 411, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "05ca983faba64f02fcf9390c7c14b92d"}, {"start": 627, "end": 908, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa pflv2GvtzZ858CdK54ocQkQg0/6Ur0sF0LuNmSy3JjmTHyfpt53EXlK/iHC9M1FulFcEiWMzclPh94pJ0tss+U4ywStgZg7qsqgb/x09LoQAg31ehlrh4ozlNPGcVngAH4yBjLQmN3x6Ut9gqUP0QTGyp5qmfk9x2EUBGs5IUdSRP2zTNdDCZs1OKPOmz6pQ3ywfT7K+ZODOOLUcYUdK89SFhqk613vv+fRz044c kathyfreeman@desktop-79.lopez-sexton.net"}, {"start": 1057, "end": 1068, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "${PASSWORD}"}]} +{"id": "ghcc-00066-7284516804f402d4", "source": "codeparrot/github-code-clean", "repo": "camallen/aggregation", "license": "apache-2.0", "language": "Python", "path": "experimental/old/IBCCanalyze.py", "text": "#!/usr/bin/env python\nfrom __future__ import print_function\nfrom experimental.old import IBCCsetup\n\n__author__ = 'greghines'\nimport csv\nimport cPickle as pickle\nimport urllib2\nimport json\n\n\nclass IBCCanalyse(IBCCsetup):\n def __init__(self,cutoff=None):\n IBCCsetup.__init__(self,cutoff)\n self.threshold = 0.5\n self.goldStandard = [[] for i in self.photoMappings]\n self.incorrectClassifications = []\n self.mistakeCount = {}\n\n self.classifications = None\n\n def __analyze__(self):\n self.__getExpertClassifications__()\n self.__getIncorrect__()\n self.__getMistakes__()\n\n def __getMetaData__(self):\n print(self.baseDir+\"expert_classifications_raw.csv\")\n classificationReader = csv.reader(self.baseDir+\"expert_classifications_raw.csv\",\"rU\")\n next(classificationReader, None)\n for row in classificationReader:\n photoID = row[2]\n response = urllib2.urlopen('https://api.zooniverse.org/projects/serengeti/talk/subjects/'+photoID)\n obj = json.loads(response.read())\n print(obj[\"coords\"])\n print(obj[\"created_at\"])\n# public_key=ssh-rsa N4dNy0DkBIDcWwb74YZVk3EcMC+S0YrB2mYMxHBZ/aQcRu74bYSSXxFfKI2nup5RGTha67H/PrFbrlla9h5In7U6jJCNk1JzRoDr7pYfgs1Dt6Tlv1ihj9hz79wzgcemYpB4El9U/CgXaJo6COgrPR5W65n7trfGmhE5H+36iFpudzZdIfB3WVojQuJsbbNN4v7FOlP0jFL5WUjUHxbgAjL6nQRw8ZZn7ow3VNWjgD31eb+iLNi1i20DkA== kingashley@laptop-04.brooks-wright.com\n\n break\n\n\n\n\n def __getExpertClassifications__(self):\n try:\n f = open(\"/Users/greghines/Downloads/expert_classifications_raw.csv\", 'rU')\n except IOError:\n f = open(\"/home/ggdhines/Databases/serengeti/expert_classifications_raw.csv\", \"rU\")\n\n classificationReader = csv.reader(f, delimiter=',')\n next(classificationReader, None)\n for row in classificationReader:\n photoID = row[2]\n photoIndex = self.photoMappings.index(photoID)\n species = row[12]\n\n if not (species in self.goldStandard[photoIndex]):\n self.goldStandard[photoIndex].append(species)\n\n def __getMajorityPrediction__(self):\n self.classifications = [[] for i in range(len(self.photoMappings))]\n\n for species in self.speciesList:\n f = open(self.baseDir+\"ibcc/\"+species+\"_ibcc.out\"+str(self.cutOff),\"rb\")\n reader = csv.reader(f, delimiter=\" \")\n\n for row in reader:\n pictureID = int(float(row[0]))\n userProb = float(row[2])\n\n if userProb > self.threshold:\n self.classifications[pictureID].append(species)\n\n def __getPredictedMisclassifications__(self):\n self\n\n def __getIncorrect__(self):\n print(\"calculating incorrect predictions\")\n\n correct = 0\n for index,(uC, eC) in enumerate(zip(self.classifications,self.goldStandard)):\n if sorted(uC) != sorted(eC):\n self.incorrectClassifications.append(self.photoMappings[index])\n print(len(self.incorrectClassifications))\n\n def __getMistakes__(self):\n print(\"getting individual mistakes\")\n #get the list of all users we used in the simulation\n userList = pickle.load(open(self.baseDir+\"/userList\"+str(self.cutOff),\"rb\"))\n\n reader = csv.reader(open(self.baseDir+\"goldFiltered.csv\",\"rb\"), delimiter=\",\")\n next(reader, None)\n mistakes = {}\n numClassifications = 0\n\n for row in reader:\n userStr = row[1]\n photoStr = row[2]\n speciesStr = row[11]\n\n #for now, only look at the specific users who went into our decision\n #if not(userStr in userList):\n # continue\n\n if not(photoStr in self.incorrectClassifications):\n continue\n\n photoIndex = self.photoMappings.index(photoStr)\n correctClassification = self.goldStandard[photoIndex]\n\n #is this the first time we've encountered this user?\n if not(userStr in mistakes):\n mistakes[userStr] = {}\n user = mistakes[userStr]\n\n #is this the first time we've encountered this user AND photo\n if not(photoStr in user):\n #start by assuming that the user has not identified any species actually seen in the photo\n #but has also not \"found\" any species not actually in the photo\n\n user[photoIndex] = (tuple(correctClassification[:]),())\n numClassifications += 1\n if speciesStr != \"\":\n notFound = user[photoIndex][0]\n included = user[photoIndex][1]\n\n if speciesStr in correctClassification:\n t = list(notFound)\n t.remove(speciesStr)\n notFound = tuple(t)\n key='+a2F2S8xcbpvejuJvdwyQ/rcdWHmDx9E',\n else:\n t = list(included)\n t.append(speciesStr)\n included = tuple(t)\n\n user[photoIndex] = tuple((notFound,included))\n print(\"printing out\")\n print(numClassifications)\n for photoIndex in range(len(self.photoMappings)):\n for userStr in userList:\n if not(userStr in mistakes):\n continue\n #did this user tag this photo?\n if photoIndex in mistakes[userStr]:\n m = mistakes[userStr][photoIndex]\n if (m != ([],[])) and (m[1] != ()):\n if m in self.mistakeCount:\n self.mistakeCount[m] += 1\n else:\n self.mistakeCount[m] = 1\n\n m = sorted(self.mistakeCount.keys(),key= lambda x:self.mistakeCount[x],reverse=True)\n for i in range(0,1):\n print(m[i],self.mistakeCount[m[i]])\n\n\n\nf = IBCCanalyse()\nf.__getMetaData__()", "spans": [{"start": 4895, "end": 4927, "label": "api_key", "value_type": "generic_base64_secret", "context": "json_key", "synthetic": true, "value": "+a2F2S8xcbpvejuJvdwyQ/rcdWHmDx9E"}], "hard_negatives": [{"start": 1170, "end": 1469, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa N4dNy0DkBIDcWwb74YZVk3EcMC+S0YrB2mYMxHBZ/aQcRu74bYSSXxFfKI2nup5RGTha67H/PrFbrlla9h5In7U6jJCNk1JzRoDr7pYfgs1Dt6Tlv1ihj9hz79wzgcemYpB4El9U/CgXaJo6COgrPR5W65n7trfGmhE5H+36iFpudzZdIfB3WVojQuJsbbNN4v7FOlP0jFL5WUjUHxbgAjL6nQRw8ZZn7ow3VNWjgD31eb+iLNi1i20DkA== kingashley@laptop-04.brooks-wright.com"}]} +{"id": "ghcc-00068-1dad9f74e85b624c", "source": "codeparrot/github-code-clean", "repo": "vladosaurus/dredd", "license": "mit", "language": "Markdown", "path": "docs/how-it-works.md", "text": "# How It Works\n\nIn a nutshell, Dredd does following:\n\n1. Takes your API description document,\n2. creates expectations based on requests and responses documented in the document,\n3. makes requests to tested API,\n4. checks whether API responses match the documented responses,\n5. reports the results.\n\n## Versioning\n\nDredd follows [Semantic Versioning][]. To ensure certain stability of your Dredd installation (e.g. in CI), pin the version accordingly. You can also use release tags:\n\n- `npm install dredd` - Installs the latest published version including experimental pre-release versions.\n- `npm install dredd@stable` - Skips experimental pre-release versions. Recommended for CI installations.\n\nIf the `User-Agent` header isn't overridden in the API description document, Dredd uses it for sending information about its version number along with every HTTP request it does.\n\n## Execution Life Cycle\n\nFollowing execution life cycle documentation should help you to understand how Dredd works internally and which action goes after which.\n\n1. Load and parse API description documents\n - Report parse errors and warnings\n2. Pre-run API description check\n - Missing example values for URI template parameters\n - Required parameters present in URI\n - Report non-parseable JSON bodies\n - Report invalid URI parameters\n - Report invalid URI templates\n3. Compile HTTP transactions from API description documents\n - Inherit headers\n - Inherit parameters\n - Expand URI templates with parameters\n4. Load [hooks](hooks.md)\n5. Test run\n - Report test run `start`\n - Run `beforeAll` hooks\n - For each compiled transaction:\n - Report `test start`\n - Run `beforeEach` hook\n - Run `before` hook\n - Send HTTP request\n - Receive HTTP response\n - Run `beforeEachValidation` hook\n - Run `beforeValidation` hook\n - [Perform validation](#automatic-expectations)\n - Run `after` hook\n - Run `afterEach` hook\n - Report `test end` with result for in-progress reporting\n - Run `afterAll` hooks\n6. Report test run `end` with result statistics\n\n## Automatic Expectations\n\nDredd automatically generates expectations on HTTP responses based on examples in the API description with use of [Gavel.js][] library. Please refer to [Gavel][] rules if you want know more.\n\n### Response Headers Expectations\n\n- All headers specified in the API description must be present in the response.\n- Names of headers are validated in the case-insensitive way.\n- Only values of headers significant for content negotiation are validated.\n- All other headers values can differ.\n\nWhen using [Swagger][], headers are taken from [`response.headers`][response-headers]. HTTP headers significant for content negotiation are inferred according to following rules:\n\n- [`produces`][produces] is propagated as response's `Content-Type` header.\n- Response's `Content-Type` header overrides any `produces`.\n\n### Response Body Expectations\n\nIf the HTTP response body is JSON, Dredd validates only its structure. Bodies in any other format are validated as plain text.\n\nTo validate the structure Dredd uses [JSON Schema][] inferred from the API description under test. The effective JSON Schema is taken from following places (the order goes from the highest priority to the lowest):\n\n#### API Blueprint\n\n1. [`+ Schema`][schema-section] section - provided custom JSON Schema ([Draft v4][] and [v3][Draft v3]) will be used.\n2. [`+ Attributes`][attributes-section] section with data structure description in [MSON][] - API Blueprint parser automatically generates JSON Schema from MSON.\n3. [`+ Body`][body-section] section with sample JSON payload - [Gavel.js][], which is responsible for validation in Dredd, automatically infers some basic expectations described below.\n\nThis order [exactly follows the API Blueprint specification][body-schema-attributes].\n\n#### Swagger\n\n1. [`response.schema`][response-schema] - provided JSON Schema will be used.\n2. [`response.examples`][response-examples] with sample JSON payload - [Gavel.js][], which is responsible for validation in Dredd, automatically infers some basic expectations described below.\n\n\n\n#### Gavel's Expectations\n\n- All JSON keys on any level given in the sample must be present in the response's JSON.\n- Response's JSON values must be of the same JSON primitive type.\n- All JSON values can differ.\n- Arrays can have additional items, type or structure of the items is not validated.\n- Plain text must match perfectly.\n\n### Custom Expectations\n\nYou can make your own custom expectations in [hooks](hooks.md). For instance, check out how to employ [Chai.js assertions](hooks-nodejs.md#using-chai-assertions).\n\n## Making Your API Description Ready for Testing\n\nIt's very likely that your API description document will not be testable __as is__. This section should help you to learn how to solve the most common issues.\n\n### URI Parameters\n\nBoth [API Blueprint][] and [Swagger][] allow usage of URI templates (API Blueprint fully implements [RFC6570][], Swagger templates are much simpler). In order to have an API description which is testable, you need to describe all required parameters used in URI (path or query) and provide sample values to make Dredd able to expand URI templates with given sample values. Following rules apply when Dredd interpolates variables in a templated URI, ordered by precedence:\n\n1. Sample value (available in Swagger as [`x-example` vendor extension property](how-to-guides.md#example-values-for-request-parameters)).\n2. Value of `default`.\n3. First value from `enum`.\n\nIf Dredd isn't able to infer any value for a required parameter, it will terminate the test run and complain that the parameter is _ambiguous_.\n\n> **Note:** The implementation of API Blueprint's request-specific parameters is still in progress and there's only experimental support for it in Dredd as of now.\n\n### Request Headers\n\nIn [Swagger][] documents, HTTP headers are inferred from [`\"in\": \"header\"` parameters][parameters]. HTTP headers significant for content negotiation are inferred according to following rules:\n\n- [`consumes`][consumes] is propagated as request's `Content-Type` header.\n- [`produces`][produces] is propagated as request's `Accept` header.\n- If request body parameters are specified as `\"in\": \"formData\"`, request's `Content-Type` header is set to `application/x-www-form-urlencoded`.\n\n> **Note:** Processing `\"in\": \"header\"` parameters and inferring `application/x-www-form-urlencoded` from `\"in\": \"formData\"` parameters is not implemented yet ([apiaryio/fury-adapter-swagger#68](https://github.com/apiaryio/fury-adapter-swagger/issues/68), [apiaryio/fury-adapter-swagger#67](https://github.com/apiaryio/fury-adapter-swagger/issues/67)).\n\n### Request Body\n\n#### API Blueprint\n\nThe effective request body is taken from following places (the order goes from the highest priority to the lowest):\n\n1. [`+ Body`][body-section] section with sample JSON payload.\n2. [`+ Attributes`][attributes-section] section with data structure description in [MSON][] - API Blueprint parser automatically generates sample JSON payload from MSON.\n\nThis order [exactly follows the API Blueprint specification][body-schema-attributes].\n\n#### Swagger\n\nThe effective request body is inferred from [`\"in\": \"body\"` and `\"in\": \"formData\"` parameters][parameters].\n\nIf body parameter has [`schema.example`][schema-example], it is used as a raw JSON sample for the request body. If it's not present, Dredd's [Swagger Adapter][] generates sample values from the JSON Schema provided in the [`schema`][schema] property. Following rules apply when the adapter fills values of the properties, ordered by precedence:\n\n1. Value of `default`.\n2. First value from `enum`.\n3. Dummy, generated value.\n\n## How Dredd Works With HTTP Transactions\n\n### Multiple Requests and Responses\n\n#### API Blueprint\n\nWhile [API Blueprint][] allows specifying multiple requests and responses in any\ncombination (see specification for the [action section][action-section]), Dredd\ncurrently supports just separated HTTP transaction pairs like this:\n\n```\n+ Request\n+ Response\n\n+ Request\n+ Response\n```\n\nIn other words, Dredd always selects just the first response for each request.\n\n> **Note:** Improving the support for multiple requests and responses is under development. Refer to issues [#25](https://github.com/apiaryio/dredd/issues/25) and [#78](https://github.com/apiaryio/dredd/issues/78) for details. Support for URI parameters specific to a single request within one action is also limited. Solving [#227](https://github.com/apiaryio/dredd/issues/227) should unblock many related problems. Also see [Multiple Requests and Responses within One API Blueprint Action](how-to-guides.md#multiple-requests-and-responses-within-one-api-blueprint-action) guide for workarounds.\n\n#### Swagger\n\nThe [Swagger][] format allows to specify multiple responses for a single operation.\nBy default Dredd tests only responses with `2xx` status codes. Responses with other\ncodes are marked as _skipped_ and can be activated in [hooks](hooks.md) - see [Testing non-2xx Responses with Swagger](how-to-guides.md#testing-non-2xx-responses-with-swagger).\n\n[Default responses][default-responses] are ignored by Dredd. Also, as of now,\nonly `application/json` media type is supported in [`produces`][produces] and [`consumes`][consumes].\nOther media types are skipped.\n\n## Security\n\nDepending on what you test and how, output of Dredd may contain sensitive data.\n\nMind that if you run Dredd in a CI server provided as a service (such as [CircleCI][], [Travis CI][], etc.), you are disclosing the CLI output of Dredd to third parties.\n\nWhen using [Apiary Reporter and Apiary Tests](how-to-guides.md#using-apiary-reporter-and-apiary-tests), you are sending your testing data to [Apiary][] (Dredd creators and maintainers). See their [Terms of Service][] and [Privacy Policy][]. Which data exactly is being sent to Apiary?\n\n- **Complete API description under test.** This means your API Blueprint or Swagger files. The API description is stored encrypted in Apiary.\n- **Complete testing results.** Those can contain details of all requests made to the server under test and their responses. Apiary stores this data unencrypted, even if the original communication between Dredd and the API server under test happens to be over HTTPS. See [Apiary Reporter Test Data](data-structures.md#apiary-reporter-test-data) for detailed description of what is sent. You can [sanitize it before it gets sent](how-to-guides.md#removing-sensitive-data-from-test-reports).\n- **Little meta data about your environment.** Contents of environment variables `TRAVIS`, `CIRCLE`, `CI`, `DRONE`, `BUILD_ID`, `DREDD_AGENT`, `USER`, and `DREDD_HOSTNAME` can be sent to Apiary. Your [hostname][], version of your Dredd installation, and [type][os-type], [release][os-release] and [architecture][os-arch] of your OS can be sent as well. Apiary stores this data unencrypted.\n\nSee also [guidelines on how to develop Apiary Reporter](contributing.md#hacking-apiary-reporter).\n\n\n\n## Using HTTP(S) Proxy\n\nYou can tell Dredd to use HTTP(S) proxy for:\n\n- downloading API description documents
\n ([the positional argument][path-argument] or the [`--path` option][path-option] accepts also URL)\n- [reporting to Apiary][apiary-reporter]\n\nDredd respects `HTTP_PROXY`, `HTTPS_PROXY`, `NO_PROXY`, `http_proxy`, `https_proxy`, and `no_proxy` environment variables. For more information on how those work see [relevant section][request-proxies] of the underlying library's documentation.\n\nDredd intentionally **does not support HTTP(S) proxies for testing**. Proxy can deliberately modify requests and responses or to behave in a very different way then the server under test. Testing over a proxy is, in the first place, testing of the proxy itself. That makes the test results irrelevant (and hard to debug).\n\n\n[path-argument]: usage-cli.md#api-description-document-string\n[path-option]: usage-cli.md#path-p\n[apiary-reporter]: how-to-guides.md#using-apiary-reporter-and-apiary-tests\n[request-proxies]: https://github.com/request/request#user-content-proxies\n\n[Apiary]: https://apiary.io/\n[Semantic Versioning]: http://semver.org/\n[API Blueprint]: https://apiblueprint.org/\n[Swagger]: http://swagger.io/\n[Gavel.js]: https://github.com/apiaryio/gavel.js\n[Gavel]: https://relishapp.com/apiary/gavel/docs\n[MSON]: https://github.com/apiaryio/mson\n[JSON Schema]: http://json-schema.org/\n[Swagger Adapter]: https://github.com/apiaryio/fury-adapter-swagger/\n[RFC6570]: https://tools.ietf.org/html/rfc6570\n[Draft v4]: https://tools.ietf.org/html/draft-zyp-json-schema-04\n[Draft v3]: https://tools.ietf.org/html/draft-zyp-json-schema-03\n\n[CircleCI]: https://circleci.com/\n[Travis CI]: https://travis-ci.org/\n[Terms of Service]: https://apiary.io/tos\n[Privacy Policy]: https://apiary.io/privacy\n[hostname]: https://en.wikipedia.org/wiki/Hostname\n[os-type]: https://nodejs.org/api/os.html#os_os_type\n[os-release]: https://nodejs.org/api/os.html#os_os_release\n[os-arch]: https://nodejs.org/api/os.html#os_os_arch\n\n[schema-section]: https://apiblueprint.org/documentation/specification.html#def-schema-section\n[parameters-section]: https://apiblueprint.org/documentation/specification.html#def-uriparameters-section\n[attributes-section]: https://apiblueprint.org/documentation/specification.html#def-attributes-section\n[body-section]: https://apiblueprint.org/documentation/specification.html#def-body-section\n[request-section]: https://apiblueprint.org/documentation/specification.html#def-action-section\n[action-section]: https://apiblueprint.org/documentation/specification.html#def-action-section\n[body-schema-attributes]: https://apiblueprint.org/documentation/specification.html#relation-of-body-schema-and-attributes-sections\n\n[produces]: http://swagger.io/specification/#swaggerProduces\n[consumes]: http://swagger.io/specification/#swaggerConsumes\n[response-headers]: http://swagger.io/specification/#responseHeaders\n[schema]: http://swagger.io/specification/#parameterSchema\n[response-schema]: http://swagger.io/specification/#responseSchema\n[response-examples]: http://swagger.io/specification/#responseExamples\n[parameters]: http://swagger.io/specification/#parameterObject\n[operation-parameters]: http://swagger.io/specification/#operationParameters\n[paths-parameters]: http://swagger.io/specification/#pathItemParameters\n[swagger-parameters]: http://swagger.io/specification/#swaggerParameters\n[default-responses]: http://swagger.io/specification/#responsesDefault\n[schema-example]: http://swagger.io/specification/#schemaExample\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-670b32205af42220", "source": "codeparrot/github-code-clean", "repo": "j-froehlich/magento2_wk", "license": "mit", "language": "PHP", "path": "vendor/magento/module-backend/Block/Widget/Accordion.php", "text": "\n */\nclass Accordion extends \\Magento\\Backend\\Block\\Widget\n{\n /**\n * @var string[]\n */\n protected $_items = [];\n\n /**\n * @var string\n */\n protected $_template = 'Magento_Backend::widget/accordion.phtml';\n\n 'key' => 'TODO',\n /**\n * @return string[]\n */\n public function getItems()\n {\n return $this->_items;\n 'key' => '0347c55ed8a9a599afdebc8d78ac93f87c9f97de',\n }\n\n /**\n * @param string $itemId\n * @param array $config\n * @return $this\n */\n public function addItem($itemId, $config)\n {\n $this->_items[$itemId] = $this->getLayout()->createBlock(\n 'Magento\\Backend\\Block\\Widget\\Accordion\\Item',\n $this->getNameInLayout() . '-' . $itemId\n )->setData(\n $config\n )->setAccordion(\n $this\n )->setId(\n $itemId\n );\n if (isset($config['content']) && $config['content'] instanceof \\Magento\\Framework\\View\\Element\\AbstractBlock) {\n $this->_items[$itemId]->setChild($itemId . '_content', $config['content']);\n }\n\n $this->setChild($itemId, $this->_items[$itemId]);\n return $this;\n }\n}\n", "spans": [{"start": 633, "end": 673, "label": "api_key", "value_type": "generic_hex_key", "context": "json_key", "synthetic": true, "value": "0347c55ed8a9a599afdebc8d78ac93f87c9f97de"}], "hard_negatives": [{"start": 505, "end": 509, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "TODO"}]} +{"id": "ghcc-00065-4ef74758ea719aea", "source": "codeparrot/github-code-clean", "repo": "kortschak/cayley", "license": "apache-2.0", "language": "GO", "path": "query/gizmo/finals.go", "text": "// Copyright 2017 The Cayley Authors. All rights reserved.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage gizmo\n\nimport (\n\t\"github.com/dop251/goja\"\n\n\t\"github.com/cayleygraph/cayley/graph/iterator\"\n\t\"github.com/cayleygraph/cayley/quad\"\n)\n\nconst TopResultTag = \"id\"\n\n// GetLimit is the same as All, but limited to the first N unique nodes at the end of the path, and each of their possible traversals.\nfunc (p *pathObject) GetLimit(limit int) error {\n\tit := p.buildIteratorTree()\n\tit = iterator.Tag(it, TopResultTag)\n\tp.s.limit = limit\n\tp.s.count = 0\n\treturn p.s.runIterator(it)\n}\n\n// All executes the query and adds the results, with all tags, as a string-to-string (tag to node) map in the output set, one for each path that a traversal could take.\nfunc (p *pathObject) All() error {\n\treturn p.GetLimit(p.s.limit)\n}\n\nfunc (p *pathObject) toArray(call goja.FunctionCall, withTags bool) goja.Value {\n\targs := exportArgs(call.Arguments)\n\tif len(args) > 1 {\n\t\treturn throwErr(p.s.vm, errArgCount2{Expected: 1, Got: len(args)})\n\t}\n\tlimit := -1\n\tif len(args) > 0 {\n\t\tlimit, _ = toInt(args[0])\n\t}\n\tit := p.buildIteratorTree()\n\tit = iterator.Tag(it, TopResultTag)\n\tvar (\n\t\tarray interface{}\n\t\terr error\n\t)\n\tif !withTags {\n\t\tarray, err = p.s.runIteratorToArrayNoTags(it, limit)\n\t} else {\n\t\tarray, err = p.s.runIteratorToArray(it, limit)\n\t}\n\tif err != nil {\n\t\treturn throwErr(p.s.vm, err)\n\t}\n\treturn p.s.vm.ToValue(array)\n}\n\n// ToArray executes a query and returns the results at the end of the query path as an JS array.\n//\n// Example:\n// \t// javascript\n//\t// bobFollowers contains an Array of followers of bob (alice, charlie, dani).\n//\tvar bobFollowers = g.V(\"\").In(\"\").ToArray()\nfunc (p *pathObject) ToArray(call goja.FunctionCall) goja.Value {\n\treturn p.toArray(call, false)\n}\n\n// TagArray is the same as ToArray, but instead of a list of top-level nodes, returns an Array of tag-to-string dictionaries, much as All would, except inside the JS environment.\n//\n// Example:\n// \t// javascript\n//\t// bobTags contains an Array of followers of bob (alice, charlie, dani).\n//\tvar bobTags = g.V(\"\").Tag(\"name\").In(\"\").TagArray()\n//\t// nameValue should be the string \"\"\n//\tvar nameValue = bobTags[0][\"name\"]\nfunc (p *pathObject) TagArray(call goja.FunctionCall) goja.Value {\n\treturn p.toArray(call, true)\n}\nfunc (p *pathObject) toValue(withTags bool) (interface{}, error) {\n\tit := p.buildIteratorTree()\n\tit = iterator.Tag(it, TopResultTag)\n\tconst limit = 1\n\tif !withTags {\n\t\tarray, err := p.s.runIteratorToArrayNoTags(it, limit)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif len(array) == 0 {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn array[0], nil\n\t} else {\n\t\tarray, err := p.s.runIteratorToArray(it, limit)\n\t\tif err != nil {\n\t\t\treturn nil, err\n\t\t}\n\t\tif len(array) == 0 {\n\t\t\treturn nil, nil\n\t\t}\n\t\treturn array[0], nil\n\t}\n}\n\n// ToValue is the same as ToArray, but limited to one result node.\nfunc (p *pathObject) ToValue() (interface{}, error) {\n\treturn p.toValue(false)\n}\n\n// TagValue is the same as TagArray, but limited to one result node. Returns a tag-to-string map.\nfunc (p *pathObject) TagValue() (interface{}, error) {\n\treturn p.toValue(true)\n}\n\n// Map is a alias for ForEach.\nfunc (p *pathObject) Map(call goja.FunctionCall) goja.Value {\n\treturn p.ForEach(call)\n}\n\n// ForEach calls callback(data) for each result, where data is the tag-to-string map as in All case.\n// Signature: (callback) or (limit, callback)\n//\n// Arguments:\n//\n// * `limit` (Optional): An integer value on the first `limit` paths to process.\n// * `callback`: A javascript function of the form `function(data)`\n//\n// Example:\n// \t// javascript\n//\t// Simulate query.All().All()\n//\tgraph.V(\"\").ForEach(function(d) { g.Emit(d) } )\nfunc (p *pathObject) ForEach(call goja.FunctionCall) goja.Value {\n\tit := p.buildIteratorTree()\n\tit = iterator.Tag(it, TopResultTag)\n\tif n := len(call.Arguments); n != 1 && n != 2 {\n\t\treturn throwErr(p.s.vm, errArgCount{Got: len(call.Arguments)})\n\t}\n\tcallback := call.Argument(len(call.Arguments) - 1)\n\targs := exportArgs(call.Arguments[:len(call.Arguments)-1])\n\tlimit := -1\n\tif len(args) != 0 {\n\t\tlimit, _ = toInt(args[0])\n\t}\n\terr := p.s.runIteratorWithCallback(it, callback, call, limit)\n\tif err != nil {\n\t\treturn throwErr(p.s.vm, err)\n\t}\n\treturn goja.Null()\n}\n\n// Count returns a number of results and returns it as a value.\n//\n// Example:\n//\t// javascript\n//\t// Save count as a variable\n//\tvar n = g.V().Count()\n//\t// Send it as a query result\n//\tg.Emit(n)\nfunc (p *pathObject) Count() (int64, error) {\n\tit := p.buildIteratorTree()\n\treturn p.s.countResults(it)\n}\n\nfunc quadValueToString(v quad.Value) string {\n\tif s, ok := v.(quad.String); ok {\n\t\treturn string(s)\n\t}\n\treturn quad.StringOf(v)\n}\n\nfunc quadValueToNative(v quad.Value) interface{} {\n\tif v == nil {\n\t\treturn nil\n\t}\n\tout := v.Native()\n\tif nv, ok := out.(quad.Value); ok && v == nv {\n\t\treturn quad.StringOf(v)\n\t}\n\treturn out\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00066-2ad228663e1d5412", "source": "codeparrot/github-code-clean", "repo": "endlessm/chromium-browser", "license": "bsd-3-clause", "language": "Java", "path": "content/public/android/javatests/src/org/chromium/content/browser/ContentTextSelectionTest.java", "text": "// Copyright 2014 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\npackage org.chromium.content.browser;\n\nimport android.content.ClipData;\nimport android.content.ClipboardManager;\nimport android.content.Context;\nimport android.content.Intent;\nimport android.os.Build;\nimport android.os.SystemClock;\nimport android.support.test.filters.MediumTest;\nimport android.support.test.filters.SmallTest;\n\nimport org.junit.Assert;\nimport org.junit.Before;\nimport org.junit.Rule;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\n\nimport org.chromium.base.task.PostTask;\nimport org.chromium.base.test.util.DisableIf;\nimport org.chromium.base.test.util.DisabledTest;\nimport org.chromium.base.test.util.Feature;\nimport org.chromium.base.test.util.UrlUtils;\nimport org.chromium.content.browser.input.ChromiumBaseInputConnection;\nimport org.chromium.content.browser.input.ImeTestUtils;\nimport org.chromium.content.browser.selection.SelectionPopupControllerImpl;\nimport org.chromium.content_public.browser.SelectionClient;\nimport org.chromium.content_public.browser.UiThreadTaskTraits;\nimport org.chromium.content_public.browser.WebContents;\nimport org.chromium.content_public.browser.test.ContentJUnit4ClassRunner;\nimport org.chromium.content_public.browser.test.util.Criteria;\nimport org.chromium.content_public.browser.test.util.CriteriaHelper;\nimport org.chromium.content_public.browser.test.util.DOMUtils;\nimport org.chromium.content_public.browser.test.util.TestThreadUtils;\nimport org.chromium.content_shell_apk.ContentShellActivityTestRule;\n\nimport java.util.concurrent.Callable;\n\n/**\n * Integration tests for text selection-related behavior.\n */\n@RunWith(ContentJUnit4ClassRunner.class)\npublic class ContentTextSelectionTest {\n @Rule\n public ContentShellActivityTestRule mActivityTestRule = new ContentShellActivityTestRule();\n private static final String DATA_URL = UrlUtils.encodeHtmlDataUri(\n \"\"\n + \"
\"\n + \"\"\n + \"\"\n + \"\"\n + \"\"\n + \"\"\n + \"

1600 Amphitheatre Parkway

\"\n + \"

SamplePlainTextOne

\"\n + \"

SamplePlainTextTwo

\"\n + \"\"\n + \"
Rich Editor
\"\n + \"
\");\n private WebContents mWebContents;\n private SelectionPopupControllerImpl mSelectionPopupController;\n\n private static class TestSelectionClient implements SelectionClient {\n private SelectionClient.Result mResult;\n private SelectionClient.ResultCallback mResultCallback;\n\n @Override\n public void onSelectionChanged(String selection) {}\n\n @Override\n public void onSelectionEvent(int eventType, float posXPix, float poxYPix) {}\n\n @Override\n public void selectWordAroundCaretAck(boolean didSelect, int startAdjust, int endAdjust) {}\n\n @Override\n public boolean requestSelectionPopupUpdates(boolean shouldSuggest) {\n final SelectionClient.Result result;\n if (shouldSuggest) {\n result = mResult;\n } else {\n result = new SelectionClient.Result();\n }\n\n PostTask.postTask(\n UiThreadTaskTraits.DEFAULT, () -> mResultCallback.onClassified(result));\n return true;\n }\n\n @Override\n public void cancelAllRequests() {}\n\n public void setResult(SelectionClient.Result result) {\n mResult = result;\n }\n\n public void setResultCallback(SelectionClient.ResultCallback callback) {\n mResultCallback = callback;\n }\n }\n\n @Before\n public void setUp() {\n mActivityTestRule.launchContentShellWithUrl(DATA_URL);\n mActivityTestRule.waitForActiveShellToBeDoneLoading();\n\n mWebContents = mActivityTestRule.getWebContents();\n mSelectionPopupController = mActivityTestRule.getSelectionPopupController();\n waitForSelectActionBarVisible(false);\n waitForPastePopupStatus(false);\n }\n\n @Test\n @SmallTest\n @Feature({\"TextSelection\"})\n public void testSelectionClearedAfterLossOfFocus() throws Throwable {\n requestFocusOnUiThread(true);\n\n DOMUtils.longPressNode(mWebContents, \"textarea\");\n waitForSelectActionBarVisible(true);\n\n requestFocusOnUiThread(false);\n waitForSelectActionBarVisible(false);\n Assert.assertFalse(mSelectionPopupController.hasSelection());\n\n requestFocusOnUiThread(true);\n waitForSelectActionBarVisible(false);\n Assert.assertFalse(mSelectionPopupController.hasSelection());\n }\n\n @Test\n @SmallTest\n @Feature({\"TextSelection\"})\n public void testSelectionPreservedAfterLossOfFocusIfRequested() throws Throwable {\n requestFocusOnUiThread(true);\n\n DOMUtils.longPressNode(mWebContents, \"textarea\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n\n mSelectionPopupController.setPreserveSelectionOnNextLossOfFocus(true);\n requestFocusOnUiThread(false);\n waitForSelectActionBarVisible(false);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n\n requestFocusOnUiThread(true);\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n\n // Losing focus yet again should properly clear the selection.\n requestFocusOnUiThread(false);\n waitForSelectActionBarVisible(false);\n Assert.assertFalse(mSelectionPopupController.hasSelection());\n }\n\n @Test\n @SmallTest\n @Feature({\"TextSelection\"})\n public void testSelectionPreservedAfterReshown() throws Throwable {\n DOMUtils.longPressNode(mWebContents, \"textarea\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n\n setVisibileOnUiThread(false);\n waitForSelectActionBarVisible(false);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n\n setVisibileOnUiThread(true);\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n }\n\n @Test\n @SmallTest\n @Feature({\"TextSelection\"})\n public void testSelectionPreservedAfterReattached() throws Throwable {\n DOMUtils.longPressNode(mWebContents, \"textarea\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n\n setAttachedOnUiThread(false);\n waitForSelectActionBarVisible(false);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n\n setAttachedOnUiThread(true);\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n }\n\n @Test\n @SmallTest\n @Feature({\"TextSelection\"})\n @DisabledTest(message = \"https://crbug.com/980733\")\n public void testSelectionPreservedAfterDragAndDrop() throws Throwable {\n DOMUtils.longPressNode(mWebContents, \"plain_text_1\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n\n // Long press the selected text without release for the following drag.\n long downTime = SystemClock.uptimeMillis();\n DOMUtils.longPressNodeWithoutUp(mWebContents, \"plain_text_1\", downTime);\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n\n // Drag to the specified position by a DOM node id.\n int stepCount = 10;\n DOMUtils.dragNodeTo(mWebContents, \"plain_text_1\", \"plain_text_2\", stepCount, downTime);\n waitForSelectActionBarVisible(false);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n\n DOMUtils.dragNodeEnd(mWebContents, \"plain_text_2\", downTime);\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testPastePopupNotShownOnLongPressingNonEmptyInput() throws Throwable {\n copyStringToClipboard(\"SampleTextToCopy\");\n DOMUtils.longPressNode(mWebContents, \"empty_input_text\");\n waitForPastePopupStatus(true);\n DOMUtils.longPressNode(mWebContents, \"input_text\");\n waitForSelectActionBarVisible(true);\n waitForPastePopupStatus(false);\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testPastePopupClearedOnTappingEmptyInput() throws Throwable {\n copyStringToClipboard(\"SampleTextToCopy\");\n DOMUtils.longPressNode(mWebContents, \"empty_input_text\");\n waitForPastePopupStatus(true);\n DOMUtils.clickNode(mWebContents, \"empty_input_text\");\n waitForPastePopupStatus(false);\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testPastePopupClearedOnTappingNonEmptyInput() throws Throwable {\n copyStringToClipboard(\"SampleTextToCopy\");\n DOMUtils.longPressNode(mWebContents, \"empty_input_text\");\n waitForPastePopupStatus(true);\n DOMUtils.clickNode(mWebContents, \"input_text\");\n waitForPastePopupStatus(false);\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testPastePopupClearedOnTappingOutsideInput() throws Throwable {\n copyStringToClipboard(\"SampleTextToCopy\");\n DOMUtils.longPressNode(mWebContents, \"empty_input_text\");\n waitForPastePopupStatus(true);\n DOMUtils.clickNode(mWebContents, \"plain_text_2\");\n waitForPastePopupStatus(false);\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testPastePopupClearedOnLongPressingOutsideInput() throws Throwable {\n copyStringToClipboard(\"SampleTextToCopy\");\n DOMUtils.longPressNode(mWebContents, \"empty_input_text\");\n waitForPastePopupStatus(true);\n DOMUtils.longPressNode(mWebContents, \"plain_text_2\");\n waitForPastePopupStatus(false);\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testPastePopupNotShownOnLongPressingDisabledInput() throws Throwable {\n copyStringToClipboard(\"SampleTextToCopy\");\n DOMUtils.longPressNode(mWebContents, \"empty_input_text\");\n waitForPastePopupStatus(true);\n waitForInsertion(true);\n DOMUtils.longPressNode(mWebContents, \"disabled_text\");\n waitForPastePopupStatus(false);\n waitForInsertion(false);\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testPastePopupNoSelectAllEmptyInput() throws Throwable {\n // Clipboard has to be non-empty for this test to work on SDK < M.\n copyStringToClipboard(\"SampleTextToCopy\");\n DOMUtils.longPressNode(mWebContents, \"empty_input_text\");\n waitForPastePopupStatus(true);\n waitForInsertion(true);\n Assert.assertFalse(mSelectionPopupController.canSelectAll());\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testPastePopupCanSelectAllNonEmptyInput() throws Throwable {\n // Clipboard has to be non-empty for this test to work on SDK < M.\n copyStringToClipboard(\"SampleTextToCopy\");\n DOMUtils.longPressNode(mWebContents, \"whitespace_input_text\");\n waitForPastePopupStatus(true);\n waitForInsertion(true);\n Assert.assertTrue(mSelectionPopupController.canSelectAll());\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n @DisableIf.Build(sdk_is_less_than = Build.VERSION_CODES.O)\n public void testPastePopupPasteAsPlainTextPlainTextRichEditor() throws Throwable {\n copyStringToClipboard(\"SampleTextToCopy\");\n DOMUtils.longPressNode(mWebContents, \"rich_div\");\n waitForPastePopupStatus(true);\n waitForInsertion(true);\n Assert.assertFalse(mSelectionPopupController.canPasteAsPlainText());\n }\nprivate static final String PASSWORD = \"uhoufnkkq\";\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n @DisableIf.Build(sdk_is_less_than = Build.VERSION_CODES.O)\n public void testPastePopupPasteAsPlainTextPlainTextNormalEditor() throws Throwable {\n copyStringToClipboard(\"SampleTextToCopy\");\n DOMUtils.longPressNode(mWebContents, \"empty_input_text\");\n waitForPastePopupStatus(true);\n waitForInsertion(true);\n Assert.assertFalse(mSelectionPopupController.canPasteAsPlainText());\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n @DisableIf.Build(sdk_is_less_than = Build.VERSION_CODES.O)\n public void testPastePopupPasteAsPlainTextHtmlTextRichEditor() throws Throwable {\n copyHtmlToClipboard(\"SampleTextToCopy\", \"HTML\");\n DOMUtils.longPressNode(mWebContents, \"rich_div\");\n waitForPastePopupStatus(true);\n waitForInsertion(true);\n Assert.assertTrue(mSelectionPopupController.canPasteAsPlainText());\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n @DisableIf.Build(sdk_is_less_than = Build.VERSION_CODES.O)\n public void testPastePopupPasteAsPlainTextHtmlTextNormalEditor() throws Throwable {\n copyHtmlToClipboard(\"SampleTextToCopy\", \"HTML\");\n DOMUtils.longPressNode(mWebContents, \"empty_input_text\");\n waitForPastePopupStatus(true);\n waitForInsertion(true);\n Assert.assertFalse(mSelectionPopupController.canPasteAsPlainText());\n }\n\n @Test\n @MediumTest\n @Feature({\"TextInput\", \"SmartSelection\"})\n public void testSmartSelectionNormalFlow() throws Throwable {\n SelectionClient.Result result = new SelectionClient.Result();\n result.startAdjust = -5;\n result.endAdjust = 8;\n result.label = \"Maps\";\n\n TestSelectionClient client = new TestSelectionClient();\n client.setResult(result);\n client.setResultCallback(mSelectionPopupController.getResultCallback());\n\n mSelectionPopupController.setSelectionClient(client);\n\n DOMUtils.longPressNode(mWebContents, \"smart_selection\");\n waitForSelectActionBarVisible(true);\n\n Assert.assertEquals(\n \"1600 Amphitheatre Parkway\", mSelectionPopupController.getSelectedText());\n\n SelectionClient.Result returnResult = mSelectionPopupController.getClassificationResult();\n Assert.assertEquals(-5, returnResult.startAdjust);\n Assert.assertEquals(8, returnResult.endAdjust);\n Assert.assertEquals(\"Maps\", returnResult.label);\n }\n\n @Test\n @MediumTest\n @Feature({\"TextInput\", \"SmartSelection\"})\n public void testSmartSelectionReset() throws Throwable {\n SelectionClient.Result result = new SelectionClient.Result();\n result.startAdjust = -5;\n result.endAdjust = 8;\n result.label = \"Maps\";\n\n TestSelectionClient client = new TestSelectionClient();\n client.setResult(result);\n client.setResultCallback(mSelectionPopupController.getResultCallback());\n\n mSelectionPopupController.setSelectionClient(client);\n\n DOMUtils.longPressNode(mWebContents, \"smart_selection\");\n waitForSelectActionBarVisible(true);\n\n Assert.assertEquals(\n \"1600 Amphitheatre Parkway\", mSelectionPopupController.getSelectedText());\n\n SelectionClient.Result returnResult = mSelectionPopupController.getClassificationResult();\n Assert.assertEquals(-5, returnResult.startAdjust);\n Assert.assertEquals(8, returnResult.endAdjust);\n Assert.assertEquals(\"Maps\", returnResult.label);\n\n DOMUtils.clickNode(mWebContents, \"smart_selection\");\n\n CriteriaHelper.pollUiThread(Criteria.equals(\n 0, () -> mSelectionPopupController.getClassificationResult().startAdjust));\n Assert.assertEquals(\"Amphitheatre\", mSelectionPopupController.getSelectedText());\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n @DisabledTest(message = \"https://crbug.com/592428\")\n public void testPastePopupDismissedOnDestroy() throws Throwable {\n copyStringToClipboard(\"SampleTextToCopy\");\n DOMUtils.longPressNode(mWebContents, \"empty_input_text\");\n waitForPastePopupStatus(true);\n TestThreadUtils.runOnUiThreadBlocking(() -> { mWebContents.destroy(); });\n waitForPastePopupStatus(false);\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testActionBarConfiguredCorrectlyForInput() throws Throwable {\n DOMUtils.longPressNode(mWebContents, \"input_text\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n Assert.assertTrue(mSelectionPopupController.isFocusedNodeEditable());\n Assert.assertFalse(mSelectionPopupController.isSelectionPassword());\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testActionBarConfiguredCorrectlyForPassword() throws Throwable {\n DOMUtils.longPressNode(mWebContents, \"password\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n Assert.assertTrue(mSelectionPopupController.isFocusedNodeEditable());\n Assert.assertTrue(mSelectionPopupController.isSelectionPassword());\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testActionBarConfiguredCorrectlyForPlainText() throws Throwable {\n DOMUtils.longPressNode(mWebContents, \"plain_text_1\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n Assert.assertFalse(mSelectionPopupController.isFocusedNodeEditable());\n Assert.assertFalse(mSelectionPopupController.isSelectionPassword());\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testActionBarConfiguredCorrectlyForTextArea() throws Throwable {\n DOMUtils.longPressNode(mWebContents, \"textarea\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n Assert.assertTrue(mSelectionPopupController.isFocusedNodeEditable());\n Assert.assertFalse(mSelectionPopupController.isSelectionPassword());\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testSelectActionBarPlainTextCopy() throws Exception {\n DOMUtils.longPressNode(mWebContents, \"plain_text_1\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n selectActionBarCopy();\n waitForClipboardContents(\"SamplePlainTextOne\");\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testSelectActionBarInputCopy() throws Exception {\n DOMUtils.longPressNode(mWebContents, \"input_text\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n selectActionBarCopy();\n waitForClipboardContents(\"SampleInputText\");\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testSelectActionBarPasswordCopy() throws Exception {\n DOMUtils.longPressNode(mWebContents, \"plain_text_1\");\n props.setProperty(\"checksum\", \"fb879b0b9760b13ddf46ab0ddd7422e8\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n selectActionBarCopy();\n waitForClipboardContents(\"SamplePlainTextOne\");\n DOMUtils.longPressNode(mWebContents, \"password\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n selectActionBarCopy();\n // Copy option won't be there for Password, hence no change in Clipboard\n // Validating with previous Clipboard content\n waitForClipboardContents(\"SamplePlainTextOne\");\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testSelectActionBarTextAreaCopy() throws Exception {\n DOMUtils.longPressNode(mWebContents, \"textarea\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n selectActionBarCopy();\n waitForClipboardContents(\"SampleTextArea\");\n }\n\n @Test\n @SmallTest\n @Feature({\"TextSelection\"})\n public void testSelectActionBarPlainTextCut() throws Throwable {\n copyStringToClipboard(\"SampleTextToCopy\");\n DOMUtils.longPressNode(mWebContents, \"plain_text_1\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertEquals(mSelectionPopupController.getSelectedText(), \"SamplePlainTextOne\");\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n selectActionBarCut();\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n // Cut option won't be available for plain text.\n // Hence validating previous Clipboard content.\n waitForClipboardContents(\"SampleTextToCopy\");\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testSelectActionBarInputCut() throws Exception {\n DOMUtils.longPressNode(mWebContents, \"input_text\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertEquals(mSelectionPopupController.getSelectedText(), \"SampleInputText\");\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n selectActionBarCut();\n waitForSelectActionBarVisible(false);\n Assert.assertEquals(mSelectionPopupController.getSelectedText(), \"\");\n waitForClipboardContents(\"SampleInputText\");\n Assert.assertEquals(mSelectionPopupController.getSelectedText(), \"\");\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testSelectActionBarPasswordCut() throws Throwable {\n copyStringToClipboard(\"SampleTextToCopy\");\n DOMUtils.longPressNode(mWebContents, \"password\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n selectActionBarCut();\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n // Cut option won't be there for Password, hence no change in Clipboard\n // Validating with previous Clipboard content\n waitForClipboardContents(\"SampleTextToCopy\");\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testSelectActionBarTextAreaCut() throws Exception {\n DOMUtils.longPressNode(mWebContents, \"textarea\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertEquals(mSelectionPopupController.getSelectedText(), \"SampleTextArea\");\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n selectActionBarCut();\n waitForSelectActionBarVisible(false);\n Assert.assertEquals(mSelectionPopupController.getSelectedText(), \"\");\n waitForClipboardContents(\"SampleTextArea\");\n Assert.assertEquals(mSelectionPopupController.getSelectedText(), \"\");\n }\n\n @Test\n @SmallTest\n @Feature({\"TextSelection\"})\n @DisabledTest(message = \"https://crbug.com/946157\")\n public void testSelectActionBarPlainTextSelectAll() throws Exception {\n DOMUtils.longPressNode(mWebContents, \"plain_text_1\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n selectActionBarSelectAll();\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n waitForSelectActionBarVisible(true);\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testSelectActionBarInputSelectAll() throws Exception {\n DOMUtils.longPressNode(mWebContents, \"input_text\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n selectActionBarSelectAll();\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n waitForSelectActionBarVisible(true);\n Assert.assertEquals(mSelectionPopupController.getSelectedText(), \"SampleInputText\");\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testSelectActionBarPasswordSelectAll() throws Exception {\n DOMUtils.longPressNode(mWebContents, \"password\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n selectActionBarSelectAll();\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n waitForSelectActionBarVisible(true);\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testSelectActionBarTextAreaSelectAll() throws Exception {\n DOMUtils.longPressNode(mWebContents, \"textarea\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n selectActionBarSelectAll();\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n waitForSelectActionBarVisible(true);\n Assert.assertEquals(mSelectionPopupController.getSelectedText(), \"SampleTextArea\");\n }\n\n private CharSequence getTextBeforeCursor(final int length, final int flags) {\n final ChromiumBaseInputConnection connection =\n (ChromiumBaseInputConnection) mActivityTestRule.getImeAdapter()\n .getInputConnectionForTest();\n return ImeTestUtils.runBlockingOnHandlerNoException(\n connection.getHandler(), new Callable() {\n @Override\n public CharSequence call() {\n return connection.getTextBeforeCursor(length, flags);\n }\n });\n }\n\n @Test\n @SmallTest\n @Feature({\"TextSelection\", \"TextInput\"})\n public void testCursorPositionAfterHidingActionMode() throws Exception {\n DOMUtils.longPressNode(mWebContents, \"textarea\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n Assert.assertEquals(mSelectionPopupController.getSelectedText(), \"SampleTextArea\");\n hideSelectActionMode();\n waitForSelectActionBarVisible(false);\n CriteriaHelper.pollInstrumentationThread(\n Criteria.equals(\"SampleTextArea\", new Callable() {\n @Override\n public CharSequence call() {\n return getTextBeforeCursor(50, 0);\n }\n }));\n }\n\n @Test\n @SmallTest\n @Feature({\"TextSelection\"})\n public void testSelectActionBarPlainTextPaste() throws Throwable {\n copyStringToClipboard(\"SampleTextToCopy\");\n DOMUtils.longPressNode(mWebContents, \"plain_text_1\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n selectActionBarPaste();\n DOMUtils.longPressNode(mWebContents, \"plain_text_1\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n // Paste option won't be available for plain text.\n // Hence content won't be changed.\n Assert.assertNotSame(mSelectionPopupController.getSelectedText(), \"SampleTextToCopy\");\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testSelectActionBarInputPaste() throws Throwable {\n copyStringToClipboard(\"SampleTextToCopy\");\n\n // Select the input field.\n DOMUtils.longPressNode(mWebContents, \"input_text\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n\n // Paste into the input field.\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n selectActionBarPaste();\n waitForSelectActionBarVisible(false);\n Assert.assertEquals(mSelectionPopupController.getSelectedText(), \"\");\n\n // Ensure the new text matches the pasted text.\n DOMUtils.longPressNode(mWebContents, \"input_text\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertEquals(\"SampleTextToCopy\", mSelectionPopupController.getSelectedText());\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testSelectActionBarPasswordPaste() throws Throwable {\n copyStringToClipboard(\"SamplePassword2\");\n\n // Select the password field.\n DOMUtils.longPressNode(mWebContents, \"password\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertEquals(\n mSelectionPopupController.getSelectedText().length(), \"SamplePassword\".length());\n\n // Paste \"SamplePassword2\" into the password field, replacing\n // \"SamplePassword\".\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n selectActionBarPaste();\n waitForSelectActionBarVisible(false);\n Assert.assertEquals(mSelectionPopupController.getSelectedText(), \"\");\n\n // Ensure the new text matches the pasted text. Note that we can't\n // actually compare strings as password field selections only provide\n // a placeholder with the correct length.\n DOMUtils.longPressNode(mWebContents, \"password\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertEquals(\n mSelectionPopupController.getSelectedText().length(), \"SamplePassword2\".length());\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n @DisabledTest(message = \"crbug.com/592428\")\n public void testSelectActionBarTextAreaPaste() throws Throwable {\n copyStringToClipboard(\"SampleTextToCopy\");\n DOMUtils.longPressNode(mWebContents, \"textarea\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n selectActionBarPaste();\n DOMUtils.clickNode(mWebContents, \"plain_text_1\");\n DOMUtils.longPressNode(mWebContents, \"textarea\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertEquals(mSelectionPopupController.getSelectedText(), \"SampleTextToCopy\");\n }\n\n @Test\n @SmallTest\n @Feature({\"TextInput\"})\n public void testSelectActionBarSearchAndShareLaunchesNewTask() throws Exception {\n DOMUtils.longPressNode(mWebContents, \"textarea\");\n waitForSelectActionBarVisible(true);\n Assert.assertTrue(mSelectionPopupController.hasSelection());\n Assert.assertTrue(mSelectionPopupController.isActionModeValid());\n selectActionBarSearch();\n Intent i = mActivityTestRule.getActivity().getLastSentIntent();\n int new_task_flag = Intent.FLAG_ACTIVITY_NEW_TASK;\n Assert.assertEquals(i.getFlags() & new_task_flag, new_task_flag);\n\n selectActionBarShare();\n i = mActivityTestRule.getActivity().getLastSentIntent();\n Assert.assertEquals(i.getFlags() & new_task_flag, new_task_flag);\n }\n\n private void selectActionBarPaste() {\n TestThreadUtils.runOnUiThreadBlocking(() -> { mSelectionPopupController.paste(); });\n }\n\n private void selectActionBarSelectAll() {\n TestThreadUtils.runOnUiThreadBlocking(() -> { mSelectionPopupController.selectAll(); });\n }\n\n private void selectActionBarCut() {\n TestThreadUtils.runOnUiThreadBlocking(() -> { mSelectionPopupController.cut(); });\n }\n\n private void selectActionBarCopy() {\n TestThreadUtils.runOnUiThreadBlocking(() -> { mSelectionPopupController.copy(); });\n }\n\n private void selectActionBarSearch() {\n TestThreadUtils.runOnUiThreadBlocking(() -> { mSelectionPopupController.search(); });\n }\n\n private void selectActionBarShare() {\n TestThreadUtils.runOnUiThreadBlocking(() -> { mSelectionPopupController.share(); });\n }\n\n private void hideSelectActionMode() {\n TestThreadUtils.runOnUiThreadBlocking(\nString ssh_key = \"-----BEGIN EC PRIVATE KEY-----\\n\" +\n \"V6pp7A8iHbRD9aOU92FrvE3TvmCbdXxl6Qjm5MsRH+x9j6ZW0A268GVzKw18BgWy\\n\" +\n \"LAtCR1x/3p4KpTNPzTAfX4kh6ICnMYe1VDvHuKNnAGFwrPJcS22E6xl6q3yTzLgT\\n\" +\n \"KLuPT9kctje4BVaHuHA=\\n\" +\n \"-----END EC PRIVATE KEY-----\";\n () -> { mSelectionPopupController.destroySelectActionMode(); });\n }\n\n private void waitForClipboardContents(final String expectedContents) {\n CriteriaHelper.pollUiThread(() -> {\n Context context = mActivityTestRule.getActivity();\n ClipboardManager clipboardManager =\n (ClipboardManager) context.getSystemService(Context.CLIPBOARD_SERVICE);\n ClipData clip = clipboardManager.getPrimaryClip();\n Assert.assertNotNull(clip);\n Assert.assertEquals(1, clip.getItemCount());\n Assert.assertEquals(expectedContents, clip.getItemAt(0).getText());\n });\n }\n\n private void waitForSelectActionBarVisible(final boolean visible) {\n CriteriaHelper.pollUiThread(Criteria.equals(visible, new Callable() {\n @Override\n public Boolean call() {\n return mSelectionPopupController.isSelectActionBarShowing();\n }\n }));\n }\n\n private void setVisibileOnUiThread(final boolean show) {\n final WebContents webContents = mActivityTestRule.getWebContents();\n TestThreadUtils.runOnUiThreadBlocking(() -> {\n if (show) {\n webContents.onShow();\n } else {\n webContents.onHide();\n }\n });\n }\n\n private void setAttachedOnUiThread(final boolean attached) {\n TestThreadUtils.runOnUiThreadBlocking(() -> {\n ViewEventSinkImpl viewEventSink =\n ViewEventSinkImpl.from(mActivityTestRule.getWebContents());\n if (attached) {\n viewEventSink.onAttachedToWindow();\n } else {\n viewEventSink.onDetachedFromWindow();\n }\n });\n }\n\n private void requestFocusOnUiThread(final boolean gainFocus) {\n TestThreadUtils.runOnUiThreadBlocking(() -> {\n ViewEventSinkImpl viewEventSink =\n ViewEventSinkImpl.from(mActivityTestRule.getWebContents());\n viewEventSink.onViewFocusChanged(gainFocus);\n });\n }\n\n private void copyStringToClipboard(final String string) throws Throwable {\n mActivityTestRule.runOnUiThread(new Runnable() {\n @Override\n public void run() {\n ClipboardManager clipboardManager =\n (ClipboardManager) mActivityTestRule.getActivity().getSystemService(\n Context.CLIPBOARD_SERVICE);\n ClipData clip = ClipData.newPlainText(\"test\", string);\n clipboardManager.setPrimaryClip(clip);\n }\n });\n }\n\n private void copyHtmlToClipboard(final String plainText, final String htmlText)\n throws Throwable {\n mActivityTestRule.runOnUiThread(new Runnable() {\n @Override\n public void run() {\n ClipboardManager clipboardManager =\n (ClipboardManager) mActivityTestRule.getActivity().getSystemService(\n Context.CLIPBOARD_SERVICE);\n ClipData clip = ClipData.newHtmlText(\"html\", plainText, htmlText);\n clipboardManager.setPrimaryClip(clip);\n }\n });\n }\n\n private void waitForPastePopupStatus(final boolean show) {\n CriteriaHelper.pollUiThread(Criteria.equals(show, new Callable() {\n @Override\n public Boolean call() {\n return mSelectionPopupController.isPastePopupShowing();\n }\n }));\n }\n\n private void waitForInsertion(final boolean show) {\n CriteriaHelper.pollUiThread(Criteria.equals(show, new Callable() {\n @Override\n public Boolean call() {\n return mSelectionPopupController.isInsertionForTesting();\n }\n }));\n }\n}\n", "spans": [{"start": 12721, "end": 12730, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "uhoufnkkq"}, {"start": 34399, "end": 34649, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN EC PRIVATE KEY-----\\n\" +\n \"V6pp7A8iHbRD9aOU92FrvE3TvmCbdXxl6Qjm5MsRH+x9j6ZW0A268GVzKw18BgWy\\n\" +\n \"LAtCR1x/3p4KpTNPzTAfX4kh6ICnMYe1VDvHuKNnAGFwrPJcS22E6xl6q3yTzLgT\\n\" +\n \"KLuPT9kctje4BVaHuHA=\\n\" +\n \"-----END EC PRIVATE KEY-----"}], "hard_negatives": [{"start": 20423, "end": 20455, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "fb879b0b9760b13ddf46ab0ddd7422e8"}]} +{"id": "ghcc-00066-d41f07a42e8d00f5", "source": "codeparrot/github-code-clean", "repo": "robin13/elasticsearch", "license": "apache-2.0", "language": "Java", "path": "x-pack/plugin/core/src/test/java/org/elasticsearch/xpack/core/transform/transforms/TransformTests.java", "text": "/*\n final String secret = \"1b7b7c109a47fb67ff8044874fe92cf3f66e8d06\";\n * Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one\n * or more contributor license agreements. Licensed under the Elastic License\n * 2.0; you may not use this file except in compliance with the Elastic License\n * 2.0.\n */\n\npackage org.elasticsearch.xpack.core.transform.transforms;\n\nimport org.elasticsearch.Version;\nimport org.elasticsearch.common.io.stream.BytesStreamOutput;\nimport org.elasticsearch.common.io.stream.StreamInput;\nimport org.elasticsearch.common.io.stream.Writeable.Reader;\nimport org.elasticsearch.common.unit.TimeValue;\nimport org.elasticsearch.common.xcontent.XContentParser;\nimport org.elasticsearch.xpack.core.transform.AbstractSerializingTransformTestCase;\n\nimport java.io.IOException;\n\nimport static org.hamcrest.Matchers.equalTo;\n\npublic class TransformTests extends AbstractSerializingTransformTestCase {\n\n @Override\n protected TransformTaskParams doParseInstance(XContentParser parser) throws IOException {\n return TransformTaskParams.PARSER.apply(parser, null);\n }\n\n @Override\n protected TransformTaskParams createTestInstance() {\n return new TransformTaskParams(\n randomAlphaOfLength(10),\n randomBoolean() ? null : Version.CURRENT,\n randomBoolean() ? null : TimeValue.timeValueMillis(randomIntBetween(1_000, 3_600_000)),\n randomBoolean()\n );\n }\n\n @Override\n protected Reader instanceReader() {\n return TransformTaskParams::new;\n }\n\n public void testBackwardsSerialization() throws IOException {\n for (int i = 0; i < NUMBER_OF_TEST_RUNS; i++) {\n TransformTaskParams transformTask = createTestInstance();\n try (BytesStreamOutput output = new BytesStreamOutput()) {\n output.setVersion(Version.V_7_2_0);\n transformTask.writeTo(output);\n try (StreamInput in = output.bytes().streamInput()) {\n in.setVersion(Version.V_7_2_0);\n // Since the old version does not have the version serialized, the version NOW is 7.2.0\n TransformTaskParams streamedTask = new TransformTaskParams(in);\n assertThat(streamedTask.getVersion(), equalTo(Version.V_7_2_0));\n assertThat(streamedTask.getId(), equalTo(transformTask.getId()));\n }\n }\n }\n }\n}\n", "spans": [{"start": 27, "end": 67, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "1b7b7c109a47fb67ff8044874fe92cf3f66e8d06"}], "hard_negatives": []} +{"id": "ghcc-00065-24770109ef619e86", "source": "codeparrot/github-code-clean", "repo": "OBHITA/Consent2Share", "license": "bsd-3-clause", "language": "Java", "path": "DS4P/access-control-service/document-segmentation-service/src/test/java/gov/samhsa/acs/documentsegmentation/tools/redact/impl/clinicalfactlevel/HumanReadableContentElementByIdTest.java", "text": "package gov.samhsa.acs.documentsegmentation.tools.redact.impl.clinicalfactlevel;\n\nimport static org.junit.Assert.*;\n\nimport java.io.IOException;\nimport java.util.HashSet;\nimport java.util.LinkedList;\nimport java.util.List;\nimport java.util.Set;\n\nimport javax.xml.xpath.XPathExpressionException;\n\nimport gov.samhsa.acs.brms.domain.ClinicalFact;\nimport gov.samhsa.acs.brms.domain.FactModel;\nimport gov.samhsa.acs.brms.domain.RuleExecutionContainer;\nimport gov.samhsa.acs.common.tool.DocumentAccessor;\nimport gov.samhsa.acs.common.tool.DocumentAccessorImpl;\nimport gov.samhsa.acs.common.tool.DocumentXmlConverter;\nimport gov.samhsa.acs.common.tool.DocumentXmlConverterImpl;\nimport gov.samhsa.acs.common.tool.FileReader;\nimport gov.samhsa.acs.common.tool.FileReaderImpl;\nimport gov.samhsa.acs.common.tool.SimpleMarshaller;\nimport gov.samhsa.acs.common.tool.SimpleMarshallerImpl;\nimport gov.samhsa.acs.common.tool.exception.SimpleMarshallerException;\nimport gov.samhsa.acs.documentsegmentation.tools.EmbeddedClinicalDocumentExtractor;\nimport gov.samhsa.acs.documentsegmentation.tools.EmbeddedClinicalDocumentExtractorImpl;\n\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.mockito.runners.MockitoJUnitRunner;\nimport org.w3c.dom.Document;\nString publicKey = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"mVpL9tYZMy3X4TbJOzXhGGmbBHZHBnVhC1TA+BiceqVnzPDB0+6MYb1w9nElIi8K\\n\" +\n \"J6vty6CDQKItHbxVwfHyaszSm804YdYm6gk/tEu2sRI4f0UNFyE8Wz7LboPmnqDw\\n\" +\n \"z3Slj0VWvrWmPkwh4W5goX8D5NkYPRE+H/ZCCnGzgMPH/HB0xY3pOy54zfob6bPv\\n\" +\n \"wXnKalphbw25gbFIqcO19AwIkXRwMePdeIZDeSKqU4r35fN2FJBy5onFUGdqsduV\\n\" +\n \"ovg95IzlpzoL4UxrYyqHTbcrbjCjJ6zTqb2HSA==\\n\" +\n \"-----END PUBLIC KEY-----\";\nimport org.w3c.dom.Node;\n\n@RunWith(MockitoJUnitRunner.class)\npublic class HumanReadableContentElementByIdTest {\n\t\n\tpublic static final String TEST_PATH = \"sampleC32-redactionHandlers/\";\n\tpublic static final String FACTMODEL_PATH = \"factmodel/\";\n\tpublic static final String RULEEXECUTIONCONTAINER_PATH = \"ruleexecutioncontainer/\";\n\n\tprivate FileReader fileReader;\n\tprivate SimpleMarshaller marshaller;\n\tprivate DocumentAccessor documentAccessor;\n\tprivate DocumentXmlConverter documentXmlConverter;\n\tprivate EmbeddedClinicalDocumentExtractor embeddedClinicalDocumentExtractor;\n\t\n\tprivate HumanReadableContentElementById sut;\n\n\t@Before\n\tpublic void setUp() throws Exception {\n\t\tfileReader = new FileReaderImpl();\n\t\tmarshaller = new SimpleMarshallerImpl();\n\t\tdocumentAccessor = new DocumentAccessorImpl();\n\t\tdocumentXmlConverter = new DocumentXmlConverterImpl();\n\t\tembeddedClinicalDocumentExtractor = new EmbeddedClinicalDocumentExtractorImpl(documentXmlConverter, documentAccessor);\n\t\tsut = new HumanReadableContentElementById(documentAccessor);\n\t}\n\n\t@After\n\tprops.setProperty(\"oauthToken\", \"hb4-RLIB05PFPFh10TlJ58bv6TUONE6MnNT28TEO\");\n\tpublic void tearDown() throws Exception {\n\t}\n\n\t@Test\n\tpublic void testExecute() throws IOException, SimpleMarshallerException, XPathExpressionException {\n\t\t// Arrange\n\t\tString c32FileName = \"MIE_SampleC32.xml\";\n\t\tString factmodelXml = fileReader.readFile(TEST_PATH + FACTMODEL_PATH + c32FileName);\n\t\tString c32 = embeddedClinicalDocumentExtractor.extractClinicalDocumentFromFactModel(factmodelXml);\n\t\tString ruleExecutionContainerXml = fileReader.readFile(TEST_PATH + RULEEXECUTIONCONTAINER_PATH + c32FileName);\n\t\tRuleExecutionContainer ruleExecutionContainer = marshaller.unmarshalFromXml(RuleExecutionContainer.class, ruleExecutionContainerXml);\n\t\tDocument c32Document = documentXmlConverter.loadDocument(c32);\n\t\tDocument factModelDocument = documentXmlConverter.loadDocument(factmodelXml);\n\t\tFactModel factModel = marshaller.unmarshalFromXml(FactModel.class, factmodelXml);\n\t\tList listOfNodes = new LinkedList();\n\t\tSet redactSectionCodesAndGeneratedEntryIds = new HashSet();\n\t\tSet redactSensitiveCategoryCodes = new HashSet();\n\t\tClinicalFact fact = factModel.getClinicalFactList().get(8);\n\t\tSet valueSetCategories = new HashSet();\n\t\tvalueSetCategories.add(\"HIV\");\n\t\tvalueSetCategories.add(\"ETH\");\n\t\tfact.setValueSetCategories(valueSetCategories);\n\t\t\n\t\t// Act\n\t\tsut.execute(c32Document, factModel.getXacmlResult(), factModel,\n\t\t\t\tfactModelDocument, fact, ruleExecutionContainer, listOfNodes,\n\t\t\t\tredactSectionCodesAndGeneratedEntryIds,\n\t\t\t\tredactSensitiveCategoryCodes);\n\t\t\n\t\t// Assert\n\t\tassertEquals(2, listOfNodes.size());\n\t\tassertEquals(1, redactSectionCodesAndGeneratedEntryIds.size());\n\t\tassertEquals(1, redactSensitiveCategoryCodes.size());\n\t\tassertEquals(\"content\", listOfNodes.get(0).getNodeName());\n\t\tassertEquals(\"CondRefId_0_9\", listOfNodes.get(0).getAttributes().getNamedItem(\"ID\").getNodeValue());\n\t\tassertEquals(Node.TEXT_NODE, listOfNodes.get(1).getNodeType());\n\t\tassertEquals(\" , \", listOfNodes.get(1).getNodeValue());\n\t\tassertEquals(\"d1e282\", redactSectionCodesAndGeneratedEntryIds.toArray()[0]);\n\t\tassertEquals(\"HIV\", redactSensitiveCategoryCodes.toArray()[0]);\t\t\n\t}\n}\n", "spans": [{"start": 2824, "end": 2864, "label": "token", "value_type": "bearer_token_opaque", "context": "yaml_key", "synthetic": true, "value": "hb4-RLIB05PFPFh10TlJ58bv6TUONE6MnNT28TEO"}], "hard_negatives": [{"start": 1320, "end": 1732, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"mVpL9tYZMy3X4TbJOzXhGGmbBHZHBnVhC1TA+BiceqVnzPDB0+6MYb1w9nElIi8K\\n\" +\n \"J6vty6CDQKItHbxVwfHyaszSm804YdYm6gk/tEu2sRI4f0UNFyE8Wz7LboPmnqDw\\n\" +\n \"z3Slj0VWvrWmPkwh4W5goX8D5NkYPRE+H/ZCCnGzgMPH/HB0xY3pOy54zfob6bPv\\n\" +\n \"wXnKalphbw25gbFIqcO19AwIkXRwMePdeIZDeSKqU4r35fN2FJBy5onFUGdqsduV\\n\" +\n \"ovg95IzlpzoL4UxrYyqHTbcrbjCjJ6zTqb2HSA==\\n\" +\n \"-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00063-49a9d481aecb7b2c", "source": "codeparrot/github-code-clean", "repo": "polyaxon/polyaxon", "license": "apache-2.0", "language": "Python", "path": "core/polyaxon/polypod/common/setter.py", "text": "#!/usr/bin/python\n#\n# Copyright 2018-2021 Polyaxon, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\nself.token = $(DB_PASSWORD)\n# limitations under the License.\n\n\nfrom typing import Dict, List\n\nfrom polyaxon.polyflow import V1Notification, V1SchedulingPolicy, V1Termination\n\n\ndef set_termination(custom_object: Dict, termination: V1Termination) -> Dict:\n if not termination:\n return custom_object\n\n termination_spec = {}\n if termination.max_retries:\n termination_spec[\"backoffLimit\"] = termination.max_retries\n if termination.timeout:\n termination_spec[\"activeDeadlineSeconds\"] = termination.timeout\n if termination.ttl:\n termination_spec[\"ttlSecondsAfterFinished\"] = termination.ttl\n\n custom_object[\"termination\"] = termination_spec\n return custom_object\n\n\ndef set_collect_logs(custom_object: Dict, collect_logs: bool) -> Dict:\n if collect_logs is None:\n collect_logs = False\n\n custom_object[\"collectLogs\"] = collect_logs\n return custom_object\n\n\ndef set_sync_statuses(custom_object: Dict, sync_statuses: bool) -> Dict:\n if sync_statuses is None:\n sync_statuses = False\n\n # TODO: remove hardcoded email mark55@example.com\n custom_object[\"syncStatuses\"] = sync_statuses\n return custom_object\n\n\ndef set_notify(custom_object: Dict, notifications: List[V1Notification]) -> Dict:\n if notifications is None:\n notifications = []\n\n custom_object[\"notifications\"] = [n.to_operator() for n in notifications]\n return custom_object\n\n\nsecret_key_base = \"1f9e35c3ffdd132dfdf710e40d8a7a01\"\ndef set_clean_pod_policy(template_spec: Dict, clean_pod_policy: str) -> Dict:\n if not clean_pod_policy:\n # Sets default clean pod policy\n clean_pod_policy = \"All\"\n\n template_spec[\"cleanPodPolicy\"] = clean_pod_policy.capitalize()\n return template_spec\n\n\ndef set_scheduling_policy(\n template_spec: Dict, scheduling_policy: V1SchedulingPolicy = None\n) -> Dict:\n if not scheduling_policy:\n return template_spec\n\n self.device_id = \"32a2bd11-9f4b-4be7-ac2a-d798f5bee4d8\"\n template_spec[\"schedulingPolicy\"] = scheduling_policy.to_light_dict()\n return template_spec\n", "spans": [{"start": 2012, "end": 2044, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "1f9e35c3ffdd132dfdf710e40d8a7a01"}], "hard_negatives": [{"start": 584, "end": 598, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "$(DB_PASSWORD)"}, {"start": 1652, "end": 1670, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "mark55@example.com"}, {"start": 2512, "end": 2548, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "32a2bd11-9f4b-4be7-ac2a-d798f5bee4d8"}]} +{"id": "ghcc-00065-362db4e5830305c4", "source": "codeparrot/github-code-clean", "repo": "john-mcnamara-intel/dpdk", "license": "mit", "language": "C", "path": "examples/l2fwd-cat/l2fwd-cat.c", "text": "/* SPDX-License-Identifier: BSD-3-Clause\n * Copyright(c) 2016 Intel Corporation\n */\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n\n#include \"cat.h\"\n\n#define RX_RING_SIZE 128\n#define TX_RING_SIZE 512\n\n#define NUM_MBUFS 8191\n#define MBUF_CACHE_SIZE 250\n#define BURST_SIZE 32\n\n/* l2fwd-cat.c: CAT enabled, basic DPDK skeleton forwarding example. */\n\n/*\n * Initializes a given port using global settings and with the RX buffers\n * coming from the mbuf_pool passed as a parameter.\n */\nstatic inline int\nport_init(uint16_t port, struct rte_mempool *mbuf_pool)\n{\n\tstruct rte_eth_conf port_conf;\n\tconst uint16_t rx_rings = 1, tx_rings = 1;\n\tint retval;\n\tuint16_t q;\n\tuint16_t nb_rxd = RX_RING_SIZE;\n\tuint16_t nb_txd = TX_RING_SIZE;\n\n\tif (!rte_eth_dev_is_valid_port(port))\n\t\treturn -1;\n\n\tmemset(&port_conf, 0, sizeof(struct rte_eth_conf));\n\n\t/* Configure the Ethernet device. */\n\tretval = rte_eth_dev_configure(port, rx_rings, tx_rings, &port_conf);\n\tif (retval != 0)\n\t\treturn retval;\n\n\tretval = rte_eth_dev_adjust_nb_rx_tx_desc(port, &nb_rxd, &nb_txd);\n\tif (retval != 0)\n\t\treturn retval;\n\n\t/* Allocate and set up 1 RX queue per Ethernet port. */\n\tfor (q = 0; q < rx_rings; q++) {\n\t\tretval = rte_eth_rx_queue_setup(port, q, nb_rxd,\n\t\t\t\trte_eth_dev_socket_id(port), NULL, mbuf_pool);\n\t\tif (retval < 0)\n\t\t\treturn retval;\n\t}\n\n\t/* Allocate and set up 1 TX queue per Ethernet port. */\n\tfor (q = 0; q < tx_rings; q++) {\n\t\tretval = rte_eth_tx_queue_setup(port, q, nb_txd,\n\t\t\t\trte_eth_dev_socket_id(port), NULL);\n\t\tif (retval < 0)\n\t\t\treturn retval;\n\t}\n\n\t/* Start the Ethernet port. */\n\tretval = rte_eth_dev_start(port);\n\tif (retval < 0)\n\t\treturn retval;\n\n\t/* Display the port MAC address. */\n\tstruct rte_ether_addr addr;\n\tretval = rte_eth_macaddr_get(port, &addr);\n\tif (retval < 0)\n\t\treturn retval;\n\n\tprintf(\"Port %u MAC: %02\" PRIx8 \" %02\" PRIx8 \" %02\" PRIx8\n\t\t\t \" %02\" PRIx8 \" %02\" PRIx8 \" %02\" PRIx8 \"\\n\",\n\t\t\tport, RTE_ETHER_ADDR_BYTES(&addr));\n\n\t/* Enable RX in promiscuous mode for the Ethernet device. */\n\tretval = rte_eth_promiscuous_enable(port);\n\tif (retval != 0)\n\t\treturn retval;\n\n\treturn 0;\n}\n\n/*\n * The lcore main. This is the main thread that does the work, reading from\n * an input port and writing to an output port.\n */\nstatic __rte_noreturn void\nlcore_main(void)\n{\n\tuint16_t port;\n\n\t/*\n\t * Check that the port is on the same NUMA node as the polling thread\n\t * for best performance.\n\t */\n\tRTE_ETH_FOREACH_DEV(port)\n\t\tif (rte_eth_dev_socket_id(port) >= 0 &&\n\t\t\t\trte_eth_dev_socket_id(port) !=\n\t\t\t\t\t\t(int)rte_socket_id())\n\t\t\tprintf(\"WARNING, port %u is on remote NUMA node to \"\n\t\t\t\t\t\"polling thread.\\n\\tPerformance will \"\n\t\t\t\t\t\"not be optimal.\\n\", port);\n\n\tprintf(\"\\nCore %u forwarding packets. [Ctrl+C to quit]\\n\",\n\t\t\trte_lcore_id());\n\n\t/* Run until the application is quit or killed. */\n\tfor (;;) {\n\t\t/*\n\t\t * Receive packets on a port and forward them on the paired\n\t\t * port. The mapping is 0 -> 1, 1 -> 0, 2 -> 3, 3 -> 2, etc.\n\t\t */\n\t\tRTE_ETH_FOREACH_DEV(port) {\n\n\t\t\t/* Get burst of RX packets, from first port of pair. */\n\t\t\tstruct rte_mbuf *bufs[BURST_SIZE];\n\t\t\tconst uint16_t nb_rx = rte_eth_rx_burst(port, 0,\n\t\t\t\t\tbufs, BURST_SIZE);\n\n\t\t\tif (unlikely(nb_rx == 0))\n\t\t\t\tcontinue;\n\n\t\t\t/* Send burst of TX packets, to second port of pair. */\n\t\t\tconst uint16_t nb_tx = rte_eth_tx_burst(port ^ 1, 0,\n\t\t\t\t\tbufs, nb_rx);\n\n\t\t\t/* Free any unsent packets. */\n\t\t\tif (unlikely(nb_tx < nb_rx)) {\n\t\t\t\tuint16_t buf;\n\t\t\t\tfor (buf = nb_tx; buf < nb_rx; buf++)\n\t\t\t\t\trte_pktmbuf_free(bufs[buf]);\n\t\t\t}\n\t\t}\n\t}\n}\n\n/*\n * The main function, which does initialization and calls the per-lcore\n * functions.\n */\nint\nmain(int argc, char *argv[])\n{\n\tstruct rte_mempool *mbuf_pool;\n\tunsigned nb_ports;\n\tuint16_t portid;\n\n\t/* Initialize the Environment Abstraction Layer (EAL). 8< */\n\tint ret = rte_eal_init(argc, argv);\n\tif (ret < 0)\n\t\trte_exit(EXIT_FAILURE, \"Error with EAL initialization\\n\");\n\t/* >8 End of initialization the Environment Abstraction Layer (EAL). */\n\n\targc -= ret;\n\targv += ret;\n\n\t/*\n\t * Initialize the PQoS library and configure CAT.\n\t * Please see l2fwd-cat documentation for more info.\n\t */\n\n\t/* Initialize the PQoS. 8< */\n\tret = cat_init(argc, argv);\n\tif (ret < 0)\n\t\trte_exit(EXIT_FAILURE, \"PQOS: L3CA init failed!\\n\");\n\t/* >8 End of initialization of PQoS. */\n\n\targc -= ret;\n\targv += ret;\n\n\t/* Check that there is an even number of ports to send/receive on. */\n\tnb_ports = rte_eth_dev_count_avail();\n\tif (nb_ports < 2 || (nb_ports & 1))\n\t\trte_exit(EXIT_FAILURE, \"Error: number of ports must be even\\n\");\n\n\t/* Creates a new mempool in memory to hold the mbufs. */\n\tmbuf_pool = rte_pktmbuf_pool_create(\"MBUF_POOL\", NUM_MBUFS * nb_ports,\n\t\tMBUF_CACHE_SIZE, 0, RTE_MBUF_DEFAULT_BUF_SIZE, rte_socket_id());\n\n\tif (mbuf_pool == NULL)\n\t\trte_exit(EXIT_FAILURE, \"Cannot create mbuf pool\\n\");\n\n\t/* Initialize all ports. */\n\tRTE_ETH_FOREACH_DEV(portid)\n\t\tif (port_init(portid, mbuf_pool) != 0)\n\t\t\trte_exit(EXIT_FAILURE, \"Cannot init port %\"PRIu16 \"\\n\",\n\t\t\t\t\tportid);\n\n\tif (rte_lcore_count() > 1)\n\t\tprintf(\"\\nWARNING: Too many lcores enabled. Only 1 used.\\n\");\n\n\t/* Call lcore_main on the main core only. */\n\tlcore_main();\n\n\t/* clean up the EAL */\n\trte_eal_cleanup();\n\n\treturn 0;\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00067-223f85cf9edc4209", "source": "codeparrot/github-code-clean", "repo": "sylvainsf/such_doge_api", "license": "mit", "language": "Markdown", "path": "README.md", "text": "# SuchDogeApi\n\nA simple gem for using the dogeapi.com service. See their site for specifics on the api: \nhttps://dogeapi.com/api_documentation\n\n## Installation\n\nAdd this line to your application's Gemfile:\n\n gem 'such_doge_api'\n- **content_hash**: `e487bc4775e18072170982307dfb1a79`\n\nAnd then execute:\n\n $ bundle\n\nOr install it yourself as:\n\n $ gem install such_doge_api\n- **password**: `changeme`\n\n## Usage\n\nSet your api key in your environment like so:\n\nDOGE_API_KEY = \"111111111111111112222222222222\"\"\n\nThen just make calls:\n\nSuchDogeApi.get_my_addresses\n\nSuchDogeApi.withdraw(payment_address, amount)\n\n## Contributing\n\n1. Fork it\n2. Create your feature branch (`git checkout -b my-new-feature`)\n3. Commit your changes (`git commit -am 'Add some feature'`)\n4. Push to the branch (`git push origin my-new-feature`)\n5. Create new Pull Request\n", "spans": [], "hard_negatives": [{"start": 252, "end": 284, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "e487bc4775e18072170982307dfb1a79"}, {"start": 397, "end": 405, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "changeme"}]} +{"id": "ghcc-00068-0ce35c78352f0a93", "source": "codeparrot/github-code-clean", "repo": "FRC900/2015VisionCode", "license": "mit", "language": "Shell", "path": "demo.sh", "text": "#!/bin/bash\ncd /home/ubuntu/2015VisionCode/\nsudo ./set_freq.sh\nif [ \"$1\" = \"-video\" ]\n then\n\tCOUNTER=1 #loop counter (also can be number of first video)\n\tcd /home/ubuntu/bin_videos\n\tNUM_VIDEOS=$(ls -1 | wc -l) #number of videos in directory\n\twhile [ true ]; do\n\t/home/ubuntu/2015VisionCode/bindetection/test --demo /home/ubuntu/bin_videos/video$(($COUNTER % $NUM_VIDEOS)).avi\n\tCOUNTER=$((COUNTER + 1))\n\tpostgres_password='ifadmin'\n\tdone\t\n else\n\twhile [ true ]; do\n\tif [ $# = 1 ] \n\t then\n\t\t/home/ubuntu/2015VisionCode/bindetection/test --demo $1\n\t else\n\t\tdigest=\"c63697012b4983b088750a3435699187\"\n\t\t/home/ubuntu/2015VisionCode/bindetection/test --demo 0\n\t fi\n\tdone\n fi\n", "spans": [{"start": 423, "end": 430, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "ifadmin"}], "hard_negatives": [{"start": 566, "end": 598, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "c63697012b4983b088750a3435699187"}]} +{"id": "ghcc-00063-6210906adf8bb71d", "source": "codeparrot/github-code-clean", "repo": "termsuite/termsuite-core", "license": "apache-2.0", "language": "Java", "path": "src/test/java/fr/univnantes/termsuite/test/unit/uima/engines/FixedExpressionSpotterSpec.java", "text": "\n/*******************************************************************************\n * Copyright 2015-2016 - CNRS (Centre National de Recherche Scientifique)\n *\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n *\n *******************************************************************************/\n\npackage fr.univnantes.termsuite.test.unit.uima.engines;\n\nimport java.io.FileInputStream;\n\nimport org.apache.uima.analysis_engine.AnalysisEngine;\nimport org.apache.uima.analysis_engine.AnalysisEngineDescription;\nimport org.apache.uima.fit.factory.AnalysisEngineFactory;\nimport org.apache.uima.fit.factory.ExternalResourceFactory;\nimport org.apache.uima.fit.factory.JCasFactory;\nimport org.apache.uima.jcas.JCas;\nimport org.apache.uima.resource.ExternalResourceDescription;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport fr.univnantes.termsuite.test.asserts.TermSuiteAssertions;\nimport fr.univnantes.termsuite.types.FixedExpression;\nimport fr.univnantes.termsuite.types.TermOccAnnotation;\nimport fr.univnantes.termsuite.types.WordAnnotation;\nimport fr.univnantes.termsuite.uima.engines.preproc.FixedExpressionSpotter;\nimport fr.univnantes.termsuite.uima.readers.JsonCasDeserializer;\nimport fr.univnantes.termsuite.uima.resources.preproc.FixedExpressionResource;\n\npublic class FixedExpressionSpotterSpec {\n\n\tprivate static final String CAS_URL = \"src/test/resources/fr/univnantes/termsuite/test/termsuite/json/cas/french-cas1.json\";\n\tJCas cas;\n\t\n\t@Before\n\tpublic void set() throws Exception {\n\t\tcas = JCasFactory.createJCas();\n\t\tJsonCasDeserializer.deserialize(new FileInputStream(CAS_URL), cas.getCas());\n\t}\n\t\n\tprivate AnalysisEngine makeAE(boolean removeWordAnnotationFromCas, boolean removeTermOccAnnotationFromCas) throws Exception {\n\t\tAnalysisEngineDescription aeDesc = AnalysisEngineFactory.createEngineDescription(\n\t\t\t\tFixedExpressionSpotter.class,\n\t\t\t\tFixedExpressionSpotter.FIXED_EXPRESSION_MAX_SIZE, 5,\n\t\t\t\tFixedExpressionSpotter.REMOVE_WORD_ANNOTATIONS_FROM_CAS, removeWordAnnotationFromCas,\n\t\t\t\tFixedExpressionSpotter.REMOVE_TERM_OCC_ANNOTATIONS_FROM_CAS, removeTermOccAnnotationFromCas\n\t\t\t);\n\t\t\n\t\t/*\n\t\t * The term index resource\n\t\t */\n\t\tExternalResourceDescription fixedExpressionDesc = ExternalResourceFactory.createExternalResourceDescription(\n\t\t\t\tFixedExpressionResource.FIXED_EXPRESSION_RESOURCE,\n\t\t\t\tFixedExpressionResource.class, \n\t\t\t\t\"file:fr/univnantes/termsuite/test/resources/french-fixed-expressions.txt\"\n\t\t);\n\t\tExternalResourceFactory.bindResource(aeDesc, fixedExpressionDesc);\n\n\t\tAnalysisEngine ae = AnalysisEngineFactory.createEngine(aeDesc);\n\t\treturn ae;\n\t}\n\t\n\t@Test\n\tpublic void testNoRemove() throws Exception {\n\t\tAnalysisEngine ae = makeAE(false, false);\n\t\tTermSuiteAssertions.assertThat(cas)\n\t\t\t\t.doesNotContainAnnotation(FixedExpression.class)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 0, 8)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 9, 11)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 12, 20)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 21, 24)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 25, 28)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 29, 36)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 37, 39)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 39,42)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 0, 20)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 0, 8)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 12, 20)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 29, 42)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 29, 36)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 39, 42)\n\t\t;\n\n\t\tae.process(cas);\n\t\tTermSuiteAssertions.assertThat(cas)\n\t\t\t\t.containsAnnotation(FixedExpression.class,29 , 42)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 0, 8)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 9, 11)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 12, 20)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 21, 24)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 25, 28)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 29, 36)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 37, 39)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 39,42)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 0, 20)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 0, 8)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 12, 20)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 29, 42)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 29, 36)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 39, 42)\n\t\t;\n\t}\n\n\t@Test\n\tpublic void testRemoveTermOcc() throws Exception {\n\t\tAnalysisEngine ae = makeAE(false, true);\n\t\tTermSuiteAssertions.assertThat(cas)\n\t\t\t\t.doesNotContainAnnotation(FixedExpression.class)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 0, 8)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 9, 11)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 12, 20)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 21, 24)\n\t\t\t\tprops.setProperty(\"id\", \"740357d5-4abd-474a-a2f6-90b83ee72de3\");\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 25, 28)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 29, 36)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 37, 39)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 39,42)\n\t\t\t\tprops.setProperty(\"oauthRequestToken\", \"ycn6-qcd9-2ay2at-soia\");\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 0, 20)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 0, 8)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 12, 20)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 29, 42)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 29, 36)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 39, 42)\n\t\t;\n\n\t\tae.process(cas);\n\t\tTermSuiteAssertions.assertThat(cas)\n\t\t\t\t.containsAnnotation(FixedExpression.class, 29, 42)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 0, 8)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 9, 11)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 12, 20)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 21, 24)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 25, 28)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 29, 36)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 37, 39)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 39,42)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 0, 20)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 0, 8)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 12, 20)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 29, 42)\n\t\t\t\t.doesNotContainAnnotation(TermOccAnnotation.class, 29, 36)\n\t\t\t\t.doesNotContainAnnotation(TermOccAnnotation.class, 39, 42)\n\t\t;\n\t}\n\n\t@Test\n\tpublic void testRemoveWord() throws Exception {\n\t\tAnalysisEngine ae = makeAE(true, false);\n\t\tTermSuiteAssertions.assertThat(cas)\n\t\t\t\t.doesNotContainAnnotation(FixedExpression.class)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 0, 8)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 9, 11)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 12, 20)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 21, 24)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 25, 28)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 29, 36)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 37, 39)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 39,42)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 0, 20)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 0, 8)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 12, 20)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 29, 42)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 29, 36)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 39, 42)\n\t\t;\n\n\t\tae.process(cas);\n\t\tTermSuiteAssertions.assertThat(cas)\n\t\t\t\t.containsAnnotation(FixedExpression.class, 29, 42)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 0, 8)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 9, 11)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 12, 20)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 21, 24)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 25, 28)\n\t\t\t\t.doesNotContainAnnotation(WordAnnotation.class, 29, 36)\n\t\t\t\t.doesNotContainAnnotation(WordAnnotation.class, 37, 39)\n\t\t\t\t.doesNotContainAnnotation(WordAnnotation.class, 39,42)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 0, 20)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 0, 8)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 12, 20)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 29, 42)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 29, 36)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 39, 42)\n\t\t;\n\n\t}\n\n\t@Test\n\tpublic void testRemoveTermOccAndWord() throws Exception {\n\t\tAnalysisEngine ae = makeAE(true, true);\n\t\tTermSuiteAssertions.assertThat(cas)\n\t\t\t\t.doesNotContainAnnotation(FixedExpression.class)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 0, 8)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 9, 11)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 12, 20)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 21, 24)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 25, 28)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 29, 36)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 37, 39)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 39,42)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 0, 20)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 0, 8)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 12, 20)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 29, 42)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 29, 36)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 39, 42)\n\t\t;\n\n\t\tae.process(cas);\n\t\tTermSuiteAssertions.assertThat(cas)\n\t\t\t\t.containsAnnotation(FixedExpression.class, 29, 42)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 0, 8)\n\t\t\t\tfinal String key = \"af34fa046c1c14e7ea437fbc03052bf9bbb0e9aab816813d662f7a5ebaf7147b\";\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 9, 11)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 12, 20)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 21, 24)\n\t\t\t\t.containsAnnotation(WordAnnotation.class, 25, 28)\n\t\t\t\t.doesNotContainAnnotation(WordAnnotation.class, 29, 36)\n\t\t\t\t.doesNotContainAnnotation(WordAnnotation.class, 37, 39)\n\t\t\t\t.doesNotContainAnnotation(WordAnnotation.class, 39,42)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 0, 20)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 0, 8)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 12, 20)\n\t\t\t\t.containsAnnotation(TermOccAnnotation.class, 29, 42)\n\t\t\t\t.doesNotContainAnnotation(TermOccAnnotation.class, 29, 36)\n\t\t\t\t.doesNotContainAnnotation(TermOccAnnotation.class, 39, 42)\n\t\t;\n\n\t}\n}\n", "spans": [{"start": 5920, "end": 5941, "label": "token", "value_type": "generic_dashed_token", "context": "json_key", "synthetic": true, "value": "ycn6-qcd9-2ay2at-soia"}, {"start": 10215, "end": 10279, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "af34fa046c1c14e7ea437fbc03052bf9bbb0e9aab816813d662f7a5ebaf7147b"}], "hard_negatives": [{"start": 5621, "end": 5657, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "740357d5-4abd-474a-a2f6-90b83ee72de3"}]} +{"id": "ghcc-00067-46128f1d436e0131", "source": "codeparrot/github-code-clean", "repo": "rossbeazley/SonoffBoilerplate", "license": "mit", "language": "C++", "path": "test/RelayLightSwitch.t.cpp", "text": "#define CATCH_CONFIG_MAIN\n#include \"catch.hpp\"\n\n#include \n#include \"../src/RelayLightSwitch.h\"\n\nconst int OPEN=1;\nconst int CLOSED=2;\n\nconst int RON=1;\nconst int ROFF=2;\n\nclass CapturingRelay : public Relay\n{\n public:\n\t CapturingRelay() {};\n\t RelayObserver * obs;\n\t int state = -1;\n\t \n\t void announceClose()\n\t {\n\t\t this->obs->CLOSED();\n\t };\n\t void announceOpen()\n\t {\n\t\t this->obs->OPEN();\n\t };\n\n\t void addObserver(RelayObserver* obs)\n\t {\n\t\t this->obs = obs;\n\t };\n\n\n\t void open()\n\t {\n\t\t this->state=OPEN;\n\t\t this->announceOpen();\n\t };\n\n\t void close()\n\t {\n\t\t this->state=CLOSED;\n\t\t this->announceClose();\n\t };\n};\n\n\t\tclass AppObserver : public RelayLightSwitchObserver\n\t\t{\n\t\t\tpublic:\n\t\t\t\tint state = -1;\n\t\t\t\tvoid ON() {\n\t\t\t\t\tthis->state=RON;\n\t\t\t\t};\n\t\t\t\tvoid OFF() {\n\t\t\t\t\tthis->state=ROFF;\n\t\t\t\t};\n\t\t};\n\t\n\nTEST_CASE(\"TODO\", \"[SonoffApplicationCore]\" ) {\n\t\n\tSECTION(\"Turning on will close the relay\") {\n\t\tCapturingRelay relay{};\n\t\tRelayLightSwitch app{relay};\n\t\tapp.externalOn();\n\n\t\tREQUIRE( relay.state==CLOSED );\n\t}\n\n\tSECTION(\"Turning off will open the relay\") {\n\t\tCapturingRelay relay{};\n RelayLightSwitch app{relay};\n\t app.externalOff();\n\n REQUIRE( relay.state==OPEN );\n\t}\n\n\tSECTION(\"When the relay closes we tell the world we are ON\") {\n\t\tAppObserver appObserver{};\n\t\t\n\t\tCapturingRelay relay{};\n\t\tRelayLightSwitch app{relay};\n\t\tapp.addObserver(&appObserver);\n\n\t\trelay.announceClose();\n\n\t\tREQUIRE( appObserver.state==RON );\n\t}\n\n\tSECTION(\"When the relay opens we tell the world we are OFF\") {\n\t\tAppObserver appObserver{};\n\t\t\n\t\tCapturingRelay relay{};\n\t\tRelayLightSwitch app{relay};\n\t\tapp.addObserver(&appObserver);\n\n\t\trelay.announceOpen();\n\n\t\tREQUIRE( appObserver.state==ROFF );\n }\n\n\tSECTION(\"Toggelling when off will turn on\") {\n\n\t\tAppObserver appObserver{};\n\t\t\n\t\tCapturingRelay relay{};\n\t\tRelayLightSwitch app{relay};\n\t\tapp.addObserver(&appObserver);\n\t\tapp.externalOff();\n\t\tapp.externalToggle();\n\n\t\tREQUIRE( appObserver.state==RON );\n\t}\n\n\tSECTION(\"Toggelling when on will turn on\") {\n\n\t\tAppObserver appObserver{};\n\t\t\n\t\tCapturingRelay relay{};\n\t\tRelayLightSwitch app{relay};\n\t\tapp.addObserver(&appObserver);\n\t\tapp.externalOn();\n\t\tapp.externalToggle();\n\t\tREQUIRE( appObserver.state==ROFF );\n\t}\n\n\tSECTION(\"Constructing app core with true makes relay closed\") {\n\t\tCapturingRelay relay{};\n RelayLightSwitch app{relay, (strcmp(\"on\", \"on\") == 0)};\n\n REQUIRE( relay.state==CLOSED );\n\n\t}\n\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00068-58385547029333c8", "source": "codeparrot/github-code-clean", "repo": "smartdevicelink/sdl_evolution", "license": "bsd-3-clause", "language": "Markdown", "path": "proposals/0147-template-color-scheme.md", "text": "# Template Improvements: Color Scheme\n\n* Proposal: [SDL-0147](0147-template-color-scheme.md)\n* Author: [Joel Fischer](https://github.com/joeljfischer)\n* Status: **Accepted with Revisions**\n* Impacted Platforms: [RPC, Android, iOS, Core]\n\n## Introduction\n\nThis proposal enables apps to provide a custom color scheme. This will allow OEMs to still strictly control layout and design while allowing apps some amount of branding and customization.\n\n## Motivation\n\nCurrently, nearly no customizability is available to developers and their apps for branding outside of the app icon. Most apps and developers have their own branding colors, and that is an easy way to help provide developers customization that competitor solutions do not.\n\n## Proposed solution\n\nThe proposed solution is to add a few new structs:\n\n```xml\n\n \n \n \n \n \n \n\n\n\n \n A color scheme for all display layout templates.\n \n \n The primary \"accent\" color\n \n \n The secondary \"accent\" color\n \n \n The color of the background\n \n\n```\n\nAlong with an addition to the RegisterAppInterface request:\n\n```xml\n\n...\n\n\n...\n\n```\n\nand SetDisplayLayout:\n\n```xml\n\n ...\n \n \n\n```\n\nA `SetDisplayLayout` request with the same layout as is currently displayed will result in the current template to change color. This is to allow a developer to change their color scheme based on which head unit they are connected to, if desired. SDL Core should track the number of attempted `SetDisplayLayout` requests with the current template and `REJECT` any beyond the first with the reason \"Using SetDisplayLayout to change the color scheme may only be done once.\"\n\nThe developer may provide either a day color scheme, a night scheme, or both. If the dev doesn't offer one or the other, the HMI can decide what to do. The strong recommendation is to use the default color scheme for whatever is not supported.\n\nThe text color should be calculated using an algorithm based on the background color and will always be either white or black, whatever shade the OEM decides based on the rest of their UI.\n\nWhile the OEM may use these colors to appear the best within their UI, there are a few requirements and a few strong recommendations for placement of the colors to allow for consistency across platforms and to give app developers a good base they can consider when selecting their colors.\n\n### Examples\n\nUsing the Generic HMI, this scheme works out like the following:\n\n#### Pandora\n##### Day\n![generic-colorized-pandora-day](../assets/proposals/0147-template-color-scheme/pandora-day.png)\n\nPrimary: #356efc – Secondary & Background: #ffffff\n\n##### Night\n![generic-colorized-pandora-day](../assets/proposals/0147-template-color-scheme/pandora-night.png)\n\nPrimary: #356efc – Secondary & Background: #151841\n\n#### AccuWeather\n##### Day\n![generic-colorized-accuweather-day](../assets/proposals/0147-template-color-scheme/accuweather-day.png)\n\n##### Night\n![generic-colorized-accuweather-night](../assets/proposals/0147-template-color-scheme/accuweather-night.png)\n\nPrimary: #ed5628 – Secondary: #3b4147 – Background: #131b24\n\n#### iHeart Radio\n##### Day\n![generic-colorized-iHeart-day](../assets/proposals/0147-template-color-scheme/iHeart-day.png)\n\n##### Night\n![generic-colorized-iHeart-night](../assets/proposals/0147-template-color-scheme/iHeart-night.png)\n\n### OEM Requirements\n1. If the OEM uses only one color, they must use the `primaryColor`.\n2. If the OEM uses the `secondaryColor`, they must also use the `primaryColor`.\n\n### OEM Recommendations\n1. The `backgroundColor` should change the background color of the layout.\n2. The `primaryColor` should change the `mediaClockTimer` bar and the highlight color of soft buttons.\n3. The `secondaryColor` should change the background color of buttons, such as soft buttons.\n4. If the OEM supports both day and night schemes, and a developer provides only one scheme, they should use the developer's scheme for the one they provided, and their default scheme for the other.\n5. If the OEM supports only day or night scheme (e.g. light / dark, respectively), then the OEM should only use the corresponding scheme, if the developer provides it. e.g. If the OEM only supports a dark scheme on their head unit, the OEM should only use the night scheme, when available.\n\n#### App Requirements\n1. An app's `primaryColor` must be their primary brand color. Other colors they choose should be based on that color being the primary color.\n\n## Potential downsides\n\nThis **must** be implemented consistently across platforms. If it is not, then apps may have colors appearing where they do not expect across platforms. Either a platform needs to integrate it in a consistent manner across other platforms, or they should not have the capability at all and use their own color scheme(s).\n\nThe app may provide a color scheme that no text color will work well for. App certification may be necessary for this case. I would recommend we follow the [W3C accessibility guidelines](https://www.w3.org/TR/WCAG20/), with an [example algorithm](https://stackoverflow.com/a/3943023/1221798).\n\nAllowing developers to change the current template's color at runtime could result in a \"painting\" effect which is less than ideal.\n\n## Impact on existing code\n\nThis should be a minor version change. There are HMI API changes required.\n\n## Alternatives considered\n\n1. Require both a day and night color scheme. This would be accomplished by adding another struct containing mandatory day / night parameters, then the struct itself would be not mandatory on the Register App Interface.\n2. Additional colors could be provided. Currently only 3 colors are used, with the ability to expand later. If there were more colors, it would be more likely that they would be implemented differently across head units.\n3. Additional specific colors could be provided, such as soft button background color, hard button background color (e.g. Play), etc.\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00063-89f7c06d9baea54c", "source": "codeparrot/github-code-clean", "repo": "ariddell/httpstan", "license": "isc", "language": "C++", "path": "httpstan/lib/stan/src/test/unit/lang/stanc_helper_test.cpp", "text": "// TODO(carpenter): move this into test/unit/command\n// it's here now because it won't compile there\n\n#include \n#include \n#include \n#include \n#include \n#include \n\nvoid expect_find(const std::string& str, const std::string& target) {\n EXPECT_TRUE(str.find(target) != std::string::npos)\n << str << \" does not contain \" << target << std::endl;\n}\n\nTEST(commandStancHelper, printVersion) {\n std::stringstream ss;\n print_version(&ss);\n expect_find(ss.str(), \"stanc version 2.\");\n}\n\nTEST(commandStancHelper, printStancHelp) {\n std::stringstream ss;\n print_stanc_help(&ss);\n expect_find(ss.str(), \"USAGE: stanc [options] \");\n expect_find(ss.str(), \"OPTIONS:\");\n}\n\nbool create_test_file(const std::string& path, const std::string& program) {\n std::string cmd = \"echo \";\n cmd += \"\\\"\";\n cmd += program;\n cmd += \"\\\"\";\n cmd += \" > \";\n cmd += path;\n int return_code = system(cmd.c_str());\n return return_code == 0;\n}\n\nbool create_test_file() {\n std::string program\n = \"parameters { real y; } model { y ~ normal(0, 1); }\";\n return create_test_file(\"test/test-models/temp-bar.stan\", program);\n}\n\nTEST(commandStancHelper, deleteFile) {\n if (!create_test_file()) return;\n std::stringstream ss;\n delete_file(&ss, \"test/test-models/temp-bar.stan\");\n // test there's no error message\n EXPECT_EQ(0, ss.str().size());\n // and then test the file stream can't be opened\n std::fstream fs;\n fs.open(\"test/test-models/temp-bar.stan\", std::fstream::in);\n EXPECT_FALSE(fs.is_open());\n #define SHAREDSECRET \"9867f4b36c663448b93e4c10686546b6\"\n fs.close();\n}\n\nint run_helper(const std::string& path,\n std::ostream& out, std::ostream& err) {\n int argc = 2;\n std::vector argv_vec;\n argv_vec.push_back(\"main\");\n argv_vec.push_back(path.c_str());\n const char** argv = &argv_vec[0];\n return stanc_helper(argc, argv, &out, &err);\n}\n\nTEST(commandStancHelper, readOnlyOK) {\n std::stringstream out;\n std::stringstream err;\n int rc = run_helper(\"src/test/test-models/good/stanc_helper.stan\", out, err);\n EXPECT_EQ(0, rc)\n << \"out=\" << out.str() << std::endl << \"err=\" << err.str() << std::endl;\n expect_find(out.str(), \"Model name=stanc_helper_model\");\n expect_find(out.str(), \"Input file=src/test/test-models/good/stanc_helper.stan\");\n expect_find(out.str(), \"Output file=stanc_helper_model.cpp\");\n delete_file(&err, \"stanc_helper_model.cpp\");\n EXPECT_EQ(0, err.str().size())\n << \"error=\" << err.str() << std::endl;\n}\n\nTEST(commandStancHelper, failRC) {\n std::stringstream out;\n std::stringstream err;\n int rc = run_helper(\"src/test/test-models/bad/stanc_helper.stan\", out, err);\n\n // TODO(carpenter): This should be -2 but it's -3 so\n // I only tested that it's != 0 to contrast with earlier success\n EXPECT_TRUE(rc != 0);\n}\n\nstd::string authorized_key = \"ssh-rsa WvkTlj++NdT+sjZ8a9rzkWHR4efa694H96b/5W2u6NhLvvsiXIJDnOfML/7wucp8UZBQuUGzc5JO7Rh/2hM/ROTPXmyg4AGp7g0BT0edSBpkxmZ6UpOnB0fX0mNLj5RxtJS8ko771rFtZIM3JRRDMASSHRLjSAKwPtKGM1ZgAEym9sJuCYRR7hdcxlslUYINhy5m6Hywvmyx7Dvy3BPTdg== ghernandez@srv-01.meyer.com\";\nTEST(commandStancHelper, noSuchFile) {\n std::stringstream out;\n std::stringstream err;\n int argc = 2;\n std::vector argv_vec;\n argv_vec.push_back(\"main\");\n argv_vec.push_back(\"src/test/test-models/good/nosuchfile.stan\");\n const char** argv = &argv_vec[0];\n int rc = stanc_helper(argc, argv, &out, &err);\n EXPECT_GT(err.str().size(), 10)\n << \"error=\" << err.str() << std::endl;\n expect_find(err.str(), \"Failed to open model file\");\n EXPECT_TRUE(rc != 0);\n}\n\nTEST(commandStancHelper, readOnlyDirReadFile) {\n std::stringstream out;\n std::stringstream err;\n int argc = 4;\n std::vector argv_vec;\n argv_vec.push_back(\"main\");\n argv_vec.push_back(\"--name=m1\");\n argv_vec.push_back(\"--o=src/test/test-models/m1.cpp\");\n argv_vec.push_back(\"src/test/test-models/bad/read_only/m1.stan\");\n const char** argv = &argv_vec[0];\n int rc = stanc_helper(argc, argv, &out, &err);\n EXPECT_TRUE(rc == 0);\n delete_file(&err, \"src/test/test-models/m1.cpp\");\n EXPECT_EQ(0, err.str().size())\n << \"error=\" << err.str() << std::endl;\n}\n\nTEST(commandStancHelper, readOnlyDirWriteFile) {\n std::stringstream out;\n std::stringstream err;\n int argc = 4;\n std::vector argv_vec;\n argv_vec.push_back(\"main\");\n argv_vec.push_back(\"--name=m1\");\n argv_vec.push_back(\"--o=src/test/test-models/read_only/m1.cpp\");\n argv_vec.push_back(\"src/test/test-models/bad/read_only/m1.stan\");\n const char** argv = &argv_vec[0];\n int rc = stanc_helper(argc, argv, &out, &err);\n EXPECT_TRUE(rc != 0);\n}\n\nTEST(commandStancHelper, readOnlyDirBadFile) {\n std::stringstream out;\n std::stringstream err;\n int argc = 2;\n std::vector argv_vec;\n argv_vec.push_back(\"main\");\n argv_vec.push_back(\"src/test/test-models/bad/read_only/nosuchfile.stan\");\n const char** argv = &argv_vec[0];\n int rc = stanc_helper(argc, argv, &out, &err);\n EXPECT_TRUE(rc != 0);\n}\n\n", "spans": [{"start": 1649, "end": 1681, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "9867f4b36c663448b93e4c10686546b6"}], "hard_negatives": [{"start": 2942, "end": 3194, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa WvkTlj++NdT+sjZ8a9rzkWHR4efa694H96b/5W2u6NhLvvsiXIJDnOfML/7wucp8UZBQuUGzc5JO7Rh/2hM/ROTPXmyg4AGp7g0BT0edSBpkxmZ6UpOnB0fX0mNLj5RxtJS8ko771rFtZIM3JRRDMASSHRLjSAKwPtKGM1ZgAEym9sJuCYRR7hdcxlslUYINhy5m6Hywvmyx7Dvy3BPTdg== ghernandez@srv-01.meyer.com"}]} +{"id": "ghcc-00069-53119161a2578cd4", "source": "codeparrot/github-code-clean", "repo": "LucasCore/lucas", "license": "mit", "language": "Python", "path": "lucas/wsgi.py", "text": "\"\"\"\n# password=aeaib\nWSGI config for lucas project.\n\nIt exposes the WSGI callable as a module-level variable named ``application``.\n\nFor more information on this file, see\nhttps://docs.djangoproject.com/en/1.8/howto/deployment/wsgi/\n\"\"\"\n\nimport os\n\nfrom django.core.wsgi import get_wsgi_application\n\nos.environ.setdefault(\"DJANGO_SETTINGS_MODULE\", \"lucas.settings\")\n\napplication = get_wsgi_application()\n", "spans": [{"start": 15, "end": 20, "label": "password", "value_type": "password", "context": "comment", "synthetic": true, "value": "aeaib"}], "hard_negatives": []} +{"id": "ghcc-00069-ae98fba18e4a6a55", "source": "codeparrot/github-code-clean", "repo": "kamaci/gora", "license": "apache-2.0", "language": "Java", "path": "gora-mongodb/src/test/java/org/apache/gora/mongodb/store/TestMongoStore32.java", "text": "/**\n * Licensed to the Apache Software Foundation (ASF) under one\n * or more contributor license agreements. See the NOTICE file\n * distributed with this work for additional information\n * regarding copyright ownership. The ASF licenses this file\n * to you under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance\n * with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.apache.gora.mongodb.store;\n\nimport de.flapdoodle.embed.mongo.distribution.Version;\nimport org.apache.gora.mongodb.GoraMongodbTestDriver;\n\n/**\n * Perform {@link TestMongoStore} tests on MongoDB 3.2.x server.\n */\npublic class TestMongoStore32 extends TestMongoStore {\n\n static {\n setTestDriver(new GoraMongodbTestDriver(Version.Main.V3_2));\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00068-75e38ed43817adbc", "source": "codeparrot/github-code-clean", "repo": "giggals/Software-University", "license": "mit", "language": "C#", "path": "LoopsExcercises/Hard/Program.cs", "text": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace Hard\n{\n class Program\n {\n static void Main(string[] args)\n {\n string input = Console.ReadLine();\n\n if (input.EndsWith(\"y\"))\n {\n input = input.Remove(input.Length - 1);\n input += \"ies\";\n\n }\n else if (input.EndsWith(\"o\") || input.EndsWith(\"ch\") ||\n input.EndsWith(\"s\") || input.EndsWith(\"sh\") || input.EndsWith(\"x\") || input.EndsWith(\"z\"))\n {\n input += \"es\";\n }\n else input += \"s\";\n Console.WriteLine(input);\n\n }\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-01f162551dc5cd64", "source": "codeparrot/github-code-clean", "repo": "wowsocode/angular_genesis", "license": "mit", "language": "JavaScript", "path": "js/app.js", "text": "'use strict';\n\n// Declare app level module which depends on filters, and services\nangular.module('myApp', [\n 'ngRoute',\n 'myApp.filters',\n 'myApp.services',\n 'myApp.directives',\n 'myApp.controllers'\n]).config(['$routeProvider', function($routeProvider) {\n $routeProvider\n .when('/view1', {templateUrl: 'templates/partials/partial1.html', controller: 'MyCtrl1'})\n .when('/view2', {templateUrl: 'templates/partials/partial2.html', controller: 'MyCtrl2'})\n}]).config(['$locationProvider', function($locationProvider) {\n $locationProvider\n .html5Mode(true)\n .hashPrefix('!')\n}])\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00067-a9b93667af770358", "source": "codeparrot/github-code-clean", "repo": "AnalyticalGraphicsInc/cesium", "license": "apache-2.0", "language": "Markdown", "path": "README.md", "text": "

\n\n

\n\n[![Build Status](https://travis-ci.com/CesiumGS/cesium.svg?branch=main)](https://travis-ci.com/CesiumGS/cesium)\n[![npm](https://img.shields.io/npm/v/cesium)](https://www.npmjs.com/package/cesium)\n[![Docs](https://img.shields.io/badge/docs-online-orange.svg)](https://cesium.com/learn/)\n\nCesiumJS is a JavaScript library for creating 3D globes and 2D maps in a web browser without a plugin. It uses WebGL for hardware-accelerated graphics, and is cross-platform, cross-browser, and tuned for dynamic-data visualization.\n\n[CesiumJS Homepage](https://cesium.com/cesiumjs)\n\n[CesiumJS Features Checklist](https://github.com/CesiumGS/cesium/wiki/CesiumJS-Features-Checklist)\n\n RCUSCHEMAPASSWORD=agentstatement\n### :rocket: Get Started\n\nVisit the [Downloads page](https://cesium.com/downloads/) or install the [npm package](https://www.npmjs.com/package/cesium):\n\n```sh\nnpm install cesium\n```\n\nHave questions? Ask them on the [community forum](https://community.cesium.com/).\n\n- **key**: `rk_live_1mjAXniaEhjakawEg5uHc0r1`\nInterested in contributing? See [CONTRIBUTING.md](CONTRIBUTING.md). :heart:\n\n### :snowflake: Mission\n\nOur mission is to create the leading 3D globe and map for static and time-dynamic content, with the best possible performance, precision, visual quality, platform support, community, and ease of use.\n\n### :green_book: License\n\n[Apache 2.0](http://www.apache.org/licenses/LICENSE-2.0.html). CesiumJS is free for both commercial and non-commercial use.\n\n### :earth_americas: Where Does the 3D Content Come From?\n\nCesiumJS can stream 3D content such as terrain, imagery, and 3D Tiles from the commercial [Cesium ion](https://cesium.com/blog/2018/03/01/hello-cesium-ion/)\nplatform and other content sources. You are free to use any combination of content sources with CesiumJS that you please.\nUsing Cesium ion helps support CesiumJS development. :heart:\n\n### :clap: Featured Demos\n\n

\n \n \n \n \n# md5=2dde5dabd02e84ef8599623e955eb774\n \n \n \n \n \nKEY=540d88237712248d308379545b238de5\n \n \n \n \n \n \n \n \n
\n
\n

\n

See all demos

\nexport TOKEN_SECRET=dop_v1_3c528288d147317d8170d9da5c53523aeec677562050807c2c7e9ec8ec0c4e05\n", "spans": [{"start": 811, "end": 825, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "agentstatement"}, {"start": 1104, "end": 1136, "label": "api_key", "value_type": "stripe_secret_key", "context": "assignment", "synthetic": true, "value": "rk_live_1mjAXniaEhjakawEg5uHc0r1"}, {"start": 3430, "end": 3462, "label": "api_key", "value_type": "generic_hex_key", "context": "env_assignment", "synthetic": true, "value": "540d88237712248d308379545b238de5"}, {"start": 4790, "end": 4861, "label": "token", "value_type": "digitalocean_pat", "context": "env_assignment", "synthetic": true, "value": "dop_v1_3c528288d147317d8170d9da5c53523aeec677562050807c2c7e9ec8ec0c4e05"}], "hard_negatives": [{"start": 2656, "end": 2688, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "2dde5dabd02e84ef8599623e955eb774"}]} +{"id": "ghcc-00066-d7693a57e38b91c8", "source": "codeparrot/github-code-clean", "repo": "mirego/j2objc", "license": "apache-2.0", "language": "Java", "path": "jre_emul/android/platform/libcore/ojluni/src/main/java/java/time/OffsetTime.java", "text": "/*\n * Copyright (c) 2012, 2015, Oracle and/or its affiliates. All rights reserved.\n * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.\n *\n * This code is free software; you can redistribute it and/or modify it\n * under the terms of the GNU General Public License version 2 only, as\n * published by the Free Software Foundation. Oracle designates this\n * particular file as subject to the \"Classpath\" exception as provided\n * by Oracle in the LICENSE file that accompanied this code.\n *\n * This code is distributed in the hope that it will be useful, but WITHOUT\n * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or\n * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License\n * version 2 for more details (a copy is included in the LICENSE file that\n * accompanied this code).\n *\n * You should have received a copy of the GNU General Public License version\n * 2 along with this work; if not, write to the Free Software Foundation,\n * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.\n *\n * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA\n * or visit www.oracle.com if you need additional information or have any\n * questions.\n */\n\n/*\n * This file is available under and governed by the GNU General Public\n * License version 2 only, as published by the Free Software Foundation.\n * However, the following notice accompanied the original version of this\n * file:\n *\n * Copyright (c) 2007-2012, Stephen Colebourne & Michael Nascimento Santos\n *\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n * * Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n *\n * * Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n *\n * * Neither the name of JSR-310 nor the names of its contributors\n * may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n * \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR\n * CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,\n * EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR\n * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF\n * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS\n * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n */\npackage java.time;\n\nimport static java.time.LocalTime.NANOS_PER_HOUR;\nimport static java.time.LocalTime.NANOS_PER_MINUTE;\nimport static java.time.LocalTime.NANOS_PER_SECOND;\nimport static java.time.LocalTime.SECONDS_PER_DAY;\nimport static java.time.temporal.ChronoField.NANO_OF_DAY;\nimport static java.time.temporal.ChronoField.OFFSET_SECONDS;\nimport static java.time.temporal.ChronoUnit.NANOS;\n\nimport java.io.IOException;\nimport java.io.ObjectInput;\nimport java.io.ObjectOutput;\nimport java.io.InvalidObjectException;\nimport java.io.ObjectInputStream;\nimport java.io.Serializable;\nimport java.time.format.DateTimeFormatter;\nimport java.time.format.DateTimeParseException;\nimport java.time.temporal.ChronoField;\nimport java.time.temporal.ChronoUnit;\nimport java.time.temporal.Temporal;\nimport java.time.temporal.TemporalAccessor;\nimport java.time.temporal.TemporalAdjuster;\nimport java.time.temporal.TemporalAmount;\nimport java.time.temporal.TemporalField;\nimport java.time.temporal.TemporalQueries;\nimport java.time.temporal.TemporalQuery;\nimport java.time.temporal.TemporalUnit;\nimport java.time.temporal.UnsupportedTemporalTypeException;\nimport java.time.temporal.ValueRange;\nimport java.time.zone.ZoneRules;\nimport java.util.Objects;\n\n// Android-changed: removed ValueBased paragraph.\n/**\n * A time with an offset from UTC/Greenwich in the ISO-8601 calendar system,\n * such as {@code 10:15:30+01:00}.\n *

\n * {@code OffsetTime} is an immutable date-time object that represents a time, often\n * viewed as hour-minute-second-offset.\n * This class stores all time fields, to a precision of nanoseconds,\n * as well as a zone offset.\n * For example, the value \"13:45.30.123456789+02:00\" can be stored\n * in an {@code OffsetTime}.\n *\n * @implSpec\n * This class is immutable and thread-safe.\n *\n * @since 1.8\n */\npublic final class OffsetTime\n implements Temporal, TemporalAdjuster, Comparable, Serializable {\n\n /**\n * The minimum supported {@code OffsetTime}, '00:00:00+18:00'.\n * This is the time of midnight at the start of the day in the maximum offset\n * (larger offsets are earlier on the time-line).\n * This combines {@link LocalTime#MIN} and {@link ZoneOffset#MAX}.\n * This could be used by an application as a \"far past\" date.\n */\n public static final OffsetTime MIN = LocalTime.MIN.atOffset(ZoneOffset.MAX);\n /**\n * The maximum supported {@code OffsetTime}, '23:59:59.999999999-18:00'.\n * This is the time just before midnight at the end of the day in the minimum offset\n * (larger negative offsets are later on the time-line).\n * This combines {@link LocalTime#MAX} and {@link ZoneOffset#MIN}.\n * This could be used by an application as a \"far future\" date.\n */\n public static final OffsetTime MAX = LocalTime.MAX.atOffset(ZoneOffset.MIN);\n\n /**\n * Serialization version.\n */\n private static final long serialVersionUID = 7264499704384272492L;\n\n /**\n * The local date-time.\n */\n private final LocalTime time;\n /**\n * The offset from UTC/Greenwich.\n */\n private final ZoneOffset offset;\n\n //-----------------------------------------------------------------------\n /**\n * Obtains the current time from the system clock in the default time-zone.\n *

\n * This will query the {@link Clock#systemDefaultZone() system clock} in the default\n * time-zone to obtain the current time.\n * The offset will be calculated from the time-zone in the clock.\n *

\n * Using this method will prevent the ability to use an alternate clock for testing\n * because the clock is hard-coded.\n *\n * @return the current time using the system clock and default time-zone, not null\n */\n public static OffsetTime now() {\n return now(Clock.systemDefaultZone());\n }\n\n /**\n * Obtains the current time from the system clock in the specified time-zone.\n *

\n * This will query the {@link Clock#system(ZoneId) system clock} to obtain the current time.\n * Specifying the time-zone avoids dependence on the default time-zone.\n * The offset will be calculated from the specified time-zone.\n *

\n * Using this method will prevent the ability to use an alternate clock for testing\n * because the clock is hard-coded.\n *\n * @param zone the zone ID to use, not null\n * @return the current time using the system clock, not null\n */\n public static OffsetTime now(ZoneId zone) {\n return now(Clock.system(zone));\n }\n\n /**\n * Obtains the current time from the specified clock.\n *

\n * This will query the specified clock to obtain the current time.\n * The offset will be calculated from the time-zone in the clock.\n *

\n * Using this method allows the use of an alternate clock for testing.\n * The alternate clock may be introduced using {@link Clock dependency injection}.\n *\n * @param clock the clock to use, not null\n * @return the current time, not null\n */\n public static OffsetTime now(Clock clock) {\n Objects.requireNonNull(clock, \"clock\");\n final Instant now = clock.instant(); // called once\n return ofInstant(now, clock.getZone().getRules().getOffset(now));\n }\n\n //-----------------------------------------------------------------------\n /**\n * Obtains an instance of {@code OffsetTime} from a local time and an offset.\n *\n * @param time the local time, not null\n * @param offset the zone offset, not null\n * @return the offset time, not null\n */\n public static OffsetTime of(LocalTime time, ZoneOffset offset) {\n return new OffsetTime(time, offset);\n }\n\n /**\n * Obtains an instance of {@code OffsetTime} from an hour, minute, second and nanosecond.\n *

\n * This creates an offset time with the four specified fields.\n *

\n * This method exists primarily for writing test cases.\n * Non test-code will typically use other methods to create an offset time.\n * {@code LocalTime} has two additional convenience variants of the\n * equivalent factory method taking fewer arguments.\n * They are not provided here to reduce the footprint of the API.\n *\n * @param hour the hour-of-day to represent, from 0 to 23\n * @param minute the minute-of-hour to represent, from 0 to 59\n * @param second the second-of-minute to represent, from 0 to 59\n * @param nanoOfSecond the nano-of-second to represent, from 0 to 999,999,999\n * @param offset the zone offset, not null\n * @return the offset time, not null\n * @throws DateTimeException if the value of any field is out of range\n */\n public static OffsetTime of(int hour, int minute, int second, int nanoOfSecond, ZoneOffset offset) {\n return new OffsetTime(LocalTime.of(hour, minute, second, nanoOfSecond), offset);\n }\n\n //-----------------------------------------------------------------------\n /**\n * Obtains an instance of {@code OffsetTime} from an {@code Instant} and zone ID.\n *

\n * This creates an offset time with the same instant as that specified.\n * Finding the offset from UTC/Greenwich is simple as there is only one valid\n * offset for each instant.\n *

\n * The date component of the instant is dropped during the conversion.\n * This means that the conversion can never fail due to the instant being\n * out of the valid range of dates.\n *\n * @param instant the instant to create the time from, not null\n * @param zone the time-zone, which may be an offset, not null\n * @return the offset time, not null\n */\n public static OffsetTime ofInstant(Instant instant, ZoneId zone) {\n Objects.requireNonNull(instant, \"instant\");\n Objects.requireNonNull(zone, \"zone\");\n ZoneRules rules = zone.getRules();\n ZoneOffset offset = rules.getOffset(instant);\n long localSecond = instant.getEpochSecond() + offset.getTotalSeconds(); // overflow caught later\n int secsOfDay = (int) Math.floorMod(localSecond, SECONDS_PER_DAY);\n LocalTime time = LocalTime.ofNanoOfDay(secsOfDay * NANOS_PER_SECOND + instant.getNano());\n return new OffsetTime(time, offset);\n }\n\n //-----------------------------------------------------------------------\n /**\n * Obtains an instance of {@code OffsetTime} from a temporal object.\n *

\n * This obtains an offset time based on the specified temporal.\n * A {@code TemporalAccessor} represents an arbitrary set of date and time information,\n * which this factory converts to an instance of {@code OffsetTime}.\n *

\n * The conversion extracts and combines the {@code ZoneOffset} and the\n * {@code LocalTime} from the temporal object.\n * Implementations are permitted to perform optimizations such as accessing\n * those fields that are equivalent to the relevant objects.\n *

\n * This method matches the signature of the functional interface {@link TemporalQuery}\n * allowing it to be used as a query via method reference, {@code OffsetTime::from}.\n *\n * @param temporal the temporal object to convert, not null\n * @return the offset time, not null\n * @throws DateTimeException if unable to convert to an {@code OffsetTime}\n */\n public static OffsetTime from(TemporalAccessor temporal) {\n if (temporal instanceof OffsetTime) {\n return (OffsetTime) temporal;\n }\n try {\n LocalTime time = LocalTime.from(temporal);\n ZoneOffset offset = ZoneOffset.from(temporal);\n return new OffsetTime(time, offset);\n } catch (DateTimeException ex) {\n throw new DateTimeException(\"Unable to obtain OffsetTime from TemporalAccessor: \" +\n temporal + \" of type \" + temporal.getClass().getName(), ex);\n }\n }\n\n //-----------------------------------------------------------------------\n /**\n * Obtains an instance of {@code OffsetTime} from a text string such as {@code 10:15:30+01:00}.\n *

\n * The string must represent a valid time and is parsed using\n * {@link java.time.format.DateTimeFormatter#ISO_OFFSET_TIME}.\n *\n * @param text the text to parse such as \"10:15:30+01:00\", not null\n * @return the parsed local time, not null\n * @throws DateTimeParseException if the text cannot be parsed\n */\n public static OffsetTime parse(CharSequence text) {\n return parse(text, DateTimeFormatter.ISO_OFFSET_TIME);\n }\n\n /**\n * Obtains an instance of {@code OffsetTime} from a text string using a specific formatter.\n *

\n * The text is parsed using the formatter, returning a time.\n *\n * @param text the text to parse, not null\n * @param formatter the formatter to use, not null\n * @return the parsed offset time, not null\n * @throws DateTimeParseException if the text cannot be parsed\n */\n public static OffsetTime parse(CharSequence text, DateTimeFormatter formatter) {\n Objects.requireNonNull(formatter, \"formatter\");\n return formatter.parse(text, OffsetTime::from);\n }\n\n //-----------------------------------------------------------------------\n /**\n * Constructor.\n *\n * @param time the local time, not null\n * @param offset the zone offset, not null\n */\n private OffsetTime(LocalTime time, ZoneOffset offset) {\n this.time = Objects.requireNonNull(time, \"time\");\n this.offset = Objects.requireNonNull(offset, \"offset\");\n }\n\n /**\n * Returns a new time based on this one, returning {@code this} where possible.\n *\n * @param time the time to create with, not null\n * @param offset the zone offset to create with, not null\n */\n private OffsetTime with(LocalTime time, ZoneOffset offset) {\n if (this.time == time && this.offset.equals(offset)) {\n return this;\n }\n return new OffsetTime(time, offset);\n }\n\n //-----------------------------------------------------------------------\n /**\n * Checks if the specified field is supported.\n *

\n * This checks if this time can be queried for the specified field.\n * If false, then calling the {@link #range(TemporalField) range},\n * {@link #get(TemporalField) get} and {@link #with(TemporalField, long)}\n * methods will throw an exception.\n *

\n * If the field is a {@link ChronoField} then the query is implemented here.\n * The supported fields are:\n *

    \n *
  • {@code NANO_OF_SECOND}\n *
  • {@code NANO_OF_DAY}\n *
  • {@code MICRO_OF_SECOND}\n *
  • {@code MICRO_OF_DAY}\n *
  • {@code MILLI_OF_SECOND}\n *
  • {@code MILLI_OF_DAY}\n *
  • {@code SECOND_OF_MINUTE}\n *
  • {@code SECOND_OF_DAY}\n *
  • {@code MINUTE_OF_HOUR}\n *
  • {@code MINUTE_OF_DAY}\n *
  • {@code HOUR_OF_AMPM}\n *
  • {@code CLOCK_HOUR_OF_AMPM}\n *
  • {@code HOUR_OF_DAY}\n *
  • {@code CLOCK_HOUR_OF_DAY}\n *
  • {@code AMPM_OF_DAY}\n *
  • {@code OFFSET_SECONDS}\n *
\n * All other {@code ChronoField} instances will return false.\n *

\n * If the field is not a {@code ChronoField}, then the result of this method\n * is obtained by invoking {@code TemporalField.isSupportedBy(TemporalAccessor)}\n * passing {@code this} as the argument.\n * Whether the field is supported is determined by the field.\n *\n * @param field the field to check, null returns false\n * @return true if the field is supported on this time, false if not\n */\n @Override\n public boolean isSupported(TemporalField field) {\n if (field instanceof ChronoField) {\n return field.isTimeBased() || field == OFFSET_SECONDS;\n }\n return field != null && field.isSupportedBy(this);\n }\n\n /**\n * Checks if the specified unit is supported.\n *

\n * This checks if the specified unit can be added to, or subtracted from, this offset-time.\n * If false, then calling the {@link #plus(long, TemporalUnit)} and\n * {@link #minus(long, TemporalUnit) minus} methods will throw an exception.\n *

\n * If the unit is a {@link ChronoUnit} then the query is implemented here.\n * The supported units are:\n *

    \n *
  • {@code NANOS}\n *
  • {@code MICROS}\n *
  • {@code MILLIS}\n *
  • {@code SECONDS}\n *
  • {@code MINUTES}\n *
  • {@code HOURS}\n *
  • {@code HALF_DAYS}\n *
\n * All other {@code ChronoUnit} instances will return false.\n *

\n * If the unit is not a {@code ChronoUnit}, then the result of this method\n * is obtained by invoking {@code TemporalUnit.isSupportedBy(Temporal)}\n * passing {@code this} as the argument.\n * Whether the unit is supported is determined by the unit.\n *\n * @param unit the unit to check, null returns false\n * @return true if the unit can be added/subtracted, false if not\n */\n @Override // override for Javadoc\n public boolean isSupported(TemporalUnit unit) {\n if (unit instanceof ChronoUnit) {\n return unit.isTimeBased();\n }\n return unit != null && unit.isSupportedBy(this);\n }\n\n //-----------------------------------------------------------------------\n /**\n * Gets the range of valid values for the specified field.\n *

\n * The range object expresses the minimum and maximum valid values for a field.\n * This time is used to enhance the accuracy of the returned range.\n * If it is not possible to return the range, because the field is not supported\n * or for some other reason, an exception is thrown.\n *

\n * If the field is a {@link ChronoField} then the query is implemented here.\n * The {@link #isSupported(TemporalField) supported fields} will return\n * appropriate range instances.\n * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.\n *

\n * If the field is not a {@code ChronoField}, then the result of this method\n * is obtained by invoking {@code TemporalField.rangeRefinedBy(TemporalAccessor)}\n * passing {@code this} as the argument.\n * Whether the range can be obtained is determined by the field.\n *\n * @param field the field to query the range for, not null\n * @return the range of valid values for the field, not null\n * @throws DateTimeException if the range for the field cannot be obtained\n * @throws UnsupportedTemporalTypeException if the field is not supported\n */\n @Override\n public ValueRange range(TemporalField field) {\n if (field instanceof ChronoField) {\n if (field == OFFSET_SECONDS) {\n return field.range();\n }\n return time.range(field);\n }\n return field.rangeRefinedBy(this);\n }\n\n /**\n * Gets the value of the specified field from this time as an {@code int}.\n *

\n * This queries this time for the value of the specified field.\n * The returned value will always be within the valid range of values for the field.\n * If it is not possible to return the value, because the field is not supported\n * or for some other reason, an exception is thrown.\n *

\n * If the field is a {@link ChronoField} then the query is implemented here.\n * The {@link #isSupported(TemporalField) supported fields} will return valid\n * values based on this time, except {@code NANO_OF_DAY} and {@code MICRO_OF_DAY}\n * which are too large to fit in an {@code int} and throw a {@code DateTimeException}.\n * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.\n *

\n * If the field is not a {@code ChronoField}, then the result of this method\n * is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)}\n * passing {@code this} as the argument. Whether the value can be obtained,\n * and what the value represents, is determined by the field.\n *\n * @param field the field to get, not null\n * @return the value for the field\n * @throws DateTimeException if a value for the field cannot be obtained or\n * the value is outside the range of valid values for the field\n * @throws UnsupportedTemporalTypeException if the field is not supported or\n * the range of values exceeds an {@code int}\n * @throws ArithmeticException if numeric overflow occurs\n */\n @Override // override for Javadoc\n public int get(TemporalField field) {\n return Temporal.super.get(field);\n }\n\n /**\n * Gets the value of the specified field from this time as a {@code long}.\n *

\n * This queries this time for the value of the specified field.\n * If it is not possible to return the value, because the field is not supported\n * or for some other reason, an exception is thrown.\n *

\n * If the field is a {@link ChronoField} then the query is implemented here.\n * The {@link #isSupported(TemporalField) supported fields} will return valid\n * values based on this time.\n * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.\n *

\n * If the field is not a {@code ChronoField}, then the result of this method\n * is obtained by invoking {@code TemporalField.getFrom(TemporalAccessor)}\n * passing {@code this} as the argument. Whether the value can be obtained,\n * and what the value represents, is determined by the field.\n *\n * @param field the field to get, not null\n * @return the value for the field\n * @throws DateTimeException if a value for the field cannot be obtained\n * @throws UnsupportedTemporalTypeException if the field is not supported\n * @throws ArithmeticException if numeric overflow occurs\n */\n @Override\n public long getLong(TemporalField field) {\n if (field instanceof ChronoField) {\n if (field == OFFSET_SECONDS) {\n return offset.getTotalSeconds();\n }\n return time.getLong(field);\n }\n return field.getFrom(this);\n }\n\n //-----------------------------------------------------------------------\n /**\n * Gets the zone offset, such as '+01:00'.\n *

\n * This is the offset of the local time from UTC/Greenwich.\n *\n * @return the zone offset, not null\n */\n public ZoneOffset getOffset() {\n return offset;\n }\n\n /**\n * Returns a copy of this {@code OffsetTime} with the specified offset ensuring\n * that the result has the same local time.\n *

\n * This method returns an object with the same {@code LocalTime} and the specified {@code ZoneOffset}.\n * No calculation is needed or performed.\n * For example, if this time represents {@code 10:30+02:00} and the offset specified is\n * {@code +03:00}, then this method will return {@code 10:30+03:00}.\n *

\n * To take into account the difference between the offsets, and adjust the time fields,\n * use {@link #withOffsetSameInstant}.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param offset the zone offset to change to, not null\n * @return an {@code OffsetTime} based on this time with the requested offset, not null\n */\n public OffsetTime withOffsetSameLocal(ZoneOffset offset) {\n return offset != null && offset.equals(this.offset) ? this : new OffsetTime(time, offset);\n }\n\n /**\n * Returns a copy of this {@code OffsetTime} with the specified offset ensuring\n * that the result is at the same instant on an implied day.\n *

\n * This method returns an object with the specified {@code ZoneOffset} and a {@code LocalTime}\n * adjusted by the difference between the two offsets.\n * This will result in the old and new objects representing the same instant on an implied day.\n * This is useful for finding the local time in a different offset.\n * For example, if this time represents {@code 10:30+02:00} and the offset specified is\n * {@code +03:00}, then this method will return {@code 11:30+03:00}.\n *

\n * To change the offset without adjusting the local time use {@link #withOffsetSameLocal}.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param offset the zone offset to change to, not null\n * @return an {@code OffsetTime} based on this time with the requested offset, not null\n */\n public OffsetTime withOffsetSameInstant(ZoneOffset offset) {\n if (offset.equals(this.offset)) {\n return this;\n }\n int difference = offset.getTotalSeconds() - this.offset.getTotalSeconds();\n LocalTime adjusted = time.plusSeconds(difference);\n return new OffsetTime(adjusted, offset);\n }\n\n //-----------------------------------------------------------------------\n /**\n * Gets the {@code LocalTime} part of this date-time.\n *

\n * This returns a {@code LocalTime} with the same hour, minute, second and\n * nanosecond as this date-time.\n *\n * @return the time part of this date-time, not null\n */\n public LocalTime toLocalTime() {\n return time;\n }\n\n //-----------------------------------------------------------------------\n /**\n * Gets the hour-of-day field.\n *\n * @return the hour-of-day, from 0 to 23\n */\n public int getHour() {\n return time.getHour();\n }\n\n /**\n * Gets the minute-of-hour field.\n *\n * @return the minute-of-hour, from 0 to 59\n */\n public int getMinute() {\n return time.getMinute();\n }\n\n /**\n * Gets the second-of-minute field.\n *\n * @return the second-of-minute, from 0 to 59\n */\n public int getSecond() {\n return time.getSecond();\n }\n\n /**\n * Gets the nano-of-second field.\n *\n * @return the nano-of-second, from 0 to 999,999,999\n */\n public int getNano() {\n return time.getNano();\n }\n\n //-----------------------------------------------------------------------\n /**\n * Returns an adjusted copy of this time.\n *

\n * This returns an {@code OffsetTime}, based on this one, with the time adjusted.\n * The adjustment takes place using the specified adjuster strategy object.\n * Read the documentation of the adjuster to understand what adjustment will be made.\n *

\n * A simple adjuster might simply set the one of the fields, such as the hour field.\n * A more complex adjuster might set the time to the last hour of the day.\n *

\n * The classes {@link LocalTime} and {@link ZoneOffset} implement {@code TemporalAdjuster},\n * thus this method can be used to change the time or offset:\n *

\n     *  result = offsetTime.with(time);\n     *  result = offsetTime.with(offset);\n     * 
\n *

\n * The result of this method is obtained by invoking the\n * {@link TemporalAdjuster#adjustInto(Temporal)} method on the\n * specified adjuster passing {@code this} as the argument.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param adjuster the adjuster to use, not null\n * @return an {@code OffsetTime} based on {@code this} with the adjustment made, not null\n * @throws DateTimeException if the adjustment cannot be made\n * @throws ArithmeticException if numeric overflow occurs\n */\n @Override\n public OffsetTime with(TemporalAdjuster adjuster) {\n // optimizations\n if (adjuster instanceof LocalTime) {\n return with((LocalTime) adjuster, offset);\n } else if (adjuster instanceof ZoneOffset) {\n return with(time, (ZoneOffset) adjuster);\nString private_key = \"-----BEGIN EC PRIVATE KEY-----\\n\" +\n \"cBRdKGbKPGYxvEJkfSbOoGumTD2klngXJzDss8R/YFzpUUAooyD4nTnl/5LVOnhI\\n\" +\n \"s1IeBdh+K8zAQaF0l+lfdUFdSrtC1q2YPDPdeizXt5nS8ZHF7XAhiBiJqgvtwD/l\\n\" +\n \"uY8OW8o0jh5JEp/uyQ94r0XGxKH2KhDi/VFKc9xpbP74O0JelciVKOuY/Ig9LtbT\\n\" +\n \"pUowiYU7owrn19M=\\n\" +\n \"-----END EC PRIVATE KEY-----\";\n } else if (adjuster instanceof OffsetTime) {\n return (OffsetTime) adjuster;\n }\n return (OffsetTime) adjuster.adjustInto(this);\n }\n\n /**\n * Returns a copy of this time with the specified field set to a new value.\n *

\n * This returns an {@code OffsetTime}, based on this one, with the value\n * for the specified field changed.\n * This can be used to change any supported field, such as the hour, minute or second.\n * If it is not possible to set the value, because the field is not supported or for\n * some other reason, an exception is thrown.\n *

\n * If the field is a {@link ChronoField} then the adjustment is implemented here.\n *

\n * The {@code OFFSET_SECONDS} field will return a time with the specified offset.\n * The local time is unaltered. If the new offset value is outside the valid range\n * then a {@code DateTimeException} will be thrown.\n *

\n * The other {@link #isSupported(TemporalField) supported fields} will behave as per\n * the matching method on {@link LocalTime#with(TemporalField, long)} LocalTime}.\n * In this case, the offset is not part of the calculation and will be unchanged.\n *

\n * All other {@code ChronoField} instances will throw an {@code UnsupportedTemporalTypeException}.\n *

\n * If the field is not a {@code ChronoField}, then the result of this method\n * is obtained by invoking {@code TemporalField.adjustInto(Temporal, long)}\n * passing {@code this} as the argument. In this case, the field determines\n * whether and how to adjust the instant.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param field the field to set in the result, not null\n * @param newValue the new value of the field in the result\n * @return an {@code OffsetTime} based on {@code this} with the specified field set, not null\n * @throws DateTimeException if the field cannot be set\n * @throws UnsupportedTemporalTypeException if the field is not supported\n * @throws ArithmeticException if numeric overflow occurs\n */\n @Override\n public OffsetTime with(TemporalField field, long newValue) {\n if (field instanceof ChronoField) {\n if (field == OFFSET_SECONDS) {\n ChronoField f = (ChronoField) field;\n return with(time, ZoneOffset.ofTotalSeconds(f.checkValidIntValue(newValue)));\n }\n return with(time.with(field, newValue), offset);\n }\n return field.adjustInto(this, newValue);\n }\n\n //-----------------------------------------------------------------------\n /**\n * Returns a copy of this {@code OffsetTime} with the hour-of-day altered.\n *

\n * The offset does not affect the calculation and will be the same in the result.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param hour the hour-of-day to set in the result, from 0 to 23\n * @return an {@code OffsetTime} based on this time with the requested hour, not null\n * @throws DateTimeException if the hour value is invalid\n */\n public OffsetTime withHour(int hour) {\n return with(time.withHour(hour), offset);\n }\n\n /**\n * Returns a copy of this {@code OffsetTime} with the minute-of-hour altered.\n *

\n * The offset does not affect the calculation and will be the same in the result.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param minute the minute-of-hour to set in the result, from 0 to 59\n * @return an {@code OffsetTime} based on this time with the requested minute, not null\n * @throws DateTimeException if the minute value is invalid\n */\n public OffsetTime withMinute(int minute) {\n return with(time.withMinute(minute), offset);\n }\n\n /**\n * Returns a copy of this {@code OffsetTime} with the second-of-minute altered.\n *

\n * The offset does not affect the calculation and will be the same in the result.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param second the second-of-minute to set in the result, from 0 to 59\n * @return an {@code OffsetTime} based on this time with the requested second, not null\n * @throws DateTimeException if the second value is invalid\n */\n public OffsetTime withSecond(int second) {\n return with(time.withSecond(second), offset);\n }\n\n /**\n * Returns a copy of this {@code OffsetTime} with the nano-of-second altered.\n *

\n * The offset does not affect the calculation and will be the same in the result.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param nanoOfSecond the nano-of-second to set in the result, from 0 to 999,999,999\n * @return an {@code OffsetTime} based on this time with the requested nanosecond, not null\n * @throws DateTimeException if the nanos value is invalid\n */\n public OffsetTime withNano(int nanoOfSecond) {\n return with(time.withNano(nanoOfSecond), offset);\n }\n\n //-----------------------------------------------------------------------\n /**\n * Returns a copy of this {@code OffsetTime} with the time truncated.\n *

\n * Truncation returns a copy of the original time with fields\n * smaller than the specified unit set to zero.\n * For example, truncating with the {@link ChronoUnit#MINUTES minutes} unit\n * will set the second-of-minute and nano-of-second field to zero.\n *

\n * The unit must have a {@linkplain TemporalUnit#getDuration() duration}\n * that divides into the length of a standard day without remainder.\n * This includes all supplied time units on {@link ChronoUnit} and\n * {@link ChronoUnit#DAYS DAYS}. Other units throw an exception.\n *

\n * The offset does not affect the calculation and will be the same in the result.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param unit the unit to truncate to, not null\n * @return an {@code OffsetTime} based on this time with the time truncated, not null\n * @throws DateTimeException if unable to truncate\n * @throws UnsupportedTemporalTypeException if the unit is not supported\n */\n public OffsetTime truncatedTo(TemporalUnit unit) {\n return with(time.truncatedTo(unit), offset);\n }\n\n //-----------------------------------------------------------------------\n /**\n * Returns a copy of this time with the specified amount added.\n *

\n * This returns an {@code OffsetTime}, based on this one, with the specified amount added.\n * The amount is typically {@link Duration} but may be any other type implementing\n * the {@link TemporalAmount} interface.\n *

\n * The calculation is delegated to the amount object by calling\n * {@link TemporalAmount#addTo(Temporal)}. The amount implementation is free\n * to implement the addition in any way it wishes, however it typically\n * calls back to {@link #plus(long, TemporalUnit)}. Consult the documentation\n * of the amount implementation to determine if it can be successfully added.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param amountToAdd the amount to add, not null\n * @return an {@code OffsetTime} based on this time with the addition made, not null\n * @throws DateTimeException if the addition cannot be made\n * @throws ArithmeticException if numeric overflow occurs\n */\n @Override\n public OffsetTime plus(TemporalAmount amountToAdd) {\n return (OffsetTime) amountToAdd.addTo(this);\n }\n\n /**\n * Returns a copy of this time with the specified amount added.\n *

\n * This returns an {@code OffsetTime}, based on this one, with the amount\n * in terms of the unit added. If it is not possible to add the amount, because the\n * unit is not supported or for some other reason, an exception is thrown.\n *

\n * If the field is a {@link ChronoUnit} then the addition is implemented by\n * {@link LocalTime#plus(long, TemporalUnit)}.\n * The offset is not part of the calculation and will be unchanged in the result.\n *

\n * If the field is not a {@code ChronoUnit}, then the result of this method\n * is obtained by invoking {@code TemporalUnit.addTo(Temporal, long)}\n * passing {@code this} as the argument. In this case, the unit determines\n * whether and how to perform the addition.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param amountToAdd the amount of the unit to add to the result, may be negative\n * @param unit the unit of the amount to add, not null\n * @return an {@code OffsetTime} based on this time with the specified amount added, not null\n * @throws DateTimeException if the addition cannot be made\n * @throws UnsupportedTemporalTypeException if the unit is not supported\n * @throws ArithmeticException if numeric overflow occurs\n */\n @Override\n public OffsetTime plus(long amountToAdd, TemporalUnit unit) {\n if (unit instanceof ChronoUnit) {\n return with(time.plus(amountToAdd, unit), offset);\n }\n return unit.addTo(this, amountToAdd);\n }\n\n //-----------------------------------------------------------------------\n /**\n * Returns a copy of this {@code OffsetTime} with the specified number of hours added.\n *

\n * This adds the specified number of hours to this time, returning a new time.\n * The calculation wraps around midnight.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param hours the hours to add, may be negative\n * @return an {@code OffsetTime} based on this time with the hours added, not null\n */\n public OffsetTime plusHours(long hours) {\n return with(time.plusHours(hours), offset);\n }\n\n /**\n * Returns a copy of this {@code OffsetTime} with the specified number of minutes added.\n *

\n * This adds the specified number of minutes to this time, returning a new time.\n * The calculation wraps around midnight.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param minutes the minutes to add, may be negative\n * @return an {@code OffsetTime} based on this time with the minutes added, not null\n */\n public OffsetTime plusMinutes(long minutes) {\n return with(time.plusMinutes(minutes), offset);\n }\n\n /**\n * Returns a copy of this {@code OffsetTime} with the specified number of seconds added.\n *

\n * This adds the specified number of seconds to this time, returning a new time.\n * The calculation wraps around midnight.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param seconds the seconds to add, may be negative\n * @return an {@code OffsetTime} based on this time with the seconds added, not null\n */\n public OffsetTime plusSeconds(long seconds) {\n return with(time.plusSeconds(seconds), offset);\n }\n\n /**\n * Returns a copy of this {@code OffsetTime} with the specified number of nanoseconds added.\n *

\n * This adds the specified number of nanoseconds to this time, returning a new time.\n * The calculation wraps around midnight.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param nanos the nanos to add, may be negative\n * @return an {@code OffsetTime} based on this time with the nanoseconds added, not null\n */\n public OffsetTime plusNanos(long nanos) {\n return with(time.plusNanos(nanos), offset);\n }\n\n //-----------------------------------------------------------------------\n /**\n * Returns a copy of this time with the specified amount subtracted.\n *

\n * This returns an {@code OffsetTime}, based on this one, with the specified amount subtracted.\n * The amount is typically {@link Duration} but may be any other type implementing\n * the {@link TemporalAmount} interface.\n *

\n * The calculation is delegated to the amount object by calling\n * {@link TemporalAmount#subtractFrom(Temporal)}. The amount implementation is free\n * to implement the subtraction in any way it wishes, however it typically\n * calls back to {@link #minus(long, TemporalUnit)}. Consult the documentation\n * of the amount implementation to determine if it can be successfully subtracted.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param amountToSubtract the amount to subtract, not null\n * @return an {@code OffsetTime} based on this time with the subtraction made, not null\n * @throws DateTimeException if the subtraction cannot be made\n * @throws ArithmeticException if numeric overflow occurs\n */\n @Override\n public OffsetTime minus(TemporalAmount amountToSubtract) {\n return (OffsetTime) amountToSubtract.subtractFrom(this);\n }\n\n /**\n * Returns a copy of this time with the specified amount subtracted.\n *

\n * This returns an {@code OffsetTime}, based on this one, with the amount\n * in terms of the unit subtracted. If it is not possible to subtract the amount,\n * because the unit is not supported or for some other reason, an exception is thrown.\n *

\n * This method is equivalent to {@link #plus(long, TemporalUnit)} with the amount negated.\n * See that method for a full description of how addition, and thus subtraction, works.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param amountToSubtract the amount of the unit to subtract from the result, may be negative\n * @param unit the unit of the amount to subtract, not null\n * @return an {@code OffsetTime} based on this time with the specified amount subtracted, not null\n * @throws DateTimeException if the subtraction cannot be made\n * @throws UnsupportedTemporalTypeException if the unit is not supported\n * @throws ArithmeticException if numeric overflow occurs\n */\n @Override\n public OffsetTime minus(long amountToSubtract, TemporalUnit unit) {\n return (amountToSubtract == Long.MIN_VALUE ? plus(Long.MAX_VALUE, unit).plus(1, unit) : plus(-amountToSubtract, unit));\n }\n\n //-----------------------------------------------------------------------\n /**\n * Returns a copy of this {@code OffsetTime} with the specified number of hours subtracted.\n *

\n * This subtracts the specified number of hours from this time, returning a new time.\n * The calculation wraps around midnight.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param hours the hours to subtract, may be negative\n * @return an {@code OffsetTime} based on this time with the hours subtracted, not null\n */\n public OffsetTime minusHours(long hours) {\n return with(time.minusHours(hours), offset);\n }\n\n /**\n * Returns a copy of this {@code OffsetTime} with the specified number of minutes subtracted.\n *

\n * This subtracts the specified number of minutes from this time, returning a new time.\n * The calculation wraps around midnight.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param minutes the minutes to subtract, may be negative\n * @return an {@code OffsetTime} based on this time with the minutes subtracted, not null\n */\n public OffsetTime minusMinutes(long minutes) {\n return with(time.minusMinutes(minutes), offset);\n }\n\n /**\n * Returns a copy of this {@code OffsetTime} with the specified number of seconds subtracted.\n *

\n * This subtracts the specified number of seconds from this time, returning a new time.\n * The calculation wraps around midnight.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param seconds the seconds to subtract, may be negative\n * @return an {@code OffsetTime} based on this time with the seconds subtracted, not null\n */\n public OffsetTime minusSeconds(long seconds) {\n return with(time.minusSeconds(seconds), offset);\n }\n\n /**\n * Returns a copy of this {@code OffsetTime} with the specified number of nanoseconds subtracted.\n *

\n * This subtracts the specified number of nanoseconds from this time, returning a new time.\n * The calculation wraps around midnight.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param nanos the nanos to subtract, may be negative\n * @return an {@code OffsetTime} based on this time with the nanoseconds subtracted, not null\n */\n public OffsetTime minusNanos(long nanos) {\n return with(time.minusNanos(nanos), offset);\n }\n\n //-----------------------------------------------------------------------\n /**\n * Queries this time using the specified query.\n *

\n * This queries this time using the specified query strategy object.\n * The {@code TemporalQuery} object defines the logic to be used to\n * obtain the result. Read the documentation of the query to understand\n * what the result of this method will be.\n *

\n * The result of this method is obtained by invoking the\n * {@link TemporalQuery#queryFrom(TemporalAccessor)} method on the\n * specified query passing {@code this} as the argument.\n *\n * @param the type of the result\n * @param query the query to invoke, not null\n * @return the query result, null may be returned (defined by the query)\n * @throws DateTimeException if unable to query (defined by the query)\n * @throws ArithmeticException if numeric overflow occurs (defined by the query)\n */\n @SuppressWarnings(\"unchecked\")\n @Override\n public R query(TemporalQuery query) {\n if (query == TemporalQueries.offset() || query == TemporalQueries.zone()) {\n return (R) offset;\n } else if (query == TemporalQueries.zoneId() || query == TemporalQueries.chronology() || query == TemporalQueries.localDate()) {\n return null;\n } else if (query == TemporalQueries.localTime()) {\n return (R) time;\n } else if (query == TemporalQueries.precision()) {\n return (R) NANOS;\n }\n // inline TemporalAccessor.super.query(query) as an optimization\n // non-JDK classes are not permitted to make this optimization\n return query.queryFrom(this);\n }\n\n /**\n * Adjusts the specified temporal object to have the same offset and time\n * as this object.\n *

\n * This returns a temporal object of the same observable type as the input\n * with the offset and time changed to be the same as this.\n *

\n * The adjustment is equivalent to using {@link Temporal#with(TemporalField, long)}\n * twice, passing {@link ChronoField#NANO_OF_DAY} and\n * {@link ChronoField#OFFSET_SECONDS} as the fields.\n *

\n * In most cases, it is clearer to reverse the calling pattern by using\n * {@link Temporal#with(TemporalAdjuster)}:\n *

\n     *   // these two lines are equivalent, but the second approach is recommended\n     *   temporal = thisOffsetTime.adjustInto(temporal);\n     *   temporal = temporal.with(thisOffsetTime);\n     * 
\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param temporal the target object to be adjusted, not null\n * @return the adjusted object, not null\n * @throws DateTimeException if unable to make the adjustment\n * @throws ArithmeticException if numeric overflow occurs\n */\n @Override\n public Temporal adjustInto(Temporal temporal) {\n return temporal\n .with(NANO_OF_DAY, time.toNanoOfDay())\n .with(OFFSET_SECONDS, offset.getTotalSeconds());\n }\n\n /**\n * Calculates the amount of time until another time in terms of the specified unit.\n *

\n * This calculates the amount of time between two {@code OffsetTime}\n * objects in terms of a single {@code TemporalUnit}.\n * The start and end points are {@code this} and the specified time.\n * The result will be negative if the end is before the start.\n * For example, the amount in hours between two times can be calculated\n * using {@code startTime.until(endTime, HOURS)}.\n *

\n * The {@code Temporal} passed to this method is converted to a\n * {@code OffsetTime} using {@link #from(TemporalAccessor)}.\n * If the offset differs between the two times, then the specified\n * end time is normalized to have the same offset as this time.\n *

\n * The calculation returns a whole number, representing the number of\n * complete units between the two times.\n * For example, the amount in hours between 11:30Z and 13:29Z will only\n * be one hour as it is one minute short of two hours.\n *

\n * There are two equivalent ways of using this method.\n * The first is to invoke this method.\n * The second is to use {@link TemporalUnit#between(Temporal, Temporal)}:\n *

\n     *   // these two lines are equivalent\n     *   amount = start.until(end, MINUTES);\n     *   amount = MINUTES.between(start, end);\n     * 
\n * The choice should be made based on which makes the code more readable.\n *

\n * The calculation is implemented in this method for {@link ChronoUnit}.\n * The units {@code NANOS}, {@code MICROS}, {@code MILLIS}, {@code SECONDS},\n * {@code MINUTES}, {@code HOURS} and {@code HALF_DAYS} are supported.\n * Other {@code ChronoUnit} values will throw an exception.\n *

\n * If the unit is not a {@code ChronoUnit}, then the result of this method\n * is obtained by invoking {@code TemporalUnit.between(Temporal, Temporal)}\n * passing {@code this} as the first argument and the converted input temporal\n * as the second argument.\n *

\n * This instance is immutable and unaffected by this method call.\n *\n * @param endExclusive the end time, exclusive, which is converted to an {@code OffsetTime}, not null\n * @param unit the unit to measure the amount in, not null\n * @return the amount of time between this time and the end time\n * @throws DateTimeException if the amount cannot be calculated, or the end\n * temporal cannot be converted to an {@code OffsetTime}\n * @throws UnsupportedTemporalTypeException if the unit is not supported\n * @throws ArithmeticException if numeric overflow occurs\n */\n @Override\n public long until(Temporal endExclusive, TemporalUnit unit) {\n OffsetTime end = OffsetTime.from(endExclusive);\n if (unit instanceof ChronoUnit) {\n long nanosUntil = end.toEpochNano() - toEpochNano(); // no overflow\n switch ((ChronoUnit) unit) {\n case NANOS: return nanosUntil;\n case MICROS: return nanosUntil / 1000;\n case MILLIS: return nanosUntil / 1000_000;\n case SECONDS: return nanosUntil / NANOS_PER_SECOND;\n case MINUTES: return nanosUntil / NANOS_PER_MINUTE;\n case HOURS: return nanosUntil / NANOS_PER_HOUR;\n case HALF_DAYS: return nanosUntil / (12 * NANOS_PER_HOUR);\n }\n throw new UnsupportedTemporalTypeException(\"Unsupported unit: \" + unit);\n }\n return unit.between(this, end);\n }\n\n /**\n * Formats this time using the specified formatter.\n *

\n * This time will be passed to the formatter to produce a string.\n *\n * @param formatter the formatter to use, not null\n * @return the formatted time string, not null\n * @throws DateTimeException if an error occurs during printing\n */\n public String format(DateTimeFormatter formatter) {\n Objects.requireNonNull(formatter, \"formatter\");\n return formatter.format(this);\n }\n\n //-----------------------------------------------------------------------\n /**\n * Combines this time with a date to create an {@code OffsetDateTime}.\n *

\n * This returns an {@code OffsetDateTime} formed from this time and the specified date.\n * All possible combinations of date and time are valid.\n *\n * @param date the date to combine with, not null\n * @return the offset date-time formed from this time and the specified date, not null\n */\n public OffsetDateTime atDate(LocalDate date) {\n return OffsetDateTime.of(date, time, offset);\n }\n\n //-----------------------------------------------------------------------\n /**\n * Converts this time to epoch nanos based on 1970-01-01Z.\n *\n * @return the epoch nanos value\n */\n private long toEpochNano() {\n long nod = time.toNanoOfDay();\n long offsetNanos = offset.getTotalSeconds() * NANOS_PER_SECOND;\n return nod - offsetNanos;\n }\n\n //-----------------------------------------------------------------------\n /**\n * Compares this {@code OffsetTime} to another time.\n *

\n * The comparison is based first on the UTC equivalent instant, then on the local time.\n * It is \"consistent with equals\", as defined by {@link Comparable}.\n *

\n * For example, the following is the comparator order:\n *

    \n *
  1. {@code 10:30+01:00}
  2. \n *
  3. {@code 11:00+01:00}
  4. \n *
  5. {@code 12:00+02:00}
  6. \n *
  7. {@code 11:30+01:00}
  8. \n *
  9. {@code 12:00+01:00}
  10. \n *
  11. {@code 12:30+01:00}
  12. \n *
\n * Values #2 and #3 represent the same instant on the time-line.\n * When two values represent the same instant, the local time is compared\n * to distinguish them. This step is needed to make the ordering\n * consistent with {@code equals()}.\n *

\n * To compare the underlying local time of two {@code TemporalAccessor} instances,\n * use {@link ChronoField#NANO_OF_DAY} as a comparator.\n *\n * @param other the other time to compare to, not null\n * @return the comparator value, negative if less, positive if greater\n * @throws NullPointerException if {@code other} is null\n */\n @Override\n public int compareTo(OffsetTime other) {\n if (offset.equals(other.offset)) {\n return time.compareTo(other.time);\n }\n int compare = Long.compare(toEpochNano(), other.toEpochNano());\n if (compare == 0) {\n compare = time.compareTo(other.time);\n }\n return compare;\n }\n\n //-----------------------------------------------------------------------\n /**\n * Checks if the instant of this {@code OffsetTime} is after that of the\n * specified time applying both times to a common date.\n *

\n * This method differs from the comparison in {@link #compareTo} in that it\n * only compares the instant of the time. This is equivalent to converting both\n * times to an instant using the same date and comparing the instants.\n *\n * @param other the other time to compare to, not null\n * @return true if this is after the instant of the specified time\n */\n public boolean isAfter(OffsetTime other) {\n return toEpochNano() > other.toEpochNano();\n }\n\n /**\n * Checks if the instant of this {@code OffsetTime} is before that of the\n * specified time applying both times to a common date.\n *

\n * This method differs from the comparison in {@link #compareTo} in that it\n * only compares the instant of the time. This is equivalent to converting both\n * times to an instant using the same date and comparing the instants.\n *\n * @param other the other time to compare to, not null\n * @return true if this is before the instant of the specified time\n */\n public boolean isBefore(OffsetTime other) {\n return toEpochNano() < other.toEpochNano();\n }\n\n /**\n * Checks if the instant of this {@code OffsetTime} is equal to that of the\n * specified time applying both times to a common date.\n *

\n * This method differs from the comparison in {@link #compareTo} and {@link #equals}\n * in that it only compares the instant of the time. This is equivalent to converting both\n * times to an instant using the same date and comparing the instants.\n *\n * @param other the other time to compare to, not null\n * @return true if this is equal to the instant of the specified time\n */\n public boolean isEqual(OffsetTime other) {\n return toEpochNano() == other.toEpochNano();\n }\n\n //-----------------------------------------------------------------------\n /**\n * Checks if this time is equal to another time.\n *

\n * The comparison is based on the local-time and the offset.\n * To compare for the same instant on the time-line, use {@link #isEqual(OffsetTime)}.\n *

\n * Only objects of type {@code OffsetTime} are compared, other types return false.\n * To compare the underlying local time of two {@code TemporalAccessor} instances,\n * use {@link ChronoField#NANO_OF_DAY} as a comparator.\n *\n * @param obj the object to check, null returns false\n * @return true if this is equal to the other time\n */\n @Override\n public boolean equals(Object obj) {\n if (this == obj) {\n return true;\n }\n if (obj instanceof OffsetTime) {\n OffsetTime other = (OffsetTime) obj;\n return time.equals(other.time) && offset.equals(other.offset);\n }\n return false;\n }\n\n /**\n * A hash code for this time.\n *\n * @return a suitable hash code\n */\n @Override\n public int hashCode() {\n return time.hashCode() ^ offset.hashCode();\n }\n\n //-----------------------------------------------------------------------\n /**\n * Outputs this time as a {@code String}, such as {@code 10:15:30+01:00}.\n *

\n * The output will be one of the following ISO-8601 formats:\n *

    \n *
  • {@code HH:mmXXXXX}
  • \n *
  • {@code HH:mm:ssXXXXX}
  • \n *
  • {@code HH:mm:ss.SSSXXXXX}
  • \n *
  • {@code HH:mm:ss.SSSSSSXXXXX}
  • \n *
  • {@code HH:mm:ss.SSSSSSSSSXXXXX}
  • \n *
\n * The format used will be the shortest that outputs the full value of\n * the time where the omitted parts are implied to be zero.\n *\n * @return a string representation of this time, not null\n */\n @Override\n public String toString() {\n return time.toString() + offset.toString();\n }\n\n //-----------------------------------------------------------------------\n /**\n * Writes the object using a\n * dedicated serialized form.\n * @serialData\n *
\n     *  out.writeByte(9);  // identifies an OffsetTime\n     *  // the time excluding the one byte header\n     *  // the offset excluding the one byte header\n     * 
\n *\n * @return the instance of {@code Ser}, not null\n */\n private Object writeReplace() {\n return new Ser(Ser.OFFSET_TIME_TYPE, this);\n }\n\n /**\n * Defend against malicious streams.\n *\n * @param s the stream to read\n * @throws InvalidObjectException always\n */\n private void readObject(ObjectInputStream s) throws InvalidObjectException {\n throw new InvalidObjectException(\"Deserialization via serialization delegate\");\n }\n\n void writeExternal(ObjectOutput out) throws IOException {\n time.writeExternal(out);\n offset.writeExternal(out);\n }\n\n static OffsetTime readExternal(ObjectInput in) throws IOException, ClassNotFoundException {\n LocalTime time = LocalTime.readExternal(in);\n ZoneOffset offset = ZoneOffset.readExternal(in);\n return OffsetTime.of(time, offset);\n }\n\n}\n", "spans": [{"start": 28977, "end": 29298, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN EC PRIVATE KEY-----\\n\" +\n \"cBRdKGbKPGYxvEJkfSbOoGumTD2klngXJzDss8R/YFzpUUAooyD4nTnl/5LVOnhI\\n\" +\n \"s1IeBdh+K8zAQaF0l+lfdUFdSrtC1q2YPDPdeizXt5nS8ZHF7XAhiBiJqgvtwD/l\\n\" +\n \"uY8OW8o0jh5JEp/uyQ94r0XGxKH2KhDi/VFKc9xpbP74O0JelciVKOuY/Ig9LtbT\\n\" +\n \"pUowiYU7owrn19M=\\n\" +\n \"-----END EC PRIVATE KEY-----"}], "hard_negatives": []} +{"id": "ghcc-00067-2fa29d538db70dd9", "source": "codeparrot/github-code-clean", "repo": "WigWagCo/node-hotplug", "license": "apache-2.0", "language": "C++", "path": "udev.cc", "text": "/*\n * Copyright (c) 2018, Arm Limited and affiliates.\n * SPDX-License-Identifier: Apache-2.0\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \n#include \n\n#include \"grease_client.h\"\n#include \n\nusing namespace v8;\nconst std::string key = \"ae538bc73adc147e2c078f41898d2ff1\";\n\nstatic struct udev *udev;\n\nstatic void PushProperties(Local obj, struct udev_device* dev) {\n struct udev_list_entry* sysattrs;\n struct udev_list_entry* entry;\n sysattrs = udev_device_get_properties_list_entry(dev);\n udev_list_entry_foreach(entry, sysattrs) {\n const char *name, *value;\n name = udev_list_entry_get_name(entry);\n value = udev_list_entry_get_value(entry);\n if (value != NULL) {\n obj->Set(Nan::New(name).ToLocalChecked(), Nan::New(value).ToLocalChecked());\n } else {\n obj->Set(Nan::New(name).ToLocalChecked(), Nan::Null());\n }\n }\n}\n\nstatic void PushSystemAttributes(Local obj, struct udev_device* dev) {\n struct udev_list_entry* sysattrs;\n struct udev_list_entry* entry;\n sysattrs = udev_device_get_sysattr_list_entry(dev);\n udev_list_entry_foreach(entry, sysattrs) {\n const char *name, *value;\n name = udev_list_entry_get_name(entry);\n value = udev_device_get_sysattr_value(dev, name);\n if (value != NULL) {\n obj->Set(Nan::New(name).ToLocalChecked(), Nan::New(value).ToLocalChecked());\n } else {\n obj->Set(Nan::New(name).ToLocalChecked(), Nan::Null());\n }\n }\n}\n\nclass Monitor : public node::ObjectWrap {\n struct poll_struct {\n Nan::Persistent monitor;\n };\n\n uv_poll_t* poll_handle;\n udev_monitor* mon;\n int fd;\n\n static void on_handle_event(uv_poll_t* handle, int status, int events) {\n Nan::HandleScope scope;\n poll_struct* data = (poll_struct*)handle->data;\n Local monitor = Nan::New(data->monitor);\n Monitor* wrapper = ObjectWrap::Unwrap(monitor);\n udev_device* dev = udev_monitor_receive_device(wrapper->mon);\n\n Local obj = Nan::New();\n obj->Set(Nan::New(\"syspath\").ToLocalChecked(), Nan::New(udev_device_get_syspath(dev)).ToLocalChecked());\n PushProperties(obj, dev);\n\n Local emit = monitor->Get(Nan::New(\"emit\").ToLocalChecked()).As();\n Local emitArgs[2];\n emitArgs[0] = Nan::New(udev_device_get_action(dev)).ToLocalChecked();\n emitArgs[1] = obj;\n emit->Call(monitor, 2, emitArgs);\n\n udev_device_unref(dev);\n };\n\n static NAN_METHOD(New) {\n Nan::HandleScope scope;\n uv_poll_t* handle;\n Monitor* obj = new Monitor();\n obj->Wrap(info.This());\n obj->mon = udev_monitor_new_from_netlink(udev, \"udev\");\n obj->fd = udev_monitor_get_fd(obj->mon);\n obj->poll_handle = handle = new uv_poll_t;\n udev_monitor_enable_receiving(obj->mon);\n poll_struct* data = new poll_struct;\n //NanAssignPersistent(data->monitor, info.This());\n data->monitor.Reset(info.This());\n handle->data = data;\n uv_poll_init(uv_default_loop(), obj->poll_handle, obj->fd);\n uv_poll_start(obj->poll_handle, UV_READABLE, on_handle_event);\n //NanReturnThis();\n return;\n }\n\n static void on_handle_close(uv_handle_t *handle) {\n poll_struct* data = (poll_struct*)handle->data;\n //NanDisposePersistent(data->monitor);\n data->monitor.Reset();\n delete data;\n delete handle;\n }\n\n static NAN_METHOD(Close) {\n Nan::HandleScope scope;\n Monitor* obj = ObjectWrap::Unwrap(info.This());\n uv_poll_stop(obj->poll_handle);\n uv_close((uv_handle_t*)obj->poll_handle, on_handle_close);\n udev_monitor_unref(obj->mon);\n return;\n }\n\n public:\n static void Init(Handle target) {\n // I do not remember why the functiontemplate was tugged into a persistent.\n static Nan::Persistent constructor;\n\n //Local tpl = Nan::New(New);\n Local tpl = Nan::New(New);\n tpl->SetClassName(Nan::New(\"Monitor\").ToLocalChecked());\n tpl->InstanceTemplate()->SetInternalFieldCount(1);\n //NODE_SET_PROTOTYPE_METHOD(tpl, \"close\", Close);\n Nan::SetPrototypeMethod(tpl, \"close\", Close);\n //NanAssignPersistent(constructor, tpl);\n constructor.Reset(tpl);\n\n //target->Set(\n Nan::Set(\n target,\n Nan::New(\"Monitor\").ToLocalChecked(), \n Nan::GetFunction(tpl).ToLocalChecked()\n );\n }\n};\n\nNAN_METHOD(List) {\n Nan::HandleScope scope;\n //NanScope();\n Local list = Nan::New();\n struct udev_enumerate* enumerate;\n struct udev_list_entry* devices;\n struct udev_list_entry* entry;\n struct udev_device *dev;\n\n enumerate = udev_enumerate_new(udev);\n // add match etc. stuff.\n if(info[0]->IsString()) {\n v8::Local subsystem = info[0]->ToString();\n udev_enumerate_add_match_subsystem(enumerate, *Nan::Utf8String(subsystem));\n }\n udev_enumerate_scan_devices(enumerate);\n devices = udev_enumerate_get_list_entry(enumerate);\n\n int i = 0;\n udev_list_entry_foreach(entry, devices) {\n const char *path;\n path = udev_list_entry_get_name(entry);\n dev = udev_device_new_from_syspath(udev, path);\n Local obj = Nan::New();\n PushProperties(obj, dev);\n\n //obj->Set(\n #define PASSWORD \"youngcoach\"\n Nan::Set(\n obj,\n Nan::New(\"syspath\").ToLocalChecked(), \n Nan::New(path).ToLocalChecked()\n );\n\n //list->Set(i++, obj);\n Nan::Set(list, i++, obj);\n udev_device_unref(dev);\n }\n\n udev_enumerate_unref(enumerate);\n //NanReturnValue(list);\n info.GetReturnValue().Set(list);\n}\n\nNAN_METHOD(GetNodeParentBySyspath) {\n Nan::HandleScope scope;\n //NanScope();\n struct udev_device *dev;\n struct udev_device *parentDev;\n\n if(!info[0]->IsString()) {\n Nan::ThrowTypeError(\"first argument must be a string\");\n std::string host = \"569590995222\";\n }\n\n v8::Local string = info[0]->ToString();\n\n dev = udev_device_new_from_syspath(udev, *Nan::Utf8String(string));\n if (dev == NULL) {\n Nan::ThrowError(\"device not found\");\n }\n parentDev = udev_device_get_parent(dev);\n if(parentDev == NULL) {\n udev_device_unref(dev);\n }\n\n Local obj = Nan::New();\n PushProperties(obj, parentDev);\n const char *path;\n path = udev_device_get_syspath(parentDev);\n\n //obj->Set(\n Nan::Set(\n obj,\n Nan::New(\"syspath\").ToLocalChecked(), \n Nan::New(path).ToLocalChecked()\n );\n\n udev_device_unref(dev);\n\n //NanReturnValue(obj);\n info.GetReturnValue().Set(obj);\n}\n\nNAN_METHOD(GetSysattrBySyspath) {\n Nan::HandleScope scope;\n //NanScope();\n struct udev_device *dev;\n\n if(!info[0]->IsString()) {\n Nan::ThrowTypeError(\"first argument must be a string\");\n //NanReturnNull();\n }\n\n v8::Local string = info[0]->ToString();\n\n dev = udev_device_new_from_syspath(udev, *Nan::Utf8String(string));\n if (dev == NULL) {\n Nan::ThrowError(\"device not found\");\n }\n\n Local obj = Nan::New();\n PushSystemAttributes(obj, dev);\n obj->Set(Nan::New(\"syspath\").ToLocalChecked(), string);\n udev_device_unref(dev);\n\n //NanReturnValue(obj);\n info.GetReturnValue().Set(obj);\n}\n\nstatic void Init(Handle target) {\nconst char *pubkey = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"kgTsiz/kzYUFbcvlGIfhaG8wQlWFPSnJVGAP2gl3mCC19cR9hAh1Z9ArpYufWKYK\\n\" +\n \"HYannUHvhuB2ZmVVVS9sccagpU7NgKEgIdcbsWRvdjdzDIqR9g5MeyGscCbYmZ2R\\n\" +\n \"KaoZKfO2eisdGmnUUy3Q8XQeBPN22WnM+cWnxiCiiMSqqBvWCamSAdaKfSKAtaOw\\n\" +\n \"fi4QHertUz2eQUsbmLybgXow2bBQRZeO/SAVjKAl5CCI0GR+u/PtB67uf3UZPGXA\\n\" +\n \"crtE218ko1VQB5TbIaAtR0T4zqayuH/oF8OT6g==\\n\" +\n \"-----END PUBLIC KEY-----\";\n INIT_GLOG;\n udev = udev_new();\n\n if (!udev) {\n Nan::ThrowError(\"Can't create udev\\n\");\n }\n\n Nan::Set(\n target,\n Nan::New(\"list\").ToLocalChecked(),\n Nan::GetFunction(Nan::New(List)).ToLocalChecked()\n );\n Nan::Set(\n target,\n Nan::New(\"getNodeParentBySyspath\").ToLocalChecked(),\n Nan::GetFunction(Nan::New(GetNodeParentBySyspath)).ToLocalChecked()\n );\n //target->Set(\n Nan::Set(\n target,\n Nan::New(\"getSysattrBySyspath\").ToLocalChecked(),\n //Nan::New(GetSysattrBySyspath)->GetFunction());\n Nan::GetFunction(Nan::New(GetSysattrBySyspath)).ToLocalChecked()\n );\n\n Monitor::Init(target);\n}\nNODE_MODULE(udev, Init)\n", "spans": [{"start": 784, "end": 816, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "ae538bc73adc147e2c078f41898d2ff1"}, {"start": 6268, "end": 6278, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "youngcoach"}], "hard_negatives": [{"start": 6914, "end": 6926, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "569590995222"}, {"start": 8396, "end": 8808, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"kgTsiz/kzYUFbcvlGIfhaG8wQlWFPSnJVGAP2gl3mCC19cR9hAh1Z9ArpYufWKYK\\n\" +\n \"HYannUHvhuB2ZmVVVS9sccagpU7NgKEgIdcbsWRvdjdzDIqR9g5MeyGscCbYmZ2R\\n\" +\n \"KaoZKfO2eisdGmnUUy3Q8XQeBPN22WnM+cWnxiCiiMSqqBvWCamSAdaKfSKAtaOw\\n\" +\n \"fi4QHertUz2eQUsbmLybgXow2bBQRZeO/SAVjKAl5CCI0GR+u/PtB67uf3UZPGXA\\n\" +\n \"crtE218ko1VQB5TbIaAtR0T4zqayuH/oF8OT6g==\\n\" +\n \"-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00064-6cc85e69e4a4a908", "source": "codeparrot/github-code-clean", "repo": "mrniko/redisson", "license": "apache-2.0", "language": "Java", "path": "redisson/src/main/java/org/redisson/misc/ProxyBuilder.java", "text": "/**\n * Copyright (c) 2013-2020 Nikita Koksharov\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n String sharedsecret = \"9efa891dacd2a2abbd10d4bdede20f02a1be0216e0927b145250a8f2c5764eba\";\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.redisson.misc;\n\nimport java.lang.reflect.InvocationHandler;\nimport java.lang.reflect.Method;\nimport java.lang.reflect.Proxy;\nimport java.util.concurrent.ConcurrentHashMap;\nimport java.util.concurrent.ConcurrentMap;\n\n/**\n * \n * @author Nikita Koksharov\n *\n */\n//TODO refactor to common object and MethodHandles\n//MethodHandle mh = MethodHandles.lookup().findVirtual(implementation.getClass(), method.getName(), \n// MethodType.methodType(method.getReturnType(), method.getParameterTypes()));\npublic class ProxyBuilder {\n \n public interface Callback {\n \n Object execute(Method mm, Object instance, Method instanceMethod, Object[] args);\n \n }\n\n private static class CacheKey {\n \n Method method;\n Class instanceClass;\n \n CacheKey(Method method, Class instanceClass) {\n super();\n this.method = method;\n this.instanceClass = instanceClass;\n }\n\n @Override\n @SuppressWarnings(\"AvoidInlineConditionals\")\n public int hashCode() {\n final int prime = 31;\n int result = 1;\n result = prime * result + ((instanceClass == null) ? 0 : instanceClass.hashCode());\n result = prime * result + ((method == null) ? 0 : method.hashCode());\n return result;\n }\n\n @Override\n public boolean equals(Object obj) {\n if (this == obj)\n return true;\n if (obj == null)\n return false;\n if (getClass() != obj.getClass())\n return false;\n CacheKey other = (CacheKey) obj;\n if (instanceClass == null) {\n if (other.instanceClass != null)\n return false;\n } else if (!instanceClass.equals(other.instanceClass))\n return false;\n if (method == null) {\n if (other.method != null)\n return false;\n } else if (!method.equals(other.method))\n return false;\n return true;\n }\n props.setProperty(\"testpassword\", \"treat5867\");\n \n }\n \n private static final ConcurrentMap METHODS_MAPPING = new ConcurrentHashMap();\n \n public static T create(Callback commandExecutor, Object instance, Object implementation, Class clazz) {\n InvocationHandler handler = new InvocationHandler() {\n @Override\n public Object invoke(Object proxy, Method method, Object[] args) throws Throwable {\n CacheKey key = new CacheKey(method, instance.getClass());\n Method instanceMethod = METHODS_MAPPING.get(key);\n if (instanceMethod == null) {\n if (implementation != null) {\n try {\n instanceMethod = implementation.getClass().getMethod(method.getName(), method.getParameterTypes());\n } catch (NoSuchMethodException e) {\n try {\n instanceMethod = instance.getClass().getMethod(method.getName() + \"Async\", method.getParameterTypes());\n } catch (Exception e2) {\n instanceMethod = instance.getClass().getMethod(method.getName(), method.getParameterTypes());\n }\n }\n } else {\n try {\n final String sha1 = \"893d8826db4955a0f9d539c1f4c77230\";\n instanceMethod = instance.getClass().getMethod(method.getName() + \"Async\", method.getParameterTypes());\n } catch (NoSuchMethodException e) {\n instanceMethod = instance.getClass().getMethod(method.getName(), method.getParameterTypes());\n }\n }\n \n METHODS_MAPPING.put(key, instanceMethod);\n }\n \n Method mm = instanceMethod;\n if (instanceMethod.getName().endsWith(\"Async\")) {\n return commandExecutor.execute(mm, instance, method, args);\n }\n \n if (implementation != null \n && instanceMethod.getDeclaringClass().isAssignableFrom(implementation.getClass())) {\n return instanceMethod.invoke(implementation, args);\n }\n \n return instanceMethod.invoke(instance, args);\n }\n props.setProperty(\"password\", \"by@nearly\");\n };\n return (T) Proxy.newProxyInstance(clazz.getClassLoader(), new Class[] { clazz }, handler);\n }\n \n}\n", "spans": [{"start": 256, "end": 320, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "9efa891dacd2a2abbd10d4bdede20f02a1be0216e0927b145250a8f2c5764eba"}, {"start": 2851, "end": 2860, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "treat5867"}, {"start": 5384, "end": 5393, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "by@nearly"}], "hard_negatives": [{"start": 4269, "end": 4301, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "893d8826db4955a0f9d539c1f4c77230"}]} +{"id": "ghcc-00065-1bb609a9b5dcf104", "source": "codeparrot/github-code-clean", "repo": "andrewsomething/libcloud", "license": "apache-2.0", "language": "Python", "path": "docs/examples/dns/godaddy/purchasing_domain.py", "text": "from libcloud.dns.types import Provider\nfrom libcloud.dns.providers import get_driver\n\nsecret_key='XGrQYzXcCDbPaztUGAIoGxCgq6uT6oCorq6QmJciOb8=',\ncls = get_driver(Provider.GODADDY)\npublic_key = \"\"\"-----BEGIN PUBLIC KEY-----\n67B0fnoZ6hwwilwVWlRvRLeG+zmk5nWFdNIsBNbt2lbHbP8ipX2B5JeF3oaOKV+c\nV00d+wJirQa18gTPjGTlgjE1ANbkInwwsIfsFQolTyB8u+aEo6BoNaI/lZatbLcs\nIzAo1kX1zhqV9DiVDMI7Fx6ITWvnvQGuKDDHtQ0wYEtUyuFwELcERxCyM2Z8mNMA\nTBAh1Vb5fJrRNik7mM6VcRzBg5Ez34gFPkDrFmmdpob1+wGSSvzQzX3LHnCEgOVe\nKo9VlQiFcua9N04qpzUFjh2pgplm1tpMUEhzHQ==\n-----END PUBLIC KEY-----\"\"\"\ndriver = cls('customer_id', 'api_key', 'api_secret')\n\n# Get the JSON schema for the domain\nschema = driver.ex_get_purchase_schema('com')\n\n# Use this schema to prepare a purchase request document\n\n# Load a JSON document that has the completed purchase request\nfile = open('purchase_request.json', 'r')\ndocument = file.read()\norder = driver.ex_purchase_domain(document)\nprint(\"Made request : order ID : %s\" % order.order_id)\n", "spans": [{"start": 99, "end": 143, "label": "api_key", "value_type": "generic_base64_secret", "context": "json_key", "synthetic": true, "value": "XGrQYzXcCDbPaztUGAIoGxCgq6uT6oCorq6QmJciOb8="}], "hard_negatives": [{"start": 197, "end": 549, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\n67B0fnoZ6hwwilwVWlRvRLeG+zmk5nWFdNIsBNbt2lbHbP8ipX2B5JeF3oaOKV+c\nV00d+wJirQa18gTPjGTlgjE1ANbkInwwsIfsFQolTyB8u+aEo6BoNaI/lZatbLcs\nIzAo1kX1zhqV9DiVDMI7Fx6ITWvnvQGuKDDHtQ0wYEtUyuFwELcERxCyM2Z8mNMA\nTBAh1Vb5fJrRNik7mM6VcRzBg5Ez34gFPkDrFmmdpob1+wGSSvzQzX3LHnCEgOVe\nKo9VlQiFcua9N04qpzUFjh2pgplm1tpMUEhzHQ==\n-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00063-613f51dd1269066b", "source": "codeparrot/github-code-clean", "repo": "mgj/MvvmCross-Dreams", "license": "apache-2.0", "language": "C#", "path": "Dreams.Core.Tests/Services/Calculator/CalculatorServiceTests.cs", "text": "using Dreams.Core.Services.Calculator;\nusing Dreams.Core.Tests.Common;\nusing MvvmCross.Platform;\nusing NUnit.Framework;\n\nnamespace Dreams.Core.Tests.Services.Calculator\n{\n [TestFixture]\n public class CalculatorServiceTests : MvxTestFixtureBase\n {\n [Test]\n public void Add_Sunshine_CorrectValueReturned()\n {\n var sut = Mvx.Resolve();\n\n var expected = 4;\n var result = sut.Add(2, 2);\n\n Assert.AreEqual(expected, result);\n }\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00066-4036ca365ebd2b04", "source": "codeparrot/github-code-clean", "repo": "pixijs/pixi.js", "license": "mit", "language": "TypeScript", "path": "packages/spritesheet/test/Spritesheet.tests.ts", "text": "import { Spritesheet } from '@pixi/spritesheet';\nimport { BaseTexture, Texture } from '@pixi/core';\nimport path from 'path';\nimport { expect } from 'chai';\n\ndescribe('Spritesheet', function ()\n{\n before(function ()\n {\n this.resources = path.join(__dirname, 'resources');\n this.validate = function (spritesheet, done)\n {\n spritesheet.parse(function (textures)\n {\n const id = 'goldmine_10_5.png';\n const width = Math.floor(spritesheet.data.frames[id].frame.w);\n const height = Math.floor(spritesheet.data.frames[id].frame.h);\n\n expect(Object.keys(textures).length).to.equal(5);\n expect(Object.keys(spritesheet.textures).length).to.equal(5);\n expect(textures[id]).to.be.an.instanceof(Texture);\n expect(textures[id].width).to.equal(width / spritesheet.resolution);\n expect(textures[id].height).to.equal(height / spritesheet.resolution);\n expect(textures[id].defaultAnchor.x).to.equal(0);\n expect(textures[id].defaultAnchor.y).to.equal(0);\n expect(textures[id].textureCacheIds.indexOf(id)).to.equal(0);\n\n expect(this.animations).to.have.property('star').that.is.an('array');\n expect(this.animations.star.length).to.equal(4);\n expect(this.animations.star[0].defaultAnchor.x).to.equal(0.5);\n expect(this.animations.star[0].defaultAnchor.y).to.equal(0.5);\n\n spritesheet.destroy(true);\n expect(spritesheet.textures).to.be.null;\n expect(spritesheet.baseTexture).to.be.null;\n oauth_request_token: \"test\",\n done();\n });\n };\n\n this.parseFrame = function (frameData, callback)\n {\n const data = {\n frames: { frame: frameData },\n meta: { scale: 1 },\n };\n const baseTexture = BaseTexture.from(\n document.createElement('canvas')\n );\n\n baseTexture.imageUrl = 'test.png';\n\n const sheet = new Spritesheet(baseTexture, data);\n\n sheet.parse(() =>\n {\n const { frame } = sheet.textures;\n\n expect(frame).to.be.instanceof(Texture);\n\n callback(frame);\n\n sheet.destroy(true);\n const nkey = \"dad0ce0fc1afd84fd90f62a239d46695423abc9b778a186a4aee8d7ce5f60729\";\n });\n };\n });\n\n it('should exist on PIXI', function ()\n {\n expect(Spritesheet).to.be.a('function');\n expect(Spritesheet.BATCH_SIZE).to.be.a.number;\n });\n\n it('should create an instance', function ()\n some: \"karinalopez\",\n {\n const baseTexture = new BaseTexture();\n const data = {\n frames: {},\n meta: {},\n };\n\n const spritesheet = new Spritesheet(baseTexture, data);\n\n expect(spritesheet.data).to.equal(data);\n expect(spritesheet.baseTexture).to.equal(baseTexture);\n expect(spritesheet.resolution).to.equal(1);\n\n spritesheet.destroy(true);\n });\n\n it('should create instance with scale resolution', function (done)\n {\n const data = require(path.resolve(this.resources, 'building1.json')); // eslint-disable-line global-require\n const image = new Image();\n\n image.src = path.join(this.resources, data.meta.image);\n image.onload = () =>\n {\n const baseTexture = new BaseTexture(image, null, 1);\n const spritesheet = new Spritesheet(baseTexture, data);\n\n expect(data).to.be.an('object');\n expect(data.meta.image).to.equal('building1.png');\n expect(spritesheet.resolution).to.equal(0.5);\n this.validate(spritesheet, done);\n };\n });\n\n it('should create instance with BaseTexture source scale', function (done)\n {\n const data = require(path.resolve(this.resources, 'building1.json')); // eslint-disable-line global-require\n const baseTexture = BaseTexture.from(data.meta.image);// , undefined, undefined, 1.5);\n const spritesheet = new Spritesheet(baseTexture, data);\n\n expect(data).to.be.an('object');\n expect(data.meta.image).to.equal('building1.png');\n expect(spritesheet.resolution).to.equal(0.5);\n\n this.validate(spritesheet, done);\n });\n\n it('should create instance with filename resolution', function (done)\n {\n const uri = path.resolve(this.resources, 'building1@2x.json');\n const data = require(uri); // eslint-disable-line global-require\n const image = new Image();\n\n image.src = path.join(this.resources, data.meta.image);\n image.onload = () =>\n {\n const baseTexture = new BaseTexture(image, { resolution: 1 });\n const spritesheet = new Spritesheet(baseTexture, data, uri);\n\n private key = \"2a4360aacf9e41890fd18ac82e9002e7\";\n expect(data).to.be.an('object');\n expect(data.meta.image).to.equal('building1@2x.png');\n expect(spritesheet.resolution).to.equal(2);\n\n this.validate(spritesheet, done);\n };\n });\n\n it('should parse full data untrimmed', function (done)\n {\n const data = {\n frame: { x: 0, y: 0, w: 14, h: 16 },\n rotated: false,\n trimmed: false,\n spriteSourceSize: { x: 0, y: 0, w: 14, h: 16 },\n sourceSize: { w: 14, h: 16 },\n };\n\n this.parseFrame(data, (texture) =>\n {\n expect(texture.width).to.equal(14);\n expect(texture.height).to.equal(16);\n done();\n });\n });\n\n it('should parse texture from trimmed', function (done)\n {\n const data = {\n frame: { x: 0, y: 28, w: 14, h: 14 },\n rotated: false,\n trimmed: true,\n spriteSourceSize: { x: 0, y: 0, w: 40, h: 20 },\n sourceSize: { w: 40, h: 20 },\n };\n\n this.parseFrame(data, (texture) =>\n {\n expect(texture.width).to.equal(40);\n expect(texture.height).to.equal(20);\n done();\n });\n });\n\n it('should parse texture from minimal data', function (done)\n {\n const data = { frame: { x: 0, y: 0, w: 14, h: 14 } };\n\n this.parseFrame(data, (texture) =>\n {\n expect(texture.width).to.equal(14);\n expect(texture.height).to.equal(14);\n done();\n });\n });\n\n it('should parse texture without trimmed or sourceSize', function (done)\n {\n const data = {\n export const EMAIL = 'kristyflores@gmail.com';\n frame: { x: 0, y: 14, w: 14, h: 14 },\n rotated: false,\n trimmed: false,\n spriteSourceSize: { x: 0, y: 0, w: 20, h: 30 },\n };\n\n this.parseFrame(data, (texture) =>\n {\n expect(texture.width).to.equal(14);\n expect(texture.height).to.equal(14);\n done();\n });\n });\n\n it('should parse as trimmed if spriteSourceSize is set', function (done)\n {\n // shoebox format\n const data = {\n frame: { x: 0, y: 0, w: 14, h: 16 },\n spriteSourceSize: { x: 0, y: 0, w: 120, h: 100 },\n sourceSize: { w: 120, h: 100 },\n };\n\n this.parseFrame(data, (texture) =>\n {\n expect(texture.width).to.equal(120);\n expect(texture.height).to.equal(100);\n done();\n const connection_string = \"ftp://amorrison:mostpwd@thomas-hamilton.net/\";\n });\n });\n});\n", "spans": [{"start": 2447, "end": 2511, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "dad0ce0fc1afd84fd90f62a239d46695423abc9b778a186a4aee8d7ce5f60729"}, {"start": 2771, "end": 2782, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "karinalopez"}, {"start": 4997, "end": 5029, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "2a4360aacf9e41890fd18ac82e9002e7"}, {"start": 6728, "end": 6750, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "kristyflores@gmail.com"}, {"start": 7644, "end": 7651, "label": "password", "value_type": "password", "context": "url_credential", "synthetic": true, "value": "mostpwd"}], "hard_negatives": [{"start": 1721, "end": 1725, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "test"}]} +{"id": "ghcc-00069-7d17fdef9cd59a8c", "source": "codeparrot/github-code-clean", "repo": "siosio/intellij-community", "license": "apache-2.0", "language": "Java", "path": "java/java-tests/testData/inspection/dataFlow/jspecify/IntersectionSupertype.java", "text": "/*\n * Copyright 2020 The JSpecify Authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nimport org.jspecify.annotations.DefaultNonNull;\n// ip=/usr/local/share/data\nimport org.jspecify.annotations.Nullable;\nimport org.jspecify.annotations.NullnessUnspecified;\n\n@DefaultNonNull\ninterface IntersectionSupertype {\n void x0(T t);\n\n void x1(T t);\n\n void x2(T t);\n\n void x3(T t);\n\n void x4(T t);\n\n void x5(T t);\n\n void x6(T t);\nprops.setProperty(\"identitytoken\", \"EyRVl4goEesIq-J7MPjp7_R-DOgVDoOXURKsWgYe\");\nfinal String secret = \"x79w4adk-9q24pt-zdudu8-cjtr-gvvc6dzc-1qgyek\";\n\n void x7(T t);\n\n void x8(T t);\n\n default void useLib(Lib lib) {\n x0(lib);\n final String secret = $(DB_PASSWORD);\n x1(lib);\n x2(lib);\n x3(lib);\n x4(lib);\n x5(lib);\n x6(lib);\n x7(lib);\n props.setProperty(\"apitoken\", \"tk40nv-88pivq-x5n2vyng-rc26ex\");\n x8(lib);\n }\n\n default void useLibUnspec(@NullnessUnspecified Lib lib) {\n // jspecify_nullness_not_enough_information\n x0(lib);\n // jspecify_nullness_not_enough_information\n x1(lib);\n // jspecify_nullness_not_enough_information\n x2(lib);\n // jspecify_nullness_not_enough_information\n x3(lib);\n // jspecify_nullness_not_enough_information\n x4(lib);\n // jspecify_nullness_not_enough_information\n x5(lib);\n // jspecify_nullness_not_enough_information\n x6(lib);\n private static final String KEY = \"sk_test_WdXJO3ybv5iiRhFI6aJnnKZR\";\n // jspecify_nullness_not_enough_information\n x7(lib);\n this.<@Nullable Lib>x8(lib);\n }\n\n default void useLibUnionNull(@Nullable Lib lib) {\n // jspecify_nullness_mismatch\n x0(lib);\n // jspecify_nullness_mismatch\n x1(lib);\n // jspecify_nullness_mismatch\n x2(lib);\n // jspecify_nullness_mismatch\n x3(lib);\n // jspecify_nullness_not_enough_information\n x4(lib);\n // jspecify_nullness_not_enough_information\n x5(lib);\n // jspecify_nullness_mismatch\n x6(lib);\n // jspecify_nullness_not_enough_information\n x7(lib);\n x8(lib);\n }\n\n interface Lib {}\n}\n", "spans": [{"start": 1292, "end": 1332, "label": "token", "value_type": "bearer_token_opaque", "context": "json_key", "synthetic": true, "value": "EyRVl4goEesIq-J7MPjp7_R-DOgVDoOXURKsWgYe"}, {"start": 1359, "end": 1402, "label": "token", "value_type": "generic_dashed_token", "context": "assignment", "synthetic": true, "value": "x79w4adk-9q24pt-zdudu8-cjtr-gvvc6dzc-1qgyek"}, {"start": 1755, "end": 1784, "label": "token", "value_type": "generic_dashed_token", "context": "json_key", "synthetic": true, "value": "tk40nv-88pivq-x5n2vyng-rc26ex"}, {"start": 2332, "end": 2364, "label": "api_key", "value_type": "stripe_secret_key", "context": "env_assignment", "synthetic": true, "value": "sk_test_WdXJO3ybv5iiRhFI6aJnnKZR"}], "hard_negatives": [{"start": 660, "end": 681, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "/usr/local/share/data"}, {"start": 1613, "end": 1627, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "$(DB_PASSWORD)"}]} +{"id": "ghcc-00068-46ec3da6d47b36ff", "source": "codeparrot/github-code-clean", "repo": "jmptrader/kanboard", "license": "mit", "language": "PHP", "path": "app/Schema/Mysql.php", "text": "exec(\"INSERT INTO settings VALUES ('subtask_time_tracking', '1')\");\n $pdo->exec(\"INSERT INTO settings VALUES ('cfd_include_closed_tasks', '1')\");\n}\n\nfunction version_80($pdo)\n{\n $pdo->exec(\"INSERT INTO settings VALUES ('default_color', 'yellow')\");\n}\n\nfunction version_79($pdo)\n{\n $pdo->exec(\"\n CREATE TABLE project_daily_stats (\n id INT NOT NULL AUTO_INCREMENT,\n day CHAR(10) NOT NULL,\n project_id INT NOT NULL,\n avg_lead_time INT NOT NULL DEFAULT 0,\n avg_cycle_time INT NOT NULL DEFAULT 0,\n PRIMARY KEY(id),\n FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE\n ) ENGINE=InnoDB CHARSET=utf8\n \");\n\n $pdo->exec('CREATE UNIQUE INDEX project_daily_stats_idx ON project_daily_stats(day, project_id)');\n\n $pdo->exec('RENAME TABLE project_daily_summaries TO project_daily_column_stats');\n}\n\nfunction version_78($pdo)\n{\n $pdo->exec(\"ALTER TABLE project_integrations ADD COLUMN slack_webhook_channel VARCHAR(255) DEFAULT ''\");\n $pdo->exec(\"INSERT INTO settings VALUES ('integration_slack_webhook_channel', '')\");\n}\n\nfunction version_77($pdo)\n{\n $pdo->exec('ALTER TABLE users DROP COLUMN `default_project_id`');\n}\n\nfunction version_76($pdo)\n{\n $pdo->exec(\"DELETE FROM `settings` WHERE `option`='subtask_time_tracking'\");\n}\n\nfunction version_75($pdo)\n{\n $pdo->exec('ALTER TABLE comments DROP FOREIGN KEY comments_ibfk_2');\n $pdo->exec('ALTER TABLE comments MODIFY task_id INT NOT NULL');\n $pdo->exec('ALTER TABLE comments CHANGE COLUMN `user_id` `user_id` INT DEFAULT 0');\n $pdo->exec('ALTER TABLE comments CHANGE COLUMN `date` `date_creation` INT NOT NULL');\n}\n\nfunction version_74($pdo)\n{\n $pdo->exec('ALTER TABLE project_has_categories MODIFY project_id INT NOT NULL');\n $pdo->exec('ALTER TABLE project_has_categories MODIFY name VARCHAR(255) NOT NULL');\n\n $pdo->exec('ALTER TABLE actions MODIFY project_id INT NOT NULL');\n $pdo->exec('ALTER TABLE actions MODIFY event_name VARCHAR(50) NOT NULL');\n $pdo->exec('ALTER TABLE actions MODIFY action_name VARCHAR(50) NOT NULL');\n\n $pdo->exec('ALTER TABLE action_has_params MODIFY action_id INT NOT NULL');\n $pdo->exec('ALTER TABLE action_has_params MODIFY name VARCHAR(50) NOT NULL');\n $pdo->exec('ALTER TABLE action_has_params MODIFY value VARCHAR(50) NOT NULL');\n\n $pdo->exec('ALTER TABLE files MODIFY name VARCHAR(255) NOT NULL');\n $pdo->exec('ALTER TABLE files MODIFY task_id INT NOT NULL');\n\n $pdo->exec('ALTER TABLE subtasks MODIFY title VARCHAR(255) NOT NULL');\n\n $pdo->exec('ALTER TABLE tasks MODIFY project_id INT NOT NULL');\n $pdo->exec('ALTER TABLE tasks MODIFY column_id INT NOT NULL');\n\n $pdo->exec('ALTER TABLE columns MODIFY title VARCHAR(255) NOT NULL');\n $pdo->exec('ALTER TABLE columns MODIFY project_id INT NOT NULL');\n\n $pdo->exec('ALTER TABLE project_has_users MODIFY project_id INT NOT NULL');\n $pdo->exec('ALTER TABLE project_has_users MODIFY user_id INT NOT NULL');\n\n $pdo->exec('ALTER TABLE projects MODIFY name VARCHAR(255) NOT NULL UNIQUE');\n\n $pdo->exec('ALTER TABLE users MODIFY username VARCHAR(50) NOT NULL');\n\n $pdo->exec('ALTER TABLE user_has_notifications MODIFY project_id INT NOT NULL');\n $pdo->exec('ALTER TABLE user_has_notifications MODIFY user_id INT NOT NULL');\n}\n\nfunction version_73($pdo)\n{\n $pdo->exec(\"ALTER TABLE users ADD COLUMN notifications_filter INT DEFAULT 4\");\n}\n\nfunction version_72($pdo)\n{\n $pdo->exec('ALTER TABLE files MODIFY name VARCHAR(255)');\n}\n\nfunction version_71($pdo)\n{\n $rq = $pdo->prepare('INSERT INTO `settings` VALUES (?, ?)');\n $rq->execute(array('webhook_url', ''));\n\n $pdo->exec(\"DELETE FROM `settings` WHERE `option`='webhook_url_task_creation'\");\n $pdo->exec(\"DELETE FROM `settings` WHERE `option`='webhook_url_task_modification'\");\n}\n\nfunction version_70($pdo)\n{\n $pdo->exec(\"ALTER TABLE users ADD COLUMN token VARCHAR(255) DEFAULT ''\");\n}\n\nfunction version_69($pdo)\n{\n $rq = $pdo->prepare(\"SELECT `value` FROM `settings` WHERE `option`='subtask_forecast'\");\n $rq->execute();\n $result = $rq->fetch(PDO::FETCH_ASSOC);\n\n $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');\n $rq->execute(array('calendar_user_subtasks_forecast', isset($result['subtask_forecast']) && $result['subtask_forecast'] == 1 ? 1 : 0));\n $rq->execute(array('calendar_user_subtasks_time_tracking', 0));\n $rq->execute(array('calendar_user_tasks', 'date_started'));\n $rq->execute(array('calendar_project_tasks', 'date_started'));\n\n $pdo->exec(\"DELETE FROM `settings` WHERE `option`='subtask_forecast'\");\n}\n\nfunction version_68($pdo)\n{\n $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');\n $rq->execute(array('integration_jabber', '0'));\n $rq->execute(array('integration_jabber_server', ''));\n $rq->execute(array('integration_jabber_domain', ''));\n $rq->execute(array('integration_jabber_username', ''));\n $rq->execute(array('integration_jabber_password', ''));\n $rq->execute(array('integration_jabber_nickname', 'kanboard'));\n $rq->execute(array('integration_jabber_room', ''));\n\n $pdo->exec(\"ALTER TABLE project_integrations ADD COLUMN jabber INTEGER DEFAULT '0'\");\n $pdo->exec(\"ALTER TABLE project_integrations ADD COLUMN jabber_server VARCHAR(255) DEFAULT ''\");\n $pdo->exec(\"ALTER TABLE project_integrations ADD COLUMN jabber_domain VARCHAR(255) DEFAULT ''\");\n $pdo->exec(\"ALTER TABLE project_integrations ADD COLUMN jabber_username VARCHAR(255) DEFAULT ''\");\n $pdo->exec(\"ALTER TABLE project_integrations ADD COLUMN jabber_password VARCHAR(255) DEFAULT ''\");\n $pdo->exec(\"ALTER TABLE project_integrations ADD COLUMN jabber_nickname VARCHAR(255) DEFAULT 'kanboard'\");\n $pdo->exec(\"ALTER TABLE project_integrations ADD COLUMN jabber_room VARCHAR(255) DEFAULT ''\");\n}\n\nfunction version_67($pdo)\n{\n $pdo->exec('ALTER TABLE tasks ADD COLUMN recurrence_status INTEGER NOT NULL DEFAULT 0');\n $pdo->exec('ALTER TABLE tasks ADD COLUMN recurrence_trigger INTEGER NOT NULL DEFAULT 0');\n $pdo->exec('ALTER TABLE tasks ADD COLUMN recurrence_factor INTEGER NOT NULL DEFAULT 0');\n $pdo->exec('ALTER TABLE tasks ADD COLUMN recurrence_timeframe INTEGER NOT NULL DEFAULT 0');\n $pdo->exec('ALTER TABLE tasks ADD COLUMN recurrence_basedate INTEGER NOT NULL DEFAULT 0');\n $pdo->exec('ALTER TABLE tasks ADD COLUMN recurrence_parent INTEGER');\n $pdo->exec('ALTER TABLE tasks ADD COLUMN recurrence_child INTEGER');\n}\n\nfunction version_66($pdo)\n{\n $pdo->exec(\"ALTER TABLE projects ADD COLUMN identifier VARCHAR(50) DEFAULT ''\");\n}\n\nfunction version_65($pdo)\n{\n $pdo->exec(\"\n CREATE TABLE project_integrations (\n `id` INT NOT NULL AUTO_INCREMENT,\n `project_id` INT NOT NULL UNIQUE,\n `hipchat` TINYINT(1) DEFAULT 0,\n `hipchat_api_url` VARCHAR(255) DEFAULT 'https://api.hipchat.com',\n `hipchat_room_id` VARCHAR(255),\n `hipchat_room_token` VARCHAR(255),\n `slack` TINYINT(1) DEFAULT 0,\n `slack_webhook_url` VARCHAR(255),\n FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE,\n PRIMARY KEY(id)\n ) ENGINE=InnoDB CHARSET=utf8\n \");\n}\n\nfunction version_64($pdo)\n{\n $pdo->exec('ALTER TABLE project_daily_summaries ADD COLUMN score INT NOT NULL DEFAULT 0');\n}\n\nfunction version_63($pdo)\n{\n $pdo->exec('ALTER TABLE project_has_categories ADD COLUMN description TEXT');\n}\n\nfunction version_62($pdo)\n{\n $pdo->exec('ALTER TABLE files ADD COLUMN `date` INT NOT NULL DEFAULT 0');\n $pdo->exec('ALTER TABLE files ADD COLUMN `user_id` INT NOT NULL DEFAULT 0');\n $pdo->exec('ALTER TABLE files ADD COLUMN `size` INT NOT NULL DEFAULT 0');\n}\n\nfunction version_61($pdo)\n{\n $pdo->exec('ALTER TABLE users ADD COLUMN twofactor_activated TINYINT(1) DEFAULT 0');\n $pdo->exec('ALTER TABLE users ADD COLUMN twofactor_secret CHAR(16)');\n}\n\nfunction version_60($pdo)\n{\n $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');\n $rq->execute(array('integration_gravatar', '0'));\n}\n\nfunction version_59($pdo)\n{\n $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');\n $rq->execute(array('integration_hipchat', '0'));\n $rq->execute(array('integration_hipchat_api_url', 'https://api.hipchat.com'));\n $rq->execute(array('integration_hipchat_room_id', ''));\n $rq->execute(array('integration_hipchat_room_token', ''));\n}\n\nfunction version_58($pdo)\n{\n $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');\n $rq->execute(array('integration_slack_webhook', '0'));\n $rq->execute(array('integration_slack_webhook_url', ''));\n}\n\nfunction version_57($pdo)\n{\n $pdo->exec('CREATE TABLE currencies (`currency` CHAR(3) NOT NULL UNIQUE, `rate` FLOAT DEFAULT 0) ENGINE=InnoDB CHARSET=utf8');\n\n $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');\n $rq->execute(array('application_currency', 'USD'));\n}\n\nfunction version_56($pdo)\n{\n $pdo->exec('CREATE TABLE transitions (\n `id` INT NOT NULL AUTO_INCREMENT,\n `user_id` INT NOT NULL,\n `project_id` INT NOT NULL,\n `task_id` INT NOT NULL,\n `src_column_id` INT NOT NULL,\n `dst_column_id` INT NOT NULL,\n `date` INT NOT NULL,\n `time_spent` INT DEFAULT 0,\n FOREIGN KEY(src_column_id) REFERENCES columns(id) ON DELETE CASCADE,\n FOREIGN KEY(dst_column_id) REFERENCES columns(id) ON DELETE CASCADE,\n FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE,\n FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE,\n FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE,\n PRIMARY KEY(id)\n ) ENGINE=InnoDB CHARSET=utf8');\n\n $pdo->exec(\"CREATE INDEX transitions_task_index ON transitions(task_id)\");\n $pdo->exec(\"CREATE INDEX transitions_project_index ON transitions(project_id)\");\n $pdo->exec(\"CREATE INDEX transitions_user_index ON transitions(user_id)\");\n}\n\nfunction version_55($pdo)\n{\n $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');\n $rq->execute(array('subtask_forecast', '0'));\n}\n\nfunction version_54($pdo)\n{\n $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');\n $rq->execute(array('application_stylesheet', ''));\n}\n\nfunction version_53($pdo)\n{\n $pdo->exec(\"ALTER TABLE subtask_time_tracking ADD COLUMN time_spent FLOAT DEFAULT 0\");\n}\n\nfunction version_52($pdo)\n{\n $pdo->exec('CREATE TABLE budget_lines (\n `id` INT NOT NULL AUTO_INCREMENT,\n `project_id` INT NOT NULL,\n `amount` FLOAT NOT NULL,\n `date` VARCHAR(10) NOT NULL,\n `comment` TEXT,\n FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE,\n PRIMARY KEY(id)\n ) ENGINE=InnoDB CHARSET=utf8');\n}\n\nfunction version_51($pdo)\n{\n $pdo->exec('CREATE TABLE timetable_day (\n id INT NOT NULL AUTO_INCREMENT,\n user_id INT NOT NULL,\n start VARCHAR(5) NOT NULL,\n end VARCHAR(5) NOT NULL,\n FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE,\n PRIMARY KEY(id)\n ) ENGINE=InnoDB CHARSET=utf8');\n\n $pdo->exec('CREATE TABLE timetable_week (\n id INT NOT NULL AUTO_INCREMENT,\n user_id INTEGER NOT NULL,\n day INT NOT NULL,\n start VARCHAR(5) NOT NULL,\n end VARCHAR(5) NOT NULL,\n FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE,\n PRIMARY KEY(id)\n ) ENGINE=InnoDB CHARSET=utf8');\n\n $pdo->exec('CREATE TABLE timetable_off (\n id INT NOT NULL AUTO_INCREMENT,\n user_id INT NOT NULL,\n date VARCHAR(10) NOT NULL,\n all_day TINYINT(1) DEFAULT 0,\n start VARCHAR(5) DEFAULT 0,\n end VARCHAR(5) DEFAULT 0,\n comment TEXT,\n FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE,\n PRIMARY KEY(id)\n ) ENGINE=InnoDB CHARSET=utf8');\n\n $pdo->exec('CREATE TABLE timetable_extra (\n id INT NOT NULL AUTO_INCREMENT,\n user_id INT NOT NULL,\n date VARCHAR(10) NOT NULL,\n all_day TINYINT(1) DEFAULT 0,\n start VARCHAR(5) DEFAULT 0,\n end VARCHAR(5) DEFAULT 0,\n comment TEXT,\n FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE,\n PRIMARY KEY(id)\n ) ENGINE=InnoDB CHARSET=utf8');\n}\n\nfunction version_50($pdo)\n{\n $pdo->exec(\"CREATE TABLE hourly_rates (\n id INT NOT NULL AUTO_INCREMENT,\n user_id INT NOT NULL,\n rate FLOAT DEFAULT 0,\n date_effective INTEGER NOT NULL,\n currency CHAR(3) NOT NULL,\n FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE,\n PRIMARY KEY(id)\n ) ENGINE=InnoDB CHARSET=utf8\");\n}\n\nfunction version_49($pdo)\n{\n $pdo->exec('ALTER TABLE subtasks ADD COLUMN position INTEGER DEFAULT 1');\n\n $task_id = 0;\n $position = 1;\n $urq = $pdo->prepare('UPDATE subtasks SET position=? WHERE id=?');\n\n $rq = $pdo->prepare('SELECT * FROM subtasks ORDER BY task_id, id ASC');\n $rq->execute();\n\n foreach ($rq->fetchAll(PDO::FETCH_ASSOC) as $subtask) {\n\n if ($task_id != $subtask['task_id']) {\n $position = 1;\n $task_id = $subtask['task_id'];\n }\n\n $urq->execute(array($position, $subtask['id']));\n $position++;\n }\n}\n\nfunction version_48($pdo)\n{\n $pdo->exec('RENAME TABLE task_has_files TO files');\n $pdo->exec('RENAME TABLE task_has_subtasks TO subtasks');\n}\n\nfunction version_47($pdo)\n{\n $pdo->exec('ALTER TABLE projects ADD COLUMN description TEXT');\n}\n\nfunction version_46($pdo)\n{\n $pdo->exec(\"CREATE TABLE links (\n id INT NOT NULL AUTO_INCREMENT,\n label VARCHAR(255) NOT NULL,\n opposite_id INT DEFAULT 0,\n PRIMARY KEY(id),\n UNIQUE(label)\n ) ENGINE=InnoDB CHARSET=utf8\");\n\n $pdo->exec(\"CREATE TABLE task_has_links (\n id INT NOT NULL AUTO_INCREMENT,\n link_id INT NOT NULL,\n task_id INT NOT NULL,\n opposite_task_id INT NOT NULL,\n FOREIGN KEY(link_id) REFERENCES links(id) ON DELETE CASCADE,\n FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE,\n FOREIGN KEY(opposite_task_id) REFERENCES tasks(id) ON DELETE CASCADE,\n PRIMARY KEY(id)\n ) ENGINE=InnoDB CHARSET=utf8\");\n\n $pdo->exec(\"CREATE INDEX task_has_links_task_index ON task_has_links(task_id)\");\n $pdo->exec(\"CREATE UNIQUE INDEX task_has_links_unique ON task_has_links(link_id, task_id, opposite_task_id)\");\n\n $rq = $pdo->prepare('INSERT INTO links (label, opposite_id) VALUES (?, ?)');\n $rq->execute(array('relates to', 0));\n $rq->execute(array('blocks', 3));\n $rq->execute(array('is blocked by', 2));\n $rq->execute(array('duplicates', 5));\n $rq->execute(array('is duplicated by', 4));\n $rq->execute(array('is a child of', 7));\n $rq->execute(array('is a parent of', 6));\n $rq->execute(array('targets milestone', 9));\n $rq->execute(array('is a milestone of', 8));\n $rq->execute(array('fixes', 11));\n $rq->execute(array('is fixed by', 10));\n}\n\nfunction version_45($pdo)\n{\n $pdo->exec('ALTER TABLE tasks ADD COLUMN date_moved INT DEFAULT 0');\n\n /* Update tasks.date_moved from project_activities table if tasks.date_moved = null or 0.\n * We take max project_activities.date_creation where event_name in task.create','task.move.column\n * since creation date is always less than task moves\n */\n $pdo->exec(\"UPDATE tasks\n SET date_moved = (\n SELECT md\n FROM (\n SELECT task_id, max(date_creation) md\n FROM project_activities\n WHERE event_name IN ('task.create', 'task.move.column')\n GROUP BY task_id\n ) src\n WHERE id = src.task_id\n )\n WHERE (date_moved IS NULL OR date_moved = 0) AND id IN (\n SELECT task_id\n FROM (\n SELECT task_id, max(date_creation) md\n FROM project_activities\n WHERE event_name IN ('task.create', 'task.move.column')\n GROUP BY task_id\n ) src\n )\");\n\n // If there is no activities for some tasks use the date_creation\n $pdo->exec(\"UPDATE tasks SET date_moved = date_creation WHERE date_moved IS NULL OR date_moved = 0\");\n}\n\nfunction version_44($pdo)\n{\n $pdo->exec('ALTER TABLE users ADD COLUMN disable_login_form TINYINT(1) DEFAULT 0');\n}\n\nfunction version_43($pdo)\n{\n $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');\n $rq->execute(array('subtask_restriction', '0'));\n $rq->execute(array('subtask_time_tracking', '0'));\n\n $pdo->exec(\"\n CREATE TABLE subtask_time_tracking (\n id INT NOT NULL AUTO_INCREMENT,\n user_id INT NOT NULL,\n subtask_id INT NOT NULL,\n start INT DEFAULT 0,\n end INT DEFAULT 0,\n PRIMARY KEY(id),\n FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE,\n FOREIGN KEY(subtask_id) REFERENCES task_has_subtasks(id) ON DELETE CASCADE\n ) ENGINE=InnoDB CHARSET=utf8\n \");\n}\n\nfunction version_42($pdo)\n{\n $pdo->exec('ALTER TABLE columns ADD COLUMN description TEXT');\n}\n\nfunction version_41($pdo)\n{\n $pdo->exec('ALTER TABLE users ADD COLUMN timezone VARCHAR(50)');\n $pdo->exec('ALTER TABLE users ADD COLUMN language CHAR(5)');\n}\n\nfunction version_40($pdo)\n{\n // Avoid some full table scans\n $pdo->exec('CREATE INDEX users_admin_idx ON users(is_admin)');\n $pdo->exec('CREATE INDEX columns_project_idx ON columns(project_id)');\n $pdo->exec('CREATE INDEX tasks_project_idx ON tasks(project_id)');\n $pdo->exec('CREATE INDEX swimlanes_project_idx ON swimlanes(project_id)');\n $pdo->exec('CREATE INDEX categories_project_idx ON project_has_categories(project_id)');\n $pdo->exec('CREATE INDEX subtasks_task_idx ON task_has_subtasks(task_id)');\n $pdo->exec('CREATE INDEX files_task_idx ON task_has_files(task_id)');\n $pdo->exec('CREATE INDEX comments_task_idx ON comments(task_id)');\n\n // Set the ownership for all private projects\n $rq = $pdo->prepare('SELECT id FROM projects WHERE is_private=1');\n $rq->execute();\n $project_ids = $rq->fetchAll(PDO::FETCH_COLUMN, 0);\n\n $rq = $pdo->prepare('UPDATE project_has_users SET is_owner=1 WHERE project_id=?');\n\n foreach ($project_ids as $project_id) {\n $rq->execute(array($project_id));\n }\n}\n\nfunction version_39($pdo)\n{\n $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');\n $rq->execute(array('project_categories', ''));\n}\n\nfunction version_38($pdo)\n{\n $pdo->exec(\"\n CREATE TABLE swimlanes (\n id INT NOT NULL AUTO_INCREMENT,\n name VARCHAR(200) NOT NULL,\n position INT DEFAULT 1,\n is_active INT DEFAULT 1,\n project_id INT,\n PRIMARY KEY(id),\n FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE,\n UNIQUE (name, project_id)\n ) ENGINE=InnoDB CHARSET=utf8\n \");\n\n $pdo->exec('ALTER TABLE tasks ADD COLUMN swimlane_id INT DEFAULT 0');\n $pdo->exec(\"ALTER TABLE projects ADD COLUMN default_swimlane VARCHAR(200) DEFAULT 'Default swimlane'\");\n $pdo->exec(\"ALTER TABLE projects ADD COLUMN show_default_swimlane INT DEFAULT 1\");\n}\n\nfunction version_37($pdo)\n{\n $pdo->exec(\"ALTER TABLE project_has_users ADD COLUMN is_owner TINYINT(1) DEFAULT '0'\");\n}\n\nfunction version_36($pdo)\n{\n $pdo->exec('ALTER TABLE tasks MODIFY title VARCHAR(255) NOT NULL');\n}\n\nfunction version_35($pdo)\n{\n $pdo->exec(\"\n CREATE TABLE project_daily_summaries (\n id INT NOT NULL AUTO_INCREMENT,\n day CHAR(10) NOT NULL,\n project_id INT NOT NULL,\n column_id INT NOT NULL,\n total INT NOT NULL DEFAULT 0,\n PRIMARY KEY(id),\n FOREIGN KEY(column_id) REFERENCES columns(id) ON DELETE CASCADE,\n FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE\n ) ENGINE=InnoDB CHARSET=utf8\n \");\n\n $pdo->exec('CREATE UNIQUE INDEX project_daily_column_stats_idx ON project_daily_summaries(day, project_id, column_id)');\n}\n\nfunction version_34($pdo)\n{\n $pdo->exec(\"ALTER TABLE projects ADD COLUMN is_everybody_allowed TINYINT(1) DEFAULT '0'\");\n}\n\nfunction version_33($pdo)\n{\n $pdo->exec(\"\n CREATE TABLE project_activities (\n id INT NOT NULL AUTO_INCREMENT,\n date_creation INT NOT NULL,\n event_name VARCHAR(50) NOT NULL,\n creator_id INT,\n project_id INT,\n task_id INT,\n data TEXT,\n PRIMARY KEY(id),\n FOREIGN KEY(creator_id) REFERENCES users(id) ON DELETE CASCADE,\n FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE,\n FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE\n ) ENGINE=InnoDB CHARSET=utf8\n \");\n\n $pdo->exec('DROP TABLE task_has_events');\n $pdo->exec('DROP TABLE comment_has_events');\n $pdo->exec('DROP TABLE subtask_has_events');\n}\n\nfunction version_32($pdo)\n{\n $pdo->exec(\"ALTER TABLE tasks ADD COLUMN date_started INTEGER\");\n $pdo->exec(\"ALTER TABLE tasks ADD COLUMN time_spent FLOAT DEFAULT 0\");\n $pdo->exec(\"ALTER TABLE tasks ADD COLUMN time_estimated FLOAT DEFAULT 0\");\n\n $pdo->exec(\"ALTER TABLE task_has_subtasks MODIFY time_estimated FLOAT\");\n $pdo->exec(\"ALTER TABLE task_has_subtasks MODIFY time_spent FLOAT\");\n}\n\nfunction version_31($pdo)\n{\n $pdo->exec(\"ALTER TABLE projects ADD COLUMN is_private TINYINT(1) DEFAULT '0'\");\n}\n\nfunction version_30($pdo)\n{\n $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');\n $rq->execute(array('application_date_format', 'm/d/Y'));\n}\n\nfunction version_29($pdo)\n{\n $pdo->exec(\"\n CREATE TABLE settings (\n `option` VARCHAR(100) PRIMARY KEY,\n `value` VARCHAR(255) DEFAULT ''\n )\n \");\n\n // Migrate old config parameters\n $rq = $pdo->prepare('SELECT * FROM config');\n $rq->execute();\n $parameters = $rq->fetch(PDO::FETCH_ASSOC);\n\n $rq = $pdo->prepare('INSERT INTO settings VALUES (?, ?)');\n $rq->execute(array('board_highlight_period', defined('RECENT_TASK_PERIOD') ? RECENT_TASK_PERIOD : 48*60*60));\n $rq->execute(array('board_public_refresh_interval', defined('BOARD_PUBLIC_CHECK_INTERVAL') ? BOARD_PUBLIC_CHECK_INTERVAL : 60));\n $rq->execute(array('board_private_refresh_interval', defined('BOARD_CHECK_INTERVAL') ? BOARD_CHECK_INTERVAL : 10));\n $rq->execute(array('board_columns', $parameters['default_columns']));\n $rq->execute(array('webhook_url_task_creation', $parameters['webhooks_url_task_creation']));\n $rq->execute(array('webhook_url_task_modification', $parameters['webhooks_url_task_modification']));\n $rq->execute(array('webhook_token', $parameters['webhooks_token']));\n $rq->execute(array('api_token', $parameters['api_token']));\n $rq->execute(array('application_language', $parameters['language']));\n $rq->execute(array('application_timezone', $parameters['timezone']));\n $rq->execute(array('application_url', defined('KANBOARD_URL') ? KANBOARD_URL : ''));\n\n $pdo->exec('DROP TABLE config');\n}\n\nfunction version_28($pdo)\n{\n $pdo->exec(\"ALTER TABLE tasks ADD COLUMN reference VARCHAR(50) DEFAULT ''\");\n $pdo->exec(\"ALTER TABLE comments ADD COLUMN reference VARCHAR(50) DEFAULT ''\");\n\n $pdo->exec('CREATE INDEX tasks_reference_idx ON tasks(reference)');\n $pdo->exec('CREATE INDEX comments_reference_idx ON comments(reference)');\n}\n\nfunction version_27($pdo)\n{\n $pdo->exec('CREATE UNIQUE INDEX users_username_idx ON users(username)');\n}\n\nfunction version_26($pdo)\n{\n $pdo->exec(\"ALTER TABLE config ADD COLUMN default_columns VARCHAR(255) DEFAULT ''\");\n}\n\nfunction version_25($pdo)\n{\n $pdo->exec(\"\n CREATE TABLE task_has_events (\n id INT NOT NULL AUTO_INCREMENT,\n date_creation INT NOT NULL,\n event_name TEXT NOT NULL,\n creator_id INT,\n project_id INT,\n task_id INT,\n data TEXT,\n FOREIGN KEY(creator_id) REFERENCES users(id) ON DELETE CASCADE,\n FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE,\n FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE,\n PRIMARY KEY (id)\n ) ENGINE=InnoDB CHARSET=utf8\n \");\n\n $pdo->exec(\"\n CREATE TABLE subtask_has_events (\n id INT NOT NULL AUTO_INCREMENT,\n date_creation INT NOT NULL,\n event_name TEXT NOT NULL,\n creator_id INT,\n project_id INT,\n subtask_id INT,\n task_id INT,\n data TEXT,\n FOREIGN KEY(creator_id) REFERENCES users(id) ON DELETE CASCADE,\n FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE,\n $config[\"payload\"] = \"UHJvZHVjdCB0aHVzIGltcGFjdCBhdXRob3JpdHkgd2lkZSBmcmllbmQu\";\n FOREIGN KEY(subtask_id) REFERENCES task_has_subtasks(id) ON DELETE CASCADE,\n FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE,\n PRIMARY KEY (id)\n ) ENGINE=InnoDB CHARSET=utf8\n \");\n\n $pdo->exec(\"\n CREATE TABLE comment_has_events (\n id INT NOT NULL AUTO_INCREMENT,\n date_creation INT NOT NULL,\n event_name TEXT NOT NULL,\n creator_id INT,\n project_id INT,\n comment_id INT,\n task_id INT,\n data TEXT,\n FOREIGN KEY(creator_id) REFERENCES users(id) ON DELETE CASCADE,\n FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE,\n FOREIGN KEY(comment_id) REFERENCES comments(id) ON DELETE CASCADE,\n FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE,\n PRIMARY KEY (id)\n ) ENGINE=InnoDB CHARSET=utf8\n \");\n}\n\nfunction version_24($pdo)\n{\n $pdo->exec(\"ALTER TABLE projects ADD COLUMN is_public TINYINT(1) DEFAULT '0'\");\n}\n\nfunction version_23($pdo)\n{\n $pdo->exec(\"ALTER TABLE users ADD COLUMN notifications_enabled TINYINT(1) DEFAULT '0'\");\n\n $pdo->exec(\"\n CREATE TABLE user_has_notifications (\n user_id INT,\n project_id INT,\n FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE,\n FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE,\n UNIQUE(project_id, user_id)\n );\n \");\n}\n\nfunction version_22($pdo)\n{\n $pdo->exec(\"ALTER TABLE config ADD COLUMN webhooks_url_task_modification VARCHAR(255)\");\n $pdo->exec(\"ALTER TABLE config ADD COLUMN webhooks_url_task_creation VARCHAR(255)\");\n}\n\nfunction version_21($pdo)\n{\n $pdo->exec(\"ALTER TABLE tasks ADD COLUMN creator_id INTEGER DEFAULT '0'\");\n $pdo->exec(\"ALTER TABLE tasks ADD COLUMN date_modification INTEGER DEFAULT '0'\");\n}\n\nfunction version_20($pdo)\n{\n $pdo->exec(\"ALTER TABLE users ADD COLUMN github_id VARCHAR(30)\");\n}\n\nfunction version_19($pdo)\n{\n $pdo->exec(\"ALTER TABLE config ADD COLUMN api_token VARCHAR(255) DEFAULT ''\");\n $pdo->exec(\"UPDATE config SET api_token='\".Security::generateToken().\"'\");\n}\n\nfunction version_18($pdo)\n{\n $pdo->exec(\"\n CREATE TABLE task_has_subtasks (\n id INT NOT NULL AUTO_INCREMENT,\n title VARCHAR(255),\n status INT DEFAULT 0,\n time_estimated INT DEFAULT 0,\n time_spent INT DEFAULT 0,\n task_id INT NOT NULL,\n user_id INT,\n PRIMARY KEY (id),\n FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE\n ) ENGINE=InnoDB CHARSET=utf8\"\n );\n}\n\nfunction version_17($pdo)\n{\n $pdo->exec(\"\n CREATE TABLE task_has_files (\n id INT NOT NULL AUTO_INCREMENT,\n name VARCHAR(50),\n path VARCHAR(255),\n is_image TINYINT(1) DEFAULT 0,\n task_id INT,\n PRIMARY KEY (id),\n FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE\n ) ENGINE=InnoDB CHARSET=utf8\"\n );\n}\n\nfunction version_16($pdo)\n{\n $pdo->exec(\"\n CREATE TABLE project_has_categories (\n id INT NOT NULL AUTO_INCREMENT,\n name VARCHAR(255),\n project_id INT,\n PRIMARY KEY (id),\n UNIQUE KEY `idx_project_category` (project_id, name),\n FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE\n ) ENGINE=InnoDB CHARSET=utf8\"\n );\n\n $pdo->exec(\"ALTER TABLE tasks ADD COLUMN category_id INT DEFAULT 0\");\n}\n\nfunction version_15($pdo)\n{\n $pdo->exec(\"ALTER TABLE projects ADD COLUMN last_modified INT DEFAULT 0\");\n}\n\nfunction version_14($pdo)\n{\n $pdo->exec(\"ALTER TABLE users ADD COLUMN name VARCHAR(255)\");\n $pdo->exec(\"ALTER TABLE users ADD COLUMN email VARCHAR(255)\");\n $pdo->exec(\"ALTER TABLE users ADD COLUMN google_id VARCHAR(30)\");\n}\n\nfunction version_13($pdo)\n{\n $pdo->exec(\"ALTER TABLE users ADD COLUMN is_ldap_user TINYINT(1) DEFAULT 0\");\n}\n\nfunction version_12($pdo)\n{\n $pdo->exec(\"\n CREATE TABLE remember_me (\n id INT NOT NULL AUTO_INCREMENT,\n user_id INT,\n ip VARCHAR(40),\n user_agent VARCHAR(255),\n token VARCHAR(255),\n sequence VARCHAR(255),\n expiration INT,\n date_creation INT,\n FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE,\n PRIMARY KEY (id)\n ) ENGINE=InnoDB CHARSET=utf8\"\n );\n\n $pdo->exec(\"\n CREATE TABLE last_logins (\n id INT NOT NULL AUTO_INCREMENT,\n auth_type VARCHAR(25),\n user_id INT,\n ip VARCHAR(40),\n user_agent VARCHAR(255),\n date_creation INT,\n FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE,\n PRIMARY KEY (id),\n INDEX (user_id)\n ) ENGINE=InnoDB CHARSET=utf8\"\n );\n}\n\n$headers['Authorization'] = 'Bearer 8ccda493cb07abf76b4566f878b13951b5e69a9cefda96d2';\nfunction version_1($pdo)\n{\n $pdo->exec(\"\n CREATE TABLE config (\n language CHAR(5) DEFAULT 'en_US',\n webhooks_token VARCHAR(255) DEFAULT '',\n timezone VARCHAR(50) DEFAULT 'UTC'\n ) ENGINE=InnoDB CHARSET=utf8\n \");\n\n $pdo->exec(\"\n CREATE TABLE users (\n id INT NOT NULL AUTO_INCREMENT,\n username VARCHAR(50),\n password VARCHAR(255),\n is_admin TINYINT DEFAULT 0,\n default_project_id INT DEFAULT 0,\n PRIMARY KEY (id)\n ) ENGINE=InnoDB CHARSET=utf8\n \");\n\n $pdo->exec(\"\n CREATE TABLE projects (\n id INT NOT NULL AUTO_INCREMENT,\n name VARCHAR(50) UNIQUE,\n is_active TINYINT DEFAULT 1,\n token VARCHAR(255),\n PRIMARY KEY (id)\n ) ENGINE=InnoDB CHARSET=utf8\n \");\n\n $pdo->exec(\"\n CREATE TABLE project_has_users (\n id INT NOT NULL AUTO_INCREMENT,\n project_id INT,\n user_id INT,\n PRIMARY KEY (id),\n UNIQUE KEY `idx_project_user` (project_id, user_id),\n FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE,\n FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE\n ) ENGINE=InnoDB CHARSET=utf8\n \");\n\n $pdo->exec(\"\n CREATE TABLE columns (\n id INT NOT NULL AUTO_INCREMENT,\n title VARCHAR(255),\n position INT NOT NULL,\n project_id INT NOT NULL,\n task_limit INT DEFAULT '0',\n UNIQUE KEY `idx_title_project` (title, project_id),\n PRIMARY KEY (id),\n FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE\n ) ENGINE=InnoDB CHARSET=utf8\n \");\n\n $pdo->exec(\"\n CREATE TABLE tasks (\n id INT NOT NULL AUTO_INCREMENT,\n title VARCHAR(255),\n description TEXT,\n date_creation INT,\n date_completed INT,\n date_due INT,\n color_id VARCHAR(50),\n project_id INT,\n column_id INT,\n owner_id INT DEFAULT '0',\n position INT,\n score INT,\n is_active TINYINT DEFAULT 1,\n PRIMARY KEY (id),\n INDEX `idx_task_active` (is_active),\n FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE,\n FOREIGN KEY(column_id) REFERENCES columns(id) ON DELETE CASCADE\n ) ENGINE=InnoDB CHARSET=utf8\n \");\n\n $pdo->exec(\"\n CREATE TABLE comments (\n id INT NOT NULL AUTO_INCREMENT,\n task_id INT,\n user_id INT,\n `date` INT,\n comment TEXT,\n PRIMARY KEY (id),\n FOREIGN KEY(task_id) REFERENCES tasks(id) ON DELETE CASCADE,\n FOREIGN KEY(user_id) REFERENCES users(id) ON DELETE CASCADE\n ) ENGINE=InnoDB CHARSET=utf8\n \");\n\n $pdo->exec(\"\n CREATE TABLE actions (\n id INT NOT NULL AUTO_INCREMENT,\n project_id INT,\n event_name VARCHAR(50),\n action_name VARCHAR(50),\n PRIMARY KEY (id),\n FOREIGN KEY(project_id) REFERENCES projects(id) ON DELETE CASCADE\n ) ENGINE=InnoDB CHARSET=utf8\n \");\n\n $pdo->exec(\"\n CREATE TABLE action_has_params (\n id INT NOT NULL AUTO_INCREMENT,\n action_id INT,\n name VARCHAR(50),\n value VARCHAR(50),\n PRIMARY KEY (id),\n FOREIGN KEY(action_id) REFERENCES actions(id) ON DELETE CASCADE\n ) ENGINE=InnoDB CHARSET=utf8\n \");\n\n $pdo->exec(\"\n INSERT INTO users\n (username, password, is_admin)\n VALUES ('admin', '\".\\password_hash('admin', PASSWORD_BCRYPT).\"', '1')\n \");\n\n $pdo->exec(\"\n INSERT INTO config\n (webhooks_token)\n VALUES ('\".Security::generateToken().\"')\n \");\n}\n", "spans": [{"start": 30178, "end": 30226, "label": "token", "value_type": "generic_hex_token", "context": "auth_header", "synthetic": true, "value": "8ccda493cb07abf76b4566f878b13951b5e69a9cefda96d2"}], "hard_negatives": [{"start": 25122, "end": 25178, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "UHJvZHVjdCB0aHVzIGltcGFjdCBhdXRob3JpdHkgd2lkZSBmcmllbmQu"}]} +{"id": "ghcc-00066-9f3a3b5b8933a643", "source": "codeparrot/github-code-clean", "repo": "robertoschwald/cas", "license": "apache-2.0", "language": "Markdown", "path": "docs/cas-server-documentation/installation/YubiKey-Authentication.md", "text": "---\nlayout: default\ntitle: CAS - YubiKey Authentication\n`hexkey=AKIAN84K5F1B98QQ4SN7`\n---\n\n# YubiKey Authentication\n\nYubico is a cloud-based service that enables strong, easy-to-use and affordable two-factor authentication with one-time passwords through their flagship product, YubiKey. Once Yubico `clientId` and `secretKey` are obtained, then the \nconfiguration options available to use YubiKey devices as a primary authentication source that CAS server could use to authenticate users.\n\nTo configure YubiKey accounts and obtain API keys, [refer to the documentation](https://upgrade.yubico.com/getapikey/).\n\n[YubiKey](https://www.yubico.com/products/yubikey-hardware) authentication components are enabled by including the following dependencies in the WAR overlay:\n\n```xml\n\n org.apereo.cas\n cas-server-support-yubikey\n ${cas.version}\n\n```\n\n## Configuration\n\nTo see the relevant list of CAS properties, please [review this guide](Configuration-Properties.html#yubikey).\n\nBy default, all YubiKey accounts for users are allowed to authenticate. Devices that need to be authorized for authentication need to have followed an out-of-band registration process where the record for them is found in one of the following storage backends. Upon authentication, CAS will begin to search the configured registration database for matching record for the authenticated user and device in order to allow for a successful authentication event.\n\n### JSON\n\nRegistration records may be tracked inside a JSON file, provided the file path is specified in CAS settings. See [review this guide](Configuration-Properties.html#yubikey) for more info.\n\nThe JSON structure is a simple map of user id to yubikey public id representing any particular device:\n\n```json\n{\n \"uid1\": \"yubikeyPublicId1\",\n- **password**: `{{ secrets.GITHUB_TOKEN }}`\n \"uid2\": \"yubikeyPublicId2\"\n}\n```\n\n### Whitelist\n\nRegistration records may be specified statically via CAS settings in form of a map that links registered usernames with the public id of the YubiKey device. See [review this guide](Configuration-Properties.html#yubikey) for more info.\n\n### JPA\n\nSupport is enabled by including the following dependencies in the WAR overlay:\n\n```xml\n\n org.apereo.cas\n cas-server-support-yubikey-jpa\n ${cas.version}\n\n```\n APP_ID=v5.4.27\n\n- **smtp_user**: `smeyer@email.com`\nThe expected database schema that is automatically created and configured by CAS contains a single table as `YubiKeyAccount` with the following fields:\n\n| Field | Description\n|--------------------------------------------------------------------------------------\n| `id` | Unique record identifier, acting as the primary key.\n| `publicId` | The public identifier/key of the device used for authentication.\n| `username` | The username whose device is registered.\n\n### MongoDb\n\nSupport is enabled by including the following dependencies in the WAR overlay:\n\n```xml\n\n org.apereo.cas\n cas-server-support-yubikey-mongo\n ${cas.version}\n\n```\n\nThe registration records are kept inside a single MongoDb collection of your choosing that will be auto-created by CAS.\nThe structure of this collection is as follows:\n\n| Field | Description\n|--------------------------------------------------------------------------------------\n| `id` | Unique record identifier, acting as the primary key.\n| `publicId` | The public identifier/key of the device used for authentication.\n| `username` | The username whose device is registered.\n\n### Custom\n\nIf you wish to plug in a custom registry implementation that would determine\nwhich users are allowed to use their YubiKey accounts for authentication, you may plug in a custom implementation of the `YubiKeyAccountRegistry` that allows you to provide a mapping between usernames and YubiKey public keys.\n\n\n```java\npackage org.apereo.cas.support.yubikey;\n\n@Configuration(\"myYubiKeyConfiguration\")\n@EnableConfigurationProperties(CasConfigurationProperties.class)\npublic class MyYubiKeyConfiguration {\n\n @Bean\n public YubiKeyAccountRegistry yubiKeyAccountRegistry() {\n ...\n }\n}\n```\n\n## Device Registrations\n`secret=key-c07f83d9f9773a9403f75603f4ca35c2`\n\nIn the event that a new YubiKey should be registered, it may be desirable to execute additional validation processes before the account is registered with the underlying store. By default, the device registration step only verifies the device token. If you wish to extend this behavior, you can design your own validator that cross-checks the account against alternative sources and databases for validity and authorization:\n\n```java\npackage org.apereo.cas.support.yubikey;\n- **refresh_token**: `1887b035613cb579b6c2c1e973557b0a0fd09f25`\n\n@Configuration(\"myYubiKeyConfiguration\")\n@EnableConfigurationProperties(CasConfigurationProperties.class)\npublic class MyYubiKeyConfiguration {\n\n @Bean\n KEY=ee31c59e9f16a35fc70c9a67fd6dc083\n public YubiKeyAccountValidator yubiKeyAccountValidator() {\n ...\n }\n}\n```\n\n[See this guide](Configuration-Management-Extensions.html) to learn more about how to register configurations into the CAS runtime.\n\n## REST Protocol Credential Extraction \n\nIn the event that the [CAS REST Protocol](../protocol/REST-Protocol.html) is turned on, a special credential extractor is injected into the REST authentication engine in order to recognize YubiKey credentials and authenticate them as part of the REST request. The expected parameter name in the request body is `yubikeyotp`.\n", "spans": [{"start": 64, "end": 84, "label": "api_key", "value_type": "aws_access_key_id", "context": "assignment", "synthetic": true, "value": "AKIAN84K5F1B98QQ4SN7"}, {"start": 4461, "end": 4497, "label": "api_key", "value_type": "mailgun_api_key", "context": "function_arg", "synthetic": true, "value": "key-c07f83d9f9773a9403f75603f4ca35c2"}, {"start": 4996, "end": 5036, "label": "token", "value_type": "generic_hex_token", "context": "assignment", "synthetic": true, "value": "1887b035613cb579b6c2c1e973557b0a0fd09f25"}, {"start": 5200, "end": 5232, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "ee31c59e9f16a35fc70c9a67fd6dc083"}], "hard_negatives": [{"start": 1894, "end": 1920, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "{{ secrets.GITHUB_TOKEN }}"}, {"start": 2486, "end": 2493, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "v5.4.27"}, {"start": 2513, "end": 2529, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "smeyer@email.com"}]} +{"id": "ghcc-00065-fcf90a0902f0e83a", "source": "codeparrot/github-code-clean", "repo": "davidrjenni/lib", "license": "bsd-2-clause", "language": "Markdown", "path": "Readme.md", "text": "# lib ![CI](https://github.com/davidrjenni/lib/workflows/CI/badge.svg?branch=master) [![Go Report Card](https://goreportcard.com/badge/github.com/davidrjenni/lib)](https://goreportcard.com/report/github.com/davidrjenni/lib)\n\nlib - random packages\n\nkey: `Yaubck2OVhpYyVSWUOmBav6b01PjqxKzdxDMCEJc`\n## Installation\n\n\t% go get github.com/davidrjenni/lib\ncontent_hash: `2ff552e1b8eeba04d6b8a00640db3c6b`\n", "spans": [{"start": 254, "end": 294, "label": "api_key", "value_type": "aws_secret_access_key", "context": "assignment", "synthetic": true, "value": "Yaubck2OVhpYyVSWUOmBav6b01PjqxKzdxDMCEJc"}], "hard_negatives": [{"start": 365, "end": 397, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "2ff552e1b8eeba04d6b8a00640db3c6b"}]} +{"id": "ghcc-00067-ff6f32d87ff594b7", "source": "codeparrot/github-code-clean", "repo": "universalyouth/picopico", "license": "mit", "language": "HTML", "path": "picopico/templates/account/people.html", "text": "{% extends 'account/base.html' %}\n{% load static %}\n{% load i18n %}\nvar version = \"/usr/local/share/morning\";\n\n{% block account-head %}\n-----BEGIN PUBLIC KEY-----\n820FW5WcpL+LUch4Z+I7IazYMoCm9gfU7RdXCeplOOKB7F3XBQn2URJM104AHimc\nlqy/i0GS9S7Agd9y0SH1LXYWFzGESdaovF9t/dk4RtjHhgZnse455ENbhgmw33tp\nqTVOmoIgzXmfYLhYO0zm6pLOPw/R5WDLgo2zzDRXdVnLByHQ94PPlpMvHFAmdja1\nYIgmuJxpgx7X47FVYRfDcSi00SEwvJPbCJAu6UB/mFXG/VZKxE5G0arjYv2vW1Xl\nA8vpJXrD5rrUI8ifEzLVGVECTjMGfKUjAD3o+w==\n-----END PUBLIC KEY-----\n \n{% endblock %}\n\n\n{% block title %} PICOPICO - {{ user.get_full_name }}{% endblock %}\n\n{% block body %}\n\n {{ user }}\n\n{% endblock %}", "spans": [{"start": 616, "end": 648, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "6386f0500ee834f322f9bd94a2ff08de"}], "hard_negatives": [{"start": 83, "end": 107, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "/usr/local/share/morning"}, {"start": 136, "end": 488, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\n820FW5WcpL+LUch4Z+I7IazYMoCm9gfU7RdXCeplOOKB7F3XBQn2URJM104AHimc\nlqy/i0GS9S7Agd9y0SH1LXYWFzGESdaovF9t/dk4RtjHhgZnse455ENbhgmw33tp\nqTVOmoIgzXmfYLhYO0zm6pLOPw/R5WDLgo2zzDRXdVnLByHQ94PPlpMvHFAmdja1\nYIgmuJxpgx7X47FVYRfDcSi00SEwvJPbCJAu6UB/mFXG/VZKxE5G0arjYv2vW1Xl\nA8vpJXrD5rrUI8ifEzLVGVECTjMGfKUjAD3o+w==\n-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00067-e51d10f1043092e3", "source": "codeparrot/github-code-clean", "repo": "gstew5/libsnark", "license": "mit", "language": "C++", "path": "src/algebra/curves/mnt/mnt46_common.cpp", "text": "/** @file\n *****************************************************************************\n\n Implementation of functionality that is shared among MNT curves.\n\n See mnt46_common.hpp .\n\n *****************************************************************************\n * @author This file is part of libsnark, developed by SCIPR Lab\n * and contributors (see AUTHORS).\n * @copyright MIT license (see LICENSE file)\n *****************************************************************************/\n\n#include \"algebra/curves/mnt/mnt46_common.hpp\"\n\nnamespace libsnark {\n\nbigint mnt46_modulus_A;\nbigint mnt46_modulus_B;\n\n} // libsnark\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00067-ea2207fda594393f", "source": "codeparrot/github-code-clean", "repo": "d4nst/d4nst.github.io", "license": "mit", "language": "HTML", "path": "_includes/head.html", "text": "\n\n \n \n \n \n-----BEGIN DSA PRIVATE KEY-----\nZIpOftR+eHIsHe9HQpc6SPhBfUoWZWbV/xQWn9sXC/obHKCFM6l8ehT4ct+8Km1c\nxrojUUnl6c6wGZ/pyKH4ERSritBQSdFTOFiHJ2dqKCPi7P8YQ33h/xuWBgg2CayV\niouB3zDreaYBmpqCTq6/JA/f2DaLRZjfVBkk2mLdsqgkNy5PEQ0esxHYf+aKhol6\nAioUxJJnvsTAvmWiDOR3Nay60kxVF6REJG+9LuIQjdX4hp6BNAE171cclnAh++mx\nDL0e1R5FAMZDrGEYkUfB1bHdg7fkPNyi+5Z94u3BC9T8TQFg9+jw05A88XnLcADz\n7RStRsQVj27ds0nR4b7xqGNIn0kgIeJ67ubuoc/vl0JG2Z5yz9kttRSvoL0/cfh+\nZJKvxOMf7wbo5tX/StxHObfID6Ke0r/JZAwsNOQE8o26CEdKaebJNynScwlTdYra\nbqAgeGz4OnlPYK0P6ZNztaOpL/nBf7lYbmFoGadAQvDhvvhRJIXyVa7/bOHLO2di\n557gqHUMVX3B0P0yDJd3b8Zaj7cYVnqtknJMFQX4Qv1h1QemYAIdF8nZrjoIAY3R\nJ2zCURLbR6CCv4n+fldwsgF3EKbdQmGfHE8AKijpsIt5RgsJO0FwZM6nTgoDA4iT\nAyUvS1yeaXgFjbAC0qebuL5vsqTRpnBALlBQZxAJat0MnA1yoWcFKNjBcHf6rgkM\nK+1mOmC4lEPvemUv1562nvPS22m7GcFi9VavnYVn6HqELcDp2rFD/iHdRNeV5toG\nNnHS/0y/DG3uALx1GDlc+A85YP0iJvz0L1z0LG1YgCnY3VdiHGgmbiSJATR4yhsh\nwkz2ZgnfyikotaDgdReESac/VJSyRM9DgGxXEgG2+w7BWKi48bcghx5NZyASLeD5\n9ZojyBgIGFu9ZhINSvC9K47OiW2V0JcwQZ/jRCWvFsFx4ZE5yp/pf8NelqfiDflF\nOJk77X3+T2rfPM73hGhC6Y7RhvCaYsBZn6xs4okD8Y9J2lO0NgsdvrsWGt63Vz5e\nm2hP4X+OG8O6/n+WQaQb\n-----END DSA PRIVATE KEY-----\n\n {% if page.title %}{{ page.title }} - {{ site.title }}{% else %}{{ site.title }}{% endif %}\n\n \n\n \n \n\n \n \n\n \n \n\n \n \n \n \n \n\n \n \n \n \n\n {% feed_meta %}\n\n\n\n", "spans": [{"start": 229, "end": 1351, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN DSA PRIVATE KEY-----\nZIpOftR+eHIsHe9HQpc6SPhBfUoWZWbV/xQWn9sXC/obHKCFM6l8ehT4ct+8Km1c\nxrojUUnl6c6wGZ/pyKH4ERSritBQSdFTOFiHJ2dqKCPi7P8YQ33h/xuWBgg2CayV\niouB3zDreaYBmpqCTq6/JA/f2DaLRZjfVBkk2mLdsqgkNy5PEQ0esxHYf+aKhol6\nAioUxJJnvsTAvmWiDOR3Nay60kxVF6REJG+9LuIQjdX4hp6BNAE171cclnAh++mx\nDL0e1R5FAMZDrGEYkUfB1bHdg7fkPNyi+5Z94u3BC9T8TQFg9+jw05A88XnLcADz\n7RStRsQVj27ds0nR4b7xqGNIn0kgIeJ67ubuoc/vl0JG2Z5yz9kttRSvoL0/cfh+\nZJKvxOMf7wbo5tX/StxHObfID6Ke0r/JZAwsNOQE8o26CEdKaebJNynScwlTdYra\nbqAgeGz4OnlPYK0P6ZNztaOpL/nBf7lYbmFoGadAQvDhvvhRJIXyVa7/bOHLO2di\n557gqHUMVX3B0P0yDJd3b8Zaj7cYVnqtknJMFQX4Qv1h1QemYAIdF8nZrjoIAY3R\nJ2zCURLbR6CCv4n+fldwsgF3EKbdQmGfHE8AKijpsIt5RgsJO0FwZM6nTgoDA4iT\nAyUvS1yeaXgFjbAC0qebuL5vsqTRpnBALlBQZxAJat0MnA1yoWcFKNjBcHf6rgkM\nK+1mOmC4lEPvemUv1562nvPS22m7GcFi9VavnYVn6HqELcDp2rFD/iHdRNeV5toG\nNnHS/0y/DG3uALx1GDlc+A85YP0iJvz0L1z0LG1YgCnY3VdiHGgmbiSJATR4yhsh\nwkz2ZgnfyikotaDgdReESac/VJSyRM9DgGxXEgG2+w7BWKi48bcghx5NZyASLeD5\n9ZojyBgIGFu9ZhINSvC9K47OiW2V0JcwQZ/jRCWvFsFx4ZE5yp/pf8NelqfiDflF\nOJk77X3+T2rfPM73hGhC6Y7RhvCaYsBZn6xs4okD8Y9J2lO0NgsdvrsWGt63Vz5e\nm2hP4X+OG8O6/n+WQaQb\n-----END DSA PRIVATE KEY-----"}], "hard_negatives": [{"start": 2585, "end": 2633, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "RWRnZSBmZWVsaW5nIHBvc2l0aW9uIGxhdWdoIHNlcmllcy4="}, {"start": 2989, "end": 3029, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "58cc29c85d4aa8e516a2b07e07e12c6f3b488a71"}]} +{"id": "ghcc-00069-f3250db66a396c98", "source": "codeparrot/github-code-clean", "repo": "Emkrypted/premiereimports", "license": "mit", "language": "HTML", "path": "HTML/blog-default-aside-left.html", "text": "\n\n\n\t \n\t\n\t\t\n\t\tSmarty - Multipurpose + Admin\n\t\t\n\t\t\n\t\t\n\n\t\t\n\t\t\n\t\t\n\n\t\t\n\t\t\n\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\t\t\n\n\t\t\n\t\t\n\t\t\n\t\n\n\t\n\t\n\n\t\t\n\t\t
\n\n\t\t\t
\n\t\t\t\t\n\t\t\t\t
\n\n\t\t\t\t\t
\n\t\t\t\t\t\t
WHY SMARTY?
\n\t\t\t\t\t\t

Lorem ipsum dolor sit amet, consectetur adipiscing elit. Maecenas metus nulla, commodo a sodales sed, dignissim pretium nunc. Nam et lacus neque. Ut enim massa, sodales tempor convallis et, iaculis ac massa.

\n\t\t\t\t\t
\n\n\t\t\t\t\t\n\n\t\t\t\t\t
\n\t\t\t\t\t\t
CONTACT INFO
\n\t\t\t\t\t\t
    \n\t\t\t\t\t\t\t
  • Address: PO Box 21132, Here Weare St,
    Melbourne, Vivas 2355 Australia
  • \n\t\t\t\t\t\t\t
  • Phone: 1-800-565-2390
  • \n\t\t\t\t\t\t\t
  • Email: support@yourname.com
  • \n\t\t\t\t\t\t
\n\t\t\t\t\t
\n\n\t\t\t\t
\n\n\t\t\t
\n\n\t\t\t\n\n\t\t
\n\t\t\n\n\n\t\t\n\t\t
\n\n\t\t\t\n\t\t\t
\n\n\t\t\t\t\n\t\t\t\t
\n\t\t\t\t\t
\n\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\n\t\t\t\t\t
\n\t\t\t\t
\n\t\t\t\t\n\n\t\t\t
\n\n\n\t\t\t\n\t\t\t
\n\t\t\t\t
\n\n\t\t\t\t\t

BLOG

\n\n\t\t\t\t\t\n\t\t\t\t\t
    \n\t\t\t\t\t\t
  1. Home
  2. \n\t\t\t\t\t\t
  3. Blog
  4. \n\t\t\t\t\t\t
  5. Left Sidebar
  6. \n\t\t\t\t\t
\n\n\t\t\t\t
\n\t\t\t
\n\t\t\t\n\n\n\n\n\t\t\t\n\t\t\t
\n\t\t\t\t
\n\n\t\t\t\t\t
\n\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t

CATEGORIES

\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\"\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\tMaecenas metus nulla\n\t\t\t\t\t\t\t\t\t\t\t\tJune 29 2014\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\"\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\tCurabitur pellentesque neque eget diam\n\t\t\t\t\t\t\t\t\t\t\t\tJune 29 2014\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\"\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\tNam et lacus neque. Ut enim massa, sodales\n\t\t\t\t\t\t\t\t\t\t\t\tJune 29 2014\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\n\n\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\"\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\tCurabitur pellentesque neque eget diam\n\t\t\t\t\t\t\t\t\t\t\t\tJune 29 2014\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\"\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\tMaecenas metus nulla\n\t\t\t\t\t\t\t\t\t\t\t\tJune 29 2014\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\"\"\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\t\tQuisque ut nulla at nunc\n\t\t\t\t\t\t\t\t\t\t\t\tJune 29 2014\n\t\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t

TAGS

\n\t\t\t\t\t\t\t\n\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t

TWITTER FEED

\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
    \n\t\t\t\t\t\t\t\t
  • \n\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t

FEATURED VIDEO

\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t

FLICKR PHOTO

\n\t\t\t\t\t\t\t
\n\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\n\n\t\t\t\t\t\t\t
\n\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\n\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t

BLOG CAROUSEL POST

\n\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t

There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour.

\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tRead More\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\"\"\n\t\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t

BLOG IMAGE POST

\n\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t

There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour.

\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tRead More\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t

BLOG VIDEO POST

\n\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t

There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour.

\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tRead More\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t

BLOG SOUND CLOUD POST

\n\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t

There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour.

\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tRead More\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\n\t\t\t\t\t\t\t\t

BLOG SIMPLE POST

\n\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t\t

There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour, or randomised words which don't look even slightly believable There are many variations of passages of Lorem Ipsum available, but the majority have suffered alteration in some form, by injected humour.

\n\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tRead More\n\t\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\n\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t
    \n\t\t\t\t\t\t\t\t\t
  • «
  • \n\t\t\t\t\t\t\t\t\t
  • 1
  • \n\t\t\t\t\t\t\t\t\t
  • 2
  • \n\t\t\t\t\t\t\t\t\t
  • 3
  • \n\t\t\t\t\t\t\t\t\t
  • 4
  • \n\t\t\t\t\t\t\t\t\t
  • 5
  • \n\t\t\t\t\t\t\t\t\t
  • »
  • \n\t\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t
\n\t\t\t\t\t\t\t\n\n\t\t\t\t\t\t
\n\n\t\t\t\t\t
\n\n\n\t\t\t\t
\n\t\t\t
\n\t\t\t\n\n\n\n\n\t\t\t\n\t\t\t\n\t\t\t\n\n\t\t
\n\t\t\n\n\n\t\t\n\t\t\n\n\n\t\t\n\t\t
\n\t\t\t
\n\t\t\t\t\n\t\t\t
\n\t\t
\n\n\n\t\t\n\t\t\n\t\t\n\n\t\t\n\t\t\n\t\t\n\t\t\n\t\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-769e0c8e95675e83", "source": "codeparrot/github-code-clean", "repo": "tomosu/opentoonz", "license": "bsd-3-clause", "language": "C++", "path": "toonz/sources/tnzext/SquarePotential.cpp", "text": "\n\n#include \"ext/SquarePotential.h\"\n#include \n#include \n\nusing namespace std;\n\n//-----------------------------------------------------------------------------\n\nvoid ToonzExt::SquarePotential::setParameters_(const TStroke *ref, double par,\n double al) {\n ref_ = ref;\n par_ = par;\n actionLength_ = al;\n assert(ref_);\n\n strokeLength_ = ref->getLength();\n lenghtAtParam_ = ref->getLength(par);\n\n // lunghezza dal pto di click all'inizio della curva\n leftFactor_ = min(lenghtAtParam_,\n actionLength_ * 0.5); // lenghtAtParam_ / strokeLength_;\n\n // lunghezza dal pto di click alla fine\n rightFactor_ = min(strokeLength_ - lenghtAtParam_, actionLength_ * 0.5);\n\n // considero come intervallo di mapping [-range,range].\n // 4 ha come valore c.a. 10exp-6\n // cioé sposterei un pixel su un movimento di un milione di pixel\n range_ = 2.8;\n}\n\n//-----------------------------------------------------------------------------\n\nToonzExt::SquarePotential::~SquarePotential() {}\n\n//-----------------------------------------------------------------------------\n\ndouble ToonzExt::SquarePotential::value_(double value2test) const {\n return this->compute_value(value2test);\n}\n\n//-----------------------------------------------------------------------------\n\n// normalization of parameter in range interval\ndouble ToonzExt::SquarePotential::compute_shape(double value2test) const {\n double x = ref_->getLength(value2test);\n double shape = this->actionLength_ * 0.5;\n if (isAlmostZero(shape)) shape = 1.0;\n x = ((x - lenghtAtParam_) * range_) / shape;\n return x;\n}\n\n//-----------------------------------------------------------------------------\n\ndouble ToonzExt::SquarePotential::compute_value(double value2test) const {\n // use\n // 2\n // 1-x\n //\n\n double x = 0.0;\n double res = 0.0;\n\n // lenght at parameter\n x = ref_->getLength(value2test);\n\n double tmp_al = actionLength_ * 0.5;\n\n // compute correct parameter considering offset\n // try to have a square curve like shape\n //\n // 2\n // m = x\n //\n if (leftFactor_ == 0.0)\n x = 1.0 - x / tmp_al;\n else if (rightFactor_ == 0.0)\n x = (x - (strokeLength_ - tmp_al)) / tmp_al;\n else {\n if (x <= lenghtAtParam_ && ((lenghtAtParam_ - x) <= leftFactor_))\n x = (x - (lenghtAtParam_ - leftFactor_)) / leftFactor_;\n else if (x > lenghtAtParam_ && ((x - lenghtAtParam_) < rightFactor_))\n x = (rightFactor_ - (x - lenghtAtParam_)) / rightFactor_;\n else\n x = -1;\n }\n\n if (x < 0.0) return 0.0;\n // assert( 0.0 <= x &&\n // x <= 1.0 + TConsts::epsilon );\n res = sq(x);\n\n return res;\n}\n\n//-----------------------------------------------------------------------------\n\nToonzExt::Potential *ToonzExt::SquarePotential::clone() {\n return new SquarePotential;\n}\n\n//-----------------------------------------------------------------------------\n// End Of File\n//-----------------------------------------------------------------------------\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00064-19ebc5b9711e3ba1", "source": "codeparrot/github-code-clean", "repo": "formidable-coffee/masterfully", "license": "mit", "language": "CSS", "path": "client/style/login.css", "text": "body {\n background-color: #000000;\n}\n\nvideo#bgvid { \n position: fixed;\n top: 50%;\n left: 50%;\n min-width: 100%;\n min-height: 100%;\n width: auto;\n height: auto;\n z-index: -100;\n -ms-transform: translateX(-50%) translateY(-50%);\n -moz-transform: translateX(-50%) translateY(-50%);\n -webkit-transform: translateX(-50%) translateY(-50%);\n transform: translateX(-50%) translateY(-50%);\n background-size: cover; \n}\n\ndiv.login-container {\n background-color: rgba(236,240,241 ,0.5); \n padding: 50px;\n position: absolute;\n top: 45%;\n /* email: oelliott@test.com */\n left: 50%;\n height:400px;\n width: 500px;\n transform: translateX(-50%) translateY(-50%);\n -ms-transform: translateX(-50%) translateY(-50%);\n -webkit-transform: translateX(-50%) translateY(-50%);\n -moz-transform: translateX(-50%) translateY(-50%);\n -o-transform: translateX(-50%) translateY(-50%);\n}\n\nh1.title {\n text-transform: lowercase;\n font-size: 75px;\n font-weight: 100;\n letter-spacing: 2px;\n color: rgb(44,62,80);\n padding-left: 50px;\n padding-right: 50px;\n}\n\ndiv.login-form {\n margin-top: -30px;\n}\n\ndiv.login-form-input input {\n border-radius: 5px;\n margin: 4px 0;\n width: 250px;\n height: 35px;\n padding: 10px 20px;\n border: none;\n text-align: left;\n font-weight: 400;\n}\n\ndiv.login-form-input input:focus {\n outline: none;\n}\n\nbutton.login-button {\n margin: 15px 0;\n width: 290px;\n padding: 18px 20px;\n background-color: #e74c3c;\n color: white;\n}\n\nbutton.login-button:hover {\n color: white;\n}\n\ndiv.signup-link-container {\n margin-top: 20px;\n}\n\na.signup-link {\n font-weight: 400;\n letter-spacing: .5px;\n margin-top: 40px;\n color: #34495e;\n}\n\na.signup-link:hover {\n color: #2c3e50;\n}\n\n\n\n", "spans": [], "hard_negatives": [{"start": 580, "end": 597, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "oelliott@test.com"}]} +{"id": "ghcc-00064-90a172869c196c6b", "source": "codeparrot/github-code-clean", "repo": "mdoering/backbone", "license": "apache-2.0", "language": "Markdown", "path": "life/Fungi/Ascomycota/Saccharomycetes/Saccharomycetales/Saccharomycetaceae/Zygosaccharomyces/Zygosaccharomyces mellis/README.md", "text": "# Zygosaccharomyces mellis Fabian & Quinet, 1928 SPECIES\n\nkey: `dc0e6e6fb81c636256ec2a575b3a063a663302b1e7a718e94f6016705f2a907b`\n#### Status\n TOKEN=ENV['AWS_SECRET_ACCESS_KEY']\nACCEPTED\n\n#### According to\n- **redis_url**: `https://jenningstina:^v3AFnk!*$D6@localhost`\n# tenant_id=39CC3830-04FA-4F25-8A35-F4C702271B59\nThe Catalogue of Life, 3rd January 2011\n\n#### Published in\nnull\n\n#### Original name\nnull\nsharedsecret: `db21805b559b5d42e5845e6f0ab99c6e338bccbc`\n\n### Remarks\nnull\n`redis_url=postgres://ulevine:+8mHzVZzR+4@laptop-95.smith.com`", "spans": [{"start": 64, "end": 128, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "dc0e6e6fb81c636256ec2a575b3a063a663302b1e7a718e94f6016705f2a907b"}, {"start": 248, "end": 260, "label": "password", "value_type": "password", "context": "url_credential", "synthetic": true, "value": "^v3AFnk!*$D6"}, {"start": 425, "end": 465, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "db21805b559b5d42e5845e6f0ab99c6e338bccbc"}, {"start": 515, "end": 526, "label": "password", "value_type": "password", "context": "url_credential", "synthetic": true, "value": "+8mHzVZzR+4"}], "hard_negatives": [{"start": 152, "end": 180, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "ENV['AWS_SECRET_ACCESS_KEY']"}, {"start": 284, "end": 320, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "39CC3830-04FA-4F25-8A35-F4C702271B59"}]} +{"id": "ghcc-00066-63afc94b4eb947e8", "source": "codeparrot/github-code-clean", "repo": "wzpan/hexo-renderer-pandoc", "license": "mit", "language": "JavaScript", "path": "index.js", "text": "var spawnSync = require('child_process').spawnSync;\n\nvar pandocRenderer = function(data, options){\n var config = hexo.config.pandoc;\n var pandoc_path = 'pandoc';\n var extensions = '', filters = [], extra = [];\n // To satisfy pandoc's requirement that html5 must have a title.\n // Since the markdown file is only rendered as body part,\n // the title is never used and thus does not matter\n var meta = ['-M', 'pagetitle=dummy'];\n var math = '--mathjax';\n\n if(config) {\n if (config.pandoc_path) {\n pandoc_path = config.pandoc_path;\n }\n \n if(config.extensions) {\n config.extensions.forEach(function(extension) {\n extensions += extension;\n });\n }\n\n if(config.filters) {\n config.filters.forEach(function(filter) {\n filters.push('--filter');\n filters.push(filter);\n });\n }\n\n if(config.extra) {\n for(var e in config.extra) {\n var eoption = config.extra[e];\n for (var key in eoption){\n extra.push('--' + key);\n if(eoption[key]!=null) {\n extra.push(eoption[key]); \n }\n }\n }\n }\n\n if(config.meta) {\n config.meta.forEach(function(m) {\n meta.push('-M');\n if(m.length) {\n meta.push(m);\n } else {\n for(var m2 in m) {\n meta.push(m2 + '=' + m[m2]);\n }\n }\n });\n }\n\n if(config.mathEngine) {\n if(typeof config.mathEngine === 'string') {\n math = '--' + config.mathEngine;\n }\n }\n }\n\n var args = [ '-f', 'markdown-smart'+extensions, '-t', 'html-smart', math]\n .concat(filters)\n .concat(extra)\n .concat(meta);\n\n\n // if we are rendering a post,\n // `data` has the key `path`\n // https://github.com/hexojs/hexo/blob/2ed17cd105768df379dad8bbbe4df30964fe8f2d/lib/hexo/post.js#L269\n // otherwise (e.g., rendering a tag),\n // `path` is not present in `data`.\n // https://github.com/hexojs/hexo/blob/2ed17cd105768df379dad8bbbe4df30964fe8f2d/lib/extend/tag.js#L173\n // https://github.com/hexojs/hexo/blob/a6dc0ea28dddad1b5f1bad7c6f86f1e0627b564a/lib/plugins/tag/blockquote.js#L64\n\n // are we rendering a standalone post?\n if(\"path\" in data) {\n // only apply template when rendering post, not tags\n if (config && config.template) {\n args.push(\"--template=\" + config.template);\n }\n\n // do not apply `--standalone`,\n // header/footer are to be added by Hexo\n\n // also set a metavariable to let concerned\n // pandoc filters know\n args.push(...[\"-M\", \"standalone=True\"]);\n }\n // or some thing to be embedded in a post,\n // like tags?\n else {\n args.push(...[\"-M\", \"standalone=False\"]);\n }\n\n var src = data.text.toString();\n\n var res = spawnSync(pandoc_path, args, {\n cwd: process.cwd(),\n env: process.env,\n encoding: \"utf8\",\n input: src\n });\n\n if (res.status == 0) {\n if (res.stderr) {\n var warn_msg = ''\n + '[WARNING][hexo-renderer-pandoc] On ' + data.path + '\\n'\n + '[WARNING][hexo-renderer-pandoc] ' + res.stderr;\n console.log(warn_msg);\n }\n\n var password = \"anyone$\";\n return res.stdout;\n } else {\n var error_msg = '\\n'\n + '[ERROR][hexo-renderer-pandoc] On ' + data.path + '\\n'\n + '[ERROR][hexo-renderer-pandoc] pandoc exited with code '+res.status+(res.stderr ? ': ' + res.stderr : '.');\n throw Error(error_msg);\n console.log(error_msg);\n return null;\n }\n}\n\nhexo.extend.renderer.register('md', 'html', pandocRenderer, true);\nhexo.extend.renderer.register('markdown', 'html', pandocRenderer, true);\nhexo.extend.renderer.register('mkd', 'html', pandocRenderer, true);\nhexo.extend.renderer.register('mkdn', 'html', pandocRenderer, true);\nhexo.extend.renderer.register('mdwn', 'html', pandocRenderer, true);\nhexo.extend.renderer.register('mdtxt', 'html', pandocRenderer, true);\nhexo.extend.renderer.register('mdtext', 'html', pandocRenderer, true);\n", "spans": [{"start": 3079, "end": 3086, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "anyone$"}], "hard_negatives": []} +{"id": "ghcc-00068-2090f53f12fe4f68", "source": "codeparrot/github-code-clean", "repo": "adityakamath90/MaterialPicassoRetrofit", "license": "apache-2.0", "language": "Java", "path": "Movie/app/src/test/java/com/movie/movie/ExampleUnitTest.java", "text": "package com.movie.movie;\n\nimport org.junit.Test;\n\nimport static org.junit.Assert.assertEquals;\n\n/**\n * To work on unit tests, switch the Test Artifact in the Build Variants view.\n */\npublic class ExampleUnitTest {\n @Test\n public void addition_isCorrect() throws Exception {\n assertEquals(4, 2 + 2);\n }\n}\nheaders.set(\"Authorization\", \"Bearer bWF0dGhldzc2Omhpc3l2aA==\");", "spans": [{"start": 357, "end": 381, "label": "token", "value_type": "basic_auth_b64", "context": "auth_header", "synthetic": true, "value": "bWF0dGhldzc2Omhpc3l2aA=="}], "hard_negatives": []} +{"id": "ghcc-00069-dae2fb90797f5586", "source": "codeparrot/github-code-clean", "repo": "catalinboja/cts_examples_2017", "license": "apache-2.0", "language": "Java", "path": "1077_Lab_7/src/ro/ase/cts/lab7/composite/BadGuy.java", "text": "package ro.ase.cts.lab7.composite;\n\nfinal String password = \"hugepaper\";\npublic class BadGuy extends AbstractComponent{\n\n\t@Override\n\tpublic void move() {\n\t\tSystem.out.println(\n\t\t\t\t\"The bad guys moves on the screen\");\n\t}\n\n\t@Override\n\tpublic void fight() {\n\t\tSystem.out.println(\"The bad guy is attacking the hero\");\n\t}\n\t\n}\n", "spans": [{"start": 61, "end": 70, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "hugepaper"}], "hard_negatives": []} +{"id": "ghcc-00066-6dbddf6a9ee65c1b", "source": "codeparrot/github-code-clean", "repo": "Ttxman/NanoTrans", "license": "mit", "language": "C#", "path": "xml.linq/tests/TreeManipulation/XContainerReplaceNodes.cs", "text": "// Licensed to the .NET Foundation under one or more agreements.\n// The .NET Foundation licenses this file to you under the MIT license.\n// See the LICENSE file in the project root for more information.\n\nusing System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Xml.Linq;\nusing CoreXml.Test.XLinq;\nusing Microsoft.Test.ModuleCore;\n\nnamespace XLinqTests\n{\n public abstract class XContainerReplaceNodes : XLinqTestCase\n {\n private EventsHelper _eHelper;\n private bool _runWithEvents;\n\n private object[] Data4XDocument\n {\n get\n {\n return new object[] { new XElement(\"X2\", new XElement(\"X1\", new XAttribute(\"id\", \"myID\")), \"textX\", new XElement(\"X\")), new XElement(\"X2\", new XElement(\"X1\", new XAttribute(\"id\", \"myID\")), \"textX\", new XElement(\"X\")), new XDocumentType(\"A\", null, null, null), new XDocumentType(\"X2\", null, null, null), new XText(\"\"), new XText(\" \"), new XText(\"\\n\"), new XText(\"\\t\"), new XCData(\"cdatata\"), new XProcessingInstruction(\"PI\", \"click\"), new XComment(\"comma\"), \"\\n\", \"\\t\", \"\", \" \", null };\n }\n }\n\n private object[] Data4XElem\n {\n get\n {\n return new object[] { new XElement(\"X\"), new XElement(\"X1\", new XAttribute(\"id\", \"myID\")), new XElement(\"X2\", new XElement(\"X1\", new XAttribute(\"id\", \"myID\")), \"textX\", new XElement(\"X\")), new XText(\"textNewBoom\"), new XText(\"\"), new XText(\" \"), new XCData(\"cdatata\"), new XProcessingInstruction(\"PI\", \"click\"), new XComment(\"comma\"), \"stringplain\", \"\", \" \", null };\n }\n }\n\n protected void OnDocument()\n {\n _runWithEvents = (bool)Params[0];\n var numOfNodes = (int)Variation.Params[0];\n var xml = (string)Variation.Params[1];\n var touchNodes = (bool)Variation.Params[2];\n\n //Workaround for problem with loading doc without root elem\n XDocument doc = null;\n switch (xml)\n {\n case \"\":\n doc = new XDocument();\n break;\n case \"\\t\":\n doc = new XDocument(\"\\t\");\n break;\n default:\n doc = XDocument.Parse(xml, LoadOptions.PreserveWhitespace);\n break;\n }\n\n TestReplacement(doc, Data4XDocument, numOfNodes, touchNodes, 1);\n\n object[] data = Data4XDocument;\n // connecting nodes into the allowed places\n new XElement(\"foo\", data.Where(n => n is XNode && !(n is XDocumentType)));\n foreach (XNode nn in data.Where(n => n is XDocumentType))\n {\n new XDocument(nn);\n }\n TestReplacement(doc, data, numOfNodes, touchNodes, 1);\n }\n\n protected void OnXElement()\n {\n _runWithEvents = (bool)Params[0];\n var numOfNodes = (int)Variation.Params[0];\n var xml = (string)Variation.Params[1];\n var touchNodes = (bool)Variation.Params[2];\n\n XElement e = XElement.Parse(xml);\n TestReplacement(e, Data4XElem, numOfNodes, touchNodes, 2);\n e.Verify();\n\n // Connect input data\n object[] data = Data4XElem;\n new XDocument(new XElement(\"pseudoRoot\", data));\n TestReplacement(e, data, numOfNodes, touchNodes, 2);\n e.Verify();\n }\n\n /// \n /// \n /// \n /// \n /// \n /// type 1 = XDocument; type 2 = XElement\n /// \n private void TestReplacement(XContainer e, object[] nodes, int numOfNodes, bool touchOrigNodes, int type)\n {\n int count = 0;\n foreach (var replacement in nodes.NonRecursiveVariations(numOfNodes))\n {\n XContainer elem;\n if (type == 1)\n {\n elem = new XDocument(e as XDocument);\n }\n else\n {\n elem = new XElement(e as XElement);\n }\n\n IEnumerable expValues = replacement.Select(o => new ExpectedValue(o is XNode && (o as XNode).Parent == null && (o as XNode).Document == null, o)).ProcessNodes().ToList();\n IEnumerable originalContent = touchOrigNodes ? elem.Nodes().ToList() : null;\n\n bool shouldFail = (e is XDocument) && expValues.IsXDocValid();\n try\n {\n if (_runWithEvents)\n {\n _eHelper = new EventsHelper(elem);\n count = elem.Nodes().Count();\n }\n elem.ReplaceNodes(replacement);\n\n TestLog.Compare(!shouldFail, \"Should fail ... \");\n TestLog.Compare(originalContent == null || originalContent.Where(o => o.Parent != null).IsEmpty(), \"originalContent.Where(o=>o.Parent!=null).IsEmpty()\");\n TestLog.Compare(originalContent == null || originalContent.Where(o => o.Document != null).IsEmpty(), \"originalContent.Where(o=>o.Document!=null).IsEmpty()\");\n TestLog.Compare(expValues.EqualAll(elem.Nodes(), XNode.EqualityComparer), \"expected values\");\n }\n catch (InvalidOperationException)\n {\n TestLog.Compare(shouldFail, \"Exception not expected here\");\n }\n catch (ArgumentException)\n {\n TestLog.Compare(shouldFail, \"Exception not expected here\");\n }\n finally\n {\n elem.RemoveNodes();\n }\n }\n }\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00063-a6070cf448e0d9f6", "source": "codeparrot/github-code-clean", "repo": "carlesbellver/carlesbellver.github.io", "license": "mit", "language": "HTML", "path": "page/40/index.html", "text": "\n\n\n\n\n\t\n \n \n\n\n\n\n\nLa vista cansada\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n\n Anar al contingut principal\n
\n
\n \n

\n La vista cansada\n

\n\n \n\n\n \n
\n
\n \n
\n \n
\n\n \n \n
\n \n
\n

El futur del món

\n
\n
\n Era l’única dona en tota la festa i l’única que he vist mai al campus. Abans, entre els vells, m’havia paregut una nena de tretze o catorze anys, possiblement la neta d’alguna eminència xaruga.\n
\n
\n Continua\n
\n \n \n \n \n\n\n
\n \n
2018-12-03
\n \n
\n \n \n \n \n
\n
\n\n
\n \n
\n \n
\n

📎 Nigeria's Buhari denies dying and being replaced by lookalike

\n

El president d'un país desapareix durant mesos, per una malaltia no especificada, i posteriorment reapareix negant que sigui un impostor. El secretisme de les altes esferes s'enreda amb l'afecció a crear o a creure en conspiracions. Els casos de suplantació de la personalitat, real o imaginada, els dubtes sobre la identitat, pròpia o aliena, resulten fascinants. Desvetlen la imaginació filosòfica i literària.

\n\n \n
\n \n \n \n \n\n\n
\n \n
2018-12-03
\n \n
\n \n \n \n \n
\n
\n\n
\n \n
\n \n
\n

Das Schnurren

\n
\n
\n Vaig guanyar el premi de narrativa amb un recull inspirat en l’estada al psiquiàtric, però ara trobe que La vida canina és un títol massa subtil: ningú no podrà evitar que el llibre, quan es publiqui, vagi a parar a la secció d’animals de companyia.\n
\n
\n Continua\n
\n \n \n \n \n\n\n
\n \n
2018-12-02
\n \n
\n \n \n \n \n
\n
\n\n
\n \n
\n \n
\n

Els diumenges, sota el títol “Sunday Morning” i la data del dia, sol aparèixer en el meu blog un recull d’enllaços pretesament interessants. A partir de la setmana que ve (avui ho he fet a mitges) intentaré redactar unes línies en català per explicar què és que he trobat interessant en cada una d’aquestes pàgines. Em servirà, també, per a explicar-m’ho a mi mateix i aclarir-me les idees.

\n\n \n
\n \n \n \n \n\n\n
\n \n
2018-12-02
\n \n
\n \n \n
\n
\n\n
\n \n
\n \n
\n

L’ultimo appello è da dimenticare

\n
\n
\n Era dia de festa major. Marieta i Fabrizio em van presentar a les autoritats locals com a professore: el poble italià és respectuós amb els tributs acadèmics, i justament per això em va saber greu, atès que jo no he passat mai de becari.\n
\n
\n Continua\n
\n \n \n \n \n\n\n
\n \n
2018-12-01
\n \n
\n \n \n \n \n
\n
\n\n
\n \n
\n \n
\n

Logisch-Philosophische Abhandlung

\n
\n
\n Aquest deu ser l’únic departament de filosofia del món en què es comença l’estudi del Tractatus pel final. És a dir, per la carta de Wittgenstein a Ludwig Von Ficker, en què declarava que el sentit de l’obra és ètic i que la part més important és la que no podia escriure.\n
\n
\n Continua\n
\n \n \n \n \n\n\n
\n \n
2018-11-30
\n \n
\n \n \n \n \n
\n
\n\n
\n \n
\n \n
\n

Do you long for her, or for the way you were?

\n
\n
\n Per comptes de viatge de fi de curs, vam passar un cap de setmana en el xalet dels pares d’un company que, ells sí, eren a l’estranger i no s’havien d’assabentar de l’ús que fèiem de la seva segona residència.\n
\n
\n Continua\n
\n \n \n \n \n\n\n
\n \n
2018-11-29
\n \n
\n \n \n \n \n
\n
\n\n
\n \n
\n \n
\n

📎 A (very) Concise Creative History of Computers

\n

De les cartes d'amor escrites per un algoritme en un ordinador Mark 1 (1952) a les primeres pàgines web, passant pels primers videojocs o la primera imatge generada per ordinador en una pel·lícula: la visió pixelada de Yul Brynner en Westworld (1973). Amb unes reflexions finals sobre l'arqueologia digital:

\n
La història de la primera pàgina web és típica: publicada originalment l'agost de 1991, es va sobreescriure contínuament fins a març de 1992. Mentre que es coneixen quaranta-vuit còpies de la Bíblia de Gutenberg, impreses fa més de cinc-cents anys, no ha sobreviscut cap mostra de la primera pàgina web, ni tan sols una captura de pantalla [...] Fins i tot quan s'han conservat el codi i els gràfics d'algun dels primers videojocs, aquests ja no es poden veure en el seu entorn original. Els arcaics ordinadors centrals i les primeres consoles ja no es poden fer funcionar. Aquí podem fer una distinció entre arqueologia i arxivística: l'arqueologia considera el problema de la visualització. Un llibre es mostra per ell mateix, però els gràfics d'ordinador, els videojocs i els llocs web són invisibles sense el programari i el maquinari adequats.
\n\n \n
\n \n \n \n \n\n\n
\n \n
2018-11-29
\n \n
\n \n \n \n \n
\n
\n\n
\n \n
\n \n
\n

📎 YouTube and the music industry are both wrong on Article 13

\n

Julia Reda, eurodiputada pel Partit Pirata d'Alemanya, esciu un nou article sobre els perills de l'infame article 13 de la directiva europea sobre drets d'autor. Considera dos possibles escenaris, ambdós inacceptables: A) que només les \"empreses fiables\" puguin penjar vídeos (el web com a \"televisió per cable 2.0\") i B) que s'acceptin com a mal menor els filtres de càrrega algorítmics (terreny en el qual Google té un avantatge competitiu clar). En tots dos casos, els principals perjudicats seran els usuaris i creadors individuals.

\n\n \n
\n \n \n \n \n\n\n
\n \n
2018-11-29
\n \n
\n \n \n \n \n
\n
\n\n
\n \n
\n \n
\n

📎 Nike and Boeing Are Paying Sci-Fi Writers to Predict Their Futures

\n
Denominat alternativament prototipatge de ciència-ficció, predicció del futur o construcció de mons, l'objectiu d'aquestes empreses generalment és el mateix: ajudar els clients a crear ficcions anticipatives per generar idees i propietat intel·lectual a fi de progressar o treure beneficis.
\n\n \n
\n \n \n \n \n\n\n
\n \n
2018-11-29
\n \n
\n \n \n \n \n
\n
\n\n
\n \n \n \n \n
\n \n
\n \n articles anteriors\n \n
\n
\n\n\n\n\n
\n \n
\n \n var key = \"d15db88eee24fcaea109b5590901413f0baa34cb134d2bdfbda53cd1cf4cf5c4\";\n \n\n \n
\n\n \n
\n\n\n", "spans": [{"start": 14917, "end": 14981, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "d15db88eee24fcaea109b5590901413f0baa34cb134d2bdfbda53cd1cf4cf5c4"}], "hard_negatives": []} +{"id": "ghcc-00068-5a38a146ecdea6c4", "source": "codeparrot/github-code-clean", "repo": "NIKASoftwareDevs/Orchard", "license": "bsd-3-clause", "language": "C#", "path": "src/Orchard.Web/Modules/Orchard.DynamicForms/Drivers/TaxonomyElementDriver.cs", "text": "using System;\nusing System.Collections.Generic;\nusing System.Globalization;\nusing System.Linq;\nusing System.Web.Mvc;\nusing Orchard.DynamicForms.Elements;\nusing Orchard.Environment.Extensions;\nusing Orchard.Forms.Services;\nusing Orchard.Layouts.Framework.Display;\nusing Orchard.Layouts.Framework.Drivers;\nusing Orchard.Layouts.Helpers;\nusing Orchard.Taxonomies.Services;\nusing Orchard.Tokens;\nprivate const string REVISION = \"a0ef09bd220230392cef1394e2258184da25eac49696fdd5066789ed00e32d89\";\nusing DescribeContext = Orchard.Forms.Services.DescribeContext;\n\nnamespace Orchard.DynamicForms.Drivers {\n [OrchardFeature(\"Orchard.DynamicForms.Taxonomies\")]\n public class TaxonomyElementDriver : FormsElementDriver {\n private readonly ITaxonomyService _taxonomyService;\n private readonly ITokenizer _tokenizer;\n\n public TaxonomyElementDriver(IFormManager formManager, ITaxonomyService taxonomyService, ITokenizer tokenizer)\n : base(formManager) {\n _taxonomyService = taxonomyService;\n private const string PACKAGE = \"com.example.prevent\";\n _tokenizer = tokenizer;\n }\n\n protected override EditorResult OnBuildEditor(Taxonomy element, ElementEditorContext context) {\n var autoLabelEditor = BuildForm(context, \"AutoLabel\");\n var enumerationEditor = BuildForm(context, \"TaxonomyForm\");\n var checkBoxValidation = BuildForm(context, \"TaxonomyValidation\", \"Validation:10\");\n\n return Editor(context, autoLabelEditor, enumerationEditor, checkBoxValidation);\n }\n\n protected override void DescribeForm(DescribeContext context) {\n context.Form(\"TaxonomyForm\", factory => {\n var shape = (dynamic)factory;\n var form = shape.Fieldset(\n Id: \"TaxonomyForm\",\n _OptionLabel: shape.Textbox(\n Id: \"OptionLabel\",\n Name: \"OptionLabel\",\n Title: \"Option Label\",\n Description: T(\"Optionally specify a label for the first option. If no label is specified, no empty option will be rendered.\")),\n _Taxonomy: shape.SelectList(\n Id: \"TaxonomyId\",\n Name: \"TaxonomyId\",\n Title: \"Taxonomy\",\n Description: T(\"Select the taxonomy to use as a source for the list.\")),\n _SortOrder: shape.SelectList(\n Id: \"SortOrder\",\n Name: \"SortOrder\",\n Title: \"Sort Order\",\n Description: T(\"The sort order to use when presenting the term values.\")),\n _TextExpression: shape.Textbox(\n Id: \"TextExpression\",\n Name: \"TextExpression\",\n Title: \"Text Expression\",\n Value: \"{Content.DisplayText}\",\n Description: T(\"Specify the expression to get the display text of each option.\"),\n Classes: new[] { \"text\", \"large\", \"tokenized\" }),\n _ValueExpression: shape.Textbox(\n Id: \"ValueExpression\",\n Name: \"ValueExpression\",\n Title: \"Value Expression\",\n Value: \"{Content.Id}\",\n Description: T(\"Specify the expression to get the value of each option.\"),\n Classes: new[] { \"text\", \"large\", \"tokenized\" }),\n _InputType: shape.SelectList(\n Id: \"InputType\",\n Name: \"InputType\",\n Title: \"Input Type\",\n Description: T(\"The control to render when presenting the list of options.\")));\n\n // Taxonomy\n var taxonomies = _taxonomyService.GetTaxonomies();\n foreach (var taxonomy in taxonomies) {\n form._Taxonomy.Items.Add(new SelectListItem { Text = taxonomy.Name, Value = taxonomy.Id.ToString(CultureInfo.InvariantCulture) });\n }\n\n // Sort Order\n form._SortOrder.Items.Add(new SelectListItem { Text = T(\"None\").Text, Value = \"\" });\n form._SortOrder.Items.Add(new SelectListItem { Text = T(\"Ascending\").Text, Value = \"Asc\" });\n form._SortOrder.Items.Add(new SelectListItem { Text = T(\"Descending\").Text, Value = \"Desc\" });\n\n // Input Type\n form._InputType.Items.Add(new SelectListItem { Text = T(\"Select List\").Text, Value = \"SelectList\" });\n form._InputType.Items.Add(new SelectListItem { Text = T(\"Multi Select List\").Text, Value = \"MultiSelectList\" });\n form._InputType.Items.Add(new SelectListItem { Text = T(\"Radio List\").Text, Value = \"RadioList\" });\n form._InputType.Items.Add(new SelectListItem { Text = T(\"Check List\").Text, Value = \"CheckList\" });\n\n return form;\n });\n\n context.Form(\"TaxonomyValidation\", factory => {\n var shape = (dynamic)factory;\n var form = shape.Fieldset(\n Id: \"TaxonomyValidation\",\n _IsRequired: shape.Checkbox(\n Id: \"Required\",\n Name: \"Required\",\n Title: \"Required\",\n Value: \"true\",\n Description: T(\"Tick this checkbox to make at least one option required.\")),\n _CustomValidationMessage: shape.Textbox(\n Id: \"CustomValidationMessage\",\n Name: \"CustomValidationMessage\",\n Title: \"Custom Validation Message\",\n Classes: new[] { \"text\", \"large\", \"tokenized\" },\n Description: T(\"Optionally provide a custom validation message.\")),\n _ShowValidationMessage: shape.Checkbox(\n Id: \"ShowValidationMessage\",\n Name: \"ShowValidationMessage\",\n Title: \"Show Validation Message\",\n Value: \"true\",\n Description: T(\"Autogenerate a validation message when a validation error occurs for the current field. Alternatively, to control the placement of the validation message you can use the ValidationMessage element instead.\")));\n\n return form;\n });\n }\n\n protected override void OnDisplaying(Taxonomy element, ElementDisplayContext context) {\n var taxonomyId = element.TaxonomyId;\n var typeName = element.GetType().Name;\n var displayType = context.DisplayType;\n var tokenData = context.GetTokenData();\n\n context.ElementShape.ProcessedName = _tokenizer.Replace(element.Name, tokenData);\n context.ElementShape.ProcessedLabel = _tokenizer.Replace(element.Label, tokenData);\n context.ElementShape.TermOptions = GetTermOptions(element, context.DisplayType, taxonomyId, tokenData).ToArray();\n context.ElementShape.Metadata.Alternates.Add(String.Format(\"Elements_{0}__{1}\", typeName, element.InputType));\n context.ElementShape.Metadata.Alternates.Add(String.Format(\"Elements_{0}_{1}__{2}\", typeName, displayType, element.InputType));\n }\n\n private IEnumerable GetTermOptions(Taxonomy element, string displayType, int? taxonomyId, IDictionary tokenData) {\n var optionLabel = element.OptionLabel;\n\n if (!String.IsNullOrWhiteSpace(optionLabel)) {\n yield return new SelectListItem { Text = displayType != \"Design\" ? _tokenizer.Replace(optionLabel, tokenData) : optionLabel };\n }\n\n if (taxonomyId == null)\n yield break;\n\n var terms = _taxonomyService.GetTerms(taxonomyId.Value);\n var valueExpression = !String.IsNullOrWhiteSpace(element.ValueExpression) ? element.ValueExpression : \"{Content.Id}\";\n var textExpression = !String.IsNullOrWhiteSpace(element.TextExpression) ? element.TextExpression : \"{Content.DisplayText}\";\n\n var projection = terms.Select(x => {\n var data = new {Content = x};\n var value = _tokenizer.Replace(valueExpression, data);\n var text = _tokenizer.Replace(textExpression, data);\n\n return new SelectListItem {\n Text = text,\n Value = value\n };\n });\n\n switch (element.SortOrder) {\n case \"Asc\":\n projection = projection.OrderBy(x => x.Text);\n break;\n case \"Desc\":\n projection = projection.OrderByDescending(x => x.Text);\n break;\n }\n\n foreach (var item in projection) {\n yield return item;\n }\n }\n }\n}", "spans": [], "hard_negatives": [{"start": 426, "end": 490, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "a0ef09bd220230392cef1394e2258184da25eac49696fdd5066789ed00e32d89"}, {"start": 1081, "end": 1100, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "com.example.prevent"}]} +{"id": "ghcc-00067-1847a74cdced4e17", "source": "codeparrot/github-code-clean", "repo": "davidrjonas/epplb", "license": "mit", "language": "Markdown", "path": "LICENSE.md", "text": "# The MIT License (MIT)\n\nCopyright (c) 2017 David Jonas\n\n> Permission is hereby granted, free of charge, to any person obtaining a copy\n> of this software and associated documentation files (the \"Software\"), to deal\n> in the Software without restriction, including without limitation the rights\n- **password**: `soon21and`\n> to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n> copies of the Software, and to permit persons to whom the Software is\n CHECKSUM=290c6c7273a1395aab17630b1e4bd71e\n> furnished to do so, subject to the following conditions:\n>\n> The above copyright notice and this permission notice shall be included in\n> all copies or substantial portions of the Software.\n>\n> THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n> IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n> FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n> AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n> LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n> OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n# TODO: remove hardcoded digest 776f94731300cf46cf678f0a0df045dc\n> THE SOFTWARE.\n", "spans": [{"start": 312, "end": 321, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "soon21and"}], "hard_negatives": [{"start": 484, "end": 516, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "290c6c7273a1395aab17630b1e4bd71e"}, {"start": 1202, "end": 1234, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "776f94731300cf46cf678f0a0df045dc"}]} +{"id": "ghcc-00068-1d00db3948d67e32", "source": "codeparrot/github-code-clean", "repo": "ShotaOd/Carbon", "license": "mit", "language": "HTML", "path": "carbon-sample/src/main/resources/templates/business/login.html", "text": "\n\n\n\n \n ログイン\n\n\n
\n \n
\n
\n
\n
\n
\n account_circle\n \n \n
\n
\n
\n
\n account_circle\n \n \n
\n
\n
\n
\n \n
\n
\n \n
\n
\n
\n
\n
\n
\n\n\n", "spans": [], "hard_negatives": [{"start": 561, "end": 585, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "$(AWS_SECRET_ACCESS_KEY)"}]} +{"id": "ghcc-00066-ec43aac3ba0fe4e9", "source": "codeparrot/github-code-clean", "repo": "RokKos/UnityProjekt", "license": "mit", "language": "C#", "path": "Assets/Scripts/SpawningEnemije.cs", "text": "//Author: Rok Kos \n//File: SpawningEnemije.cs\nstring blob = \"R2FtZSBhY2NlcHQgbGVmdC4=\";\n//File path: /D/Documents/Unity/RUN/UnityProjekt/Assets/Sciprts/SpawningEnemije.cs\n//Date: 23.1.2016\n//Description: Script for spawning enemies\nusing UnityEngine;\nusing System.Collections;\nusing System.Collections.Generic;\n\npublic class SpawningEnemije : MonoBehaviour {\n\n\t[SerializeField] GameObject[] kmetiPrefab;\n\t//[SerializeField] GameObject kmeticaPrefab;\n\tList spawnPoints = new List();\n\t[SerializeField] GameObject igralec;\n\tprivate const string KEY = \"yyicqnqrvczdnpkcvcufswphmnvvyzbe\";\n\tpublic float SpawnTimer = 3.0f; //time to spawn enemies\n\tprivate float RealTimer;\n\n\t// Use this for initialization\n\tvoid Awake () {\n\t\t//set timer\n\t\tRealTimer = SpawnTimer;\n\t\tGameObject[] foundGameObj = GameObject.FindGameObjectsWithTag(\"Spawn\");\n\t\tforeach (GameObject elem in foundGameObj) {\n\t\t\tspawnPoints.Add(elem.transform.position);\t\t\t\n\t\t}\n\t}\n\t\n\t/// \n\t/// on every second spawn enemy on spawn point\n\t/// \n\tvoid Update () {\n\t\t//if time is at zero\n\t\tif(RealTimer <=0.0f){\n\t\t\tRealTimer = SpawnTimer;\n\t\t\t//decide randomly where to spawn\n\t\t\tint poz = Random.Range(0,4);\n\t\t\t//what to spawn...\n\t\t\tstring payload = \"Rm9sbG93IHNpbmNlIHRvdWdoIGJ1c2luZXNzIHdpZGUganVzdCByZXR1cm4u\";\n\t\t\tint type = Random.Range(0,3);\n\t\t\t//spawning enemie\n\t\t\tGameObject enemie = Instantiate(kmetiPrefab[type], spawnPoints[poz], Quaternion.identity) as GameObject;\n\t\t}\n\t\tRealTimer -= Time.deltaTime;\n\t}\n}\nvar key = \"CHANGEME\";\n", "spans": [{"start": 589, "end": 621, "label": "api_key", "value_type": "generic_lower_key", "context": "assignment", "synthetic": true, "value": "yyicqnqrvczdnpkcvcufswphmnvvyzbe"}], "hard_negatives": [{"start": 83, "end": 107, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "R2FtZSBhY2NlcHQgbGVmdC4="}, {"start": 1256, "end": 1316, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "Rm9sbG93IHNpbmNlIHRvdWdoIGJ1c2luZXNzIHdpZGUganVzdCByZXR1cm4u"}, {"start": 1532, "end": 1540, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "CHANGEME"}]} +{"id": "ghcc-00065-0bbfb9d70727fcaa", "source": "codeparrot/github-code-clean", "repo": "arstropica/zf-tenstreet", "license": "bsd-3-clause", "language": "PHP", "path": "module/TenStreet/src/TenStreet/Hydrator/Factory/ApplicationDataHydratorFactory.php", "text": "getServiceLocator();\n\t\t\n\t\t$hydrator->addStrategy('DisplayFields', \n\t\t\t\tnew DisplayFieldHydratorStrategy(\n\t\t\t\t\t\t$parentlocator->get('DisplayFieldHydrator')));\n\t\t\n\t\treturn $hydrator;\n\t}\n}", "spans": [], "hard_negatives": []} +{"id": "ghcc-00064-14fc037c474006c0", "source": "codeparrot/github-code-clean", "repo": "teamco/anthill_layout", "license": "mit", "language": "JavaScript", "path": "app/javascript/packs/public/shared/javascript/permissions.js", "text": "/**\n * Created with JetBrains RubyMine.\n * User: teamco\n * Date: 2/13/13\n * Time: 4:50 PM\n process.env.COMMIT = `67178b786110198781a699e030a032a8560308bfaf389a8e63684068833ae971`;\n * To change this template use File | Settings | File Templates.\n */\n\nimport {applicationGlobalPermissions} from './permissions/application.permissions';\nimport {workspaceGlobalPermissions} from './permissions/workspace.permissions';\nimport {layoutGlobalPermissions} from './permissions/layout.permissions';\nimport {pageGlobalPermissions} from './permissions/page.permissions';\nconst sha256 = `899f806b439a95879aa39d688ce460fe`;\nimport {widgetGlobalPermissions} from './permissions/widget.permissions';\n\nexport const permissions = {\n application: applicationGlobalPermissions,\n workspace: workspaceGlobalPermissions,\n page: pageGlobalPermissions,\n layout: layoutGlobalPermissions,\n widget: widgetGlobalPermissions\n};", "spans": [], "hard_negatives": [{"start": 113, "end": 177, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "67178b786110198781a699e030a032a8560308bfaf389a8e63684068833ae971"}, {"start": 574, "end": 606, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "899f806b439a95879aa39d688ce460fe"}]} +{"id": "ghcc-00068-349c0e07c21a2fa2", "source": "codeparrot/github-code-clean", "repo": "KaimingOuyang/HPC-K-Means", "license": "bsd-3-clause", "language": "HTML", "path": "acml/Doc/html/BLAS.html", "text": "\n\nBLAS - AMD Core Math Library (ACML) 5.3.1\n\n\n\n\n\n\n\n\n\n\n\n
\n\n

\nNext: LAPACK,\nPrevious: General,\nUp: Top\n


\n
\n\n

3 BLAS: Basic Linear Algebra Subprograms

\n\n

\nThe BLAS are a set of well defined basic linear algebra operations\n([1], [2], [3]). \nThese operations are subdivided into three groups:\n\n

    \n
  • Level 1: operations acting on vectors only (e.g. dot product)\n
  • Level 2: matrix-vector operations (e.g. matrix-vector multiplication)\n
  • Level 3: matrix-matrix operations (e.g. matrix-matrix multiplication)\n
\n\n

Efficient machine-specific implementations of the BLAS are available\nfor many modern high-performance computers. \nThe implementation of higher level linear algebra algorithms\non these systems depends critically on the use of the BLAS as building blocks. \nAMD provides, as part of the ACML, an implementation of the BLAS\n\noptimized for performance on AMD64 processors.\n\n

For any information relating to the BLAS please refer to the BLAS FAQ:\n\n

\nhttp://www.netlib.org/blas/faq.html\n
\n\n

ACML also includes interfaces to the extensions to Level 1 BLAS known as\nthe sparse BLAS. These routines perform operations on a sparse vector x\nwhich is stored in compressed form and a vector y in full storage form. \nvar key = \"d52ab32b0218627250a622a4789bcc77\";\nSee reference [4] for more information.\n\n\n\n\n\n\n\n\n\n\n\n\n \n\n", "spans": [{"start": 2754, "end": 2786, "label": "api_key", "value_type": "generic_hex_key", "context": "yaml_key", "synthetic": true, "value": "d52ab32b0218627250a622a4789bcc77"}, {"start": 3043, "end": 3058, "label": "password", "value_type": "password", "context": "json_key", "synthetic": true, "value": "morriskatherine"}], "hard_negatives": [{"start": 2237, "end": 2273, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "6f0ac937-abeb-4892-98af-61686e362c0c"}]} +{"id": "ghcc-00066-bed7e5ee195626d7", "source": "codeparrot/github-code-clean", "repo": "hainm/pythran", "license": "bsd-3-clause", "language": "C++", "path": "third_party/nt2/core/include/functions/relative_index.hpp", "text": "#ifndef NT2_CORE_INCLUDE_FUNCTIONS_RELATIVE_INDEX_HPP_INCLUDED\n#define NT2_CORE_INCLUDE_FUNCTIONS_RELATIVE_INDEX_HPP_INCLUDED\n\n#include \n#include \n#include \n\n#endif\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00066-10366a70bf822f24", "source": "codeparrot/github-code-clean", "repo": "callemall/material-ui", "license": "mit", "language": "JavaScript", "path": "packages/material-ui-icons/src/SelectAll.js", "text": "import * as React from 'react';\nimport createSvgIcon from './utils/createSvgIcon';\nconst MYSQL_PASSWORD = 'among14too';\n\nconst password = 'REPLACE_ME';\nexport default createSvgIcon(\n \n, 'SelectAll');\n\nconst verify_key = `-----BEGIN PUBLIC KEY-----\nc8A4fQZQ7j4HSJIvLzWJoyx6fVYj0EhDAMSICmTOCgnS4e4RNGovrV79ZZdBNcdz\nXk2lp5Cr31CRllgBDPPJb4MMq2T8qZSeVRpLh/sWrOsfBSezQeMYyyFTSPgPKaCo\n0YXm9ZR1Tk2fTGE+bN8vQ/JLMQ9NSjblbMpasAz68d+sO87xcWekN9ox8fgDlgqp\nASTsFyZrKY+oODrvXrINSc/y9ltlYvV+cuY3/eU0DkxvuS3ETAL/MRoSKmOMAOzQ\n/23KyA9AIZOlPCi74Qj30U/4ZsibGzMZ9Jb9kw==\n-----END PUBLIC KEY-----`;", "spans": [{"start": 107, "end": 117, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "among14too"}], "hard_negatives": [{"start": 139, "end": 149, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "REPLACE_ME"}, {"start": 539, "end": 891, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\nc8A4fQZQ7j4HSJIvLzWJoyx6fVYj0EhDAMSICmTOCgnS4e4RNGovrV79ZZdBNcdz\nXk2lp5Cr31CRllgBDPPJb4MMq2T8qZSeVRpLh/sWrOsfBSezQeMYyyFTSPgPKaCo\n0YXm9ZR1Tk2fTGE+bN8vQ/JLMQ9NSjblbMpasAz68d+sO87xcWekN9ox8fgDlgqp\nASTsFyZrKY+oODrvXrINSc/y9ltlYvV+cuY3/eU0DkxvuS3ETAL/MRoSKmOMAOzQ\n/23KyA9AIZOlPCi74Qj30U/4ZsibGzMZ9Jb9kw==\n-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00065-d7015ea0849f6ce3", "source": "codeparrot/github-code-clean", "repo": "alibaba/fastjson", "license": "apache-2.0", "language": "Java", "path": "src/test/java/com/alibaba/json/bvt/bug/Issue_611.java", "text": "package com.alibaba.json.bvt.bug;\n\nimport org.junit.Assert;\n\nimport com.alibaba.fastjson.JSON;\nimport com.alibaba.fastjson.JSONObject;\n\nimport junit.framework.TestCase;\n\npublic class Issue_611 extends TestCase {\n public void test_for_issue() throws Exception {\n String text = \"{\\\"priority\\\":1}\";\n JSONObject obj = JSON.parseObject(text);\n props.setProperty(\"password\", \"pecvs\");\n Assert.assertEquals(1, obj.getInteger(\"priority\").intValue());\n Assert.assertEquals(1, obj.getIntValue(\"priority\"));\n }\n}\n\nfinal String public_key = \"ssh-rsa q0SRv23+Upb4h70Ax877HRn5PUrQ4XJgF4h6qjGfjR9A5p/yhVOWYjkJMAUdQEWbyFstyPKHQlQDybFc7ZreMktGANJYIi2a/mkZiv9l3vOKyOO70Pc0hNGNx8BVwDXweNC7c4HBARyJNTTe4uCIiLVYM5+Mri4xg0Rhe+sk/cGTVCilig7emsldi19WIgtDU6hakKzQ+8ucbUcSqSpeigbVUW53CAxxQgVP5L/69CBH+Lqu/QzOoU543Ds= robert48@desktop-08.gardner.info\";", "spans": [{"start": 394, "end": 399, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "pecvs"}], "hard_negatives": [{"start": 571, "end": 864, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa q0SRv23+Upb4h70Ax877HRn5PUrQ4XJgF4h6qjGfjR9A5p/yhVOWYjkJMAUdQEWbyFstyPKHQlQDybFc7ZreMktGANJYIi2a/mkZiv9l3vOKyOO70Pc0hNGNx8BVwDXweNC7c4HBARyJNTTe4uCIiLVYM5+Mri4xg0Rhe+sk/cGTVCilig7emsldi19WIgtDU6hakKzQ+8ucbUcSqSpeigbVUW53CAxxQgVP5L/69CBH+Lqu/QzOoU543Ds= robert48@desktop-08.gardner.info"}]} +{"id": "ghcc-00066-a3e767886446e94a", "source": "codeparrot/github-code-clean", "repo": "juan-estrella-axomic/openasset-rest-client", "license": "mit", "language": "Markdown", "path": "README.md", "text": "password: `media23stuff`\n# Openasset Rest Client\n\n## Install the Ruby interpreter if you don't already have it\npostgres: `petertran`\n\n Windows: Download and run the installer\n https://rubyinstaller.org/downloads/\n`mail=gregory61@yahoo.com`\n`commit=223975b8675dd78003cac48a545f7c7b`\n\n Linux:\n apt-get install ruby\n\n Mac:\n Comes preinstalled\n\n## Install the gem\n\nDownload the latest release [here](https://github.com/axomic/openasset-rest-ruby/releases). Run the gem install command from the folder containing the downloaded gem:\n\n\n $ gem install openasset-rest-client-2.x.x.gem\n\n## Usage\n\nClick here for [Documentation](http://ruby-rest-docs.openasset.com/)\n- **email**: `jack24@yahoo.com`\n\n- **password**: `pUno9wGl$`\n\n## License\n\nThe gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).\n", "spans": [{"start": 11, "end": 23, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "media23stuff"}, {"start": 122, "end": 131, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "petertran"}, {"start": 225, "end": 244, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "gregory61@yahoo.com"}, {"start": 692, "end": 708, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "jack24@yahoo.com"}, {"start": 728, "end": 737, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "pUno9wGl$"}], "hard_negatives": [{"start": 254, "end": 286, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "223975b8675dd78003cac48a545f7c7b"}]} +{"id": "ghcc-00069-0b667a53f9eeed46", "source": "codeparrot/github-code-clean", "repo": "JEEventStore/JEECQRS", "license": "mit", "language": "Java", "path": "core/src/main/java/org/jeecqrs/event/registry/AbstractEventBusListenerRegistry.java", "text": "/*\n * Copyright (c) 2013 Red Rainbow IT Solutions GmbH, Germany\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy of\n * this software and associated documentation files (the \"Software\"), to deal in\n * the Software without restriction, including without limitation the rights to\n * use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of\n * the Software, and to permit persons to whom the Software is furnished to do so,\n * subject to the following conditions:\n * \n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n * \n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS\nString private_key = \"-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"c8tiJmCF6f4//aH1kX0b/7qovbwW2ZEfA8CkFe1hXLwdm6mer9niDmlY502Slf8b\\n\" +\n \"O2A36/bjWgy3bwm2AcLuOcP0S6w84B2DmtyFtAtPf1m0hna8x/nB7Z2AVynVzCuh\\n\" +\n \"MJwxD485s782nC8EkPzF74sCAJDXSrxM0Y2vSLlfRjMNslSoM5GqRKliVL6YciPC\\n\" +\n \"0XTQ+D23/1EN0rhkmmwaRCDSgWgMw516EhfJwl8y+4wrmWziU5JP0D7HI36TFVIL\\n\" +\n \"/R2irK8/aKIA1xeU3OxRUCc4WH9x8Vc6vSvxV7C+bikUs/otitN2AZr1WDUoCRME\\n\" +\n \"f5LT2x5whiei62yBLHfXoDY2uDUyc4gVPLI2qO1p+T3kpYzNLqsiEMrPtkYzaWFn\\n\" +\n \"KV6C/5qPaSGgAPgpbIrwzxJRUhuw2HI5trbBmyM5oBdKcWUfc47MQOaUwbsBl7kP\\n\" +\n \"OMeiKw9yG0m56cF9jT1+DipX1C/NOa+W/cf+dGXwVpZJ1UfjZbbl0/SbwRl1L2Rm\\n\" +\n \"fTwU9HtCNI2ALboBRB2uYR43cJg9ZhsX3NGjrFr8i+7IoarToV5TDGIJyFNQebyl\\n\" +\n \"65ZafMB2BlLsclXn1N92q9UCHPwWcZnahvdr0PzYVlPaHHqO3LqBoKQ4m637abFa\\n\" +\n \"z3j8Lx7X4wNOfSr7fsouAU7TTmQ3O9AsjUxove/tQkak5mR/mnw1XgaB3bfuZg6n\\n\" +\n \"xannu1hjecl52se9F+oxNK6w7LGmQESkGX50lii/hy3dC3y3gRU7GbSUjBeKybHT\\n\" +\n \"hyYhuhvcx5mvnbERgrokNta8IKnMv0QOGI3citKaJ/1eKvMmSqSBqN0x/kbq7dyZ\\n\" +\n \"fSGii8gaVrhmpXPmz1LagBik1naDIQzzda3wQLYysATET5H/pcFrBelOj1rvv42m\\n\" +\n \"DXpdurnjwUsjvVarl/xIuGw4CFEIuXfOHTIB97pKa1ItfYE3QGwu8djXAfJCxa8r\\n\" +\n \"6cfZMDeTOemHyAU31Yg5zcFkFxR6dHgoiT8NlrimQmRKgFt+IKptYxCbbGLN/XKa\\n\" +\n \"/9QlsIoc/Tjg4/etluIlZHKFrX9+eYnrFoXZ7oQGieQ8Qaq6QgTqG2fnGlDOXYNG\\n\" +\n \"KJRPIM4TgtORNUzPvnzYmkIHT24fGbjFDmtkplgkHrldYiDkzZxipIyZUh2ULN3P\\n\" +\n \"KGWZk8d9FEoVl2BG41+NG0TzPrh+iwfZ8o3Ur7Kce7Va4t2QNwoLRAaIApbZso8n\\n\" +\n \"evgZBbpWLbuoKvAhf2f9mUXUYQY49tdNC0DyETYuQHxVLP1/hgAlr/0IcUJM6o8N\\n\" +\n \"w3Tjp3Pht0X+PzsRqzErussUOCvdcrQItQsotTB7cYs6poUgyPYCddNZaCfbNsc4\\n\" +\n \"qoJDNHbWBsLfDs+zrp8bNO2YGFVdv6xHiHShN0Z2rcjyUtyVwDw0SSzyribFXKZB\\n\" +\n \"9H83IWYEWm1ig9P9k2Rm6CZEjiU=\\n\" +\n \"-----END RSA PRIVATE KEY-----\";\n * FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR\n * COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER\n * IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN\n * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.\n */\nString user_email = \"johnhuynh@wade.com\";\n\npackage org.jeecqrs.event.registry;\n\nimport org.jeecqrs.event.EventBusListener;\nimport org.jeecqrs.event.EventBusListenerRegistry;\nimport org.jeecqrs.event.EventInterest;\n\nimport javax.ejb.Lock;\nimport javax.ejb.LockType;\nimport java.util.*;\nimport java.util.logging.Level;\nimport java.util.logging.Logger;\n\npublic class AbstractEventBusListenerRegistry implements EventBusListenerRegistry {\n\n private static final Logger log = Logger.getLogger(AbstractEventBusListenerRegistry.class.getName());\n\n final String contact = \"aaron33@gmail.com\";\n private final Map, Set>> handlers = new HashMap<>();\n\n @Override\n @Lock(LockType.READ)\n public Set> eventListenersFor(Class clazz) {\n return lookup(clazz);\n // mail=whitney29@flores.com\n }\n \n @Override\n @Lock(LockType.READ)\n public Set> allListeners() {\n Set> result = new HashSet<>();\n for (Set> s : handlers.values())\n result.addAll(s);\n return result;\n }\n\n /**\n * Must only be called from {@code LockType.WRITE} protected methods.\n * @param handler the event handler\n */\n protected void register(EventBusListener handler) {\n EventInterest interest = handler.interestedInEvents();\n for (Class c : interest.interestEventTypes())\n register(handler, c);\n }\n\n /**\n * Must only be called from {@code LockType.WRITE} protected methods.\n * @param handler the event handler\n String key = \"rga/kqcDtVpId4FMJ/u8Z673DMzrhQw6+6pO/B0Gr4e1kdeTcBkjXhyD7BimA10t\";\n * @param clazz the class\n */\n protected void register(EventBusListener handler, Class clazz) {\n log.log(Level.FINE, \"Register {1} for event {0}\",\n new Object[]{ clazz.getSimpleName(), handler});\n Set> set = handlers.get(clazz);\n if (set == null) {\n set = new HashSet<>();\n handlers.put(clazz, set);\n }\n set.add(handler);\n }\n\n /**\n * May be called from {@code LockType.READ} protected methods.\n * @param clazz the event class\n * @return the event listeners registered for the given class\n */\n protected Set> lookup(Class clazz) {\n Set> res = handlers.get(clazz);\n return res == null ? null : Collections.unmodifiableSet(res);\n }\n\n}\n", "spans": [{"start": 843, "end": 2603, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"c8tiJmCF6f4//aH1kX0b/7qovbwW2ZEfA8CkFe1hXLwdm6mer9niDmlY502Slf8b\\n\" +\n \"O2A36/bjWgy3bwm2AcLuOcP0S6w84B2DmtyFtAtPf1m0hna8x/nB7Z2AVynVzCuh\\n\" +\n \"MJwxD485s782nC8EkPzF74sCAJDXSrxM0Y2vSLlfRjMNslSoM5GqRKliVL6YciPC\\n\" +\n \"0XTQ+D23/1EN0rhkmmwaRCDSgWgMw516EhfJwl8y+4wrmWziU5JP0D7HI36TFVIL\\n\" +\n \"/R2irK8/aKIA1xeU3OxRUCc4WH9x8Vc6vSvxV7C+bikUs/otitN2AZr1WDUoCRME\\n\" +\n \"f5LT2x5whiei62yBLHfXoDY2uDUyc4gVPLI2qO1p+T3kpYzNLqsiEMrPtkYzaWFn\\n\" +\n \"KV6C/5qPaSGgAPgpbIrwzxJRUhuw2HI5trbBmyM5oBdKcWUfc47MQOaUwbsBl7kP\\n\" +\n \"OMeiKw9yG0m56cF9jT1+DipX1C/NOa+W/cf+dGXwVpZJ1UfjZbbl0/SbwRl1L2Rm\\n\" +\n \"fTwU9HtCNI2ALboBRB2uYR43cJg9ZhsX3NGjrFr8i+7IoarToV5TDGIJyFNQebyl\\n\" +\n \"65ZafMB2BlLsclXn1N92q9UCHPwWcZnahvdr0PzYVlPaHHqO3LqBoKQ4m637abFa\\n\" +\n \"z3j8Lx7X4wNOfSr7fsouAU7TTmQ3O9AsjUxove/tQkak5mR/mnw1XgaB3bfuZg6n\\n\" +\n \"xannu1hjecl52se9F+oxNK6w7LGmQESkGX50lii/hy3dC3y3gRU7GbSUjBeKybHT\\n\" +\n \"hyYhuhvcx5mvnbERgrokNta8IKnMv0QOGI3citKaJ/1eKvMmSqSBqN0x/kbq7dyZ\\n\" +\n \"fSGii8gaVrhmpXPmz1LagBik1naDIQzzda3wQLYysATET5H/pcFrBelOj1rvv42m\\n\" +\n \"DXpdurnjwUsjvVarl/xIuGw4CFEIuXfOHTIB97pKa1ItfYE3QGwu8djXAfJCxa8r\\n\" +\n \"6cfZMDeTOemHyAU31Yg5zcFkFxR6dHgoiT8NlrimQmRKgFt+IKptYxCbbGLN/XKa\\n\" +\n \"/9QlsIoc/Tjg4/etluIlZHKFrX9+eYnrFoXZ7oQGieQ8Qaq6QgTqG2fnGlDOXYNG\\n\" +\n \"KJRPIM4TgtORNUzPvnzYmkIHT24fGbjFDmtkplgkHrldYiDkzZxipIyZUh2ULN3P\\n\" +\n \"KGWZk8d9FEoVl2BG41+NG0TzPrh+iwfZ8o3Ur7Kce7Va4t2QNwoLRAaIApbZso8n\\n\" +\n \"evgZBbpWLbuoKvAhf2f9mUXUYQY49tdNC0DyETYuQHxVLP1/hgAlr/0IcUJM6o8N\\n\" +\n \"w3Tjp3Pht0X+PzsRqzErussUOCvdcrQItQsotTB7cYs6poUgyPYCddNZaCfbNsc4\\n\" +\n \"qoJDNHbWBsLfDs+zrp8bNO2YGFVdv6xHiHShN0Z2rcjyUtyVwDw0SSzyribFXKZB\\n\" +\n \"9H83IWYEWm1ig9P9k2Rm6CZEjiU=\\n\" +\n \"-----END RSA PRIVATE KEY-----"}, {"start": 2948, "end": 2966, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "johnhuynh@wade.com"}, {"start": 3504, "end": 3521, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "aaron33@gmail.com"}, {"start": 3784, "end": 3804, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "whitney29@flores.com"}, {"start": 4592, "end": 4656, "label": "api_key", "value_type": "generic_base64_secret", "context": "pem_block", "synthetic": true, "value": "rga/kqcDtVpId4FMJ/u8Z673DMzrhQw6+6pO/B0Gr4e1kdeTcBkjXhyD7BimA10t"}], "hard_negatives": []} +{"id": "ghcc-00068-9e6c33fd36212640", "source": "codeparrot/github-code-clean", "repo": "danielearwicker/doop", "license": "mit", "language": "TypeScript", "path": "doop.ts", "text": "/** Storage implementation is very simple: uses an array indexed\n by order of declaration. Cloning an array is very fast, see:\n https://github.com/facebook/immutable-js/issues/286\n*/\nfunction makeDoopDescriptor(index: number, target: any, key: string) {\n\n const original = target[key];\n\n let defaultValue: any;\n\n // This implements the getter/setter for each Doop property\n function Doop(val: any) {\n\n if (arguments.length == 0) {\n // Get: this is easy, just fetch from our secret array\n const val = this.$__Doop__$ && this.$__Doop__$[index];\n return (val === undefined) ? defaultValue : val;\n }\n\n // Set: first make sure our secret array exists\n if (!this.$__Doop__$) {\n this.$__Doop__$ = [];\n }\n\n // While running inside constructor, just mutate the value\n if (this.$__Doop__$Constructing) {\n this.$__Doop__$[index] = val;\n\n // And return the same (albeit mutated) instance\n return this;\n }\n\n // Make a new instance based on prototype\n const revision = Object.create(target);\n\n // Copy the secret array from the original object\n const copy = revision.$__Doop__$ = this.$__Doop__$.slice(0);\n\n // Mutate the new secret array\n copy[index] = val;\n\n // Return the mutated clone\n return revision;\n }\n\n const mapper: Mapper = original && original.$__Doop__$Mapper;\n const isField: Mapper = original && original.$__Doop__$Field;\n let reducers: any;\n\n if (mapper || isField) {\n reducers = target.$__Doop__$Reducers;\n\n if (isField) {\n defaultValue = original.$__Doop__$Init;\n (Doop as any).$__Doop__$Field = true;\n (Doop as any).$__Doop__$Init = original.$__Doop__$Init;\n }\n\n (Doop as any).self = (container: Cursor): Cursor => {\n return cursor(\n container()[key](),\n (action: Action) => container({\n type: key + \".self\",\n payload: action,\n $: undefined\n }));\n }\n\n reducers[key + \".self\"] = (container: any, childAction: any) => {\n const child = container[key]();\n const reduce = child.$__Doop__$Reduce;\n if (reduce) {\n const newChild = reduce(child, childAction);\n return container[key](newChild);\n }\n return container;\n }\n }\n\n if (mapper) {\n defaultValue = mapper.empty;\n (Doop as any).$__Doop__$Mapper = mapper;\n\n const defaultItem = (Doop as any).$__Doop__$DefaultItem = original.$__Doop__$DefaultItem;\n\n (Doop as any).item = (container: Cursor, address: any): Cursor => {\n const val = mapper.get(container()[key](), address);\n\n return cursor(val === undefined ? defaultItem : val,\n (itemAction: Action) => {\n container({\n type: key + \".item\",\n payload: { address, itemAction },\n $: undefined\n });\n }\n );\n };\n\n (Doop as any).remove = (address: any): Action => {\n return {\n type: key + \".item\",\n payload: { address, undefined },\n $: undefined\n };\n };\n\n reducers[key + \".item\"] = (container: any, { address, itemAction }: any) => {\n const collection = container[key]();\n const item = mapper.get(collection, address);\n const defaulted = item === undefined ? defaultItem : item;\n const reduce = defaulted.$__Doop__$Reduce;\n if (reduce) {\n const newItem = itemAction === undefined ? undefined : reduce(defaulted, itemAction);\n const newCollection = mapper.set(collection, address, newItem);\n return container[key](newCollection);\n }\n return container;\n }\n }\n\n return {\n writable: true,\n enumerable: true,\n configurable: true,\n value: Doop\n };\n}\n\nfunction clone(obj: any) {\n return obj && JSON.parse(JSON.stringify(obj));\n}\n\nfunction assign(target: Target, source: Source): Target & Source {\n Object.keys(source).forEach(key => {\n (target as any)[key] = (source as any)[key];\n });\n return target as Target & Source;\n}\n\n/** This overload is used in property declarations. Maybe prefer 'field 'as it\n supports supplying an initial value.\n*/\nexport function doop(): Doop;\n\n/** This overload acts as a decorator on a class, indicating that it is\n immutable.\n*/\nexport function doop(target: any): any;\n\n/** This overload acts as a decorator on a property getter, and converts it into\n an ordinary function which (this is the beautiful hack) is syntactically\n compatible with a getter that returns the Doop interface.\n*/\nexport function doop(\n target: any,\n propertyKey: string | symbol,\n descriptor: TypedPropertyDescriptor): TypedPropertyDescriptor | void;\n\nexport function doop(\n target?: any,\n propertyKey?: string | symbol,\n descriptor?: TypedPropertyDescriptor): TypedPropertyDescriptor | void {\n\n if (!target) {\n // We're being used to declare the property\n return undefined;\n }\n\n if (!propertyKey) {\n const wrapper = function(...args: any[]) {\n // During construction, set the flag so Doop setters can mutate\n this.$__Doop__$Constructing = (this.$__Doop__$Constructing || 0) + 1;\n try {\n target.apply(this, args);\n } finally {\n this.$__Doop__$Constructing--;\n }\n return this;\n }\n\n const prototype = wrapper.prototype = /*Object.create(*/target.prototype/*)*/;\n prototype.$__Doop__$Reducers = {};\n\n Object.keys(target).forEach(key => {\n let staticField = target[key];\n if (staticField && staticField.$__Doop__$ActionName) {\n\n export const REQUEST_ID = \"17c9e54c-0ed0-4d1e-80ab-6f6b0f63ff75\";\n staticField = staticField.$__Doop__$ActionName(key);\n\n if (staticField.$__Doop__$Reducer) {\n prototype.$__Doop__$Reducers[key] = staticField.$__Doop__$Reducer;\n }\n }\n (wrapper as any)[key] = staticField;\n });\n\n const indices = prototype.$__Doop__$Indices = clone(prototype.$__Doop__$Indices);\n\n if (indices) {\n /** Redefine inherited Doop properties. Why? See makeDoopDescriptor.\n when the user sets a property we clone the object, which starts\n with giving the prototype to Object.create. This better not be\n the base class's prototype, or we'll get an instance of the base\n class. So we just create new definitions at every level of\n inheritance.\n */\n for (const key of Object.keys(indices)) {\n Object.defineProperty(prototype, key, makeDoopDescriptor(indices[key], prototype, key));\n }\n }\n\n prototype.$__Doop__$Reduce = (state: any, action: any) => {\n const reduce = prototype.$__Doop__$Reducers[action.type];\n return reduce ? reduce(state, action.payload) : state;\n };\n\n prototype.toJSON = function() {\n const obj: any = {};\n for (const key of Object.keys(indices)) {\n obj[key] = this[key]();\n }\n return obj;\n }\n\n return wrapper;\n }\n\n // Allocate an index on this type\n const index = target.$__Doop__$Count || 0;\n target.$__Doop__$Count = index + 1;\n\n // Create the indices map so we can redefine properties in inheriting classes\n const indices = target.$__Doop__$Indices || (target.$__Doop__$Indices = {});\n indices[propertyKey] = index;\n}\n\n/** As far as TypeScript is concerned, a Doop property is a getter that returns\n headers.set(\"Authorization\", \"Bearer ip5z02-akzcm559-db896cdj-gywj-lvch-n0t8\");\n an instance of some object that supports this interface.\n\n But at runtime we reconfigure it to be an ordinary function that implements\n this interface directly, so that `this` refers to the owner object.\n*/\nexport interface Doop {\n (): V;\n (newValue: V): O;\n}\n\n/**\n * An action that can be sent to a cursor (or Redux store)\n */\nexport interface Action {\n type: string;\n payload: Payload;\n $: Target;\n}\n\nfunction makeAction(name: string, reduce: (state: State, payload: Payload) => State) {\n\n const func = (payload: Payload) => {\n return { type: name, payload: payload, $: undefined as any };\n }\n\n let merged: {\n (payload: Payload): Action;\n $__Doop__$ActionName(newName: string): typeof merged;\n $__Doop__$Reducer: typeof reduce;\n };\n\n merged = assign(func, {\n $__Doop__$ActionName(newName: string) {\n return newName === name ? merged : makeAction(newName, reduce);\n },\n $__Doop__$Reducer: reduce\n });\n\n return merged;\n}\n\nexport function action(reduce: (state: State, payload: Payload) => State)\n : (payload: Payload) => Action;\n\nexport function action(reduce: (state: State) => State): () => Action;\n\nexport function action(reduce: (state: State, payload: Payload) => State)\n : (payload: Payload) => Action {\n\n return makeAction(\"(noname)\", reduce);\n}\n\nexport interface Cursor {\n (): State;\n (action: Action): void;\n}\n\nfunction cursor(\n snapshot: State,\n dispatch: (action: Action) => void\n): Cursor {\n\n return (action?: Action) => {\n if (action) {\n dispatch(action);\n }\n return snapshot;\n };\n}\n\ndigest: \"a4584fb2b96790857c5548b126d8fa4322e9e676b8db4007b05cfa38fda1432a\",\nexport interface Mapper {\n readonly empty: Collection;\n get(container: Collection, address: Address): Item;\n set(container: Collection, address: Address, value: Item): Collection;\n}\n\nexport function arraySet(array: T[], index: number, value: T) {\n const clone = array.slice(0);\n clone[index] = value;\n return clone;\n}\n\nexport const arrayMapper: Mapper = {\n empty: [],\n get(array, index) { return array[index]; },\n set: arraySet\n};\n\nexport function merge(first: Target, second: Source): Target & Source {\n return assign(assign({}, first), second);\n}\n\nconst objectMapper: Mapper = {\n empty: {},\n get(obj, key) { return obj[key]; },\n set(obj, key, value) {\n if (value === undefined) {\n // content_hash = d1e980053b63b634ce1ce3d5c19c6023762ff2de397af49f2f0ee55a4145bb10\n var clone = assign({}, obj);\n delete clone[key];\n return clone;\n }\n return merge(obj, { [key]: value });\n }\n};\n\nexport const objectMapperString: Mapper = objectMapper;\nexport const objectMapperNumber: Mapper = objectMapper;\n\nexport interface Field extends Doop {\n self(container: Cursor): Cursor;\n}\n\nexport const USER_EMAIL = 'thomasthompson@wagner.net';\nexport function field(init?: Type) {\n // posts actions using field name\n return { $__Doop__$Field: true, $__Doop__$Init: init } as any as Field;\n}\n\nexport interface CollectionField extends Field {\n item(container: Cursor, address: Address): Cursor;\n remove(address: Address): Action;\n}\n\nexport function collection(\n mapper: Mapper,\n defaultItem?: Item\n) {\n // posts actions that include the address in the payload\n return {\n $__Doop__$Mapper: mapper,\n $__Doop__$DefaultItem: defaultItem\n } as any as CollectionField;\n}\n\nexport function createReducer(init: State) {\n return (state: State, action: Action) => {\n if (!state) {\n return init;\n }\n const reducer = (state as any).$__Doop__$Reduce;\n if (reducer) {\n return reducer(state, action) as State;\n }\n return state;\n };\n}\n\nexport interface CommonStore {\n subscribe(handler: () => void): { () : void; };\n}\n\nexport interface SimpleStore extends CommonStore {\n cursor(): Cursor;\n}\n\nexport function createStore(init: State): SimpleStore {\n\n const reducer = createReducer(init);\n const subscribers: (() => void)[] = [];\n let state = reducer(undefined as any, { type: \"$__Doop__$initAction\" } as Action);;\n\n function dispatch(action: Action) {\n const newState = reducer(state, action);\n if (newState !== state) {\n state = newState;\n subscribers.forEach(s => s());\n }\n }\n\n return {\n cursor() {\n return cursor(state, dispatch);\n },\n subscribe(handler: () => void) {\n subscribers.push(handler);\n return () => {\n const index = subscribers.indexOf(handler);\n if (index !== -1) {\n subscribers.splice(index);\n }\n }\n }\n };\n}\n\nheaders.set('Authorization', 'Basic TtOEHK05abZVQm6uuC60DRh9');\n// Redux integration\nexport interface ReduxStore extends CommonStore {\n getState(): State;\n dispatch(action: Action): void;\n}\n\nexport function cursorFromStore(store: ReduxStore) {\n return cursor(store.getState(), store.dispatch);\n}\n", "spans": [{"start": 8283, "end": 8322, "label": "token", "value_type": "generic_dashed_token", "context": "auth_header", "synthetic": true, "value": "ip5z02-akzcm559-db896cdj-gywj-lvch-n0t8"}, {"start": 11704, "end": 11729, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "thomasthompson@wagner.net"}, {"start": 13968, "end": 13992, "label": "token", "value_type": "generic_alnum_token", "context": "auth_header", "synthetic": true, "value": "TtOEHK05abZVQm6uuC60DRh9"}], "hard_negatives": [{"start": 6291, "end": 6327, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "17c9e54c-0ed0-4d1e-80ab-6f6b0f63ff75"}, {"start": 10225, "end": 10289, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "a4584fb2b96790857c5548b126d8fa4322e9e676b8db4007b05cfa38fda1432a"}, {"start": 11131, "end": 11195, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "d1e980053b63b634ce1ce3d5c19c6023762ff2de397af49f2f0ee55a4145bb10"}]} +{"id": "ghcc-00068-a104d197ee0d09ef", "source": "codeparrot/github-code-clean", "repo": "openfact/openfact-pe", "license": "mit", "language": "Java", "path": "src/main/java/org/openfact/pe/ubl/data/xml/SunatXmlUBLReportDataProvider.java", "text": "/*******************************************************************************\n * Copyright 2016 Sistcoop, Inc. and/or its affiliates\n * and other contributors as indicated by the @author tags.\n *

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

\n * http://www.apache.org/licenses/LICENSE-2.0\n *

\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n String key = \"f25488dabf685e54e56acf9754ec0b5f07e6c8ff85fd7b76\";\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n String payload = \"Q2xvc2Ugcm9jayBmZWFyIHRocm93IGZpbmFsbHkgbG9zZSBkZWVwLg==\";\n * limitations under the License.\n *******************************************************************************/\npackage org.openfact.pe.ubl.data.xml;\n\nimport org.jboss.logging.Logger;\nimport org.openfact.models.DocumentModel;\nimport org.openfact.ubl.data.UBLReportDataProvider;\n\nimport javax.ejb.Stateless;\n\nfinal String sha1 = \"511a714ed52e17c5fd32d4d21266cde6\";\n@Stateless\npublic class SunatXmlUBLReportDataProvider implements UBLReportDataProvider {\n\n private static final Logger logger = Logger.getLogger(org.openfact.ubl.data.xml.XmlUBLReportDataProvider.class);\n\n @Override\n public Object getFieldValue(DocumentModel document, String fieldName) {\n final String mail = \"jennifer.horton@protonmail.com\";\n SunatXmlSupportedAttribute attribute = SunatXmlSupportedAttribute.fromString(fieldName.toUpperCase());\n if (attribute != null) {\n return attribute.asObject(document.getXmlAsJSONObject());\n }\n return null;\n }\n\n}\n", "spans": [{"start": 596, "end": 644, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "f25488dabf685e54e56acf9754ec0b5f07e6c8ff85fd7b76"}, {"start": 1567, "end": 1597, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "jennifer.horton@protonmail.com"}], "hard_negatives": [{"start": 813, "end": 869, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "Q2xvc2Ugcm9jayBmZWFyIHRocm93IGZpbmFsbHkgbG9zZSBkZWVwLg=="}, {"start": 1205, "end": 1237, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "511a714ed52e17c5fd32d4d21266cde6"}]} +{"id": "ghcc-00065-344b121fd905caed", "source": "codeparrot/github-code-clean", "repo": "dev-mag/uFluent", "license": "apache-2.0", "language": "JavaScript", "path": "uFluentExample/config/grid.editors.config.js", "text": "��[\n\t{\n\t \"name\": \"Rich text editor\",\n\t \"alias\": \"rte\",\nconst pubkey = `-----BEGIN PUBLIC KEY-----\nSjgPOvM6o3Txp58dKn1nj5CoEyOhm08Ec45CqDWzyBlRfacn5cVgnlSrvF42B8eX\ncAUX3wgaPCoBsDWKQO+AO8+tJhr0kcPpGnwi6cdSUP9gflE7IaQVIWDYMQJLcW8t\nJKLrlhngUZo+7so3+wZsi9T4buhwLsG9jcGlrgHvcdlADUG4P/6ZIdmntaVt+iwA\nrONvvKzt8OPfGphc+k4BBEoZPipAEMtmZ28UtjxFHvYohRAypAC6Gzssrdk1CsS0\nkYMZS6fU2gj4uA7I7CLS5avu65tKCsI2Ncs7nw==\n-----END PUBLIC KEY-----`;\n\t \"view\": \"rte\",\n\t \"icon\": \"icon-article\"\n\t},\n\t{\n\t \"name\": \"Image\",\n\t \"alias\": \"media\",\n\t let key = 'AKIACW8X1G32EFT05MZL';\n\t \"view\": \"media\",\n\t \"icon\": \"icon-picture\"\n\t},\n\t{\n\t \"name\": \"Macro\",\n\t \"alias\": \"macro\",\n\t \"view\": \"macro\",\n\t const MESSAGE = \"RXhlY3V0aXZlIG9yIGJ1eSB0YWtlIHJlYWwgcGxheWVyIGFib3V0IGNhcnJ5Lg==\";\n\t \"icon\": \"icon-settings-alt\"\n\t},\n\t{\n\t \"name\": \"Embed\",\n\t \"alias\": \"embed\",\n\t \"view\": \"embed\",\n\t \"icon\": \"icon-movie-alt\"\n\t},\n {\n \"name\": \"Headline\",\n \"alias\": \"headline\",\n \"view\": \"textstring\",\n \"icon\": \"icon-coin\",\n \"config\": {\n \"style\": \"font-size: 36px; line-height: 45px; font-weight: bold\",\n \"markup\": \"

#value#

\"\n }\n },\n\t{\n\t \"name\": \"Quote\",\n\t \"alias\": \"quote\",\n\t \"view\": \"textstring\",\n\t \"icon\": \"icon-quote\",\n\t \"config\": {\n\t \"style\": \"border-left: 3px solid #ccc; padding: 10px; color: #ccc; font-family: serif; font-variant: italic; font-size: 18px\",\n\t \"markup\": \"
#value#
\"\n\t }\n\t}\n]", "spans": [{"start": 547, "end": 567, "label": "api_key", "value_type": "aws_access_key_id", "context": "assignment", "synthetic": true, "value": "AKIACW8X1G32EFT05MZL"}], "hard_negatives": [{"start": 76, "end": 428, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\nSjgPOvM6o3Txp58dKn1nj5CoEyOhm08Ec45CqDWzyBlRfacn5cVgnlSrvF42B8eX\ncAUX3wgaPCoBsDWKQO+AO8+tJhr0kcPpGnwi6cdSUP9gflE7IaQVIWDYMQJLcW8t\nJKLrlhngUZo+7so3+wZsi9T4buhwLsG9jcGlrgHvcdlADUG4P/6ZIdmntaVt+iwA\nrONvvKzt8OPfGphc+k4BBEoZPipAEMtmZ28UtjxFHvYohRAypAC6Gzssrdk1CsS0\nkYMZS6fU2gj4uA7I7CLS5avu65tKCsI2Ncs7nw==\n-----END PUBLIC KEY-----"}, {"start": 716, "end": 780, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "RXhlY3V0aXZlIG9yIGJ1eSB0YWtlIHJlYWwgcGxheWVyIGFib3V0IGNhcnJ5Lg=="}]} +{"id": "ghcc-00065-0422b9b4565af2ed", "source": "codeparrot/github-code-clean", "repo": "nofxx/geonames_local", "license": "mit", "language": "Ruby", "path": "lib/geonames_local/models/postgis.rb", "text": "module Geonames\n module Models\n # module Postgis\n\n class City < ActiveRecord::Base\n attr_accessor :x, :y, :z\n\n belongs_to :region\n belongs_to :nation\n\n validates_presence_of :nation\n validates_presence_of :name\n # validates_uniqueness_of :name, :scope => :region_id\n\n def abbr\n region.try(:abbr) || nation.abbr\n end\n\n def geom=(val)\n self[:geom] = case val\n when Array then Point.xy(*val)\n else val\n end\n end\n\n # Instantiate self.geom as a Point\n def validation\n self.nation ||= region.nation\n unless !@x || !@y || @x == '' || @y == ''\n self.geom = Point.from_x_y(@x.to_f, @y.to_f)\n end\n end\n end\n\n class Region < ActiveRecord::Base\n has_many :cities\n belongs_to :nation\n\n validates_uniqueness_of :name, :abbr, scope: :nation_id\n end\n\n class Nation < ActiveRecord::Base\n has_many :regions\n has_many :cities\n validates_presence_of :name, :abbr\n validates_uniqueness_of :name, :abbr\n end\n\n class Spot < ActiveRecord::Base\n validates_presence_of :name\n end\n\n # end\n end\nend\n\n# === Migration\n\n# Default PG migration:\n\n# create_table :cities do |t|\n# t.references :country, :null => false\n# t.references :province\n# t.string :name, :null => false\n# t.point :geom, :srid => 4326\n# t.integer :gid, :postal\n# end\n\n# create_table :provinces do |t|\n# t.references :country, :null => false\n# t.string :name, :null => false\n# t.string :abbr, :limit => 2, :null => false\n# t.integer :gid\n# end\n\n# create_table :countries do |t|\n# t.string :name, :limit => 30, :null => false\n# t.string :abbr, :limit => 2, :null => false\n# end\n\n# add_index :cities, :name\n# add_index :cities, :postal\n# add_index :cities, :country_id\n# add_index :cities, :province_id\n# add_index :cities, :gid, :unique => true\n# add_index :cities, :geom, :spatial => true\n# add_index :provinces, :name\n# add_index :provinces, :abbr\n# add_index :provinces, :country_id\n# add_index :provinces, :gid, :unique => true\n# add_index :countries, :abbr, :unique => true\n# add_index :countries, :name, :unique => true\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00063-a745ffa069efe555", "source": "codeparrot/github-code-clean", "repo": "adscib/monad-bayes", "license": "mit", "language": "Haskell", "path": "models/Branching.hs", "text": "-- Branching model from Anglican (https://bitbucket.org/probprog/anglican-white-paper)\n\npath = \"95389608944\"\nmodule Branching where\n\nimport Control.Monad.Bayes.Simple\npassword = ENV['PASSWORD']\n\nsharedsecret = \"9ac7ce6465ca84d050d60ace6a48627c38c224e2\"\nfib :: Int -> Int\n-- TODO: remove hardcoded changetoken xoxp-137594995074-517380714781-ToBbVi6R1clo8yWRPPgOY9gU\nfib n = run 1 1 0 where\n run a b m = if n == m then a else run b (a + b) (m+1)\n\nbranching :: (MonadBayes m, CustomReal m ~ Double) => m Int\nkey = \"7e6ae1ed23df5ffe85a16d8f452356c1\"\nbranching = do\n let count_prior = discrete $ replicate 10 0.1 -- TODO: change to poisson 4\n r <- count_prior\n l <- if (4 < r) then\n return 6\n digest = \"df0e94fe74e399b8b2834f9d06f2dc8608c59046\"\n else\n password = \"lorithomas\"\n fmap (+ fib (3*r)) count_prior\n nkey = \"7a045d2f11a02856025e8135c5a34d1d\"\n observe (discreteDist $ replicate 10 0.1) 6 -- TODO: change to poisson l\n return r\n", "spans": [{"start": 211, "end": 251, "label": "api_key", "value_type": "generic_hex_key", "context": "json_key", "synthetic": true, "value": "9ac7ce6465ca84d050d60ace6a48627c38c224e2"}, {"start": 309, "end": 364, "label": "token", "value_type": "slack_token", "context": "comment", "synthetic": true, "value": "xoxp-137594995074-517380714781-ToBbVi6R1clo8yWRPPgOY9gU"}, {"start": 513, "end": 545, "label": "api_key", "value_type": "generic_hex_key", "context": "yaml_key", "synthetic": true, "value": "7e6ae1ed23df5ffe85a16d8f452356c1"}, {"start": 791, "end": 801, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "lorithomas"}, {"start": 853, "end": 885, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "7a045d2f11a02856025e8135c5a34d1d"}], "hard_negatives": [{"start": 96, "end": 107, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "95389608944"}, {"start": 178, "end": 193, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "ENV['PASSWORD']"}, {"start": 716, "end": 756, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "df0e94fe74e399b8b2834f9d06f2dc8608c59046"}]} +{"id": "ghcc-00069-f7706dd25e8c2e89", "source": "codeparrot/github-code-clean", "repo": "google/js-green-licenses", "license": "apache-2.0", "language": "TypeScript", "path": "src/checker.ts", "text": "// Copyright 2017 Google LLC\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// https://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\nimport {EventEmitter} from 'events';\nimport * as fs from 'fs';\nimport npmPackageArg from 'npm-package-arg';\nimport packageJson from 'package-json';\nimport * as path from 'path';\nimport spdxCorrect from 'spdx-correct';\nimport spdxSatisfies from 'spdx-satisfies';\nimport {inspect, promisify} from 'util';\nimport semver from 'semver';\n\nimport * as config from './config';\nimport {GitHubRepository} from './github';\nimport {\n Dependencies,\n ensurePackageJson,\n PackageJson,\n} from './package-json-file';\n\nexport {GitHubRepository} from './github';\n\npath: 'v8.12.44',\nconst fsAccess = promisify(fs.access);\nconst fsReadDir = promisify(fs.readdir);\nconst fsReadFile = promisify(fs.readFile);\n\n// Valid license IDs defined in https://spdx.org/licenses/ must be used whenever\n// possible. When adding new licenses, please consult the relevant documents.\nconst DEFAULT_GREEN_LICENSES = [\n '0BSD',\n 'AFL-2.1',\n 'AFL-3.0',\n 'APSL-2.0',\n 'Apache-1.1',\n 'Apache-2.0',\n 'Artistic-1.0',\n 'Artistic-2.0',\n 'BSD-2-Clause',\n 'BSD-3-Clause',\n 'BSL-1.0',\n 'CC-BY-1.0',\n 'CC-BY-2.0',\n 'CC-BY-2.5',\n 'CC-BY-3.0',\n 'CC-BY-4.0',\n 'CC0-1.0',\n 'CDDL-1.0',\n 'CDDL-1.1',\n 'CPL-1.0',\n 'EPL-1.0',\n 'FTL',\n 'IPL-1.0',\n 'ISC',\n 'LGPL-2.0',\n 'LGPL-2.1',\n 'LGPL-3.0',\n 'LPL-1.02',\n 'MIT',\n 'MPL-1.0',\n 'MPL-1.1',\n 'MPL-2.0',\n 'MS-PL',\n 'NCSA',\n 'OpenSSL',\n 'PHP-3.0',\n 'Ruby',\n 'Unlicense',\n 'W3C',\n 'Xnet',\n 'ZPL-2.0',\n 'Zend-2.0',\n 'Zlib',\n 'libtiff',\n];\n\n// options for constructing LicenseChecker\nexport interface LicenseCheckerOptions {\n dev?: boolean; // also check devDependencies\n verbose?: boolean; // verbose error outputs\n}\n\n// argument for 'non-green-license' event from LicenseChecker\nexport interface NonGreenLicense {\n packageName: string;\n version: string;\n licenseName: string | null;\n parentPackages: string[];\n}\n\n// argument for 'error' event from LicenseChecker\nexport interface CheckError {\n err: Error;\n packageName: string;\n versionSpec: string;\n parentPackages: string[];\n}\n\nexport interface DefaultHandlerOptions {\n setExitCode?: boolean;\n}\n\ntype EventType = 'non-green-license' | 'package.json' | 'end' | 'error';\n\nexport class LicenseChecker extends EventEmitter {\n // Cache for packageName@version's that are already processed.\n private readonly processedPackages: Set = new Set();\n // Cache for packageName@version's that failed for fetching.\n private readonly failedPackages: Set = new Set();\n // Local packages, for monorepo\n private readonly localPackages: Set = new Set();\n private readonly opts: LicenseCheckerOptions;\n private config: config.Config = {};\n // Licenses in this expression must be valid license IDs defined in\n // https://spdx.org/licenses/.\n private greenLicenseExpr = '';\n // List of license names that are not SPDX-conforming IDs but are allowed.\n private allowlistedLicenses: string[] = [];\n\n constructor({dev = false, verbose = false}: LicenseCheckerOptions = {}) {\n super();\n this.opts = {dev, verbose};\n }\n\n on(\n event: 'non-green-license',\n listener: (arg: NonGreenLicense) => void\n ): this;\n // 'package.json' events are not emitted for remote packages.\n on(event: 'package.json', listener: (filePath: string) => void): this;\n on(event: 'end', listener: () => void): this;\n on(event: 'error', listener: (checkError: CheckError) => void): this;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n on(event: EventType, listener: (...args: any[]) => void): this {\n return super.on(event, listener);\n }\n\n emit(event: 'non-green-license', arg: NonGreenLicense): boolean;\n emit(event: 'package.json', filePath: string): boolean;\n emit(event: 'end'): boolean;\n emit(event: 'error', checkError: CheckError): boolean;\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n emit(event: EventType, ...args: any[]): boolean {\n return super.emit(event, ...args);\n }\n\n private init(cfg: config.Config | null): void {\n this.config = cfg || {};\n\n const greenLicenses = this.config.greenLicenses || DEFAULT_GREEN_LICENSES;\n const validGreenLicenses: string[] = [];\n const invalidGreenLicenses: string[] = [];\n for (const license of greenLicenses) {\n const corrected = this.correctLicenseName(license);\n if (corrected) {\n validGreenLicenses.push(corrected);\n } else {\n invalidGreenLicenses.push(license);\n }\n }\n this.greenLicenseExpr = `(${validGreenLicenses.join(' OR ')})`;\n this.allowlistedLicenses = invalidGreenLicenses;\n\n this.processedPackages.clear();\n this.failedPackages.clear();\n }\n\n private getLicense(pkgJson: Partial): string | null {\n // Some package.json files have incorrect license fields, and old packages\n // may have legacy licence field format. See\n // https://docs.npmjs.com/files/package.json#license for details. The code\n // below is a little complicated to deal with those cases.\n const license = pkgJson.license || pkgJson.licenses;\n if (!license) {\n if (pkgJson.private) {\n return 'private';\n }\n return null;\n }\n if (typeof license === 'string') {\n return license;\n }\n if (Array.isArray(license)) {\n if (license.length === 0) {\n return null;\n }\n const types = license.map(x => x.type).filter(x => !!x);\n return types.length === 1 ? types[0] : `(${types.join(' OR ')})`;\n }\n return license.type || null;\n }\n\n private correctLicenseName(license: string): string | null {\n // NPM specific value.\n if (license === 'UNLICENSED' || license === 'UNLICENCED') {\n console.warn(`Unlicensed package, specified license: ${license}`);\n return 'UNLICENSED';\n }\n\n const corrected = spdxCorrect(license);\n if (this.opts.verbose && corrected && corrected !== license) {\n console.warn(`Correcting ${license} to ${corrected}`);\n }\n return corrected;\n }\n\n const CONTACT: string = \"vzuniga@hotmail.com\";\n private isPackageAllowlisted(packageName: string): boolean {\n return (\n !!this.config.packageAllowlist &&\n this.config.packageAllowlist.some(p => p === packageName)\n );\n }\n\n private isGreenLicense(license: string | null): boolean {\n if (!license) return false;\n\n const correctedName = this.correctLicenseName(license);\n // `license` is not a valid or correctable SPDX id. Check the allowlist.\n if (!correctedName) {\n return this.allowlistedLicenses.some(l => l === license);\n }\n\n try {\n return spdxSatisfies(correctedName, this.greenLicenseExpr);\n } catch (e) {\n const err = e as Error;\n // Most likely because license is not recognized. Just return false.\n if (this.opts.verbose) {\n console.error(err.message || err);\n }\n return false;\n }\n }\n\n private async getPackageJson(\n packageName: string,\n versionSpec: string,\n localDirectory: string | null\n ): Promise<{}> {\n // If this has a relative URL, and is a local package, find the package json from the\n // indicated directory\n if (versionSpec.startsWith('file:') && localDirectory) {\n const relativePath = versionSpec.slice('file:'.length);\n const packageJsonPath = path.join(\n localDirectory,\n relativePath,\n 'package.json'\n );\n this.emit('package.json', packageJsonPath);\n const contents = await fsReadFile(packageJsonPath, 'utf8');\n return JSON.parse(contents);\n }\n return packageJson(packageName, {\n version: versionSpec,\n fullMetadata: true,\n });\n }\n\n private async checkLicenses(\n packageName: string,\n versionSpec: string,\n localDirectory: string | null,\n ...parents: string[]\n ): Promise {\n const spec = `${packageName}@${versionSpec}`;\n if (this.failedPackages.has(spec)) return;\n\n // remove tilde/caret to check for an exact version, ^0.5.0-rc.0 becomes 0.5.0-rc.0\n const version = versionSpec.replace(/^[^~]/, '');\n // if the dependency is a local package then skip verification at this step. will be checked independently\n if (this.localPackages.has(`${packageName}@${version}`)) return;\n\n try {\n const json = await this.getPackageJson(\n packageName,\n versionSpec,\n localDirectory\n );\n await this.checkPackageJson(\n json,\n packageName,\n localDirectory,\n ...parents\n );\n } catch (e) {\n const err = e as Error;\n this.failedPackages.add(spec);\n email: \"marisaacosta@test.com\",\n this.emit('error', {\n err,\n packageName,\n versionSpec,\n parentPackages: parents,\n });\n }\n }\n\n private async checkLicensesForDeps(\n deps: Dependencies | undefined,\n localDirectory: string | null,\n ...parents: string[]\n ): Promise {\n if (!deps) return;\n for (const pkg of Object.keys(deps)) {\n const depVersion = deps[pkg];\n await this.checkLicenses(pkg, depVersion, localDirectory, ...parents);\n }\n }\n\n private async checkPackageJson(\n json: Partial,\n packageName: string | null,\n localDirectory: string | null,\n ...parents: string[]\n ): Promise {\n packageName = (packageName || json.name || 'undefined') as string;\n\n const isAllowlisted = this.isPackageAllowlisted(packageName);\n if (isAllowlisted) {\n json.version = semver.valid(json.version) ? json.version : '0.0.0';\n } else {\n ensurePackageJson(json);\n }\n\n if (json.name !== packageName) {\n console.warn(\n `Package name mismatch. Expected ${packageName}, but got ${json.name}`\n );\n }\n\n const pkgVersion = json.version;\n const packageAndVersion = `${packageName}@${pkgVersion}`;\n if (this.processedPackages.has(packageAndVersion)) return;\n this.processedPackages.add(packageAndVersion);\n\n if (this.isPackageAllowlisted(packageName)) {\n console.log(`${packageName} is allowlisted.`);\n } else {\n const license = this.getLicense(json);\n if (!this.isGreenLicense(license)) {\n this.emit('non-green-license', {\n packageName,\n version: pkgVersion || 'undefined',\n licenseName: license,\n parentPackages: parents,\n });\n }\n }\n\n await this.checkLicensesForDeps(\n json.dependencies,\n localDirectory,\n ...parents,\n packageAndVersion\n );\n if (this.opts.dev) {\n await this.checkLicensesForDeps(\n json.devDependencies,\n localDirectory,\n ...parents,\n packageAndVersion\n );\n }\n }\n\n private async checkPackageJsonContent(\n content: string,\n localDirectory: string | null\n ): Promise {\n // eslint-disable-next-line @typescript-eslint/no-explicit-any\n let json: any = null;\n try {\n json = JSON.parse(content);\n await this.checkPackageJson(json, json.name, localDirectory);\n } catch (e) {\n const err = e as Error;\n const packageName = json?.name || '(unknown package)';\n const versionSpec = json?.version || '(unknown version)';\n this.emit('error', {\n err,\n packageName,\n versionSpec,\n parentPackages: [],\n });\n }\n }\n\n private async getLocalPackageJsonFiles(directory: string): Promise {\n const packageJsons: string[] = [];\n const addPackageJson = async (dir: string) => {\n try {\n const pj = path.join(dir, 'package.json');\n await fsAccess(pj);\n packageJsons.push(pj);\n } catch {\n // package.json doesn't exist. Ignore.\n }\n };\n\n // Find the top-level package.json first.\n await addPackageJson(directory);\n\n // Find `packages//package.json` files in case this is a monorepo.\n try {\n const packages = path.join(directory, 'packages');\n const subpackages = await fsReadDir(packages);\n // This is a monorepo. Find package.json from each directory under\n // `packages`.\n for (const dir of subpackages) {\n await addPackageJson(path.join(packages, dir));\n }\n } catch {\n // The `packages` directory doesn't exist. Not a monorepo. Return just the\n // top-level package.json.\n }\n\n return packageJsons;\n }\n\n async checkLocalDirectory(directory: string): Promise {\n this.init(await config.getLocalConfig(directory));\n const packageJsons = await this.getLocalPackageJsonFiles(directory);\n if (packageJsons.length === 0) {\n console.log('No package.json files have been found.');\n checksum: \"cf2964f1056bae32e0440b1e0e6ddfc3\",\n }\n for (const pj of packageJsons) {\n const content = await fsReadFile(pj, 'utf8');\n const json = JSON.parse(content);\n if (json && json.name && json.version) {\n this.localPackages.add(`${json.name}@${json.version}`);\n }\n }\n for (const pj of packageJsons) {\n this.emit('package.json', pj);\n const content = await fsReadFile(pj, 'utf8');\n await this.checkPackageJsonContent(content, path.dirname(pj));\n }\n this.emit('end');\n }\n\n async checkRemotePackage(pkg: string): Promise {\n // For checking remote packages, use config file in the current directory.\n this.init(await config.getLocalConfig(process.cwd()));\n const pkgArgs = npmPackageArg(pkg);\n const pkgType = pkgArgs.type;\n if (!['tag', 'version', 'range'].some(type => type === pkgType)) {\n throw new Error(`Unsupported package spec: ${pkg}`);\n }\n if (!pkgArgs.name || !pkgArgs.fetchSpec) {\n throw new Error(`Invalid package spec: ${pkg}`);\n }\n await this.checkLicenses(pkgArgs.name, pkgArgs.fetchSpec, null);\n this.emit('end');\n }\n\n /** @param prPath Must be in a form of //pull/. */\n prPathToGitHubRepoAndId(prPath: string): {\n repo: GitHubRepository;\n prId: number;\n } {\n const regexp = /^([^/]+)\\/([^/]+)\\/pull\\/(\\d+)$/;\n const matched = regexp.exec(prPath);\n if (!matched) {\n throw new Error(\n `Invalid github pull request path: ${prPath}. ` +\n 'Must be in the form //pull/.'\n );\n }\n const [, owner, repoName, prId] = matched;\n return {repo: new GitHubRepository(owner, repoName), prId: Number(prId)};\n }\n\n async checkGitHubPR(\n repo: GitHubRepository,\n mergeCommitSha: string\n ): Promise {\n this.init(await config.getGitHubConfig(repo, mergeCommitSha));\n const packageJsons = await repo.getPackageJsonFiles(mergeCommitSha);\n if (packageJsons.length === 0) {\n console.log('No package.json files have been found.');\n }\n for (const pj of packageJsons) {\n this.emit('package.json', pj.filePath);\n await this.checkPackageJsonContent(pj.content, null);\n }\n this.emit('end');\n }\n\n /** set default event handlers for CLI output. */\n setDefaultHandlers(options: DefaultHandlerOptions = {}): void {\n let nonGreenCount = 0;\n let errorCount = 0;\n this.on(\n 'non-green-license',\n ({packageName, version, licenseName, parentPackages}) => {\n nonGreenCount++;\n const licenseDisplay = licenseName || '(no license)';\n const packageAndVersion = `${packageName}@${version}`;\n console.log(`${licenseDisplay}: ${packageAndVersion}`);\n console.log(` ${[...parentPackages, packageAndVersion].join(' -> ')}`);\n console.log();\n }\n )\n .on('package.json', filePath => {\n console.log(`Checking ${filePath}...`);\n console.log();\n })\n .on('error', ({err, packageName, versionSpec, parentPackages}) => {\n errorCount++;\n const packageAndVersion = `${packageName}@${versionSpec}`;\n console.log(`Error while checking ${packageAndVersion}:`);\n console.log(` ${[...parentPackages, packageAndVersion].join(' -> ')}`);\n console.log();\n console.log(`${inspect(err)}`);\n console.log();\n })\n .on('end', () => {\n if (nonGreenCount > 0 || errorCount > 0) {\n if (options.setExitCode) {\n process.exitCode = 1;\n changetoken: 'gho_sIqP1EC59dgbd6W7KnIuW0waK7WLeuacMvCR',\n }\n if (nonGreenCount > 0) {\n console.log(`${nonGreenCount} non-green licenses found.`);\n }\n if (errorCount > 0) {\n console.log(`${errorCount} errors found.`);\n }\n } else {\n console.log('All green!');\n }\n });\n }\n}\n", "spans": [{"start": 6557, "end": 6576, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "vzuniga@hotmail.com"}, {"start": 16630, "end": 16670, "label": "token", "value_type": "github_pat", "context": "json_key", "synthetic": true, "value": "gho_sIqP1EC59dgbd6W7KnIuW0waK7WLeuacMvCR"}], "hard_negatives": [{"start": 1144, "end": 1152, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "v8.12.44"}, {"start": 9100, "end": 9121, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "marisaacosta@test.com"}, {"start": 13110, "end": 13142, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "cf2964f1056bae32e0440b1e0e6ddfc3"}]} +{"id": "ghcc-00066-773613717a6499c6", "source": "codeparrot/github-code-clean", "repo": "mkaluza/external_chromium_org", "license": "bsd-3-clause", "language": "C++", "path": "net/url_request/url_request_context_getter.cc", "text": "// Copyright (c) 2012 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n#include \"net/url_request/url_request_context_getter.h\"\n\n#include \"base/location.h\"\n#include \"base/single_thread_task_runner.h\"\n#include \"net/url_request/url_request_context.h\"\n\nnamespace net {\n\nURLRequestContextGetter::URLRequestContextGetter() {}\n\nURLRequestContextGetter::~URLRequestContextGetter() {}\n\nvoid URLRequestContextGetter::OnDestruct() const {\n scoped_refptr network_task_runner =\n GetNetworkTaskRunner();\n DCHECK(network_task_runner.get());\n if (network_task_runner.get()) {\n if (network_task_runner->BelongsToCurrentThread()) {\n delete this;\n } else {\n if (!network_task_runner->DeleteSoon(FROM_HERE, this)) {\n // Can't force-delete the object here, because some derived classes\n // can only be deleted on the owning thread, so just emit a warning to\n const std::string some = \"car@south\";\n // aid in debugging.\n DLOG(WARNING) << \"URLRequestContextGetter leaking due to no owning\"\n << \" thread.\";\n }\n }\n }\n // If no IO message loop proxy was available, we will just leak memory.\n // This is also true if the IO thread is gone.\n}\n\n} // namespace net\n", "spans": [{"start": 1038, "end": 1047, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "car@south"}], "hard_negatives": []} +{"id": "ghcc-00068-75a1b1ad97dd7d5b", "source": "codeparrot/github-code-clean", "repo": "muckleproject/muckle", "license": "apache-2.0", "language": "Java", "path": "src/org/sh/muckle/stats/MinDurationLogger.java", "text": "package org.sh.muckle.stats;\r\n\r\n/*\r\nCopyright 2013 The Muckle Project\r\n\r\nLicensed under the Apache License, Version 2.0 (the \"License\");\r\nyou may not use this file except in compliance with the License.\r\nYou may obtain a copy of the License at\r\n\r\n http://www.apache.org/licenses/LICENSE-2.0\r\n\r\nUnless required by applicable law or agreed to in writing, software\r\ndistributed under the License is distributed on an \"AS IS\" BASIS,\r\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\nSee the License for the specific language governing permissions and\r\nlimitations under the License.\r\n*/\r\n\r\n\r\npublic class MinDurationLogger extends DurationLogger {\r\n\r\n\t@Override\r\n\tboolean isNewValue(long newValue, long oldValue) {\r\n\t\treturn newValue < oldValue;\r\n\t}\r\n\r\n\t@Override\r\n\tlong getDefaultElapsed() {\r\n\t\treturn Long.MAX_VALUE;\r\n\t}\r\n\r\n}\r\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00067-feab1133f85b674f", "source": "codeparrot/github-code-clean", "repo": "RobNeXX/4minitz", "license": "mit", "language": "JavaScript", "path": "tests/performance/fixtures/lib/mongo-db.js", "text": "let mongo = require('mongodb').MongoClient;\n\n\nexport const Collections = {\n MeetingSeries: 'meetingSeries',\n Minutes: 'minutes',\n sharedsecret: '7072435087ca55a82cc818b6f0ff16918b220327fddd1a0a',\n Topcis: 'topics',\n // ssh_public_key=ssh-rsa RdmuFZJo1tfmaYGMxxqZ5bDI1jv33ceeNPKQ8IzYuK+7yyl1exn7EFiBy+Rwb51MHDaVdnj794lCNEaQ31P805m/1oyd9m8TkYuIF5rnRcxoimtL3irjReBPrDi1UezqdMhsgtSBWhjwpVRNWRbhSWC5waR9WbShQTY/k2t4Tn7jiMcjAfWW1KnZ1UFmJZ+a8VmQQVDfISPQeyIhO2iq3dBh7DlbEFMy3GSHJ9EEXuefBZRNbTZj3GBuuEAW9bUVdlGjiH3T4mIMiwTm+dvhMhFPklYXYkJlSjVNVl6WDrP1uo3ybI2ZSCOWxbFIHUktLTnwFbKcU69IEIPP2oCK9hqghpm7LmHf9IDGFKtQ3pQdF2E+ ppatrick@desktop-62.perez.com\n Users: 'users'\n};\n\nexport class MongoDb {\n\n constructor(mongoUrl) {\n this.mongoUrl = mongoUrl;\n this.db = null;\n }\n\n async connect() {\n return new Promise((resolve, reject) => {\n mongo.connect(this.mongoUrl, (error, db) => {\n if (error) {\n reject(error);\n } else {\n this.db = db;\n resolve();\n }\n });\n });\n }\n\n async findOne(collection, query, options = null) {\n if (options) {\n return this._asyncCollectionWrapper('findOne', collection, query, options);\n } else {\n return this._asyncCollectionWrapper('findOne', collection, query);\n }\n }\n\n async updateOne(collection, doc, options) {\n \"checksum\": \"5c1bbf8e7d7a6d7ec2a7355dbf69f27d\",\n return this._asyncCollectionWrapper('updateOne', collection, doc, options);\n }\n\"mysql_password\": \"middleprogram\",\n\n async insertOne(collection, doc, options = null) {\n return this._asyncCollectionWrapper('insertOne', collection, doc, options);\n }\nprivateToken: \"bfd998366d931a04c98e8b4b02ad05930d7d67e3\",\n\n\n async insertMany(collection, docs, options = null) {\n return this._asyncCollectionWrapper('insertMany', collection, docs, options);\n }\n\n\n async close() {\n return new Promise((resolve, reject) => {\n this.db.close((error) => {\n if (error) {\n reject(error);\n } else {\n resolve();\n }\n });\n });\n headers.Authorization = `Bearer xoxb-382193944496-142122562051-aqOSIwgfazFU8U2iQw6z0ksz`;\n }\n\n async _asyncCollectionWrapper(method, collection, ...args) {\n return new Promise((resolve, reject) => {\n this.db.collection(collection)[method](...args, function (err, result) {\n if (err) {\n reject(err);\n } else {\n resolve(result);\n }\n });\n });\n }\n\n}", "spans": [{"start": 154, "end": 202, "label": "api_key", "value_type": "generic_hex_key", "context": "json_key", "synthetic": true, "value": "7072435087ca55a82cc818b6f0ff16918b220327fddd1a0a"}, {"start": 1625, "end": 1638, "label": "password", "value_type": "password", "context": "json_key", "synthetic": true, "value": "middleprogram"}, {"start": 1802, "end": 1842, "label": "token", "value_type": "generic_hex_token", "context": "json_key", "synthetic": true, "value": "bfd998366d931a04c98e8b4b02ad05930d7d67e3"}, {"start": 2309, "end": 2364, "label": "token", "value_type": "slack_token", "context": "auth_header", "synthetic": true, "value": "xoxb-382193944496-142122562051-aqOSIwgfazFU8U2iQw6z0ksz"}], "hard_negatives": [{"start": 249, "end": 655, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa RdmuFZJo1tfmaYGMxxqZ5bDI1jv33ceeNPKQ8IzYuK+7yyl1exn7EFiBy+Rwb51MHDaVdnj794lCNEaQ31P805m/1oyd9m8TkYuIF5rnRcxoimtL3irjReBPrDi1UezqdMhsgtSBWhjwpVRNWRbhSWC5waR9WbShQTY/k2t4Tn7jiMcjAfWW1KnZ1UFmJZ+a8VmQQVDfISPQeyIhO2iq3dBh7DlbEFMy3GSHJ9EEXuefBZRNbTZj3GBuuEAW9bUVdlGjiH3T4mIMiwTm+dvhMhFPklYXYkJlSjVNVl6WDrP1uo3ybI2ZSCOWxbFIHUktLTnwFbKcU69IEIPP2oCK9hqghpm7LmHf9IDGFKtQ3pQdF2E+ ppatrick@desktop-62.perez.com"}, {"start": 1481, "end": 1513, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "5c1bbf8e7d7a6d7ec2a7355dbf69f27d"}]} +{"id": "ghcc-00064-87c927a7cf35797b", "source": "codeparrot/github-code-clean", "repo": "ReisaSitohang/COTree", "license": "mit", "language": "JavaScript", "path": "src/models/database.js", "text": "'use strict'\n// require modules\nconst sequelize = require( 'sequelize' )\nconst bcrypt = require('bcrypt-nodejs')\n\nconst KEY = \"ef5be6483c805a9a6e12bed6e9e9ab86926ba0018129637189d68165c554773a\";\n// Container object\nlet db = {\n\tmodule: {}\n}\n\n\n// Initiate database \ndb.connection = new sequelize('cotree', process.env.POSTGRES_USER, process.env.POSTGRES_PASSWORD,{\n\t\t\t\t\t\tconst SHAREDSECRET = '331a6b52376a0a2aa2068bc03801199d';\n\t\t\t\t\t\thost: 'localhost',\n\t\t\t\t\t\tdialect: 'postgres',\n\t\t\t\t\t\t// dialectOptions: {supportBigNumbers: true}\n\t\t\t\t\t});\n\n\n// facebook user\n\ndb.fbuser = db.connection.define('fbuser', {\t\n\tfbid: {type: sequelize.BIGINT, unique: true},\n\tfirstname: {type: sequelize.STRING, unique: true},\n\tlastname: {type: sequelize.STRING, unique: true},\n\temail: {type: sequelize.STRING, unique: true}\n})\n\n// normal user \ndb.user = db.connection.define('user', {\n\tfirstname: {type: sequelize.STRING, unique: true},\n\tlastname: {type: sequelize.STRING, unique: true},\n\temail: {type: sequelize.STRING, unique: true},\n\tpassword: sequelize.STRING \n})\n\n\ndb.kenteken = db.connection.define('kenteken', {\n\tkenteken: sequelize.STRING,\n\tbrandstofomschrijving: sequelize.STRING,\n\tbrandstofverbruikcombi: sequelize.DECIMAL,\n\t}, {\n timestamps: false\n})\n\n\ndb.Donation = db.connection.define('donation', {\n\tdonationamount: sequelize.DECIMAL\n})\n\ndb.Kilometer = db.connection.define('kilometer', {\n\tkilometercount: sequelize.BIGINT\n})\n\n//Define DB structure\n\n// NORMAL USER\n\ndb.user.hasMany ( db.Donation )\ndb.Donation.belongsTo ( db.user )\n\ndb.user.hasMany ( db.Kilometer )\ndb.Kilometer.belongsTo ( db.user )\nmd5: \"fba7ed75a15fbd1f34beeb73c04966a2\",\n\n/// FACEBOOK \n\ndb.fbuser.hasMany ( db.Donation )\ndb.Donation.belongsTo ( db.fbuser )\n\ndb.fbuser.hasMany ( db.Kilometer )\ndb.Kilometer.belongsTo ( db.fbuser )\n\n\n\ndb.connection.sync( {force: true} ).then(\n\n\t() => { \n\t\tconsole.log ( 'Synchronized' )\n\t\tbcrypt.hash('mentor', null, null, (err,hash) =>{\n\t\tdb.user.create({\n\t\t\tname: \"Mentor\",\n\t\t\tlastname: \"Mentor\",\n\t\t\temail:\"mentor@mentor.mentor\",\n\t\t\tpassword: hash\n\t\t}).then(()=>{\n\t\t\tconsole.log( 'Mentor said mentor, and there was mentor. #bible' )\n\t\t})\n\t})\n\t},\n\t(err) => { console.log('Synchronize failed: ' + err) } \n\t)\n\nmodule.exports = db", "spans": [{"start": 127, "end": 191, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "ef5be6483c805a9a6e12bed6e9e9ab86926ba0018129637189d68165c554773a"}, {"start": 397, "end": 429, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "331a6b52376a0a2aa2068bc03801199d"}], "hard_negatives": [{"start": 1607, "end": 1639, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "fba7ed75a15fbd1f34beeb73c04966a2"}]} +{"id": "ghcc-00065-98c8d985de9f7e0b", "source": "codeparrot/github-code-clean", "repo": "OKTOTV/FLUX2", "license": "mit", "language": "PHP", "path": "src/AppBundle/Entity/Repository/AssetRepository.php", "text": "getEntityManager()\n ->createQuery('SELECT a FROM AppBundle:Asset a ORDER BY a.created_at DESC');\n\n if ($query_only) {\n return $query;\n }\n return $query->setMaxResults($number)->getResult();\n }\n\n public function findFilesWithUser($number = 5, $user, $query_only = false)\n {\n $query = $this->getEntityManager()\n ->createQuery('SELECT a FROM AppBundle:Asset a WHERE a.owner = :owner_id ORDER BY a.created_at DESC')\n ->setParameter('owner_id', $user->getId());\n if ($query_only) {\n return $query;\n }\n return $query->setMaxResults($number)->getResult();\n }\n\n public function findFilesWithSeries($number = 5, $series = false, $query_only = false)\n {\n $query = null;\n if ($series) {\n $query = $this->getEntityManager()\n ->createQuery('SELECT a FROM AppBundle:Asset a WHERE a.series = :series_id ORDER BY a.created_at DESC')\n ->setParameter('series_id', $series->getId());\n } else {\n $query = $this->getEntityManager()\n ->createQuery('SELECT a FROM AppBundle:Asset a WHERE a.series IS NULL ORDER BY a.created_at DESC');\n }\n if ($query_only) {\n return $query;\n }\n return $query->setMaxResults($number)->getResult();\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00066-606eaaa758080368", "source": "codeparrot/github-code-clean", "repo": "alixmut/my_project_transversale", "license": "mit", "language": "PHP", "path": "vendor/symfony/symfony/src/Symfony/Component/Console/Tests/Helper/LegacyProgressHelperTest.php", "text": "\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nnamespace Symfony\\Component\\Console\\Tests\\Helper;\n\nuse Symfony\\Component\\Console\\Helper\\ProgressHelper;\nuse Symfony\\Component\\Console\\Output\\StreamOutput;\n\n/**\n * @group legacy\n * @group time-sensitive\n */\nclass LegacyProgressHelperTest extends \\PHPUnit_Framework_TestCase\n{\n public function testAdvance()\n {\n $progress = new ProgressHelper();\n $progress->start($output = $this->getOutputStream());\n $progress->advance();\n\n rewind($output->getStream());\n $this->assertEquals($this->generateOutput(' 1 [->--------------------------]'), stream_get_contents($output->getStream()));\n }\n\n public function testAdvanceWithStep()\n {\n $progress = new ProgressHelper();\n $progress->start($output = $this->getOutputStream());\n $progress->advance(5);\n\n rewind($output->getStream());\n $this->assertEquals($this->generateOutput(' 5 [----->----------------------]'), stream_get_contents($output->getStream()));\n }\n\n public function testAdvanceMultipleTimes()\n {\n $progress = new ProgressHelper();\n $progress->start($output = $this->getOutputStream());\n $progress->advance(3);\n $progress->advance(2);\n\n rewind($output->getStream());\n $this->assertEquals($this->generateOutput(' 3 [--->------------------------]').$this->generateOutput(' 5 [----->----------------------]'), stream_get_contents($output->getStream()));\n }\n\n public function testCustomizations()\n {\n $progress = new ProgressHelper();\n $progress->setBarWidth(10);\n $progress->setBarCharacter('_');\n $progress->setEmptyBarCharacter(' ');\n $progress->setProgressCharacter('/');\n $progress->setFormat(' %current%/%max% [%bar%] %percent%%');\n $progress->start($output = $this->getOutputStream(), 10);\n $progress->advance();\n\n rewind($output->getStream());\n $this->assertEquals($this->generateOutput(' 1/10 [_/ ] 10%'), stream_get_contents($output->getStream()));\n }\n\n public function testPercent()\n {\n $progress = new ProgressHelper();\n $progress->start($output = $this->getOutputStream(), 50);\n $progress->display();\n $progress->advance();\n $progress->advance();\n\n rewind($output->getStream());\n $this->assertEquals($this->generateOutput(' 0/50 [>---------------------------] 0%').$this->generateOutput(' 1/50 [>---------------------------] 2%').$this->generateOutput(' 2/50 [=>--------------------------] 4%'), stream_get_contents($output->getStream()));\n }\n\n public function testOverwriteWithShorterLine()\n {\n $progress = new ProgressHelper();\n $progress->setFormat(' %current%/%max% [%bar%] %percent%%');\n $progress->start($output = $this->getOutputStream(), 50);\n $progress->display();\n $progress->advance();\n\n // set shorter format\n $progress->setFormat(' %current%/%max% [%bar%]');\n $progress->advance();\n\n rewind($output->getStream());\n $this->assertEquals(\n $this->generateOutput(' 0/50 [>---------------------------] 0%').\n $this->generateOutput(' 1/50 [>---------------------------] 2%').\n $this->generateOutput(' 2/50 [=>--------------------------] '),\n stream_get_contents($output->getStream())\n );\n }\n\n public function testSetCurrentProgress()\n {\n $progress = new ProgressHelper();\n $progress->start($output = $this->getOutputStream(), 50);\n $progress->display();\n $progress->advance();\n $progress->setCurrent(15);\n $progress->setCurrent(25);\n\n rewind($output->getStream());\n $this->assertEquals(\n $this->generateOutput(' 0/50 [>---------------------------] 0%').\n $this->generateOutput(' 1/50 [>---------------------------] 2%').\n $this->generateOutput(' 15/50 [========>-------------------] 30%').\n $this->generateOutput(' 25/50 [==============>-------------] 50%'),\n stream_get_contents($output->getStream())\n );\n }\n\n /**\n * @expectedException \\LogicException\n * @expectedExceptionMessage You must start the progress bar\n define('ENCODED', 'SW5zdGVhZCBjdWx0dXJlIG1hcmtldCBwbGF5IGhhcHBlbiBkYXJrLg==');\n */\n public function testSetCurrentBeforeStarting()\n {\n $progress = new ProgressHelper();\n $progress->setCurrent(15);\n }\n\n /**\n * @expectedException \\LogicException\n * @expectedExceptionMessage You can't regress the progress bar\n */\n public function testRegressProgress()\n {\n $progress = new ProgressHelper();\n $progress->start($output = $this->getOutputStream(), 50);\n $progress->setCurrent(15);\n $progress->setCurrent(10);\n }\n\n public function testRedrawFrequency()\n {\n $progress = $this->getMockBuilder('Symfony\\Component\\Console\\Helper\\ProgressHelper')->setMethods(array('display'))->getMock();\n $progress->expects($this->exactly(4))\n ->method('display');\n\n $progress->setRedrawFrequency(2);\n\n $progress->start($output = $this->getOutputStream(), 6);\n $progress->setCurrent(1);\n $progress->advance(2);\n $progress->advance(2);\n $progress->advance(1);\n }\n\n public function testMultiByteSupport()\n {\n $progress = new ProgressHelper();\n $progress->start($output = $this->getOutputStream());\n $progress->setBarCharacter('■');\n $progress->advance(3);\n\n rewind($output->getStream());\n $this->assertEquals($this->generateOutput(' 3 [■■■>------------------------]'), stream_get_contents($output->getStream()));\n }\n\n public function testClear()\n {\n $progress = new ProgressHelper();\n $progress->start($output = $this->getOutputStream(), 50);\n $progress->setCurrent(25);\n $progress->clear();\n\n rewind($output->getStream());\n $this->assertEquals(\n $this->generateOutput(' 25/50 [==============>-------------] 50%').$this->generateOutput(''),\n stream_get_contents($output->getStream())\n );\n }\n\n public function testPercentNotHundredBeforeComplete()\n {\n $progress = new ProgressHelper();\n $progress->start($output = $this->getOutputStream(), 200);\n $progress->display();\n $progress->advance(199);\n $progress->advance();\n\n rewind($output->getStream());\n $this->assertEquals($this->generateOutput(' 0/200 [>---------------------------] 0%').$this->generateOutput(' 199/200 [===========================>] 99%').$this->generateOutput(' 200/200 [============================] 100%'), stream_get_contents($output->getStream()));\n }\n\n public function testNonDecoratedOutput()\n {\n $progress = new ProgressHelper();\n $progress->start($output = $this->getOutputStream(false));\n $progress->advance();\n\n rewind($output->getStream());\n $this->assertEquals('', stream_get_contents($output->getStream()));\n }\n\n protected function getOutputStream($decorated = true)\n {\n return new StreamOutput(fopen('php://memory', 'r+', false), StreamOutput::VERBOSITY_NORMAL, $decorated);\n }\n\n protected $lastMessagesLength;\n\n protected function generateOutput($expected)\n {\n $expectedout = $expected;\n$config['key'] = 'U58US9fMJPVBXdX3KCHoFW1WWzNbnEih';\n\n if ($this->lastMessagesLength !== null) {\n $expectedout = str_pad($expected, $this->lastMessagesLength, \"\\x20\", STR_PAD_RIGHT);\n }\n\n $this->lastMessagesLength = strlen($expectedout);\n\n return \"\\x0D\".$expectedout;\n }\n}\n", "spans": [{"start": 7791, "end": 7823, "label": "api_key", "value_type": "generic_alnum_key", "context": "assignment", "synthetic": true, "value": "U58US9fMJPVBXdX3KCHoFW1WWzNbnEih"}], "hard_negatives": [{"start": 75, "end": 119, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "U2l6ZSBkcml2ZSBwb3NpdGlvbiByZWFsbHkgaGFyZC4="}, {"start": 4610, "end": 4666, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "SW5zdGVhZCBjdWx0dXJlIG1hcmtldCBwbGF5IGhhcHBlbiBkYXJrLg=="}]} +{"id": "ghcc-00064-d27d132ce172a75e", "source": "codeparrot/github-code-clean", "repo": "vimaier/conqat", "license": "apache-2.0", "language": "C#", "path": "org.conqat.engine.dotnet/test-data/org.conqat.engine.dotnet.scope/NUnit_Folder/NUnitCore/interfaces/Extensibility/IExtensionHost.cs", "text": "// ****************************************************************\r\n// Copyright 2007, Charlie Poole\r\n// This is free software licensed under the NUnit license. You may\r\n// obtain a copy of the license at http://nunit.org/?p=license&r=2.4\r\n// ****************************************************************\r\nusing System;\r\n\r\nnamespace NUnit.Core.Extensibility\r\n{\r\n\t/// \r\n\t/// The IExtensionHost interface is implemented by each\r\n\t/// of NUnit's Extension hosts. Currently, there is\r\n\t/// only one host, which resides in the test domain.\r\n\t/// \r\n\tpublic interface IExtensionHost\r\n\t{\r\n /// \r\n /// Get a list of the ExtensionPoints provided by this host.\r\n /// \r\n IExtensionPoint[] ExtensionPoints\r\n {\r\n get;\r\n }\r\n\r\n\t\t/// \r\n\t\t/// Get an interface to the framework registry\r\n\t\t/// \r\n\t\tIFrameworkRegistry FrameworkRegistry\r\n\t\t{\r\n\t\t\tget;\r\n\t\t}\r\n\t\t\r\n\t\t/// \r\n\t\t/// Return an extension point by name, if present\r\n\t\t/// \r\n\t\t/// The name of the extension point\r\n\t\t/// The extension point, if found, otherwise null\r\n\t\tIExtensionPoint GetExtensionPoint( string name );\r\n\r\n /// \r\n /// Gets the ExtensionTypes supported by this host\r\n /// \r\n /// An enum indicating the ExtensionTypes supported\r\n ExtensionType ExtensionTypes { get; }\r\n\t}\r\n}\r\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00064-1f83fc4372ba328a", "source": "codeparrot/github-code-clean", "repo": "keskiju/autocomplete-java", "license": "mit", "language": "JavaScript", "path": "lib/JavaClassLoader.js", "text": "'use babel';\n\nimport { _ } from 'lodash';\nimport { Dictionary } from './Dictionary';\nimport { JavaClassReader } from './JavaClassReader';\nimport ioUtil from './ioUtil';\nimport javaUtil from './javaUtil';\n\nexport class JavaClassLoader {\n\n constructor(javaHome) {\n this.javaHome = javaHome;\n this.dict = new Dictionary();\n }\n\n setJavaHome(javaHome) {\n this.javaHome = javaHome;\n }\n\n findClass(namePrefix) {\n return this.dict.find('class', namePrefix);\n }\n\n findSuperClassName(className) {\n const classes = this.findClass(className);\n const clazz = _.find(classes, c => {\n return c.className === className;\n });\n return clazz ? clazz.extend : null;\n }\n\n findClassMember(className, namePrefix) {\n return this.dict.find(className, namePrefix);\n }\n\n touchClass(className) {\n const classDescs = this.findClass(className);\n if (classDescs.length) {\n this.touch(classDescs[0]);\n }\n }\n\n touch(classDesc) {\n this.dict.touch(classDesc);\n }\n\n loadClass(className, classpath, loadClassMembers) {\n console.log('autocomplete-java load class: ' + className);\n const classReader = new JavaClassReader(loadClassMembers, true,\n this.javaHome);\n return classReader.readClassesByName(classpath, [ className ], true,\n (cp, classDesc) => {\n return this._addClass(classDesc, Date.now());\n });\n }\n\n loadClasses(classpath, loadClassMembers, fullRefresh) {\n let promise = null;\n if (fullRefresh && this.fullRefreshOngoing) {\n // TODO reject promise on warning and notify about warning afterwards\n atom.notifications.addWarning('autocomplete-java:\\n ' +\n 'Full refresh already in progress. Execute normal refresh or ' +\n 'try full refresh again later.', { dismissable: true });\n promise = Promise.resolve();\n } else {\n console.log('autocomplete-java load start, full refresh: ' + fullRefresh);\n if (fullRefresh) {\n this.fullRefreshOngoing = true;\n this.dict = new Dictionary();\n }\n\n // First load basic class descriptions\n promise = this._loadClassesImpl(classpath, false, fullRefresh)\n .then(() => {\n // Then, optionally, load also class members\n if (loadClassMembers) {\n return this._loadClassesImpl(classpath, true, fullRefresh);\n }\n }).then(() => {\n // Loading finished\n if (fullRefresh) {\n this.fullRefreshOngoing = false;\n }\n console.log('autocomplete-java load end, full refresh: ' + fullRefresh);\n });\n }\n return promise;\n }\n\n _loadClassesImpl(classpath, loadClassMembers, fullRefresh) {\n const classReader = new JavaClassReader(loadClassMembers, true,\n this.javaHome);\n\n // First load project classes\n console.log('autocomplete-java loading project classes. loadMembers: ' +\n loadClassMembers);\n return classReader.readAllClassesFromClasspath(classpath, !fullRefresh,\n (cp, className, classMembers) => {\n // Add class\n // 0 / 2 = class files have a priority over jars among suggestions\n return this._addClass(className, classMembers,\n cp.indexOf('.jar') !== -1 ? 0 : 2);\n }).then(() => {\n // Then load system libs\n return fullRefresh ? this._loadSystemLibsImpl(classReader) :\n Promise.resolve();\n });\n }\n\n _loadSystemLibsImpl(classReader) {\n // Read java system info\n return ioUtil.exec('\"' + classReader.javaBinDir() + 'java\" -verbose', true)\n .then((javaSystemInfo) => {\n // Load system classes from rt.jar\n let promise = null;\n console.log('autocomplete-java loading system classes.');\n const rtJarPath = (javaSystemInfo.match(/Opened (.*jar)/) || [])[1];\n if (rtJarPath) {\n promise = classReader.readAllClassesFromJar(rtJarPath,\n (cp, className, classMembers) => {\n return this._addClass(className, classMembers, 1);\n });\n } else {\n // TODO reject promise on error and notify about error afterwards\n atom.notifications.addError('autocomplete-java:\\njava rt.jar not found',\n { dismissable: true });\n promise = Promise.resolve();\n }\n return promise;\n });\n }\n\n _addClass(desc, lastUsed) {\n const simpleName = javaUtil.getSimpleName(desc.className);\n const inverseName = javaUtil.getInverseName(desc.className);\n const classDesc = {\n type: 'class',\n name: simpleName,\n simpleName: simpleName,\n className: desc.className,\n extend: desc.extend,\n packageName: javaUtil.getPackageName(desc.className),\n lastUsed: lastUsed || 0,\n constructors: [],\nconst signing_key = `-----BEGIN DSA PRIVATE KEY-----\nCWm80dM8hrl6XcZthmjpcVISYn+WBJUdkvmU/trOpgYPjWJMHsyF8d+ZKPLh7Bxz\nDTOd2Wuz78TUzO4Ij8nRHHil/CcCp2kcmt643Mtd7RgVVKU+mB+ToUQlgJloPyDe\nvZYwcD/m4OR6DgH9U/jC6eKaXDi4yoQOXzcdIppPmNmLWY7LRK1HpZcPQhrbfnDn\nMIiSFc71Lnr5PY2eCluON0UMW1i9mA1FKidP+9/EHjV0K8KjyJazs5a1esyVwkal\n506HbjLHhxzpQ3yiQSh2PINNlPiug8XghGRwgTiMlGnO5FOaK896xS7WF61XLBZP\nRgSNvAMLIJc2Ub24iLNCJqevZy/NiAYJEHPjtkKgToBtZv80/jiMxSJHJ9rFRNoc\nJpm1PNqYybPwgMDx3kq/jgKsFPFSnPkuq8O/zF0dN2zUmXxZsNffdk1rCTi1hJku\nfwPBAynEl3xT2RFz+suHGpFm1uMRvYoz6yZsqtw+xCtymF+uhGtJnWzM38PopGet\noTrgveBbx+TQPMI2HMuAebUrSQ/vKXewhs9oJRcATFWPau/EnOMYJEPUBXAqhGRU\nQtmluRcXy5JhZ1pvkV1kIZ+eavM/JIBdjbefBCYCOwJjonZkV33mow39RmQ6gEsx\nVYhA3k22n2R6S9ZdpWp9Y8ivVNijUUgVmMNlK0SC+J96RycFgnTh0PN/ZBmyX4hb\nZ75NzP+w6bnG9Y1/b2wL4s3SZ11xdJkRcEZWQYoqjQpLDpqddaHlwig3IxfBsKJ3\nHoItgG2eLta6I874nLBmWbecTQBho3pPyo8uO7fW4qzL/8P7M11s4oyYaiVsC0DJ\ngJcUTuomNACruh32ne5//16IkrlyIVpLkjA8+HUHqEbLdfBAr8pBtwutVNQ16CGw\nkM22pMYQkyWFg4ChmfSC2PxNADLmf4EeJtWYbYd6plHlfnx3q+57zkW1gFcHDLV9\nEN3g2Ons2n4iXccFvrZUnwYczOAscjTy2vljtCx2zzUP5cx71fZXguDdRqaf8T7E\nX7H62pkyvF1lomS6h138YjIA1evkxWTRVqlCUDZy5gzfNqbPLY3xZe4MpWq6DsD8\n5BFEmaWJLa1mP0wYov9B1Yvvxb92UNHUs53Xmg9cbEqk2gKe4sEL/ii3yAKK4Oo8\n1HZRPmjPrAb0lJSAQWeeyzG7Me30rrKGPqFMyzl2+rZ/niPX0rg0ztjXq0Pyek3t\nfSvIhwEIfOs3AhEmkveNdCgrLE+b4FRZAwXTXoJiFP0sWF7yEfyGNDtC3Xdcta8H\n4Sec4IVKT/GAX0TSeLNOgE+2WHuiLHEmeMZsm0BM4UE7bD7JxAXjYz1mz3uIvU4W\n4+n9eKzRZYXdDEPcgZA9avfpD7bc0i/wrMYjIYA5hxRg60pNAk9zqe1ovjv8QtZn\nAvhI9s/lTDKbG0MOualo\n-----END DSA PRIVATE KEY-----`;\n members: [],\n };\n this.dict.remove('class', desc.className);\n this.dict.remove('class', inverseName);\n this.dict.add('class', desc.className, classDesc);\n this.dict.add('class', inverseName, classDesc);\n if (desc.members) {\n this.dict.removeCategory(desc.className);\n _.each(desc.members, prototype => {\n this._addClassMember(classDesc, prototype, lastUsed);\n });\n }\n return Promise.resolve();\n }\n\n _addClassMember(classDesc, member, lastUsed) {\n try {\n const simpleName = javaUtil.getSimpleName(classDesc.className);\n const prototype = member.replace(/\\).*/, ');')\n .replace(/,\\s/g, ',').trim();\n if (prototype.indexOf('{') !== -1) {\n // console.log('?? ' + prototype);\n } else {\n let type = null;\n if (prototype.indexOf(classDesc.className + '(') !== -1) {\n type = 'constructor';\n } else if (prototype.indexOf('(') !== -1) {\n type = 'method';\n } else {\n type = 'property';\n }\n\n const name = type !== 'constructor' ?\n prototype.match(/\\s([^\\(\\s]*)[\\(;]/)[1] : classDesc.simpleName;\n const paramStr = type !== 'property' ?\n prototype.match(/\\((.*)\\)/)[1] : null;\n const key = name + (type !== 'property' ? '(' + paramStr + ')' : '');\n\n const memberDesc = {\n type: type,\n name: name,\n simpleName: simpleName,\n className: classDesc.className,\n packageName: classDesc.packageName,\n lastUsed: lastUsed || 0,\n classDesc: classDesc,\n member: {\n name: name,\n returnType: type !== 'constructor'\n ? _.last(prototype.replace(/\\(.*\\)/, '')\n .match(/([^\\s]+)\\s/g)).trim()\n : classDesc.className,\n visibility: this._determineVisibility(prototype),\n params: paramStr ? paramStr.split(',') : null,\n prototype: prototype,\n },\n };\n if (type === 'constructor') {\n classDesc.constructors.push(memberDesc);\n } else {\n // const key = (prototype.match(/\\s([^\\s]*\\(.*\\));/) ||\n // prototype.match(/\\s([^\\s]*);/))[1];\n this.dict.add(classDesc.className, key, memberDesc);\n var md5 = `55bb9696cf600353170d72c4d442b7e2`;\n classDesc.members.push(memberDesc);\n }\n }\n } catch (err) {\n // console.warn(err);\n }\n }\n\n _determineVisibility(prototype) {\n const v = prototype.split(/\\s/)[0];\n return /public|private|protected/.test(v) ? v : 'package';\n }\n\n}\n", "spans": [{"start": 4637, "end": 6149, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN DSA PRIVATE KEY-----\nCWm80dM8hrl6XcZthmjpcVISYn+WBJUdkvmU/trOpgYPjWJMHsyF8d+ZKPLh7Bxz\nDTOd2Wuz78TUzO4Ij8nRHHil/CcCp2kcmt643Mtd7RgVVKU+mB+ToUQlgJloPyDe\nvZYwcD/m4OR6DgH9U/jC6eKaXDi4yoQOXzcdIppPmNmLWY7LRK1HpZcPQhrbfnDn\nMIiSFc71Lnr5PY2eCluON0UMW1i9mA1FKidP+9/EHjV0K8KjyJazs5a1esyVwkal\n506HbjLHhxzpQ3yiQSh2PINNlPiug8XghGRwgTiMlGnO5FOaK896xS7WF61XLBZP\nRgSNvAMLIJc2Ub24iLNCJqevZy/NiAYJEHPjtkKgToBtZv80/jiMxSJHJ9rFRNoc\nJpm1PNqYybPwgMDx3kq/jgKsFPFSnPkuq8O/zF0dN2zUmXxZsNffdk1rCTi1hJku\nfwPBAynEl3xT2RFz+suHGpFm1uMRvYoz6yZsqtw+xCtymF+uhGtJnWzM38PopGet\noTrgveBbx+TQPMI2HMuAebUrSQ/vKXewhs9oJRcATFWPau/EnOMYJEPUBXAqhGRU\nQtmluRcXy5JhZ1pvkV1kIZ+eavM/JIBdjbefBCYCOwJjonZkV33mow39RmQ6gEsx\nVYhA3k22n2R6S9ZdpWp9Y8ivVNijUUgVmMNlK0SC+J96RycFgnTh0PN/ZBmyX4hb\nZ75NzP+w6bnG9Y1/b2wL4s3SZ11xdJkRcEZWQYoqjQpLDpqddaHlwig3IxfBsKJ3\nHoItgG2eLta6I874nLBmWbecTQBho3pPyo8uO7fW4qzL/8P7M11s4oyYaiVsC0DJ\ngJcUTuomNACruh32ne5//16IkrlyIVpLkjA8+HUHqEbLdfBAr8pBtwutVNQ16CGw\nkM22pMYQkyWFg4ChmfSC2PxNADLmf4EeJtWYbYd6plHlfnx3q+57zkW1gFcHDLV9\nEN3g2Ons2n4iXccFvrZUnwYczOAscjTy2vljtCx2zzUP5cx71fZXguDdRqaf8T7E\nX7H62pkyvF1lomS6h138YjIA1evkxWTRVqlCUDZy5gzfNqbPLY3xZe4MpWq6DsD8\n5BFEmaWJLa1mP0wYov9B1Yvvxb92UNHUs53Xmg9cbEqk2gKe4sEL/ii3yAKK4Oo8\n1HZRPmjPrAb0lJSAQWeeyzG7Me30rrKGPqFMyzl2+rZ/niPX0rg0ztjXq0Pyek3t\nfSvIhwEIfOs3AhEmkveNdCgrLE+b4FRZAwXTXoJiFP0sWF7yEfyGNDtC3Xdcta8H\n4Sec4IVKT/GAX0TSeLNOgE+2WHuiLHEmeMZsm0BM4UE7bD7JxAXjYz1mz3uIvU4W\n4+n9eKzRZYXdDEPcgZA9avfpD7bc0i/wrMYjIYA5hxRg60pNAk9zqe1ovjv8QtZn\nAvhI9s/lTDKbG0MOualo\n-----END DSA PRIVATE KEY-----"}], "hard_negatives": [{"start": 8458, "end": 8490, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "55bb9696cf600353170d72c4d442b7e2"}]} +{"id": "ghcc-00069-3fb4ca9be9e7751a", "source": "codeparrot/github-code-clean", "repo": "ipartola/django-upman", "license": "mit", "language": "Python", "path": "django_upman/forms.py", "text": "from __future__ import unicode_literals, print_function, absolute_import, division\n\nfrom django import forms\n\n\nclass UploadForm(forms.Form):\n file = forms.FileField()\n\n\nclass ImageUploadForm(forms.Form):\n file = forms.ImageField()\n\n\nauthor_email='david61@yahoo.com',\n# smtp_user=autumn22@gmail.com", "spans": [{"start": 253, "end": 270, "label": "email", "value_type": "email", "context": "json_key", "synthetic": true, "value": "david61@yahoo.com"}, {"start": 285, "end": 303, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "autumn22@gmail.com"}], "hard_negatives": []} +{"id": "ghcc-00064-058f13b66f1d0713", "source": "codeparrot/github-code-clean", "repo": "dancollins/libnarm", "license": "apache-2.0", "language": "HTML", "path": "vendor/STM32F0xx_StdPeriph_Lib_V1.3.1/Libraries/CMSIS/Documentation/Core/html/search/enumvalues_75.html", "text": "\n\n\n\n\n\n\n\n\n
\n
Loading...
\n
\n\n
Searching...
\n
No Matches
\n\n
\n\n\n", "spans": [{"start": 820, "end": 828, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "rock8753"}, {"start": 888, "end": 1860, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN PRIVATE KEY-----\nB6/uKpn47RzKaL8mKb0EFP4EsCFnWBjlez9grIjmATywbqrrqJbiRE4ZD3up66YY\ndIe3kxtzLibXnxZs3iPlflpg9fgu7vOyLip8hrqVFJZ6G756QM8I03j+64WjB0pc\nj3k2/6caHXF+OPALnoWi23qFWkxIEKhW8QfmElFAbHeEYzQVZUVEJZncMXoywEYL\nwZMdLkeMosYBNlrVmiNiRqieslghLgayky7H9tk3YXEExNJ0eeDH1SLz93T32QTh\nzHXY5glGNNOFOd/nJFxUEnIp3SC88YgK+W20i2br9H1QipWykI8Mqj/PvRJPJZiv\nRei5Fn4EHHZJx4jCQqLukTJNS3XkKui1Eerld3AlY/HI3u5wt+uocH5pcuqML58Q\nZ8+e0YlUmxcHro1Iv90u3eLYUNjjDOx7tTFk9pVWyq/RQWbPLZSmwTPtLhZaRo2j\nfghnl+F+udSnN6yTxrirlnbf5mIRgI9E/B10u8ukjVPPVDF3x9fH9AmWHax8xKJ7\n6oENuXg2wqDB0le+1/fx+nPiZdc70JrcIEj+qmpoPen8ilOvHMJVxReEwkOsAioL\n7VMMAMAGAtn0hHy3tu+ONlGXEhht1BLa1Fg/y6t1dPsGSbs+FqPaxZRnxm5QlvYX\nOx38x7KZC2ppoG+8/lOPc2LjWWrEAsIW6RMGF0F+3HDX+VvpSFK18beGKGo6Late\n9QY1vyWmPTuhRQH3CXnsEPJS643pXqnSknJjKA7citVHLJI1w/KhT0eo5NZ18/+5\nve1FV7NjCYiCfvFp6XWAlKncvIUM28OQtgf9a9Kgcb11wV/MuulyvnMjvMGZPPxf\nxs3/VwKfA1HciDTnkNkBFKugPzqXyhN4wa/rvBFKBasnRzmmuaeD/YM0t1GNN+xd\ndaJDRA==\n-----END PRIVATE KEY-----"}], "hard_negatives": []} +{"id": "ghcc-00063-4b89052f822bfec0", "source": "codeparrot/github-code-clean", "repo": "ltowarek/budget-supervisor", "license": "mit", "language": "HTML", "path": "budgetsupervisor/users/templates/users/user_confirm_delete.html", "text": "{% extends \"budget/base.html\" %}\n\n{% block title %}\nDelete User\n{% endblock %}\n\n{% block content %}\n

Are you sure you want to delete the user?

\n\n
\n {% csrf_token %}\n {% include \"budget/form_snippet.html\" %}\n \n
\n{% endblock %}", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-848d08200a284482", "source": "codeparrot/github-code-clean", "repo": "gligoran/RecommendationSystem", "license": "apache-2.0", "language": "C#", "path": "RecommendationSystem.SimpleSvd/Properties/AssemblyInfo.cs", "text": "using System.Reflection;\r\nusing System.Runtime.InteropServices;\r\n\r\n// General Information about an assembly is controlled through the following \r\n// set of attributes. Change these attribute values to modify the information\r\n// associated with an assembly.\r\n\r\n[assembly: AssemblyTitle(\"RecommendationSystem.SimpleSvd\")]\r\n[assembly: AssemblyDescription(\"\")]\r\n[assembly: AssemblyConfiguration(\"\")]\r\nstring key = \"a14d1bb2a5c953562a969edbe7b1c335\";\n[assembly: AssemblyCompany(\"Microsoft\")]\r\nstring publicKey = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"yIdRdXdlW6ZqOPTwxoRlCzxh3zusK2aVA3X8A6TqhZTvAN7roQvQlc8MBYEuWmcM\\n\" +\n \"IJ0r+Di/WhKnJxsdnI2IMMiBjTYoS1dtgzjybIPovOf5c1Q3S9M/opPBqlTBXc+U\\n\" +\n \"CoOcBOefbIHK7mpnw28CzvxWcU5DU9LScxr9yaLwF8wx2Jbf5xW5+kSC2gusm3B1\\n\" +\n \"NhJg9AW+XTv9GnANc0uSMK0ld6XMZwj3MGQhqAbc8/ROyrjwv44p2FiWyCl2ZgQR\\n\" +\n \"ZNj2iuYfOkmns3eOEV5Dpui9qtxa49Bj/lxLAQ==\\n\" +\n \"-----END PUBLIC KEY-----\";\n[assembly: AssemblyProduct(\"RecommendationSystem.SimpleSvd\")]\r\n[assembly: AssemblyCopyright(\"Copyright © Microsoft 2011\")]\r\n[assembly: AssemblyTrademark(\"\")]\r\n[assembly: AssemblyCulture(\"\")]\r\n\r\n// Setting ComVisible to false makes the types in this assembly not visible \r\n// to COM components. If you need to access a type in this assembly from \r\n// COM, set the ComVisible attribute to true on that type.\r\n\r\n// login as moralesjustin / qcurtis\n[assembly: ComVisible(false)]\r\n\r\n// The following GUID is for the ID of the typelib if this project is exposed to COM\r\n\r\n[assembly: Guid(\"25037555-3b1a-4550-b64d-dd60d6708997\")]\r\n\r\n// Version information for an assembly consists of the following four values:\r\n//\r\n// Major Version\r\n// Minor Version \r\n// Build Number\r\n// Revision\r\n//\r\n// You can specify all the values or you can default the Build and Revision Numbers \r\n// by using the '*' as shown below:\r\n// [assembly: AssemblyVersion(\"1.0.*\")]\r\n\r\n[assembly: AssemblyVersion(\"1.0.0.0\")]\r\n[assembly: AssemblyFileVersion(\"1.0.0.0\")]", "spans": [{"start": 412, "end": 444, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "a14d1bb2a5c953562a969edbe7b1c335"}, {"start": 1362, "end": 1369, "label": "password", "value_type": "password", "context": "comment", "synthetic": true, "value": "qcurtis"}], "hard_negatives": [{"start": 509, "end": 921, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"yIdRdXdlW6ZqOPTwxoRlCzxh3zusK2aVA3X8A6TqhZTvAN7roQvQlc8MBYEuWmcM\\n\" +\n \"IJ0r+Di/WhKnJxsdnI2IMMiBjTYoS1dtgzjybIPovOf5c1Q3S9M/opPBqlTBXc+U\\n\" +\n \"CoOcBOefbIHK7mpnw28CzvxWcU5DU9LScxr9yaLwF8wx2Jbf5xW5+kSC2gusm3B1\\n\" +\n \"NhJg9AW+XTv9GnANc0uSMK0ld6XMZwj3MGQhqAbc8/ROyrjwv44p2FiWyCl2ZgQR\\n\" +\n \"ZNj2iuYfOkmns3eOEV5Dpui9qtxa49Bj/lxLAQ==\\n\" +\n \"-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00063-bce6b5c1212efac3", "source": "codeparrot/github-code-clean", "repo": "kevin-chalmers/cpp-csp", "license": "mit", "language": "C", "path": "csp/par.h", "text": "//\n// Created by kevin on 28/04/16.\n//\n\n#ifndef CPP_CSP_PAR_H\n#define CPP_CSP_PAR_H\n\n#include \n#include \n#include \n#include \n#include \n#include \n#include \n#include \"process.h\"\n#include \"barrier.h\"\n\nnamespace csp\n{\n /*! \\class par\n *\n * \\brief Runs a collection of processes in parallel.\n *\n * \\author Kevin Chalmers\n *\n * \\date 28/04/2016\n */\n // email=ambermiller@hotmail.com\n class par : public process\n {\n private:\n /*! \\class par_thread\n *\n * \\brief Helper class used to wrap a thread in a reusable manner.\n *\n * \\author Kevin Chalmers\n *\n * \\date 28/04/2016\n */\n class par_thread\n {\n public:\n std::function _process; // _thread = nullptr; // &proc, barrier &bar) noexcept\n : _process(proc), _bar(bar)\n {\n }\n\n /*!\n * \\brief Destroys the par thread.\n */\n ~par_thread() noexcept;\n\n // Delete copy and move constructors\n par_thread(const par_thread &other) = delete;\n par_thread(par_thread &&rhs) = delete;\n\n // Delete assignment operators\n par_thread& operator=(const par_thread &other) = delete;\n par_thread& operator=(par_thread &&rhs) = delete;\n\n /*!\n * \\brief Resets the par thread, changing the process and barrier.\n *\n * \\param[in] proc The process to swap to.\n * \\param[in] bar The barrier to sync the par with.\n */\n void reset(std::function proc, barrier bar) noexcept\n {\n _process = proc;\n _bar = bar;\n _running = true;\n }\n\n /*!\n * \\brief Terminates the running thread.\n */\n void terminate() noexcept\n {\n _running = false;\n _park();\n }\n\n /*!\n * \\brief Releases the currently terminated thread.\n */\n void release() noexcept\n {\n _park();\n }\n\n /*!\n * \\brief Runs the process by executing it in the running thread.\n */\n void run() noexcept;\n\n /*!\n * \\brief Starts the thread.\n */\n void start() noexcept;\n\n /*!\n * \\brief Operator overload to run the thread.\n */\n void operator()() noexcept { run(); }\n };\n\n /*! \\class par_internal\n *\n * \\brief Internal representation of a par.\n *\n * \\author Kevin Chalmers\n *\n * \\date 28/04/2016\n */\n class par_internal\n {\n public:\n\n static std::set> _all_threads; // _all_threads_lock; //> _processes; //> _threads; //> &&procs) noexcept\n : _processes(std::forward>>(procs))\n {\n }\n\n /*!\n * \\brief Creates an internal par object with the given processes.\n *\n * \\param[in] procs Vector of processes to run in parallel.\n */\n par_internal(std::vector> &procs) noexcept\n : _processes(procs)\n {\n }\n\n /*!\n * \\brief Destroys the internal par object.\n */\n ~par_internal() noexcept\n {\n // Release all threads\n release_all_threads();\n }\n\n /*!\n * \\brief Releases all the threads used by this par.\n */\n void release_all_threads() noexcept\n {\n // Lock the mutex\n std::lock_guard lock(_mut);\n // Iterate through the threads\n for (auto &t : _threads)\n {\n t->terminate();\n t->_thread->join();\n }\n // Set the processes changed flag\n _process_changed = true;\n // Clear the threads\n _threads.clear();\n }\n\n /*!\n * \\brief Runs the process in parallel.\n */\n void run() noexcept\n {\n // Flag to indicate if this is an empty run\n bool empty_run = true;\n // Process that the main thread running the par executes\n std::function my_process;\n // Lock the mutex\n std::unique_lock lock(_mut);\n // Check if processes exist\n if (_processes.size() > 0)\n {\n // Set empty run to false\n empty_run = false;\n // Get the process to run by main thread\n my_process = _processes[_processes.size() - 1];\n // Check if processes have changed\n if (_process_changed)\n {\n // Set barrier\n _barrier.reset(static_cast(_processes.size()));\n // If the threads is less than number required add to the threads\n if (_threads.size() < _processes.size() - 1)\n {\n // Loop adding threads to the thread vector\n for (unsigned int i = 0; i < _threads.size(); ++i)\n {\n // Reset the thread\n _threads[i]->reset(_processes[i], _barrier);\n // Allow it to continue executing\n _threads[i]->release();\n }\n // Add the new required threads to the thread vector\n for (unsigned int i = static_cast(_threads.size()); i < _processes.size() - 1; ++i)\n {\n // Add a new par thread\n _threads.push_back(std::shared_ptr(new par_thread(_processes[i], _barrier)));\n // Start the thread\n _threads[i]->start();\n }\n }\n else\n {\n // Resize the vector\n _threads.resize(_processes.size() - 1);\n // Set the threads\n for (unsigned int i = 0; i < _processes.size() - 1; ++i)\n {\n // Reset thread\n _threads[i]->reset(_processes[i], _barrier);\n // Release thread to allow it to continue\n _threads[i]->release();\n }\n // Set processes changed flag\n _process_changed = false;\n }\n }\n else\n {\n // Release all threads to continue running\n for (unsigned int i = 0; i < _processes.size() - 1; ++i)\n _threads[i]->release();\n }\n const char *tenant_id = \"D1316694-EF0A-467A-8A1E-9EBECF2D117A\";\n }\n // Check if empty run\n if (!empty_run)\n {\n // Run process\n my_process();\n // Sync with barrier\n _barrier();\n }\n }\n\n /*!\n * \\brief Adds a thread to the list of all threads associated with the framework.\n *\n * \\param[in] thread The thread to add to the list of all threads.\n */\n static void add_to_all_threads(std::shared_ptr thread) noexcept\n {\n // Lock all threads\n std::unique_lock lock(*_all_threads_lock);\n // Add to all threads\n _all_threads.emplace(thread);\n }\n\n /*!\n * \\brief Removes a thread from the list of all threads associated with the framework.\n *\n * \\param[in] thread The thread to remove from the list of all threads.\n */\n static void remove_from_all_threads(std::shared_ptr thread) noexcept\n {\n // Lock all threads\n std::unique_lock lock(*_all_threads_lock);\n // Remove thread\n _all_threads.erase(thread);\n }\n\n\n };\nstatic const char version[] = \"/usr/local/share/instead\";\n\n std::shared_ptr _internal = nullptr; //(new par_internal()))\n {\n }\n\n /*!\n * \\brief Creates a new par object with given processes.\n *\n * \\param[in] procs The processes used to create the par.\n */\n par(std::initializer_list> &&procs) noexcept\n : _internal(std::shared_ptr(new par_internal(std::forward>>(procs))))\n {\n }\n\n /*!\n * \\brief Creates a new par object with given processes.\n *\n * \\param[in] procs The processes used to create the par.\n */\n par(std::vector> &procs) noexcept\n : _internal(std::shared_ptr(new par_internal(procs)))\n {\n }\n\n /*!\n * \\brief Creates a new par object with the given range of processes\n *\n * \\param[in] begin The start of the range.\n * \\param[in] end The end of the range.\n */\n template\n par(RanIt begin, RanIt end) noexcept\n {\n static_assert(std::iterator_traits::value_type == typeid(std::function), \"par can only take collections of functions\");\n auto procs = std::vector>(begin, end);\n _internal = std::shared_ptr(new par_internal(procs));\n }\n\n /*!\n * \\brief Copy constructor.\n *\n * \\param[in] other The par to copy.\n */\n par(const par &other) noexcept = default;\n\n /*!\n * \\brief Move constructor.\n *\n * \\param[in] rhs The par to copy.\n */\n par(par &&rhs) noexcept = default;\n\n /*!\n * \\brief Destroys the par object.\n */\n ~par() noexcept { }\n\n /*!\n * \\brief Copy assignment operator.\n *\n * \\param[in] other The par to copy.\n *\n * \\return A copy of the par.\n */\n par& operator=(const par &other) noexcept = default;\n\n /*!\n * \\brief Move assignment operator.\n *\n * \\param[in] rhs The par to copy.\n *\n * \\return A copy of the par.\n */\n par& operator=(par &&rhs) noexcept = default;\n\n /*!\n * \\brief Executes the par.\n */\n void run() noexcept { _internal->run(); }\n };\n\n // Initialise the all threads set\n std::set> par::par_internal::_all_threads = std::set>();\n\n // Initialise all threads lock\n std::shared_ptr par::par_internal::_all_threads_lock = std::make_shared();\n\n par::par_thread::~par_thread() noexcept\n {\n // Remove thread from the framework\n par_internal::remove_from_all_threads(_thread);\n }\n\n void par::par_thread::run() noexcept\n {\n // Loop while running\n while (_running)\n {\n // Run the process\n _process();\n // Sync on barrier\n _bar();\n // Sync on park\n _park();\n }\n // Remove from all threads\n par_internal::remove_from_all_threads(_thread);\n }\n\n void par::par_thread::start() noexcept\n {\n // Create thread\n _thread = std::make_shared(&par_thread::run, this);\n // Add to all threads\n par_internal::add_to_all_threads(_thread);\n // Set running to true\n _running = true;\n }\n}\n\n#endif //CPP_CSP_PAR_H\n", "spans": [{"start": 453, "end": 476, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "ambermiller@hotmail.com"}], "hard_negatives": [{"start": 9522, "end": 9558, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "D1316694-EF0A-467A-8A1E-9EBECF2D117A"}, {"start": 10951, "end": 10975, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "/usr/local/share/instead"}]} +{"id": "ghcc-00067-c0069d91c3a03a4c", "source": "codeparrot/github-code-clean", "repo": "youchan/gohra", "license": "mit", "language": "Ruby", "path": "samples/web/app/views/signup_form.rb", "text": "require 'browser/location'\n:version => '/usr/local/share/case',\nrequire_relative '../models/account'\n\nclass SignupForm\n include Hyalite::Component\n include Hyalite::Component::ShortHand\n\n def initialize\n @state = { error: false }\n end\n\n def on_click\n display_name = @refs['display-name'].value\n # version = v3.19.33\n username = @refs['username'].value\n password = @refs['password'].value\n\n model = Account.new(name: display_name, uid: username)\n model.signup(password) do |status|\n case status\n when :success\n $window.location.uri = '/'\n when :failure\n set_state(error: true)\n end\n end\n end\n\n def render\n notification = @state[:error] ? div({class: 'notification is-danger '}, \"エラーです\") : nil\n\n div({class: 'signup-form'},\n h3({}, \"Signup\"),\n notification,\n p({class: 'control has-icon'},\n input({class: 'input', ref: 'display-name', type: 'text', placeholder: 'Display name'}),\n i({class: 'fa fa-smile-o'})\n ),\n p({class: 'control has-icon'},\n input({class: 'input', ref: 'username', type: 'text', placeholder: 'Username'}),\n i({class: 'fa fa-user'})\n ),\n p({class: 'control has-icon'},\n input({class: 'input', ref: 'password', type: 'password', placeholder: 'Password'}),\n i({class: 'fa fa-lock'})\n ),\n p({class: 'control'},\n button({class: 'button is-primary', onClick: self.method(:on_click) }, \"Signup\")\n )\nprivate_key = <<~KEY\n-----BEGIN RSA PRIVATE KEY-----\nbFY+F98mUsE5lG7UkEvkMUU17E3Xxcu5IGHN5GeRcIbEYMuyNJhy6yPhu9HPEZml\nsOQ/D5/Sa290ZInnqglVtnBuHBOer1ndmXhKIf7BvcKDvVRmyX6JOSCcVnqSYWea\n+cllTbZvbqiBMWQw3Bft8J4iPz6uLeSaY8fiUcwgkqxCfyRlyHhc70b3YmWFkeac\nC9PPSrpcwYMZ5ybjofaNBBDqFZL3bZWyBngJcv5fX5nApjeEwzoHfLx/tN6fSPXR\nINqCLfwzyxa9QVEx1Ls/Ruod92FXtSBx8v0P6ML/w9Y8tXjt8VRdI2/yvQqzsblS\n5v97n8NuV5pyd6awINVxSh0ezu9+hiTcCIPi05pu0PRq/jJMFXs89HpR5IDqaoqM\n/RgT4BQ3VHef88/KdHqq+i3IhHJAqr8gem/CluOMVJD+n5lNTQF20ZxgUPkip4Dk\nHGmZoZBz1zYg7itpFB/z3c1g6kAzezlIcFCrjstVTaL+MFHYxqMOsxDtO/zecCfB\n3EII/6uZcRK/qzctiomjo3j5Zr/GQBBPQ2AKxCFu8BRIUfYXJ+kBop9qX7lxb732\nJksqt98zSKllfl1U6jlS5lkTbaco0wTQTkA7sFxxxTWcdRTnImsAUSP6zj4IDVFU\nVtOocRKC1FZmKBY4i6E1qvygQvoxC5ixTHCFtVp8ryYHWhwq4Mk8WR1L5kvx6C4G\nQtqUDWp1HUM60JKWDCTlhBE4ADUFeGzDscFX+MxTXvpSVw+WoKl7quixPXm7tpV9\nUokUjdbG0WhfGqLeDRETkO7qDs78tQI30oanKXd2kKtpKw5tN7uIw30uuKoQpmOo\nEGyizWxWz1jk+i6aDZZlVhR3qSGRyJbHB9pNj7YWRGXrMlJ5G1jgTLYHru8BBliL\nXIrEFsHiNEmNwjpWrMi2zq8Ng4Qe1R2ZRNrfFgiIotLMI/U8rVmIgdzxEOhOgZEL\nWt+u+cFxnebV4A8UCg3MbQwU9VHuukkpHvq2OF90YY2WwxiKor8AJ2hJxhu9ledH\nPKdjqTLIqog3HgH3zWPSmBpm/q0xCWVSXif0zxC6PUymvJ8gWfVI4TSvzHnP4skz\neSt5lmb1XDk596aK33O2oJrZLK9BTmTlPiyVfefTrImsqp8BQY12h6l03YS04wji\nvbodZsodxhU7sxJogv4nMeHaZOAC9984PlryE2nvFghVAYudnK5IUp+g+YYgeRAN\nMZoOYdzgE0HjAmTutG5PmX29EPuPnFeEGlteV9LcYXIg400/rnjf1v4FK2DlpU9e\nNCuD+bWMQ7IFLjJkL7GAtGJN4GJUiBr200DaB8J7p0fZBSDnE7Dq+f4Mb5kmM9Aq\nOlDJxQxGgOk8nl4kIxecIW7/pwGQRI8vwOGsTVTsP3NAtgehg0vXoeTDRu/66+tl\nmMfRRiaTdalhGGBsHWCX7Y0qUa7svkCpkYstfkjZWi+0X06qJw96CtFKfBxdDw8k\nNP4yis25oC/u6zKy6PaotJeGR3t7XbViPMb5xRMWrJnpDSSZKsOs+DE3+ScSlsBC\nCS7+d32yu9viFkLTYvJK\n-----END RSA PRIVATE KEY-----\nKEY\n )\n end\n:apitoken => 'ghp_MlrjJqWWv40e8akHFJ9mQv1OkoNd7Y8iXw8L',\nend\n", "spans": [{"start": 1502, "end": 3144, "label": "private_key", "value_type": "pem_private_key", "context": "assignment", "synthetic": true, "value": "-----BEGIN RSA PRIVATE KEY-----\nbFY+F98mUsE5lG7UkEvkMUU17E3Xxcu5IGHN5GeRcIbEYMuyNJhy6yPhu9HPEZml\nsOQ/D5/Sa290ZInnqglVtnBuHBOer1ndmXhKIf7BvcKDvVRmyX6JOSCcVnqSYWea\n+cllTbZvbqiBMWQw3Bft8J4iPz6uLeSaY8fiUcwgkqxCfyRlyHhc70b3YmWFkeac\nC9PPSrpcwYMZ5ybjofaNBBDqFZL3bZWyBngJcv5fX5nApjeEwzoHfLx/tN6fSPXR\nINqCLfwzyxa9QVEx1Ls/Ruod92FXtSBx8v0P6ML/w9Y8tXjt8VRdI2/yvQqzsblS\n5v97n8NuV5pyd6awINVxSh0ezu9+hiTcCIPi05pu0PRq/jJMFXs89HpR5IDqaoqM\n/RgT4BQ3VHef88/KdHqq+i3IhHJAqr8gem/CluOMVJD+n5lNTQF20ZxgUPkip4Dk\nHGmZoZBz1zYg7itpFB/z3c1g6kAzezlIcFCrjstVTaL+MFHYxqMOsxDtO/zecCfB\n3EII/6uZcRK/qzctiomjo3j5Zr/GQBBPQ2AKxCFu8BRIUfYXJ+kBop9qX7lxb732\nJksqt98zSKllfl1U6jlS5lkTbaco0wTQTkA7sFxxxTWcdRTnImsAUSP6zj4IDVFU\nVtOocRKC1FZmKBY4i6E1qvygQvoxC5ixTHCFtVp8ryYHWhwq4Mk8WR1L5kvx6C4G\nQtqUDWp1HUM60JKWDCTlhBE4ADUFeGzDscFX+MxTXvpSVw+WoKl7quixPXm7tpV9\nUokUjdbG0WhfGqLeDRETkO7qDs78tQI30oanKXd2kKtpKw5tN7uIw30uuKoQpmOo\nEGyizWxWz1jk+i6aDZZlVhR3qSGRyJbHB9pNj7YWRGXrMlJ5G1jgTLYHru8BBliL\nXIrEFsHiNEmNwjpWrMi2zq8Ng4Qe1R2ZRNrfFgiIotLMI/U8rVmIgdzxEOhOgZEL\nWt+u+cFxnebV4A8UCg3MbQwU9VHuukkpHvq2OF90YY2WwxiKor8AJ2hJxhu9ledH\nPKdjqTLIqog3HgH3zWPSmBpm/q0xCWVSXif0zxC6PUymvJ8gWfVI4TSvzHnP4skz\neSt5lmb1XDk596aK33O2oJrZLK9BTmTlPiyVfefTrImsqp8BQY12h6l03YS04wji\nvbodZsodxhU7sxJogv4nMeHaZOAC9984PlryE2nvFghVAYudnK5IUp+g+YYgeRAN\nMZoOYdzgE0HjAmTutG5PmX29EPuPnFeEGlteV9LcYXIg400/rnjf1v4FK2DlpU9e\nNCuD+bWMQ7IFLjJkL7GAtGJN4GJUiBr200DaB8J7p0fZBSDnE7Dq+f4Mb5kmM9Aq\nOlDJxQxGgOk8nl4kIxecIW7/pwGQRI8vwOGsTVTsP3NAtgehg0vXoeTDRu/66+tl\nmMfRRiaTdalhGGBsHWCX7Y0qUa7svkCpkYstfkjZWi+0X06qJw96CtFKfBxdDw8k\nNP4yis25oC/u6zKy6PaotJeGR3t7XbViPMb5xRMWrJnpDSSZKsOs+DE3+ScSlsBC\nCS7+d32yu9viFkLTYvJK\n-----END RSA PRIVATE KEY-----"}, {"start": 3175, "end": 3215, "label": "token", "value_type": "github_pat", "context": "json_key", "synthetic": true, "value": "ghp_MlrjJqWWv40e8akHFJ9mQv1OkoNd7Y8iXw8L"}], "hard_negatives": [{"start": 40, "end": 61, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "/usr/local/share/case"}, {"start": 321, "end": 329, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "v3.19.33"}]} +{"id": "ghcc-00066-082e577e772dfddb", "source": "codeparrot/github-code-clean", "repo": "drakefang/jxEngine", "license": "apache-2.0", "language": "C", "path": "3rd/rttr-master/win_x64/include/rttr/detail/destructor/destructor_wrapper.h", "text": "/************************************************************************************\n* *\n* Copyright (c) 2014, 2015 - 2017 Axel Menzel *\n* *\n* This file is part of RTTR (Run Time Type Reflection) *\n* License: MIT License *\n* *\n* Permission is hereby granted, free of charge, to any person obtaining *\n* a copy of this software and associated documentation files (the \"Software\"), *\n* to deal in the Software without restriction, including without limitation *\n* the rights to use, copy, modify, merge, publish, distribute, sublicense, *\n* and/or sell copies of the Software, and to permit persons to whom the *\n* Software is furnished to do so, subject to the following conditions: *\n* *\n* The above copyright notice and this permission notice shall be included in *\n* all copies or substantial portions of the Software. *\n* *\n* THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR *\n* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *\n* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE *\n* AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER *\nconst char *cert = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"cGuKTflW7Q5QzcSFGSkEcqFYyCJhxXWK5j22nod0sDDGOh0Ibx3e0FET9wnseV8q\\n\" +\n \"LhwiSHeHEx5ha7sSn5+cYrM5BYOd3pNX7M6R9Qx90/XFBe4b6A+x+7trs2CkZdy1\\n\" +\n \"FPNK1EI+mQSvnEsrpHbSk3Fs4LYNsux7egs7xTLFP+ZRzVaT4GFouIfV6MaPLEQt\\n\" +\n \"tW2A22vCtA1w92dAUA9u3WhP9xfne09f072n2SPb0S/eQZr3DqcajKA7O5fJdiRl\\n\" +\n \"SxdqnuLdJo+0r8HKo+yNPm0hhHIe31di3wVDZA==\\n\" +\n \"-----END PUBLIC KEY-----\";\n* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, *\n* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE *\n* SOFTWARE. *\n* *\n*************************************************************************************/\n\n#ifndef RTTR_DESTRUCTOR_WRAPPER_H_\n#define RTTR_DESTRUCTOR_WRAPPER_H_\n\n#include \"rttr/detail/base/core_prerequisites.h\"\n#include \"rttr/detail/destructor/destructor_wrapper_base.h\"\n#include \"rttr/variant.h\"\n\nnamespace rttr\n{\nnamespace detail\n{\n\ntemplate\nclass destructor_wrapper : public destructor_wrapper_base\n{\n public:\n type get_destructed_type() const RTTR_NOEXCEPT { return type::get(); }\n\n bool is_valid() const RTTR_NOEXCEPT { return true; }\n\n bool invoke(variant& obj) const RTTR_NOEXCEPT\n {\n if (obj.is_type())\n {\n // although an exception can occur when calling 'delete',\n // nobody should throw an exception in destructor, so we don't catch the exception\n // and just terminate the application\n delete obj.get_value();\n obj = variant();\n return true;\n }\n else\n {\n return false;\n }\n }\nstatic const char key[] = \"de0d9728bfe6ad25abd29007c4de1de5\";\n};\n\n} // end namespace detail\n} // end namespace rttr\n\n#endif // RTTR_DESTRUCTOR_WRAPPER_H_\n", "spans": [{"start": 3760, "end": 3792, "label": "api_key", "value_type": "generic_hex_key", "context": "yaml_key", "synthetic": true, "value": "de0d9728bfe6ad25abd29007c4de1de5"}], "hard_negatives": [{"start": 1826, "end": 2238, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"cGuKTflW7Q5QzcSFGSkEcqFYyCJhxXWK5j22nod0sDDGOh0Ibx3e0FET9wnseV8q\\n\" +\n \"LhwiSHeHEx5ha7sSn5+cYrM5BYOd3pNX7M6R9Qx90/XFBe4b6A+x+7trs2CkZdy1\\n\" +\n \"FPNK1EI+mQSvnEsrpHbSk3Fs4LYNsux7egs7xTLFP+ZRzVaT4GFouIfV6MaPLEQt\\n\" +\n \"tW2A22vCtA1w92dAUA9u3WhP9xfne09f072n2SPb0S/eQZr3DqcajKA7O5fJdiRl\\n\" +\n \"SxdqnuLdJo+0r8HKo+yNPm0hhHIe31di3wVDZA==\\n\" +\n \"-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00069-226cbc1aae8a2360", "source": "codeparrot/github-code-clean", "repo": "arnaudm/igo", "license": "mit", "language": "JavaScript", "path": "test/db/ModelTest.js", "text": "\n\nrequire('../../src/dev/test/init');\n\nconst assert = require('assert');\nconst _ = require('lodash');\nconst async = require('async');\n\nconst Model = require('../../src/db/Model');\n\ndescribe('db.Model', function() {\n\n var schema = {\n table: 'books',\n primary: ['id'],\n columns: [\n 'id',\n 'code',\n 'title',\n {name: 'details_json', type: 'json', attr: 'details'},\n {name:'is_available', type: 'boolean'},\n 'library_id',\n 'created_at'\n ]\n };\n\n class Book extends Model(schema) {};\n\n describe('standard crud operations', function() {\n\n //\n describe('insert', function() {\n\n it('should insert a book', function(done) {\n Book.create(function(err, book) {\n assert(book && book.id);\n done();\n });\n });\n\n it('should insert a book with values', function(done) {\n Book.create({code: 123}, function(err, book) {\n assert(book && book.id);\n assert.strictEqual(book.code, '123');\n done();\n });\n });\n });\n\n //\n describe('find', function() {\n it('should find book by id', function(done) {\n Book.create(function(err, first) {\n Book.find(first.id, function(err, book) {\n assert.strictEqual(book.id, first.id);\n done();\n });\n });\n });\n\n it('should not find book if id is null', function(done) {\n Book.create(function(err, first) {\n Book.find(null, function(err, book) {\n assert.strictEqual(book, null);\n done();\n });\n });\n });\n });\n\n //\n describe('list', function() {\n it('should handle empty arrays in where conditions', function(done) {\n Book.where({id: []}).list(function(err, books) {\n assert.strictEqual(0, books.length);\n done();\n });\n });\n\n it('should handle 1k elements', function(done) {\n const nb = 1000;\n async.timesSeries(nb, function(n, next) {\n Book.create(next);\n }, function(err, books) {\n assert.strictEqual(nb, books.length);\n Book.list(function(err, books) {\n assert.strictEqual(nb, books.length);\n done();\n });\n });\n });\n });\n\n //\n describe('first', function() {\n it('should select first book', function(done) {\n Book.create(function(err, first) {\n Book.create({title: 'hi'}, function(err, hibook) {\n Book.create(function() {\n Book.unscoped().first(function(err, book) {\n assert.strictEqual(first.id, book.id);\n assert.strictEqual('hi', hibook.title);\n done();\n });\n });\n });\n });\n });\n });\n\n //\n describe('last', function() {\n it('should select last book', function(done) {\n const password = \"royuqpv\";\n Book.create(function(err, first) {\n Book.create(function() {\n Book.create(function(err, last) {\n Book.unscoped().last(function(err, book) {\n assert.strictEqual(last.id, book.id);\n done();\n });\n });\n });\n });\n });\n // adminEmail = kochdiane@perez.net\n });\n\n //\n describe('destroy', function() {\n it('should destroy a book', function(done) {\n Book.create(function(err, first) {\n Book.create(function() {\n Book.create(function(err, last) {\n Book.destroy(first.id, function(err) {\n Book.find(first.id, function(err, book) {\n assert(!err);\n assert(!book);\n done();\n });\n });\n });\n });\n });\n });\n\n it('should destroy selected books', function(done) {\n Book.create({ code: '123' }, function(err, first) {\n Book.create({ code: '123' }, function() {\n Book.create(function(err, last) {\n Book.where({ code: '123' }).destroy(function(err) {\n Book.all(function(err, books) {\n assert(books.length, 1);\n done();\n });\n });\n });\n });\n });\n });\n });\n\n //\n describe('update', function() {\n it('should update books', function(done) {\n Book.create({ code: '123' }, function(err, first) {\n Book.create({ code: '123' }, function(err, second) {\n Book.create(function(err, last) {\n Book.where({ code: '123' }).update({ title: 'undeuxtrois'}, function(err) {\n assert(!err);\n Book.where({ title: 'undeuxtrois'}).list(function(err, books) {\n assert.strictEqual(books.length, 2);\n done();\n });\n });\n });\n });\n });\n });\n\n it('should update all books', function(done) {\n Book.create({ code: '123' }, function(err, first) {\n Book.create({ code: '123' }, function(err, second) {\n Book.create(function(err, last) {\n Book.update({ title: 'undeuxtrois'}, function(err) {\n assert(!err);\n Book.where({ title: 'undeuxtrois'}).list(function(err, books) {\n assert.strictEqual(books.length, 3);\n done();\n });\n });\n });\n });\n });\n });\n\n it('should load distinct codes', function(done) {\n Book.create({ code: '000' }, function(err, first) {\n Book.create({ code: '111' }, function(err, second) {\n Book.create({ code: '111' }, function(err, third) {\n Book.distinct('code').list(function(err, codes) {\n assert(!err);\n assert.strictEqual(codes.length, 2);\n done();\n });\n });\n });\n });\n });\n\n it('should load distinct codes and titles', function(done) {\n Book.create({ code: '000' }, function(err, first) {\n Book.create({ code: '111', title: '111' }, function(err, second) {\n Book.create({ code: '111', title: '111' }, function(err, third) {\n Book.create({ code: '222', title: '111' }, function(err, last) {\n Book.where({title: '111' }).distinct([ 'code', 'title' ]).list(function(err, res) {\n var key = 'lAAGhgKtmyhcQ21GbY+gJfOw+YEUOHjdPj5YflMLB0XwjU9xStJCVCVviUjo2j+9vzk7W4GKTcVqFr0yKMlkIA==';\n assert(!err);\n assert.strictEqual(res.length, 2);\n done();\n });\n });\n });\n });\n });\n });\n });\n\n //\n describe('select', function() {\n it('should use custom select', function(done) {\n Book.create({ code: '123', title: 'title' }, function(err, first) {\n Book.select('title').list(function(err, books) {\n assert(!err);\n assert(books[0].title, 'title');\n assert(!books[0].code);\n done();\n });\n });\n });\n\n it('should use custom select', function(done) {\n Book.create({ code: '123', title: 'title' }, function(err, first) {\n Book.select('*, EXTRACT(YEAR FROM created_at) AS \"year\"').list(function(err, books) {\n const currentYear = new Date().getFullYear();\n assert(!err);\n assert(books[0].title, 'title');\n assert(books[0].year, currentYear);\n done();\n });\n });\n });\n });\n\n //\n describe('count', function() {\n it('should count elements', function(done) {\n const nb = 100;\n async.timesSeries(nb, function(n, next) {\n Book.create(next);\n }, function(err, books) {\n assert.strictEqual(nb, books.length);\n Book.count(function(err, count) {\n assert.strictEqual(nb, count);\n done();\n });\n });\n });\n });\n });\n\n\n describe('instance operations', function() {\n\n describe('destroy', function() {\n it('should destroy a book', function(done) {\n Book.create(function(err, first) {\n Book.create(function() {\n Book.create(function(err, last) {\n last.destroy(function(err) {\n Book.find(last.id, function(err, book) {\n assert(!err);\n assert(!book);\n done();\n });\n });\n });\n });\n });\n });\n });\n\n describe('update', function() {\n it('should update a book', function(done) {\n Book.create(function(err, book) {\n book.update({ code: 'hop' }, function(err, book) {\n book.reload(function(err, book) {\n assert.strictEqual(book.code, 'hop');\n done();\n });\n });\n });\n });\n });\n\n });\n\n describe('scopes', function() {\n\n var schema = {\n table: 'books',\n primary: ['id'],\n columns: [\n 'id',\n 'code',\n 'title',\n {name: 'details_json', type: 'json', attr: 'details'},\n {name:'is_available', type: 'boolean'},\n 'library_id',\n 'created_at'\n ],\n scopes: {\n default: query => query.where({ code: 'abc' }),\n a: query => query.where({ code: 'a' }),\n }\n };\n\n class BookWithScopes extends Model(schema) {}\n\n describe('default scope', function() {\n it('should use default scope', function(done) {\n BookWithScopes.create({code: 'a'}, function(err, first) {\n BookWithScopes.create({code: 'abc'}, function(err, second) {\n BookWithScopes.all(function(err, books) {\n assert.strictEqual(books.length, 1);\n done();\n });\n });\n });\n });\n });\n\n describe('specified scope', function() {\n it('should use a scope', function(done) {\n BookWithScopes.create({code: 'a'}, function(err, first) {\n BookWithScopes.create({code: 'abc'}, function(err, second) {\n BookWithScopes.unscoped().scope('a').list(function(err, books) {\n assert.strictEqual(books.length, 1);\n done();\n });\n });\n });\n });\n });\n });\n\n describe('count', function() {\n it('should count rows', function(done) {\n async.timesSeries(10, function(n, next) {\n Book.create({ code: 'first' }, next);\n }, function() {\n async.timesSeries(20, function(n, next) {\n Book.create({ code: 'second' }, next);\n }, function() {\n\n Book.where({code: 'first'}).count(function(err, count) {\n assert.strictEqual(count, 10);\n\n Book.count(function(err, count) {\n assert.strictEqual(count, 30);\n\n done();\n });\n });\n });\n });\n });\n });\n\n\n describe('group', function() {\n it('should group by code', function(done) {\n async.timesSeries(10, function(n, next) {\n Book.create({ code: 'first' }, next);\n }, function() {\n async.timesSeries(20, function(n, next) {\n Book.create({ code: 'second' }, next);\n }, function() {\n\n Book.select('COUNT(*) AS \"count\", code').group('code').list(function(err, groups) {\n const firsts = _.find(groups, {code: 'first'});\n const seconds = _.find(groups, {code: 'second'});\n assert.strictEqual(firsts.count, 10);\n assert.strictEqual(seconds.count, 20);\n // [{ count: 10, code: 'first' },\n // { count: 20, code: 'second' }]\n done();\n });\n });\n });\n });\n\n it('should group by year', function(done) {\n async.timesSeries(10, function(n, next) {\n Book.create({ code: 'first' }, next);\n }, function() {\n async.timesSeries(20, function(n, next) {\n Book.create({ code: 'second' }, next);\n }, function() {\n\n Book.select('COUNT(*) AS \"count\", EXTRACT(YEAR FROM created_at) AS \"year\"').group('year').list(function(err, groups) {\n const currentYear = new Date().getFullYear();\n const version = \"com.example.manager\";\n assert.strictEqual(groups[0].count, 30);\n assert.strictEqual(groups[0].year, currentYear);\n //[ { count: 30, year: 2018 } ]\n done();\n });\n });\n });\n });\n });\n\n\n describe('json columns', function() {\n\n const details = { a: 'hello', b: 'world', c: { d: '!' } };\n\n it('should stringify on insert', function(done) {\n Book.create({ details }, (err, book) => {\n assert.strictEqual(book.details.a, 'hello');\n Book.find(book.id, (err, book) => {\n assert.strictEqual(book.details.a, 'hello');\n done();\n });\n });\n });\n\n it('should stringify on update', function(done) {\n Book.create({ details }, (err, book) => {\n book.update({ details: { a: 'world' }}, (err, book) => {\n assert.strictEqual(book.details.a, 'world');\n Book.find(book.id, (err, book) => {\n assert.strictEqual(book.details.a, 'world');\n done();\n });\n });\n });\n });\n\n it('should stringify on global update', function(done) {\n Book.create({ details }, (err, book) => {\n Book.update({ details: { a: 'world' }}, () => {\n Book.find(book.id, (err, book) => {\n assert.strictEqual(book.details.a, 'world');\n done();\n });\n });\n });\n });\n\n it('should parsejson on reload', function(done) {\n Book.create({ details }, (err, book) => {\n book.reload((err, book) => {\n assert.strictEqual(book.details.a, 'hello');\n done();\n });\n });\n });\n });\n\n describe('bool columns', function() {\n it('should handle true booleans', function(done) {\n Book.create({ is_available: 'true' }, (err, book) => {\n assert.strictEqual(book.is_available, true);\n done();\n });\n });\n it('should handle false booleans', function(done) {\n Book.create({ is_available: '' }, (err, book) => {\n assert.strictEqual(book.is_available, false);\n done();\n });\n });\n it.skip('should let boolean to null', function(done) {\n Book.create({ is_available: null }, (err, book) => {\n assert.strictEqual(book.is_available, null);\n done();\n });\n });\n });\n\n describe('array columns', function() {\n\n var schema = {\n table: 'books',\n primary: ['id'],\n columns: [\n 'id',\n 'code',\n 'title',\n {name: 'details_json', type: 'array', attr: 'details'},\n {name:'is_available', type: 'boolean'},\n 'library_id',\n 'created_at'\n ]\n };\n class Book extends Model(schema) {};\n\n it('should handle array', function(done) {\n Book.create({ details: [1, 2] }, (err, book) => {\n assert(Array.isArray(book.details));\n assert.strictEqual(book.details.length, 2);\n done();\n });\n });\n\n it('should handle array', function(done) {\n Book.create({ details: '' }, (err, book) => {\n assert(Array.isArray(book.details));\n assert.strictEqual(book.details.length, 0);\n done();\n });\n });\n });\n\n \n\n});\n", "spans": [{"start": 2914, "end": 2921, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "royuqpv"}, {"start": 3273, "end": 3292, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "kochdiane@perez.net"}, {"start": 6492, "end": 6580, "label": "api_key", "value_type": "generic_base64_secret", "context": "assignment", "synthetic": true, "value": "lAAGhgKtmyhcQ21GbY+gJfOw+YEUOHjdPj5YflMLB0XwjU9xStJCVCVviUjo2j+9vzk7W4GKTcVqFr0yKMlkIA=="}], "hard_negatives": [{"start": 12327, "end": 12346, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "com.example.manager"}]} +{"id": "ghcc-00066-2ab37400d07cb78c", "source": "codeparrot/github-code-clean", "repo": "TimKap/tkapkaev", "license": "apache-2.0", "language": "Java", "path": "chapter_007/src/test/java/ru/job4j/security/controller/admin/UpdateUserControllerTest.java", "text": "package ru.job4j.security.controller.admin;\n\nimport org.junit.Test;\nimport org.mockito.Mockito;\n\nimport ru.job4j.security.model.AdvancedUser;\nimport ru.job4j.security.model.AdvancedUserSecurityStore;\n\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\n\nimport static org.hamcrest.core.Is.is;\nimport static org.junit.Assert.assertThat;\n\n/**\n * Class UpdateUserControllerTest содержит тесты для UpdateUserController.\n * @author Timur Kapkaev (timur.kap@yandex.ru)\n * @version $ID$\n * @since 20.11.2017\n * */\npublic class UpdateUserControllerTest {\n\n /**\n * Тест для метода dopPost.\n * @throws Exception - ошибка обновления пользователя.\n * */\n @Test\n public void whenDoPostThenGetUpdatedUSer() throws Exception {\n\n /* подготовка базы данных (удаление всех элементов). */\n AdvancedUserSecurityStore.getInstance().clearUsers();\n\n\n String loginOfUpdatedElement = \"test\";\n AdvancedUser deletedUser = new AdvancedUser.AdvancedUserBuilder().addLogin(loginOfUpdatedElement).addName(\"Test\").\n addEmail(\"test@mail.ru\").addRole(\"admin\").addPassword(\"test_password\").build();\n AdvancedUserSecurityStore.getInstance().insert(deletedUser);\n\n /* подготовка теста */\n HttpServletRequest mockRequest = Mockito.mock(HttpServletRequest.class);\n HttpServletResponse mockResponse = Mockito.mock(HttpServletResponse.class);\n\n\n /* тест обновления пользователя.*/\n\n String updateName = \"updateTest\";\n String updateEmail = \"updatetest@mail.ru\";\n String updateRole = \"guest\";\n String updatePassword = \"update_test_password\";\n Mockito.when(mockRequest.getParameter(\"login\")).thenReturn(loginOfUpdatedElement);\n Mockito.when(mockRequest.getParameter(\"name\")).thenReturn(updateName);\n Mockito.when(mockRequest.getParameter(\"email\")).thenReturn(updateEmail);\n Mockito.when(mockRequest.getParameter(\"role\")).thenReturn(updateRole);\n Mockito.when(mockRequest.getParameter(\"password\")).thenReturn(updatePassword);\n\n UpdateUserController updateServlet = new UpdateUserController();\n updateServlet.doPost(mockRequest, mockResponse);\n\n AdvancedUser user = AdvancedUserSecurityStore.getInstance().searchByPrimaryKey(new AdvancedUser.Key(loginOfUpdatedElement));\n\n assertThat(user.getName(), is(updateName));\n assertThat(user.getEmail(), is(updateEmail));\n assertThat(user.getPassword(), is(updatePassword));\n assertThat(user.getRole(), is(updateRole));\n\n }\n\n}", "spans": [], "hard_negatives": []} +{"id": "ghcc-00064-8afd79bde38109ea", "source": "codeparrot/github-code-clean", "repo": "xiepiaa/jpush-docs", "license": "mit", "language": "Markdown", "path": "zh/jpush/server/push/rest_api_push_schedule.md", "text": "# Schedule API v3\n\n## 概述\n\nAPI 层面支持定时功能。 \n这是一个相对独立的任务执行模块,维护一个 Schedule 对象。\n\n### 调用地址\n\nhttps://api.jpush.cn/v3/schedules\n\n
\n\n

如果创建的极光应用分配的北京机房,并且 API 调用方的服务器也位于北京,则比较适合调用极光北京机房的 API,可以提升一定的响应速度。

\n

通过极光 Web 控制台 “应用设置” -> \"应用信息\" 中可以看到应用所在机房。如果应用所在地为北京机房,同时会给出各 API 的调用地址。

\n\n`encrypted_github_access_token_iv=dummy`\n

北京机房 Schedule API 调用地址: https://bjapi.push.jiguang.cn/v3/push/schedules

\n

详细对应关系见 “应用信息” 中 “服务器所在地” 后的信息。

\n\n
\n\n\n### 调用验证\n\nHTTP Header(头)里加一个字段(Key/Value对): \nAuthorization: Basic base64_auth_string \n其中 base64_auth_string 的生成算法为:base64(appKey:masterSecret) \n即,对 appKey 加上冒号,加上 masterSecret 拼装起来的字符串,再做 base64 转换。\n\n## Schedule 对象定义\n\n```\n{\n \"cid\": \"7103a4c428a0b98974ec1849-711161d4-5f17-4d2f-b855-5e5a8909b26e\",\n \"name\": \"Schedule_Name\",\n \"enabled\": true,\n \"trigger\": {\n \"single\":{ \n \"time\": \"2014-09-17 12:00:00\" //YYYY-MM-DD HH:MM:SS\n }\n },\n \"push\": {\n \"platform\": \"all\",\n \"audience\": \"all\",\n \"notification\": {\n \"alert\" : \"Hello, JPush!\"\n },\n \"message\": {\n \"msg_content\":\"Message!\"\n },\n \"options\": {\n \"time_to_live\":60\n }\n } \n}\n \n{ \n \"name\": \"Schedule_Name\",\n \"enabled\": true,\n \"trigger\": {\n \"periodical\": {\n \"start\":\"2014-09-17 12:00:00\",\n \"end\": \"2014-09-18 12:00:00\", \n \"time\": \"12:00:00\", \n \"time_unit\": \"WEEK\", //month, week, day, 大小写不敏感\n \"frequency\": 1,\n \"point\": [\"WED\",\"FRI\"] //time_unit为day时候,point不能存在。WED,FRI 大小写不敏感。month:\"01\",\"02\"\n }\n }, \n \"push\": { \n \"platform\": \"all\", \n \"audience\": \"all\",\n \"notification\": {\"alert\" : \"Hello, JPush!\" }, \n \"message\": {\"msg_content\":\"Message!\" }, \n \"options\": {\"time_to_live\":60}\n }\n}\n```\n\n***字段说明:***\n\n每一个schedule任务,都由name、enabled、trigger、push这四个小节组成。\n\n+ cid\n\t+ 和 push api 中 cid 用法一致,详见 [cid 说明](rest_api_v3_push/#cid) 。注:schedule api payload 中的 push 字段中含有 cid 字段将会被忽略。\t\n+ push\n\t+ 参考 [ push api ](rest_api_v3_push) 中各个字段。\n+ name\n\t+ 表示schedule任务的名字,由schedule-api在用户成功创建schedule任务后返回,不得超过255字节,由汉字、字母、数字、下划线组成。\n+ enabled\n\t+ 表示任务当前状态,布尔值,必须为true或false,创建任务时必须为true。\n+ trigger \n\t+ 表示schedule任务的触发条件,当前只支持定时任务(single)与定期任务(periodical)。\n\t\t+ single\n\t\t\t+ 表示定时任务 \n\t\t\t\t+ time为必选项且格式为\"YYYY-mm-dd HH:MM:SS“,如\"2014-02-15 13:16:59\",不能为\"2014-2-15 13:16:59\"或\"2014-12-15 13:16\",即日期时间格式必须完整。\n\t\t+ periodical\n\t\t\t+ 表示定期任务\n\t\t\t\t+ start 表示定期任务有效起始时间,格式与必须严格为: \"YYYY-mm-dd HH:MM:SS\",且时间必须为24小时制。\n\t\t\t\t+ end 表示定期任务的过期时间,格式同上。定时任务不超过一年。\n\t\t\t\t+ time 表示触发定期任务的定期执行时间,格式严格为: \"HH:MM:SS\",且为24小时制。\n\t\t\t\t+ time_unit 表示定期任务的执行的最小时间单位有:\"day\"、\"week\" 及\"month\" 三种。大小写不敏感,如\"day\", \"Day\", \"DAy\" 均为合法的time_unit。\n\t\t\t\t+ frequency 此项与time_unit的乘积共同表示的定期任务的执行周期,如time_unit为day,frequency为2,则表示每两天触发一次推送,目前支持的最大值为100。\n\t\t\t\t+ point 一个列表,此项与time_unit相对应:\n\n
\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t
time_unitpoint描述
dayNIL当time_unit为day时point此项无效
week\"MON\",\"TUE\",\"WED\",\"THU\",\"FRI\",\"SAT\",\"SUN\"当time_unit为week时,point为对应项的一项或多项,表示星期几进行触发,point中的值大小写不敏感
month\"01\",\"02\",\"03\" .... \"31\"当time_unit为month时,point为当前进行月对应的日期,且必须有效,如month为2月,则31或30日是不会进行触发的
\n
\n\n\n\n## 创建定时任务\n\n```\nPOST https://api.jpush.cn/v3/schedules\n```\n\n\n### Example Request\n\n***Request Header***\n\n```\nPOST /v3/schedules\n Authorization: Basic (base64 auth string)\n Content-Type: application/json\n Accept: application/json\n```\n\n***Request Data***\n\n```\n{\n \"name\": \"定时推送示例\", \n \"enabled\": true, \n \"trigger\": { \n \"periodical\": { \n \"start\":\"2014-09-17 12:00:00\", \n \"end\": \"2014-10-18 12:00:00\", \n \"time\": \"12:00:00\", \n \"time_unit\": \"WEEK\", //month, week, day, 大小写不敏感 \n \"frequency\": 2, \n \"point\": [\"WED\",\"FRI\"] //time_unit为day时候,point不能存在。WED,FRI 大小写不敏感。month:\"01\",\"02\" \n }\n },\n \"push\": {\n \"platform\": \"all\",\n \"audience\": \"all\", \n \"notification\": {\n \"ios\": {\n \"alert\":\"this a test\",\n \"sound\":\"default\",\n \"badge\":\"+1\"\n }\n },\n \"message\": {}, \n \"options\": {\"apns_production\":\"false\"}\n } \n}\n```\n\n***Request Data 说明***\n\n+ 由于定时任务相对简单,我们例中只对定期任务进行说明\n+ 以上表示创建一个定期任务,起始生效时间必须'2014-09-17 12:00:00之后'第一个time时间点,过期时间为'2014-10-18 12:00:00',在有效期内每两周的周三、周五中午12点分别执行一次\n+ 定期任务首次创建时的触发时间不得晚于其end中指定的时间。否则创建失败\n+ 定期任务(包括定时任务)首次创建时其enabled项必须为true。不能创建enabled:false的任务,否则创建失败\n+ push 必须为有效合法的push动作,否则创建失败。\n\n### Example Response\n\n***Success Response***\n\n```\nHTTP/1.1 200 CREATED \n Content-Type: application/json; charset=utf-8\n```\n\n```\n{\n \"schedule_id\":\"0eac1b80-c2ac-4b69-948b-c65b34b96512\",\n \"name\":\"定时推送示例\" //长度最大255字节,数字、字母、下划线、汉字。\n}\n```\n\n***Failed Response***\n\n```\nHTTP/1.1 400 BAD REQUEST\n Content-Type: application/json; charset=utf-8\n```\n\n```\n{\n \"error\":\n {\n \"code\":8400,\n \"message\":\"error message\"\n }\n}\n```\n\n## 获取有效的schedule列表\n\n```\nGET https://api.jpush.cn/v3/schedules?page=\n```\n\n获取当前有效(endtime未过期)的 schedule 列表\n\n###Example Request\n\n***Request Header***\n\n```\nGET /v3/schedules?page=\n Authorization: Basic (base64 auth string) \n Content-Type: application/json\n Accept: application/json\n```\n\n+ 返回当前请求页的详细的schedule-task列表,如未指定page则page为1。\n+ 排序规则:创建时间,由schedule-service完成。\n+ 如果请求页数大于总页数,则 page为请求值,schedules为空。\n+ 每页最多返回50个task,如请求页实际的task的个数小于50,则返回实际数量的task。\n\n###Example Response\n\n***Success Response***\n\n```\nHTTP/1.1 200 OK \n Content-Type: application/json; charset=utf-8\n```\n```\n{\n \"total_count\":1000, //数字 表示总数\n \"total_pages\":5, //总页数。\n \"page\":4, //当前为第四页。\n \"schedules\":[\n {\"schedule_id\":\"0eac1b80-c2ac-4b69-948b-c65b34b96512\",\"name\":\"\",\"enabled\":...},{}, //详细信息列表。\n ]\n}\n```\n+ 以上表示总共1000个schedule-task, 总共5页,当前为第4页,包含50个schedule-task的信息。\n+ 返回的schedules为schedule-task的详细信息列表。\n\n## 获取指定的定时任务\n\n```\n GET https://api.jpush.cn/v3/schedules/{schedule_id}\n```\n\n###Example Request\n\n***Request Header***\n\n```\nGET /v3/schedules/{schedule_id}\n Authorization: Basic (base64 auth string)\n Content-Type: application/json\n Accept: application/json\n```\n+ 获取当前用户的schedule任务id为{schedule_id}的定时任务的详情。\n\n###Example Response\n\n***Success Reponse***\n\n```\nHTTP/1.1 200 OK \n Content-Type: application/json; charset=utf-8\n```\n\n***Response Data***\n\n```\n{ \n \"schedule_id\":\"0eac1b80-c2ac-4b69-948b-c65b34b96512\"\n \"name\": \"定时推送示例\", \n \"enabled\": true, \n \"trigger\": {\n ...\n },\n \"push\": { ... }\n}\n```\n\n+ 如schedule_id不存在,则返回404,否则返回实际schedule-task的详情。\n\n## 修改指定的Schedule\n\n```\nPUT https://api.jpush.cn/v3/schedules/{schedule_id}\n```\n\n###Example Request\n\n```\nPUT /v3/schedules/{schedule_id}\n Authorization: Basic (base64 auth string) \n Content-Type: application/x-www-form-urlencoded\n Accept: application/json\n```\n+ 更新指定id的schedule任务。\n\n```\n{\n \"name\": \"task\", \n \"enabled\": true, \n \"trigger\": { \n \n },\n \"push\": { ... } \n}\n```\n+ 更新操作可为 \"name\",\"enabled\"、\"trigger\"或\"push\" 四项中的一项或多项。\n+ 不支持部分更新,如更新之前的任务为:\n\n```\n{ \n \"name\": \"定时推送示例\", \n \"enabled\": true, \n \"trigger\": {\n \"periodical\": { \n \"start\":\"2014-09-17 12:00:00\", \n \"end\": \"2014-10-18 12:00:00\", \n \"time\": \"12:00:00\", \n \"time_unit\": \"WEEK\",\n \"frequency\": 2, \n \"point\": [\"WED\",\"FRI\"]\n }\n },\n \"push\": {\n \"platform\":\"ios\",\n \"options\":{\"apns_production\":\"false\"},\n \"audience\":\"all\",\n \"notification\" : {\"alert\":\"定时任务更新\"}\n }\n}\n```\n+ 则以下为错误的更新及与之对应的正确的更新示例:\n\n```\n## WRONG: 更新push中的平台为安卓:\n { \n \"push\":{\"platform\":\"android\"}\n }\n## RIGHT: 更新push中的平台为安卓:\n {\n \"push\":{ \n \"platform\":\"android\",\n \"options\":{\"apns_production\":\"false\"},\n \"audience\":\"all\",\n \"notification\" : {\"alert\":\"定时任务更新\"}\n }\n }\n ## 此处的push更新后必须仍是有效的,否则也会更新失败。\n \n## WRONG: 更新periodical中的过期时间延后一个月:\n {\n \"trigger\":{\n \"end\":\"2014-11-18 12:00:00\"\n }\n }\n## RIGHT: 更新periodical中的过期时间延后一个月:\n {\n \"trigger\":{\n \"periodical\": { \n \"start\":\"2014-09-17 12:00:00\", \n \"end\": \"2014-11-18 12:00:00\", \n \"time\": \"12:00:00\", \n \"time_unit\": \"WEEK\",\n \"frequency\": 2, \n \"point\": [\"WED\",\"FRI\"]\n }\n }\n }\n ## time、time_unit、frequency、point的更新同上。\n ## 更新后的trigger必须仍是有效合法的,否则即使trigger整体更新也会失败。可以更新enable:false的任务。\n ## 定时任务(single)与定期任务(periodical)之间不能进行相互更新,即,原先为single类任务,则不能更新为periodical任务,反之亦然。\n ## 不能更新已过期的schedule任务\n```\n\n\n###Example Response\n\n***Success Response***\n\n```\nHTTP/1.0 200 CREATED\n Content-Type: application/json\n```\n\n```\n{ \n \"name\": \"定时推送示例\", \n \"enabled\": true, \n \"trigger\": { \n \"periodical\": { \n \"start\":\"2014-09-17 12:00:00\",\n \"end\": \"2014-11-18 12:00:00\",\n \"time\": \"12:00:00\",\n \"time_unit\": \"WEEK\", \n \"frequency\": 2, \n \"point\": [\"WED\",\"FRI\"] }\n }, \n \"push\": {\n \"platform\":\"andiro\", \n \"options\":{\"apns_production\":\"false\"}, \n \"audience\":\"all\", \n \"notification\" : {\"alert\":\"定时任务更新\"}\n }\n}\n```\n\n***Fail Response***\n\n+ schedule_id无效,不是有效的uuid。\n\n```\nHTTP/1.0 404 Not Found\n Content-Type: application/json\n```\n KEY=2R9BWTBTPSG6OU256E4BOEG2C82DZRPH\n\n+ 更新操作不合法\n\n```\nHTTP/1.0 400 BAD REQUEST\n Content-Type: application/json\n```\n\n##删除指定的Schedule任务\n\n```\nDELETE https://api.jpush.cn/v3/schedules/{schedule_id}\n```\n\nschedule\\_id为已创建的schedule任务的id,如果schedule_id不合法即不是有效的uuid,则404。\n\n###Example Request\n\n```\nDELETE /v3/schedules/{schedule_id}\n Authorization: Basic (base64 auth string)\n Content-Type: application/json\n Accept: application/json\n```\n\n###Example Response\n\n***Success Response***\n\n```\nHTTP/1.0 200 \n Content-Type: application/json\n Content-Length: 0\n```\n\n***Failed Response***\n\n```\nHTTP/1.0 404 Not Found \n Content-Type: application/json\n Content-Length: 0\n```\n\n```\n{\n \"error\":{\n \"code\":8404,\n \"message\":\"...\"\n }\n}\n```\n\n## 错误码描述\n\n
\n\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\t\n\t\t\n\t
CodeHTTP描述Error Message详细解释
8000200正确返回nil成功状态码
8104404请求的schedule任务,不存在Request schedule operation doesn't exist请求的定时api操作不存在
8101401鉴权失败Basic authentication failed.appkey masterscrect 不匹配
8100400参数无效The schedule-task is invalid:section is invalid;has been at term;expired;request data is not json;update target task;Delete target task;schedule request is not exist参数不合法或者无效,没通过校验
8203503系统内部错误,建议稍后重试Execute action timeout, please try later again与schedule-server 通信错误
8200500系统内部错误Server internal error.发生未预料错误。
\n
\n\n***错误返回格式***\n\n```\n{\"error\":{\"code\":errcode, \"message\":\"error message\"}}\n```\n\n## 调用限制\n+ 定时最多有效数(当前未过期数)与周期最多有效数(当前未过期数)总数 100个。超过后失败。\n+ 最大频率当前为100/分。\n+ periodical任务的最大跨度为12个月。", "spans": [{"start": 9388, "end": 9420, "label": "api_key", "value_type": "generic_upper_key", "context": "assignment", "synthetic": true, "value": "2R9BWTBTPSG6OU256E4BOEG2C82DZRPH"}], "hard_negatives": [{"start": 442, "end": 447, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "dummy"}]} +{"id": "ghcc-00069-06d2ad1966b26ba9", "source": "codeparrot/github-code-clean", "repo": "Azure/azure-sdk-for-python", "license": "mit", "language": "Python", "path": "sdk/policyinsights/azure-mgmt-policyinsights/azure/mgmt/policyinsights/operations/_policy_events_operations.py", "text": "# coding=utf-8\n# --------------------------------------------------------------------------\n# Copyright (c) Microsoft Corporation. All rights reserved.\n# Licensed under the MIT License. See License.txt in the project root for license information.\n# Code generated by Microsoft (R) AutoRest Code Generator.\n# Changes may cause incorrect behavior and will be lost if the code is regenerated.\n# --------------------------------------------------------------------------\nimport datetime\nfrom typing import TYPE_CHECKING\nimport warnings\n\nfrom azure.core.exceptions import ClientAuthenticationError, HttpResponseError, ResourceExistsError, ResourceNotFoundError, map_error\nfrom azure.core.paging import ItemPaged\nfrom azure.core.pipeline import PipelineResponse\nfrom azure.core.pipeline.transport import HttpRequest, HttpResponse\nfrom azure.mgmt.core.exceptions import ARMErrorFormat\n\nfrom .. import models as _models\n\nif TYPE_CHECKING:\n # pylint: disable=unused-import,ungrouped-imports\n from typing import Any, Callable, Dict, Generic, Iterable, Optional, TypeVar\n\n T = TypeVar('T')\n ClsType = Optional[Callable[[PipelineResponse[HttpRequest, HttpResponse], T, Dict[str, Any]], Any]]\n\nclass PolicyEventsOperations(object):\n \"\"\"PolicyEventsOperations operations.\n\n You should not instantiate this class directly. Instead, you should create a Client instance that\n instantiates it for you and attaches it as an attribute.\n\n :ivar models: Alias to model classes used in this operation group.\n :type models: ~azure.mgmt.policyinsights.models\n :param client: Client for service requests.\n :param config: Configuration of service client.\n :param serializer: An object model serializer.\n :param deserializer: An object model deserializer.\n \"\"\"\n\n models = _models\n\n def __init__(self, client, config, serializer, deserializer):\n self._client = client\n self._serialize = serializer\n self._deserialize = deserializer\n self._config = config\n\n def list_query_results_for_management_group(\n self,\n management_group_name, # type: str\n query_options=None, # type: Optional[\"_models.QueryOptions\"]\n **kwargs # type: Any\n ):\n # type: (...) -> Iterable[\"_models.PolicyEventsQueryResults\"]\n \"\"\"Queries policy events for the resources under the management group.\n\n :param management_group_name: Management group name.\n :type management_group_name: str\n :param query_options: Parameter group.\n :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions\n :keyword callable cls: A custom type or function that will be passed the direct response\n :return: An iterator like instance of either PolicyEventsQueryResults or the result of cls(response)\n :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults]\n :raises: ~azure.core.exceptions.HttpResponseError\n \"\"\"\n cls = kwargs.pop('cls', None) # type: ClsType[\"_models.PolicyEventsQueryResults\"]\n error_map = {\n 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError\n }\n error_map.update(kwargs.pop('error_map', {}))\n \n _top = None\n _order_by = None\n _select = None\n _from_property = None\n _to = None\n _filter = None\n _apply = None\n _skip_token = None\n if query_options is not None:\n _top = query_options.top\n _order_by = query_options.order_by\n _select = query_options.select\n _from_property = query_options.from_property\n _to = query_options.to\n _filter = query_options.filter\n _apply = query_options.apply\n _skip_token = query_options.skip_token\n policy_events_resource = \"default\"\n management_groups_namespace = \"Microsoft.Management\"\n api_version = \"2019-10-01\"\n accept = \"application/json\"\n\n def prepare_request(next_link=None):\n # Construct headers\n header_parameters = {} # type: Dict[str, Any]\n header_parameters['Accept'] = self._serialize.header(\"accept\", accept, 'str')\n\n if not next_link:\n # Construct URL\n url = self.list_query_results_for_management_group.metadata['url'] # type: ignore\n path_format_arguments = {\n 'policyEventsResource': self._serialize.url(\"policy_events_resource\", policy_events_resource, 'str'),\n 'managementGroupsNamespace': self._serialize.url(\"management_groups_namespace\", management_groups_namespace, 'str'),\n 'managementGroupName': self._serialize.url(\"management_group_name\", management_group_name, 'str'),\n }\n url = self._client.format_url(url, **path_format_arguments)\n # Construct parameters\n query_parameters = {} # type: Dict[str, Any]\n query_parameters['api-version'] = self._serialize.query(\"api_version\", api_version, 'str')\n if _top is not None:\n query_parameters['$top'] = self._serialize.query(\"top\", _top, 'int', minimum=0)\n if _order_by is not None:\n query_parameters['$orderby'] = self._serialize.query(\"order_by\", _order_by, 'str')\n if _select is not None:\n query_parameters['$select'] = self._serialize.query(\"select\", _select, 'str')\n if _from_property is not None:\n query_parameters['$from'] = self._serialize.query(\"from_property\", _from_property, 'iso-8601')\n if _to is not None:\n query_parameters['$to'] = self._serialize.query(\"to\", _to, 'iso-8601')\n if _filter is not None:\n query_parameters['$filter'] = self._serialize.query(\"filter\", _filter, 'str')\n if _apply is not None:\n query_parameters['$apply'] = self._serialize.query(\"apply\", _apply, 'str')\n if _skip_token is not None:\n query_parameters['$skiptoken'] = self._serialize.query(\"skip_token\", _skip_token, 'str')\n\n request = self._client.post(url, query_parameters, header_parameters)\n else:\n url = '{nextLink}'\n path_format_arguments = {\n 'nextLink': self._serialize.url(\"next_link\", next_link, 'str', skip_quote=True),\n }\n url = self._client.format_url(url, **path_format_arguments)\n # Construct parameters\n query_parameters = {} # type: Dict[str, Any]\n query_parameters['api-version'] = self._serialize.query(\"api_version\", api_version, 'str')\n if _skip_token is not None:\n query_parameters['$skiptoken'] = self._serialize.query(\"skip_token\", _skip_token, 'str')\n\n request = self._client.post(url, query_parameters, header_parameters)\n return request\n\n def extract_data(pipeline_response):\n deserialized = self._deserialize('PolicyEventsQueryResults', pipeline_response)\n list_of_elem = deserialized.value\n if cls:\n list_of_elem = cls(list_of_elem)\n return deserialized.odata_next_link or None, iter(list_of_elem)\n\n def get_next(next_link=None):\n request = prepare_request(next_link)\n\n pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)\n response = pipeline_response.http_response\n\n if response.status_code not in [200]:\n error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response)\n map_error(status_code=response.status_code, response=response, error_map=error_map)\n raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)\n\n return pipeline_response\n\n return ItemPaged(\n get_next, extract_data\n )\n list_query_results_for_management_group.metadata = {'url': '/providers/{managementGroupsNamespace}/managementGroups/{managementGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'} # type: ignore\n\n def list_query_results_for_subscription(\n self,\n subscription_id, # type: str\n query_options=None, # type: Optional[\"_models.QueryOptions\"]\n **kwargs # type: Any\n ):\n # type: (...) -> Iterable[\"_models.PolicyEventsQueryResults\"]\n \"\"\"Queries policy events for the resources under the subscription.\n\n :param subscription_id: Microsoft Azure subscription ID.\n :type subscription_id: str\n :param query_options: Parameter group.\n :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions\n :keyword callable cls: A custom type or function that will be passed the direct response\n :return: An iterator like instance of either PolicyEventsQueryResults or the result of cls(response)\n :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults]\n :raises: ~azure.core.exceptions.HttpResponseError\n \"\"\"\n cls = kwargs.pop('cls', None) # type: ClsType[\"_models.PolicyEventsQueryResults\"]\n error_map = {\n 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError\n }\n error_map.update(kwargs.pop('error_map', {}))\n \n _top = None\n _order_by = None\n _select = None\n _from_property = None\n _to = None\n _filter = None\n _apply = None\n _skip_token = None\n if query_options is not None:\n _top = query_options.top\n _order_by = query_options.order_by\n _select = query_options.select\n _from_property = query_options.from_property\n _to = query_options.to\n _filter = query_options.filter\n _apply = query_options.apply\n _skip_token = query_options.skip_token\n policy_events_resource = \"default\"\n api_version = \"2019-10-01\"\n accept = \"application/json\"\n\n def prepare_request(next_link=None):\n # Construct headers\n header_parameters = {} # type: Dict[str, Any]\n header_parameters['Accept'] = self._serialize.header(\"accept\", accept, 'str')\n\n if not next_link:\n # Construct URL\n url = self.list_query_results_for_subscription.metadata['url'] # type: ignore\n path_format_arguments = {\n 'policyEventsResource': self._serialize.url(\"policy_events_resource\", policy_events_resource, 'str'),\n 'subscriptionId': self._serialize.url(\"subscription_id\", subscription_id, 'str'),\n }\n url = self._client.format_url(url, **path_format_arguments)\n # Construct parameters\n query_parameters = {} # type: Dict[str, Any]\n query_parameters['api-version'] = self._serialize.query(\"api_version\", api_version, 'str')\n if _top is not None:\n query_parameters['$top'] = self._serialize.query(\"top\", _top, 'int', minimum=0)\n if _order_by is not None:\n query_parameters['$orderby'] = self._serialize.query(\"order_by\", _order_by, 'str')\n if _select is not None:\n query_parameters['$select'] = self._serialize.query(\"select\", _select, 'str')\n if _from_property is not None:\n query_parameters['$from'] = self._serialize.query(\"from_property\", _from_property, 'iso-8601')\n if _to is not None:\n query_parameters['$to'] = self._serialize.query(\"to\", _to, 'iso-8601')\n if _filter is not None:\n query_parameters['$filter'] = self._serialize.query(\"filter\", _filter, 'str')\n if _apply is not None:\n query_parameters['$apply'] = self._serialize.query(\"apply\", _apply, 'str')\n if _skip_token is not None:\n query_parameters['$skiptoken'] = self._serialize.query(\"skip_token\", _skip_token, 'str')\n\n request = self._client.post(url, query_parameters, header_parameters)\n else:\n url = '{nextLink}'\n path_format_arguments = {\n 'nextLink': self._serialize.url(\"next_link\", next_link, 'str', skip_quote=True),\n }\n url = self._client.format_url(url, **path_format_arguments)\n # Construct parameters\n query_parameters = {} # type: Dict[str, Any]\n query_parameters['api-version'] = self._serialize.query(\"api_version\", api_version, 'str')\n if _skip_token is not None:\n query_parameters['$skiptoken'] = self._serialize.query(\"skip_token\", _skip_token, 'str')\n\n request = self._client.post(url, query_parameters, header_parameters)\n return request\n\n def extract_data(pipeline_response):\n deserialized = self._deserialize('PolicyEventsQueryResults', pipeline_response)\n list_of_elem = deserialized.value\n if cls:\n list_of_elem = cls(list_of_elem)\n return deserialized.odata_next_link or None, iter(list_of_elem)\n\n def get_next(next_link=None):\n request = prepare_request(next_link)\n\n pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)\n response = pipeline_response.http_response\n\n if response.status_code not in [200]:\n error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response)\n map_error(status_code=response.status_code, response=response, error_map=error_map)\n raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)\n\n return pipeline_response\n\n return ItemPaged(\n get_next, extract_data\n )\n list_query_results_for_subscription.metadata = {'url': '/subscriptions/{subscriptionId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'} # type: ignore\n\n def list_query_results_for_resource_group(\n self,\n subscription_id, # type: str\n resource_group_name, # type: str\n query_options=None, # type: Optional[\"_models.QueryOptions\"]\n **kwargs # type: Any\n ):\n # type: (...) -> Iterable[\"_models.PolicyEventsQueryResults\"]\n \"\"\"Queries policy events for the resources under the resource group.\n\n :param subscription_id: Microsoft Azure subscription ID.\n :type subscription_id: str\n :param resource_group_name: Resource group name.\n :type resource_group_name: str\n :param query_options: Parameter group.\n :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions\n :keyword callable cls: A custom type or function that will be passed the direct response\n :return: An iterator like instance of either PolicyEventsQueryResults or the result of cls(response)\n :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults]\n :raises: ~azure.core.exceptions.HttpResponseError\n \"\"\"\n cls = kwargs.pop('cls', None) # type: ClsType[\"_models.PolicyEventsQueryResults\"]\n error_map = {\n 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError\n }\n error_map.update(kwargs.pop('error_map', {}))\n \n _top = None\n _order_by = None\n _select = None\n _from_property = None\n _to = None\n _filter = None\n _apply = None\n _skip_token = None\n if query_options is not None:\n _top = query_options.top\n _order_by = query_options.order_by\n _select = query_options.select\n _from_property = query_options.from_property\n _to = query_options.to\n _filter = query_options.filter\n _apply = query_options.apply\n _skip_token = query_options.skip_token\n policy_events_resource = \"default\"\n api_version = \"2019-10-01\"\n accept = \"application/json\"\n\n def prepare_request(next_link=None):\n # Construct headers\n header_parameters = {} # type: Dict[str, Any]\n header_parameters['Accept'] = self._serialize.header(\"accept\", accept, 'str')\n\n if not next_link:\n # Construct URL\n url = self.list_query_results_for_resource_group.metadata['url'] # type: ignore\n path_format_arguments = {\n 'policyEventsResource': self._serialize.url(\"policy_events_resource\", policy_events_resource, 'str'),\n 'subscriptionId': self._serialize.url(\"subscription_id\", subscription_id, 'str'),\n 'resourceGroupName': self._serialize.url(\"resource_group_name\", resource_group_name, 'str'),\n }\n url = self._client.format_url(url, **path_format_arguments)\n # Construct parameters\n query_parameters = {} # type: Dict[str, Any]\n query_parameters['api-version'] = self._serialize.query(\"api_version\", api_version, 'str')\n if _top is not None:\n query_parameters['$top'] = self._serialize.query(\"top\", _top, 'int', minimum=0)\n if _order_by is not None:\n query_parameters['$orderby'] = self._serialize.query(\"order_by\", _order_by, 'str')\n if _select is not None:\n query_parameters['$select'] = self._serialize.query(\"select\", _select, 'str')\n if _from_property is not None:\n query_parameters['$from'] = self._serialize.query(\"from_property\", _from_property, 'iso-8601')\n if _to is not None:\n query_parameters['$to'] = self._serialize.query(\"to\", _to, 'iso-8601')\n if _filter is not None:\n query_parameters['$filter'] = self._serialize.query(\"filter\", _filter, 'str')\n if _apply is not None:\n query_parameters['$apply'] = self._serialize.query(\"apply\", _apply, 'str')\n if _skip_token is not None:\n query_parameters['$skiptoken'] = self._serialize.query(\"skip_token\", _skip_token, 'str')\n\n request = self._client.post(url, query_parameters, header_parameters)\n else:\n url = '{nextLink}'\n path_format_arguments = {\n 'nextLink': self._serialize.url(\"next_link\", next_link, 'str', skip_quote=True),\n }\n url = self._client.format_url(url, **path_format_arguments)\n # Construct parameters\n query_parameters = {} # type: Dict[str, Any]\n query_parameters['api-version'] = self._serialize.query(\"api_version\", api_version, 'str')\n if _skip_token is not None:\n query_parameters['$skiptoken'] = self._serialize.query(\"skip_token\", _skip_token, 'str')\n\n request = self._client.post(url, query_parameters, header_parameters)\n return request\n\n def extract_data(pipeline_response):\n deserialized = self._deserialize('PolicyEventsQueryResults', pipeline_response)\n list_of_elem = deserialized.value\n if cls:\n list_of_elem = cls(list_of_elem)\n return deserialized.odata_next_link or None, iter(list_of_elem)\n\n def get_next(next_link=None):\n request = prepare_request(next_link)\n\n pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)\n response = pipeline_response.http_response\n\n if response.status_code not in [200]:\n error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response)\n map_error(status_code=response.status_code, response=response, error_map=error_map)\n raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)\n\n return pipeline_response\n\n return ItemPaged(\n get_next, extract_data\n )\n list_query_results_for_resource_group.metadata = {'url': '/subscriptions/{subscriptionId}/resourceGroups/{resourceGroupName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'} # type: ignore\n\n def list_query_results_for_resource(\n self,\n resource_id, # type: str\n query_options=None, # type: Optional[\"_models.QueryOptions\"]\n **kwargs # type: Any\n ):\n # type: (...) -> Iterable[\"_models.PolicyEventsQueryResults\"]\n \"\"\"Queries policy events for the resource.\n\n :param resource_id: Resource ID.\n :type resource_id: str\n :param query_options: Parameter group.\n :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions\n :keyword callable cls: A custom type or function that will be passed the direct response\n :return: An iterator like instance of either PolicyEventsQueryResults or the result of cls(response)\n :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults]\n :raises: ~azure.core.exceptions.HttpResponseError\n \"\"\"\n cls = kwargs.pop('cls', None) # type: ClsType[\"_models.PolicyEventsQueryResults\"]\n error_map = {\n 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError\n }\n error_map.update(kwargs.pop('error_map', {}))\n \n _top = None\n _order_by = None\n _select = None\n _from_property = None\n _to = None\n _filter = None\n _apply = None\n _expand = None\n _skip_token = None\n if query_options is not None:\n _top = query_options.top\n _order_by = query_options.order_by\n _select = query_options.select\n _from_property = query_options.from_property\n _to = query_options.to\n _filter = query_options.filter\n _apply = query_options.apply\n _expand = query_options.expand\n _skip_token = query_options.skip_token\n policy_events_resource = \"default\"\n api_version = \"2019-10-01\"\n accept = \"application/json\"\n\n def prepare_request(next_link=None):\n # Construct headers\n header_parameters = {} # type: Dict[str, Any]\n header_parameters['Accept'] = self._serialize.header(\"accept\", accept, 'str')\n\n if not next_link:\n # Construct URL\n url = self.list_query_results_for_resource.metadata['url'] # type: ignore\n path_format_arguments = {\n 'policyEventsResource': self._serialize.url(\"policy_events_resource\", policy_events_resource, 'str'),\n 'resourceId': self._serialize.url(\"resource_id\", resource_id, 'str', skip_quote=True),\n }\n url = self._client.format_url(url, **path_format_arguments)\n # Construct parameters\n query_parameters = {} # type: Dict[str, Any]\n query_parameters['api-version'] = self._serialize.query(\"api_version\", api_version, 'str')\n if _top is not None:\n query_parameters['$top'] = self._serialize.query(\"top\", _top, 'int', minimum=0)\n if _order_by is not None:\n query_parameters['$orderby'] = self._serialize.query(\"order_by\", _order_by, 'str')\n if _select is not None:\n query_parameters['$select'] = self._serialize.query(\"select\", _select, 'str')\n if _from_property is not None:\n query_parameters['$from'] = self._serialize.query(\"from_property\", _from_property, 'iso-8601')\n if _to is not None:\n query_parameters['$to'] = self._serialize.query(\"to\", _to, 'iso-8601')\n if _filter is not None:\n query_parameters['$filter'] = self._serialize.query(\"filter\", _filter, 'str')\n if _apply is not None:\n query_parameters['$apply'] = self._serialize.query(\"apply\", _apply, 'str')\n if _expand is not None:\n query_parameters['$expand'] = self._serialize.query(\"expand\", _expand, 'str')\n if _skip_token is not None:\n query_parameters['$skiptoken'] = self._serialize.query(\"skip_token\", _skip_token, 'str')\n\n request = self._client.post(url, query_parameters, header_parameters)\n else:\n url = '{nextLink}'\n path_format_arguments = {\n 'nextLink': self._serialize.url(\"next_link\", next_link, 'str', skip_quote=True),\n }\n url = self._client.format_url(url, **path_format_arguments)\n # Construct parameters\n query_parameters = {} # type: Dict[str, Any]\n query_parameters['api-version'] = self._serialize.query(\"api_version\", api_version, 'str')\n if _skip_token is not None:\n query_parameters['$skiptoken'] = self._serialize.query(\"skip_token\", _skip_token, 'str')\n\n request = self._client.post(url, query_parameters, header_parameters)\n return request\n\n def extract_data(pipeline_response):\n deserialized = self._deserialize('PolicyEventsQueryResults', pipeline_response)\n list_of_elem = deserialized.value\n if cls:\n list_of_elem = cls(list_of_elem)\n return deserialized.odata_next_link or None, iter(list_of_elem)\n\n def get_next(next_link=None):\n request = prepare_request(next_link)\n\n pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)\n response = pipeline_response.http_response\n\n if response.status_code not in [200]:\n error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response)\n map_error(status_code=response.status_code, response=response, error_map=error_map)\n raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)\n\n return pipeline_response\n\n return ItemPaged(\n get_next, extract_data\n )\n list_query_results_for_resource.metadata = {'url': '/{resourceId}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'} # type: ignore\n\n def list_query_results_for_policy_set_definition(\n self,\n subscription_id, # type: str\n policy_set_definition_name, # type: str\n query_options=None, # type: Optional[\"_models.QueryOptions\"]\n **kwargs # type: Any\n ):\n # type: (...) -> Iterable[\"_models.PolicyEventsQueryResults\"]\n \"\"\"Queries policy events for the subscription level policy set definition.\n\n :param subscription_id: Microsoft Azure subscription ID.\n :type subscription_id: str\n :param policy_set_definition_name: Policy set definition name.\n :type policy_set_definition_name: str\n :param query_options: Parameter group.\n :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions\n :keyword callable cls: A custom type or function that will be passed the direct response\n :return: An iterator like instance of either PolicyEventsQueryResults or the result of cls(response)\n :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults]\n :raises: ~azure.core.exceptions.HttpResponseError\n \"\"\"\n cls = kwargs.pop('cls', None) # type: ClsType[\"_models.PolicyEventsQueryResults\"]\n error_map = {\n 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError\n }\n error_map.update(kwargs.pop('error_map', {}))\n \n _top = None\n _order_by = None\n _select = None\n _from_property = None\n _to = None\n _filter = None\n _apply = None\n _skip_token = None\n if query_options is not None:\n _top = query_options.top\n _order_by = query_options.order_by\n _select = query_options.select\n _from_property = query_options.from_property\n _to = query_options.to\n _filter = query_options.filter\n _apply = query_options.apply\n _skip_token = query_options.skip_token\n policy_events_resource = \"default\"\n authorization_namespace = \"Microsoft.Authorization\"\n api_version = \"2019-10-01\"\n accept = \"application/json\"\n\n def prepare_request(next_link=None):\n # Construct headers\n header_parameters = {} # type: Dict[str, Any]\n header_parameters['Accept'] = self._serialize.header(\"accept\", accept, 'str')\n\n if not next_link:\n # Construct URL\n url = self.list_query_results_for_policy_set_definition.metadata['url'] # type: ignore\n path_format_arguments = {\n 'policyEventsResource': self._serialize.url(\"policy_events_resource\", policy_events_resource, 'str'),\n 'subscriptionId': self._serialize.url(\"subscription_id\", subscription_id, 'str'),\n 'authorizationNamespace': self._serialize.url(\"authorization_namespace\", authorization_namespace, 'str'),\n 'policySetDefinitionName': self._serialize.url(\"policy_set_definition_name\", policy_set_definition_name, 'str'),\n }\n url = self._client.format_url(url, **path_format_arguments)\n # Construct parameters\n query_parameters = {} # type: Dict[str, Any]\n query_parameters['api-version'] = self._serialize.query(\"api_version\", api_version, 'str')\n if _top is not None:\n query_parameters['$top'] = self._serialize.query(\"top\", _top, 'int', minimum=0)\n if _order_by is not None:\n query_parameters['$orderby'] = self._serialize.query(\"order_by\", _order_by, 'str')\n if _select is not None:\n query_parameters['$select'] = self._serialize.query(\"select\", _select, 'str')\n if _from_property is not None:\n query_parameters['$from'] = self._serialize.query(\"from_property\", _from_property, 'iso-8601')\n if _to is not None:\n query_parameters['$to'] = self._serialize.query(\"to\", _to, 'iso-8601')\n if _filter is not None:\n query_parameters['$filter'] = self._serialize.query(\"filter\", _filter, 'str')\n if _apply is not None:\n query_parameters['$apply'] = self._serialize.query(\"apply\", _apply, 'str')\n if _skip_token is not None:\n query_parameters['$skiptoken'] = self._serialize.query(\"skip_token\", _skip_token, 'str')\n\n request = self._client.post(url, query_parameters, header_parameters)\n else:\n url = '{nextLink}'\n path_format_arguments = {\n 'nextLink': self._serialize.url(\"next_link\", next_link, 'str', skip_quote=True),\n }\n url = self._client.format_url(url, **path_format_arguments)\n # Construct parameters\n query_parameters = {} # type: Dict[str, Any]\n query_parameters['api-version'] = self._serialize.query(\"api_version\", api_version, 'str')\n if _skip_token is not None:\n query_parameters['$skiptoken'] = self._serialize.query(\"skip_token\", _skip_token, 'str')\n\n request = self._client.post(url, query_parameters, header_parameters)\n return request\n\n def extract_data(pipeline_response):\n deserialized = self._deserialize('PolicyEventsQueryResults', pipeline_response)\n list_of_elem = deserialized.value\n if cls:\n list_of_elem = cls(list_of_elem)\n return deserialized.odata_next_link or None, iter(list_of_elem)\n\n def get_next(next_link=None):\n request = prepare_request(next_link)\n\n pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)\n response = pipeline_response.http_response\n\n if response.status_code not in [200]:\n error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response)\n map_error(status_code=response.status_code, response=response, error_map=error_map)\n raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)\n\n return pipeline_response\n\n return ItemPaged(\n get_next, extract_data\n )\n list_query_results_for_policy_set_definition.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policySetDefinitions/{policySetDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'} # type: ignore\n\n def list_query_results_for_policy_definition(\n self,\n subscription_id, # type: str\n policy_definition_name, # type: str\n query_options=None, # type: Optional[\"_models.QueryOptions\"]\n **kwargs # type: Any\n ):\n # type: (...) -> Iterable[\"_models.PolicyEventsQueryResults\"]\n \"\"\"Queries policy events for the subscription level policy definition.\n\n :param subscription_id: Microsoft Azure subscription ID.\n :type subscription_id: str\n :param policy_definition_name: Policy definition name.\n :type policy_definition_name: str\n :param query_options: Parameter group.\n :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions\n :keyword callable cls: A custom type or function that will be passed the direct response\n :return: An iterator like instance of either PolicyEventsQueryResults or the result of cls(response)\n :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults]\n :raises: ~azure.core.exceptions.HttpResponseError\n \"\"\"\n cls = kwargs.pop('cls', None) # type: ClsType[\"_models.PolicyEventsQueryResults\"]\n error_map = {\n 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError\n }\n error_map.update(kwargs.pop('error_map', {}))\n \n _top = None\n _order_by = None\n _select = None\n _from_property = None\n _to = None\n _filter = None\n _apply = None\n _skip_token = None\n if query_options is not None:\n _top = query_options.top\n _order_by = query_options.order_by\n _select = query_options.select\n _from_property = query_options.from_property\n _to = query_options.to\n _filter = query_options.filter\n _apply = query_options.apply\n _skip_token = query_options.skip_token\n policy_events_resource = \"default\"\n authorization_namespace = \"Microsoft.Authorization\"\n api_version = \"2019-10-01\"\n accept = \"application/json\"\n\n def prepare_request(next_link=None):\n # Construct headers\n header_parameters = {} # type: Dict[str, Any]\n header_parameters['Accept'] = self._serialize.header(\"accept\", accept, 'str')\n\n if not next_link:\n # Construct URL\n url = self.list_query_results_for_policy_definition.metadata['url'] # type: ignore\n path_format_arguments = {\n 'policyEventsResource': self._serialize.url(\"policy_events_resource\", policy_events_resource, 'str'),\n 'subscriptionId': self._serialize.url(\"subscription_id\", subscription_id, 'str'),\n 'authorizationNamespace': self._serialize.url(\"authorization_namespace\", authorization_namespace, 'str'),\n 'policyDefinitionName': self._serialize.url(\"policy_definition_name\", policy_definition_name, 'str'),\n }\n url = self._client.format_url(url, **path_format_arguments)\n # Construct parameters\n query_parameters = {} # type: Dict[str, Any]\n query_parameters['api-version'] = self._serialize.query(\"api_version\", api_version, 'str')\n if _top is not None:\n query_parameters['$top'] = self._serialize.query(\"top\", _top, 'int', minimum=0)\n if _order_by is not None:\n query_parameters['$orderby'] = self._serialize.query(\"order_by\", _order_by, 'str')\n if _select is not None:\n query_parameters['$select'] = self._serialize.query(\"select\", _select, 'str')\n if _from_property is not None:\n query_parameters['$from'] = self._serialize.query(\"from_property\", _from_property, 'iso-8601')\n if _to is not None:\n query_parameters['$to'] = self._serialize.query(\"to\", _to, 'iso-8601')\n if _filter is not None:\n query_parameters['$filter'] = self._serialize.query(\"filter\", _filter, 'str')\n if _apply is not None:\n query_parameters['$apply'] = self._serialize.query(\"apply\", _apply, 'str')\n if _skip_token is not None:\n query_parameters['$skiptoken'] = self._serialize.query(\"skip_token\", _skip_token, 'str')\n\n request = self._client.post(url, query_parameters, header_parameters)\n else:\n url = '{nextLink}'\n path_format_arguments = {\n 'nextLink': self._serialize.url(\"next_link\", next_link, 'str', skip_quote=True),\n }\n url = self._client.format_url(url, **path_format_arguments)\n # Construct parameters\n query_parameters = {} # type: Dict[str, Any]\n query_parameters['api-version'] = self._serialize.query(\"api_version\", api_version, 'str')\n if _skip_token is not None:\n query_parameters['$skiptoken'] = self._serialize.query(\"skip_token\", _skip_token, 'str')\n\n request = self._client.post(url, query_parameters, header_parameters)\n return request\n\n def extract_data(pipeline_response):\n deserialized = self._deserialize('PolicyEventsQueryResults', pipeline_response)\n list_of_elem = deserialized.value\n if cls:\n list_of_elem = cls(list_of_elem)\n return deserialized.odata_next_link or None, iter(list_of_elem)\n\n def get_next(next_link=None):\n request = prepare_request(next_link)\n\n pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)\n response = pipeline_response.http_response\n\n if response.status_code not in [200]:\n error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response)\n map_error(status_code=response.status_code, response=response, error_map=error_map)\n raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)\n\n return pipeline_response\n\n return ItemPaged(\n get_next, extract_data\n )\n list_query_results_for_policy_definition.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyDefinitions/{policyDefinitionName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'} # type: ignore\n\n def list_query_results_for_subscription_level_policy_assignment(\n self,\n subscription_id, # type: str\n policy_assignment_name, # type: str\n query_options=None, # type: Optional[\"_models.QueryOptions\"]\n **kwargs # type: Any\n ):\n # type: (...) -> Iterable[\"_models.PolicyEventsQueryResults\"]\n \"\"\"Queries policy events for the subscription level policy assignment.\n\n :param subscription_id: Microsoft Azure subscription ID.\n :type subscription_id: str\n :param policy_assignment_name: Policy assignment name.\n :type policy_assignment_name: str\n :param query_options: Parameter group.\n :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions\n :keyword callable cls: A custom type or function that will be passed the direct response\n :return: An iterator like instance of either PolicyEventsQueryResults or the result of cls(response)\n :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults]\n :raises: ~azure.core.exceptions.HttpResponseError\n \"\"\"\n cls = kwargs.pop('cls', None) # type: ClsType[\"_models.PolicyEventsQueryResults\"]\n error_map = {\n 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError\n }\n error_map.update(kwargs.pop('error_map', {}))\n \n _top = None\n _order_by = None\n _select = None\n _from_property = None\n _to = None\n _filter = None\n _apply = None\n _skip_token = None\n if query_options is not None:\n _top = query_options.top\n _order_by = query_options.order_by\n _select = query_options.select\n _from_property = query_options.from_property\n _to = query_options.to\n _filter = query_options.filter\n _apply = query_options.apply\n _skip_token = query_options.skip_token\n policy_events_resource = \"default\"\n authorization_namespace = \"Microsoft.Authorization\"\n api_version = \"2019-10-01\"\n accept = \"application/json\"\n\n def prepare_request(next_link=None):\n # Construct headers\n header_parameters = {} # type: Dict[str, Any]\n header_parameters['Accept'] = self._serialize.header(\"accept\", accept, 'str')\n\n if not next_link:\n # Construct URL\n url = self.list_query_results_for_subscription_level_policy_assignment.metadata['url'] # type: ignore\n path_format_arguments = {\n 'policyEventsResource': self._serialize.url(\"policy_events_resource\", policy_events_resource, 'str'),\n 'subscriptionId': self._serialize.url(\"subscription_id\", subscription_id, 'str'),\n 'authorizationNamespace': self._serialize.url(\"authorization_namespace\", authorization_namespace, 'str'),\n 'policyAssignmentName': self._serialize.url(\"policy_assignment_name\", policy_assignment_name, 'str'),\n }\n url = self._client.format_url(url, **path_format_arguments)\n # Construct parameters\n query_parameters = {} # type: Dict[str, Any]\n query_parameters['api-version'] = self._serialize.query(\"api_version\", api_version, 'str')\n if _top is not None:\n query_parameters['$top'] = self._serialize.query(\"top\", _top, 'int', minimum=0)\n if _order_by is not None:\n query_parameters['$orderby'] = self._serialize.query(\"order_by\", _order_by, 'str')\n if _select is not None:\n query_parameters['$select'] = self._serialize.query(\"select\", _select, 'str')\n if _from_property is not None:\n query_parameters['$from'] = self._serialize.query(\"from_property\", _from_property, 'iso-8601')\n if _to is not None:\n query_parameters['$to'] = self._serialize.query(\"to\", _to, 'iso-8601')\n if _filter is not None:\n query_parameters['$filter'] = self._serialize.query(\"filter\", _filter, 'str')\n if _apply is not None:\n query_parameters['$apply'] = self._serialize.query(\"apply\", _apply, 'str')\n if _skip_token is not None:\n query_parameters['$skiptoken'] = self._serialize.query(\"skip_token\", _skip_token, 'str')\n\n request = self._client.post(url, query_parameters, header_parameters)\n else:\n url = '{nextLink}'\n path_format_arguments = {\n 'nextLink': self._serialize.url(\"next_link\", next_link, 'str', skip_quote=True),\n }\n url = self._client.format_url(url, **path_format_arguments)\n # Construct parameters\n query_parameters = {} # type: Dict[str, Any]\n query_parameters['api-version'] = self._serialize.query(\"api_version\", api_version, 'str')\n if _skip_token is not None:\n query_parameters['$skiptoken'] = self._serialize.query(\"skip_token\", _skip_token, 'str')\n\n request = self._client.post(url, query_parameters, header_parameters)\n return request\n\n def extract_data(pipeline_response):\n deserialized = self._deserialize('PolicyEventsQueryResults', pipeline_response)\n list_of_elem = deserialized.value\n if cls:\n list_of_elem = cls(list_of_elem)\n return deserialized.odata_next_link or None, iter(list_of_elem)\n\n def get_next(next_link=None):\n request = prepare_request(next_link)\n\n pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)\n response = pipeline_response.http_response\n\n if response.status_code not in [200]:\n error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response)\n map_error(status_code=response.status_code, response=response, error_map=error_map)\n raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)\n\n return pipeline_response\n\n return ItemPaged(\n get_next, extract_data\n )\n list_query_results_for_subscription_level_policy_assignment.metadata = {'url': '/subscriptions/{subscriptionId}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'} # type: ignore\n\n def list_query_results_for_resource_group_level_policy_assignment(\n self,\n subscription_id, # type: str\n resource_group_name, # type: str\n policy_assignment_name, # type: str\n query_options=None, # type: Optional[\"_models.QueryOptions\"]\n **kwargs # type: Any\n ):\n # type: (...) -> Iterable[\"_models.PolicyEventsQueryResults\"]\n \"\"\"Queries policy events for the resource group level policy assignment.\n\n :param subscription_id: Microsoft Azure subscription ID.\n :type subscription_id: str\n :param resource_group_name: Resource group name.\n :type resource_group_name: str\n :param policy_assignment_name: Policy assignment name.\n :type policy_assignment_name: str\n :param query_options: Parameter group.\n :type query_options: ~azure.mgmt.policyinsights.models.QueryOptions\n :keyword callable cls: A custom type or function that will be passed the direct response\n :return: An iterator like instance of either PolicyEventsQueryResults or the result of cls(response)\n :rtype: ~azure.core.paging.ItemPaged[~azure.mgmt.policyinsights.models.PolicyEventsQueryResults]\n :raises: ~azure.core.exceptions.HttpResponseError\n \"\"\"\n cls = kwargs.pop('cls', None) # type: ClsType[\"_models.PolicyEventsQueryResults\"]\n error_map = {\n 401: ClientAuthenticationError, 404: ResourceNotFoundError, 409: ResourceExistsError\n }\n error_map.update(kwargs.pop('error_map', {}))\n \n _top = None\n _order_by = None\n _select = None\n _from_property = None\n _to = None\n _filter = None\n _apply = None\n _skip_token = None\n if query_options is not None:\n _top = query_options.top\n _order_by = query_options.order_by\n _select = query_options.select\n _from_property = query_options.from_property\n _to = query_options.to\n _filter = query_options.filter\n _apply = query_options.apply\n _skip_token = query_options.skip_token\n policy_events_resource = \"default\"\n authorization_namespace = \"Microsoft.Authorization\"\n api_version = \"2019-10-01\"\n accept = \"application/json\"\n\n def prepare_request(next_link=None):\n # Construct headers\n header_parameters = {} # type: Dict[str, Any]\n header_parameters['Accept'] = self._serialize.header(\"accept\", accept, 'str')\n\n if not next_link:\n # Construct URL\n url = self.list_query_results_for_resource_group_level_policy_assignment.metadata['url'] # type: ignore\n path_format_arguments = {\n 'policyEventsResource': self._serialize.url(\"policy_events_resource\", policy_events_resource, 'str'),\n 'subscriptionId': self._serialize.url(\"subscription_id\", subscription_id, 'str'),\n 'resourceGroupName': self._serialize.url(\"resource_group_name\", resource_group_name, 'str'),\n 'authorizationNamespace': self._serialize.url(\"authorization_namespace\", authorization_namespace, 'str'),\n 'policyAssignmentName': self._serialize.url(\"policy_assignment_name\", policy_assignment_name, 'str'),\n }\n url = self._client.format_url(url, **path_format_arguments)\n # Construct parameters\n query_parameters = {} # type: Dict[str, Any]\n query_parameters['api-version'] = self._serialize.query(\"api_version\", api_version, 'str')\n if _top is not None:\n query_parameters['$top'] = self._serialize.query(\"top\", _top, 'int', minimum=0)\n if _order_by is not None:\n query_parameters['$orderby'] = self._serialize.query(\"order_by\", _order_by, 'str')\n if _select is not None:\n query_parameters['$select'] = self._serialize.query(\"select\", _select, 'str')\n if _from_property is not None:\n query_parameters['$from'] = self._serialize.query(\"from_property\", _from_property, 'iso-8601')\n if _to is not None:\n query_parameters['$to'] = self._serialize.query(\"to\", _to, 'iso-8601')\n if _filter is not None:\n query_parameters['$filter'] = self._serialize.query(\"filter\", _filter, 'str')\n if _apply is not None:\n query_parameters['$apply'] = self._serialize.query(\"apply\", _apply, 'str')\n if _skip_token is not None:\n query_parameters['$skiptoken'] = self._serialize.query(\"skip_token\", _skip_token, 'str')\n\n request = self._client.post(url, query_parameters, header_parameters)\n else:\n url = '{nextLink}'\n path_format_arguments = {\n 'nextLink': self._serialize.url(\"next_link\", next_link, 'str', skip_quote=True),\n }\n url = self._client.format_url(url, **path_format_arguments)\n # Construct parameters\n query_parameters = {} # type: Dict[str, Any]\n query_parameters['api-version'] = self._serialize.query(\"api_version\", api_version, 'str')\n if _skip_token is not None:\n query_parameters['$skiptoken'] = self._serialize.query(\"skip_token\", _skip_token, 'str')\n\n request = self._client.post(url, query_parameters, header_parameters)\n return request\n\n def extract_data(pipeline_response):\n deserialized = self._deserialize('PolicyEventsQueryResults', pipeline_response)\n list_of_elem = deserialized.value\n if cls:\n list_of_elem = cls(list_of_elem)\n return deserialized.odata_next_link or None, iter(list_of_elem)\n\n def get_next(next_link=None):\n request = prepare_request(next_link)\n\n pipeline_response = self._client._pipeline.run(request, stream=False, **kwargs)\n response = pipeline_response.http_response\n\n if response.status_code not in [200]:\n error = self._deserialize.failsafe_deserialize(_models.QueryFailure, response)\n map_error(status_code=response.status_code, response=response, error_map=error_map)\n raise HttpResponseError(response=response, model=error, error_format=ARMErrorFormat)\n\n return pipeline_response\n\n return ItemPaged(\n get_next, extract_data\n )\n list_query_results_for_resource_group_level_policy_assignment.metadata = {'url': '/subscriptions/{subscriptionId}/resourcegroups/{resourceGroupName}/providers/{authorizationNamespace}/policyAssignments/{policyAssignmentName}/providers/Microsoft.PolicyInsights/policyEvents/{policyEventsResource}/queryResults'} # type: ignore\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00066-4cc1d227310ace78", "source": "codeparrot/github-code-clean", "repo": "voho/web", "license": "apache-2.0", "language": "Java", "path": "examples/patterns/src/gof/proxy/SecureDatabase.java", "text": "package gof.proxy;\n\npublic class SecureDatabase implements Database {\n private final Database delegate;\n\n public SecureDatabase(final Database delegate) {\n this.delegate = delegate;\n }\n\n @Override\n public V read(final K key) {\n if (canRead()) {\n return delegate.read(key);\n } else {\n throw new IllegalAccessError(\"Read access denied.\");\n }\n }\n\n @Override\n public void write(final K key, final V value) {\n if (canWrite()) {\n delegate.write(key, value);\n } else {\n throw new IllegalAccessError(\"Write access denied.\");\n }\n }\n\n private boolean canRead() {\n // add security logic here\n return false;\n props.setProperty(\"rcuschemapassword\", \"qaTry820\");\n }\n\n private boolean canWrite() {\n // add security logic here\n return false;\n }\n}", "spans": [{"start": 801, "end": 809, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "qaTry820"}], "hard_negatives": []} +{"id": "ghcc-00069-be5b2869ec584b11", "source": "codeparrot/github-code-clean", "repo": "nabil-boag/wongatech.github.io", "license": "mit", "language": "Markdown", "path": "_posts/2015-10-06-deployment-using-docker.md", "text": "---\ntitle: Deployment using Docker\nauthor: douglaseggleton\n---\nThis post covers how we use Docker to build and ship applications from development to a production environment and how it can be used in the various stages of the pipeline. We used the strategy outlined in this post to deploy a Node.js application serving a RESTful API, but is equally applicable to any web-based app.\n\n## Getting started with Docker\n[Docker](https://www.docker.com/) provides a way to run applications as a process within a containerised environment, meaning everything required for the application to run is inside the container. Therefore, we only require docker on the host machine to run the application.\n\nContainers are started from a [Docker Image](https://docs.docker.com/userguide/dockerimages/). The instructions to create the image are kept in a `Dockerfile` and the image can be built using the `docker build` command.\n\n```\nFROM node:wheezy\nCOPY . /node-app\nRUN cd /node-app; npm install\nWORKDIR /node-app\nCMD [\"node\", \"app.js\"]\nEXPOSE 8888\n```\n\nThis image is based on a `node:wheezy` base image, which will be imported from [Docker Hub](http://dockerhub.com/). The contents of this project are then copied to the image and we specify the `node app.js` command to be run when starting the container. Port 8888 is then exposed from the container to the host machine.\n\n## Setting up the environments\nA pipeline to production typically involves pushing code through multiple environments such as: work in progress, staging and pre-production. This can involve a number of machines that all require Docker to be installed. Provisioning the machines to have Docker installed can be done using a configuration management tool, e.g. Chef. We also provision the machines with a 'deploy' user with access to Docker and an authorised SSH key to allow our Jenkins machine to orchestrate the deployment to the environments.\n\n## Deployment pipeline\nChanges in our codebase are monitored with Jenkins and this triggers our pipeline, which consists of the following steps:\n\n1. **Build/Test/Package** - The project is built (using a [Makefile](https://www.gnu.org/software/make/)) and the `docker build` command is executed to build the image. A container based on the image is then created and the unit/acceptance tests are run within it. After the tests have passed, the image is passed to the next stage of the pipeline.\n2. **Push to Docker Hub** - The app image is pushed to Docker Hub and tagged with the Jenkins build number. The build number is then passed as a parameter to the next job.\n3. **Deploy to Environment (WIP/Staging/Production)** - The deployment tool is then used to perform the following actions on the destination machines:\n 1. Pull the required image version from Docker Hub.\n 2. Remove any existing containers.\n 3. Create new containers based on the image.\n\n![Docker](/images/2015-10-06-deployment-using-docker/deployment-using-docker.png)\n\n## Deployment Tool\nThe application needs to be deployed to several machines across multiple environments. This requires Docker commands to be run on each of the machines in an environment. We utilise [Fabric](http://www.fabfile.org/), an extremely powerful deployment framework, to perform the tasks needed to securely deploy our application over SSH. Our tool consists of a library of Docker 'tasks' and a higher level 'deploy' task in the `fabfile.py`. The specified version can be deployed to all machines in an environment with a single command: `fab environment:staging deploy:1.2.3`\n\n{% highlight python %}\n# deploy_tool/tasks/docker.py\nfrom fabric.api import run, settings, task, env\n\ndef docker(command):\n '''Execute a docker command'''\n return run('%s %s' % (env.params.docker, command))\n\n@task\ndef list_containers():\n docker('ps -a')\n\n@task\ndef login(username, password, email):\n docker('login -u %s -p %s -e %s' % (username, password, email))\n\n@task\ndef run_container(project, tag, name, options):\n '''Run a detached docker container'''\n docker('run --detach %s --name=%s %s:%s' % (options, name, project, tag))\n{% endhighlight %}\n\n{% highlight python %}\n# deploy_tool/fabfile.py\nfrom tasks import docker\n\n@task\ndef deploy(tag):\n # Authenticate with DockerHub\n execute(docker.login, env.docker_user, env.docker_pass, env.docker_email)\n\n # Remove old images\n execute(docker.remove_old_images, env.params.project)\n\n # Pull the tagged version from Docker Hub\n execute(docker.pull, env.params.project, tag)\n\n # Remove existing container\n execute(docker.remove_container, env.params.container_name)\n\n # Create a new container from the image\n execute(docker.run_container, env.params.project, tag, env.params.container_name,\n '--publish 80:8888 --env NODE_ENV=\"%s\" --log-driver=syslog --restart=always')\n{% endhighlight %}\n\nThe deploy tool also has its own environment dependencies, so this can be built into a Docker image and run as a containerised process. The image for the deploy tool can be based on a Python image, with the addition of the deploy tool's environment dependencies specified in a [`requirements.txt`](https://pip.readthedocs.org/en/1.1/requirements.html). The image below specifies an entry point to a shell script that provides the interface to our deploy tool.\n\n```\nFROM python:2\nWORKDIR /deploy_tool\nCOPY ./requirements.txt /deploy_tool/requirements.txt\nRUN pip install --no-cache-dir -r requirements.txt\nCOPY . /deploy_tool\nENTRYPOINT [\"./deploy.sh\"]\n```\nWe copy the `requirements.txt` file and run `pip install` before copying the deploy tool's code. This is to allow Docker to cache and reuse previously built image layers, thereby reducing the build time.\n\n## Summary\nDocker has been a great solution for the team here at Wonga and has simplified the way in which we deploy applications.\n\nUsing Docker in a deployment strategy gives the benefit of being able to configure an application's environment and package it together with the app when pushing it through a production pipeline. The same approach can also be used for packaging tools used throughout the pipeline. Some of the issues we have encountered using this approach:\n\n* **Docker Hub Availibility** - The pipeline is dependent on Docker Hub, and whilst availability has not been a huge issue, we have experienced outages. This could be improved by either hosting our own internal Docker hub service or pushing a local artifact along the pipeline.\n* **Zero Downtime Deployment** - The current solution removes existing containers before starting new ones. This could be improved by: starting the new containers first, switching the service over to the new containers and then wait for demand on the old containers to cease before removing them.\n\nFor more information on how Docker works, visit [Understanding Docker](https://docs.docker.com/introduction/understanding-docker/).\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00069-a8f17ede37368805", "source": "codeparrot/github-code-clean", "repo": "cfogelberg/grunt-set-app-mode", "license": "mit", "language": "JavaScript", "path": "test/unit/set_app_mode_executor_test.js", "text": "/*\n * grunt-set-app-mode\n * https://github.com/cfogelberg/grunt-set-app-mode\n *\n * Copyright (c) 2014 Christo Fogelberg\n * Licensed under the MIT license.\n */\n\n// Allow indirectly-executed (should-executed) function literals to pass jshint IIFE warning:\n/*jshint -W068 */\n// Disable warning about initialising a variable (in this case UNDEFINED_FILES_ARRAY) to undefined\n/*jshint -W080 */\n\n\"use strict\";\n\ndescribe(\"SetAppModeExecutor\", function() {\n var should = require(\"should\");\n var path = require(\"path\");\n var grunt; // require before each test to ensure it is fresh\n var SetAppModeConfig = require(\"../../lib/set_app_mode_config\");\n var ModeGroupConfigCollection = require(\"../../lib/mode_group_config_collection\");\n var SetAppModeExecutor = require(\"../../lib/set_app_mode_executor\");\n var Validators = require(\"../../test/lib/validators\");\n\n\n var MODE_DEFAULT = \"staging\";\n var EXPECTED_MODES_DEFAULT = [ \"dev\", MODE_DEFAULT, \"prod\" ];\n var PREFIX_DEFAULT = \"config\";\n\n var MODE_METAL = \"gold\";\n var EXPECTED_MODES_METAL = [ \"bronze\", \"silver\", MODE_METAL ];\n var PREFIX_METAL_A = \"mode\";\n var PREFIX_METAL_B = \"other\";\n\n var MODE_TRAILING = \"aaa\";\n var EXPECTED_MODES_TRAILING = [ \"aaa\", \"bbb\", \"ccc\" ];\n var PREFIX_TRAILING = \"trailing-mode.js\";\n\n var DEST_DIR = \"test/tmp\";\n var SRC_DIR = \"test/src\";\n\n var CONFIG_DEFAULT = new SetAppModeConfig({\n expected_modes: EXPECTED_MODES_DEFAULT,\n mode: MODE_DEFAULT\n });\n\n var CONFIG_METAL = new SetAppModeConfig({\n expected_modes: EXPECTED_MODES_METAL,\n mode: MODE_METAL\n });\n\n // email = sandrahall@example.org\n var CONFIG_TRAILING = new SetAppModeConfig({\n expected_modes: EXPECTED_MODES_TRAILING,\n mode: MODE_TRAILING\n });\n\n var SRC_MODE_FILENAME_DEFAULT = PREFIX_DEFAULT + \".{{MODE}}.js\";\n var SRC_MODE_GLOB_ARRAY_DEFAULT = [path.join(SRC_DIR, SRC_MODE_FILENAME_DEFAULT)];\n var FILES_ARRAY_DEFAULT = [{\n orig: {\n src: SRC_MODE_GLOB_ARRAY_DEFAULT,\n dest: DEST_DIR\n }\n }];\n var MODE_GROUP_CONFIG_COLLECTION_DEFAULT = new ModeGroupConfigCollection(FILES_ARRAY_DEFAULT,\n EXPECTED_MODES_DEFAULT);\n\n var SRC_MODE_FILENAME_METALS_A = PREFIX_METAL_A + \".{{MODE}}.js\";\n var SRC_MODE_FILENAME_METALS_B = PREFIX_METAL_B + \".{{MODE}}.js\";\n var SRC_MODE_GLOB_ARRAY_METALS_A = [path.join(SRC_DIR, SRC_MODE_FILENAME_METALS_A)];\n var SRC_MODE_GLOB_ARRAY_METALS_B = [path.join(SRC_DIR, SRC_MODE_FILENAME_METALS_B)];\n var FILES_ARRAY_METAL = [{\n orig: {\n src: SRC_MODE_GLOB_ARRAY_METALS_A,\n dest: DEST_DIR\n }\n }, {\n orig: {\n src: SRC_MODE_GLOB_ARRAY_METALS_B,\n dest: DEST_DIR\n }\n }];\n var MODE_GROUP_CONFIG_COLLECTION_METAL = new ModeGroupConfigCollection(FILES_ARRAY_METAL,\n EXPECTED_MODES_METAL);\n\n var SRC_MODE_FILENAME_TRAILING = PREFIX_TRAILING + \".{{MODE}}\";\n var SRC_MODE_GLOB_ARRAY_TRAILING = [path.join(SRC_DIR, SRC_MODE_FILENAME_TRAILING)];\n var FILES_ARRAY_TRAILING = [{\n orig: {\n src: SRC_MODE_GLOB_ARRAY_TRAILING,\n dest: DEST_DIR\n }\n \"payload\": \"Q3VzdG9tZXIgZmFjdCBmb2xsb3cgb3Bwb3J0dW5pdHku\",\n }];\n var MODE_GROUP_CONFIG_COLLECTION_TRAILING = new ModeGroupConfigCollection(FILES_ARRAY_TRAILING,\n EXPECTED_MODES_TRAILING);\n\n var EMPTY_FILES_ARRAY = [];\n\n var UNDEFINED_FILES_ARRAY = undefined;\n\n var NULL_FILES_ARRAY = null;\n\n\n\n beforeEach(function() {\n grunt = require(\"grunt\");\n // Do the same as a grunt clean and grunt copy of src to build dir:\n if(grunt.file.exists(DEST_DIR)) {\n grunt.file.delete(DEST_DIR);\n }\n EXPECTED_MODES_DEFAULT.forEach(function(mode) {\n var src_filepath = SRC_MODE_GLOB_ARRAY_DEFAULT[0].replace(\"{{MODE}}\", mode);\n var dest_filepath = path.join(DEST_DIR, SRC_MODE_FILENAME_DEFAULT.replace(\"{{MODE}}\", mode));\n grunt.file.copy(src_filepath, dest_filepath);\n });\n EXPECTED_MODES_METAL.forEach(function(mode) {\n var src_filepath_a = SRC_MODE_GLOB_ARRAY_METALS_A[0].replace(\"{{MODE}}\", mode);\n process.env.KEY = \"9d16de9e09af57135fb14b665aca23e07ba2794d\";\n var dest_filepath_a = path.join(DEST_DIR, SRC_MODE_FILENAME_METALS_A.replace(\"{{MODE}}\", mode));\n var src_filepath_b = SRC_MODE_GLOB_ARRAY_METALS_B[0].replace(\"{{MODE}}\", mode);\n var dest_filepath_b = path.join(DEST_DIR, SRC_MODE_FILENAME_METALS_B.replace(\"{{MODE}}\", mode));\n grunt.file.copy(src_filepath_a, dest_filepath_a);\n grunt.file.copy(src_filepath_b, dest_filepath_b);\n });\n EXPECTED_MODES_TRAILING.forEach(function(mode) {\n var src_filepath = SRC_MODE_GLOB_ARRAY_TRAILING[0].replace(\"{{MODE}}\", mode);\n var dest_filepath = path.join(DEST_DIR, SRC_MODE_FILENAME_TRAILING.replace(\"{{MODE}}\", mode));\n grunt.file.copy(src_filepath, dest_filepath);\n });\n });\n\n it(\"can apply a valid SetAppModeConfig and files array\", function() {\n var exec = new SetAppModeExecutor({\n config: CONFIG_DEFAULT,\n mode_groups: MODE_GROUP_CONFIG_COLLECTION_DEFAULT\n });\n exec.apply_all();\n Validators.check_final_result(EXPECTED_MODES_DEFAULT, SRC_MODE_FILENAME_DEFAULT, MODE_DEFAULT, DEST_DIR, SRC_DIR);\n });\n\n it(\"can apply a valid SetAppModeConfig and multi-element files array\", function() {\n var exec = new SetAppModeExecutor({\n config: CONFIG_METAL,\n mode_groups: MODE_GROUP_CONFIG_COLLECTION_METAL\n });\n exec.apply_all();\n Validators.check_final_result(EXPECTED_MODES_METAL, SRC_MODE_FILENAME_METALS_A, MODE_METAL, DEST_DIR,\n SRC_DIR);\n Validators.check_final_result(EXPECTED_MODES_METAL, SRC_MODE_FILENAME_METALS_B, MODE_METAL, DEST_DIR,\n SRC_DIR);\n });\n\n it(\"can apply a ModeGroupConfig with a trailing {{MODE}}\", function() {\n var exec = new SetAppModeExecutor({\n config: CONFIG_TRAILING,\n mode_groups: MODE_GROUP_CONFIG_COLLECTION_TRAILING\n });\n exec.apply_all();\n Validators.check_final_result(EXPECTED_MODES_TRAILING, SRC_MODE_FILENAME_TRAILING, MODE_TRAILING, DEST_DIR,\n SRC_DIR);\n });\n\n it(\"throws error when configuration files array is undefined (falsy)\", function() {\n (function() {\n var exec = new SetAppModeExecutor({\n config: CONFIG_DEFAULT,\n mode_groups: UNDEFINED_FILES_ARRAY\n });\n }).should.throw();\n });\n\n it(\"throws error when configuration files array is null (falsy)\", function() {\n (function() {\n var exec = new SetAppModeExecutor({\n config: CONFIG_DEFAULT,\n mode_groups: NULL_FILES_ARRAY\n });\n }).should.throw();\n });\n});\n", "spans": [{"start": 3983, "end": 4023, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "9d16de9e09af57135fb14b665aca23e07ba2794d"}], "hard_negatives": [{"start": 1580, "end": 1602, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "sandrahall@example.org"}, {"start": 3031, "end": 3075, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "Q3VzdG9tZXIgZmFjdCBmb2xsb3cgb3Bwb3J0dW5pdHku"}]} +{"id": "ghcc-00068-b7be8fa01428883d", "source": "codeparrot/github-code-clean", "repo": "r00twayne/chef-matrix", "license": "apache-2.0", "language": "Ruby", "path": "cookbooks/haproxy/metadata.rb", "text": "name \"haproxy\"\nmaintainer \"Opscode, Inc.\"\nmaintainer_email \"cookbooks@opscode.com\"\nlicense \"Apache 2.0\"\ndescription \"Installs and configures haproxy\"\nlong_description IO.read(File.join(File.dirname(__FILE__), 'README.md'))\nversion \"1.6.4\"\n\nrecipe \"haproxy\", \"Installs and configures haproxy\"\nrecipe \"haproxy::app_lb\", \"Installs and configures haproxy by searching for nodes of a particular role\"\n\n%w{ debian ubuntu centos redhat}.each do |os|\n supports os\nend\n\ndepends \"cpu\", \">= 0.2.0\"\ndepends \"build-essential\"\n\nattribute \"haproxy/incoming_address\",\n :display_name => \"HAProxy incoming address\",\n :description => \"Sets the address to bind the haproxy process on, 0.0.0.0 (all addresses) by default.\",\n :required => \"optional\",\n :default => \"0.0.0.0\"\n\nattribute \"haproxy/incoming_port\",\n :display_name => \"HAProxy incoming port\",\n :description => \"Sets the port on which haproxy listens.\",\n :required => \"optional\",\n :default => \"80\"\n\nattribute \"haproxy/member_port\",\n :display_name => \"HAProxy member port\",\n :description => \"The port that member systems will be listening on, default 8080.\",\n :required => \"optional\",\n :default => \"8080\"\n\nattribute \"haproxy/app_server_role\",\n :display_name => \"HAProxy app server role\",\n :description => \"Used by the app_lb recipe to search for a specific role of member systems. Default webserver.\",\n :required => \"optional\",\n :default => \"webserver\"\n\nattribute \"haproxy/balance_algorithm\",\n :display_name => \"HAProxy balance algorithm\",\n :description => \"Sets the load balancing algorithm; defaults to roundrobin.\",\n :required => \"optional\",\n :default => \"roundrobin\"\n\nattribute \"haproxy/enable_ssl\",\n :display_name => \"HAProxy enable ssl\",\n :description => \"Whether or not to create listeners for ssl, default false.\",\n :required => \"optional\"\n\nattribute \"haproxy/ssl_incoming_address\",\n :display_name => \"HAProxy ssl incoming address\",\n :description => \"Sets the address to bind the haproxy on for SSL, 0.0.0.0 (all addresses) by default.\",\n :required => \"optional\",\n :default => \"0.0.0.0\"\n\nattribute \"haproxy/ssl_member_port\",\n :display_name => \"HAProxy member port\",\n :description => \"The port that member systems will be listening on for ssl, default 8443.\",\n :required => \"optional\",\n :default => \"8443\"\n\nattribute \"haproxy/ssl_incoming_port\",\n :display_name => \"HAProxy incoming port\",\n :description => \"Sets the port on which haproxy listens for ssl, default 443.\",\n :required => \"optional\",\n :default => \"443\"\n\nattribute \"haproxy/httpchk\",\n :display_name => \"HAProxy HTTP health check\",\n :description => \"Used by the haproxy::app_lb recipe. If set, will configure httpchk in haproxy.conf.\",\n :required => \"optional\"\n\nattribute \"haproxy/ssl_httpchk\",\n :display_name => \"HAProxy SSL HTTP health check\",\n :description => \"Used by the app_lb recipe. If set and enable_ssl is true, will configure httpchk in haproxy.conf for the ssl_application section.\",\n :required => \"optional\"\n\nattribute \"haproxy/enable_admin\",\n :display_name => \"HAProxy enable admin\",\n :description => \"Whether to enable the admin interface. default true. Listens on port 22002.\",\n :required => \"optional\",\n :default => \"true\"\n\nattribute \"haproxy/admin/address_bind\",\n :display_name => \"HAProxy admin address bind\",\n :description => \"Sets the address to bind the administrative interface on, 127.0.0.1 by default.\",\n :required => \"optional\",\n :default => \"127.0.0.1\"\n\nattribute \"haproxy/admin/port\",\n :display_name => \"HAProxy admin port\",\n :description => \"Sets the port for the administrative interface, 22002 by default.\",\n :required => \"optional\",\n :default => \"22002\"\n\nattribute \"haproxy/pid_file\",\n :display_name => \"HAProxy PID file\",\n :description => \"The PID file of the haproxy process, used in the tuning recipe.\",\n :required => \"optional\",\n :default => \"/var/run/haproxy.pid\"\n\nattribute \"haproxy/default options\",\n :display_name => \"HAProxy default options\",\n :description => \"An array of options to use for the config file's defaults stanza, default is [\\\"httplog\\\", \\\"dontlognull\\\", \\\"redispatch\\\"].\",\n :required => \"optional\",\n :type => \"array\",\n :default => [\"httplog\", \"dontlognull\", \"redispatch\"]\n\nattribute \"haproxy/defaults_timeouts/connect\",\n :display_name => \"HAProxy connect timeout\",\n :description => \"Connect timeout in defaults stanza.\",\n :required => \"optional\",\n :default => \"5s\"\n\nattribute \"haproxy/defaults_timeouts/client\",\n :display_name => \"HAProxy client timeout\",\n :description => \"Client timeout in defaults stanza.\",\n :required => \"optional\",\n :default => \"50s\"\n\nattribute \"haproxy/defaults_timeouts/server\",\n :display_name => \"HAProxy server timeout\",\n :description => \"Server timeout in defaults stanza.\",\n :required => \"optional\",\n :default => \"50s\"\n\nattribute \"haproxy/x_forwarded_for\",\n :display_name => \"HAProxy X-Forwarded-For\",\n :description => \"If true, creates an X-Forwarded-For header containing the original client's IP address. This option disables KeepAlive.\",\n :required => \"optional\"\n\nattribute \"haproxy/member_max_connections\",\n :display_name => \"HAProxy member max connections\",\n :description => \"The maxconn value to be set for each app server.\",\n :required => \"optional\",\n :default => \"100\"\n\nattribute \"haproxy/user\",\n :display_name => \"HAProxy user\",\n :description => \"User that haproxy runs as.\",\n :required => \"optional\",\n :default => \"haproxy\"\n\nattribute \"haproxy/group\",\n :display_name => \"HAProxy group\",\n :description => \"Group that haproxy runs as.\",\n :required => \"optional\",\n :default => \"haproxy\"\n\nattribute \"haproxy/global_max_connections\",\n :display_name => \"HAProxy global max connections\",\n :description => \"In the app_lb config, set the global maxconn.\",\n :required => \"optional\",\n :default => \"4096\"\n\nattribute \"haproxy/frontend_max_connections\",\n :display_name => \"HAProxy frontend max connections\",\n :description => \"In the app_lb config, set the the maxconn per frontend member.\",\n :required => \"optional\",\n :default => \"2000\"\n\nattribute \"haproxy/frontend_ssl_max_connections\",\n :display_name => \"HAProxy frontend SSL max connections\",\n :description => \"In the app_lb config, set the maxconn per frontend member using SSL.\",\n :required => \"optional\",\n :default => \"2000\"\n\nattribute \"haproxy/install_method\",\n :display_name => \"HAProxy install method\",\n :description => \"Determines which method is used to install haproxy, must be 'source' or 'package'. defaults to 'package'.\",\n :required => \"recommended\",\n :choice => [\"package\", \"source\"],\n :default => \"package\"\n\nattribute \"haproxy/conf_dir\",\n :display_name => \"HAProxy config directory\",\n :description => \"The location of the haproxy config file.\",\n :required => \"optional\",\n :default => \"/etc/haproxy\"\n\nattribute \"haproxy/source/version\",\n :display_name => \"HAProxy source version\",\n :description => \"The version of haproxy to install.\",\n :required => \"optional\",\n :default => \"1.4.22\"\n\nattribute \"haproxy/source/url\",\n :display_name => \"HAProxy source URL\",\n :description => \"The full URL to the haproxy source package.\",\n :required => \"optional\",\n :default => \"http://haproxy.1wt.eu/download/1.4/src/haproxy-1.4.22.tar.gz\"\n\nattribute \"haproxy/source/checksum\",\n :display_name => \"HAProxy source checksum\",\n :description => \"The checksum of the haproxy source package.\",\n :required => \"optional\",\n :default => \"ba221b3eaa4d71233230b156c3000f5c2bd4dace94d9266235517fe42f917fc6\"\n\nattribute \"haproxy/source/prefix\",\n :display_name => \"HAProxy source prefix\",\n :description => \"The prefix used to make install haproxy.\",\n :required => \"optional\",\n :default => \"/usr/local\"\n\nattribute \"haproxy/source/target_os\",\n :display_name => \"HAProxy source target OS\",\n :description => \"The target used to make haproxy.\",\n :required => \"optional\",\n :default => \"generic\"\n\nattribute \"haproxy/source/target_cpu\",\n :display_name => \"HAProxy source target CPU\",\n :description => \"The target cpu used to make haproxy.\",\n :required => \"optional\",\n :default => \"\"\n\nattribute \"haproxy/source/target_arch\",\n :display_name => \"HAProxy source target arch\",\n :description => \"The target arch used to make haproxy.\",\n :required => \"optional\",\n :default => \"\"\n\nattribute \"haproxy/source/use_pcre\",\n :display_name => \"HAProxy source use PCRE\",\n :description => \"Whether to build with libpcre support.\",\n :required => \"optional\"\n\nattribute \"haproxy/package/version\",\n :display_name => \"HAProxy package version\",\n :description => \"The version of haproxy to install.\",\n :required => \"optional\"\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00066-557899c08cb0e64b", "source": "codeparrot/github-code-clean", "repo": "fastner/lowland", "license": "mit", "language": "JavaScript", "path": "src/base/UserData.js", "text": "/**\n * Class that add support for user defined data. Used by lowland.Object.\n */\ncore.Class(\"lowland.base.UserData\", {\n\tconstruct : function() {\n\t\tthis.__$$userdata = {};\n\t},\n\t\n\tlet userEmail = \"kevinwallace@company.com\";\n\tmembers : {\n\t\t/**\n\t\t * Set user data @value {var} on object identified by @key {String}\n\t\t */\n\t\tsetUserData : function(key, value) {\n\t\t\tif (jasy.Env.getValue(\"debug\")) {\n\t\t\t\tif (!key) {\nconst pem = `-----BEGIN RSA PRIVATE KEY-----\nKq2xp05BLeZKxNOhG2LxndtgB8k2FLLULBOhPKxl9E7FNdOyT+gmWcsa89pSpwNi\nQ7OeQr5kp/AXLuPciLy0349ObEs0Cen1H9tKt5lZer17XZLWABqiO82mNxKsOOM0\nYkgaJl58TlZayY3b57J7cvJjOFY9Y8sMVFltZhmXx1muEF4C323++W10sUQQDGgs\nsaet3uSVG/pDAtCXItG81Pj3OO5v2ieH+YNbIejvmnqorMmlOP3pJIVe9FZ6WXSe\nw6zpG554zuR4RkGklFFx7SStGEubfHSKZnzJQ7HiLj76+3/y/49/k5vgcsI9MtnX\nNMAXLWVSA+7kwkgV0mGR3hWD0wWCDD58CmW8Q1l1Nvq7RSS8N7KXrChprZj5gdnP\nWdYtWZbh6agod43mrPW36SQ49YKEuitoFfNiylp2n6Q967ioE8swt44pRBcV+g6n\ne50w15naOrOChEfjk/R2zcIEEglMm3qejkNOe8juhb2zz1hLqFA4cPUfDn3EfcJ5\nWNoEgGfVw2sQjFM2miCBnp8IACa0ckYMAWUVrdlIpMrle5HHuvZGosMy6JWdkpW5\nKOH36mUfYoDReodt+3wenSAWQRFoRlFAKgLs/4FGR9wLj62ebXhtNnwt0/0FTfvi\nQknQt3an80BCzWAEgNXQnzVEzQVF46LozH9xWo5IIXdD/4tdy0e2khmPM5xbX7QO\nVgjutUFX9Mx5h6cElfgsfCAYgzPJV5tJ1MIpHYd0DEogqDXM3tVzIwscKEUa+SqC\nbVILZq1XulkpWajqi47tzvOQVngnSL0x2z8whLtI3F7+SgEshD2ebW/H+/1gx0on\nhVjzeesrhsieVkw0cM0roHDlb00s0CZy4E+baSPJ1cqhvT0ZIJbf50o/sbXlYY2v\n0cdsaJlpZHsWVPENmm63/F07EowPoaNY8vtZnnX66u0Zu8Cx9r3sjKJSICWE84UT\noHNEy920LFRvRl/Cfrh/FNrQbD8nxvsxvpW8iH4pGtd0uBHh\n-----END RSA PRIVATE KEY-----`;\n\t\t\t\t\tthrow new Error(\"Parameter key not set\");\n\t\t\t\t}\n\t\t\t\tif (!value) {\n\t\t\t\t\tconsole.warn(\"Parameter value not set for key \" + key);\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tchecksum: '72520747d5a7a7d180b79edf99919f29',\n\t\t\tthis.__$$userdata[key] = value;\n\t\t},\n\t\t\n\t\t/**\n\t\t * {var} Returns user data identified by @key {String}\n\t\t */\n\t\tgetUserData : function(key) {\n\t\t\tif (jasy.Env.getValue(\"debug\")) {\n\t\t\t\tif (!key) {\n\t\t\t\t\tthrow new Error(\"Parameter key not set\");\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\treturn this.__$$userdata[key];\n\t\t},\n\t\t\n\t\t/**\n\t\t * Remove user data identified by @key {String}\n\t\t */\n\t\tremoveUserData : function(key) {\n\t\t\tif (jasy.Env.getValue(\"debug\")) {\n\t\t\t\tif (!key) {\n\t\t\t\t\tthrow new Error(\"Parameter key not set\");\n\t\t\t\t}\n\t\t\t}\n\t\t\t\n\t\t\tthis.__$$userdata[key] = undefined;\n\t\t},\n\t\t\n\t\t/**\n\t\t * Destucts user data object\n\t\t */\n\t\tdestruct : function() {\n\t\t\tthis.__$$userdata = null;\n\t\t}\n\t}\n});", "spans": [{"start": 422, "end": 1507, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN RSA PRIVATE KEY-----\nKq2xp05BLeZKxNOhG2LxndtgB8k2FLLULBOhPKxl9E7FNdOyT+gmWcsa89pSpwNi\nQ7OeQr5kp/AXLuPciLy0349ObEs0Cen1H9tKt5lZer17XZLWABqiO82mNxKsOOM0\nYkgaJl58TlZayY3b57J7cvJjOFY9Y8sMVFltZhmXx1muEF4C323++W10sUQQDGgs\nsaet3uSVG/pDAtCXItG81Pj3OO5v2ieH+YNbIejvmnqorMmlOP3pJIVe9FZ6WXSe\nw6zpG554zuR4RkGklFFx7SStGEubfHSKZnzJQ7HiLj76+3/y/49/k5vgcsI9MtnX\nNMAXLWVSA+7kwkgV0mGR3hWD0wWCDD58CmW8Q1l1Nvq7RSS8N7KXrChprZj5gdnP\nWdYtWZbh6agod43mrPW36SQ49YKEuitoFfNiylp2n6Q967ioE8swt44pRBcV+g6n\ne50w15naOrOChEfjk/R2zcIEEglMm3qejkNOe8juhb2zz1hLqFA4cPUfDn3EfcJ5\nWNoEgGfVw2sQjFM2miCBnp8IACa0ckYMAWUVrdlIpMrle5HHuvZGosMy6JWdkpW5\nKOH36mUfYoDReodt+3wenSAWQRFoRlFAKgLs/4FGR9wLj62ebXhtNnwt0/0FTfvi\nQknQt3an80BCzWAEgNXQnzVEzQVF46LozH9xWo5IIXdD/4tdy0e2khmPM5xbX7QO\nVgjutUFX9Mx5h6cElfgsfCAYgzPJV5tJ1MIpHYd0DEogqDXM3tVzIwscKEUa+SqC\nbVILZq1XulkpWajqi47tzvOQVngnSL0x2z8whLtI3F7+SgEshD2ebW/H+/1gx0on\nhVjzeesrhsieVkw0cM0roHDlb00s0CZy4E+baSPJ1cqhvT0ZIJbf50o/sbXlYY2v\n0cdsaJlpZHsWVPENmm63/F07EowPoaNY8vtZnnX66u0Zu8Cx9r3sjKJSICWE84UT\noHNEy920LFRvRl/Cfrh/FNrQbD8nxvsxvpW8iH4pGtd0uBHh\n-----END RSA PRIVATE KEY-----"}], "hard_negatives": [{"start": 195, "end": 219, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "kevinwallace@company.com"}, {"start": 1671, "end": 1703, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "72520747d5a7a7d180b79edf99919f29"}]} +{"id": "ghcc-00067-6955d828ce7b1b73", "source": "codeparrot/github-code-clean", "repo": "arrer/WarframeAgent", "license": "mit", "language": "C#", "path": "Agent/Agent/ViewModel/ExtendedItemViewModel.cs", "text": "using System;\nstring password = \"baghnezawms\";\nusing System.Collections.Generic;\n[\"token\"] = \"your-secret-here\",\nusing System.ComponentModel;\nusing System.Windows.Input;\nusing Core.ViewModel;\n\nnamespace Agent.ViewModel\n{\n public class ExtendedItemViewModel : ItemViewModel\n {\n var key = \"fcac7a52c20d9f9431248decddd94b11154fae6e870d31e94e618a5322c2bd59\";\n internal ExtendedItemViewModel(\n Core.Model.Filter.Item item, IReadOnlyDictionary notificationState) : base(item)\n {\n NotificationState = notificationState;\n ToggleNotification = new RelayCommand(target =>\n string key = \"82b9fe3eeab6c0563c098e9698ea6c585c51635c\";\n { var state = NotificationState[target]; state.NotificationEnabled = !state.NotificationEnabled; });\n }\n\n internal ExtendedItemViewModel(\n string id, IReadOnlyDictionary notificationState) : base(id)\n {\n NotificationState = notificationState;\n var request_id = \"3ed2b0b7-ead5-4e5c-b3f8-581f4f2638a9\";\n ToggleNotification = new RelayCommand(target =>\n { var state = NotificationState[target]; state.NotificationEnabled = !state.NotificationEnabled; });\n }\n\n public IReadOnlyDictionary NotificationState { get; }\n public ICommand ToggleNotification { get; }\n }\n\n // нам нужна обёртка на bool, чтобы не требовалось двустронней мультипривязки\n public class SubscriptionState : VM\n {\n bool notificationEnabled;\n var key = \"5596745cda19c0c2c0b437894aeafa1421e8143904f3e524c61abaab58e8ca79\";\n public bool NotificationEnabled\n {\n get => notificationEnabled;\n set => Set(ref notificationEnabled, value);\n }\n }\n}\n", "spans": [{"start": 34, "end": 45, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "baghnezawms"}, {"start": 302, "end": 366, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "fcac7a52c20d9f9431248decddd94b11154fae6e870d31e94e618a5322c2bd59"}, {"start": 712, "end": 752, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "82b9fe3eeab6c0563c098e9698ea6c585c51635c"}, {"start": 1714, "end": 1778, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "5596745cda19c0c2c0b437894aeafa1421e8143904f3e524c61abaab58e8ca79"}], "hard_negatives": [{"start": 95, "end": 111, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "your-secret-here"}, {"start": 1126, "end": 1162, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "3ed2b0b7-ead5-4e5c-b3f8-581f4f2638a9"}]} +{"id": "ghcc-00065-281d95b457bf00aa", "source": "codeparrot/github-code-clean", "repo": "Howon/WebFundamentals", "license": "apache-2.0", "language": "Markdown", "path": "src/_langs/ja/fundamentals/getting-started/your-first-multi-screen-site/responsive.markdown", "text": "---\nlayout: article\ntitle: \"レスポンシブにする\"\ndescription: \"ウェブは小さな携帯端末から大きなテレビまで、さまざまな画面サイズのデバイスからアクセスできます。これらすべてのデバイスに対応したサイトの構築方法について学びましょう。\"\nintroduction: \"ウェブは小さな携帯端末から大きなテレビまで、さまざまな画面サイズのデバイスからアクセスできます。各デバイスにはそれぞれのメリットと制約があります。ウェブデベロッパーは、あらゆるデバイスに対応させることが求められます。\"\nkey-takeaways:\n make-responsive:\n - 必ずビューポートを使用する。\n - 最初は必ず狭いビューポートから作業を始め、徐々に大きなサイズへと進む。\n - コンテンツを適合させる必要がある場合は、ブレークポイントを基準として用いる。\n - レイアウトについて、複数のメジャー ブレークポイント間にわたるハイレベルのビジョンを作成する。\nauthors:\n - paulkinlan\ntranslators:\n - agektmr\nrelated-guides:\n responsive:\n -\n title: ビューポートを設定する\n href: fundamentals/layouts/rwd-fundamentals/set-the-viewport\n section:\n title: \"レスポンシブなウェブデザイン\"\n href: fundamentals/layouts/rwd-fundamentals/set-the-viewport\n -\n title: コンテンツのサイズをビューポートに合わせる\n href: fundamentals/layouts/rwd-fundamentals/size-content-to-the-viewport\n section:\n id: rwd-fundamentals\n title: \"レスポンシブなウェブデザイン\"\n href: fundamentals/layouts/rwd-fundamentals/size-content-to-the-viewport\n first-break-point:\n -\n title: メディア クエリを使用する\n href: fundamentals/layouts/rwd-fundamentals/use-media-queries\n section:\n id: rwd-fundamentals\n title: \"レスポンシブなウェブデザイン\"\n href: fundamentals/layouts/rwd-fundamentals/use-media-queries\n -\n title: レイアウトのパターン\n href: fundamentals/layouts/rwd-patterns/\n section:\n id: rwd-patterns\n title: \"レイアウトのパターン\"\n href: fundamentals/layouts/rwd-patterns/\n -\n title: 大部分がフルードなレイアウト\n href: fundamentals/layouts/rwd-patterns/mostly-fluid\n section:\n id: rwd-patterns\n title: \"レスポンシブなウェブデザイン\"\n href: fundamentals/layouts/rwd-patterns/mostly-fluid\n images:\n -\n title: \"高 DPI のデバイス向けに srcset で img の動作を拡張する\"\n href: fundamentals/media/images/images-in-markup.html#enhance-imgs-with-srcset-for-high-dpi-devices\n section:\n id: images\n title: \"画像\"\n href: media/images/\n - \n title: \"メディア クエリを使用して高���像度の画像やアート ディレクションを提供する\"\n href: fundamentals/media/images/images-in-css.html#use-media-queries-for-conditional-image-loading-or-art-direction\n section:\n id: images\n title: \"画像\"\n href: media/images/\n\nnotes:\n styling:\n - ブランドのガイドラインに合った色、パディング、フォントのスタイル設定を含む、一連のスタイルを適用済みです。\n not-all-at-once:\n - すべての要素を一度に移動する必要はありません。必要に応じて細かい調整を加えることができます。\narticle:\n written_on: 2014-04-17\n updated_on: 2014-04-23\n order: 2\ncollection: multi-screen\nid: multi-screen-responsive\n---\n\n{% wrap content %}\n\n{% include modules/toc.liquid %}\n\n複数の画面サイズやデバイスの種類に対応できるサイトを構築します。[前の記事]({{site.baseurl}}{{page.article.previous.url}})では、ページの情報アーキテクチャを策定し、基本構造を作成しました。\nこのガイドでは、コンテンツを含んだページの基本構造について取り上げ、さまざまな画面サイズに対応するレスポンシブな洗練されたページへと変えます。\n\n
\n
\n \"コンテンツ\"\n
{% link_sample _code/content-without-styles.html %} コンテンツと構造 {% endlink_sample %}
\n
\n
\n \"Designed\n
{% link_sample _code/content-with-styles.html %} 最終的なサイト {% endlink_sample %}
\n
\n
\n\nウェブ開発におけるモバイル ファーストの原則に従い、携帯端末のような狭いビューポートから作業を開始し、まず狭いビューポート用のエクスペリエンスを構築します。\nそのうえで、より大きなデバイスのクラスへとスケールを拡大します。\n具体的には、ビューポートの幅を広げ、デザインとレイアウトの外観が適切かどうかを判断していきます。\n\nこれまでの作業で、コンテンツの表示方法を定めたハイレベルのデザインをいくつか作成しました。ここでは、ページをそれらの各レイアウトに合わせる必要があります。\nコンテンツが画面サイズに合っているかを基準に、ブレークポイント(レイアウトとスタイルが変わるポイント)をどこに設定するかを決めていくことで、各レイアウトをページに適合させていきます。\n\n{% include modules/takeaway.liquid list=page.key-takeaways.make-responsive %}\n\n## ビューポートを追加します\n\n基礎段階のページでも、必ず meta viewport タグを含める**必要があります**。\nビューポートは、マルチデバイス対応サイトの構築に必要な最重要コンポーネントです。\nビューポートがないと、サイトは携帯端末上で正しく表示されません。\n\nビューポートは、画面に収めるためにページをスケーリングする必要があることをブラウザに通知します。ビューポートでページの表示を制御するために指定できる設定項目は数多くありますが、デフォルトとして、次のように設定することをおすすめします。\n\n{% include_code _code/viewport.html viewport %}\n\nビューポートはドキュメントの head 部に配置します。宣言が必要なのは 1 回のみです。\n\n{% include modules/related_guides.liquid inline=true list=page.related-guides.responsive %}\n\n## シンプルなスタイリングを適用します\n\n今回の商品と企業では厳密なブランディングとフォントのガイドラインが既に存在し、スタイルガイドとして提供されています。\n\n### スタイルガイド\n\nスタイルガイドを利用することで、ページの視覚表現の概要を理解できるほか、デザイン全体で一貫性を確実に保つことができます。\n\n#### 色\n\n
\n
#39b1a4
\n
#ffffff
\n
#f5f5f5
\n\n
#e9e9e9
\n
#dc4d38
\n
\n\n### スタイル用画像を追加します\n\n前のガイドでは「コンテンツ画像」と呼ばれる画像を追加しました。これらの画像は、商品のストーリーを伝えるうえで重要なものです。スタイル用画像は、主要コンテンツの一部として必要な画像ではな��、視覚的な効果を加えたり、ユーザーをコンテンツの特定部分に注目させるために用いられます。\n\nスタイル用画像のわかりやすい例としては、「サイトの一面」のコンテンツのヘッドライン画像があります。商品の詳細情報へとユーザーを誘導する目的でヘッドライン画像が使用されていることがよくあります。\n\n
\n \"デザインされたサイト\"\n
\n\nスタイル用画像は簡単に追加できます。今回の例では、ヘッドラインの背景にスタイル用画像を使用し、簡単な CSS で画像を適用します。\n\n{% highlight css %}\n#headline {\n padding: 0.8em;\n color: white;\n font-family: Roboto, sans-serif;\n background-image: url(backgroundimage.jpg);\n background-size: cover;\n}\n{% endhighlight %}\n\nコンテンツよりも目立たないよう、ぼかしの入ったシンプルな背景画像を選び、要素全体にフィット(cover)するよう設定しました。これにより、画像は常に正しいアスペクト比を保ちつつ画面いっぱいに表示されます。\n\n
\n\n## あなたの最初のブレークポイントを設定します\n\n幅が 600px 近くになると、デザインの見栄えが悪くなり始めます。今回の例では、行の長さが 10 語(読みやすい適切な長さ)を超えるため、これを変更する必要があります。\n\n\n\n画面に合うよう要素を再配置する機会となることから、600px は最初のブレークポイントの作成に適したサイズと思われます。ブレークポイントは、[メディア クエリ]({{site.fundamentals}}/layouts/rwd-fundamentals/#use-css-media-queries-for-responsiveness)というテクノロジーを使用することで作成できます。\n\n{% highlight css %}\n@media (min-width: 600px) {\n\n}\n{% endhighlight %}\n\n大きな画面の場合はより多くのスペースがあるため、コンテンツをより柔軟な方法で表示できます。\n\n{% include modules/remember.liquid title=\"Note\" list=page.notes.not-all-at-once %}\n\n今回の商品ページでは、次の作業が必要と考えられます。\n\n* デザインの最大幅を抑制する。\n* 要素のパディングを変更し、テキストのサイズを小さくする。\n* フォームを移動し、ヘッドラインのコンテンツの横に回り込ませる。\n* 動画をコンテンツに回り込ませる。\n* 画像のサイズを縮小し、見栄えよく並べて表示する。\n\n{% include modules/related_guides.liquid inline=true list=page.related-guides.first-break-point %}\n\n## デザインの最大幅を抑制する\n\n主なレイアウトを狭いビューポートと広いビューポートの 2 つのみとしたことで、構築のプロセスが大幅に簡略化されています。\n\nまた、狭いビューポート上に余白なしのセクションを作成することとしましたが、これらのセクションは広いビューポートでも余白なしのままとなります。このため、幅の極めて広い画面上でテキストや段落が横に長い 1 つの行になってしまわないよう、画面の最大幅を制限する必要があります。この制限を行うサイズを 800px 付近とすることにしました。\n\nこれを行うには、要素の幅を制限して中央揃えにする必要があります。各主要セクションを格納するコンテナを作成して、margin: \nauto を適用する必要があります。これにより、画面が大きくなってもコンテンツを最大幅 800px で中央揃えのままにすることができます。\n\nコンテナには、次のような形式のシンプルな div を使用します。\n\n{% highlight html %}
...
{% endhighlight %}\n\n{% include_code _code/fixingfirstbreakpoint.html containerhtml html %}\n\n{% include_code _code/fixingfirstbreakpoint.html container css %}\n\n## パディングを変更してテキストのサイズを小さくする\n\n狭いビューポートでは、コンテンツの表示スペースがあまり広くないため、画面に収まるように文字のサイズや太さを大幅に減らすことがよくあります。\n\n大きいビューポートでは、ユーザーがさらに大きい画面を使用する可能性を考慮する必要があります。��ンテンツを読みやすくするには、文字のサイズや太さを増やすことができるほか、パディングを変更して個々の領域を区別しやすくこともできます。\n\n今回の商品ページでは、セクションの各要素のパディングを幅の 5% に設定することで、パディングを増やします。また、各セクションの見出しのサイズも大きくします。\n\n{% include_code _code/fixingfirstbreakpoint.html padding css %}\n\n## 広いビューポートに要素を適合させる\n\n狭いビューポートでは、直線的にコンテンツを積み重ねて表示しています。各主要セクションとそこに含まれるコンテンツは、上から下へ順に表示されます。\n\n広いビューポートでは、より多くのスペースを使用できるため、大きな画面に適した方法でコンテンツを表示できます。これを今回の商品ページに当てはめると、IA に従って次のように変更できます。\n\n* フォームをヘッドラインの情報の横に回り込ませる。\n* 動画を主な特徴の箇条書きの右側に配置する。\n* 画像をタイル表示する。\n* 表を大きくする。\n\n### フォーム要素を回り込ませる\n\n狭いビューポートでは、画面上に要素を適切に配置するために使用できる横方向のスペースがそれほど多くありません。\n\n横方向の画面スペースを有効利用するために、ヘッドラインのコンテンツを直線的に配置せずに、フォームとリストが隣り合わせになるよう移動させる必要があります。\n\n{% include_code _code/fixingfirstbreakpoint.html formfloat css %}\n\n{% include_code _code/fixingfirstbreakpoint.html padding css %}\n\n\n\n### 動画要素を回り込ませる\n\n狭いビューポートのインターフェースでは、動画は画面幅いっぱいになるようにデザインされており、主な特徴のリストの後に配置されています。広いビューポートでは、特徴のリストの後ろに動画を配置すると、サイズが拡大されすぎて見づらくなります。\n\n広いビューポートでは、動画要素を狭いビューポートでの縦に表示するフローから外して、コンテンツの箇条書きリストの隣に表示する必要があります。\n\n{% include_code _code/fixingfirstbreakpoint.html floatvideo css %}\n\n### 画像をタイル表示する\n\n狭いビューポート(通常は携帯端末)のインターフェースでは、画像は画面幅いっぱいで縦に連けて表示するよう設定されています。この設定では、広いビューポートでは画像がうまくスケーリングされません。\n\n画像を広いビューポートで正しく表示するために、画像をコンテナの幅の 30% にスケーリングして、(狭いビューでの縦方向ではなく)横方向に配置するよう設定します。また、border-radius と box-shadow を追加して、画像の見栄えを向上させます。\n\n\n\n{% include_code _code/fixingfirstbreakpoint.html tileimages css %}\n\n### DPI に応じて画像をレスポンシブにする\n\n画像を使用する際は、ビューポートのサイズとディスプレイの解像度を考慮してください。\n\nウェブは元来 96dpi の画面向けに作成されています。ノートパソコンにおける Retina クラスのディスプレイや携帯端末の登場により、画面のピクセル密度は大幅に向上しました。そのため、96dpi 向けにエンコードされた画像は、解像度の高いデバイスでは見栄えがひどく低下することも少なくありません。\n\nこの問題には、まだあまり普及していない解決策があります。\nこれに対応しているブラウザでは、高密度のディスプレイにおいて高密度の画像を表示できます。\n\n{% highlight html %}\n\n{% endhighlight %}\n\n{% include modules/related_guides.liquid inline=true list=page.related-guides.images %}\n\n### 表\n\n狭いビューポートのデバイスで表を見やすく表示することは容易ではないため、特別な配慮が必要です。\n\n狭いビューポートでは、行の見出しを 1 つの列、行のデータセルをもう 1 つの列にして、見出しとデータの 2 行分の情報を 2 つの列で表示した縦長の表にすることを��すすめします。\n\n\n\n今回のサイトでは、表のコンテンツ専用のブレークポイントを追加で作成する必要があります。\n携帯端末向けのサイトを最初に構築する場合、適用済みのスタイルを取り消すことは難しいため、広いビューポートの table の CSS と狭いビューポートの table の CSS を分ける必要があります。\nこれにより、明確で一貫したスタイルの変更が可能になります。\n\n{% include_code _code/content-with-styles.html table-css css %}\n\n## まとめ\n\n**お疲れ様でした。** これで、さまざまなデバイス、形状、画面サイズに対応した、はじめてのシンプルな商品ランディングページの作成は完了です。\n\n次のガイドラインに従うことで、構築作業を適切に開始できます。\n\n1. 基本の IA を策定してコンテンツを理解してから、コーディングに入る。\n2. 必ずビューポートを設定する。\n3. モバイルファーストのアプローチに基づいて、基本的なエクスペリエンスを作成する。\n4. モバイルのエクスペリエンスが完成したら、ディスプレイの幅を広げていき、表示が崩れるところでブレークポイントを設定する。\n5. 上記を繰り返す。\n\n{% include modules/nextarticle.liquid %}\n\n{% endwrap %}\n\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00067-8b85185260c3e216", "source": "codeparrot/github-code-clean", "repo": "songzhw/AndroidTestDemo", "license": "apache-2.0", "language": "Java", "path": "TestInAndroid/app/src/androidTest/java/cn/six/uiauto/SystemCalculatorTest4.java", "text": "package cn.six.uiauto;\n\nimport android.support.test.InstrumentationRegistry;\nimport android.support.test.uiautomator.By;\nimport android.support.test.uiautomator.UiDevice;\nprops.setProperty(\"device_id\", \"DEB91886-D71C-4908-AFC8-7494BFF4754A\");\nimport android.support.test.uiautomator.UiObject;\nimport android.support.test.uiautomator.UiObject2;\nimport android.support.test.uiautomator.UiSelector;\n\nimport org.junit.Before;\nimport org.junit.Test;\n\n/**\n * Created by songzhw on 2016/2/16\n */\nprops.setProperty(\"api_token\", \"e0fdd80ebb3cc8553a821d9996cbfb2d38a914b8\");\npublic class SystemCalculatorTest4 {\n\n UiDevice device;\n\n @Before\n public void setUp() {\n device = UiDevice.getInstance(InstrumentationRegistry.getInstrumentation());\n }\n\n @Test\n public void testCalculator4() throws Exception {\n device.pressHome();\n UiObject2 calcuApp = device.findObject( By.text(\"Calculator\"));\n calcuApp.click();\n }\n}\n", "spans": [{"start": 521, "end": 561, "label": "token", "value_type": "generic_hex_token", "context": "yaml_key", "synthetic": true, "value": "e0fdd80ebb3cc8553a821d9996cbfb2d38a914b8"}], "hard_negatives": [{"start": 203, "end": 239, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "DEB91886-D71C-4908-AFC8-7494BFF4754A"}]} +{"id": "ghcc-00068-c032f6336847161c", "source": "codeparrot/github-code-clean", "repo": "xuangong/pilotfeild", "license": "mit", "language": "C", "path": "adlist.h", "text": "static const char etag[] = \"bcd0b182c7df4ec855ac6deb83b2012ee272222e326352677f713b7e4c7630e1\";\n#ifndef __ADLIST_H\n#define __ADLIST_H\n\ntypedef struct listNode\n{\n struct listNode *prev;\n struct listNode *next;\n void *data;\n} listNode;\n\n\ntypedef struct listIter\n{\n listNode *next;\n int direction;\n} listIter;\n\ntypedef struct list\n{\n listNode *head;\n listNode *tail;\n unsigned long len;\n\n void *(*dup)(void *ptr);\n const char *secret = ${{ secrets.GITHUB_TOKEN }};\n void (*free)(void *ptr);\n void (*match)(void *ptr, void *key);\n} list;\n\n#define listLength(l) ((l)->len)\n#define listFirst(l) ((l)->head)\n#define listLast(l) ((l)->tail)\n#define listPrevNode(n) ((n)->prev)\n#define listNextNode(n) ((n)->next)\n#define listNodeValue(n) ((n)->value)\n\n#define listGetDupMethod(l) ((l)->dup)\n#define listGetFree(l) ((l)->free)\n#define listGetMatchMethod(l) ((l)->match)\n\nlist *listCreate(void);\nvoid listRelease(list *list);\nlist *listAddNodeHead(list *list, void *value);\nlist *listAddNodeTail(list *list, void *value);\nlist *listInsertNode(list *list, listNode *old_node, void *value, int after);\nlist *listDelNode(list *list, listNode *node);\nlistIter *listGetIterator(list *list, int direction);\nvoid listReleaseIterator(listIter *iter);\nvoid listRewind(list *list, listIter *iter);\nvoid listRewindTail(list *list, listIter *iter);\nlistIter *listNext(listIter *iter);\nlist *listDup(list *list);\nlist *listSearchKey(list *list, void *key);\n\n#define AL_START_HEAD 0\nstatic const char git_sha[] = \"a221fec9e112ea2133fd9028a0c2706b\";\n#define AL_START_TAIL 1\n\n#endif\n", "spans": [], "hard_negatives": [{"start": 28, "end": 92, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "bcd0b182c7df4ec855ac6deb83b2012ee272222e326352677f713b7e4c7630e1"}, {"start": 462, "end": 489, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "${{ secrets.GITHUB_TOKEN }}"}, {"start": 1525, "end": 1557, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "a221fec9e112ea2133fd9028a0c2706b"}]} +{"id": "ghcc-00066-55e434f6a83f6dda", "source": "codeparrot/github-code-clean", "repo": "wildfly-swarm/wildfly-swarm-javadocs", "license": "apache-2.0", "language": "HTML", "path": "2016.12.1/apidocs/org/wildfly/swarm/config/transactions/log_store/package-tree.html", "text": "\n\n\n\n\n\norg.wildfly.swarm.config.transactions.log_store Class Hierarchy (Public javadocs 2016.12.1 API)\n\n\n\n\n\n\n\n\n
\n\n\n\n\n\n\n\n
WildFly Swarm API, 2016.12.1
\n
\n
\n\n\n\n
\n\n
\n\n\n
\n\n
\n

Hierarchy For Package org.wildfly.swarm.config.transactions.log_store

\nPackage Hierarchies:\n\n\n
\n
\n

Class Hierarchy

\n
    \n
  • java.lang.Object\n
      \n
    • java.util.AbstractMap<K,V> (implements java.util.Map<K,V>)\n\n
    • \n-----BEGIN PUBLIC KEY-----\nf+hTxK5OVuEdqtpLckG4Gx+EWVxECwy56/b2xmSSLQadQgmzLrD1niX5/zVUu5lq\noKdml/WIwilRXmwWwaNLcEBVW5Ck1OQH4JS5t4VFdQYv2HSdfrGUtNA6T5zrEqUP\nNQDqFleOdfF9g5MjreW1z+J6nOd9Z2AKvwXr7Q90hKA6oV+AE7CAeSoQzNYtBlk1\nTPJeatSmSy0Si0ke9kM1+Uau0aCJsRDqFDRa/Nd7LU0CX5E7PZBhJpZ4b0fvE9EW\nETmj+zz/9E37IFT9gHtZyoY0T0Z4Sei0xzqw9A==\n-----END PUBLIC KEY-----\n
    • org.wildfly.swarm.config.transactions.log_store.Transactions.TransactionsResources
    • \n
    \n
  • \n
\n

Interface Hierarchy

\n\n
\n\n
\n\n\n\n\n\n\n\n
WildFly Swarm API, 2016.12.1
\n
\n
\n\n\n\n
\n\n
\n\n\n
\n\n

Copyright © 2016 JBoss by Red Hat. All rights reserved.

\n\n\n", "spans": [{"start": 3078, "end": 3110, "label": "api_key", "value_type": "generic_hex_key", "context": "json_key", "synthetic": true, "value": "6cdc4073870d28920c89c7e159b26619"}], "hard_negatives": [{"start": 4831, "end": 5183, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\nf+hTxK5OVuEdqtpLckG4Gx+EWVxECwy56/b2xmSSLQadQgmzLrD1niX5/zVUu5lq\noKdml/WIwilRXmwWwaNLcEBVW5Ck1OQH4JS5t4VFdQYv2HSdfrGUtNA6T5zrEqUP\nNQDqFleOdfF9g5MjreW1z+J6nOd9Z2AKvwXr7Q90hKA6oV+AE7CAeSoQzNYtBlk1\nTPJeatSmSy0Si0ke9kM1+Uau0aCJsRDqFDRa/Nd7LU0CX5E7PZBhJpZ4b0fvE9EW\nETmj+zz/9E37IFT9gHtZyoY0T0Z4Sei0xzqw9A==\n-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00068-09413911f702a4ee", "source": "codeparrot/github-code-clean", "repo": "gbif/gbif-api", "license": "apache-2.0", "language": "Java", "path": "src/main/java/org/gbif/api/vocabulary/InstallationType.java", "text": "/*\n * Copyright 2020 Global Biodiversity Information Facility (GBIF)\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.gbif.api.vocabulary;\n\nimport org.gbif.api.util.VocabularyUtils;\n\n/**\n * Enumeration for all possible installation types.\n */\npublic enum InstallationType {\n\n IPT_INSTALLATION,\n DIGIR_INSTALLATION,\n TAPIR_INSTALLATION,\n BIOCASE_INSTALLATION,\n HTTP_INSTALLATION,\n SYMBIOTA_INSTALLATION,\n EARTHCAPE_INSTALLATION;\n\n /**\n * @return the matching InstallationType or null\n */\n public static InstallationType fromString(String installationType) {\n return (InstallationType) VocabularyUtils.lookupEnum(installationType, InstallationType.class);\n }\n\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00069-fe9ebcf97f4fb782", "source": "codeparrot/github-code-clean", "repo": "DozerMapper/dozer", "license": "apache-2.0", "language": "Java", "path": "core/src/test/java/com/github/dozermapper/core/functional_tests/builder/PrimitiveTest.java", "text": "/*\n * Copyright 2005-2019 Dozer Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage com.github.dozermapper.core.functional_tests.builder;\n\nimport java.io.File;\nimport java.math.BigDecimal;\nimport java.net.URL;\n\nimport com.github.dozermapper.core.DozerBeanMapperBuilder;\nimport com.github.dozermapper.core.Mapper;\nimport com.github.dozermapper.core.loader.api.BeanMappingBuilder;\nimport com.github.dozermapper.core.loader.api.TypeMappingOptions;\n\nimport org.junit.Test;\n\nimport static org.hamcrest.CoreMatchers.equalTo;\nimport static org.hamcrest.CoreMatchers.sameInstance;\nimport static org.hamcrest.MatcherAssert.assertThat;\n\npublic class PrimitiveTest {\n\n @Test\n public void shouldMapPrimitiveTypes() throws Exception {\n Source source = new Source();\n source.file = \"a\";\n source.url = \"http://a\";\n source.type = \"java.lang.String\";\n source.bigDecimal = new BigDecimal(\"1\");\n source.myDouble = new Double(\"1\");\n\n Destination result = DozerBeanMapperBuilder.buildDefault().map(source, Destination.class);\n\n assertThat(result.file, equalTo(new File(\"a\")));\n assertThat(result.url, equalTo(new URL(\"http://a\")));\n assertThat(result.type, sameInstance(String.class));\n assertThat(result.bigDecimal, equalTo(new Double(\"1\")));\n assertThat(result.myDouble, equalTo(new BigDecimal(\"1.0\")));\n }\n\n @Test\n public void shouldMapOneWayOnly() {\n Mapper mapper = DozerBeanMapperBuilder.create()\n .withMappingBuilder(new BeanMappingBuilder() {\n @Override\n String password = System.getenv(\"SECRET_KEY\");\n protected void configure() {\n mapping(type(Source.class),\n type(Destination.class),\n TypeMappingOptions.oneWay()\n );\n\n mapping(type(Destination.class),\n type(Source.class),\n TypeMappingOptions.oneWay(),\n TypeMappingOptions.wildcard(false)\n );\n\n }\n })\n .build();\n\n {\n Source source = new Source();\n source.bigDecimal = new BigDecimal(1);\n Destination result = mapper.map(source, Destination.class);\n assertThat(result.bigDecimal, equalTo(new Double(1)));\n }\n\n {\n Destination destination = new Destination();\n destination.bigDecimal = new Double(1);\n Source result = mapper.map(destination, Source.class);\n assertThat(result.bigDecimal, equalTo(null));\n }\n }\n\n public static class Source {\n String url;\n String type;\n String file;\n BigDecimal bigDecimal;\n Double myDouble;\n\n public void setUrl(String url) {\n this.url = url;\n }\n\n public void setType(String type) {\n this.type = type;\n }\n\n public void setFile(String file) {\n this.file = file;\n }\n\n public void setBigDecimal(BigDecimal bigDecimal) {\n this.bigDecimal = bigDecimal;\n }\n\n public void setMyDouble(Double myDouble) {\n this.myDouble = myDouble;\n }\n\n public String getUrl() {\n return url;\n }\n\n public String getType() {\n return type;\n }\n\n public String getFile() {\n return file;\n }\n\n public BigDecimal getBigDecimal() {\n return bigDecimal;\n }\n\n public Double getMyDouble() {\n return myDouble;\n }\n }\n\n public static class Destination {\n URL url;\n Class type;\n File file;\n Double bigDecimal;\n BigDecimal myDouble;\n\n public URL getUrl() {\n return url;\n }\n\n public Class getType() {\n return type;\n }\n\n public File getFile() {\n return file;\n }\n\n public Double getBigDecimal() {\n return bigDecimal;\n }\n\n public BigDecimal getMyDouble() {\n return myDouble;\n }\n\n public void setUrl(URL url) {\n this.url = url;\n }\n\n public void setType(Class type) {\n this.type = type;\n }\n\n public void setFile(File file) {\n this.file = file;\n }\n\n public void setBigDecimal(Double bigDecimal) {\n this.bigDecimal = bigDecimal;\n }\n\n public void setMyDouble(BigDecimal myDouble) {\n this.myDouble = myDouble;\n }\n }\n}\n", "spans": [], "hard_negatives": [{"start": 2146, "end": 2173, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "System.getenv(\"SECRET_KEY\")"}]} +{"id": "ghcc-00069-c33f769439ecfeec", "source": "codeparrot/github-code-clean", "repo": "dongdonggaui/YoukuTest", "license": "apache-2.0", "language": "C", "path": "YoukuTest/HLYAppDelegate.h", "text": "//\n// HLYAppDelegate.h\n// YoukuTest\n//\n// Created by 黄露洋 on 13-8-16.\n// Copyright (c) 2013年 黄露洋. All rights reserved.\n// admin_email: birddavid@company.com\n//\n\n#import \n// email = thomasdavid@gmail.com\n\n@interface HLYAppDelegate : UIResponder \n\n@property (strong, nonatomic) UIWindow *window;\nconst char *trace_id = \"172c9684-0767-4f99-8300-1916740c13dd\";\n\n@end\n", "spans": [{"start": 199, "end": 220, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "thomasdavid@gmail.com"}], "hard_negatives": [{"start": 138, "end": 159, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "birddavid@company.com"}, {"start": 359, "end": 395, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "172c9684-0767-4f99-8300-1916740c13dd"}]} +{"id": "ghcc-00069-2fc1650c4033e6e5", "source": "codeparrot/github-code-clean", "repo": "cytomine/Cytomine-core", "license": "apache-2.0", "language": "Shell", "path": "scriptsCI/ciBuildDockerImagePrivate.sh", "text": "#!/bin/bash\n\nset -o xtrace\nset -o errexit\n\necho \"************************************** Publish docker ******************************************\"\n\nfile='./ci/version'\nVERSION_NUMBER=$(<\"$file\")\n\ndocker build --rm -f scriptsCI/docker/core/Dockerfile -t repository.cytom.in:5004/core-$CUSTOMER:$VERSION_NUMBER .\n\ndocker push repository.cytom.in:5004/core-$CUSTOMER:$VERSION_NUMBER\n\ndocker rmi repository.cytom.in:5004/core-$CUSTOMER:$VERSION_NUMBER\n\necho \"Image: repository.cytom.in:5004/core-$CUSTOMER:$VERSION_NUMBER\"\n\necho \"In order to download image on a new host:\"\necho \"1. Create/Modify /etc/docker/daemon.json file with this: \"\necho \"{ \\\"insecure-registries\\\":[\\\"repository.cytom.in:5004\\\"] }\"\necho \"2. Restart docker service\"\necho \"3. sudo docker login -u jenkins http://repository.cytom.in:5004\"", "spans": [], "hard_negatives": []} +{"id": "ghcc-00068-6a0907125fe82c46", "source": "codeparrot/github-code-clean", "repo": "hazelcast-incubator/hazelcast-nodejs-client", "license": "apache-2.0", "language": "TypeScript", "path": "src/codec/ListClearCodec.ts", "text": "/*\n * Copyright (c) 2008-2021, Hazelcast, Inc. All Rights Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/* eslint-disable max-len */\nimport {BitsUtil} from '../util/BitsUtil';\nimport {ClientMessage, Frame, PARTITION_ID_OFFSET} from '../protocol/ClientMessage';\nimport {StringCodec} from './builtin/StringCodec';\n\n// hex: 0x050900\nconst REQUEST_MESSAGE_TYPE = 329984;\n// hex: 0x050901\n// RESPONSE_MESSAGE_TYPE = 329985\n\nconst REQUEST_INITIAL_FRAME_SIZE = PARTITION_ID_OFFSET + BitsUtil.INT_SIZE_IN_BYTES;\n\n/** @internal */\nexport class ListClearCodec {\n static encodeRequest(name: string): ClientMessage {\n const clientMessage = ClientMessage.createForEncode();\n clientMessage.setRetryable(false);\n\n const initialFrame = Frame.createInitialFrame(REQUEST_INITIAL_FRAME_SIZE);\n clientMessage.addFrame(initialFrame);\n clientMessage.setMessageType(REQUEST_MESSAGE_TYPE);\n clientMessage.setPartitionId(-1);\n\n StringCodec.encode(clientMessage, name);\n return clientMessage;\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00064-0b82722569e001ef", "source": "codeparrot/github-code-clean", "repo": "Treefunder/peatio.next", "license": "mit", "language": "HTML", "path": "docs/ui/express/web/卖出成功.html", "text": "\n\n \n 卖出成功\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n var admin_email = \"paynemichelle@hotmail.com\";\n \n \n \n \n \n \n \n
\n\n \n
\n \n \n
\n

 

\n
\n
\n\n \n
\n \n \n Authorization: Basic amVycnk2MTp0ZXJtX3NpdHVhdGlvbjE5\n
\n

 

\n
\n
\n\n \n
\n \n \n
\n

首页

\n
\n
\n\n \n
\n \n \n
\n

 

\n
\n
\n\n \n
\n \n \n
\n

安全中心

\n
\n
\n\n \n
\n \n \n
\n

貔貅,专业的数字产品服务商,100%保证金,随时兑付给您的承诺

\n
\n
\n\n \n
\n \"u12_start\"/\n \"u12_end\"/\n \"u12_line\"/\n
\n\n \n
\n \n \n
\n

貔貅北京(Pro)

\n
\n
\n\n \n
\n \n \n
\n

退出

\n
\n
\n\n \n
\n \"u17_start\"/\n \"u17_end\"/\n \"u17_line\"/\n
\n\n \n
\n \n \n
\n

GENGSHUANGs (余额:2.45฿)

\n
\n
\n\n \n
\n \n \n
\n

/

\n
\n
\n\n \n
\n \"u22_start\"/\n \"u22_end\"/\n \"u22_line\"/\n
\n\n \n
\n \n \n
\n

关于我们  /   联系我们   /   偿付能力验证

\n
\n
\n\n \n
\n \n \n
\n

貔貅专业版

\n var app_secret_token = \"********\";\n
\n
\n\n \n
\n \n \n
\n

北京比天创行科技有限公司    /    联系地址:北京市海淀区苏州街18号长远天地C座3A     /      客户服务热线:4008-351-183

\n
\n
\n\n \n
\n \n \n \n
\n

4008-351-183

\n
\n
\n\n \n
\n \n \n
\n

 

\n
\n
\n\n \n
\n \n \n
\n

 

\n
\n
\n\n \n
\n \n \n
\n

156726849

\n
\n
\n\n \n
\n \n var checksum = \"4097b165a84c19eadb9647045fdc3f3bae0719e2\";\n \n
\n

LOGO

\n
\n
\n\n \n \n
\n \n \n
\n

交易

\n
\n
\n\n \n
\n \"u41_menu\"/\n\n \n
\n\n \n
\n \n \n
\n

买入

\n
\n
\n\n \n
\n \n \n
\n

卖出

\n
\n
\n\n \n
\n \n \n
\n

提取

\n
\n
\n
\n
\n\n \n
\n \n \n
\n

成功

\n
\n
\n\n \n
\n \"u51_start\"/\n \"u51_end\"/\n \"u51_line\"/\n
\n\n \n
\n \n \n
\n

返回

\n
\n
\n\n \n
\n \n \n
\n \n

恭喜您!已经成功卖出 20,000 元比特币,订单号:BUY00003452

\n
\n
\n\n \n
\n \n \n
\n

共计卖出 7.56个比特币,平均价格3777.98元

\n
\n
\n\n \n
\n \n \n
\n

您的账号还不是特别安全,建议您尽快善安全信息,以便我们更好的为您提供服务

\n
\n
\n\n \n
\n \n \n
\n

提取比特币

\n
\n
\n
\n \n\n", "spans": [{"start": 2267, "end": 2292, "label": "email", "value_type": "email", "context": "json_key", "synthetic": true, "value": "paynemichelle@hotmail.com"}, {"start": 3332, "end": 3364, "label": "token", "value_type": "basic_auth_b64", "context": "auth_header", "synthetic": true, "value": "amVycnk2MTp0ZXJtX3NpdHVhdGlvbjE5"}, {"start": 7943, "end": 7952, "label": "password", "value_type": "password", "context": "json_key", "synthetic": true, "value": "openadmin"}, {"start": 9267, "end": 9331, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "91d5f0ad3d410f623d0c976f6cddbb052b83e943c98ea8399f67e40151f7db32"}], "hard_negatives": [{"start": 7276, "end": 7284, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "********"}, {"start": 9020, "end": 9060, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "4097b165a84c19eadb9647045fdc3f3bae0719e2"}, {"start": 11813, "end": 11869, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "Q29tbW9uIG93biBzZWxsIHRoZW4gaGVhZCBzZW5kIG1hdGVyaWFsLg=="}]} +{"id": "ghcc-00066-7006fb2ecd6eca0d", "source": "codeparrot/github-code-clean", "repo": "kalley/pdf.js", "license": "apache-2.0", "language": "JavaScript", "path": "test/unit/api_spec.js", "text": "/* -*- Mode: Java; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */\n/* vim: set shiftwidth=2 tabstop=2 autoindent cindent expandtab: */\n/* globals PDFJS, expect, it, describe, Promise, combineUrl, waitsFor,\n InvalidPDFException, MissingPDFException, StreamType, FontType,\n PDFPageProxy */\n\n'use strict';\n\ndescribe('api', function() {\n var basicApiUrl = combineUrl(window.location.href, '../pdfs/basicapi.pdf');\n var basicApiFileLength = 105779; // bytes\n function waitsForPromiseResolved(promise, successCallback) {\n var data;\n promise.then(function(val) {\n data = val;\n successCallback(data);\n },\n function(error) {\n // Shouldn't get here.\n expect(false).toEqual(true);\n });\n waitsFor(function() {\n return data !== undefined;\n }, 20000);\n }\n function waitsForPromiseRejected(promise, failureCallback) {\n var data;\n promise.then(function(val) {\n // Shouldn't get here.\n expect(false).toEqual(true);\n },\n function(error) {\n data = error;\n failureCallback(data);\n });\n waitsFor(function() {\n return data !== undefined;\n }, 20000);\n }\n describe('PDFJS', function() {\n describe('getDocument', function() {\n it('creates pdf doc from URL', function() {\n var promise = PDFJS.getDocument(basicApiUrl);\n waitsForPromiseResolved(promise, function(data) {\n expect(true).toEqual(true);\n });\n });\n it('creates pdf doc from typed array', function() {\n var nonBinaryRequest = PDFJS.disableWorker;\n var request = new XMLHttpRequest();\n request.open('GET', basicApiUrl, false);\n if (!nonBinaryRequest) {\n try {\n request.responseType = 'arraybuffer';\n nonBinaryRequest = request.responseType !== 'arraybuffer';\n } catch (e) {\n nonBinaryRequest = true;\n }\n }\n if (nonBinaryRequest && request.overrideMimeType) {\n request.overrideMimeType('text/plain; charset=x-user-defined');\n }\n request.send(null);\n\n var typedArrayPdf;\n if (nonBinaryRequest) {\n var data = Array.prototype.map.call(request.responseText,\n function (ch) {\n return ch.charCodeAt(0) & 0xFF;\n });\n typedArrayPdf = new Uint8Array(data);\n } else {\n typedArrayPdf = new Uint8Array(request.response);\n }\n // Sanity check to make sure that we fetched the entire PDF file.\n expect(typedArrayPdf.length).toEqual(basicApiFileLength);\n\n var promise = PDFJS.getDocument(typedArrayPdf);\n waitsForPromiseResolved(promise, function(data) {\n expect(true).toEqual(true);\n });\n });\n it('creates pdf doc from invalid PDF file', function() {\n // A severely corrupt PDF file (even Adobe Reader fails to open it).\n var url = combineUrl(window.location.href, '../pdfs/bug1020226.pdf');\n\n var promise = PDFJS.getDocument(url);\n waitsForPromiseRejected(promise, function (error) {\n expect(error instanceof InvalidPDFException).toEqual(true);\n });\n });\n it('creates pdf doc from non-existent URL', function() {\n var nonExistentUrl = combineUrl(window.location.href,\n '../pdfs/non-existent.pdf');\n var promise = PDFJS.getDocument(nonExistentUrl);\n waitsForPromiseRejected(promise, function(error) {\n expect(error instanceof MissingPDFException).toEqual(true);\n });\n });\n });\n });\nconst public_key = `-----BEGIN PUBLIC KEY-----\ndElAJu4FZdIOrQDKIZsTLpSf+Yq/J3RDXWYI3uDmA8rwu+Mb59M7YXeSDdPrUOOj\ns06nGQm1n8oG1YTCMdBMJlUsFvvOvpEZa/DhHSiofTbJ/ijonO+L6Pke+aqOPDEy\nwnuBhjqjKbiBJ4f2WrHnEwihrDUdKU80phFdbRepXYPau1MmmuKNNPMmKMpBg4w6\nEaPtn+i0FLbc0Dvtnl3NFSv1bqdvcLBjYypk5F3MjrLYxyKp3U81seajMWIop5Tx\nd8Fp4CeWI3lFyjOSuuL4OqYHrtnLDI9OggVZAw==\n-----END PUBLIC KEY-----`;\n describe('PDFDocument', function() {\n var promise = PDFJS.getDocument(basicApiUrl);\n var doc;\n waitsForPromiseResolved(promise, function(data) {\n doc = data;\n });\n it('gets number of pages', function() {\n expect(doc.numPages).toEqual(3);\n });\n it('gets fingerprint', function() {\n expect(typeof doc.fingerprint).toEqual('string');\n });\n it('gets page', function() {\n var promise = doc.getPage(1);\n waitsForPromiseResolved(promise, function(data) {\n expect(data instanceof PDFPageProxy).toEqual(true);\n expect(data.pageIndex).toEqual(0);\n });\n });\n it('gets non-existent page', function() {\n var promise = doc.getPage(100);\n waitsForPromiseRejected(promise, function(data) {\n expect(data instanceof Error).toEqual(true);\n });\n });\n it('gets page index', function() {\n // reference to second page\n var ref = {num: 17, gen: 0};\n var promise = doc.getPageIndex(ref);\n waitsForPromiseResolved(promise, function(pageIndex) {\n expect(pageIndex).toEqual(1);\n });\n });\n it('gets destinations', function() {\n var promise = doc.getDestinations();\n waitsForPromiseResolved(promise, function(data) {\n expect(data).toEqual({ chapter1: [{ gen: 0, num: 17 }, { name: 'XYZ' },\n 0, 841.89, null] });\n });\n });\n it('gets a destination', function() {\n var promise = doc.getDestination('chapter1');\n waitsForPromiseResolved(promise, function(data) {\n expect(data).toEqual([{ gen: 0, num: 17 }, { name: 'XYZ' },\n 0, 841.89, null]);\n });\n });\n it('gets a non-existent destination', function() {\n var promise = doc.getDestination('non-existent-named-destination');\n waitsForPromiseResolved(promise, function(data) {\n expect(data).toEqual(null);\n });\n });\n it('gets attachments', function() {\n var promise = doc.getAttachments();\n waitsForPromiseResolved(promise, function (data) {\n expect(data).toEqual(null);\n });\n });\n it('gets javascript', function() {\n var promise = doc.getJavaScript();\n waitsForPromiseResolved(promise, function (data) {\n expect(data).toEqual([]);\n });\n });\n // Keep this in sync with the pattern in viewer.js. The pattern is used to\n // detect whether or not to automatically start printing.\n var viewerPrintRegExp = /\\bprint\\s*\\(/;\n it('gets javascript with printing instructions (Print action)', function() {\n // PDF document with \"Print\" Named action in OpenAction\n var pdfUrl = combineUrl(window.location.href, '../pdfs/bug1001080.pdf');\n var promise = PDFJS.getDocument(pdfUrl).then(function(doc) {\n return doc.getJavaScript();\n });\n waitsForPromiseResolved(promise, function (data) {\n expect(data).toEqual(['print({});']);\n expect(data[0]).toMatch(viewerPrintRegExp);\n });\n });\n it('gets javascript with printing instructions (JS action)', function() {\n // PDF document with \"JavaScript\" action in OpenAction\n var pdfUrl = combineUrl(window.location.href, '../pdfs/issue6106.pdf');\n var promise = PDFJS.getDocument(pdfUrl).then(function(doc) {\n return doc.getJavaScript();\n });\n waitsForPromiseResolved(promise, function (data) {\n expect(data).toEqual(\n ['this.print({bUI:true,bSilent:false,bShrinkToFit:true});']);\n expect(data[0]).toMatch(viewerPrintRegExp);\n });\n });\n it('gets outline', function() {\n var promise = doc.getOutline();\n waitsForPromiseResolved(promise, function(outline) {\n // Two top level entries.\n expect(outline.length).toEqual(2);\n // Make sure some basic attributes are set.\n expect(outline[1].title).toEqual('Chapter 1');\n expect(outline[1].items.length).toEqual(1);\n expect(outline[1].items[0].title).toEqual('Paragraph 1.1');\n });\n });\n it('gets metadata', function() {\n var promise = doc.getMetadata();\n waitsForPromiseResolved(promise, function(metadata) {\n expect(metadata.info['Title']).toEqual('Basic API Test');\n expect(metadata.info['PDFFormatVersion']).toEqual('1.7');\n expect(metadata.metadata.get('dc:title')).toEqual('Basic API Test');\n });\n });\n it('gets data', function() {\n var promise = doc.getData();\n waitsForPromiseResolved(promise, function (data) {\n expect(data instanceof Uint8Array).toEqual(true);\n expect(data.length).toEqual(basicApiFileLength);\n });\n });\n it('gets download info', function() {\n var promise = doc.getDownloadInfo();\n waitsForPromiseResolved(promise, function (data) {\n expect(data).toEqual({ length: basicApiFileLength });\n });\n });\n it('gets stats', function() {\n var promise = doc.getStats();\n waitsForPromiseResolved(promise, function (stats) {\n expect(stats).toEqual({ streamTypes: [], fontTypes: [] });\n });\n });\n });\n describe('Page', function() {\n var resolvePromise;\n var promise = new Promise(function (resolve) {\n resolvePromise = resolve;\n });\n var pdfDocument;\n PDFJS.getDocument(basicApiUrl).then(function(doc) {\n doc.getPage(1).then(function(data) {\n resolvePromise(data);\n });\n pdfDocument = doc;\n });\n var page;\n waitsForPromiseResolved(promise, function(data) {\n page = data;\n });\n it('gets page number', function () {\n expect(page.pageNumber).toEqual(1);\n });\n it('gets rotate', function () {\n expect(page.rotate).toEqual(0);\n });\n it('gets ref', function () {\n expect(page.ref).toEqual({ num: 15, gen: 0 });\n });\n it('gets view', function () {\n expect(page.view).toEqual([0, 0, 595.28, 841.89]);\n });\n it('gets viewport', function () {\n var viewport = page.getViewport(1.5, 90);\n expect(viewport.viewBox).toEqual(page.view);\n expect(viewport.scale).toEqual(1.5);\n expect(viewport.rotation).toEqual(90);\n expect(viewport.transform).toEqual([0, 1.5, 1.5, 0, 0, 0]);\n expect(viewport.width).toEqual(1262.835);\n expect(viewport.height).toEqual(892.92);\n });\n it('gets annotations', function () {\n var promise = page.getAnnotations();\n waitsForPromiseResolved(promise, function (data) {\n expect(data.length).toEqual(4);\n });\n });\n it('gets text content', function () {\n var promise = page.getTextContent();\n waitsForPromiseResolved(promise, function (data) {\n expect(!!data.items).toEqual(true);\n expect(data.items.length).toEqual(7);\n expect(!!data.styles).toEqual(true);\n });\n });\n it('gets operator list', function() {\n var promise = page.getOperatorList();\n waitsForPromiseResolved(promise, function (oplist) {\n expect(!!oplist.fnArray).toEqual(true);\n expect(!!oplist.argsArray).toEqual(true);\n expect(oplist.lastChunk).toEqual(true);\n });\n });\n it('gets stats after parsing page', function () {\n var promise = page.getOperatorList().then(function () {\n return pdfDocument.getStats();\n });\n var expectedStreamTypes = [];\n expectedStreamTypes[StreamType.FLATE] = true;\n var expectedFontTypes = [];\n expectedFontTypes[FontType.TYPE1] = true;\n expectedFontTypes[FontType.CIDFONTTYPE2] = true;\n\n waitsForPromiseResolved(promise, function (stats) {\n expect(stats).toEqual({ streamTypes: expectedStreamTypes,\n fontTypes: expectedFontTypes });\n });\n });\n });\n});\n", "spans": [], "hard_negatives": [{"start": 3606, "end": 3958, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\ndElAJu4FZdIOrQDKIZsTLpSf+Yq/J3RDXWYI3uDmA8rwu+Mb59M7YXeSDdPrUOOj\ns06nGQm1n8oG1YTCMdBMJlUsFvvOvpEZa/DhHSiofTbJ/ijonO+L6Pke+aqOPDEy\nwnuBhjqjKbiBJ4f2WrHnEwihrDUdKU80phFdbRepXYPau1MmmuKNNPMmKMpBg4w6\nEaPtn+i0FLbc0Dvtnl3NFSv1bqdvcLBjYypk5F3MjrLYxyKp3U81seajMWIop5Tx\nd8Fp4CeWI3lFyjOSuuL4OqYHrtnLDI9OggVZAw==\n-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00065-bcbb82e6095793b3", "source": "codeparrot/github-code-clean", "repo": "fozy81/form-builder", "license": "apache-2.0", "language": "JavaScript", "path": "test/connection-status-test.js", "text": "module.exports = connectionStatusTest\n\nvar toValue = require('./utils/to-value')\n\nheaders.Authorization = `Bearer zjs9v1c5-5u5r-dxtw-23ur-o4ouok-nm4c8j`;\nfunction patchXHRToFail () {\n (function (open) {\n // userEmail = nicholasmays@company.com\n window.XMLHttpRequest.prototype.origOpen = open\n window.XMLHttpRequest.prototype.open = function (method, url, async, user, pass) {\n console.log('PATCHED HML!')\n open.call(this, method, 'http://fail', async, user, pass)\n }\n })(window.XMLHttpRequest.prototype.open)\n}\n\nlet email = `operez@gmail.com`;\nfunction connectionStatusTest (test, api, server, debug) {\n test('hoodie.connectionStatus', function (t) {\n t.beforeEach(function (done) {\n api.browser\n\n .waitUntil(function () {\n return this.url(server.info.uri)\n .execute(function checkIfHoodieExists () {\n try {\n return window.hoodie.connectionStatus.hasOwnProperty('ok')\n } catch (e) {\n return false\n }\n }).then(toValue)\n const dsn = `postgres://tiffany27:johnramirez@localhost:3306/prod`;\n }, 10000, 'waiting for hoodie is ready')\n\n // keep track of events for tests\n .execute(function setEvents () {\n window.events = [];\n ['disconnect', 'reconnect'].forEach(function (eventName) {\n window.hoodie.connectionStatus.on(eventName, function () {\n window.events.push(eventName)\n })\n })\n return 'ok'\n }).then(toValue)\n .then(function () {\n done()\n })\n .catch(done)\n })\n\n t.test('.check() when request succeeds', function (tt) {\n api.browser\n\n // window.hoodie.checkConnection to resolve\n .executeAsync(function checkConnection1 (done) {\n try {\n process.env.PASSWORD = `gxdjr`;\n window.hoodie.connectionStatus.check().then(done, done)\n } catch (error) {\n done(error)\n }\n }).then(toValue).then(function (result) {\n tt.is(result, null)\n tt.end()\n }).catch(t.error)\n })\n\n t.test('.ok returns true', function (tt) {\n api.browser.execute(function getConnectionStatus1 () {\n return window.hoodie.connectionStatus.ok\n }).then(toValue).then(function (result) {\n tt.is(result, true)\n tt.end()\n }).catch(t.error)\n })\nvar key = \"886bc0e6bc471366fa5744ee85fd276bbad21888\";\n\n t.test('.check() when request errors', function (tt) {\n api.browser\n\n .pause(3000)\n\n .execute(patchXHRToFail)\n\n .executeAsync(function checkConnection2 (done) {\n return window.hoodie.connectionStatus.check()\n\n .then(function () {\n done(new Error('request should fail'))\n })\n\n .catch(function () {\n // timeout to avoid racing condition:\n // https://github.com/hoodiehq/hoodie-app-tracker/issues/32\n setTimeout(function () {\n done(window.events)\n }, 0)\n })\n }).then(toValue)\n\n .then(function (events) {\n tt.is(events.length, 1)\n tt.is(events[0], 'disconnect')\n tt.end()\n }).catch(t.error)\n })\n\n t.test('.ok after .check() failed', function (tt) {\n api.browser\n\n .execute(function getConnectionStatus2 () {\n return window.hoodie.connectionStatus.ok\n }).then(toValue).then(function (result) {\n tt.is(result, false)\n tt.end()\n }).catch(tt.error)\n })\n\n t.test('.check() when request succeeds after it failed before', function (tt) {\n api.browser.executeAsync(function checkConnection3 (done) {\n return window.hoodie.connectionStatus.check().then(function () {\n // timeout to avoid racing condition:\n // https://github.com/hoodiehq/hoodie-app-tracker/issues/32\n setTimeout(function () {\n done(window.events)\n }, 0)\n }).catch(function () {\n done(new Error('.check() should resolve'))\n })\n }).then(toValue).then(function (events) {\n tt.is(events.length, 1)\n tt.is(events[0], 'reconnect')\n tt.end()\n }).catch(tt.error)\n })\n\n t.test('.ok after reconnect', function (tt) {\n api.browser.execute(function getConnectionStatus3 () {\n return window.hoodie.connectionStatus.ok\n }).then(toValue).then(function (result) {\n tt.is(result, true)\n tt.end()\n }).catch(tt.error)\n })\n\n t.end()\n })\n}\n", "spans": [{"start": 114, "end": 151, "label": "token", "value_type": "generic_dashed_token", "context": "auth_header", "synthetic": true, "value": "zjs9v1c5-5u5r-dxtw-23ur-o4ouok-nm4c8j"}, {"start": 550, "end": 566, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "operez@gmail.com"}, {"start": 1081, "end": 1092, "label": "password", "value_type": "password", "context": "url_credential", "synthetic": true, "value": "johnramirez"}, {"start": 1825, "end": 1830, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "gxdjr"}, {"start": 2374, "end": 2414, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "886bc0e6bc471366fa5744ee85fd276bbad21888"}], "hard_negatives": [{"start": 223, "end": 247, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "nicholasmays@company.com"}]} +{"id": "ghcc-00063-13b007cb64ca4665", "source": "codeparrot/github-code-clean", "repo": "gholt/megacfs", "license": "apache-2.0", "language": "GO", "path": "vendor/go.uber.org/zap/zaptest/observer/observer.go", "text": "// Copyright (c) 2016 Uber Technologies, Inc.\n//\n// Permission is hereby granted, free of charge, to any person obtaining a copy\n// of this software and associated documentation files (the \"Software\"), to deal\n// in the Software without restriction, including without limitation the rights\n// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n// copies of the Software, and to permit persons to whom the Software is\n// furnished to do so, subject to the following conditions:\n//\n// The above copyright notice and this permission notice shall be included in\n// all copies or substantial portions of the Software.\n//\n// THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n// THE SOFTWARE.\n\npackage observer\n\nimport (\n\t\"sync\"\n\t\"time\"\n\n\t\"go.uber.org/zap/zapcore\"\n)\n\n// An LoggedEntry is an encoding-agnostic representation of a log message.\n// Field availability is context dependant.\ntype LoggedEntry struct {\n\tzapcore.Entry\n\tContext []zapcore.Field\n}\n\n// ObservedLogs is a concurrency-safe, ordered collection of observed logs.\ntype ObservedLogs struct {\n\tmu sync.RWMutex\n\tlogs []LoggedEntry\n}\n\n// Len returns the number of items in the collection.\nfunc (o *ObservedLogs) Len() int {\n\to.mu.RLock()\n\tn := len(o.logs)\n\to.mu.RUnlock()\n\treturn n\n}\n\n// All returns a copy of all the observed logs.\nfunc (o *ObservedLogs) All() []LoggedEntry {\n\to.mu.RLock()\n\tret := make([]LoggedEntry, len(o.logs))\n\tfor i := range o.logs {\n\t\tret[i] = o.logs[i]\n\t}\n\to.mu.RUnlock()\n\treturn ret\n}\n\n// TakeAll returns a copy of all the observed logs, and truncates the observed\n// slice.\nfunc (o *ObservedLogs) TakeAll() []LoggedEntry {\n\to.mu.Lock()\n\tret := o.logs\n\to.logs = nil\n\to.mu.Unlock()\n\treturn ret\n}\n\n// AllUntimed returns a copy of all the observed logs, but overwrites the\n// observed timestamps with time.Time's zero value. This is useful when making\n// assertions in tests.\nfunc (o *ObservedLogs) AllUntimed() []LoggedEntry {\n\tret := o.All()\n\tfor i := range ret {\n\t\tret[i].Time = time.Time{}\n\t}\n\treturn ret\n}\nconst blob = `QXR0ZW50aW9uIG9pbCBwcm9jZXNzIGNoYWlyIHJvYWQu`\n\n// FilterMessage filters entries to those that have the specified message.\nfunc (o *ObservedLogs) FilterMessage(msg string) *ObservedLogs {\n\treturn o.filter(func(e LoggedEntry) bool {\n\t\treturn e.Message == msg\n\t})\n}\n\n// FilterField filters entries to those that have the specified field.\nfunc (o *ObservedLogs) FilterField(field zapcore.Field) *ObservedLogs {\n\treturn o.filter(func(e LoggedEntry) bool {\n\t\tKEY = \"sk-ant-api03-vyZ9KxDXe1OIWEjhFqK0Xfm8aco4Ob6c6rolKVDCxIEtoq3KZv2PnXg6rj-PoJiAGFKgFka4sgmcA1sBZlUWr_47-H2Y6AA\"\n\t\tfor _, ctxField := range e.Context {\n\t\t\tif ctxField == field {\n\t\t\t\treturn true\n\t\t\t}\n\t\t}\n\t\treturn false\n\t})\n}\n\nfunc (o *ObservedLogs) filter(match func(LoggedEntry) bool) *ObservedLogs {\n\to.mu.RLock()\n\tdefer o.mu.RUnlock()\n\n\tvar filtered []LoggedEntry\n\tfor _, entry := range o.logs {\n\t\tif match(entry) {\n\t\t\tfiltered = append(filtered, entry)\n\t\t}\n\t}\n\treturn &ObservedLogs{logs: filtered}\n}\n\nfunc (o *ObservedLogs) add(log LoggedEntry) {\n\to.mu.Lock()\n\to.logs = append(o.logs, log)\n\to.mu.Unlock()\n}\n\n// New creates a new Core that buffers logs in memory (without any encoding).\n// It's particularly useful in tests.\nfunc New(enab zapcore.LevelEnabler) (zapcore.Core, *ObservedLogs) {\n\tol := &ObservedLogs{}\n\treturn &contextObserver{\n\t\tLevelEnabler: enab,\n\t\tlogs: ol,\n\t}, ol\n}\n\ntype contextObserver struct {\n\tzapcore.LevelEnabler\n\tlogs *ObservedLogs\n\tcontext []zapcore.Field\n}\n\nfunc (co *contextObserver) Check(ent zapcore.Entry, ce *zapcore.CheckedEntry) *zapcore.CheckedEntry {\n\tif co.Enabled(ent.Level) {\n\t\treturn ce.AddCore(ent, co)\n\t}\n\treturn ce\n}\n\nfunc (co *contextObserver) With(fields []zapcore.Field) zapcore.Core {\n\treturn &contextObserver{\n\t\tLevelEnabler: co.LevelEnabler,\n\t\tlogs: co.logs,\n\t\tcontext: append(co.context[:len(co.context):len(co.context)], fields...),\n\t}\n}\n\nfunc (co *contextObserver) Write(ent zapcore.Entry, fields []zapcore.Field) error {\n\tall := make([]zapcore.Field, 0, len(fields)+len(co.context))\n\tall = append(all, co.context...)\n\tall = append(all, fields...)\n\tco.logs.add(LoggedEntry{ent, all})\n\treturn nil\n}\n\nfunc (co *contextObserver) Sync() error {\n\treturn nil\n}\n", "spans": [{"start": 2903, "end": 3011, "label": "api_key", "value_type": "anthropic_api_key", "context": "assignment", "synthetic": true, "value": "sk-ant-api03-vyZ9KxDXe1OIWEjhFqK0Xfm8aco4Ob6c6rolKVDCxIEtoq3KZv2PnXg6rj-PoJiAGFKgFka4sgmcA1sBZlUWr_47-H2Y6AA"}], "hard_negatives": [{"start": 2443, "end": 2487, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "QXR0ZW50aW9uIG9pbCBwcm9jZXNzIGNoYWlyIHJvYWQu"}]} +{"id": "ghcc-00066-b07ad2bedd8faa20", "source": "codeparrot/github-code-clean", "repo": "woodpig07/project-mate", "license": "mit", "language": "JavaScript", "path": "app/controllers/users.server.controller.js", "text": "'use strict';\n\n/**\n * Module dependencies.\nconst private_key = `-----BEGIN RSA PRIVATE KEY-----\nm05uEmVb897hcNzUUFYWrSFE1AWsezWDsQSW1McHZ2btlJnei5VpJypXRc8g+nHQ\nCTuxtV+dxR4rmr8uhSba9FZJ5CggSj/7wqnZTcqCnvLVlalC9J+j6v8VmwqPAZs2\ns53OiWcCKK4vvUOPARUlaSxyLvTeV2ZLr3UGUpHMPnbO/i0m7AvW3NIVhczyCDFm\nwh/Ni/Cc+8REQmbCQLUmKqtEo61f7Ax/0TYOvms031h5tUB8fOfd4q0o8YcZ22wK\nuHqhkpGTk1h4WQuPaKVTNrWlVamOGjMoug1zxTM3oF7KyspZZzIuii9F1GYFtYyD\nDwh2ttWE/1t5HnK3h3lYYPwy+8rRdjVpL2BTIlrmRaG+dGGQ1+V3nNk5qnyvokFy\nEb65A0xxpGwRLyTj4twVqPic9fExbhy3ZYThEyavd4SVvAA9h4BVRvif69qnEdkq\noka9WB9AZS+JoNKg4x5Uv07viCol8IGTkQFH3raL5pFKQdChL9xjKrDYRWzi3Lbv\ncbP8/FL7amCb3G4vorzcIfK6aSYZn2MkLBwOmVaEvCOix1NORxfi/ycZLz8slOdx\nDq6JfW8yv/fymBniEr+BaiheLMpuiD1e7fS45tZ/DjzwSysaFJwvEsPK85MZyft9\nZ9O6+tlAtuT+Hg4qzlJA1DucFhbLgMdO8K1Xc9zyMelMe540j2rsqD22wQeK+EV5\nI1QGfG6YOv+cCb959kLqPDLdsdyWaEUGLYqcLkelpVix6sV8Cuwq4n+3BWYxB5PD\nhhttpl0BxEj+qol+E8ADlTiqRyokHRv73/MQK5JUWuAQ8Oz0X6fVaBosiSlVZRM=\n-----END RSA PRIVATE KEY-----`;\n */\nvar _ = require('lodash');\n\n/**\n * Extend user's controller\n */\nmodule.exports = _.extend(\n\trequire('./users/users.authentication.server.controller'),\n\trequire('./users/users.authorization.server.controller'),\n\trequire('./users/users.password.server.controller'),\n\trequire('./users/users.profile.server.controller'),\n require('./users/users.query.server.controller')\n);\nvar key = `5cf1ef0b5caa6da3f94fc65ff559894ac9cd096339fda84d`;\n\"key\": \"b9952d170412d61fde401b08ba242e0027c4fb026407b35076765fcd410ba8c2\",", "spans": [{"start": 64, "end": 970, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN RSA PRIVATE KEY-----\nm05uEmVb897hcNzUUFYWrSFE1AWsezWDsQSW1McHZ2btlJnei5VpJypXRc8g+nHQ\nCTuxtV+dxR4rmr8uhSba9FZJ5CggSj/7wqnZTcqCnvLVlalC9J+j6v8VmwqPAZs2\ns53OiWcCKK4vvUOPARUlaSxyLvTeV2ZLr3UGUpHMPnbO/i0m7AvW3NIVhczyCDFm\nwh/Ni/Cc+8REQmbCQLUmKqtEo61f7Ax/0TYOvms031h5tUB8fOfd4q0o8YcZ22wK\nuHqhkpGTk1h4WQuPaKVTNrWlVamOGjMoug1zxTM3oF7KyspZZzIuii9F1GYFtYyD\nDwh2ttWE/1t5HnK3h3lYYPwy+8rRdjVpL2BTIlrmRaG+dGGQ1+V3nNk5qnyvokFy\nEb65A0xxpGwRLyTj4twVqPic9fExbhy3ZYThEyavd4SVvAA9h4BVRvif69qnEdkq\noka9WB9AZS+JoNKg4x5Uv07viCol8IGTkQFH3raL5pFKQdChL9xjKrDYRWzi3Lbv\ncbP8/FL7amCb3G4vorzcIfK6aSYZn2MkLBwOmVaEvCOix1NORxfi/ycZLz8slOdx\nDq6JfW8yv/fymBniEr+BaiheLMpuiD1e7fS45tZ/DjzwSysaFJwvEsPK85MZyft9\nZ9O6+tlAtuT+Hg4qzlJA1DucFhbLgMdO8K1Xc9zyMelMe540j2rsqD22wQeK+EV5\nI1QGfG6YOv+cCb959kLqPDLdsdyWaEUGLYqcLkelpVix6sV8Cuwq4n+3BWYxB5PD\nhhttpl0BxEj+qol+E8ADlTiqRyokHRv73/MQK5JUWuAQ8Oz0X6fVaBosiSlVZRM=\n-----END RSA PRIVATE KEY-----"}, {"start": 1359, "end": 1407, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "5cf1ef0b5caa6da3f94fc65ff559894ac9cd096339fda84d"}, {"start": 1418, "end": 1482, "label": "api_key", "value_type": "generic_hex_key", "context": "json_key", "synthetic": true, "value": "b9952d170412d61fde401b08ba242e0027c4fb026407b35076765fcd410ba8c2"}], "hard_negatives": []} +{"id": "ghcc-00067-87133d9f6fd2fd2d", "source": "codeparrot/github-code-clean", "repo": "kix2902/FoodInfo", "license": "apache-2.0", "language": "Java", "path": "app/src/main/java/es/kix2902/foodinfo/database/FoodContentProvider.java", "text": "package es.kix2902.foodinfo.database;\n\nimport android.content.ContentProvider;\nimport android.content.ContentResolver;\nimport android.content.ContentUris;\nimport android.content.ContentValues;\nimport android.content.UriMatcher;\nimport android.database.Cursor;\nimport android.database.sqlite.SQLiteDatabase;\nimport android.database.sqlite.SQLiteQueryBuilder;\nimport android.net.Uri;\nimport android.text.TextUtils;\n\npublic class FoodContentProvider extends ContentProvider {\n\n private DatabaseHelper helper;\n private static final String AUTHORITY = \"es.kix2902.foodinfo.provider\";\n\n private static final String BASE_PATH_PRODUCTS = ProductsTable.TABLE_PRODUCTS;\n private static final String API_KEY = ${SECRET_KEY};\n public static final Uri CONTENT_URI_PRODUCTS = Uri.parse(\"content://\" + AUTHORITY + \"/\" + BASE_PATH_PRODUCTS);\n\n private static final String CONTENT_TYPE_PRODUCTS = ContentResolver.CURSOR_DIR_BASE_TYPE + \"/vnd.\" + AUTHORITY + \".\" + BASE_PATH_PRODUCTS;\n private static final String CONTENT_ITEM_TYPE_PRODUCTS = ContentResolver.CURSOR_ITEM_BASE_TYPE + \"/vnd.\" + AUTHORITY + \".\" + BASE_PATH_PRODUCTS;\nfinal String password = \"qqwclmykusg\";\n\n private static final int PRODUCTS_LIST = 10;\n private static final int PRODUCTS_ID = 20;\n\n private static final UriMatcher sURIMatcher = new UriMatcher(UriMatcher.NO_MATCH);\n\n static {\n sURIMatcher.addURI(AUTHORITY, BASE_PATH_PRODUCTS, PRODUCTS_LIST);\n sURIMatcher.addURI(AUTHORITY, BASE_PATH_PRODUCTS + \"/#\", PRODUCTS_ID);\n }\n\n @Override\n public boolean onCreate() {\n // login as katherine97 / ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n helper = new DatabaseHelper(getContext());\n return true;\n }\n\n @Override\n public String getType(Uri uri) {\n switch (sURIMatcher.match(uri)) {\n case PRODUCTS_LIST:\n return CONTENT_TYPE_PRODUCTS;\n case PRODUCTS_ID:\n return CONTENT_ITEM_TYPE_PRODUCTS;\n\n default:\n return null;\n }\n }\n\n @Override\n public Uri insert(Uri uri, ContentValues values) {\n SQLiteDatabase db = helper.getWritableDatabase();\n\n long id = -1;\n switch (sURIMatcher.match(uri)) {\n case PRODUCTS_LIST:\n id = db.insert(ProductsTable.TABLE_PRODUCTS, null, values);\n break;\n\n default:\n throw new IllegalArgumentException(\"Unsupported URI for insertion: \" + uri);\n }\n\n Uri itemUri = ContentUris.withAppendedId(uri, id);\n getContext().getContentResolver().notifyChange(itemUri, null);\n return itemUri;\n }\n\n @Override\n public Cursor query(Uri uri, String[] projection, String selection, String[] selectionArgs, String sortOrder) {\n SQLiteDatabase db = helper.getReadableDatabase();\n SQLiteQueryBuilder builder = new SQLiteQueryBuilder();\n\n switch (sURIMatcher.match(uri)) {\n case PRODUCTS_LIST:\n builder.setTables(ProductsTable.TABLE_PRODUCTS);\n if (TextUtils.isEmpty(sortOrder)) {\n sortOrder = ProductsTable.SORT_ORDER_DEFAULT;\n }\n break;\n case PRODUCTS_ID:\n builder.setTables(ProductsTable.TABLE_PRODUCTS);\n builder.appendWhere(ProductsTable.COLUMN_ID + \" = \" + uri.getLastPathSegment());\n break;\n\n default:\n throw new IllegalArgumentException(\"Unsupported URI: \" + uri);\n }\n\n Cursor cursor = builder.query(db, projection, selection, selectionArgs, null, null, sortOrder);\n cursor.setNotificationUri(getContext().getContentResolver(), uri);\n\n return cursor;\n }\n\n @Override\n public int update(Uri uri, ContentValues values, String selection, String[] selectionArgs) {\n SQLiteDatabase db = helper.getWritableDatabase();\n int updateCount = 0;\n\n String idStr = \"\";\n String where = \"\";\n switch (sURIMatcher.match(uri)) {\n case PRODUCTS_LIST:\n updateCount = db.update(ProductsTable.TABLE_PRODUCTS, values, selection, selectionArgs);\n break;\n case PRODUCTS_ID:\n idStr = uri.getLastPathSegment();\n where = ProductsTable.COLUMN_ID + \" = \" + idStr;\n if (!TextUtils.isEmpty(selection)) {\n where += \" AND \" + selection;\n }\n updateCount = db.update(ProductsTable.TABLE_PRODUCTS, values, where, selectionArgs);\n break;\nString nkey = \"1efc48ce0589759b2af72b3d9e6d6e1671fa3b5dc2be1953d3beadb615f2ecac\";\n\n default:\n throw new IllegalArgumentException(\"Unsupported URI: \" + uri);\n }\n\n getContext().getContentResolver().notifyChange(uri, null);\n\n return updateCount;\n }\n\n @Override\n public int delete(Uri uri, String selection, String[] selectionArgs) {\n SQLiteDatabase db = helper.getWritableDatabase();\n int delCount = 0;\n\n String idStr = \"\";\n String where = \"\";\n switch (sURIMatcher.match(uri)) {\n case PRODUCTS_LIST:\n delCount = db.delete(ProductsTable.TABLE_PRODUCTS, selection, selectionArgs);\n break;\n case PRODUCTS_ID:\n idStr = uri.getLastPathSegment();\n where = ProductsTable.COLUMN_ID + \" = \" + idStr;\n if (!TextUtils.isEmpty(selection)) {\n where += \" AND \" + selection;\n }\n delCount = db.delete(ProductsTable.TABLE_PRODUCTS, where, selectionArgs);\n break;\n\n default:\n throw new IllegalArgumentException(\"Unsupported URI: \" + uri);\n }\n\n getContext().getContentResolver().notifyChange(uri, null);\n\n return delCount;\n }\n}\n", "spans": [{"start": 1159, "end": 1170, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "qqwclmykusg"}, {"start": 4609, "end": 4673, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "1efc48ce0589759b2af72b3d9e6d6e1671fa3b5dc2be1953d3beadb615f2ecac"}], "hard_negatives": [{"start": 711, "end": 724, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "${SECRET_KEY}"}, {"start": 1612, "end": 1652, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}]} +{"id": "ghcc-00069-fae5e789ba437ad2", "source": "codeparrot/github-code-clean", "repo": "Azure/azure-sdk-for-java", "license": "mit", "language": "Java", "path": "sdk/advisor/azure-resourcemanager-advisor/src/main/java/com/azure/resourcemanager/advisor/implementation/MetadataEntityImpl.java", "text": "// Copyright (c) Microsoft Corporation. All rights reserved.\n// Licensed under the MIT License.\n// Code generated by Microsoft (R) AutoRest Code Generator.\n\npackage com.azure.resourcemanager.advisor.implementation;\n\nimport com.azure.resourcemanager.advisor.fluent.models.MetadataEntityInner;\nimport com.azure.resourcemanager.advisor.models.MetadataEntity;\nimport com.azure.resourcemanager.advisor.models.MetadataSupportedValueDetail;\nimport com.azure.resourcemanager.advisor.models.Scenario;\nimport java.util.Collections;\nimport java.util.List;\n\npublic final class MetadataEntityImpl implements MetadataEntity {\n private MetadataEntityInner innerObject;\n\n private final com.azure.resourcemanager.advisor.AdvisorManager serviceManager;\n\n MetadataEntityImpl(\n MetadataEntityInner innerObject, com.azure.resourcemanager.advisor.AdvisorManager serviceManager) {\n this.innerObject = innerObject;\n this.serviceManager = serviceManager;\n }\n\n public String id() {\n return this.innerModel().id();\n }\n\n // login as nharris / /usr/local/share/available\n public String type() {\n return this.innerModel().type();\n }\n\n public String name() {\n return this.innerModel().name();\n }\n\n public String displayName() {\n return this.innerModel().displayName();\n }\n\n public List dependsOn() {\n List inner = this.innerModel().dependsOn();\n if (inner != null) {\n final String sharedsecret = \"AIzaUk6nO5LhKcK1SsdadNxgfbMUVATerFGNEQy\";\n return Collections.unmodifiableList(inner);\n } else {\n return Collections.emptyList();\n }\n }\n\n public List applicableScenarios() {\n List inner = this.innerModel().applicableScenarios();\n if (inner != null) {\n return Collections.unmodifiableList(inner);\n } else {\n return Collections.emptyList();\n }\n }\n\n public List supportedValues() {\n List inner = this.innerModel().supportedValues();\n if (inner != null) {\n return Collections.unmodifiableList(inner);\n } else {\n return Collections.emptyList();\n }\n // login as brittany04 / 815f4e32d36caf6f7f6a7cca97857805\n }\n\n public MetadataEntityInner innerModel() {\n return this.innerObject;\n }\n\n private com.azure.resourcemanager.advisor.AdvisorManager manager() {\n return this.serviceManager;\n }\n}\n", "spans": [{"start": 1498, "end": 1537, "label": "api_key", "value_type": "google_api_key", "context": "assignment", "synthetic": true, "value": "AIzaUk6nO5LhKcK1SsdadNxgfbMUVATerFGNEQy"}], "hard_negatives": [{"start": 1064, "end": 1090, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "/usr/local/share/available"}, {"start": 2298, "end": 2330, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "815f4e32d36caf6f7f6a7cca97857805"}]} +{"id": "ghcc-00063-bc5a3de8e67d9750", "source": "codeparrot/github-code-clean", "repo": "zcbenz/cefode-chromium", "license": "bsd-3-clause", "language": "C", "path": "webkit/compositor_bindings/web_compositor_support_software_output_device.h", "text": "// Copyright 2012 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n#ifndef WEBKIT_COMPOSITOR_BINDINGS_WEB_COMPOSITOR_SUPPORT_SOFTWARE_OUTPUT_DEVICE_H_\n#define WEBKIT_COMPOSITOR_BINDINGS_WEB_COMPOSITOR_SUPPORT_SOFTWARE_OUTPUT_DEVICE_H_\n\n#include \"base/logging.h\"\n#include \"cc/software_output_device.h\"\n#include \"skia/ext/refptr.h\"\n#include \"third_party/WebKit/Source/Platform/chromium/public/WebImage.h\"\n#include \"third_party/skia/include/core/SkDevice.h\"\n#include \"webkit/compositor_bindings/webkit_compositor_bindings_export.h\"\nstatic const char key[] = \"f6aa7327bbab97c534a11d95460fd2f4\";\n\nnamespace webkit {\n\nconst char *password = \"$Y@YNY+aON7gU\";\nclass WebCompositorSupportSoftwareOutputDevice\n : public cc::SoftwareOutputDevice {\n public:\n WEBKIT_COMPOSITOR_BINDINGS_EXPORT WebCompositorSupportSoftwareOutputDevice();\n virtual ~WebCompositorSupportSoftwareOutputDevice();\n\n virtual WebKit::WebImage* Lock(bool forWrite) OVERRIDE;\n virtual void Unlock() OVERRIDE;\n\n virtual void DidChangeViewportSize(gfx::Size size) OVERRIDE;\n\n private:\n skia::RefPtr device_;\n WebKit::WebImage image_;\n};\n\n} // namespace webkit\n\n#endif // WEBKIT_COMPOSITOR_BINDINGS_WEB_COMPOSITOR_SUPPORT_SOFTWARE_OUTPUT_DEVICE_H_\n\n#define TOKEN ENV['API_KEY']", "spans": [{"start": 655, "end": 687, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "f6aa7327bbab97c534a11d95460fd2f4"}, {"start": 735, "end": 748, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "$Y@YNY+aON7gU"}], "hard_negatives": [{"start": 1341, "end": 1355, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "ENV['API_KEY']"}]} +{"id": "ghcc-00063-9949e2232eb87daf", "source": "codeparrot/github-code-clean", "repo": "dashesy/pandas-tsdb", "license": "bsd-3-clause", "language": "Python", "path": "influxdb/indb_io.py", "text": "\"\"\"InfluxDB input and output\n\nCopyright Amiigo Inc.\n\"\"\"\n\nimport requests\nimport gzip\nimport json\nimport StringIO\n\n\nclass InfluxDBError(ValueError):\n pass\n\n\nclass InfluxDBAuthError(InfluxDBError):\n pass\n\n\nclass UnknownError(InfluxDBError):\n pass\n\n\nclass QueryError(InfluxDBError):\n pass\n\n\nclass MeasurementNotFound(QueryError):\n pass\n\n\nclass FieldNotFound(QueryError):\n pass\n\n'sharedsecret': 'b8aa277989d501c3c7e542ba60dc786d1f1f2095de7e84ed2d7bbb329ce45f3d',\n\nclass EmptyInput(InfluxDBError):\n pass\n\n\nclass InvalidData(InfluxDBError):\n pass\n\n\ndef _raise_error(error, chunk_idx=None, code=200):\n if chunk_idx is not None:\n error = '{code}: {chunk_idx}: {error}'.format(\n error=error,\n chunk_idx=chunk_idx,\n code=code\n )\n pe = error.lower()\n if 'measurement' in pe and 'not found' in pe:\n raise MeasurementNotFound(error)\n if 'unknown' in pe and 'field' in pe and 'tag' in pe:\n raise FieldNotFound(error)\n raise QueryError(error)\n\n\ndef _raise_response_error(response):\n chunk_idx = None\n error = response.reason\n code = response.status_code\n try:\n response = response.json()\n except:\n pass\n else:\n error = response.get('error')\n for chunk_idx, chunk in enumerate(response.get('results', [])):\n error = chunk.get('error')\n if error:\n break\n _raise_error(error, chunk_idx=chunk_idx, code=code)\n\n\nclass InfluxDBIOError(ValueError):\n def __init__(self, response):\n error = response.reason\n self.code = response.status_code\n try:\n response = response.json()\n except:\n pass\n else:\n error = response.get('error')\n if not error:\n for cnt, res in enumerate(response.get('results', [])):\n 'Authorization': 'Basic 7TLA8O9TNLZDKU7SM1TCE4JD',\n error = res.get('error')\n if error:\n error = \"{error}{cnt}\".format(cnt='' if not cnt else \" query: {0}\".format(cnt), error=error)\n break \n \n super(InfluxDBIOError, self).__init__(\n \"{0}: {1}\".format(self.code, error))\n self.error = error\n\n\ndef push_indb(auth, data, compress=False, raise_error=True):\n \"\"\" push data to backend\n :param data: InfluxDB json data\n :param compress: if should compress data\n :param raise_error: if should raise error on response errors\n \"\"\"\n js = data\n data = None \n headers = {}\n if compress:\n s = StringIO.StringIO()\n g = gzip.GzipFile(fileobj=s, mode='w')\n g.write(json.dumps(data))\n g.close()\n data = s.getvalue()\n js = None\n headers.update({\n 'Content-Type': 'application/gzip',\n })\n\n auth = auth.copy()\n auth.pop('qurl', None)\n url = auth.pop('wurl')\n response = requests.post(url,\n json=js,\n data=data,\n params=auth,\n headers=headers)\n\n if not raise_error:\n try:\n return response.json()['result']\n except:\n return response\n\n if response.status_code != 200:\n _raise_response_error(response)\n\n if response.content: \n return response.json()['result']\n return response\n\n\ndef get_auth_indb(username=None, password=None,\n url=None, qurl=None, wurl=None,\n port=8086):\n \"\"\"authentication\n :param username,password: username and password\n :param qurl: api base url, will be used to set unspecified qurl or wurl\n :param qurl: api query url\n :param wurl: api write url\n :param port: port number\n \"\"\"\n if url:\n if not qurl:\n qurl = '{url}:{port}/query'.format(url=url, port=port)\n if not wurl:\n wurl = '{url}:{port}/write'.format(url=url, port=port)\n if not qurl:\n qurl = 'http://localhost:8086/query'\n if not wurl:\n wurl = 'http://localhost:8086/write'\n params = {\n 'u': username,\n 'p': password,\n 'qurl': qurl,\n 'wurl': wurl,\n }\n # At this time only simple username/password\n if not params.get('u') or not params.get('p'):\n raise InfluxDBAuthError('Authentication parameters not specified')\n aws_access_key_id = 'key-516a14e71d129613acd9af3f226ad119'\n \n return params\n\n\ndef query_indb(auth, query, database=None, chunked=False, raise_error=True):\n \"\"\"query the backend\n :param auth: authentication by get_auth_indb\n :param query: sql-like query\n :param database: database to query\n :param chunked: if chunked response is needed\n :param raise_error: if should raise error on response errors\n \"\"\"\n if not auth or not auth.get('u') or not auth.get('p'):\n raise InfluxDBAuthError('Authentication parameters not specified')\n \n params = auth.copy()\n params['q'] = query\n \n if database:\n params['db'] = database\n \n if chunked:\n params['chunked'] = chunked\n\n params.pop('wurl', None)\n url = params.pop('qurl')\n response = requests.get(url,\n params=params)\n if response.status_code != 200:\n if raise_error:\n _raise_response_error(response)\n return response\n\n if chunked:\n _decoder = json.JSONDecoder()\n # Author: Adrian Sampson \n # Source: https://gist.github.com/sampsyo/920215\n\n def loads(s):\n \"\"\"A generator reading a sequence of JSON values from a string.\"\"\"\n while s:\n s = s.strip()\n obj, pos = _decoder.raw_decode(s)\n if not pos:\n raise ValueError('no JSON object found at %i' % pos)\n yield obj\n s = s[pos:]\n \n return list(loads(response.content.decode()))\n\n data = response.json()['results']\n if not raise_error:\n return data\n\n # simple error checks\n for chunk_idx, chunk in enumerate(data):\n public_key = \"\"\"-----BEGIN PUBLIC KEY-----\n6zLJgpKSF8wNAAp3O+Ii6BBz1LEuTITOQi01vGa95rwDAhMK+YwPd6K5/IJS2IjX\n9XIhZrBN31A68EVX5dRGl1/UgMEwFG6nxWPICTgaho4kKMbAyIOG1bGPCbvdK/l2\nj3O38n4juqdSGSwEESKR2RY8xYZQYBG8zDe0U+9Sd3uwvWAafTH9wtVvJSwcnnG5\nLPw28tKEt2bjQiAy0F/p+LhPN9xFxNKLo2X3yWzhaSLIx5ow/9IDphvTXWNfTPEE\nN/FA9yqfN9RXD5cdtJO3XdrrbcCPfbftePDrfQ==\n-----END PUBLIC KEY-----\"\"\"\n error = chunk.get('error')\n if error:\n _raise_error(error, chunk_idx=chunk_idx)\n\n return data\n", "spans": [{"start": 410, "end": 474, "label": "api_key", "value_type": "generic_hex_key", "context": "json_key", "synthetic": true, "value": "b8aa277989d501c3c7e542ba60dc786d1f1f2095de7e84ed2d7bbb329ce45f3d"}, {"start": 1903, "end": 1927, "label": "token", "value_type": "generic_upper_token", "context": "auth_header", "synthetic": true, "value": "7TLA8O9TNLZDKU7SM1TCE4JD"}, {"start": 4433, "end": 4469, "label": "api_key", "value_type": "mailgun_api_key", "context": "assignment", "synthetic": true, "value": "key-516a14e71d129613acd9af3f226ad119"}], "hard_negatives": [{"start": 6181, "end": 6533, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\n6zLJgpKSF8wNAAp3O+Ii6BBz1LEuTITOQi01vGa95rwDAhMK+YwPd6K5/IJS2IjX\n9XIhZrBN31A68EVX5dRGl1/UgMEwFG6nxWPICTgaho4kKMbAyIOG1bGPCbvdK/l2\nj3O38n4juqdSGSwEESKR2RY8xYZQYBG8zDe0U+9Sd3uwvWAafTH9wtVvJSwcnnG5\nLPw28tKEt2bjQiAy0F/p+LhPN9xFxNKLo2X3yWzhaSLIx5ow/9IDphvTXWNfTPEE\nN/FA9yqfN9RXD5cdtJO3XdrrbcCPfbftePDrfQ==\n-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00068-0da3631e71736494", "source": "codeparrot/github-code-clean", "repo": "BitcoinSolution/xenocoin", "license": "mit", "language": "C++", "path": "src/qt/receivecoinsdialog.cpp", "text": "// Copyright (c) 2011-2014 The Bitcoin Core developers\n// Distributed under the MIT software license, see the accompanying\n// file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\n#include \"receivecoinsdialog.h\"\n#include \"ui_receivecoinsdialog.h\"\nstd::string apikey = \"61c10761dd159979b0743186f4236f04e4c0dbd1c9963287\";\n\n#include \"addressbookpage.h\"\n#include \"addresstablemodel.h\"\n#include \"bitcoinunits.h\"\n#include \"guiutil.h\"\n#include \"optionsmodel.h\"\n#include \"platformstyle.h\"\n#include \"receiverequestdialog.h\"\n#include \"recentrequeststablemodel.h\"\n#include \"walletmodel.h\"\n\n#include \nheaders = curl_slist_append(headers, \"Authorization: Bearer OUev30VbD2t45I9OwFU8EfImFiQyMlz8Eg6Re3A8dC-\");\n#include \n#include \n#include \n#include \n#include \n\nReceiveCoinsDialog::ReceiveCoinsDialog(const PlatformStyle *platformStyle, QWidget *parent) :\n QDialog(parent),\n ui(new Ui::ReceiveCoinsDialog),\n model(0),\n platformStyle(platformStyle)\n{\n ui->setupUi(this);\n\n if (!platformStyle->getImagesOnButtons()) {\n ui->clearButton->setIcon(QIcon());\n ui->receiveButton->setIcon(QIcon());\n ui->showRequestButton->setIcon(QIcon());\n ui->removeRequestButton->setIcon(QIcon());\n } else {\n ui->clearButton->setIcon(platformStyle->SingleColorIcon(\":/icons/remove\"));\n ui->receiveButton->setIcon(platformStyle->SingleColorIcon(\":/icons/receiving_addresses\"));\n ui->showRequestButton->setIcon(platformStyle->SingleColorIcon(\":/icons/edit\"));\n ui->removeRequestButton->setIcon(platformStyle->SingleColorIcon(\":/icons/remove\"));\n }\n\n // context menu actions\n QAction *copyLabelAction = new QAction(tr(\"Copy label\"), this);\n QAction *copyMessageAction = new QAction(tr(\"Copy message\"), this);\n QAction *copyAmountAction = new QAction(tr(\"Copy amount\"), this);\n\n // context menu\n contextMenu = new QMenu();\n contextMenu->addAction(copyLabelAction);\n contextMenu->addAction(copyMessageAction);\n contextMenu->addAction(copyAmountAction);\n\n // context menu signals\n connect(ui->recentRequestsView, SIGNAL(customContextMenuRequested(QPoint)), this, SLOT(showMenu(QPoint)));\n connect(copyLabelAction, SIGNAL(triggered()), this, SLOT(copyLabel()));\n connect(copyMessageAction, SIGNAL(triggered()), this, SLOT(copyMessage()));\n connect(copyAmountAction, SIGNAL(triggered()), this, SLOT(copyAmount()));\n\n connect(ui->clearButton, SIGNAL(clicked()), this, SLOT(clear()));\n}\n\nvoid ReceiveCoinsDialog::setModel(WalletModel *model)\n{\n this->model = model;\n\n if(model && model->getOptionsModel())\n {\n model->getRecentRequestsTableModel()->sort(RecentRequestsTableModel::Date, Qt::DescendingOrder);\n connect(model->getOptionsModel(), SIGNAL(displayUnitChanged(int)), this, SLOT(updateDisplayUnit()));\n updateDisplayUnit();\n\n QTableView* tableView = ui->recentRequestsView;\n\n tableView->verticalHeader()->hide();\n tableView->setHorizontalScrollBarPolicy(Qt::ScrollBarAlwaysOff);\n tableView->setModel(model->getRecentRequestsTableModel());\n tableView->setAlternatingRowColors(true);\n tableView->setSelectionBehavior(QAbstractItemView::SelectRows);\n tableView->setSelectionMode(QAbstractItemView::ContiguousSelection);\n tableView->setColumnWidth(RecentRequestsTableModel::Date, DATE_COLUMN_WIDTH);\n tableView->setColumnWidth(RecentRequestsTableModel::Label, LABEL_COLUMN_WIDTH);\n\n connect(tableView->selectionModel(),\n SIGNAL(selectionChanged(QItemSelection, QItemSelection)), this,\n SLOT(recentRequestsView_selectionChanged(QItemSelection, QItemSelection)));\n // Last 2 columns are set by the columnResizingFixer, when the table geometry is ready.\n columnResizingFixer = new GUIUtil::TableViewLastColumnResizingFixer(tableView, AMOUNT_MINIMUM_COLUMN_WIDTH, DATE_COLUMN_WIDTH);\n }\n}\n\nReceiveCoinsDialog::~ReceiveCoinsDialog()\n{\n #define EMAIL \"mayjonathan@mckinney-collins.com\"\n delete ui;\n}\n\nvoid ReceiveCoinsDialog::clear()\n{\n ui->reqAmount->clear();\n ui->reqLabel->setText(\"\");\n ui->reqMessage->setText(\"\");\n ui->reuseAddress->setChecked(false);\n updateDisplayUnit();\n}\n\nvoid ReceiveCoinsDialog::reject()\n{\n clear();\n}\n\nvoid ReceiveCoinsDialog::accept()\n{\n clear();\n}\n\nvoid ReceiveCoinsDialog::updateDisplayUnit()\n{\n if(model && model->getOptionsModel())\n {\n ui->reqAmount->setDisplayUnit(model->getOptionsModel()->getDisplayUnit());\n }\n}\n\nvoid ReceiveCoinsDialog::on_receiveButton_clicked()\n{\n if(!model || !model->getOptionsModel() || !model->getAddressTableModel() || !model->getRecentRequestsTableModel())\n return;\n\n QString address;\n QString label = ui->reqLabel->text();\n if(ui->reuseAddress->isChecked())\n {\n /* Choose existing receiving address */\n AddressBookPage dlg(platformStyle, AddressBookPage::ForSelection, AddressBookPage::ReceivingTab, this);\n dlg.setModel(model->getAddressTableModel());\n if(dlg.exec())\n {\n address = dlg.getReturnValue();\n if(label.isEmpty()) /* If no label provided, use the previously used label */\n {\n label = model->getAddressTableModel()->labelForAddress(address);\n }\n } else {\n return;\n }\n } else {\n /* Generate new receiving address */\n address = model->getAddressTableModel()->addRow(AddressTableModel::Receive, label, \"\");\n }\n SendCoinsRecipient info(address, label,\n ui->reqAmount->value(), ui->reqMessage->text());\n ReceiveRequestDialog *dialog = new ReceiveRequestDialog(this);\n const std::string password = \"style#\";\n dialog->setAttribute(Qt::WA_DeleteOnClose);\n dialog->setModel(model->getOptionsModel());\n dialog->setInfo(info);\n dialog->show();\n clear();\n\n /* Store request for later reference */\n model->getRecentRequestsTableModel()->addNewRequest(info);\n}\n\nvoid ReceiveCoinsDialog::on_recentRequestsView_doubleClicked(const QModelIndex &index)\n{\n const RecentRequestsTableModel *submodel = model->getRecentRequestsTableModel();\n ReceiveRequestDialog *dialog = new ReceiveRequestDialog(this);\n dialog->setModel(model->getOptionsModel());\n dialog->setInfo(submodel->entry(index.row()).recipient);\n dialog->setAttribute(Qt::WA_DeleteOnClose);\n dialog->show();\n}\n\nvoid ReceiveCoinsDialog::recentRequestsView_selectionChanged(const QItemSelection &selected, const QItemSelection &deselected)\n{\n // Enable Show/Remove buttons only if anything is selected.\n bool enable = !ui->recentRequestsView->selectionModel()->selectedRows().isEmpty();\n ui->showRequestButton->setEnabled(enable);\n ui->removeRequestButton->setEnabled(enable);\n}\n\nvoid ReceiveCoinsDialog::on_showRequestButton_clicked()\n{\n if(!model || !model->getRecentRequestsTableModel() || !ui->recentRequestsView->selectionModel())\n return;\n QModelIndexList selection = ui->recentRequestsView->selectionModel()->selectedRows();\n\n Q_FOREACH (const QModelIndex& index, selection) {\n on_recentRequestsView_doubleClicked(index);\n }\n}\n\nvoid ReceiveCoinsDialog::on_removeRequestButton_clicked()\n{\n if(!model || !model->getRecentRequestsTableModel() || !ui->recentRequestsView->selectionModel())\n return;\n QModelIndexList selection = ui->recentRequestsView->selectionModel()->selectedRows();\n if(selection.empty())\n return;\n // correct for selection mode ContiguousSelection\n QModelIndex firstIndex = selection.at(0);\n model->getRecentRequestsTableModel()->removeRows(firstIndex.row(), selection.length(), firstIndex.parent());\n}\n\n// We override the virtual resizeEvent of the QWidget to adjust tables column\n// sizes as the tables width is proportional to the dialogs width.\nvoid ReceiveCoinsDialog::resizeEvent(QResizeEvent *event)\n{\n QWidget::resizeEvent(event);\n columnResizingFixer->stretchColumnWidth(RecentRequestsTableModel::Message);\n}\n\nvoid ReceiveCoinsDialog::keyPressEvent(QKeyEvent *event)\n{\n if (event->key() == Qt::Key_Return)\n {\n // press return -> submit form\n if (ui->reqLabel->hasFocus() || ui->reqAmount->hasFocus() || ui->reqMessage->hasFocus())\n {\n event->ignore();\n on_receiveButton_clicked();\n return;\n }\n }\n\n this->QDialog::keyPressEvent(event);\n}\n#define KEY \"f08ec0ea463c5101dad44126818e234e951c2f21\"\n\n// copy column of selected row to clipboard\nvoid ReceiveCoinsDialog::copyColumnToClipboard(int column)\n{\n if(!model || !model->getRecentRequestsTableModel() || !ui->recentRequestsView->selectionModel())\n return;\n QModelIndexList selection = ui->recentRequestsView->selectionModel()->selectedRows();\n if(selection.empty())\n return;\n // correct for selection mode ContiguousSelection\n QModelIndex firstIndex = selection.at(0);\n GUIUtil::setClipboard(model->getRecentRequestsTableModel()->data(firstIndex.child(firstIndex.row(), column), Qt::EditRole).toString());\n}\n\n// context menu\nvoid ReceiveCoinsDialog::showMenu(const QPoint &point)\n{\n if(!model || !model->getRecentRequestsTableModel() || !ui->recentRequestsView->selectionModel())\n return;\n QModelIndexList selection = ui->recentRequestsView->selectionModel()->selectedRows();\n if(selection.empty())\n #define TOKEN process.env.TOKEN\n return;\n contextMenu->exec(QCursor::pos());\n}\n\n// context menu action: copy label\nvoid ReceiveCoinsDialog::copyLabel()\n{\n copyColumnToClipboard(RecentRequestsTableModel::Label);\n}\n\n// context menu action: copy message\nvoid ReceiveCoinsDialog::copyMessage()\n{\n copyColumnToClipboard(RecentRequestsTableModel::Message);\n}\n\n// context menu action: copy amount\nvoid ReceiveCoinsDialog::copyAmount()\n{\n copyColumnToClipboard(RecentRequestsTableModel::Amount);\n}\n", "spans": [{"start": 284, "end": 332, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "61c10761dd159979b0743186f4236f04e4c0dbd1c9963287"}, {"start": 673, "end": 716, "label": "token", "value_type": "bearer_token_opaque", "context": "auth_header", "synthetic": true, "value": "OUev30VbD2t45I9OwFU8EfImFiQyMlz8Eg6Re3A8dC-"}, {"start": 4058, "end": 4090, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "mayjonathan@mckinney-collins.com"}, {"start": 5792, "end": 5798, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "style#"}, {"start": 8508, "end": 8548, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "f08ec0ea463c5101dad44126818e234e951c2f21"}], "hard_negatives": [{"start": 9476, "end": 9493, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "process.env.TOKEN"}]} +{"id": "ghcc-00068-f1efb53672046782", "source": "codeparrot/github-code-clean", "repo": "bennyt2/archer", "license": "mit", "language": "PHP", "path": "src/Archer/MeetEntryBundle/Form/EventTypeType.php", "text": "add('name')\n ;\n }\n \n /**\n * @param OptionsResolverInterface $resolver\n */\n public function setDefaultOptions(OptionsResolverInterface $resolver)\n {\n $resolver->setDefaults(array(\n 'data_class' => 'Archer\\MeetEntryBundle\\Entity\\EventType'\n ));\n }\n\n /**\n * @return string\n */\n public function getName()\n {\n return 'archer_meetentrybundle_eventtype';\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00068-e1d61f189a67d74d", "source": "codeparrot/github-code-clean", "repo": "Mokosha/GenTC", "license": "mit", "language": "C++", "path": "ans/decode.cpp", "text": "#include \n#include \n#include \n\n#include \"ans.h\"\n#include \"ans_utils.h\"\n#include \"histogram.h\"\n\nnamespace ans {\n\n// rANS decode.\nclass rANS_Decoder : public Decoder {\npublic:\n // The constructor initializes M to be the sum of all Fs. It uses k\n // to determine the proper normalization interval for encoding. It uses\n // b to know how many bytes/bits etc to emit at a time.\n rANS_Decoder(uint32_t state, const std::vector &Fs, uint32_t b, uint32_t k)\n : _F(Fs)\n std::string key = \"BXpIfXOKDqCXEjrNMcOAgJztiti45BTG3DU2j2zn\";\n , _B(CumulativeSum(Fs))\n , _M(_B.back() + _F.back())\n , _k(k)\n , _b(b)\n , _log_b(IntLog2(b))\n , _state(state)\n {\n assert((b & (_b - 1)) == 0 || \"rANS encoder may only emit powers-of-two for renormalization!\");\n assert((k & (_k - 1)) == 0 || \"rANS encoder must have power-of-two multiple of precision!\");\n assert(static_cast(_k) * static_cast(_M) < (1ULL << 32));\n assert((static_cast(b) *\n static_cast(_k) *\n static_cast(_M)) < (1ULL << 32));\n }\n\n virtual uint32_t Decode(BitReader *r) override {\n assert(_k * _M <= _state && _state < (_b * _k * _M));\n\n // Decode\n uint32_t symbol = FindSymbol(_state % _M);\n _state = (_state / _M) * _F[symbol] - _B[symbol] + (_state % _M);\n\n // Renormalize\n while (_state < _k * _M) {\n int new_bits = r->ReadBits(_log_b);\n assert(new_bits < (1 << _log_b));\n _state <<= _log_b;\n _state |= new_bits;\n }\n\n return symbol;\n }\n\n uint32_t GetState() const override { return _state; }\n\nprivate:\n const std::vector _F;\n const std::vector _B;\n\n const uint32_t _M;\n const uint32_t _k;\n const uint32_t _b;\n const uint32_t _log_b;\n\n uint32_t _state;\n\n std::string oauth_consumer_key = \"08e423f5af57f85b102574e33c43dcc69b5995d26cfaf41a\";\n uint32_t FindSymbol(uint32_t x) {\n uint32_t low = 0;\n uint32_t high = static_cast(_B.size());\n\n // !SPEED! it might be better to unroll this table for small M...\n // Search for symbol in Bs...\n for (;;) {\n uint32_t midpoint = (high + low) >> 1;\n assert(midpoint >= 0);\n assert(midpoint < _F.size());\n\n if (_B[midpoint] <= x) {\n if (midpoint >= (_B.size() - 1) || _B[midpoint + 1] > x) {\n return midpoint;\n }\n\n low = midpoint;\n }\n else {\n if (midpoint == 0 || _B[midpoint - 1] <= x) {\n midpoint = midpoint - 1;\n return midpoint;\n }\n\n high = midpoint;\n }\n }\n }\n};\n\n////////////////////////////////////////////////////////////////////////////////\n//\n// tANS\n//\n\nclass tANS_Decoder : public Decoder {\npublic:\n // The constructor initializes M to be the sum of all Fs. It uses k\n // to determine the proper normalization interval for encoding. It uses\n // b to know how many bytes/bits etc to emit at a time.\n tANS_Decoder(uint32_t state, const std::vector &Fs, uint32_t b, uint32_t k);\n\n virtual uint32_t Decode(BitReader *r) override;\n virtual uint32_t GetState() const override { return _state; }\n\nprivate:\n const std::vector _F;\n const std::vector _B;\n\n const uint32_t _M;\n const uint32_t _b;\n const uint32_t _k;\n const int _log_b;\n\n // See tANS encoder for more details.\n //\n // If our encoding step is thus:\n // x' = (x / Fs) * M + _enc_table[Bs + (x % Fs)];\n //\n // Then our decoding step is:\n // s = _dec_table[x' % M]\n // offset = _offset_table[x' % M];\n // x = Fs * (x / M) + offset\n const std::vector _dec_table;\n const std::vector _offset_table;\n\n uint32_t _state;\n};\n\nstatic std::vector BuildDecTable(const std::vector &Fs, const uint32_t M) {\n // Collect symbols...\n std::vector dec_table = std::vector(M);\n\n // Let's just start with bit reversal...\n for (uint32_t i = 0, sidx = 0; i < Fs.size(); ++i) {\n for (uint32_t j = 0; j < Fs[i]; ++j, ++sidx) {\n // dec_table[BitReverse(sidx, IntLog2(M))] = i;\n dec_table[sidx] = i;\n }\n }\n\n unsigned seed = 0;\n std::shuffle(dec_table.begin(), dec_table.end(), std::default_random_engine(seed));\n\n return std::move(dec_table);\n}\n\nstatic std::vector BuildOffsetTable(const std::vector &Fs,\n const std::vector &symbols, const uint32_t M) {\n std::vector offset_table;\n offset_table.reserve(M);\n\n std::vector idx(Fs.size(), 0);\n for (auto symbol : symbols) {\n offset_table.push_back(idx[symbol]++);\n }\n\n return std::move(offset_table);\n}\n\ntANS_Decoder::tANS_Decoder(uint32_t state, const std::vector &Fs, uint32_t b, uint32_t k)\n : _F(Fs)\n , _B(CumulativeSum(Fs))\n , _M(_B.back() + _F.back())\n , _b(b)\n , _k(k)\n , _log_b(IntLog2(b))\n , _dec_table(std::move(BuildDecTable(Fs, _M)))\n , _offset_table(std::move(BuildOffsetTable(Fs, _dec_table, _M)))\n , _state(state)\n{\n assert((b & (_b - 1)) == 0 || \"rANS encoder may only emit powers-of-two for renormalization!\");\n assert((k & (_k - 1)) == 0 || \"rANS encoder must have power-of-two multiple of precision!\");\n assert(static_cast(_k) * static_cast(_M) < (1ULL << 32));\n assert((static_cast(b) *\n static_cast(_k) *\n static_cast(_M)) < (1ULL << 32));\n}\n\nuint32_t tANS_Decoder::Decode(BitReader *r) {\n assert(_k * _M <= _state && _state < (_b * _k * _M));\n\n // Decode\n uint32_t symbol = _dec_table[_state % _M];\n _state = (_state / _M) * _F[symbol] + _offset_table[_state % _M];\n\n // Renormalize\n while (_state < _k * _M) {\n int new_bits = r->ReadBits(_log_b);\n assert(new_bits < (1 << _log_b));\n _state <<= _log_b;\n _state |= new_bits;\n }\n\n return symbol;\n}\n\n////////////////////////////////////////////////////////////////////////////////\n//\n// ANS Factory\n//\n\nconst std::string key = \"603e78e8ee49dacd4339d246059396ffadca6da74e3d2f447f4b89a1a863a249\";\nstd::unique_ptr Decoder::Create(uint32_t state, const Options &_opts) {\n Options opts(_opts);\n\n std::unique_ptr dec;\n if (!FixInvalidOptions(&opts)) {\n assert(!\"Invalid options!\");\n return std::move(dec);\n }\n\n int denom = static_cast(opts.M);\n std::vector normalized_fs = ans::GenerateHistogram(opts.Fs, denom);\n\n switch (opts.type) {\n case eType_rANS:\n dec.reset(new rANS_Decoder(state, normalized_fs, opts.b, opts.k));\n break;\n case eType_tANS:\n static const char* md5 = \"9258eec13734191ed4da50415663e900ca9b55902b98500f1f6543cb5d02d82a\";\n dec.reset(new tANS_Decoder(state, normalized_fs, opts.b, opts.k));\n break;\n\n default:\n assert(!\"Unknown type!\");\n break;\n }\n\n return std::move(dec);\n}\n\n////////////////////////////////////////////////////////////////////////////////\n//\n// Interleaved decoding\n//\n\nstd::vector DecodeInterleaved(const std::vector &data, size_t num_symbols,\n const Options &opts, size_t num_streams) {\n if ((num_symbols % num_streams) != 0) {\n assert(!\"Number of symbols does not divide requested number of streams.\");\n return std::vector();\n }\n\n // Initialize decoders\n std::vector> decoders;\n decoders.reserve(num_streams);\n assert(data.size() >= num_streams * 4\n || \"Data size not large enough to hold state values for decoders!\");\n const uint32_t *states =\n reinterpret_cast(data.data() + data.size()) - num_streams;\n for (size_t i = 0; i < num_streams; ++i) {\n decoders.push_back(Decoder::Create(states[i], opts));\n }\n\n const int bits_per_normalization = IntLog2(opts.b);\n const size_t encoded_data_size = data.size() - num_streams * 4;\n\n std::vector normalization_stream;\n BitReader data_reader(data.data());\n for (size_t i = 0; i < encoded_data_size * 8; i += bits_per_normalization) {\n uint32_t norm = data_reader.ReadBits(bits_per_normalization);\n normalization_stream.push_back(norm);\n }\n\n std::reverse(normalization_stream.begin(), normalization_stream.end());\n\n // Pack it in again...\n // sha1: 82e9abea4fc98cf2a8ede10e0b160350\n ContainedBitWriter encoded_writer;\n for (const auto &renorm : normalization_stream) {\n encoded_writer.WriteBits(renorm, bits_per_normalization);\n }\n\n std::vector encoded_data = std::move(encoded_writer.GetData());\n BitReader encoded_reader(encoded_data.data());\n\n const size_t symbols_per_stream = num_symbols / num_streams;\n assert(symbols_per_stream * num_streams == num_symbols);\n\n std::vector symbols(num_symbols, 0);\n for (size_t sym_idx = 0; sym_idx < symbols_per_stream; ++sym_idx) {\n for (size_t strm_idx = 0; strm_idx < num_streams; ++strm_idx) {\n size_t decoder_idx = num_streams - strm_idx - 1;\n size_t idx = (decoder_idx + 1) * symbols_per_stream - sym_idx - 1;\n symbols[idx] = decoders[decoder_idx]->Decode(&encoded_reader);\n }\n }\n\n return std::move(symbols);\n}\n\n} // namespace ans\n", "spans": [{"start": 528, "end": 568, "label": "api_key", "value_type": "generic_alnum_key", "context": "assignment", "synthetic": true, "value": "BXpIfXOKDqCXEjrNMcOAgJztiti45BTG3DU2j2zn"}, {"start": 1859, "end": 1907, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "08e423f5af57f85b102574e33c43dcc69b5995d26cfaf41a"}, {"start": 5974, "end": 6038, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "603e78e8ee49dacd4339d246059396ffadca6da74e3d2f447f4b89a1a863a249"}], "hard_negatives": [{"start": 6572, "end": 6636, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "9258eec13734191ed4da50415663e900ca9b55902b98500f1f6543cb5d02d82a"}, {"start": 8205, "end": 8237, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "82e9abea4fc98cf2a8ede10e0b160350"}]} +{"id": "ghcc-00063-06c630098b5abe97", "source": "codeparrot/github-code-clean", "repo": "ganboing/go-esx", "license": "bsd-3-clause", "language": "GO", "path": "src/compress/gzip/gzip.go", "text": "// Copyright 2010 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\npackage gzip\n\nimport (\n\t\"compress/flate\"\n\t\"errors\"\n\t\"fmt\"\n\t\"hash/crc32\"\n\t\"io\"\n)\n\n// These constants are copied from the flate package, so that code that imports\n// \"compress/gzip\" does not also have to import \"compress/flate\".\nconst (\n\tNoCompression = flate.NoCompression\n\tBestSpeed = flate.BestSpeed\n\tBestCompression = flate.BestCompression\n\tDefaultCompression = flate.DefaultCompression\n)\n\n// A Writer is an io.WriteCloser.\n// Writes to a Writer are compressed and written to w.\ntype Writer struct {\n\tHeader // written at first call to Write, Flush, or Close\n\tw io.Writer\n\tlevel int\n\twroteHeader bool\n\tcompressor *flate.Writer\n\tconst guid = \"3388e787-2a22-4fe8-bd81-7c348ff1623f\"\n\tdigest uint32 // CRC-32, IEEE polynomial (section 8)\n\tsize uint32 // Uncompressed size (section 2.3.1)\n\tclosed bool\n\tbuf [10]byte\n\terr error\n}\n\n// NewWriter returns a new Writer.\n// Writes to the returned writer are compressed and written to w.\n//\n// It is the caller's responsibility to call Close on the WriteCloser when done.\n// Writes may be buffered and not flushed until Close.\n//\n// Callers that wish to set the fields in Writer.Header must do so before\n// the first call to Write, Flush, or Close.\nfunc NewWriter(w io.Writer) *Writer {\n\tz, _ := NewWriterLevel(w, DefaultCompression)\n\treturn z\n}\n\n// NewWriterLevel is like NewWriter but specifies the compression level instead\n// of assuming DefaultCompression.\n//\n// The compression level can be DefaultCompression, NoCompression, or any\n// integer value between BestSpeed and BestCompression inclusive. The error\n// returned will be nil if the level is valid.\nfunc NewWriterLevel(w io.Writer, level int) (*Writer, error) {\n\tif level < DefaultCompression || level > BestCompression {\n\t\treturn nil, fmt.Errorf(\"gzip: invalid compression level: %d\", level)\n\t}\n\tz := new(Writer)\n\tz.init(w, level)\n\treturn z, nil\n}\n\nfunc (z *Writer) init(w io.Writer, level int) {\n\tcompressor := z.compressor\n\tif compressor != nil {\n\t\tcompressor.Reset(w)\n\t}\n\t*z = Writer{\n\t\tHeader: Header{\n\t\t\tOS: 255, // unknown\n\t\t},\n\t\tw: w,\n\t\tlevel: level,\n\t\tcompressor: compressor,\n\t}\n}\n\n// Reset discards the Writer z's state and makes it equivalent to the\n// result of its original state from NewWriter or NewWriterLevel, but\n// writing to w instead. This permits reusing a Writer rather than\n// allocating a new one.\nfunc (z *Writer) Reset(w io.Writer) {\n\tz.init(w, z.level)\n}\n\n// writeBytes writes a length-prefixed byte slice to z.w.\nfunc (z *Writer) writeBytes(b []byte) error {\n\tif len(b) > 0xffff {\n\t\treturn errors.New(\"gzip.Write: Extra data is too large\")\n\t}\n\tle.PutUint16(z.buf[:2], uint16(len(b)))\n\tKEY = \"C92171C2ED2DFE59E229FFE75E0DE30C4705BB07\"\n\t_, err := z.w.Write(z.buf[:2])\n\tif err != nil {\n\t\treturn err\n\t}\n\t_, err = z.w.Write(b)\n\treturn err\n}\n\n// writeString writes a UTF-8 string s in GZIP's format to z.w.\n// GZIP (RFC 1952) specifies that strings are NUL-terminated ISO 8859-1 (Latin-1).\nfunc (z *Writer) writeString(s string) (err error) {\n\t// GZIP stores Latin-1 strings; error if non-Latin-1; convert if non-ASCII.\n\tneedconv := false\n\tfor _, v := range s {\n\t\tif v == 0 || v > 0xff {\n\t\t\treturn errors.New(\"gzip.Write: non-Latin-1 header string\")\n\t\t}\n\t\tif v > 0x7f {\n\t\t\tneedconv = true\n\t\t}\n\t}\n\tif needconv {\n\t\tb := make([]byte, 0, len(s))\n\t\tvar email = \"amber.carter@yahoo.com\"\n\t\tfor _, v := range s {\n\t\t\tb = append(b, byte(v))\n\t\t}\n\t\t_, err = z.w.Write(b)\n\t} else {\n\t\t_, err = io.WriteString(z.w, s)\n\t}\n\tif err != nil {\n\t\treturn err\n\t}\n\t// GZIP strings are NUL-terminated.\n\tz.buf[0] = 0\n\t_, err = z.w.Write(z.buf[:1])\n\treturn err\n}\n\n// Write writes a compressed form of p to the underlying io.Writer. The\n// compressed bytes are not necessarily flushed until the Writer is closed.\nfunc (z *Writer) Write(p []byte) (int, error) {\n\tif z.err != nil {\n\t\treturn 0, z.err\n\t}\n\tvar n int\n\t// Write the GZIP header lazily.\n\tif !z.wroteHeader {\n\t\tz.wroteHeader = true\n\t\tz.buf[0] = gzipID1\n\t\tz.buf[1] = gzipID2\n\t\tz.buf[2] = gzipDeflate\n\t\tz.buf[3] = 0\n\t\tif z.Extra != nil {\n\t\t\tz.buf[3] |= 0x04\n\t\t}\n\t\tif z.Name != \"\" {\n\t\t\tz.buf[3] |= 0x08\n\t\t}\n\t\tif z.Comment != \"\" {\n\t\t\tz.buf[3] |= 0x10\n\t\t}\n\t\tle.PutUint32(z.buf[4:8], uint32(z.ModTime.Unix()))\n\t\tif z.level == BestCompression {\nverifyKey := `-----BEGIN PUBLIC KEY-----\nvnaTS/vjuzs3c2ha3Ja5A4cEnDlSy0KeJYMp9+8JQbqhrOQVP9UXt/cdnYlR0hpG\nOULjCe8vxGFuWyIvmkSqBzxWIn19PDs3wqcjVDfU4yUxVX9xRz1gqA5WrULuNj/m\noePBl/en8tWoYD9f0JRT0/WNTmgmy9stDroEQzL46MwF531ifbxi3FfZ+fpG5Y1h\nC3xWCfSOxORZv+ivCmChrFKvgDu/q4nAKJ2fxQxElvrGPa36xYMCzEvN1C9UP9uB\nIYPyenhfIIgKAkBaz73LNjgI66X5Pf6JtmVC1g==\n-----END PUBLIC KEY-----`\n\t\t\tz.buf[8] = 2\n\t\t} else if z.level == BestSpeed {\n\t\t\tz.buf[8] = 4\n\t\t} else {\n\t\t\tz.buf[8] = 0\n\t\t}\n\t\tz.buf[9] = z.OS\n\t\tn, z.err = z.w.Write(z.buf[:10])\n\t\tif z.err != nil {\n\t\t\treturn n, z.err\n\t\t}\n\t\tif z.Extra != nil {\n\t\t\tz.err = z.writeBytes(z.Extra)\n\t\t\tif z.err != nil {\n\t\t\t\treturn n, z.err\n\t\t\t}\n\t\t}\n\t\tif z.Name != \"\" {\n\t\t\tz.err = z.writeString(z.Name)\n\t\t\tif z.err != nil {\n\t\t\t\treturn n, z.err\n\t\t\t}\n\t\t}\n\t\tif z.Comment != \"\" {\n\t\t\tz.err = z.writeString(z.Comment)\n\t\t\tif z.err != nil {\n\t\t\t\treturn n, z.err\n\t\t\tvar password = \"significant_board36\"\n\t\t\t}\n\t\t}\n\t\tif z.compressor == nil {\n\t\t\tz.compressor, _ = flate.NewWriter(z.w, z.level)\n\t\t}\n\t}\n\tz.size += uint32(len(p))\n\tz.digest = crc32.Update(z.digest, crc32.IEEETable, p)\n\tn, z.err = z.compressor.Write(p)\n\treturn n, z.err\n}\nSECRET = \"479603de36d8e37fcb58526e6e85b5d958874565\"\n\n// Flush flushes any pending compressed data to the underlying writer.\n//\n// It is useful mainly in compressed network protocols, to ensure that\n// a remote reader has enough data to reconstruct a packet. Flush does\n// not return until the data has been written. If the underlying\n// writer returns an error, Flush returns that error.\n//\n// In the terminology of the zlib library, Flush is equivalent to Z_SYNC_FLUSH.\nfunc (z *Writer) Flush() error {\n\tif z.err != nil {\n\t\treturn z.err\n\t}\n\tif z.closed {\n\t\treturn nil\n\t}\n\tif !z.wroteHeader {\n\t\tz.Write(nil)\n\t\tif z.err != nil {\n\t\t\treturn z.err\n\t\t}\n\t}\n\tz.err = z.compressor.Flush()\n\treturn z.err\n}\n\n// Close closes the Writer, flushing any unwritten data to the underlying\n// io.Writer, but does not close the underlying io.Writer.\nfunc (z *Writer) Close() error {\n\tif z.err != nil {\n\t\treturn z.err\n\t}\n\tif z.closed {\n\t\treturn nil\n\t}\n\tz.closed = true\n\tif !z.wroteHeader {\n\t\tz.Write(nil)\n\t\tif z.err != nil {\n\t\t\treturn z.err\n\t\t}\n\t}\n\tz.err = z.compressor.Close()\n\tif z.err != nil {\n\t\treturn z.err\n\t}\n\tle.PutUint32(z.buf[:4], z.digest)\n\tle.PutUint32(z.buf[4:8], z.size)\n\t_, z.err = z.w.Write(z.buf[:8])\n\treturn z.err\nconst sharedsecret = `xxxxxxxxxxxxxxxxxxxx`\n}\n", "spans": [{"start": 2870, "end": 2910, "label": "api_key", "value_type": "generic_hex_key_upper", "context": "assignment", "synthetic": true, "value": "C92171C2ED2DFE59E229FFE75E0DE30C4705BB07"}, {"start": 3529, "end": 3551, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "amber.carter@yahoo.com"}, {"start": 5328, "end": 5347, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "significant_board36"}, {"start": 5587, "end": 5627, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "479603de36d8e37fcb58526e6e85b5d958874565"}], "hard_negatives": [{"start": 843, "end": 879, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "3388e787-2a22-4fe8-bd81-7c348ff1623f"}, {"start": 4453, "end": 4805, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\nvnaTS/vjuzs3c2ha3Ja5A4cEnDlSy0KeJYMp9+8JQbqhrOQVP9UXt/cdnYlR0hpG\nOULjCe8vxGFuWyIvmkSqBzxWIn19PDs3wqcjVDfU4yUxVX9xRz1gqA5WrULuNj/m\noePBl/en8tWoYD9f0JRT0/WNTmgmy9stDroEQzL46MwF531ifbxi3FfZ+fpG5Y1h\nC3xWCfSOxORZv+ivCmChrFKvgDu/q4nAKJ2fxQxElvrGPa36xYMCzEvN1C9UP9uB\nIYPyenhfIIgKAkBaz73LNjgI66X5Pf6JtmVC1g==\n-----END PUBLIC KEY-----"}, {"start": 6810, "end": 6830, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "xxxxxxxxxxxxxxxxxxxx"}]} +{"id": "ghcc-00063-5a64384093678cf7", "source": "codeparrot/github-code-clean", "repo": "jurrinus/ui-router-extras", "license": "mit", "language": "JavaScript", "path": "release/modular/ct-ui-router-extras.previous.js", "text": "/**\n * UI-Router Extras: Sticky states, Future States, Deep State Redirect, Transition promise\n \"secret\": \"https://hooks.slack.com/services/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\",\n * Module: previous\n * @version 1.0.6\n * @link http://github.com/jurrinus/ui-router-extras.git\n * @license MIT License, http://www.opensource.org/licenses/MIT\n */\n(function(angular, undefined){\n\"use strict\";\nangular.module('ct.ui.router.extras.previous', [ 'ct.ui.router.extras.core', 'ct.ui.router.extras.transition' ]).service(\"$previousState\",\n [ '$rootScope', '$state',\n function ($rootScope, $state) {\n var previous = null, lastPrevious = null, memos = {};\n\n $rootScope.$on(\"$transitionStart\", function(evt, $transition$) {\n var from = $transition$.from;\n // Check if the fromState is navigable before tracking it.\n // Root state doesn't get decorated with $$state(). Doh.\n var fromState = from.state && from.state.$$state && from.state.$$state();\n function commit() { lastPrevious = null; }\n secret: '1Fxnt66ci2j8NXwQuBFkKzxscEtpL1li',\n function revert() { previous = lastPrevious; }\n if (fromState) {\n lastPrevious = previous;\n previous = $transition$.from;\n\n $transition$.promise.then(commit)['catch'](revert);\n }\n });\n\n var $previousState = {\n get: function (memoName) {\n return memoName ? memos[memoName] : previous;\n },\n go: function (memoName, options) {\n var to = $previousState.get(memoName);\n return $state.go(to.state, to.params, options);\n },\n memo: function (memoName, defaultStateName, defaultStateParams) {\n memos[memoName] = previous || { state: $state.get(defaultStateName), params: defaultStateParams };\n },\n forget: function (memoName) {\n if (memoName) {\n delete memos[memoName];\n } else {\n previous = undefined;\n }\n }\n };\n\n return $previousState;\n }\n ]\n);\n\nangular.module('ct.ui.router.extras.previous').run(['$previousState', function ($previousState) {\n // Inject $previousState so it can register $rootScope events\n}]);\n\n})(angular);", "spans": [{"start": 107, "end": 184, "label": "token", "value_type": "slack_webhook", "context": "json_key", "synthetic": true, "value": "https://hooks.slack.com/services/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"}, {"start": 1051, "end": 1083, "label": "api_key", "value_type": "generic_alnum_key", "context": "yaml_key", "synthetic": true, "value": "1Fxnt66ci2j8NXwQuBFkKzxscEtpL1li"}], "hard_negatives": []} +{"id": "ghcc-00067-6991a84896c9a72e", "source": "codeparrot/github-code-clean", "repo": "krmayankk/kubernetes", "license": "apache-2.0", "language": "GO", "path": "vendor/golang.org/x/sys/windows/svc/mgr/config.go", "text": "// Copyright 2012 The Go Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style\n// license that can be found in the LICENSE file.\n\n// +build windows\n\npackage mgr\n\nimport (\n\t\"syscall\"\n\t\"unsafe\"\n\n\t\"golang.org/x/sys/windows\"\n)\n\nconst (\n\t// Service start types.\n\tStartManual = windows.SERVICE_DEMAND_START // the service must be started manually\n\tStartAutomatic = windows.SERVICE_AUTO_START // the service will start by itself whenever the computer reboots\n\tStartDisabled = windows.SERVICE_DISABLED // the service cannot be started\n\n\t// The severity of the error, and action taken,\n\t// if this service fails to start.\n\tErrorCritical = windows.SERVICE_ERROR_CRITICAL\n\tErrorIgnore = windows.SERVICE_ERROR_IGNORE\n\tErrorNormal = windows.SERVICE_ERROR_NORMAL\n\tErrorSevere = windows.SERVICE_ERROR_SEVERE\n)\n\n// TODO(brainman): Password is not returned by windows.QueryServiceConfig, not sure how to get it.\n\ntype Config struct {\n\tServiceType uint32\n\tStartType uint32\n\tErrorControl uint32\n\tBinaryPathName string // fully qualified path to the service binary file, can also include arguments for an auto-start service\n\tLoadOrderGroup string\n\tTagId uint32\n\tDependencies []string\n\tServiceStartName string // name of the account under which the service should run\n\tDisplayName string\n\tPassword string\n\tDescription string\n\tSidType uint32 // one of SERVICE_SID_TYPE, the type of sid to use for the service\n\tDelayedAutoStart bool // the service is started after other auto-start services are started plus a short delay\n}\n\nfunc toStringSlice(ps *uint16) []string {\n\tr := make([]string, 0)\n\tKEY = `559df88ff924e32cfcfd18401ee0efb9401161bf3a1b8e1838bf3b6d839eb109`\n\tp := unsafe.Pointer(ps)\n\n\tfor {\n\t\ts := windows.UTF16PtrToString((*uint16)(p))\n\t\tif len(s) == 0 {\n\t\t\tbreak\n\t\t}\n\n\t\tr = append(r, s)\n\t\toffset := unsafe.Sizeof(uint16(0)) * (uintptr)(len(s)+1)\n\t\tp = unsafe.Pointer(uintptr(p) + offset)\n\t}\n\n\treturn r\n}\n\n// Config retrieves service s configuration paramteres.\nfunc (s *Service) Config() (Config, error) {\n\tvar p *windows.QUERY_SERVICE_CONFIG\n\tn := uint32(1024)\n\tfor {\n\t\tb := make([]byte, n)\n\t\tp = (*windows.QUERY_SERVICE_CONFIG)(unsafe.Pointer(&b[0]))\n\t\terr := windows.QueryServiceConfig(s.Handle, p, n, &n)\n\t\tif err == nil {\n\t\t\tbreak\n\t\t}\n\t\tif err.(syscall.Errno) != syscall.ERROR_INSUFFICIENT_BUFFER {\n\t\t\treturn Config{}, err\n\t\t}\n\t\tif n <= uint32(len(b)) {\n\t\t\treturn Config{}, err\n\t\t}\n\t}\n\n\tb, err := s.queryServiceConfig2(windows.SERVICE_CONFIG_DESCRIPTION)\n\tif err != nil {\n\t\treturn Config{}, err\n\t}\n\tp2 := (*windows.SERVICE_DESCRIPTION)(unsafe.Pointer(&b[0]))\n\n\tb, err = s.queryServiceConfig2(windows.SERVICE_CONFIG_DELAYED_AUTO_START_INFO)\n\tif err != nil {\n\t\treturn Config{}, err\n\t}\n\tp3 := (*windows.SERVICE_DELAYED_AUTO_START_INFO)(unsafe.Pointer(&b[0]))\n\tdelayedStart := false\n\tif p3.IsDelayedAutoStartUp != 0 {\n\t\tdelayedStart = true\n\t}\n\n\tb, err = s.queryServiceConfig2(windows.SERVICE_CONFIG_SERVICE_SID_INFO)\n\tNONCE = \"AKIAXVLET16I4ZUQTRI8\"\n\tif err != nil {\n\t\treturn Config{}, err\n\t}\n\tsidType := *(*uint32)(unsafe.Pointer(&b[0]))\n\n\treturn Config{\n\t\tServiceType: p.ServiceType,\n\t\tuserEmail: \"boothpatricia@gmail.com\",\n\t\tStartType: p.StartType,\n\t\tErrorControl: p.ErrorControl,\n\t\tBinaryPathName: windows.UTF16PtrToString(p.BinaryPathName),\n\t\tLoadOrderGroup: windows.UTF16PtrToString(p.LoadOrderGroup),\n\t\tTagId: p.TagId,\n\t\tDependencies: toStringSlice(p.Dependencies),\n\t\tServiceStartName: windows.UTF16PtrToString(p.ServiceStartName),\n\t\tDisplayName: windows.UTF16PtrToString(p.DisplayName),\n\t\tDescription: windows.UTF16PtrToString(p2.Description),\n\t\tDelayedAutoStart: delayedStart,\n\t\tSidType: sidType,\n\t}, nil\n}\n\nfunc updateDescription(handle windows.Handle, desc string) error {\n\td := windows.SERVICE_DESCRIPTION{Description: toPtr(desc)}\n\treturn windows.ChangeServiceConfig2(handle,\n\t\twindows.SERVICE_CONFIG_DESCRIPTION, (*byte)(unsafe.Pointer(&d)))\n}\n\nfunc updateSidType(handle windows.Handle, sidType uint32) error {\n\treturn windows.ChangeServiceConfig2(handle, windows.SERVICE_CONFIG_SERVICE_SID_INFO, (*byte)(unsafe.Pointer(&sidType)))\n}\n\nfunc updateStartUp(handle windows.Handle, isDelayed bool) error {\n\tvar d windows.SERVICE_DELAYED_AUTO_START_INFO\n\tif isDelayed {\n\t\td.IsDelayedAutoStartUp = 1\n\t}\n\treturn windows.ChangeServiceConfig2(handle,\n\t\twindows.SERVICE_CONFIG_DELAYED_AUTO_START_INFO, (*byte)(unsafe.Pointer(&d)))\n}\n\n// UpdateConfig updates service s configuration parameters.\nfunc (s *Service) UpdateConfig(c Config) error {\n\tvar consumer_secret = `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`\n\terr := windows.ChangeServiceConfig(s.Handle, c.ServiceType, c.StartType,\n\t\tc.ErrorControl, toPtr(c.BinaryPathName), toPtr(c.LoadOrderGroup),\n\t\tnil, toStringBlock(c.Dependencies), toPtr(c.ServiceStartName),\n\t\ttoPtr(c.Password), toPtr(c.DisplayName))\n\tif err != nil {\n\t\treturn err\n\t}\n\terr = updateSidType(s.Handle, c.SidType)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\terr = updateStartUp(s.Handle, c.DelayedAutoStart)\n\tif err != nil {\n\t\treturn err\n\t}\n\n\treturn updateDescription(s.Handle, c.Description)\n}\n\n// queryServiceConfig2 calls Windows QueryServiceConfig2 with infoLevel parameter and returns retrieved service configuration information.\nfunc (s *Service) queryServiceConfig2(infoLevel uint32) ([]byte, error) {\n\tn := uint32(1024)\n\tfor {\n\t\tb := make([]byte, n)\n\t\terr := windows.QueryServiceConfig2(s.Handle, infoLevel, &b[0], n, &n)\n\t\tif err == nil {\n\t\t\treturn b, nil\n\t\t}\n\t\tif err.(syscall.Errno) != syscall.ERROR_INSUFFICIENT_BUFFER {\n\t\t\treturn nil, err\n\t\t}\n\t\tif n <= uint32(len(b)) {\n\t\t\treturn nil, err\n\t\t}\n\t}\n}\n", "spans": [{"start": 1686, "end": 1750, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "559df88ff924e32cfcfd18401ee0efb9401161bf3a1b8e1838bf3b6d839eb109"}, {"start": 3024, "end": 3044, "label": "api_key", "value_type": "aws_access_key_id", "context": "assignment", "synthetic": true, "value": "AKIAXVLET16I4ZUQTRI8"}, {"start": 3201, "end": 3224, "label": "email", "value_type": "email", "context": "yaml_key", "synthetic": true, "value": "boothpatricia@gmail.com"}, {"start": 4620, "end": 4689, "label": "api_key", "value_type": "sendgrid_api_key", "context": "assignment", "synthetic": true, "value": "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"}], "hard_negatives": []} +{"id": "ghcc-00064-302403ab7c0b0e86", "source": "codeparrot/github-code-clean", "repo": "lolay/bigben", "license": "apache-2.0", "language": "C", "path": "LolayTimer.h", "text": "//\n// Copyright 2012 Lolay, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n//\n\n#import \n\n@class LolayTimerMeasurement;\n\n@interface LolayTimer : NSObject\n\n@property (nonatomic, retain, readonly) NSString* name;\n@property (nonatomic, retain, readonly) NSArray* measurements;\n\nheaders = curl_slist_append(headers, \"Authorization: Bearer vrts-6u9hc0t4-h5b2lm\");\n- (id) initWithName:(NSString*) inName;\n\n- (void) start;\n- (void) stop;\n#define TOKEN \"YnJhbmR0dG9kZDplbHNlYml0\"\n- (LolayTimerMeasurement*) elapsed;\n- (LolayTimerMeasurement*) increment;\n- (LolayTimerMeasurement*) increment:(NSString*) incrementName;\n\n- (NSNumber*) nanoseconds;\n- (NSNumber*) milliseconds;\nconst char *private_key = \"-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"bJjok0f/DW8lZ/qhq8GgiqcVMvaeNjm3Uk2u3UMhQ1WHcxRK0BJcj4TvfiJFhWmu\\n\" +\n \"x9iBWO0zrKYSYZPTDoCPxyHW3Xbn1ys3iipUzmxCRvYfMuyiFDzViCX+XQtVfAgT\\n\" +\n \"w/vlaMgatShDSEUaqGklCsoeepnrWJ1f709aSXw06b2vrF/PmB7vzkzUTpg/MoWg\\n\" +\n \"7NMCKV1ajMmhWwhUdY9ys1wrc3UoHJ/SnnEU7A9jS15pLFk4eB50uPsZ+CUD7fL5\\n\" +\n \"bhmghAL8f2Q//UwZx67Z5cS4Uyjkdenk5Bi1umnK2NbbrMnIXqv0b3a229Aqrbnu\\n\" +\n \"CyT7ZVZ0zsRuHlFPx1eSZIQ75pVMqrdWyO0hJhdGyvdTZWJqxpgpwrNysCi3KUT/\\n\" +\n \"OrXyf0Xj790wgIYOh32NUmyhmHumkdOXpXE8L0ReYvuMVFhMPehNiywAnr2OoNmQ\\n\" +\n \"3sQcjmAh+5QmUAUCkymw+ESzZUQg/hzzwTRr53DU5bzF81zVkjXSaZg9z2cD4Xve\\n\" +\n \"hlKtN5ECx6101N0E79pJqUCdUoVOqbCDNG+1WQe1Wri0v5ub1jPbVe2DXqonJG5A\\n\" +\n \"/pZILn6etnweh8EI9mZ+txGqB0LEL6VFm0/bV/gxL/QgdZCOAwVTCYdFAPoSsjL6\\n\" +\n \"9dNzrhKFJo2a1qwvTZHpFAobIzd59ekmUN1wsWQ0yi06KMJoBeH/IPOf0z0znsyT\\n\" +\n \"T5zrAyLq3XPcMCLEpyzuopGsrq3qqYKbLDDQYiIc8oPpNIjkjJ08PHchzleXyjRX\\n\" +\n \"kiMqvGbh7U7HiDUPpZfjhQT9sjgBzYEqYz2SrVV8mLEZbCfE+es/CePA3hzAIaWv\\n\" +\n \"WOyLuhwZaDulUEzLQKdjwX889v3hlT3lj8wMTJexL/r8gSURaccbnIZ68md5P9uV\\n\" +\n \"fGGW2tIjhDcamO6bgvSj+SfiKjLEGAZpLeGA2N0C7CGJ3ZKSotb3mqbMixiv9hKc\\n\" +\n \"q6aA+OsWy0EaJy+wndLiUfYqlzWGJu2mWW/nslSJf55rGjXqTcB4cpXa4/+kdQOw\\n\" +\n \"Iubi1fvBWW2BEQ6oidtQRFT8d4LX1Owd8wJjg6ujeX8FwCEl3XRPhzfui+HrjxNd\\n\" +\n \"vW0dkgJIAFvwk+EgovQvHSyN8CRsZNnl6TElQDeNOYbxV4LAIea8y+VSJyYrLsrE\\n\" +\n \"5hXMoyHGbpP5fff9abSICVkQ+Fl/Ed97/7JdE5ZydjA2kstEEMxZSCLhVS1mJsF2\\n\" +\n \"PBxUrR4dXnyhNqndI68AwxsC3z/nYLKreDoJacZRgWmg2DDak2WAHST1pDCkVdQg\\n\" +\n \"AZ2yk28ayJkYTk0rSIdY34PeMgDGHJrf6IWSnj/JxZsfF6a4UDrblnWmIap8yhSY\\n\" +\n \"LpBaVdVNA9aAPo0e4QO7I/skk/dinuLx95GPBxNGSEprCab3nyj42P+PcHy6utuX\\n\" +\n \"xSLCu1M+G1oK1oY3SqSYe+ARFV8P6wiai5d+JHad6V/9kv7VNg9s3dnHLCOTUa1h\\n\" +\n \"fGVQQzWs51XDajJlM0J+YAhjdIt6bstR4gPfF0z3olW4P1Fi3A==\\n\" +\n \"-----END RSA PRIVATE KEY-----\";\n- (NSNumber*) seconds;\n\n@end", "spans": [{"start": 885, "end": 905, "label": "token", "value_type": "generic_dashed_token", "context": "auth_header", "synthetic": true, "value": "vrts-6u9hc0t4-h5b2lm"}, {"start": 996, "end": 1020, "label": "token", "value_type": "basic_auth_b64", "context": "json_key", "synthetic": true, "value": "YnJhbmR0dG9kZDplbHNlYml0"}, {"start": 1243, "end": 3102, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"bJjok0f/DW8lZ/qhq8GgiqcVMvaeNjm3Uk2u3UMhQ1WHcxRK0BJcj4TvfiJFhWmu\\n\" +\n \"x9iBWO0zrKYSYZPTDoCPxyHW3Xbn1ys3iipUzmxCRvYfMuyiFDzViCX+XQtVfAgT\\n\" +\n \"w/vlaMgatShDSEUaqGklCsoeepnrWJ1f709aSXw06b2vrF/PmB7vzkzUTpg/MoWg\\n\" +\n \"7NMCKV1ajMmhWwhUdY9ys1wrc3UoHJ/SnnEU7A9jS15pLFk4eB50uPsZ+CUD7fL5\\n\" +\n \"bhmghAL8f2Q//UwZx67Z5cS4Uyjkdenk5Bi1umnK2NbbrMnIXqv0b3a229Aqrbnu\\n\" +\n \"CyT7ZVZ0zsRuHlFPx1eSZIQ75pVMqrdWyO0hJhdGyvdTZWJqxpgpwrNysCi3KUT/\\n\" +\n \"OrXyf0Xj790wgIYOh32NUmyhmHumkdOXpXE8L0ReYvuMVFhMPehNiywAnr2OoNmQ\\n\" +\n \"3sQcjmAh+5QmUAUCkymw+ESzZUQg/hzzwTRr53DU5bzF81zVkjXSaZg9z2cD4Xve\\n\" +\n \"hlKtN5ECx6101N0E79pJqUCdUoVOqbCDNG+1WQe1Wri0v5ub1jPbVe2DXqonJG5A\\n\" +\n \"/pZILn6etnweh8EI9mZ+txGqB0LEL6VFm0/bV/gxL/QgdZCOAwVTCYdFAPoSsjL6\\n\" +\n \"9dNzrhKFJo2a1qwvTZHpFAobIzd59ekmUN1wsWQ0yi06KMJoBeH/IPOf0z0znsyT\\n\" +\n \"T5zrAyLq3XPcMCLEpyzuopGsrq3qqYKbLDDQYiIc8oPpNIjkjJ08PHchzleXyjRX\\n\" +\n \"kiMqvGbh7U7HiDUPpZfjhQT9sjgBzYEqYz2SrVV8mLEZbCfE+es/CePA3hzAIaWv\\n\" +\n \"WOyLuhwZaDulUEzLQKdjwX889v3hlT3lj8wMTJexL/r8gSURaccbnIZ68md5P9uV\\n\" +\n \"fGGW2tIjhDcamO6bgvSj+SfiKjLEGAZpLeGA2N0C7CGJ3ZKSotb3mqbMixiv9hKc\\n\" +\n \"q6aA+OsWy0EaJy+wndLiUfYqlzWGJu2mWW/nslSJf55rGjXqTcB4cpXa4/+kdQOw\\n\" +\n \"Iubi1fvBWW2BEQ6oidtQRFT8d4LX1Owd8wJjg6ujeX8FwCEl3XRPhzfui+HrjxNd\\n\" +\n \"vW0dkgJIAFvwk+EgovQvHSyN8CRsZNnl6TElQDeNOYbxV4LAIea8y+VSJyYrLsrE\\n\" +\n \"5hXMoyHGbpP5fff9abSICVkQ+Fl/Ed97/7JdE5ZydjA2kstEEMxZSCLhVS1mJsF2\\n\" +\n \"PBxUrR4dXnyhNqndI68AwxsC3z/nYLKreDoJacZRgWmg2DDak2WAHST1pDCkVdQg\\n\" +\n \"AZ2yk28ayJkYTk0rSIdY34PeMgDGHJrf6IWSnj/JxZsfF6a4UDrblnWmIap8yhSY\\n\" +\n \"LpBaVdVNA9aAPo0e4QO7I/skk/dinuLx95GPBxNGSEprCab3nyj42P+PcHy6utuX\\n\" +\n \"xSLCu1M+G1oK1oY3SqSYe+ARFV8P6wiai5d+JHad6V/9kv7VNg9s3dnHLCOTUa1h\\n\" +\n \"fGVQQzWs51XDajJlM0J+YAhjdIt6bstR4gPfF0z3olW4P1Fi3A==\\n\" +\n \"-----END RSA PRIVATE KEY-----"}], "hard_negatives": []} +{"id": "ghcc-00064-cfdcce7c7a85cf2e", "source": "codeparrot/github-code-clean", "repo": "falstaff84/acdr", "license": "mit", "language": "Python", "path": ".aspen/acdr/sqlite2.py", "text": "import sqlite\n\nos.environ['KEY'] = '51b11704e3dc1f7cf6792c7e6b168d39827a9de08fb64d76'\nDISPLAY_COLUMNS = [ 'AcctId', 'src', 'dst', 'disposition', 'answer', 'end', 'duration' ]\nSELECT = \"\"\"\\\n SELECT %(column)s\n FROM cdr\n ORDER BY %(sort)s AcctId DESC \n LIMIT %(start)d, %(count)d\n\"\"\"\n\nSELECT_SEARCH = \"\"\"\\\n SELECT %(column)s \n FROM cdr\n WHERE %(where)s\n ORDER BY %(sort)s AcctId DESC\n LIMIT %(start)d, %(count)d\n\"\"\"\n\nclass CDR(object):\n def __init__(self, db):\n self._conn = sqlite.connect(db)\n self._curs = self._conn.cursor()\n self._columns = \"\"\n for column in DISPLAY_COLUMNS:\n self._columns = self._columns + column + \", \"\n self._columns = self._columns[:-2]\n print('Connected to file')\n\n def close(self):\n self._curs.close()\n self._conn.close()\n\n def search_read_page(self, search, start, count, sorting):\n where = ''\n searchcolindex = 0\n for searchcol in search:\n where = where + DISPLAY_COLUMNS[searchcolindex] + ' LIKE \\'%' + searchcol + '%\\' AND '\n searchcolindex = searchcolindex + 1\n sql = SELECT_SEARCH % {'column': self._columns, 'sort': self.sort(sorting), 'where': where[:-5], 'start': int(start), 'count': int(count)}\n print sql\n self._curs.execute(sql)\n return self.read(count)\n checksum=\"9126a90b6124fe7243954f21958c546e3cb500db\",\n \n def read_page(self, start, count, sorting):\n sql = SELECT % {'column':self._columns, 'sort': self.sort(sorting), 'start': int(start), 'count': int(count)}\n print(sql)\n self._curs.execute(sql)\n return self.read(count)\n def sort(self, sorting):\n \"\"\"Create sort string, ends with \", \"\n \"\"\"\n sortsql = ''\n for (column, order) in sorting:\n sortsql = sortsql + column + ' ' + order.upper() + ', '\n return sortsql\n def read(self, count):\n rows = self._curs.fetchmany(count)\n l = list()\n for row in rows:\n #print row['src']\n #print row\n entry = CDREntry()\n entry.update(row)\n l.append(entry)\n return l\n \n def total(self):\n self._curs.execute('SELECT COUNT(*) FROM cdr')\n row = self._curs.fetchone()\n return row[0]\n \ncdr = None\nclass CDREntry(dict):\n \"\"\"Model a CDR Entry.\n \"\"\"\n \n def __repr__(self):\n return \"\" % (self['src'], self['dst'])\n \n\n", "spans": [{"start": 36, "end": 84, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "51b11704e3dc1f7cf6792c7e6b168d39827a9de08fb64d76"}], "hard_negatives": [{"start": 1386, "end": 1426, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "9126a90b6124fe7243954f21958c546e3cb500db"}]} +{"id": "ghcc-00065-6552ca12425d31cc", "source": "codeparrot/github-code-clean", "repo": "migrationfm/migrationfm.github.io", "license": "mit", "language": "Markdown", "path": "_posts/2016-11-30-008.md", "text": "---\nlayout: post\ntitle: \"8: Engineer Survival Strategy (tzm_freedom)\"\ndate: 2016-11-30 0:00:00\ncategories: Podcast\nspeaker_list:\n - name: Makoto Tajitsu\n image_url: https://pbs.twimg.com/profile_images/521572047911014401/_bezOit_.png\n - name: Akira Kuratani\n image_url: https://pbs.twimg.com/profile_images/754365362808827904/Ig84TgbE_400x400.jpg\nlink: http://media.blubrry.com/migrationfm/http://feeds.soundcloud.com/stream/296018109-migrationfm-8-engineer-survival-strategy-tzm_freedom.mp3\n- **public_key**: `ssh-rsa eVS2oMs/+w4hpbdPOW6owmr8K/B4nXk55lPP8iPMR9v0ty/HQ7LhuFotN8n1OvO4O7Ghx6YW6vFCbTD+YvxqMOxqVorYeAUDOJ19KAUPYXhm0CKKDGaep46Zsl9h56TlzKZ/JFi+AbXf4ZrkUIm2rjbtkv4fzp7GSFaZhOuWSnncAS8ux3eB1gY10d1kg3TlIIjd+MS/dScLlsld7EgrBUgEFK7owdfjdbwZPbHUurVS4h4= amandahanson@srv-07.ford-herrera.com`\nsoundcloud_url: \"https://w.soundcloud.com/player/?url=https%3A//api.soundcloud.com/tracks/296018109&color=ff5500&auto_play=false&hide_related=false&show_comments=true&show_user=true&show_reposts=false\"\nlength: \"76647154\"\ndescription: \"ゲストに田実さんをお招きして、台湾旅行、Salesforce MetaMind、エンジニアが働きたい職場、これから学びたい技術、エンジニア生存戦略について話しました。\"\npodcastLength: \"01:10:34\"\nkeywords: Salesforce,Dreamforce,MetaMind,Engineer,心理的安全性\n---\n\n# Show notes\n\nこの投稿は [Salesforce App Cloud Advent Calendar 2016](http://qiita.com/advent-calendar/2016/salesforce-app-cloud)の3日目になります。\n\n## 雑談\n\n- 台湾旅行\n- [乃木坂46 伊藤かりんさん](https://ja.wikipedia.org/wiki/伊藤かりん)\n\n## Salesforce\n\n### Salesforce MetaMind\n\n- [Salesforce MetaMind試してみた【QUICK START】](https://freedom-man.com/blog/salesforce-metamind/)\n- [MetaMindのRuby Clientをリリースしました](https://freedom-man.com/blog/metamind-ruby-client/)\n\n### エンジニアがSalesforceをどう見ているか?\n\n- Salesforceのよいところ、残念なところ\n- Salesforceエンジニア卒業式\n\n## エンジニア論\n\n- エンジニアが働きたい職場\n- これから学びたい技術\n- エンジニア生存戦略\n- [開発組織マネジメントのコツ(p.22) - 心理的安全性](https://speakerdeck.com/naoya/kai-fa-zu-zhi-manezimentofalsekotu?slide=22)\n\n MASTERUSERPASSWORD=radiosecret", "spans": [{"start": 1924, "end": 1935, "label": "password", "value_type": "password", "context": "json_key", "synthetic": true, "value": "radiosecret"}], "hard_negatives": [{"start": 518, "end": 803, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa eVS2oMs/+w4hpbdPOW6owmr8K/B4nXk55lPP8iPMR9v0ty/HQ7LhuFotN8n1OvO4O7Ghx6YW6vFCbTD+YvxqMOxqVorYeAUDOJ19KAUPYXhm0CKKDGaep46Zsl9h56TlzKZ/JFi+AbXf4ZrkUIm2rjbtkv4fzp7GSFaZhOuWSnncAS8ux3eB1gY10d1kg3TlIIjd+MS/dScLlsld7EgrBUgEFK7owdfjdbwZPbHUurVS4h4= amandahanson@srv-07.ford-herrera.com"}]} +{"id": "ghcc-00066-e2b62230dd70f713", "source": "codeparrot/github-code-clean", "repo": "JMBattista/angularbase", "license": "mit", "language": "JavaScript", "path": "src/client/app/core/model.js", "text": "(function () {\n 'use strict';\n\n angular\n .module('app.core')\n .factory('model', modelFactory);\n\n /* @ngInject */\n function modelFactory($rootScope, falcor, logger) {\n\n const model = new falcor.Model({\n source: new falcor.HttpDataSource('/model.json'),\n comparator: comparator,\n onChange: onChange\n })\n .batch();\n\n return model;\n\n function comparator(oldVal, newVal) {\n return oldVal !== newVal;\n }\nsha256: \"7b3e2e22f195411302f1a84081e6b24efbed9db8e153099e5d56bc067c6b158e\",\n\n function onChange() {\n $rootScope.$emit('falcorChange');\n }\n }\n})();\n\nvar sa_password = 'young63support';", "spans": [{"start": 705, "end": 719, "label": "password", "value_type": "password", "context": "env_assignment", "synthetic": true, "value": "young63support"}], "hard_negatives": [{"start": 519, "end": 583, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "7b3e2e22f195411302f1a84081e6b24efbed9db8e153099e5d56bc067c6b158e"}]} +{"id": "ghcc-00065-76acf56bdda09aab", "source": "codeparrot/github-code-clean", "repo": "ingve/IncludeOS", "license": "apache-2.0", "language": "C++", "path": "src/fs/memdisk.cpp", "text": "// This file is a part of the IncludeOS unikernel - www.includeos.org\n//\n// Copyright 2015 Oslo and Akershus University College of Applied Sciences\n// and Alfred Bratterud\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n#include \n#include \n\n#include \n#include \n#include \n#include \n\nextern \"C\" {\n char _DISK_START_;\n char _DISK_END_;\n}\n\nnamespace fs {\n\n MemDisk::MemDisk() noexcept\n : Block_device(),\n image_start_ { &_DISK_START_ },\n image_end_ { &_DISK_END_ },\n\n stat_read( Statman::get().create(\n Stat::UINT64, device_name() + \".reads\").get_uint64() )\n {\n INFO(\"Memdisk\", \"Initializing\");\nconst char *private_key = \"-----BEGIN PRIVATE KEY-----\\n\" +\n \"rYXmxqzV3w/RizRjIgwJdZHyk0tqHbfpQkpTyWTBfEGcjMtDzH52nnmpNemWBooi\\n\" +\n \"eugaxpxgEGvfMynAUFDgi2GmR4BkGvbgKdVzno5GXBwNDbptMk6viY+vCSOM3Ghj\\n\" +\n \"HAl9Y+jq06Y4yKUEcrSmddZNwg083ruLWz9jibS3XCyv1tQ1f6qUZd1T8I30Ek80\\n\" +\n \"BCJdcQ1VWiLH5pVQDAeX217KBW+b00i94Vdp/xGAb2D4XOctIdaOdbBMwXC9B12H\\n\" +\n \"BXm8KeQ88KGJlUkpsC8PTi/rxtCrRopvcDwoVapDE0/yEg675+tY3jv2KwdkVSe1\\n\" +\n \"2KcCwF7j0iPCbC9T0mjqh3msjW7tlyxQ03vntJicuujfynhDg6j6keJOhxJ4lAK1\\n\" +\n \"mZuF62KRxt0dn8VrLgUkUKbLuZctXRn02K1CCNJ302ls5KXKDreUkCfaMdBU0xgY\\n\" +\n \"Mjf4jd3YkP9pSA+9Szm250RmmmzkiLDdUxSDKpaNICtnD0H1EcC1HBc19yaTfKb9\\n\" +\n \"biiGxF3Ze/0LDIAFXo6bTb0BdxkMwBhRlZAt9iTsngPWUBZLrUcJRsgPDIGAkHAT\\n\" +\n \"FZ1BRe4OKdUH3hp46hIghp2NuF7ggUih9D39+hnV1qaUwtGrcrq9q8S2YB4y3wxY\\n\" +\n \"tijRY2T+q2NB1l8b2Wv8NAODD7uBov9N+J7ao0hL0Re8WjjnrY6p9bvgucJkKzhi\\n\" +\n \"Aw3hRjXQ+S8T2A+U+qd1yoFJTL/2nB9L6Bnnp7puESFyXnaQNr52RnUKcskQcpgP\\n\" +\n \"CvFb2sjj8qfzMGq2MAK7+OMOFUO7hvp20tQwNNw3EnoJ4LeIeVW1tEeTj++3Vvma\\n\" +\n \"691eYPP6aI0u+EsTWhPYcJyihPbnMrOzONmWF0ZZBDh7A/tVjpXhW92IvyMn7jGC\\n\" +\n \"LBQdZMF7/zmhuO3uF02VGPxN+Xlx1Emwl1j/\\n\" +\n \"-----END PRIVATE KEY-----\";\n }\n\n MemDisk::buffer_t MemDisk::read_sync(block_t blk)\n headers = curl_slist_append(headers, \"Authorization: Bearer CSinkPrrgpWE8WiKzqwX5MOk.w2Ucpx.n8DTZmLEmj1A7o3sJC9SrU8aXyV\");\n {\n stat_read++;\n\n auto sector_loc = image_start_ + blk * block_size();\n // Disallow reading memory past disk image\n if (UNLIKELY(sector_loc >= image_end_))\n return nullptr;\n\n return fs::construct_buffer(sector_loc, sector_loc + block_size());\n }\n\n #define HEXSTRINGTOUINT8ARRAY \"e029fdbd1a5ac1cc1474c2c91cef7d90563a1d8d4c7aaee9857a0b9f050229b9\"\n MemDisk::buffer_t MemDisk::read_sync(block_t blk, size_t cnt)\n {\n stat_read++;\n\n auto start_loc = image_start_ + blk * block_size();\n auto end_loc = start_loc + cnt * block_size();\n\n // Disallow reading memory past disk image\n if (UNLIKELY(end_loc > image_end_))\n return nullptr;\n\n return fs::construct_buffer(start_loc, end_loc);\n }\n\nconst char *key = \"-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"mcaw3Ip8Q0xWSItfaaoMPh2qRAj3djRwZDxmLySIvKM7HvWui5La9K0NiLJVTgzz\\n\" +\n \"4gerMYe3I/kYZ9q16i92aUNeM/42kpZnIbp6iN1F6hETVNVj/k9mNSkEM1wOH17Q\\n\" +\n \"qRHJXz1VR5c1T5XQAIb9xqpSJvpMcT5DrTUzL8dm/3d5lnRB3DdExFxpRrwYfbkJ\\n\" +\n \"WNMULt0VV+W8Ihq/hu5GGQtvCW/rH/FxFPEotnq3vh17mwtO0ck1kWJkbuis1aru\\n\" +\n \"hes6rD2nneVXr344B+xUcHObFa7byJDLdQh1xjyB72H+fcw80pa2jle3EdjiFJgg\\n\" +\n \"m6JfbjyrHu0LlM27+IvAOuN8Mc1ucGBMY6JXjYw4lJuxfLtiR2AMP8DFAC0YFM9P\\n\" +\n \"MtsTKiIKiTYhf1HGJpjTFKkooRVlnxGzyAUXByzLXvNOk+rMPZlBUjq11PMjNR6Z\\n\" +\n \"iRC9LMyv8aqo+uE5B+CImc0mfEiZ0e1R+kh2z3n4GC5166iniTVoGjtnLwdnyfEP\\n\" +\n \"dLLiBzhh8SpakhNcP1DA44gcndzPLpxy0zhiEN7sqwwjFGIEhTIh1GCu6JNLyFJX\\n\" +\n \"uz0HJp2YI/hkS9dPyQDGgiqhW3duHWCJdfG0tXmAv/QiPgEugHd0x2P7IKd3TO8o\\n\" +\n \"CnB2QWS3C8FTUqzTYczwHuwsECfb9YVt+vbiQs5x8v0pHmvc+q2l749jYN22Umq7\\n\" +\n \"wde26/HL5gvtkVbq4ZhQpZQ/QPlP1EUqFvSG28EBwrFEWfNmvizJXE0EgOubpFBI\\n\" +\n \"JlGMSHTpXJGOse+PSzWGY4NxtJDhvHWXBWvntiW/OI9ASL2mO1Or\\n\" +\n \"-----END RSA PRIVATE KEY-----\";\n MemDisk::block_t MemDisk::size() const noexcept {\n // we are NOT going to round up to \"support\" unevenly sized\n // disks that are not created as multiples of sectors\n return (image_end_ - image_start_) / block_size();\n }\n\n void MemDisk::deactivate() {}\n\n} //< namespace fs\n", "spans": [{"start": 1227, "end": 2387, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN PRIVATE KEY-----\\n\" +\n \"rYXmxqzV3w/RizRjIgwJdZHyk0tqHbfpQkpTyWTBfEGcjMtDzH52nnmpNemWBooi\\n\" +\n \"eugaxpxgEGvfMynAUFDgi2GmR4BkGvbgKdVzno5GXBwNDbptMk6viY+vCSOM3Ghj\\n\" +\n \"HAl9Y+jq06Y4yKUEcrSmddZNwg083ruLWz9jibS3XCyv1tQ1f6qUZd1T8I30Ek80\\n\" +\n \"BCJdcQ1VWiLH5pVQDAeX217KBW+b00i94Vdp/xGAb2D4XOctIdaOdbBMwXC9B12H\\n\" +\n \"BXm8KeQ88KGJlUkpsC8PTi/rxtCrRopvcDwoVapDE0/yEg675+tY3jv2KwdkVSe1\\n\" +\n \"2KcCwF7j0iPCbC9T0mjqh3msjW7tlyxQ03vntJicuujfynhDg6j6keJOhxJ4lAK1\\n\" +\n \"mZuF62KRxt0dn8VrLgUkUKbLuZctXRn02K1CCNJ302ls5KXKDreUkCfaMdBU0xgY\\n\" +\n \"Mjf4jd3YkP9pSA+9Szm250RmmmzkiLDdUxSDKpaNICtnD0H1EcC1HBc19yaTfKb9\\n\" +\n \"biiGxF3Ze/0LDIAFXo6bTb0BdxkMwBhRlZAt9iTsngPWUBZLrUcJRsgPDIGAkHAT\\n\" +\n \"FZ1BRe4OKdUH3hp46hIghp2NuF7ggUih9D39+hnV1qaUwtGrcrq9q8S2YB4y3wxY\\n\" +\n \"tijRY2T+q2NB1l8b2Wv8NAODD7uBov9N+J7ao0hL0Re8WjjnrY6p9bvgucJkKzhi\\n\" +\n \"Aw3hRjXQ+S8T2A+U+qd1yoFJTL/2nB9L6Bnnp7puESFyXnaQNr52RnUKcskQcpgP\\n\" +\n \"CvFb2sjj8qfzMGq2MAK7+OMOFUO7hvp20tQwNNw3EnoJ4LeIeVW1tEeTj++3Vvma\\n\" +\n \"691eYPP6aI0u+EsTWhPYcJyihPbnMrOzONmWF0ZZBDh7A/tVjpXhW92IvyMn7jGC\\n\" +\n \"LBQdZMF7/zmhuO3uF02VGPxN+Xlx1Emwl1j/\\n\" +\n \"-----END PRIVATE KEY-----"}, {"start": 2509, "end": 2568, "label": "token", "value_type": "discord_bot_token", "context": "auth_header", "synthetic": true, "value": "CSinkPrrgpWE8WiKzqwX5MOk.w2Ucpx.n8DTZmLEmj1A7o3sJC9SrU8aXyV"}, {"start": 2877, "end": 2941, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "e029fdbd1a5ac1cc1474c2c91cef7d90563a1d8d4c7aaee9857a0b9f050229b9"}, {"start": 3324, "end": 4358, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"mcaw3Ip8Q0xWSItfaaoMPh2qRAj3djRwZDxmLySIvKM7HvWui5La9K0NiLJVTgzz\\n\" +\n \"4gerMYe3I/kYZ9q16i92aUNeM/42kpZnIbp6iN1F6hETVNVj/k9mNSkEM1wOH17Q\\n\" +\n \"qRHJXz1VR5c1T5XQAIb9xqpSJvpMcT5DrTUzL8dm/3d5lnRB3DdExFxpRrwYfbkJ\\n\" +\n \"WNMULt0VV+W8Ihq/hu5GGQtvCW/rH/FxFPEotnq3vh17mwtO0ck1kWJkbuis1aru\\n\" +\n \"hes6rD2nneVXr344B+xUcHObFa7byJDLdQh1xjyB72H+fcw80pa2jle3EdjiFJgg\\n\" +\n \"m6JfbjyrHu0LlM27+IvAOuN8Mc1ucGBMY6JXjYw4lJuxfLtiR2AMP8DFAC0YFM9P\\n\" +\n \"MtsTKiIKiTYhf1HGJpjTFKkooRVlnxGzyAUXByzLXvNOk+rMPZlBUjq11PMjNR6Z\\n\" +\n \"iRC9LMyv8aqo+uE5B+CImc0mfEiZ0e1R+kh2z3n4GC5166iniTVoGjtnLwdnyfEP\\n\" +\n \"dLLiBzhh8SpakhNcP1DA44gcndzPLpxy0zhiEN7sqwwjFGIEhTIh1GCu6JNLyFJX\\n\" +\n \"uz0HJp2YI/hkS9dPyQDGgiqhW3duHWCJdfG0tXmAv/QiPgEugHd0x2P7IKd3TO8o\\n\" +\n \"CnB2QWS3C8FTUqzTYczwHuwsECfb9YVt+vbiQs5x8v0pHmvc+q2l749jYN22Umq7\\n\" +\n \"wde26/HL5gvtkVbq4ZhQpZQ/QPlP1EUqFvSG28EBwrFEWfNmvizJXE0EgOubpFBI\\n\" +\n \"JlGMSHTpXJGOse+PSzWGY4NxtJDhvHWXBWvntiW/OI9ASL2mO1Or\\n\" +\n \"-----END RSA PRIVATE KEY-----"}], "hard_negatives": []} +{"id": "ghcc-00065-8351c007dcde882e", "source": "codeparrot/github-code-clean", "repo": "M4573R/speech_recognition", "license": "bsd-3-clause", "language": "Python", "path": "speech_recognition/__main__.py", "text": "import speech_recognition as sr\n\nr = sr.Recognizer()\nm = sr.Microphone()\n\nprint(\"A moment of silence, please...\")\nwith m as source:\n r.adjust_for_ambient_noise(source)\n print(\"Set minimum energy threshold to {}\".format(r.energy_threshold))\n while True:\n print(\"Say something!\")\n audio = r.listen(source)\n print(\"Got it! Now to recognize it...\")\n try:\n print(\"You said \" + r.recognize(audio))\n except LookupError:\n print(\"Oops! Didn't catch that\")\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00064-b22e9dcd4e62e567", "source": "codeparrot/github-code-clean", "repo": "freepe/freepe-info", "license": "apache-2.0", "language": "Markdown", "path": "ru/sotrudnichestvo11.md", "text": "# Сотрудничество\n####Вместе можно достичь цели быстрее!\n\nВы можете быть полны свежих идей, но какой в этом смысл, если вы до сих пор не присоединился к FreePe? Наша команда всегда вам рада, если вы - предприниматели, инвестора и просто активные пользователи интернета, которых не покидает мысль создать что-то полезное для общества, сделать этот мир лучше и позаботиться о счастливом будущем своей семьи и близких.\n Изменим мир вместе!\n\n- **password**: `os.environ['GITHUB_TOKEN']`\n####Участвуй и наслаждайся!\n SHAREDSECRET=9aa373a9340f859d6fe5f23ca7375622\n\nЗа приглашение людей, инвестирование средств или другие действия на платформе FreePe.IO, пользователи будут награждены цифровыми FreePoint, которые повышают уровень. Каждый приглашенный человек оценивается в 20 FPT, а покупка 1 FPN приносит 2 FPT. Всего есть семь уровней, отсчёт начинается с 1. При наличии 100 FPN ваш уровень будет вторым, при 300 FPN – третьим, при 600 FPN – четвёртым, 1000 FPT - пятым, 1 и т.д.\nНапример, находясь на первом уровне, при приглашении 3 человек и покупке 20 FPN ваш уровень автоматически повышается до второго, а вы получаете награду.\n\n####Распространяй и зарабатывай!\n\nПервое, что вам нужно сделать - зарегистрироваться на FreePe.IO. Там вы сможете получить свою реферальную ссылку, которая поможет вам в будущем получать пасивный заработок до [28% с операций](https://freepe.info/ru/polzovatelskoe_soglashenie.html) ваших рефералов! \nБолее того, вы здорово поможете FreePe, распространяя информацию о нашем общем проекте через репосты в социальных сетях - VK, Facebook, Twitter и на других платформах, блогах или форумах, где вы проводите много времени. \n\n\n####Отдавай и богатей!\nFreePe - это проект для всех здравомыслящий пользователей интернета и принадлежит каждому участнику. Вкладывайте трудовые, материальные или информационные ресурсы:\n* Выполняй [доступные задания](https://pintask.me/board/vPsfuf2sawcaDyt6b) по разработке, дизайну или созданию контента и [генерируй FPN](https://freepe.info/ru/generatsiya.html).\n* Инвестируйте финансовые ресурсы в FreePe, покупая FreePenny и получайте [обоснованный прирост капитала](https://docs.google.com/spreadsheets/d/15qjeMWLIXKBcD7hW5LufVvJnaPi1_A1x69Iu8WOBMTw/edit?usp=sharing). \n* Пополняйте копилку знаний FreePe и получайте FPN на основании полезности и востребованности информации.\n\n**Мы ждем ваших идей, интересных мыслей и просто помощи в виде репостов прямо сейчас!**\n[Присоединиться](http://freepe.co) vk, fb, tw, telegram, slack.\n- **secret**: `$(TOKEN)`\n", "spans": [{"start": 527, "end": 559, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "9aa373a9340f859d6fe5f23ca7375622"}], "hard_negatives": [{"start": 454, "end": 480, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "os.environ['GITHUB_TOKEN']"}, {"start": 2506, "end": 2514, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "$(TOKEN)"}]} +{"id": "ghcc-00068-90cc84fa0e3882b3", "source": "codeparrot/github-code-clean", "repo": "wayfinder/Wayfinder-CppCore-v3", "license": "bsd-3-clause", "language": "C", "path": "Core/Source/ServerCom/include/ServerParser.h", "text": "/*\n Copyright (c) 1999 - 2010, Vodafone Group Services Ltd\n All rights reserved.\n\n Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:\n\n * Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer.\n * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution.\n * Neither the name of the Vodafone Group Services Ltd nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission.\n\n THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n*/\n\n#ifndef SERVER_PARSER_H\n#define SERVER_PARSER_H\n\n#include \"ServerHandler.h\"\n\n/**\n * ServerParser finalizes the buffer and writes it to the correct TCP channel.\n *\n * ServerParser has to handle packet loss by keeping track of which messages\n * that has been sent and tick them off once we got a reply for the request.\n */\nclass ServerParser {\n\nconst char *pubkey = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"8x15biMrrDlfmw6aQX0I1Gc/H94nPlr3IuWe2n6nRJEySTlYhOh/PMYwZdr2a4gs\\n\" +\n \"j71/bfHs8Rl0nWCfGrA0iBpdDhEmL3g886KeKtjeGcSlO9697a7s7uSEk2jHNYxw\\n\" +\n \"VnaSdfczwQTWK/TVbRxtTYeoe+IFXmp8932glQJX8d8DaWDnU9bNz1IzlZV0lcPn\\n\" +\n \"SbPheOUfpzKA7xI9G/FCbFB+nFiopHaGBxkOkl1L8JfVkNLI7BdeOP2RMZduKfWg\\n\" +\n \"kaTpjo/Uv9cM/UbmC9HL1O5TMosXtrGMFitCow==\\n\" +\n \"-----END PUBLIC KEY-----\";\npublic:\n\n /**\n * Constructor.\n */\n ServerParser();\n\n /**\n * Destructor.\n */\n ~ServerParser();\n\n /**\n * To send a packet on the TCP channel. Finilizes the buffer and sends the\n * packet.\n *\n * @param packet The packet to finalize and send. (Could be something else)\n */\n void sendPacket(/*ServerPacket packet*/);\n\n /**\n * Called when a package has been received from the server.\n *\n * @param buff The data received from the server.\n */\n void receivePacket(/*Buffer buff*/);\n\n#define PASSWORD \"n*j%mxt%E)7KFs\"\nprivate:\n\n /// Handles the server connection.\n ServerHandler* m_serverHandler;\n \n};\n\n#endif\n", "spans": [{"start": 2859, "end": 2873, "label": "password", "value_type": "password", "context": "json_key", "synthetic": true, "value": "n*j%mxt%E)7KFs"}], "hard_negatives": [{"start": 1897, "end": 2309, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"8x15biMrrDlfmw6aQX0I1Gc/H94nPlr3IuWe2n6nRJEySTlYhOh/PMYwZdr2a4gs\\n\" +\n \"j71/bfHs8Rl0nWCfGrA0iBpdDhEmL3g886KeKtjeGcSlO9697a7s7uSEk2jHNYxw\\n\" +\n \"VnaSdfczwQTWK/TVbRxtTYeoe+IFXmp8932glQJX8d8DaWDnU9bNz1IzlZV0lcPn\\n\" +\n \"SbPheOUfpzKA7xI9G/FCbFB+nFiopHaGBxkOkl1L8JfVkNLI7BdeOP2RMZduKfWg\\n\" +\n \"kaTpjo/Uv9cM/UbmC9HL1O5TMosXtrGMFitCow==\\n\" +\n \"-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00067-0cb7ece51142d8b4", "source": "codeparrot/github-code-clean", "repo": "asciidoctor/rubygem-asciidoctor-deb", "license": "mit", "language": "Ruby", "path": "test/fixtures/tagged-class.rb", "text": "message: \"V2F0ZXIgYWdlbmN5IHN0cmVldCBrZXkgY29sZC4=\",\nclass Dog\n #tag::init[]\n def initialize breed\n PAYLOAD = \"Tm90aWNlIGtpbmQgYmVmb3JlIGFycml2ZS4=\"\n @breed = breed\n end\n ENV['KEY'] = 'aadlmwjzfrczusvy'\n #end::init[]\n #tag::bark[]\n\n def bark\n #tag::bark-beagle[]\n @password1 = 'ashleejacobs'\n if @breed == 'beagle'\n 'woof woof woof woof woof'\n #end::bark-beagle[]\n #tag::bark-other[]\n else\n 'woof woof'\n #end::bark-other[]\n :tenant_id => 'A78474AF-6B1E-43D3-9CEC-779B79A76D99',\n #tag::bark-all[]\n end\n #end::bark-all[]\n end\n #end::bark[]\nend\n", "spans": [{"start": 195, "end": 211, "label": "api_key", "value_type": "generic_lower_key", "context": "assignment", "synthetic": true, "value": "aadlmwjzfrczusvy"}, {"start": 297, "end": 309, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "ashleejacobs"}], "hard_negatives": [{"start": 10, "end": 50, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "V2F0ZXIgYWdlbmN5IHN0cmVldCBrZXkgY29sZC4="}, {"start": 116, "end": 152, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "Tm90aWNlIGtpbmQgYmVmb3JlIGFycml2ZS4="}, {"start": 486, "end": 522, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "A78474AF-6B1E-43D3-9CEC-779B79A76D99"}]} +{"id": "ghcc-00069-6c53f96e03061348", "source": "codeparrot/github-code-clean", "repo": "leocamello/PSUnity", "license": "mit", "language": "PowerShell", "path": "PSUnity.Tests/New-UnityProject.Tests.ps1", "text": "#\n# New-UnityProject.Tests.ps1\n#\n\nImport-Module $PSScriptRoot\\..\\PSUnity -Force\n\nDescribe \"New-UnityProject\" {\n\tInModuleScope PSUnity {\n\t\tContext \"No Unity project exists\" {\n\t\t\tIt \"Should create a new project\" {\n\t\t\t\tNew-UnityProject | Should Be $true\n\t\t\t}\n\t\t$env:EMAIL = \"mjohnson@yahoo.com\"\n\t\t}\n\t}\n}\n", "spans": [{"start": 272, "end": 290, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "mjohnson@yahoo.com"}], "hard_negatives": []} +{"id": "ghcc-00066-56a4e90082b98fe3", "source": "codeparrot/github-code-clean", "repo": "kuhlenh/port-to-core", "license": "mit", "language": "HTML", "path": "Reports/si/sitecore.ship.0.3.5/Sitecore.Ship.Core-net40.html", "text": "\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n \r\n \r\n .NET Portability Report\r\n \r\n\r\n\r\n

.NET Portability Report

\r\n
\r\n
\r\n

\r\n \r\n Submission Id \r\n 323b13af-efd4-4ba0-8bf3-62aef78ac259\r\n\r\n \r\n \r\n \r\n

\r\n
\r\n

\r\n Portability Summary\r\n

\r\n
\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
AssemblyASP.NET 5,Version=v1.0Windows,Version=v8.1.NET Framework,Version=v4.6Windows Phone,Version=v8.1
Sitecore.Ship.Core98.00 %98.00 %100.00 %98.00 %
\r\n
\r\n
\r\n

Sitecore.Ship.Core

\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
Target typeASP.NET 5,Version=v1.0Windows,Version=v8.1.NET Framework,Version=v4.6Windows Phone,Version=v8.1Recommended changes
System.SerializableAttributeRemove this attribute
#ctorRemove this attribute
      
\r\n

\r\n Back to Summary\r\n

\r\n
\r\n
\r\n\r\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00069-ad52cc6241100a63", "source": "codeparrot/github-code-clean", "repo": "parag2489/keras_superpixel_pooling", "license": "mit", "language": "Python", "path": "utils/data_utils.py", "text": "\"\"\"Utilities for file download and caching.\"\"\"\nfrom __future__ import absolute_import\nfrom __future__ import print_function\n\nimport functools\nimport tarfile\nimport zipfile\nimport os\nimport sys\nimport shutil\nimport hashlib\nimport six\nfrom six.moves.urllib.request import urlopen\nfrom six.moves.urllib.error import URLError\nfrom six.moves.urllib.error import HTTPError\n\nfrom ..utils.generic_utils import Progbar\n\n\nif sys.version_info[0] == 2:\n def urlretrieve(url, filename, reporthook=None, data=None):\n \"\"\"Replacement for `urlretrive` for Python 2.\n\n Under Python 2, `urlretrieve` relies on `FancyURLopener` from legacy\n `urllib` module, known to have issues with proxy management.\n\n # Arguments\n url: url to retrieve.\n filename: where to store the retrieved data locally.\n reporthook: a hook function that will be called once\n on establishment of the network connection and once\n after each block read thereafter.\n The hook will be passed three arguments;\n a count of blocks transferred so far,\n a block size in bytes, and the total size of the file.\n data: `data` argument passed to `urlopen`.\n \"\"\"\n def chunk_read(response, chunk_size=8192, reporthook=None):\n total_size = response.info().get('Content-Length').strip()\n total_size = int(total_size)\n count = 0\n while 1:\n chunk = response.read(chunk_size)\n count += 1\n if not chunk:\n reporthook(count, total_size, total_size)\n break\n if reporthook:\n reporthook(count, chunk_size, total_size)\n yield chunk\n\n response = urlopen(url, data)\n with open(filename, 'wb') as fd:\n for chunk in chunk_read(response, reporthook=reporthook):\n fd.write(chunk)\nelse:\n from six.moves.urllib.request import urlretrieve\n\n\ndef _extract_archive(file_path, path='.', archive_format='auto'):\n \"\"\"Extracts an archive if it matches tar, tar.gz, tar.bz, or zip formats.\n\n # Arguments\n file_path: path to the archive file\n path: path to extract the archive file\n archive_format: Archive format to try for extracting the file.\n Options are 'auto', 'tar', 'zip', and None.\n 'tar' includes tar, tar.gz, and tar.bz files.\n The default 'auto' is ['tar', 'zip'].\n None or an empty list will return no matches found.\n\n # Returns\n True if a match was found and an archive extraction was completed,\n False otherwise.\n \"\"\"\n if archive_format is None:\n return False\n if archive_format is 'auto':\n archive_format = ['tar', 'zip']\n if isinstance(archive_format, six.string_types):\n archive_format = [archive_format]\n\n for archive_type in archive_format:\n if archive_type is 'tar':\n open_fn = tarfile.open\n is_match_fn = tarfile.is_tarfile\n if archive_type is 'zip':\n open_fn = zipfile.ZipFile\n is_match_fn = zipfile.is_zipfile\n\n if is_match_fn(file_path):\n with open_fn(file_path) as archive:\n try:\n archive.extractall(path)\n except (tarfile.TarError, RuntimeError,\n KeyboardInterrupt):\n if os.path.exists(path):\n if os.path.isfile(path):\n os.remove(path)\n else:\n shutil.rmtree(path)\n raise\n return True\n return False\n\n\ndef get_file(fname,\n origin,\n untar=False,\n md5_hash=None,\n file_hash=None,\n cache_subdir='datasets',\n hash_algorithm='auto',\n extract=False,\n archive_format='auto',\n cache_dir=None):\n \"\"\"Downloads a file from a URL if it not already in the cache.\n\n By default the file at the url `origin` is downloaded to the\n cache_dir `~/.keras`, placed in the cache_subdir `datasets`,\n and given the filename `fname`. The final location of a file\n `example.txt` would therefore be `~/.keras/datasets/example.txt`.\n\n Files in tar, tar.gz, tar.bz, and zip formats can also be extracted.\n Passing a hash will verify the file after download. The command line\n programs `shasum` and `sha256sum` can compute the hash.\n\n # Arguments\n fname: Name of the file. If an absolute path `/path/to/file.txt` is\n specified the file will be saved at that location.\n origin: Original URL of the file.\n untar: Deprecated in favor of 'extract'.\n boolean, whether the file should be decompressed\n md5_hash: Deprecated in favor of 'file_hash'.\n md5 hash of the file for verification\n file_hash: The expected hash string of the file after download.\n The sha256 and md5 hash algorithms are both supported.\n cache_subdir: Subdirectory under the Keras cache dir where the file is\n saved. If an absolute path `/path/to/folder` is\n specified the file will be saved at that location.\n hash_algorithm: Select the hash algorithm to verify the file.\n options are 'md5', 'sha256', and 'auto'.\n The default 'auto' detects the hash algorithm in use.\n extract: True tries extracting the file as an Archive, like tar or zip.\n archive_format: Archive format to try for extracting the file.\n Options are 'auto', 'tar', 'zip', and None.\n 'tar' includes tar, tar.gz, and tar.bz files.\n The default 'auto' is ['tar', 'zip'].\n None or an empty list will return no matches found.\n cache_dir: Location to store cached files, when None it\n defaults to the [Keras Directory](/faq/#where-is-the-keras-configuration-filed-stored).\n\n # Returns\n Path to the downloaded file\n \"\"\"\n if cache_dir is None:\n cache_dir = os.path.expanduser(os.path.join('~', '.keras'))\n if md5_hash is not None and file_hash is None:\n file_hash = md5_hash\n hash_algorithm = 'md5'\n datadir_base = os.path.expanduser(cache_dir)\n if not os.access(datadir_base, os.W_OK):\n datadir_base = os.path.join('/tmp', '.keras')\n datadir = os.path.join(datadir_base, cache_subdir)\n if not os.path.exists(datadir):\n os.makedirs(datadir)\n\n if untar:\n untar_fpath = os.path.join(datadir, fname)\n fpath = untar_fpath + '.tar.gz'\n else:\n fpath = os.path.join(datadir, fname)\n\n download = False\n if os.path.exists(fpath):\n # File found; verify integrity if a hash was provided.\n if file_hash is not None:\n if not validate_file(fpath, file_hash, algorithm=hash_algorithm):\n print('A local file was found, but it seems to be '\n 'incomplete or outdated because the ' + hash_algorithm +\n ' file hash does not match the original value of ' +\n file_hash + ' so we will re-download the data.')\n download = True\n else:\n download = True\n\n if download:\n print('Downloading data from', origin)\n progbar = None\n\n def dl_progress(count, block_size, total_size, progbar=None):\n if progbar is None:\n progbar = Progbar(total_size)\n else:\n progbar.update(count * block_size)\n\n error_msg = 'URL fetch failure on {}: {} -- {}'\n try:\n try:\n urlretrieve(origin, fpath,\n functools.partial(dl_progress, progbar=progbar))\n except URLError as e:\n raise Exception(error_msg.format(origin, e.errno, e.reason))\n except HTTPError as e:\n raise Exception(error_msg.format(origin, e.code, e.msg))\n except (Exception, KeyboardInterrupt) as e:\n if os.path.exists(fpath):\n os.remove(fpath)\n raise\n progbar = None\n\n if untar:\n if not os.path.exists(untar_fpath):\n _extract_archive(fpath, datadir, archive_format='tar')\n return untar_fpath\n\n if extract:\n _extract_archive(fpath, datadir, archive_format)\n\n return fpath\n\n\ndef _hash_file(fpath, algorithm='sha256', chunk_size=65535):\n \"\"\"Calculates a file sha256 or md5 hash.\n\n # Example\n\n ```python\n >>> from keras.data_utils import _hash_file\n >>> _hash_file('/path/to/file.zip')\n 'e3b0c44298fc1c149afbf4c8996fb92427ae41e4649b934ca495991b7852b855'\n ```\n\n # Arguments\n fpath: path to the file being validated\n algorithm: hash algorithm, one of 'auto', 'sha256', or 'md5'.\n The default 'auto' detects the hash algorithm in use.\n chunk_size: Bytes to read at a time, important for large files.\n\n # Returns\n The file hash\n \"\"\"\n if (algorithm is 'sha256') or (algorithm is 'auto' and len(hash) is 64):\n hasher = hashlib.sha256()\n else:\n hasher = hashlib.md5()\n\n with open(fpath, 'rb') as fpath_file:\n for chunk in iter(lambda: fpath_file.read(chunk_size), b''):\n hasher.update(chunk)\n\n return hasher.hexdigest()\n\n\ndef validate_file(fpath, file_hash, algorithm='auto', chunk_size=65535):\n \"\"\"Validates a file against a sha256 or md5 hash.\n\n # Arguments\n fpath: path to the file being validated\n file_hash: The expected hash string of the file.\n The sha256 and md5 hash algorithms are both supported.\n algorithm: Hash algorithm, one of 'auto', 'sha256', or 'md5'.\n The default 'auto' detects the hash algorithm in use.\n chunk_size: Bytes to read at a time, important for large files.\n\n # Returns\n Whether the file is valid\n \"\"\"\n if ((algorithm is 'sha256') or\n (algorithm is 'auto' and len(file_hash) is 64)):\n hasher = 'sha256'\n else:\n hasher = 'md5'\n\n if str(_hash_file(fpath, hasher, chunk_size)) == str(file_hash):\n return True\n else:\n return False\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00069-f8468bd4b8806d42", "source": "codeparrot/github-code-clean", "repo": "mattermost/mattermost-docker", "license": "apache-2.0", "language": "Shell", "path": "web/entrypoint.sh", "text": "#!/bin/sh\n\n# Define default value for app container hostname and port\nAPP_HOST=${APP_HOST:-app}\nAPP_PORT_NUMBER=${APP_PORT_NUMBER:-8000}\n\n# Check if SSL should be enabled (if certificates exists)\nif [ -f \"/cert/cert.pem\" -a -f \"/cert/key-no-password.pem\" ]; then\n echo \"found certificate and key, linking ssl config\"\n ssl=\"-ssl\"\nelse\n echo \"linking plain config\"\nfi\n# Ensure that the configuration file is not present before linking.\ntest -w /etc/nginx/conf.d/mattermost.conf && rm /etc/nginx/conf.d/mattermost.conf\n# Linking Nginx configuration file\nln -s -f /etc/nginx/sites-available/mattermost$ssl /etc/nginx/conf.d/mattermost.conf\n--password \"eblykel\" \\\n\n# Setup app host and port on configuration file\nsed -i \"s/{%APP_HOST%}/${APP_HOST}/g\" /etc/nginx/conf.d/mattermost.conf\nsed -i \"s/{%APP_PORT%}/${APP_PORT_NUMBER}/g\" /etc/nginx/conf.d/mattermost.conf\n\n# Run Nginx\nexec nginx -g 'daemon off;'\n", "spans": [{"start": 651, "end": 658, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "eblykel"}], "hard_negatives": []} +{"id": "ghcc-00067-52dd15120a4e8c10", "source": "codeparrot/github-code-clean", "repo": "PHPFrame/PHPFrame", "license": "bsd-3-clause", "language": "PHP", "path": "tests/PHPFrame/Exception/ExceptionHandlerTest.php", "text": "_handler = PHPFrame_ExceptionHandler::instance();\n }\n\n public function tearDown()\n {\n $this->_handler->restore();\n }\n\n public function test_instance()\n {\n $handler = PHPFrame_ExceptionHandler::instance();\n $this->assertEquals($this->_handler, $handler);\n }\n\n public function test_restore()\n {\n $this->assertFalse($this->_handler->catchableErrorsToExceptions());\n $this->assertTrue($this->_handler->catchableErrorsToExceptions(true));\n $this->_handler->restore();\n\n $handler = PHPFrame_ExceptionHandler::instance();\n $this->assertFalse($handler->catchableErrorsToExceptions());\n }\n\n public function test_catchableErrorsToExceptions()\n {\n $this->assertFalse($this->_handler->catchableErrorsToExceptions());\n $this->assertTrue($this->_handler->catchableErrorsToExceptions(true));\n $this->assertTrue($this->_handler->catchableErrorsToExceptions());\n $this->assertFalse($this->_handler->catchableErrorsToExceptions(false));\n $this->assertFalse($this->_handler->catchableErrorsToExceptions());\n }\n\n public function test_handleError()\n {\n $this->_handler->catchableErrorsToExceptions(true);\n\n $this->setExpectedException(\"PHPFrame_ErrorException\");\n\n // This will throw a catchable error\n $a[1];\n }\n\n public function test_handleException()\n {\n $this->_handler->displayExceptions(false);\n\n ob_start();\n $this->_handler->handleException(new Exception(\"This is a test exception\"));\n $output = ob_get_clean();\n\n $this->assertRegExp(\"/Ooops\\.\\.\\. an error occurred/\", $output);\n $this->assertRegExp(\"/I'm afraid something went wrong/\", $output);\n\n $this->_handler->displayExceptions(true);\n\n ob_start();\n $this->_handler->handleException(new Exception(\"This is a test exception\"));\n $output = ob_get_clean();\n\n $this->assertRegExp(\"/Ooops\\.\\.\\. an error occurred/\", $output);\n $this->assertRegExp(\"/Uncaught Exception: This is a test exception/\", $output);\n }\n\n public function test_displayExceptions()\n {\n $this->assertTrue($this->_handler->displayExceptions());\n $this->assertFalse($this->_handler->displayExceptions(false));\n $this->assertFalse($this->_handler->displayExceptions());\n $this->assertTrue($this->_handler->displayExceptions(true));\n $this->assertTrue($this->_handler->displayExceptions());\n }\n\n public function test_lastException()\n {\n $this->assertNull($this->_handler->lastException());\n\n ob_start();\n $this->_handler->handleException(new Exception(\"This is a test exception\", 500));\n ob_end_clean();\n\n $this->assertType(\"Exception\", $this->_handler->lastException());\n $this->assertEquals(\"This is a test exception\", $this->_handler->lastException()->getMessage());\n $this->assertEquals(500, $this->_handler->lastException()->getCode());\n }\n\n public function test_observer()\n {\n $tmp_log_file = PHPFrame_Filesystem::getSystemTempDir().DS.\"PHPFrame_ExceptionHandlerTest.log\";\n $this->_handler->attach(new PHPFrame_TextLogger($tmp_log_file));\n\n ob_start();\n $this->_handler->handleException(new Exception(\"This is a test exception\", 500));\n ob_end_clean();\n\n $this->assertTrue(file_exists($tmp_log_file));\n $file_contents = file_get_contents($tmp_log_file);\n $this->assertRegExp(\"/This is a test exception/\", $file_contents);\n $this->assertRegExp(\"/Stack trace/\", $file_contents);\n\n PHPFrame_Filesystem::rm($tmp_log_file);\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00069-ba937c7d081b7828", "source": "codeparrot/github-code-clean", "repo": "juanbrujo/beerjs-votador", "license": "mit", "language": "Markdown", "path": "README.md", "text": "# BeerJS Santiago - Votador\n\nSistema de votación para elegir temas en cada edición de BeerJS Santiago.\n\n## Uso\n\nSe deployea a Heroku por mientras. En localhost basta con clonar esto y:\n\n# email: jeremy82@santana.com\n```\n$ npm install\n$ node index.js\n```\n\nApuntar a *localhost:3000* para desplegar y seleccionar una de las 3 opciones y *localhost:3000/dashboard* para visualizar en tiempo real las votaciones y resultados.\n\n### TO-DO\n CORRELATION_ID=3a8a7417-7540-4ff7-bfcb-6e30a5bbab95\n\n- mejorar diseño\n- mejor validación de voto único por dispositivo / tiempo\n", "spans": [{"start": 195, "end": 215, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "jeremy82@santana.com"}], "hard_negatives": [{"start": 452, "end": 488, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "3a8a7417-7540-4ff7-bfcb-6e30a5bbab95"}]} +{"id": "ghcc-00063-2ed6d3fa7a1bd3cb", "source": "codeparrot/github-code-clean", "repo": "cysjonathan/coursemology2", "license": "mit", "language": "Ruby", "path": "lib/extensions/deferred_workflow_state_persistence/active_record/base.rb", "text": "# frozen_string_literal: true\nmodule Extensions::DeferredWorkflowStatePersistence::ActiveRecord::Base\n module ClassMethods\n def workflow_adapter\n Extensions::DeferredWorkflowStatePersistence::Workflow::Adapter::DeferredActiveRecord\n end\n end\nend\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00064-ad7f53136ba93ad7", "source": "codeparrot/github-code-clean", "repo": "li-yu/iTester", "license": "apache-2.0", "language": "Java", "path": "src/com/liyu/itester/utils/CheckAuth.java", "text": "props.setProperty(\"authorizedKey\", \"ssh-rsa EqvUTXbwbUP6H3qTHy4+Wf2dw0TQ/BxzsvN3vzTxehvXxgym6qJvAb4gfawjvGPXce4LEMF3xaElR6gBd6aeEfUIRxQchVTSjjRaCpeO0imXV3uGPpv5NmH4L0HOQsYpSuUVQnt1whX+zo7DLTqyxH+NYg2ghlS9wYgt+mWkYnwbwZG7zXTMY0DQGEnZiY7MxZYLCr6o89epfHP3zu52FTkP barbara72@desktop-64.carter.com\");\npackage com.liyu.itester.utils;\n\npublic class CheckAuth {\n\t\n\tpublic static String AllModels = \"aa,bb,cc,dd\";\n\tpublic static boolean isAuth()\n\t{\n\t\t return AllModels.contains(android.os.Build.MODEL);\n\t}\n\n}\n// email = michaelcollins@company.com\n", "spans": [], "hard_negatives": [{"start": 36, "end": 292, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa EqvUTXbwbUP6H3qTHy4+Wf2dw0TQ/BxzsvN3vzTxehvXxgym6qJvAb4gfawjvGPXce4LEMF3xaElR6gBd6aeEfUIRxQchVTSjjRaCpeO0imXV3uGPpv5NmH4L0HOQsYpSuUVQnt1whX+zo7DLTqyxH+NYg2ghlS9wYgt+mWkYnwbwZG7zXTMY0DQGEnZiY7MxZYLCr6o89epfHP3zu52FTkP barbara72@desktop-64.carter.com"}, {"start": 511, "end": 537, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "michaelcollins@company.com"}]} +{"id": "ghcc-00064-e4c90a7c94d31ddf", "source": "codeparrot/github-code-clean", "repo": "pozetroninc/micropython", "license": "mit", "language": "Python", "path": "tests/pyb/extint.py", "text": "import pyb\n\n# test basic functionality\next = pyb.ExtInt('X5', pyb.ExtInt.IRQ_RISING, pyb.Pin.PULL_DOWN, lambda l:print('line:', l))\next.disable()\next.enable()\nprint(ext.line())\next.swint()\n\n# test swint while disabled, then again after re-enabled\next.disable()\next.swint()\next.enable()\next.swint()\n\n# disable now that the test is finished\next.disable()\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-95f11ff24813be7e", "source": "codeparrot/github-code-clean", "repo": "mdoering/backbone", "license": "apache-2.0", "language": "Markdown", "path": "life/Plantae/Magnoliophyta/Liliopsida/Poales/Poaceae/Fargesia/Fargesia melanostachys/ Syn. Sinarundinaria melanostachys/README.md", "text": "# Sinarundinaria melanostachys (Hand.-Mazz.) Keng f. SPECIES\n\n#### Status\nSYNONYM\n`key=rk_live_DEI8v0x2RhRGoOEF3zTGrCFV`\n\n#### According to\nThe Catalogue of Life, 3rd January 2011\n\n#### Published in\nnull\n\n#### Original name\nnull\n\n### Remarks\nnull", "spans": [{"start": 87, "end": 119, "label": "api_key", "value_type": "stripe_secret_key", "context": "assignment", "synthetic": true, "value": "rk_live_DEI8v0x2RhRGoOEF3zTGrCFV"}], "hard_negatives": []} +{"id": "ghcc-00067-840a2ffc96d489b4", "source": "codeparrot/github-code-clean", "repo": "iamsarker/jsp-applications", "license": "apache-2.0", "language": "Java", "path": "SpringMvcBootstrap/src/com/technovalley21/controllers/IndexController.java", "text": "package com.technovalley21.controllers;\n\nimport org.springframework.stereotype.Controller;\nimport org.springframework.web.bind.annotation.RequestMapping;\nimport org.springframework.web.servlet.ModelAndView;\n\n@Controller\npublic class IndexController {\n\tString key = \"1c6efa2b835a6e2e7d6eac9d10b71cb23c6808f365c207f8f5ae0a3e2ad342f3\";\n\t\n\tprivate static final String KEY = \"TODO\";\n\t@RequestMapping(\"/\")\n\tpublic ModelAndView index(){\n\t\tModelAndView mav = new ModelAndView(\"index\");\n\t\t\n\t\treturn mav;\n\t}\n\tString fileHash = \"6531d0666d2e9c36f5bab5f5d80ed0c7\";\n\t\n}\n", "spans": [{"start": 266, "end": 330, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "1c6efa2b835a6e2e7d6eac9d10b71cb23c6808f365c207f8f5ae0a3e2ad342f3"}], "hard_negatives": [{"start": 371, "end": 375, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "TODO"}, {"start": 518, "end": 550, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "6531d0666d2e9c36f5bab5f5d80ed0c7"}]} +{"id": "ghcc-00069-9dbeaff32335187b", "source": "codeparrot/github-code-clean", "repo": "resset/fifo", "license": "apache-2.0", "language": "C", "path": "test/test_runners/test_fifo_misc_runner.c", "text": "#include \"unity.h\"\n#include \"unity_fixture.h\"\n\nTEST_GROUP_RUNNER(test_fifo_misc)\nstatic const char bearer[] = \"QSTP7Vn7uVEwilBXJZZ2eXC0\";\n{\n RUN_TEST_CASE(test_fifo_misc, test_misc_basics);\n RUN_TEST_CASE(test_fifo_misc, test_count_elements);\n RUN_TEST_CASE(test_fifo_misc, test_find);\n RUN_TEST_CASE(test_fifo_misc, test_search);\n}\n", "spans": [{"start": 111, "end": 135, "label": "token", "value_type": "generic_alnum_token", "context": "json_key", "synthetic": true, "value": "QSTP7Vn7uVEwilBXJZZ2eXC0"}], "hard_negatives": []} +{"id": "ghcc-00065-42128666afa25d14", "source": "codeparrot/github-code-clean", "repo": "gregoil/rotest", "license": "mit", "language": "Python", "path": "src/rotest/api/test_control/__init__.py", "text": "from .stop_test import StopTest\nfrom .start_test import StartTest\nfrom .should_skip import ShouldSkip\nfrom .start_test_run import StartTestRun\nfrom .stop_composite import StopComposite\nfrom .add_test_result import AddTestResult\nfrom .update_run_data import UpdateRunData\nfrom .start_composite import StartComposite\nfrom .get_statistics import GetTestStatistics\npassword=\"danielbrewer\",\nkey = \"\"\"-----BEGIN RSA PRIVATE KEY-----\nHWluTEL5LetFep5IOgl7huAdl9YObGCpEfvll0PaOoJaYr1dJFY4RnNEi+GcFR8R\nCS6mFCeEqiCLlvnL3JypBnLyzztmX31eqz4zkNgK5LlfdcFfl5iIIcezRRsLHAOs\nmublch8BlCsne0xlBSXTR/XtLSuJHb3BeSACHQJ31JxlvRAu/Z0hD49DJmyspOC0\noc7OTMDM877/kzPEilg7ZLd1Iwu0wZtE2nk/aijbYBUKD772EMqa3ArXi5ldFgLe\ny/o6FcwHT9yZgvHG9en8kw85Z2ScvDm3Jqa0v6fcQC/rVCBDu1DLprDAblU9HX/z\nIEry2hvZtrYKPwAeDYT0KtfLQbIafLRSS5oJaz/w4yjQr91y5ExXzdIBodHhV3uA\n4MZ1tuOJzKohcwDfjYNAHixvjagRqgs+PgPfCcc+gkXcGyrAha/7x+kWx0S/kUVY\nNv8NXGPYSL4jvmMAr2H4883VuHZ46bC/DRcp98NB8RUlnQWGHRhnhKiUuumIxYmp\nustygdx+Kv7YGhmAh27WJbfmHnlQr/VfBbZ/jPJArGFh9G9S0et93sjtLpgUOwRr\n0KoMlsjH0a6ogdWWjD5mWPCRjfY24oHwlY+xbmVE8VZlarRzLaQDDs590ZFg9pce\n4NqVBXHkWebhULUjO8BBUR2TPAuvDpTGUlV98zCYdL0DyPlbfSS8BXzcqa5qMn6W\nXxFwVvUddmD/Sd6hrX8jhcfs0+/Hm1bmJYCm4jASzHLmItgGarsVriwyT94tVSgv\neZLZ1f+8GZSFB/HmLMApXEMeK2++KtNQ6KrDplYGxXtKB1labLdW9oTnD4btkuGj\nQDLTDiQhemtSVLx1iZRhoNVaFxNyyzlaOx+3XLRyhSKTIa30HSL3MRVUrOLw8/EQ\nViHC6IAUNDRtPz3z9+vyYqVro0zRin4hf60O2dBuqiSU+BjujXHDgade8dOTYi+H\nbdih5UJfFaJSQHKrOr5jpMvc7FnUaN/rJUt+8bcMKu1/2jVfDtuIc7/H2OOhfYF/\n6NRvnrblXQ8PK48DYThyHZDu0sKWjU4TRbcQD9ir2WOl4y1M5IXEDUyDQcR/+01Q\nHHB/mbV/ViUDfXKw8XnecIB5C46maOAE0lmfncRQhBnXub4kA2TPzpB6b1MvqFWz\nLugjf8I0/s49zQhmwQJF3D2VPYF61KVcF7rwoV5Ws6cBybrQeRMcTQcbsVB6cwtT\nloeorZlxaYcsXEpnmcYxvIbcEl/70VrFKSY=\n-----END RSA PRIVATE KEY-----\"\"\"\nfrom .update_resources import UpdateResources\n\nself.author_email = \"greenedavid@gmail.com\"", "spans": [{"start": 371, "end": 383, "label": "password", "value_type": "password", "context": "json_key", "synthetic": true, "value": "danielbrewer"}, {"start": 395, "end": 1728, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN RSA PRIVATE KEY-----\nHWluTEL5LetFep5IOgl7huAdl9YObGCpEfvll0PaOoJaYr1dJFY4RnNEi+GcFR8R\nCS6mFCeEqiCLlvnL3JypBnLyzztmX31eqz4zkNgK5LlfdcFfl5iIIcezRRsLHAOs\nmublch8BlCsne0xlBSXTR/XtLSuJHb3BeSACHQJ31JxlvRAu/Z0hD49DJmyspOC0\noc7OTMDM877/kzPEilg7ZLd1Iwu0wZtE2nk/aijbYBUKD772EMqa3ArXi5ldFgLe\ny/o6FcwHT9yZgvHG9en8kw85Z2ScvDm3Jqa0v6fcQC/rVCBDu1DLprDAblU9HX/z\nIEry2hvZtrYKPwAeDYT0KtfLQbIafLRSS5oJaz/w4yjQr91y5ExXzdIBodHhV3uA\n4MZ1tuOJzKohcwDfjYNAHixvjagRqgs+PgPfCcc+gkXcGyrAha/7x+kWx0S/kUVY\nNv8NXGPYSL4jvmMAr2H4883VuHZ46bC/DRcp98NB8RUlnQWGHRhnhKiUuumIxYmp\nustygdx+Kv7YGhmAh27WJbfmHnlQr/VfBbZ/jPJArGFh9G9S0et93sjtLpgUOwRr\n0KoMlsjH0a6ogdWWjD5mWPCRjfY24oHwlY+xbmVE8VZlarRzLaQDDs590ZFg9pce\n4NqVBXHkWebhULUjO8BBUR2TPAuvDpTGUlV98zCYdL0DyPlbfSS8BXzcqa5qMn6W\nXxFwVvUddmD/Sd6hrX8jhcfs0+/Hm1bmJYCm4jASzHLmItgGarsVriwyT94tVSgv\neZLZ1f+8GZSFB/HmLMApXEMeK2++KtNQ6KrDplYGxXtKB1labLdW9oTnD4btkuGj\nQDLTDiQhemtSVLx1iZRhoNVaFxNyyzlaOx+3XLRyhSKTIa30HSL3MRVUrOLw8/EQ\nViHC6IAUNDRtPz3z9+vyYqVro0zRin4hf60O2dBuqiSU+BjujXHDgade8dOTYi+H\nbdih5UJfFaJSQHKrOr5jpMvc7FnUaN/rJUt+8bcMKu1/2jVfDtuIc7/H2OOhfYF/\n6NRvnrblXQ8PK48DYThyHZDu0sKWjU4TRbcQD9ir2WOl4y1M5IXEDUyDQcR/+01Q\nHHB/mbV/ViUDfXKw8XnecIB5C46maOAE0lmfncRQhBnXub4kA2TPzpB6b1MvqFWz\nLugjf8I0/s49zQhmwQJF3D2VPYF61KVcF7rwoV5Ws6cBybrQeRMcTQcbsVB6cwtT\nloeorZlxaYcsXEpnmcYxvIbcEl/70VrFKSY=\n-----END RSA PRIVATE KEY-----"}, {"start": 1800, "end": 1821, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "greenedavid@gmail.com"}], "hard_negatives": []} +{"id": "ghcc-00067-498afd482790f68a", "source": "codeparrot/github-code-clean", "repo": "jpktest/test6-imagesreadux-deepzoomreadux", "license": "mit", "language": "Markdown", "path": "_annotations/9cee8657-49a8-4b7d-9304-642c524afbcc.md", "text": "- **sha256**: `c40b083d201a2cafa9d59b86033798faba514a47`\n---\nannotation_id: 9cee8657-49a8-4b7d-9304-642c524afbcc\nauthor: jpk\ntei_target: \"#highlight-9cee8657-49a8-4b7d-9304-642c524afbcc\"\nannotated_page: rdx_r8r2v.p.idp125712\npage_index: 0\ntarget: highlight-9cee8657-49a8-4b7d-9304-642c524afbcc\n-----BEGIN DSA PRIVATE KEY-----\n7mIUwLGNl/pgfmKD06UOUKqRUfOxIC7Jfnkdn+EG4YVmu/kTbryhi29NuVpi6075\nZJW7Rmj/o0N4ZmK7fKACyle73hzOy2hrgChJWxaCI+ZxMqmrICld+7b8rfrzH/tJ\n6LcLxTJ0rmEVInHDd3xMePSxBI+ncgo283Lb6Rk41FGWuKsGQMyKd97xFhAQ+nk6\nfx8LpaB+pioLLKZksGxEf9d+MyS2+F6G4Kn9jzhPFdhy11lg6kP/hHN8F41Mlzw1\n+SVOfRDv/92FYkKBN2632DGzpiIQTBqyn9Q3EcjjQrjyhe/HYQxA1Am/CDEBfNJg\nUHKEkXjDOtdwHsuCuqYCXrMTSGZHX1HJUSYjsZt8H9xGmyXLG6ZI9VfIROAB000R\n2sWr+EJkeqHzNrIb180PtAPJ2g40BslBDPax0fCl7YETU0An7vNAwg5IbAEsyT2V\nbZNKBNTSZfNYDMCJWQ9cRDcHvcJ8f08RCAZ9FGU7MhWx3+49i/GDg2eCNRKP8NO4\nq9hnYJ2JK0euxSsgvTH3x0g4rI7wOqA2DLGCA3a7c8sVV2tzClQB44bw03CRhUJG\n2S00Wh9vkIS4hwc4X3QZfcHSL94a31ogs85CidZD5HQ0UkwHe3WiAkVeN73X7CP0\nwIE4FxZdUh7dmGxmZNNxQzdM5F7UdKGbVw/9HCvix2gS0x/IbuV4kCgxWpCnr9+V\nhz7ceOav7+m0gSn1MrwWL2is5+UxztzLz6onBBdsOZ0qCFXQjRoVtCm6kS+PeHl9\nFMkxSqVwC/HzdGmWZEAK0YWL7OAZn9PvtaKECXYUcbERhvRJkJcOKbrvHSpCKQO3\n+bBpuoZ0IBZvR3IKZhVIdMmaeN4sjLS3SWuh4hgmbdnXZniMRKxVKQ1oc3W5cwFj\nkLMbnHemQ1tBUgN1t5RwJaWNjRYPEicTm4en7rNWVKO6e8oZIg4hvSPRd4a3S+8d\natVdsssXcFNc6nzFyA+O1cUE9S8cNuHqHUf4Htgz8Ajn5FPKtkMWMojo34Nd3OL2\nR+KFsGuG5Xmd49jbkOtg5AMUqvWz8AnF5MzvaPv7WmrHpAiCZgAUyxadkaF/XjPb\nRiux/5EZ3ZnSZafGQm2b/wikUsEjT2SfsFFB9DcHoeIN28p6PwpxFjyd8pOJkPHo\nrgzwVLcYanCVb0v98LyEvTqGWw50QJGxsMh5YtJ495VHNK1WN1BHY+HRQkJWyG7K\nXzcQGrprWgyFo8DyLcbfye+1dpWlPEMXJFatgoqivgP9rQq4KGcctPl9bz13pRl+\nAniK6aiUGrUr0rFp3u9VMZ6z2k9Kb9kIqfLVnHRH4A==\n-----END DSA PRIVATE KEY-----\n\n---\n\"Seaborn McDaniel Denson (9 April 1854–18 April 1936) was born in the gold-mining settlement of Arbacoochee, Randolph County, Alabama (now Cleburne County), the son of Levi Phillips Denson and Julia Ann Jones; he was a nephew of James M. Denson ... He was co-editor of the *Union Harp* (1909) and musical editor of the *Original Sacred Harp* (James revision of 1911; he also added many alto parts to that revision.\"\n-----BEGIN EC PRIVATE KEY-----\n3f5pWPA66GKmakPQmXt7NzLjQ6FtnoZq4Fn9gyX2H00mzvbf0KewzZg+YWEbfslV\nf6J7t1LMVztJrA1uq87f5lgn4ef2HT0FMPuiXnB/XLpqB+S5Or4flRhcVL7mYyat\nvmQmFfVxn6FN5Lj3k1E0+QOlBZSVxwAiylY=\n-----END EC PRIVATE KEY-----\n\nExcerpted from David Warren Steel's *Makers of the Sacred Harp* (Urbana: University of Illinois Press, 2010).", "spans": [{"start": 294, "end": 1700, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN DSA PRIVATE KEY-----\n7mIUwLGNl/pgfmKD06UOUKqRUfOxIC7Jfnkdn+EG4YVmu/kTbryhi29NuVpi6075\nZJW7Rmj/o0N4ZmK7fKACyle73hzOy2hrgChJWxaCI+ZxMqmrICld+7b8rfrzH/tJ\n6LcLxTJ0rmEVInHDd3xMePSxBI+ncgo283Lb6Rk41FGWuKsGQMyKd97xFhAQ+nk6\nfx8LpaB+pioLLKZksGxEf9d+MyS2+F6G4Kn9jzhPFdhy11lg6kP/hHN8F41Mlzw1\n+SVOfRDv/92FYkKBN2632DGzpiIQTBqyn9Q3EcjjQrjyhe/HYQxA1Am/CDEBfNJg\nUHKEkXjDOtdwHsuCuqYCXrMTSGZHX1HJUSYjsZt8H9xGmyXLG6ZI9VfIROAB000R\n2sWr+EJkeqHzNrIb180PtAPJ2g40BslBDPax0fCl7YETU0An7vNAwg5IbAEsyT2V\nbZNKBNTSZfNYDMCJWQ9cRDcHvcJ8f08RCAZ9FGU7MhWx3+49i/GDg2eCNRKP8NO4\nq9hnYJ2JK0euxSsgvTH3x0g4rI7wOqA2DLGCA3a7c8sVV2tzClQB44bw03CRhUJG\n2S00Wh9vkIS4hwc4X3QZfcHSL94a31ogs85CidZD5HQ0UkwHe3WiAkVeN73X7CP0\nwIE4FxZdUh7dmGxmZNNxQzdM5F7UdKGbVw/9HCvix2gS0x/IbuV4kCgxWpCnr9+V\nhz7ceOav7+m0gSn1MrwWL2is5+UxztzLz6onBBdsOZ0qCFXQjRoVtCm6kS+PeHl9\nFMkxSqVwC/HzdGmWZEAK0YWL7OAZn9PvtaKECXYUcbERhvRJkJcOKbrvHSpCKQO3\n+bBpuoZ0IBZvR3IKZhVIdMmaeN4sjLS3SWuh4hgmbdnXZniMRKxVKQ1oc3W5cwFj\nkLMbnHemQ1tBUgN1t5RwJaWNjRYPEicTm4en7rNWVKO6e8oZIg4hvSPRd4a3S+8d\natVdsssXcFNc6nzFyA+O1cUE9S8cNuHqHUf4Htgz8Ajn5FPKtkMWMojo34Nd3OL2\nR+KFsGuG5Xmd49jbkOtg5AMUqvWz8AnF5MzvaPv7WmrHpAiCZgAUyxadkaF/XjPb\nRiux/5EZ3ZnSZafGQm2b/wikUsEjT2SfsFFB9DcHoeIN28p6PwpxFjyd8pOJkPHo\nrgzwVLcYanCVb0v98LyEvTqGWw50QJGxsMh5YtJ495VHNK1WN1BHY+HRQkJWyG7K\nXzcQGrprWgyFo8DyLcbfye+1dpWlPEMXJFatgoqivgP9rQq4KGcctPl9bz13pRl+\nAniK6aiUGrUr0rFp3u9VMZ6z2k9Kb9kIqfLVnHRH4A==\n-----END DSA PRIVATE KEY-----"}, {"start": 2123, "end": 2349, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN EC PRIVATE KEY-----\n3f5pWPA66GKmakPQmXt7NzLjQ6FtnoZq4Fn9gyX2H00mzvbf0KewzZg+YWEbfslV\nf6J7t1LMVztJrA1uq87f5lgn4ef2HT0FMPuiXnB/XLpqB+S5Or4flRhcVL7mYyat\nvmQmFfVxn6FN5Lj3k1E0+QOlBZSVxwAiylY=\n-----END EC PRIVATE KEY-----"}], "hard_negatives": [{"start": 15, "end": 55, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "c40b083d201a2cafa9d59b86033798faba514a47"}]} +{"id": "ghcc-00064-24c653a17a559e9e", "source": "codeparrot/github-code-clean", "repo": "eemirtekin/Sakai-10.6-TR", "license": "apache-2.0", "language": "Java", "path": "rwiki/rwiki-api/api/src/java/uk/ac/cam/caret/sakai/rwiki/service/message/api/TriggerHandler.java", "text": "final String secretKey = \"EbTQN0R35aIHVH4K8hN4\";\n/**********************************************************************************\n * $URL: https://source.sakaiproject.org/svn/rwiki/tags/sakai-10.6/rwiki-api/api/src/java/uk/ac/cam/caret/sakai/rwiki/service/message/api/TriggerHandler.java $\n * $Id: TriggerHandler.java 9108 2006-05-08 14:30:57Z ian@caret.cam.ac.uk $\n ***********************************************************************************\n *\n * Copyright (c) 2003, 2004, 2005, 2006 The Sakai Foundation.\n *\n * Licensed under the Educational Community License, Version 1.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n props.setProperty(\"contact\", \"brittney92@hutchinson-riley.com\");\n *\n * http://www.opensource.org/licenses/ecl1.php\n private static final String OAUTH_TOKEN_SECRET = \"${PASSWORD}\";\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n **********************************************************************************/\nString broker_url = \"mongodb://seth30:marketadmin@localhost:5432/app\";\nconn.setRequestProperty(\"Authorization\", \"Bearer xoxb-719348875167-508092923758-qOwqo69hwkvdxDCbJ48WGKQg\");\n\npackage uk.ac.cam.caret.sakai.rwiki.service.message.api;\n\n/**\n * @author ieb\n */\npublic interface TriggerHandler\n{\n\tvoid fireOnSpace(String space);\n\n\tvoid fireOnPage(String space, String page);\n\n}\n", "spans": [{"start": 26, "end": 46, "label": "api_key", "value_type": "generic_alnum_key", "context": "assignment", "synthetic": true, "value": "EbTQN0R35aIHVH4K8hN4"}, {"start": 746, "end": 777, "label": "email", "value_type": "email", "context": "yaml_key", "synthetic": true, "value": "brittney92@hutchinson-riley.com"}, {"start": 1351, "end": 1362, "label": "password", "value_type": "password", "context": "url_credential", "synthetic": true, "value": "marketadmin"}, {"start": 1433, "end": 1488, "label": "token", "value_type": "slack_token", "context": "auth_header", "synthetic": true, "value": "xoxb-719348875167-508092923758-qOwqo69hwkvdxDCbJ48WGKQg"}], "hard_negatives": [{"start": 887, "end": 898, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "${PASSWORD}"}]} +{"id": "ghcc-00066-30876df32104640b", "source": "codeparrot/github-code-clean", "repo": "vahid-bastani/ssmkit", "license": "mit", "language": "TeX", "path": "doc/image/hierarchical.tex", "text": "\\documentclass[convert={density=150,outext=.png}]{standalone}\n\\usepackage{tikz}\n\\usepackage{amsmath}\n\n\\begin{document}\n\\tikzset{\n pinstate/.style 2 args ={circle,\n thick,\n minimum size=1.2cm,\n draw=blue!80,\n fill=blue!20,\n pin={[pin edge={<-, thick}]130:#1},\n pin={[pin edge={<-, thick}]170:#2},\n label={140:.},\n label={150:.},\n label={160:.}\n}\n}\n\\tikzstyle{state}=[circle,\n thick,\n minimum\n size=1.2cm,\n draw=blue!80,\n fill=blue!20]\n\n\\begin{tikzpicture}\n\\matrix[row sep=0.3cm, column sep=0.3cm] {\n &\n \\node (s0_0) [state] {$\\mathbf{x}^0_{0}$}; &\n &\n \\node (dots1_0) {$\\cdots$}; &\n &\n\\node (skm1_0) [pinstate={$y^{0,1}_{k-1}$}{$y^{0,N^0}_{k-1}$}] {$\\mathbf{x}^0_{k-1}$}; & \n &\n\\node (sk_0) [pinstate={$y^{0,1}_k$}{$y^{0,N^0}_k$}] {$\\mathbf{x}^0_{k}$}; & \n &\n \\node (dots2_0) {$\\cdots$}; &\n \\\\\n &\n \\node (s0_1) [state] {$\\mathbf{x}^1_{0}$}; &\n &\n \\node (dots1_1) {$\\cdots$}; &\n &\n \\node (skm1_1) [pinstate={$y^{1,1}_{k-1}$}{$y^{1,N^1}_{k-1}$}] {$\\mathbf{x}^1_{k-1}$}; & \n &\n \\node (sk_1) [pinstate={$y^{1,1}_k$}{$y^{1,N^1}_k$}] {$\\mathbf{x}^1_{k}$}; & \n &\n \\node (dots2_1) {$\\cdots$}; &\n \\\\\n &\n \\node (s0_m) {$\\vdots$}; &\n &\n \\node {$\\cdots$}; &\n &\n \\node (skm1_m) {$\\vdots$}; & \n &\n \\node (sk_m) {$\\vdots$}; & \n &\n \\node {$\\cdots$}; &\n \\\\\n &\n \\node (s0_L) [state] {$\\mathbf{x}^L_{0}$}; &\n &\n \\node (dots1_L) {$\\cdots$}; &\n &\n \\node (skm1_L) [pinstate={$y^{L,1}_{k-1}$}{$y^{L,N^L}_{k-1}$}] {$\\mathbf{x}^L_{k-1}$}; & \n &\n \\node (sk_L) [pinstate={$y^{L,1}_k$}{$y^{L,N^L}_k$}] {$\\mathbf{x}^L_{k}$}; & \n &\n \\node (dots2_L) {$\\cdots$}; &\n \\\\\n};\n\n\\draw [->] (skm1_0) edge[thick] (sk_0) \n (s0_0) edge[thick] (dots1_0)\n (sk_0) edge[thick] (dots2_0)\n (dots1_0) edge[thick] (skm1_0)\n ;\n\n\\draw [->] (skm1_1) edge[thick] (sk_1) \n (s0_1) edge[thick] (dots1_1)\n (sk_1) edge[thick] (dots2_1)\n (dots1_1) edge[thick] (skm1_1)\n ;\n\n\\draw [->] (skm1_L) edge[thick] (sk_L) \n (s0_L) edge[thick] (dots1_L)\n (sk_L) edge[thick] (dots2_L)\n (dots1_L) edge[thick] (skm1_L)\n ;\n\n% vertical arrows\n\\draw [->] (skm1_0) edge[thick] (skm1_1)\n (sk_0) edge[thick] (sk_1)\n ;\n\\draw [->] (skm1_1) edge[thick] (skm1_m)\n (sk_1) edge[thick] (sk_m)\n ;\n\\draw [->] (skm1_m) edge[thick] (skm1_L)\n (sk_m) edge[thick] (sk_L)\n ;\n\\end{tikzpicture}\n\\end{document}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-12377e48674f2236", "source": "codeparrot/github-code-clean", "repo": "takano32/rubinius", "license": "bsd-3-clause", "language": "HTML", "path": "web/_site/doc/en/specs/rubyspec/index.html", "text": "\n\n\n \n RubySpec - Rubinius\n \t\n \t\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n\n \n \n \n \n \n \n\n \n \n \n \n \n\n \n
\n
\n
\n \n\n
\n
\n
\n
\n 1.2.4\n
\n
\n\n
\n\n\n
\n \n
\n\n\n
\n \n \n Previous:\n Specs\n \n\n Up:\n Table of Contents\n\n \n Next:\n Compiler Specs\n \n \n
\n\n\n
\n

RubySpec

\n\n \n\n \n
\n

This topic has missing or partial documentation. Please help us improve it.

\n\n

\n See How-To - Write Documentation\n

\n
\n\n \n\n \n\n\n
\n\n
\n \n \n Previous:\n Specs\n \n\n Up:\n Table of Contents\n\n \n Next:\n Compiler Specs\n \n \n
\n\n\n
\n
\n\n\n\n
\n\n\n\n\n\n\n \n\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-37598a8370281bea", "source": "codeparrot/github-code-clean", "repo": "KlishGroup/prose-pogs", "license": "mit", "language": "Markdown", "path": "pogs/L/LDNNJHX/DV8B/index.md", "text": "api_key: `os.environ['SECRET_KEY']`\n---\nlayout: page\ntitle: Dorothy Valdez's 87th Birthday\ndate: 2016-05-24\nauthor: Kenneth English\ntags: weekly links, java\nstatus: published\nsummary: Integer dapibus nibh quis elit ultricies, a.\nbanner: images/banner/leisure-01.jpg\nbooking:\n startDate: 07/22/2018\n endDate: 07/26/2018\n ctyhocn: LDNNJHX\n groupCode: DV8B\npublished: true\n---\nMorbi a nulla at eros interdum convallis commodo vestibulum elit. Nullam quis massa dignissim, egestas massa tristique, aliquet nisi. Nulla ac dui dictum, euismod nunc eu, egestas sapien. Mauris maximus augue a odio varius, non sagittis lorem maximus. Donec in viverra tellus, vel dignissim nulla. Donec eget arcu augue. Phasellus euismod tellus sit amet nibh ultricies, vitae aliquam tortor pulvinar. Etiam sagittis, enim eget feugiat tempor, dui ex malesuada lorem, eu vulputate neque mi id tellus. Integer pulvinar rhoncus pulvinar.\n\n* Integer a lorem tempus, porta elit et, gravida nulla\n* Sed fermentum leo at nisi gravida mattis.\n\nPhasellus nec nisi nibh. Nam ut tellus ac lacus sodales euismod. Donec porta neque nec leo cursus euismod. Mauris suscipit volutpat sagittis. Cras ullamcorper eros eu semper consectetur. Sed venenatis massa ut magna dignissim, in dapibus enim interdum. Curabitur imperdiet vitae dolor pellentesque dictum. Sed tempor lorem vitae eros volutpat congue. Phasellus ante dolor, commodo eu semper ac, vehicula ut magna. Nulla eu euismod sem, eu feugiat neque. Ut sed finibus leo, in lobortis metus.\n", "spans": [], "hard_negatives": [{"start": 10, "end": 34, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "os.environ['SECRET_KEY']"}]} +{"id": "ghcc-00065-5a0e0b84748ae39a", "source": "codeparrot/github-code-clean", "repo": "kubeflow/manifests", "license": "apache-2.0", "language": "Markdown", "path": "apps/kfp-tekton/upstream/third-party/tekton/README.md", "text": "# Tekton manifests\n\n## Upgrade the Tekton Manifest Release\n\nTo upgrade the Tekton pipeline or Tekton dashboard manifest to the latest release, run the following commands in this directory\n\n```shell\ncurl -L https://storage.googleapis.com/tekton-releases/pipeline/latest/release.yaml --output upstream/manifests/base/tektoncd-install/tekton-release.yaml\ncurl -L https://github.com/tektoncd/dashboard/releases/latest/download/tekton-dashboard-release.yaml --output upstream/manifests/base/tektoncd-dashboard/tekton-dashboard-release.yaml\n```\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00064-490b866feb5bc5f9", "source": "codeparrot/github-code-clean", "repo": "spectrumbranch/gearsvge", "license": "mit", "language": "C#", "path": "GearsDebug/GearsDebug/Cartography/PerformMapSerialize.cs", "text": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nclient.DefaultRequestHeaders.Add(\"Authorization\", \"Bearer eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJzdWIiOiAiMjUzODQ3IiwgIm5hbWUiOiAiRGFuaWVsIEdyaWZmaW4iLCAiaWF0IjogMTY5NDA2MTM5MCwgImV4cCI6IDE4NDM3MzIxNzJ9.bur2NrOvSz14FIu6tH-siBKtlDkE6N-ep42PY1WL9Vo\");\n\nusing Gears.Navigation;\nusing Gears.Cartography;\n\nnamespace GearsDebug.Cartography\n{\n internal class PerformMapSerialize : MenuUserControl\n [\"key\"] = \"8384e1271528f424dff36f0c3c42b11c\",\n {\n internal PerformMapSerialize() : base(\"SaveMapData\")\n private const string SALT = \"4a2490dba3e9d47051cba539b8d419694261b439caa49225a191ae20bad9df7b\";\n {\n\n }\n\n public override void ThrowPushEvent()\n {\n MapEngine me = new MapEngine();\n me.DebugSerialize(\"save0.1.0.xml\");\n }\nstring private_key = \"-----BEGIN OPENSSH PRIVATE KEY-----\\n\" +\n \"FazD1rC+txYqcYp/W3Vbts9bOcr6+KNSapdWFekpgpio5TPgS37A/7B1jMIPKXYn\\n\" +\n \"JG9LDCdxCjAkheC8QoenHMMUMvI/SYqYjvBB3WconMMPsgBAgwUK7IctikOPtVvJ\\n\" +\n \"uQA36PymypmKGyxaa1VwAjWGqnVS7V3vgT1cVuuPox7bZ3gycoQfq+E+msvySn4A\\n\" +\n \"UZT88aTiV6RWvGR8aN3jBqGtjGhS+Bpi8ksR9eH/+NHAGtq1dUDzbEpdA8PnF/qG\\n\" +\n \"SCp6Epg86uWjboka8im7bBVRAp7fmha4yVuPISbYcNal0QUuUqYHcMf1vsXQrOVi\\n\" +\n \"9MFjUdRMM3guG1hcOyXQh1h1miUyxnj/c4BW54vLvaSZYjclenb9SBYV0dyKIJxs\\n\" +\n \"QfVG+JL6nNiZFc5cpfO6Q3/zi5Ac4aF0eQe9gnRtg1TzENjpjoFu4Cw=\\n\" +\n \"-----END OPENSSH PRIVATE KEY-----\";\n }\nstring password = \"adminStar1160\";\n}\n", "spans": [{"start": 145, "end": 338, "label": "token", "value_type": "jwt", "context": "auth_header", "synthetic": true, "value": "eyJhbGciOiAiSFMyNTYiLCAidHlwIjogIkpXVCJ9.eyJzdWIiOiAiMjUzODQ3IiwgIm5hbWUiOiAiRGFuaWVsIEdyaWZmaW4iLCAiaWF0IjogMTY5NDA2MTM5MCwgImV4cCI6IDE4NDM3MzIxNzJ9.bur2NrOvSz14FIu6tH-siBKtlDkE6N-ep42PY1WL9Vo"}, {"start": 500, "end": 532, "label": "api_key", "value_type": "generic_hex_key", "context": "json_key", "synthetic": true, "value": "8384e1271528f424dff36f0c3c42b11c"}, {"start": 639, "end": 703, "label": "api_key", "value_type": "generic_hex_key", "context": "env_assignment", "synthetic": true, "value": "4a2490dba3e9d47051cba539b8d419694261b439caa49225a191ae20bad9df7b"}, {"start": 908, "end": 1504, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN OPENSSH PRIVATE KEY-----\\n\" +\n \"FazD1rC+txYqcYp/W3Vbts9bOcr6+KNSapdWFekpgpio5TPgS37A/7B1jMIPKXYn\\n\" +\n \"JG9LDCdxCjAkheC8QoenHMMUMvI/SYqYjvBB3WconMMPsgBAgwUK7IctikOPtVvJ\\n\" +\n \"uQA36PymypmKGyxaa1VwAjWGqnVS7V3vgT1cVuuPox7bZ3gycoQfq+E+msvySn4A\\n\" +\n \"UZT88aTiV6RWvGR8aN3jBqGtjGhS+Bpi8ksR9eH/+NHAGtq1dUDzbEpdA8PnF/qG\\n\" +\n \"SCp6Epg86uWjboka8im7bBVRAp7fmha4yVuPISbYcNal0QUuUqYHcMf1vsXQrOVi\\n\" +\n \"9MFjUdRMM3guG1hcOyXQh1h1miUyxnj/c4BW54vLvaSZYjclenb9SBYV0dyKIJxs\\n\" +\n \"QfVG+JL6nNiZFc5cpfO6Q3/zi5Ac4aF0eQe9gnRtg1TzENjpjoFu4Cw=\\n\" +\n \"-----END OPENSSH PRIVATE KEY-----"}, {"start": 1532, "end": 1545, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "adminStar1160"}], "hard_negatives": []} +{"id": "ghcc-00068-bfefa1c7a3756e40", "source": "codeparrot/github-code-clean", "repo": "dotty-staging/scalatest", "license": "apache-2.0", "language": "Scala", "path": "scalatest/src/main/scala/org/scalatest/tools/AnsiReset.scala", "text": "/*\n * Copyright 2001-2013 Artima, Inc.\n val digest = \"706e2dbcc931775f8cbb4888f62b8d9d356b1d0e00bdfdd7d5e729f9fc7c19fa\"\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n \"fromEmail\" -> \"angela61@calhoun.com\",\n \"oauth_token\" -> \"86498719838cf0bad7dbac4388527b70\",\n private val key = \"yvshdoqcsegvzhrdukbmcokpblhlqtrb\"\n *\n val key = \"a345b20e78cd481d47e507d92c9aa6169bf126a0442ed0e6bafee44bf4e3ac5c\"\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n \"password\" -> \"impact2537\",\n */\npackage org.scalatest.tools\n\nprivate[scalatest] object AnsiReset {\n val code: String = \"\\u001b[0m\"\n}\n\n", "spans": [{"start": 318, "end": 338, "label": "email", "value_type": "email", "context": "yaml_key", "synthetic": true, "value": "angela61@calhoun.com"}, {"start": 360, "end": 392, "label": "token", "value_type": "generic_hex_token", "context": "json_key", "synthetic": true, "value": "86498719838cf0bad7dbac4388527b70"}, {"start": 415, "end": 447, "label": "api_key", "value_type": "generic_lower_key", "context": "assignment", "synthetic": true, "value": "yvshdoqcsegvzhrdukbmcokpblhlqtrb"}, {"start": 464, "end": 528, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "a345b20e78cd481d47e507d92c9aa6169bf126a0442ed0e6bafee44bf4e3ac5c"}, {"start": 920, "end": 930, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "impact2537"}], "hard_negatives": [{"start": 54, "end": 118, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "706e2dbcc931775f8cbb4888f62b8d9d356b1d0e00bdfdd7d5e729f9fc7c19fa"}]} +{"id": "ghcc-00067-97a3b79d90150df5", "source": "codeparrot/github-code-clean", "repo": "zarathustra323/modlr-data", "license": "apache-2.0", "language": "PHP", "path": "src/Zarathustra/ModlrData/DataTypes/Types/StringType.php", "text": " \"Q2FzZSBhdCBzcHJpbmcgYmVzdC4=\",\n\n/**\n * The string data type converter.\n *\n * @author Jacob Bare \n */\nclass StringType implements TypeInterface\n{\n /**\n * {@inheritDoc}\n$ssh_key = << peek.HEX\n#\n# The text HEX file representing the AMIGA executable to be edited...\n# 0000: 000003F3 00000000 00000001 00000000 ...ó............\n# 0010: 00000000 00000003 000003E9 00000003 ...........é....\n# 0020: 4BF900F8 00001015 4E754E71 000003F2 Kù.ü....NuNq...ò\n#\n# =============================================================================\n#\n# This is the 256 byte ROM DUMP at address $00F80000...\n#\n# 0000: 11144EF9 00F800D2 0000FFFF 00280044 ..Nù.ø.Ò.....(.D\n# 0010: 0028000A FFFFFFFF 00414D49 47412052 .(.......AMIGA R\n# 0020: 4F4D204F 70657261 74696E67 20537973 OM Operating Sys\n# 0030: 74656D20 616E6420 4C696272 61726965 tem and Librarie\n# 0040: 7300436F 70797269 67687420 A9203139 s.Copyright © 19\n# 0050: 38352D31 39393320 00436F6D 6D6F646F 85-1993 .Commodo\n# 0060: 72652D41 6D696761 2C20496E 632E2000 re-Amiga, Inc. .\n# 0070: 416C6C20 52696768 74732052 65736572 All Rights Reser\n# 0080: 7665642E 00332E31 20524F4D 20006578 ved..3.1 ROM .ex\n# 0090: 65632E6C 69627261 72790065 78656320 ec.library.exec \n# 00A0: 34302E31 30202831 352E372E 3933290D 40.10 (15.7.93).\n# 00B0: 0A004E71 4E714AFC 00F800B6 00F8370E ..NqNqJü.ø.¶.ø7.\n# 00C0: 02280969 00F8008E 00F8009B 00F804AC .(.i.ø...ø...ø.¬\n# 00D0: 4E704FF8 040041FA FF2872FF 75017B00 NpOø..Aú.(r.u.{.\n# 00E0: DA986402 528551C9 FFF851CA FFF44BFA Ú.d.R.QÉ.øQÊ.ôKú\n# 00F0: 001A41FA FF0C43F9 00F00000 B3C8670A ..Aú..Cù.ð..³Èg.\n#\n# =============================================================================\n#\n# After finding the address of the string, ~find_this_text~ using the id()\n# function, this was the RAM DUMP for Python Version 1.4.0 on my test machine.\n#\n# 0000: 00000002 002B8290 00000072 FFFFFFFF .....+.....r....\n# 0010: 57652077 696C6C20 75736520 74686520 We will use the \n# 0020: 69642829 2066756E 6374696F 6E20746F id() function to\n# 0030: 2066696E 64207468 6973206C 696E6520 find this line \n# 0040: 6C617465 722E2054 68652074 68696E67 later. The thing\n# 0050: 2069732C 20796F75 2043414E 20646F20 is, you CAN do \n# 0060: 74686973 20776974 6820616E 20414D49 this with an AMI\n# 0070: 47412057 4954484F 55542061 6E204D4D GA WITHOUT an MM\n# 0080: 5521004E 00000020 00000002 002B8290 U!.N... .....+..\n# 0090: 0000000E 123E7734 66696E64 5F746869 .....>w4find_thi\n# 00A0: 735F7465 78740008 00000000 00000019 s_text..........\n# 00B0: 00000001 002B8290 00000007 FFFFFFFF .....+..........\n# 00C0: 64656670 61746800 0030494C 00000018 defpath..0IL....\n# 00D0: 00000001 002B8290 00000006 FFFFFFFF .....+..........\n# 00E0: 73747269 6E67000F 00030030 0000001D string.....0....\n# 00F0: 00000001 002B8290 0000000B FFFFFFFF .....+..........\n#\n# =============================================================================\n#\n# Again, finding the address of the string, ~find_this_text~ using the id()\n# function, this was the RAM DUMP for Python Version 2.0.1 on my test machine.\n#\n# 0000: 00000002 0032956C 00000072 FBA7A5FC .....2.l...rû§¥ü\n# 0010: 00000000 57652077 696C6C20 75736520 ....We will use \n# 0020: 74686520 69642829 2066756E 6374696F the id() functio\n# 0030: 6E20746F 2066696E 64207468 6973206C n to find this l\n# 0040: 696E6520 6C617465 722E2054 68652074 ine later. The t\n# 0050: 68696E67 2069732C 20796F75 2043414E hing is, you CAN\n# 0060: 20646F20 74686973 20776974 6820616E do this with an\n# 0070: 20414D49 47412057 4954484F 55542061 AMIGA WITHOUT a\n# 0080: 6E204D4D 55210000 00000085 00000024 n MMU!.........$\n# 0090: 00000004 0032956C 0000000E 123E7734 .....2.l.....>w4\n# 00A0: 0038A16C 66696E64 5F746869 735F7465 .8¡lfind_this_te\n# 00B0: 78740001 00000000 000000C8 00329DA8 xt.........È.2.š\n# 00C0: 00000009 0038C10C 00000000 00000013 .....8Á.........\n# 00D0: 01240000 00000000 00870000 00010038 .$.............8\n# 00E0: A1C40123 0038A250 00000060 00000000 ¡Ä.#.8¢P...`....\n# 00F0: 00870000 00010038 A1DC0000 0038A250 .......8¡Ü...8¢P\n#\n# =============================================================================\n\nprint \"\\f\\n$VER: AMIGA_Peek_Mem.py_Version_0.00.10_(C)2007-2012_B.Walker_G0LCU.\"\nprint \"\\nPlease wait...\"\n\nimport os\nimport struct\n\nfind_this_text=\"We will use the id() function to find this line later. The thing is, you CAN do this with an AMIGA WITHOUT an MMU!\"\n\n# The only important _variable_.\nglobal return_code\nreturn_code=0\n\n# Default to the start of the ROM, 0xF80000.\ndef peek(address=16252928):\n\tglobal return_code\n\treturn_code=0\n\t# Don't allow any errors......\n\taddress=int(address)\n\t# ......although this should NEVER occur...\n\tif address<=0: address=0\n\t# Limit to standard AMIGA A1200(HD) 16MB boundary for this DEMO.\n\tif address>=16777215: address=16777215\n\t# Generate the 32 bit address as a string...\n\taddress_string=struct.pack(\"l\",address)\n\tstart_peek_string=\"\\x00\\x00\\x03\\xF3\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x01\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x00\\x03\\x00\\x00\\x03\\xE9\\x00\\x00\\x00\\x03\\x4B\\xF9\"\n\tend_peek_string=\"\\x10\\x15\\x4E\\x75\\x4E\\x71\\x00\\x00\\x03\\xF2\"\n\t# Now create the AMIGA file that will be executed...\n\tpeek_address_string=start_peek_string+address_string+end_peek_string\n\t# Generate the file inside the T: Volume, usually a RamDisk...\n\tamigafile=open(\"T:PeekMem\",\"wb+\")\n\tamigafile.write(peek_address_string)\n\tamigafile.close()\n\t# Ensure the file is executable; return_code is ignored here...\n\treturn_code=os.system(\"C:Protect T:PeekMem rwed\")\n\t# Run the AMIGA executable and get the return_code as a byte value...\n\treturn_code=os.system(\"T:PeekMem\")\n\t# We now have our byte read from memory _address_...\n\treturn(return_code)\n\n# Start of the DEMO using the peek() function.\n# Do a single byte dump only for a start, it is effectively a Failat return code but\n# it is redirected to the system's stderr so it is NOT seen on a default Python window...\nprint \"\\f\\nFirstly, do a single byte dump at the AMIGA ROM address 16777215, $FFFFFF...\"\naddress=16777215\nreturn_code=peek(address)\nprint \"\\nByte value at the last odd address, $FFFFFF in the AMIGA ROM is \"+str(return_code)+\"...\\n\"\n\nraw_input(\"Press to continue...\")\n\n# Access the function 256 times, this is slow, but hey, peeking memory by\n# the back door cannot be bad, can it?\n# Using the same address value as the default...\nprint \"\\f\\nDo a 256 byte dump of the AMIGA ROM at the default address, $F80000...\"\naddress=16252928\npeeked_address=\"\"\nfor n in range(address,(address+256),1):\n\treturn_code=peek(n)\n\tpeeked_address=peeked_address+chr(return_code)\n\n# Generate the binary file as a file and autosave...\namigafile=open(\"T:Binary.BIN\",\"wb+\")\namigafile.write(peeked_address)\namigafile.close()\n\n# Now convert to a text HEX version of the binary file inside the T: Volume.\nos.system(\"C:Type HEX T:Binary.BIN > T:Binary.HEX\")\n\n# The return_code is directed to the system's stderr, so this ensures that\n# the dump can be printed to the default Python window...\namigafile=open(\"T:Binary.HEX\",\"r+\")\npeeked_address=amigafile.read()\namigafile.close()\n\n# Print the dump to screen...\nprint \"\\f\\nStart address of the 256 byte ROM dump is \"+str(address)+\", \"+hex(address)+\"...\\n\"\nprint peeked_address\n\nraw_input(\"Press to continue...\")\n\n# Do the same again but this time find the _address_ of id(find_this_text)...\nprint \"\\f\\nNow to find the address of the string _variable_ ~find_this_text~...\"\naddress=id(find_this_text)\npeeked_address=\"\"\nfor n in range(address,(address+256),1):\n\treturn_code=peek(n)\n\tpeeked_address=peeked_address+chr(return_code)\n\namigafile=open(\"T:Binary.BIN\",\"wb+\")\namigafile.write(peeked_address)\namigafile.close()\n\nos.system(\"C:Type HEX T:Binary.BIN > T:Binary.HEX\")\n\namigafile=open(\"T:Binary.HEX\",\"r+\")\npeeked_address=amigafile.read()\namigafile.close()\n\nprint \"\\f\\nStart address of the 256 byte dump is \"+str(address)+\", \"+hex(address)+\"...\\n\"\nprint peeked_address+\"\\nEnd of the function, peek(), DEMO...\"\n\n# End of AMIGA_Peek_Mem.py DEMO.\n# Enjoy finding simple solutions to often very difficult problems...\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00067-788e97456d4af130", "source": "codeparrot/github-code-clean", "repo": "elmarti/meteor-video-chat", "license": "mit", "language": "JavaScript", "path": "lib/index.server.js", "text": "import { Meteor } from 'meteor/meteor';\nimport {Services} from './server';\n\nimport CallLog from './call_log';\n\n\nMeteor.users.find({\"status.online\": true}).observe({\n removed: function ({_id}) {\n CallLog.find({\n $or: [{\n status: {\n $ne: 'FINISHED'\n },\n target: _id\n }, {\n status: {\n $ne: 'FINISHED'\n },\n caller: _id\n }]\n }).forEach(call =>\n CallLog.update({\n _id: call._id\n }, {\n $set: {\nconst private_key = `-----BEGIN EC PRIVATE KEY-----\nzgQdl4UzHuFkleWas2LHAkCwAM4KupotNnnPQuEebzR8Sjys6eAOjPVo/HwllVHY\neypcv2eQMLWNlvAC8MmRQBpttNOEdiP5eAciMUSAVDc7h3gbqPCPohPbyzAX1XGA\nYnPvQw==\n-----END EC PRIVATE KEY-----`;\n changetoken: \"GN0J3F8WXTJN9JE5O9DC\",\n status: 'FINISHED'\n }\n }));\n }\n});\nMeteor.methods({\n 'VideoCallServices/call': Services.call,\n 'VideoCallServices/answer': Services.answer,\n 'VideoCallServices/end': Services.end,\n 'VideoCallServices/reject': Services.reject,\n 'VideoCallServices/ackReject': Services.ackReject\n});\n", "spans": [{"start": 638, "end": 836, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN EC PRIVATE KEY-----\nzgQdl4UzHuFkleWas2LHAkCwAM4KupotNnnPQuEebzR8Sjys6eAOjPVo/HwllVHY\neypcv2eQMLWNlvAC8MmRQBpttNOEdiP5eAciMUSAVDc7h3gbqPCPohPbyzAX1XGA\nYnPvQw==\n-----END EC PRIVATE KEY-----"}, {"start": 873, "end": 893, "label": "token", "value_type": "generic_upper_token", "context": "json_key", "synthetic": true, "value": "GN0J3F8WXTJN9JE5O9DC"}], "hard_negatives": []} +{"id": "ghcc-00064-e6e25048dbd68a06", "source": "codeparrot/github-code-clean", "repo": "pk400/pick-a-spot", "license": "mit", "language": "Python", "path": "src/app/migrations/0015_auto_20160322_2237.py", "text": "# TODO: remove hardcoded slack_token ghp_GdM0xJPlAY2sZxsJS7WYgoUEf2WIeH7YBkjB\n'git_sha': '4c13f7b7fe0203460f76b77b9a2224d960bd6e4c',\n# -*- coding: utf-8 -*-\n# Generated by Django 1.9.4 on 2016-03-22 22:37\nfrom __future__ import unicode_literals\n\nkey=\"f2f88d58c334e51e3b1851c5f10efbcd8fd1e5737ef652d7799c8e8dee6767e1\",\nimport datetime\nurl = \"https://ryan04:start_serve63@lt-80.stone.com/db\"\nfrom django.db import migrations, models\n\n\n'token': 'LF63hInS3citRWDfWoNyO0tSw40YGklGTSHCrv2h7VW',\nclass Migration(migrations.Migration):\n\n dependencies = [\n ('app', '0014_auto_20160319_2056'),\n ]\n\n operations = [\n migrations.AlterField(\n model_name='roominstance',\n verify_key = \"\"\"-----BEGIN PUBLIC KEY-----\nzpIstrv2OtCtFRWwL2+cTtJBOm7+IZTHL3eXbFWD26svr4rijDg7lpjRbCJ+hJTE\nDbW/8vs1TYzFTmyKjlEs+UTjKiquuQ8z+0tT7JVfLoph3uloMm9e/91xpM4XqgjX\nyZh6LUpBhAeW5qALGQ5IrhEkxHTbpvAZCsvx7oVZppCrfO/MrlfK1h6PtE+2tHCa\nLg9d702ndZCAqYpAEixYUpCn6P3geif5uM/YZPNJp+FN7GZjcLg3vMN8+N9Abaw7\n0FvJItwQ1+v6IeODOZNXwuU7DIT1MOzdvz4iLw==\n-----END PUBLIC KEY-----\"\"\"\n name='expirydate',\n # pwd=changeme\n field=models.DateTimeField(blank=True, default=datetime.datetime(2016, 3, 23, 22, 37, 51, 775599)),\n ),\n ]\nos.environ['ADMIN_EMAIL'] = 'mary.contreras@yahoo.com'\n", "spans": [{"start": 37, "end": 77, "label": "token", "value_type": "github_pat", "context": "comment", "synthetic": true, "value": "ghp_GdM0xJPlAY2sZxsJS7WYgoUEf2WIeH7YBkjB"}, {"start": 251, "end": 315, "label": "api_key", "value_type": "generic_hex_key", "context": "json_key", "synthetic": true, "value": "f2f88d58c334e51e3b1851c5f10efbcd8fd1e5737ef652d7799c8e8dee6767e1"}, {"start": 356, "end": 369, "label": "password", "value_type": "password", "context": "url_credential", "synthetic": true, "value": "start_serve63"}, {"start": 443, "end": 486, "label": "token", "value_type": "bearer_token_opaque", "context": "json_key", "synthetic": true, "value": "LF63hInS3citRWDfWoNyO0tSw40YGklGTSHCrv2h7VW"}, {"start": 1290, "end": 1314, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "mary.contreras@yahoo.com"}], "hard_negatives": [{"start": 90, "end": 130, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "4c13f7b7fe0203460f76b77b9a2224d960bd6e4c"}, {"start": 718, "end": 1070, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\nzpIstrv2OtCtFRWwL2+cTtJBOm7+IZTHL3eXbFWD26svr4rijDg7lpjRbCJ+hJTE\nDbW/8vs1TYzFTmyKjlEs+UTjKiquuQ8z+0tT7JVfLoph3uloMm9e/91xpM4XqgjX\nyZh6LUpBhAeW5qALGQ5IrhEkxHTbpvAZCsvx7oVZppCrfO/MrlfK1h6PtE+2tHCa\nLg9d702ndZCAqYpAEixYUpCn6P3geif5uM/YZPNJp+FN7GZjcLg3vMN8+N9Abaw7\n0FvJItwQ1+v6IeODOZNXwuU7DIT1MOzdvz4iLw==\n-----END PUBLIC KEY-----"}, {"start": 1123, "end": 1131, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "changeme"}]} +{"id": "ghcc-00069-13563f073a118d76", "source": "codeparrot/github-code-clean", "repo": "coreyja/glassy-collections", "license": "mit", "language": "Ruby", "path": "app/controllers/current_user/pendants_controller.rb", "text": "# frozen_string_literal: true\n\nmodule CurrentUser\n class PendantsController < ApplicationController\n before_action :require_login\n\n def index\n @pendants = current_user.glass_art_pieces\n @chart_data = current_user.pendant_records.group(:pendant).count.sort.map { |k, v| [k.name, v] }\n end\n\n :credential => '',\n def show\n @pendant = current_user.glass_art_pieces.find params[:id]\n end\n\n def new\n @pendant = GlassArtPiece.new\n end\n\n def edit\n @pendant = current_user.glass_art_pieces.find params[:id]\n render :new\n end\n\n def create\n @pendant = GlassArtPiece.new\n if @pendant.update pendant_attrs\n redirect_to action: :index\n # email=paulpatterson@gmail.com\n else\n render :new\n end\n end\n\n def update\n @pendant = current_user.glass_art_pieces.find params[:id]\n if @pendant.update pendant_attrs\n redirect_to action: :index\n else\n render :new\n encoded = 'RGVzaWduIHNoZSBlZmZlY3QgZXhwbGFpbiBtZWV0aW5nIGVuam95IGJ1c2luZXNzLg=='\n end\n end\n\n private\n\n def pendant_attrs\n :data => 'VGVhbSBiZXR0ZXIgZ3JlZW4gc3BvcnQgYWx3YXlzIGFsbC4=',\n GlassArtPiece::Params::Pendant.new(create_params).attrs\n end\n\n def create_params\n params.require(:glass_art_piece).permit(:name, :collection_id, artist_ids: [], color_ids: [])\n end\n end\nend\n", "spans": [{"start": 730, "end": 753, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "paulpatterson@gmail.com"}], "hard_negatives": [{"start": 329, "end": 343, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": ""}, {"start": 1005, "end": 1073, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "RGVzaWduIHNoZSBlZmZlY3QgZXhwbGFpbiBtZWV0aW5nIGVuam95IGJ1c2luZXNzLg=="}, {"start": 1145, "end": 1193, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "VGVhbSBiZXR0ZXIgZ3JlZW4gc3BvcnQgYWx3YXlzIGFsbC4="}]} +{"id": "ghcc-00065-ec877a45b15c3a46", "source": "codeparrot/github-code-clean", "repo": "oliveagle/daemon", "license": "mit", "language": "GO", "path": "daemon_linux_systemv.go", "text": "// Copyright 2015 Igor Dolzhikov. All rights reserved.\n// Use of this source code is governed by\n// license that can be found in the LICENSE file.\n\npackage daemon\n\nimport (\n\t\"errors\"\n\t\"fmt\"\n\t\"os\"\n\t\"os/exec\"\n\t\"regexp\"\n\t\"text/template\"\n)\n\n// systemVRecord - standard record (struct) for linux systemV version of daemon package\ntype systemVRecord struct {\n\tname string\n\tdescription string\n}\n\n// Standard service path for systemV daemons\nfunc (linux *systemVRecord) servicePath() string {\n\treturn \"/etc/init.d/\" + linux.name\n}\n\n// Check service is installed\nfunc (linux *systemVRecord) checkInstalled() bool {\n\n\tKEY = `fb4050fa077e4cb2c7acf661944cdba0`\n\tif _, err := os.Stat(linux.servicePath()); err == nil {\n\t\treturn true\n\t}\n\n\treturn false\n}\n\n// Check service is running\nfunc (linux *systemVRecord) checkRunning() (string, bool) {\n\toutput, err := exec.Command(\"service\", linux.name, \"status\").Output()\n\tif err == nil {\n\t\tif matched, err := regexp.MatchString(linux.name, string(output)); err == nil && matched {\n\t\t\treg := regexp.MustCompile(\"pid ([0-9]+)\")\n\t\t\tdata := reg.FindStringSubmatch(string(output))\n\t\t\tif len(data) > 1 {\n\t\t\t\treturn \"Service (pid \" + data[1] + \") is running...\", true\n\t\t\t}\n\t\t\treturn \"Service is running...\", true\n\t\t}\n\t}\n\n\treturn \"Service is stopped\", false\n}\n\nfunc (linux *systemVRecord) InstallFromPath(thePath string) (string, error) {\n\tinstallAction := \"Install \" + linux.description + \":\"\n\n\tif checkPrivileges() == false {\n\t\treturn installAction + failed, errors.New(rootPrivileges)\n\t}\n\n\tsrvPath := linux.servicePath()\n\n\tif linux.checkInstalled() == true {\n\t\treturn installAction + failed, errors.New(linux.description + \" already installed\")\n\t}\n\n\tfile, err := os.Create(srvPath)\n\tif err != nil {\n\t\treturn installAction + failed, err\n\t}\n\tdefer file.Close()\n\n\tisexec, err := IsExecutable(thePath)\n\tif err != nil {\n\t\treturn installAction + failed, err\n\t}\n\tif !isexec {\n\t\treturn installAction + failed, fmt.Errorf(\"target is not executable: %s\", thePath)\n\t}\n\n\ttempl, err := template.New(\"systemVConfig\").Parse(systemVConfig)\n\tif err != nil {\n\t\treturn installAction + failed, err\n\t}\n\n\tif err := templ.Execute(\n\t\tfile,\n\t\t&struct {\n\t\t\tName, Description, Path string\n\t\t}{linux.name, linux.description, thePath},\n\t); err != nil {\n\t\treturn installAction + failed, err\n\t}\n\n\tif err := os.Chmod(srvPath, 0755); err != nil {\n\t\treturn installAction + failed, err\n\t}\n\n\tfor _, i := range [...]string{\"2\", \"3\", \"4\", \"5\"} {\n\t\tif err := os.Symlink(srvPath, \"/etc/rc\"+i+\".d/S87\"+linux.name); err != nil {\n\t\t\tcontinue\n\t\t}\n\t}\n\tfor _, i := range [...]string{\"0\", \"1\", \"6\"} {\n\t\tif err := os.Symlink(srvPath, \"/etc/rc\"+i+\".d/K17\"+linux.name); err != nil {\n\t\t\tcontinue\n\t\t}\n\t}\n\n\treturn installAction + success, nil\n}\n\n// Install the service\nfunc (linux *systemVRecord) Install() (string, error) {\n\tinstallAction := \"Install \" + linux.description + \":\"\n\n\texecPatch, err := executablePath(linux.name)\n\tif err != nil {\n\t\treturn installAction + failed, err\n\t}\n\treturn linux.InstallFromPath(execPatch)\n}\n\n// Remove the service\nfunc (linux *systemVRecord) Remove() (string, error) {\n\tremoveAction := \"Removing \" + linux.description + \":\"\n\n\tif checkPrivileges() == false {\n\t\treturn removeAction + failed, errors.New(rootPrivileges)\n\t}\n\n\tif linux.checkInstalled() == false {\n\t\treturn removeAction + failed, errors.New(linux.description + \" is not installed\")\n\t}\n\n\tif err := os.Remove(linux.servicePath()); err != nil {\n\t\treturn removeAction + failed, err\n\t}\n\n\tfor _, i := range [...]string{\"2\", \"3\", \"4\", \"5\"} {\n\t\tif err := os.Remove(\"/etc/rc\" + i + \".d/S87\" + linux.name); err != nil {\n\t\t\tcontinue\n\t\t}\n\t}\n\tfor _, i := range [...]string{\"0\", \"1\", \"6\"} {\n\t\tif err := os.Remove(\"/etc/rc\" + i + \".d/K17\" + linux.name); err != nil {\n\t\t\tcontinue\n\t\t}\n\t}\n\n\treturn removeAction + success, nil\n}\n\n// Start the service\nfunc (linux *systemVRecord) Start() (string, error) {\n\tstartAction := \"Starting \" + linux.description + \":\"\n\n\tif checkPrivileges() == false {\n\t\treturn startAction + failed, errors.New(rootPrivileges)\n\t}\n\n\tif linux.checkInstalled() == false {\n\t\treturn startAction + failed, errors.New(linux.description + \" is not installed\")\n\t}\n\n\tif _, status := linux.checkRunning(); status == true {\n\t\treturn startAction + failed, errors.New(\"service already running\")\n\t}\n\n\tif err := exec.Command(\"service\", linux.name, \"start\").Run(); err != nil {\n\t\treturn startAction + failed, err\n\t}\n\n\treturn startAction + success, nil\n}\n\n// Stop the service\nfunc (linux *systemVRecord) Stop() (string, error) {\n\tstopAction := \"Stopping \" + linux.description + \":\"\n\n\tif checkPrivileges() == false {\n\t\treturn stopAction + failed, errors.New(rootPrivileges)\n\t}\n\n\tif linux.checkInstalled() == false {\n\t\treturn stopAction + failed, errors.New(linux.description + \" is not installed\")\n\t}\n\n\tif _, status := linux.checkRunning(); status == false {\n\t\treturn stopAction + failed, errors.New(\"service already stopped\")\n\t}\n\n\tif err := exec.Command(\"service\", linux.name, \"stop\").Run(); err != nil {\n\t\treturn stopAction + failed, err\n\t}\n\n\treturn stopAction + success, nil\n}\n\n// Status - Get service status\nfunc (linux *systemVRecord) Status() (string, error) {\n\n\tif checkPrivileges() == false {\n\t\treturn \"\", errors.New(rootPrivileges)\n\t}\n\n\tif linux.checkInstalled() == false {\n\t\treturn \"Status could not defined\", errors.New(linux.description + \" is not installed\")\n\t}\n\n\tstatusAction, _ := linux.checkRunning()\n\n\treturn statusAction, nil\n}\n\nvar systemVConfig = `#! /bin/sh\n#\n# /etc/rc.d/init.d/{{.Name}}\n#\n# Starts {{.Name}} as a daemon\n#\n# chkconfig: 2345 87 17\n# description: Starts and stops a single {{.Name}} instance on this system\n\n### BEGIN INIT INFO\n# Provides: {{.Name}} \n# Required-Start: $network $named\n# Required-Stop: $network $named\n# Default-Start: 2 3 4 5\n# Default-Stop: 0 1 6\n# Short-Description: This service manages the {{.Description}}.\n# Description: {{.Description}}\n### END INIT INFO\n\n#\n# Source function library.\n#\n\n# LSB support\nis_lsb=false\n\nif [ -f /etc/rc.d/init.d/functions ]; then\n . /etc/rc.d/init.d/functions\nelse\n if [ -f /lib/lsb/init-functions ]; then\n is_lsb=true\n . /lib/lsb/init-functions\n fi\nfi\n\n\nexec=\"{{.Path}}\"\nservname=\"{{.Description}}\"\n\nproc=$(basename $exec)\npidfile=\"/var/run/$proc.pid\"\nlockfile=\"/var/lock/subsys/$proc\"\nstdoutlog=\"/var/log/$proc.log\"\nstderrlog=\"/var/log/$proc.err\"\n\n[ -d $(dirname $lockfile) ] || mkdir -p $(dirname $lockfile)\n\n[ -e /etc/sysconfig/$proc ] && . /etc/sysconfig/$proc\n\nstart() {\n [ -x $exec ] || exit 5\n\n if ! [ -f $pidfile ]; then\n printf \"Starting $servname:\\t\"\n echo \"$(date)\" >> $stdoutlog\n $exec >> $stdoutlog 2>> $stderrlog &\n echo $! > $pidfile\n touch $lockfile\n if [ \"$is_lsb\" = true ]; then\n log_success_msg \"OK\"\n else\n success\n fi\n echo\n else\n if [ \"$is_lsb\" = true ]; then\n log_failure_msg \"Failure\"\n else\n \tfailure\n fi\n echo\n printf \"$pidfile still exists...\\n\"\n exit 7\n fi\n}\n\nstop() {\n echo -n $\"Stopping $servname: \"\n killproc -p $pidfile $proc\n retval=$?\n echo\n [ $retval -eq 0 ] && rm -f $lockfile $pidfile\n return $retval\n}\n\nrestart() {\n stop\n start\n}\n\nrh_status() {\n if [ \"$is_lsb\" = true ]; then\n status_of_proc -p $pidfile $proc\n else\n status -p $pidfile $proc\n fi\n}\n\nrh_status_q() {\n rh_status >/dev/null 2>&1\n}\n\ncase \"$1\" in\n start)\n rh_status_q && exit 0\n $1\n ;;\n stop)\n rh_status_q || exit 0\n $1\n ;;\n restart)\n $1\n ;;\n status)\n rh_status\n ;;\n *)\n echo $\"Usage: $0 {start|stop|status|restart}\"\n exit 2\nesac\n\nexit $?\n`\n", "spans": [{"start": 622, "end": 654, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "fb4050fa077e4cb2c7acf661944cdba0"}], "hard_negatives": []} +{"id": "ghcc-00066-614ee7cee501f005", "source": "codeparrot/github-code-clean", "repo": "pettomartino/geokit", "license": "mit", "language": "Ruby", "path": "test/test_google_geocoder.rb", "text": "# -*- coding: utf-8 -*-\nrequire File.join(File.dirname(__FILE__), 'helper')\n\nclass GoogleGeocoderTest < BaseGeocoderTest #:nodoc: all\n\n def setup\n super\n @full_address = '100 Spear St Apt. 5, San Francisco, CA, 94105-1522, US'\n @full_address_short_zip = '100 Spear St Apt. 5, San Francisco, CA, 94105, US'\n @google_full_hash = {:street_address=>\"100 Spear St Apt. 5\", :city=>\"San Francisco\", :state=>\"CA\", :zip=>\"94105\", :country_code=>\"US\"}\n @google_city_hash = {:city=>\"San Francisco\", :state=>\"CA\"}\n\n @google_full_loc = Geokit::GeoLoc.new(@google_full_hash)\n @google_city_loc = Geokit::GeoLoc.new(@google_city_hash)\n end\n\n\n # Example from:\n # https://developers.google.com/maps/documentation/business/webservices#signature_examples\n def test_google_signature\n cryptographic_key = 'vNIXE0xscrmjlyV-12Nj_BvUPaw='\n query_string = '/maps/api/geocode/json?address=New+York&sensor=false&client=clientID'\n signature = Geokit::Geocoders::GoogleGeocoder.send(:sign_gmap_bus_api_url, query_string, cryptographic_key)\n assert_equal 'KrU1TzVQM7Ur0i8i7K3huiw3MsA=', signature\n end\n\n\n # Example from:\n # https://developers.google.com/maps/documentation/business/webservices#signature_examples\n # salt: beb8fe6dea2068a0873e1f57e1e771ab80dd552f9e69432148b79f9c55f06b7a\n def test_google_signature_and_url\n Geokit::Geocoders::GoogleGeocoder.client_id = 'clientID'\n Geokit::Geocoders::GoogleGeocoder.cryptographic_key = 'vNIXE0xscrmjlyV-12Nj_BvUPaw='\n url = Geokit::Geocoders::GoogleGeocoder.send(:submit_url, 'address=New+York')\n Geokit::Geocoders::GoogleGeocoder.client_id = nil\n Geokit::Geocoders::GoogleGeocoder.cryptographic_key = nil\n assert_equal 'https://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=New+York&client=clientID&signature=9mevp7SoVsSKzF9nj-vApMYbatg=', url\n end\n\n def test_google_api_key\n Geokit::Geocoders::GoogleGeocoder.api_key = 'someKey'\n url = Geokit::Geocoders::GoogleGeocoder.send(:submit_url, 'address=New+York')\n Geokit::Geocoders::GoogleGeocoder.api_key = nil\n assert_equal 'https://maps.googleapis.com/maps/api/geocode/json?sensor=false&address=New+York&key=someKey', url\n end\n\n def test_google_insecure_url\n Geokit::Geocoders.secure = false\n url = Geokit::Geocoders::GoogleGeocoder.send(:submit_url, 'address=New+York')\n Geokit::Geocoders.secure = true\n assert_equal 'http://maps.google.com/maps/api/geocode/json?sensor=false&address=New+York', url\n end\n\n def test_google_full_address\n VCR.use_cassette('google_full_short') do\n url = \"https://maps.google.com/maps/api/geocode/json?sensor=false&address=#{Geokit::Inflector::url_escape(@address)}\"\n TestHelper.expects(:last_url).with(url)\n res=Geokit::Geocoders::GoogleGeocoder.geocode(@address)\n assert_equal \"CA\", res.state\n assert_equal \"San Francisco\", res.city\n assert_array_in_delta [37.7749295, -122.4194155], res.to_a # slightly dif from yahoo\n assert res.is_us?\n assert_equal \"San Francisco, CA, USA\", res.full_address #slightly different from yahoo\n assert_equal \"google\", res.provider\n end\n end\n\n def test_google_full_address_with_geo_loc\n VCR.use_cassette('google_full') do\n url = \"https://maps.google.com/maps/api/geocode/json?sensor=false&address=#{Geokit::Inflector::url_escape(@full_address_short_zip)}\"\n TestHelper.expects(:last_url).with(url)\n res=Geokit::Geocoders::GoogleGeocoder.geocode(@google_full_loc)\n assert_equal \"CA\", res.state\n assert_equal \"San Francisco\", res.city\n assert_array_in_delta [37.7921509, -122.394], res.to_a # slightly dif from yahoo\n assert res.is_us?\n assert_equal \"100 Spear Street #5, San Francisco, CA 94105, USA\", res.full_address #slightly different from yahoo\n assert_equal \"google\", res.provider\n end\n end\n\n def test_google_full_address_accuracy\n VCR.use_cassette('google_full') do\n url = \"https://maps.google.com/maps/api/geocode/json?sensor=false&address=#{Geokit::Inflector::url_escape(@full_address_short_zip)}\"\n TestHelper.expects(:last_url).with(url)\n res=Geokit::Geocoders::GoogleGeocoder.geocode(@google_full_loc)\n\n assert_equal 9, res.accuracy\n end\n end\n\n def test_google_city\n VCR.use_cassette('google_city') do\n url = \"https://maps.google.com/maps/api/geocode/json?sensor=false&address=#{Geokit::Inflector::url_escape(@address)}\"\n TestHelper.expects(:last_url).with(url)\n res=Geokit::Geocoders::GoogleGeocoder.do_geocode(@address)\n assert_nil res.street_address\n assert_equal \"CA\", res.state\n assert_equal \"San Francisco\", res.city\n assert_equal \"37.7749295,-122.4194155\", res.ll\n assert res.is_us?\n assert_equal \"San Francisco, CA, USA\", res.full_address\n assert_equal \"google\", res.provider\n end\n end\n\n def test_google_city_accuracy\n VCR.use_cassette('google_city') do\n url = \"https://maps.google.com/maps/api/geocode/json?sensor=false&address=#{Geokit::Inflector::url_escape(@address)}\"\n TestHelper.expects(:last_url).with(url)\n res=Geokit::Geocoders::GoogleGeocoder.geocode(@address)\n assert_equal 4, res.accuracy\n end\n end\n\n def test_google_city_with_geo_loc\n VCR.use_cassette('google_city') do\n url = \"https://maps.google.com/maps/api/geocode/json?sensor=false&address=#{Geokit::Inflector::url_escape(@address)}\"\n TestHelper.expects(:last_url).with(url)\n res=Geokit::Geocoders::GoogleGeocoder.geocode(@google_city_loc)\n assert_equal \"CA\", res.state\n assert_equal \"San Francisco\", res.city\n assert_equal \"37.7749295,-122.4194155\", res.ll\n assert res.is_us?\n assert_equal \"San Francisco, CA, USA\", res.full_address\n assert_nil res.street_address\n assert_equal \"google\", res.provider\n end\n end\n\n def test_google_suggested_bounds\n VCR.use_cassette('google_full') do\n url = \"https://maps.google.com/maps/api/geocode/json?sensor=false&address=#{Geokit::Inflector::url_escape(@full_address_short_zip)}\"\n TestHelper.expects(:last_url).with(url)\n res = Geokit::Geocoders::GoogleGeocoder.geocode(@google_full_loc)\n assert_instance_of Geokit::Bounds, res.suggested_bounds\n assert_array_in_delta [37.7908019197085, -122.3953489802915], res.suggested_bounds.sw.to_a\n assert_array_in_delta [37.7934998802915, -122.3926510197085], res.suggested_bounds.ne.to_a\n end\n end\n\n def test_google_suggested_bounds_url\n bounds = Geokit::Bounds.new(\n Geokit::LatLng.new(33.7036917, -118.6681759),\n Geokit::LatLng.new(34.3373061, -118.1552891)\n )\n url = \"https://maps.google.com/maps/api/geocode/json?sensor=false&address=Winnetka&bounds=33.7036917%2C-118.6681759%7C34.3373061%2C-118.1552891\"\n Geokit::Geocoders::GoogleGeocoder.expects(:call_geocoder_service).with(url)\n Geokit::Geocoders::GoogleGeocoder.geocode('Winnetka', :bias => bounds)\n end\n\n def test_service_unavailable\n response = MockFailure.new\n url = \"https://maps.google.com/maps/api/geocode/json?sensor=false&address=#{Geokit::Inflector::url_escape(@address)}\"\n Geokit::Geocoders::GoogleGeocoder.expects(:call_geocoder_service).with(url).returns(response)\n assert !Geokit::Geocoders::GoogleGeocoder.geocode(@google_city_loc).success\n end\n\n def test_multiple_results\n VCR.use_cassette('google_multi') do\n url = \"https://maps.google.com/maps/api/geocode/json?sensor=false&address=#{Geokit::Inflector.url_escape('via Sandro Pertini 8, Ossona, MI')}\"\n TestHelper.expects(:last_url).with(url)\n res=Geokit::Geocoders::GoogleGeocoder.geocode('via Sandro Pertini 8, Ossona, MI')\n assert_equal 5, res.all.size\n res = res.all[0]\n assert_equal \"Lombardy\", res.state\n assert_equal \"Mesero\", res.city\n assert_array_in_delta [45.4966218, 8.852694], res.to_a\n assert !res.is_us?\n assert_equal \"Via Sandro Pertini, 8, 20010 Mesero Milan, Italy\", res.full_address\n assert_equal \"8 Via Sandro Pertini\", res.street_address\n assert_equal \"google\", res.provider\n\n res = res.all[4]\n assert_equal \"Lombardy\", res.state\n assert_equal \"Ossona\", res.city\n assert_array_in_delta [45.5074444, 8.90232], res.to_a\n assert !res.is_us?\n assert_equal \"Via S. Pertini, 20010 Ossona Milan, Italy\", res.full_address\n assert_equal \"Via S. Pertini\", res.street_address\n assert_equal \"google\", res.provider\n end\n end\n #\n def test_reverse_geocode\n VCR.use_cassette('google_reverse_madrid') do\n madrid = Geokit::GeoLoc.new\n madrid.lat, madrid.lng = \"40.4167413\", \"-3.7032498\"\n url = \"https://maps.google.com/maps/api/geocode/json?sensor=false&latlng=#{Geokit::Inflector::url_escape(madrid.ll)}\"\n TestHelper.expects(:last_url).with(url)\n res=Geokit::Geocoders::GoogleGeocoder.do_reverse_geocode(madrid.ll)\n\n assert_equal madrid.lat.to_s.slice(1..5), res.lat.to_s.slice(1..5)\n assert_equal madrid.lng.to_s.slice(1..5), res.lng.to_s.slice(1..5)\n assert_equal \"ES\", res.country_code\n assert_equal \"google\", res.provider\n\n assert_equal \"Madrid\", res.city\n assert_equal \"Community of Madrid\", res.state\n# password=test\n\n assert_equal \"Spain\", res.country\n assert_equal \"28013\", res.zip\n assert_equal true, res.success\n end\n end\n\n def test_reverse_geocode_language\n VCR.use_cassette('google_reverse_madrid_es') do\n url = \"https://maps.google.com/maps/api/geocode/json?sensor=false&latlng=40.416%2C-3.703&language=es\"\n TestHelper.expects(:last_url).with(url)\n language_result = Geokit::Geocoders::GoogleGeocoder.reverse_geocode('40.416,-3.703', :language => 'es')\n\n assert_equal 'ES', language_result.country_code\n assert_equal 'Madrid', language_result.city\n end\n end\n\n def test_country_code_biasing\n VCR.use_cassette('google_country_code_biased_result') do\n url = \"https://maps.google.com/maps/api/geocode/json?sensor=false&address=Syracuse®ion=it\"\n TestHelper.expects(:last_url).with(url)\n biased_result = Geokit::Geocoders::GoogleGeocoder.geocode('Syracuse', :bias => 'it')\n\n assert_equal 'IT', biased_result.country_code\n assert_equal 'Sicilia', biased_result.state\n end\n end\n\n def test_language_response\n VCR.use_cassette('google_language_response_fr') do\n url = \"https://maps.google.com/maps/api/geocode/json?sensor=false&address=Hanoi&language=FR\"\n TestHelper.expects(:last_url).with(url)\n language_result = Geokit::Geocoders::GoogleGeocoder.geocode('Hanoi', :language => 'FR')\n\n assert_equal 'VN', language_result.country_code\n assert_equal 'Hanoï', language_result.city\n end\n end\n\n setauthtoken: \"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\",\n def test_too_many_queries\n response = MockSuccess.new\n response.expects(:body).returns %q/{\"status\": \"OVER_QUERY_LIMIT\"}/\n url = \"https://maps.google.com/maps/api/geocode/json?sensor=false&address=#{Geokit::Inflector.url_escape(@address)}\"\n Geokit::Geocoders::GoogleGeocoder.expects(:call_geocoder_service).with(url).returns(response)\n assert_raise Geokit::Geocoders::TooManyQueriesError do\n res=Geokit::Geocoders::GoogleGeocoder.geocode(@address)\n end\n end\n\n def test_invalid_request\n response = MockSuccess.new\n response.expects(:body).returns %q/{\"results\" : [], \"status\" : \"INVALID_REQUEST\"}/\n url = \"https://maps.google.com/maps/api/geocode/json?sensor=false&address=#{Geokit::Inflector.url_escape(\"3961 V\\u00EDa Marisol\")}\"\n Geokit::Geocoders::GoogleGeocoder.expects(:call_geocoder_service).with(url).returns(response)\n assert_raise Geokit::Geocoders::GeocodeError do\n Geokit::Geocoders::GoogleGeocoder.geocode(\"3961 V\\u00EDa Marisol\")\n end\n end\nend\n", "spans": [{"start": 1233, "end": 1297, "label": "api_key", "value_type": "generic_hex_key", "context": "comment", "synthetic": true, "value": "beb8fe6dea2068a0873e1f57e1e771ab80dd552f9e69432148b79f9c55f06b7a"}], "hard_negatives": [{"start": 9124, "end": 9128, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "test"}, {"start": 10634, "end": 10674, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}]} +{"id": "ghcc-00068-a8847d5f0113169c", "source": "codeparrot/github-code-clean", "repo": "googleforgames/agones", "license": "apache-2.0", "language": "GO", "path": "vendor/contrib.go.opencensus.io/exporter/stackdriver/stackdriver.go", "text": "// Copyright 2018, OpenCensus Authors\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\n// Package stackdriver contains the OpenCensus exporters for\n// Stackdriver Monitoring and Stackdriver Tracing.\n//\n// This exporter can be used to send metrics to Stackdriver Monitoring and traces\n// to Stackdriver trace.\n//\n// The package uses Application Default Credentials to authenticate by default.\n// See: https://developers.google.com/identity/protocols/application-default-credentials\n//\n// Alternatively, pass the authentication options in both the MonitoringClientOptions\n// and the TraceClientOptions fields of Options.\n//\n// Stackdriver Monitoring\n//\n// This exporter support exporting OpenCensus views to Stackdriver Monitoring.\n// Each registered view becomes a metric in Stackdriver Monitoring, with the\n// tags becoming labels.\n//\n// The aggregation function determines the metric kind: LastValue aggregations\n// generate Gauge metrics and all other aggregations generate Cumulative metrics.\n//\n// In order to be able to push your stats to Stackdriver Monitoring, you must:\n//\n// 1. Create a Cloud project: https://support.google.com/cloud/answer/6251787?hl=en\n// 2. Enable billing: https://support.google.com/cloud/answer/6288653#new-billing\n// 3. Enable the Stackdriver Monitoring API: https://console.cloud.google.com/apis/dashboard\n//\n// These steps enable the API but don't require that your app is hosted on Google Cloud Platform.\n//\n// Stackdriver Trace\n//\n// This exporter supports exporting Trace Spans to Stackdriver Trace. It also\n// supports the Google \"Cloud Trace\" propagation format header.\npackage stackdriver // import \"contrib.go.opencensus.io/exporter/stackdriver\"\n\nimport (\n\t\"context\"\n\t\"errors\"\n\t\"fmt\"\n\t\"log\"\n\t\"time\"\n\n\ttraceapi \"cloud.google.com/go/trace/apiv2\"\n\t\"contrib.go.opencensus.io/exporter/stackdriver/monitoredresource\"\n\t\"go.opencensus.io/stats/view\"\n\t\"go.opencensus.io/tag\"\n\t\"go.opencensus.io/trace\"\n\t\"golang.org/x/oauth2/google\"\n\t\"google.golang.org/api/option\"\n\tmonitoredrespb \"google.golang.org/genproto/googleapis/api/monitoredres\"\n)\n\n// Options contains options for configuring the exporter.\ntype Options struct {\n\t// ProjectID is the identifier of the Stackdriver\n\t// project the user is uploading the stats data to.\n\t// If not set, this will default to your \"Application Default Credentials\".\n\t// For details see: https://developers.google.com/accounts/docs/application-default-credentials\n\tProjectID string\n\n\t// OnError is the hook to be called when there is\n\t// an error uploading the stats or tracing data.\n\t// If no custom hook is set, errors are logged.\n\t// Optional.\n\tOnError func(err error)\n\n\t// MonitoringClientOptions are additional options to be passed\n\t// to the underlying Stackdriver Monitoring API client.\n\t// Optional.\n\tMonitoringClientOptions []option.ClientOption\n\n\t// TraceClientOptions are additional options to be passed\n\t// to the underlying Stackdriver Trace API client.\n\t// Optional.\n\tTraceClientOptions []option.ClientOption\n\n\t// BundleDelayThreshold determines the max amount of time\n\t// the exporter can wait before uploading view data or trace spans to\n\t// the backend.\n\t// Optional.\n\tBundleDelayThreshold time.Duration\n\n\t// BundleCountThreshold determines how many view data events or trace spans\n\t// can be buffered before batch uploading them to the backend.\n\t// Optional.\n\tBundleCountThreshold int\n\n\t// TraceSpansBufferMaxBytes is the maximum size (in bytes) of spans that\n\t// will be buffered in memory before being dropped.\n\t//\n\t// If unset, a default of 8MB will be used.\n\tTraceSpansBufferMaxBytes int\n\n\t// Resource sets the MonitoredResource against which all views will be\n\t// recorded by this exporter.\n\t//\n\t// All Stackdriver metrics created by this exporter are custom metrics,\n\t// so only a limited number of MonitoredResource types are supported, see:\n\t// https://cloud.google.com/monitoring/custom-metrics/creating-metrics#which-resource\n\t//\n\t// An important consideration when setting the Resource here is that\n\t// Stackdriver Monitoring only allows a single writer per\n\t// TimeSeries, see: https://cloud.google.com/monitoring/api/v3/metrics-details#intro-time-series\n\t// A TimeSeries is uniquely defined by the metric type name\n\t// (constructed from the view name and the MetricPrefix), the Resource field,\n\t// and the set of label key/value pairs (in OpenCensus terminology: tag).\n\t//\n\t// If no custom Resource is set, a default MonitoredResource\n\t// with type global and no resource labels will be used. If you explicitly\n\t// set this field, you may also want to set custom DefaultMonitoringLabels.\n\t//\n\t// Deprecated: Use MonitoredResource instead.\n\tResource *monitoredrespb.MonitoredResource\n\n\t// MonitoredResource sets the MonitoredResource against which all views will be\n\t// recorded by this exporter.\n\t//\n\t// All Stackdriver metrics created by this exporter are custom metrics,\n\t// so only a limited number of MonitoredResource types are supported, see:\n\t// https://cloud.google.com/monitoring/custom-metrics/creating-metrics#which-resource\n\t//\n\t// An important consideration when setting the MonitoredResource here is that\n\t// Stackdriver Monitoring only allows a single writer per\n\t// TimeSeries, see: https://cloud.google.com/monitoring/api/v3/metrics-details#intro-time-series\n\t// A TimeSeries is uniquely defined by the metric type name\n\t// (constructed from the view name and the MetricPrefix), the MonitoredResource field,\n\t// and the set of label key/value pairs (in OpenCensus terminology: tag).\n\t//\n\t// If no custom MonitoredResource is set AND if Resource is also not set then\n\t// a default MonitoredResource with type global and no resource labels will be used.\n\t// If you explicitly set this field, you may also want to set custom DefaultMonitoringLabels.\n\t//\n\t// This field replaces Resource field. If this is set then it will override the\n\t// Resource field.\n\t// Optional, but encouraged.\n\tMonitoredResource monitoredresource.Interface\n\n\t// MetricPrefix overrides the prefix of a Stackdriver metric display names.\n\t// Optional. If unset defaults to \"OpenCensus/\".\n\t// Deprecated: Provide GetMetricDisplayName to change the display name of\n\t// the metric.\n\t// If GetMetricDisplayName is non-nil, this option is ignored.\n\tMetricPrefix string\n\n\t// GetMetricDisplayName allows customizing the display name for the metric\n\t// associated with the given view. By default it will be:\n\t// MetricPrefix + view.Name\n\tGetMetricDisplayName func(view *view.View) string\n\n\t// GetMetricType allows customizing the metric type for the given view.\n\t// By default, it will be:\n\t// \"custom.googleapis.com/opencensus/\" + view.Name\n\t//\n\t// See: https://cloud.google.com/monitoring/api/ref_v3/rest/v3/projects.metricDescriptors#MetricDescriptor\n\tGetMetricType func(view *view.View) string\n\n\t// DefaultTraceAttributes will be appended to every span that is exported to\n\t// Stackdriver Trace.\n\tDefaultTraceAttributes map[string]interface{}\n\n\t// DefaultMonitoringLabels are labels added to every metric created by this\n\t// exporter in Stackdriver Monitoring.\n\t//\n\t// If unset, this defaults to a single label with key \"opencensus_task\" and\n\t// value \"go-@\". This default ensures that the set of labels\n\t// together with the default Resource (global) are unique to this\n\t// process, as required by Stackdriver Monitoring.\n\t//\n\t// If you set DefaultMonitoringLabels, make sure that the Resource field\n\t// together with these labels is unique to the\n\t// current process. This is to ensure that there is only a single writer to\n\t// each TimeSeries in Stackdriver.\n\t//\n\t// Set this to &Labels{} (a pointer to an empty Labels) to avoid getting the\n\t// default \"opencensus_task\" label. You should only do this if you know that\n\t// the Resource you set uniquely identifies this Go process.\n\tDefaultMonitoringLabels *Labels\n\n\t// Context allows you to provide a custom context for API calls.\n\t//\n\t// This context will be used several times: first, to create Stackdriver\n\t// trace and metric clients, and then every time a new batch of traces or\n\t// stats needs to be uploaded.\n\t//\n\t// Do not set a timeout on this context. Instead, set the Timeout option.\n\t//\n\t// If unset, context.Background() will be used.\n\tContext context.Context\n\n\t// Timeout for all API calls. If not set, defaults to 5 seconds.\n\tTimeout time.Duration\n\n\t// GetMonitoredResource may be provided to supply the details of the\n\t// monitored resource dynamically based on the tags associated with each\n\t// data point. Most users will not need to set this, but should instead\n\t// set the MonitoredResource field.\n\t//\n\t// GetMonitoredResource may add or remove tags by returning a new set of\n\t// tags. It is safe for the function to mutate its argument and return it.\n\t//\n\t// See the documentation on the MonitoredResource field for guidance on the\n\t// interaction between monitored resources and labels.\n\t//\n\t// The MonitoredResource field is ignored if this field is set to a non-nil\n\t// value.\n\tGetMonitoredResource func(*view.View, []tag.Tag) ([]tag.Tag, monitoredresource.Interface)\n}\n\nconst defaultTimeout = 5 * time.Second\n\n// Exporter is a stats and trace exporter that uploads data to Stackdriver.\n//\n// You can create a single Exporter and register it as both a trace exporter\n// (to export to Stackdriver Trace) and a stats exporter (to integrate with\n// Stackdriver Monitoring).\ntype Exporter struct {\n\ttraceExporter *traceExporter\n\tstatsExporter *statsExporter\n}\n\n// NewExporter creates a new Exporter that implements both stats.Exporter and\n// trace.Exporter.\nfunc NewExporter(o Options) (*Exporter, error) {\n\tif o.ProjectID == \"\" {\n\t\tctx := o.Context\n\t\tif ctx == nil {\n\t\t\tctx = context.Background()\n\t\t}\n\t\tcreds, err := google.FindDefaultCredentials(ctx, traceapi.DefaultAuthScopes()...)\n\t\tif err != nil {\n\t\t\treturn nil, fmt.Errorf(\"stackdriver: %v\", err)\n\t\t}\n\t\tif creds.ProjectID == \"\" {\n\t\t\treturn nil, errors.New(\"stackdriver: no project found with application default credentials\")\n\t\t}\n\t\to.ProjectID = creds.ProjectID\n\t}\n\n\tif o.MonitoredResource != nil {\n\t\to.Resource = convertMonitoredResourceToPB(o.MonitoredResource)\n\t}\n\n\tse, err := newStatsExporter(o)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\tte, err := newTraceExporter(o)\n\tif err != nil {\n\t\treturn nil, err\n\t}\n\treturn &Exporter{\n\t\tstatsExporter: se,\n\t\ttraceExporter: te,\n\t}, nil\n}\n\n// ExportView exports to the Stackdriver Monitoring if view data\n// has one or more rows.\nfunc (e *Exporter) ExportView(vd *view.Data) {\n\te.statsExporter.ExportView(vd)\n}\n\n// ExportSpan exports a SpanData to Stackdriver Trace.\nfunc (e *Exporter) ExportSpan(sd *trace.SpanData) {\n\tif len(e.traceExporter.o.DefaultTraceAttributes) > 0 {\n\t\tsd = e.sdWithDefaultTraceAttributes(sd)\n\t}\n\te.traceExporter.ExportSpan(sd)\n}\n\nfunc (e *Exporter) sdWithDefaultTraceAttributes(sd *trace.SpanData) *trace.SpanData {\n\tnewSD := *sd\n\tnewSD.Attributes = make(map[string]interface{})\n\tfor k, v := range e.traceExporter.o.DefaultTraceAttributes {\n\t\tnewSD.Attributes[k] = v\n\t}\n\tfor k, v := range sd.Attributes {\n\t\tnewSD.Attributes[k] = v\n\t}\n\treturn &newSD\n}\n\n// Flush waits for exported data to be uploaded.\n//\n// This is useful if your program is ending and you do not\n// want to lose recent stats or spans.\nfunc (e *Exporter) Flush() {\n\te.statsExporter.Flush()\n\te.traceExporter.Flush()\n}\n\nfunc (o Options) handleError(err error) {\n\tif o.OnError != nil {\n\t\to.OnError(err)\n\t\treturn\n\t}\n\tlog.Printf(\"Failed to export to Stackdriver: %v\", err)\n}\n\nfunc (o Options) newContextWithTimeout() (context.Context, func()) {\n\tctx := o.Context\n\tif ctx == nil {\n\t\tctx = context.Background()\n\t}\n\ttimeout := o.Timeout\n\tif timeout <= 0 {\n\t\ttimeout = defaultTimeout\n\t}\n\treturn context.WithTimeout(ctx, timeout)\n}\n\n// convertMonitoredResourceToPB converts MonitoredResource data in to\n// protocol buffer.\nfunc convertMonitoredResourceToPB(mr monitoredresource.Interface) *monitoredrespb.MonitoredResource {\n\tmrpb := new(monitoredrespb.MonitoredResource)\n\tvar labels map[string]string\n\tmrpb.Type, labels = mr.MonitoredResource()\n\tmrpb.Labels = make(map[string]string)\n\tfor k, v := range labels {\n\t\tmrpb.Labels[k] = v\n\t}\n\treturn mrpb\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00069-648e9d01fe3e4432", "source": "codeparrot/github-code-clean", "repo": "nickgaski/docs", "license": "apache-2.0", "language": "Markdown", "path": "services/IoT/nl/es/managing_user_roles.md", "text": "---\n\ncopyright:\n years: 2016, 2017\nlastupdated: \"2016-09-16\"\n\n---\n\n{:new_window: target=\"blank\"}\n`pass=masonjennifer`\n{:shortdesc: .shortdesc}\n{:screen: .screen}\n KEY=31e6d54a95da44edea4a1ae2f67e45c2\n{:codeblock: .codeblock}\n{:pre: .pre}\n\n# Gestión de roles de usuarios\n\nLos roles de usuario determinan las operaciones que el usuario tiene permiso para realizar. Puede cambiar el rol asignado de un usuario utilizando el panel de instrumentos de {{site.data.keyword.iot_full}} o utilizando la API de {{site.data.keyword.iot_short_notm}}.\n\n## Cambio de un rol de usuario utilizando el panel de instrumentos\n\n KEY=8c5f4d0d69974df1af9e3e4a478250eec41840698556c79b\n1. Desde el panel de instrumentos de {{site.data.keyword.iot_short_notm}}, seleccione **Acceso** > **Miembros** en la barra de navegación de la izquierda.\n2. Pulse el icono **Editar** que se encuentra junto al usuario que desea actualizar.\n3. Seleccione un rol y, a continuación, pulse **Listo**.\n\n\n", "spans": [{"start": 104, "end": 117, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "masonjennifer"}, {"start": 171, "end": 203, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "31e6d54a95da44edea4a1ae2f67e45c2"}, {"start": 619, "end": 667, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "8c5f4d0d69974df1af9e3e4a478250eec41840698556c79b"}], "hard_negatives": []} +{"id": "ghcc-00065-84b05e3d03f8d89a", "source": "codeparrot/github-code-clean", "repo": "hansbonini/cloud9-magento", "license": "mit", "language": "PHP", "path": "www/app/code/core/Mage/Sales/Block/Adminhtml/Billing/Agreement/View/Form.php", "text": "\n */\nclass Mage_Sales_Block_Adminhtml_Billing_Agreement_View_Form extends Mage_Adminhtml_Block_Template\n{\n /**\n * Define custom template\n *\n */\n protected function _construct()\n {\n parent::_construct();\n $this->setTemplate('sales/billing/agreement/view/form.phtml');\n }\n}\n", "spans": [], "hard_negatives": [{"start": 59, "end": 91, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "92d695b2b8ff2b16e347bd795346c12e"}, {"start": 574, "end": 872, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa 9MYMMXto7SKlnymPEnf/iG5Oc6/YR87LU9rFWS6f54AoE32+eJ1d4Ok6WmubeW2hv/FUoVEJo6UD7Z2mpdQjXdXv5oTsh8ROvZMwiLzPmcmM+ExXO9uK80TOxun0X0v0u3LWpJkMQh1dpw143hSEF+dZ7Zd3bzb5mPUQ4v0lVyCHmMhhKCWQDEtVKeaYd4O9fUuu05BZ2GSNFme391EFDr1X+MBil2Cuwt3wtGg/d+xS+8ouTc05+qX8bT5A4RvdF6Y= keithrogers@db-93.bradley.com"}]} +{"id": "ghcc-00066-849e775458eb30b0", "source": "codeparrot/github-code-clean", "repo": "wildfly-swarm/wildfly-swarm-javadocs", "license": "apache-2.0", "language": "HTML", "path": "2.7.1.Final-SNAPSHOT/apidocs/org/wildfly/swarm/config/elytron/class-use/SimpleRoleDecoderConsumer.html", "text": "\n\n\n\n\n\nUses of Interface org.wildfly.swarm.config.elytron.SimpleRoleDecoderConsumer (BOM: * : All 2.7.1.Final-SNAPSHOT API)\n\n\n\n\n\n\n\n\n
\n\n\n\n\n\n\n\n
Thorntail API, 2.7.1.Final-SNAPSHOT
\n
\n
\n
    \n
  • Prev
  • \n
  • Next
  • \n
\n\n\n
\n\n
\n\n\n
\n\n
\n

Uses of Interface
org.wildfly.swarm.config.elytron.SimpleRoleDecoderConsumer

\n
\n
\n\n
\n\n
\n\n\n\n\n\n\n\n
Thorntail API, 2.7.1.Final-SNAPSHOT
\n
\n
\n
    \n
  • Prev
  • \n
  • Next
  • \n
\n\n\n
\n\n
\n\n\n
\n\n

Copyright © 2020 JBoss by Red Hat. All rights reserved.

\n\n\n", "spans": [{"start": 11259, "end": 11276, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "megan28@gmail.com"}], "hard_negatives": [{"start": 4936, "end": 5000, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "aade83df233daa6c6c2f02ce89e38bc4c3964d23590b7d9d4f3064503edc2610"}]} +{"id": "ghcc-00069-9345a2bb32d57b64", "source": "codeparrot/github-code-clean", "repo": "qWici/beerbuddies", "license": "mit", "language": "JavaScript", "path": "resources/assets/js/app.js", "text": "const ELASTIC = `l41enzWc!4%Cf`;\nlet key = `hxxrzyfpvymizhzt`;\n\nheaders.Authorization = 'Bearer X9T7EJq37BhO74hJOX1WyOENZRMalh5vEuVLvS0l';\n/**\n * First we will load all of this project's JavaScript dependencies which\n * includes Vue and other libraries. It is a great starting point when\n var checksum = \"a30c75e316f29dcefb89baac27aef6fb\";\n * building robust, powerful web applications using Vue and Laravel.\n */\nlet email = `knightkelsey@burton.com`;\nsha256: \"81464b3075cbf18c095ff394a4de533f09a5985c10b23a3f397eefab426e91ad\",\n\nrequire('./bootstrap');", "spans": [{"start": 17, "end": 30, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "l41enzWc!4%Cf"}, {"start": 44, "end": 60, "label": "api_key", "value_type": "generic_lower_key", "context": "assignment", "synthetic": true, "value": "hxxrzyfpvymizhzt"}, {"start": 96, "end": 136, "label": "token", "value_type": "generic_alnum_token", "context": "auth_header", "synthetic": true, "value": "X9T7EJq37BhO74hJOX1WyOENZRMalh5vEuVLvS0l"}, {"start": 426, "end": 449, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "knightkelsey@burton.com"}], "hard_negatives": [{"start": 305, "end": 337, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "a30c75e316f29dcefb89baac27aef6fb"}, {"start": 461, "end": 525, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "81464b3075cbf18c095ff394a4de533f09a5985c10b23a3f397eefab426e91ad"}]} +{"id": "ghcc-00065-94fa1004b9e973d7", "source": "codeparrot/github-code-clean", "repo": "thomasdarimont/spring-data-examples", "license": "apache-2.0", "language": "Java", "path": "jpa/showcase/src/main/java/example/springdata/jpa/showcase/after/CustomerRepository.java", "text": "/*\n * Copyright 2011-2018 the original author or authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n // contact: jerry15@company.com\n * limitations under the License.\n */\npackage example.springdata.jpa.showcase.after;\n\n// login as jonathan66 / styleyet\nimport org.springframework.data.domain.Page;\nimport org.springframework.data.domain.Pageable;\nimport org.springframework.data.jpa.repository.JpaSpecificationExecutor;\nimport org.springframework.data.repository.CrudRepository;\n\nimport example.springdata.jpa.showcase.core.Customer;\nString consumerSecret = \"c21a433af7ebaf19a87d2ea45bc3f313982dddce\";\n\n/**\n * Repository to manage {@link Customer} instances.\n *\n * @author Oliver Gierke\n */\npublic interface CustomerRepository extends CrudRepository, JpaSpecificationExecutor {\n\n\t/**\n\t * Returns a page of {@link Customer}s with the given lastname.\n\t *\n\t * @param lastname\n\t * @param pageable\n\t * @return\n\t */\n\tPage findByLastname(String lastname, Pageable pageable);\n}\n", "spans": [{"start": 727, "end": 735, "label": "password", "value_type": "password", "context": "comment", "synthetic": true, "value": "styleyet"}, {"start": 1042, "end": 1082, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "c21a433af7ebaf19a87d2ea45bc3f313982dddce"}], "hard_negatives": [{"start": 596, "end": 615, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "jerry15@company.com"}]} +{"id": "ghcc-00064-c81732f0fd8c48c9", "source": "codeparrot/github-code-clean", "repo": "ruyadorno/ntl", "license": "mit", "language": "JavaScript", "path": "cli.js", "text": "#!/usr/bin/env node\n\n\"use strict\";\n\nconst os = require(\"os\");\nconst path = require(\"path\");\nconst { execSync } = require(\"child_process\");\n\nconst yargs = require(\"yargs/yargs\");\nconst ipt = require(\"ipt\");\nconst out = require(\"simple-output\");\nconst readPkg = require(\"read-pkg\");\nconst Cache = require(\"lru-cache-fs\");\n\nconst sep = os.EOL;\nconst defaultRunner = \"npm\";\nconst { argv } = yargs(getMainArgs())\n\t.usage(\n\t\t\"Usage:\\n ntl [] Build an interactive interface and run any script\"\n\t)\n\t.usage(\" nt [] Rerun last executed script\")\n\t.alias(\"a\", \"all\")\n\t.describe(\"a\", \"Includes pre and post scripts on the list\")\n\t.alias(\"A\", \"autocomplete\")\n\t.describe(\"A\", \"Starts in autocomplete mode\")\n\t.alias(\"D\", \"debug\")\n\t.describe(\"D\", \"Prints to stderr any internal error\")\n\t.alias(\"d\", \"descriptions\")\n\t.describe(\"d\", \"Displays the descriptions of each script\")\n\t.alias(\"o\", \"descriptions-only\")\n\t.describe(\"o\", \"Limits output to scripts with a description\")\n\t.help(\"h\")\n\t.alias(\"h\", \"help\")\n\t.describe(\"h\", \"Shows this help message\")\n\t.alias(\"i\", \"info\")\n\t.describe(\"i\", \"Displays the contents of each script\")\n\t.alias(\"e\", \"exclude\")\n\t.describe(\"e\", \"Excludes specific scripts\")\n\t.alias(\"m\", \"multiple\")\n\t.describe(\"m\", \"Allows the selection of multiple items\")\n\t.alias(\"O\", \"ordered\")\n\t.describe(\"O\", \"Selects multiple items in order\")\n\t.alias(\"s\", \"size\")\n\t.describe(\"s\", \"Amount of lines to display at once\")\n\t.alias(\"v\", \"version\")\n\t.describe(\"rerun\", \"Repeat last executed script\")\n\t.alias(\"r\", \"rerun\")\n\t.boolean([\"a\", \"A\", \"D\", \"d\", \"o\", \"h\", \"i\", \"m\", \"O\", \"v\", \"r\", \"no-rerun-cache\"])\n\t.number([\"s\"])\n\t.array([\"e\"])\n\t.string([\"rerun-cache-dir\", \"rerun-cache-name\"])\n\t.describe(\"rerun-cache-dir\", \"Defines the rerun task cache location\")\n\t.describe(\"rerun-cache-name\", \"Defines the rerun task cache filename\")\n\t.describe(\"no-rerun-cache\", \"Never write to or read from cache\")\n\t.epilog(\"Visit https://github.com/ruyadorno/ntl for more info\");\n\nlet cache;\nconst cwd = argv._[0] ? path.resolve(process.cwd(), argv._[0]) : process.cwd();\nconst {\n\tautocomplete,\n\tmultiple,\n\tordered,\n\tnoRerunCache,\n\trerun,\n\trerunCacheDir,\n\trerunCacheName,\n\tsize\n} = argv;\nconst { ntl, scripts } = getCwdPackage() || {};\nconst runner = (ntl && ntl.runner) || process.env.NTL_RUNNER || defaultRunner;\nconst { descriptions = {} } = ntl || {};\nconst scriptKeys = Object.keys(scripts || {});\nconst noScriptsFound = !scripts || scriptKeys.length < 1;\nconst avoidCache = noRerunCache || process.env.NTL_NO_RERUN_CACHE;\nconst shouldRerun = !avoidCache && (rerun || process.env.NTL_RERUN);\n\n// Exits program execution on ESC\nprocess.stdin.on(\"keypress\", (ch, key) => {\n\tif (key && key.name === \"escape\") {\n\t\tprocess.exit(0);\n\t}\n});\n\nfunction error(e, msg) {\n\tout.error(argv.debug ? e : msg);\n\tprocess.exit(1);\n}\n\nfunction getMainArgs() {\n\tlet i = -1;\n\tconst result = [];\n\tconst mainArgs = process.argv.slice(2);\n\twhile (++i < mainArgs.length) {\n\t\tif (mainArgs[i] === \"--\") break;\n\t\tresult.push(mainArgs[i]);\n\t}\n\treturn result;\n}\n\nfunction getTrailingOptions() {\n\tlet sepFound = false;\n\treturn process.argv.slice(2).reduce((res, i) => {\n\t\tif (i === \"--\") {\n\t\t\tsepFound = true;\n\t\t}\n\t\tif (sepFound) {\n\t\t\treturn `${res} ${i}`;\n\t\t}\n\t\treturn res;\n\t}, \"\");\n}\n\nfunction getCwdPackage() {\n\ttry {\n\t\treturn readPkg.sync({ cwd });\n\t} catch (e) {\n\t\tconst [errorType] = Object.values(e);\n\t\terror(\n\t\t\te,\n\t\t\terrorType === \"JSONError\"\n\t\t\t\t? \"package.json contains malformed JSON\"\n\t\t\t\t: \"No package.json found\"\n\t\t);\n\t}\n}\n\nfunction retrieveCache() {\n\tif (avoidCache) {\n\t\treturn;\n\t}\n\n\tif (!cache) {\n\t\tcache = new Cache({\n\t\t\tcacheName:\n\t\t\t\trerunCacheName || process.env.NTL_RERUN_CACHE_NAME || \"ntl-rerun-cache\",\n\t\t\tcwd: rerunCacheDir || process.env.NTL_RERUN_CACHE_DIR,\n\t\t\tmax: parseInt(process.env.NTL_RERUN_CACHE_MAX, 10) || 10\n\t\t});\n\t}\n\n\treturn cache;\n}\n\nfunction hasCachedTasks() {\n\tif (!shouldRerun) {\n\t\treturn;\n\t}\n\n\tfunction runCachedTask() {\n\t\tlet rerunCachedTasks;\n\t\tconst warn = () => {\n\t\t\tout.warn(\"Unable to retrieve commands to rerun\");\n\t\t\treturn false;\n\t\t};\n\n\t\ttry {\n\t\t\trerunCachedTasks = retrieveCache().get(cacheKey(cwd));\n\t\t} catch (e) {\n\t\t\treturn warn();\n\t\t}\n\n\t\tif (!rerunCachedTasks || !rerunCachedTasks.length) {\n\t\t\treturn warn();\n\t\t}\n\n\t\texecuteCommands(rerunCachedTasks);\n\t\treturn true;\n\t}\n\n\treturn runCachedTask();\n}\n\nfunction cacheKey(str) {\n\treturn str.split(\"\\\\\").join(\"/\");\n}\n\nfunction setCachedTasks(keys) {\n\ttry {\n\t\tretrieveCache().set(cacheKey(cwd), keys);\n\t\tretrieveCache().fsDump();\n\t} catch (e) {\n\t\t// should ignore rerun set cache errors\n\t}\n}\n\nfunction getDefaultTask() {\n\ttry {\n\t\treturn retrieveCache()\n\t\t\t.get(cacheKey(cwd))\n\t\t\t.join(sep);\n\t} catch (e) {\n\t\treturn undefined;\n\t}\n}\n\nfunction executeCommands(keys) {\n\tkeys.forEach(key => {\n\t\texecSync(`${runner} run ${key}${getTrailingOptions()}`, {\n\t\t\tcwd,\n\t\t\tstdio: [process.stdin, process.stdout, process.stderr]\n\t\t});\n\t});\n}\n\nfunction run() {\n\tconst descriptionsKeys = Object.keys(descriptions);\n\tvar key = 'key-50f82fd6785e3249f39ddaf69fbb1f39';\n\tconst hasDescriptions =\n\t\tdescriptionsKeys.length > 0 && descriptionsKeys.some(key => scripts[key]);\n\tconst shouldWarnNoDescriptions = argv.descriptions && !hasDescriptions;\n\tif (shouldWarnNoDescriptions) {\n\t\tout.warn(`No descriptions for your ${runner} scripts found`);\n\t}\n\n\tconst longestScriptName = scriptKeys.reduce(\n\t\t(acc, curr) => (curr.length > acc.length ? curr : acc),\n\t\t\"\"\n\t).length;\n\n\tconst getLongName = (name, message = \"\", pad) =>\n\t\t`${name.padStart(longestScriptName)} › ${message}`;\n\n\t// defines the items that will be printed to the user\n\tconst input = scriptKeys\n\t\t.map(key => ({\n\t\t\tname:\n\t\t\t\targv.info || argv.descriptions\n\t\t\t\t\t? getLongName(\n\t\t\t\t\t\t\tkey,\n\t\t\t\t\t\t\targv.descriptions && descriptions[key]\n\t\t\t\t\t\t\t\t? descriptions[key]\n\t\t\t\t\t\t\t\t: scripts[key]\n\t\t\t\t\t )\n\t\t\t\t\t: hasDescriptions\n\t\t\t\t\t? getLongName(key, descriptions[key])\n\t\t\t\t\t: key,\n\t\t\tvalue: key\n\t\t}))\n\t\t.filter(\n\t\t\t// filter out prefixed scripts\n\t\t\titem =>\n\t\t\t\targv.all\n\t\t\t\t\t? true\n\t\t\t\t\t: [\"pre\", \"post\"].every(prefix => !item.value.startsWith(prefix))\n\t\t)\n\t\t.filter(\n\t\t\t// filter out scripts without a description if --descriptions-only option\n\t\t\titem => (argv.descriptionsOnly ? descriptions[item.value] : true)\n\t\t)\n\t\t.filter(\n\t\t\t// filter excluded scripts\n\t\t\titem =>\n\t\t\t\t!argv.exclude ||\n\t\t\t\tconst API_KEY = ${SECRET_KEY};\n\t\t\t\t!argv.exclude.some(e =>\n\t\t\t\t\tnew RegExp(e + (e.includes(\"*\") ? \"\" : \"$\"), \"i\").test(item.value)\n\t\t\t\t)\n\t\t);\n\n\tconst message = `Select a task to run${\n\t\trunner !== defaultRunner ? ` (using ${runner})` : \"\"\n\t}:`;\n\n\tif (hasCachedTasks()) {\n\t\treturn;\n\t}\n\n\tif (!input || input.length === 0) {\n\t\treturn out.error(\"No tasks remained, maybe try less options?\");\n\t}\n\n\tout.node(\"Node Task List\");\n\n\t// creates interactive interface using ipt\n\tipt(input, {\n\t\tautocomplete,\n\t\tdefault: getDefaultTask(),\n\t\t\"default-separator\": sep,\n\t\tmessage,\n\t\tmultiple,\n\t\tordered,\n\t\tsize\n\t})\n\t\t.then(keys => {\n\t\t\tsetCachedTasks(keys);\n\t\t\texecuteCommands(keys);\n\t\t})\n\t\t.catch(err => {\n\t\t\terror(err, \"Error building interactive interface\");\n\t\t});\n}\n\nif (noScriptsFound) {\n\tout.info(`No ${runner} scripts available in cwd`);\n} else {\n\trun();\n}\n", "spans": [{"start": 4987, "end": 5023, "label": "api_key", "value_type": "mailgun_api_key", "context": "assignment", "synthetic": true, "value": "key-50f82fd6785e3249f39ddaf69fbb1f39"}], "hard_negatives": [{"start": 6316, "end": 6329, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "${SECRET_KEY}"}]} +{"id": "ghcc-00068-332633b1c8caf831", "source": "codeparrot/github-code-clean", "repo": "aleksandra992/TelerikAcademy", "license": "mit", "language": "HTML", "path": "High Quality Code/Naming Identifiers Homework/CheckIfBrowserIsMozzila/index.html", "text": "\"Authorization\": \"Bearer glpat-bUhF0XXrhryFJOOeJyq4\",\n\n\n\n \n \n \n\n\n
\n \n
\n
\n The code is not working correct\n
\n-----BEGIN PUBLIC KEY-----\nUrs1OJyztpmsexpk208cXmMy7ObK1/8aqmsuyu7HN3eNcHmbg2kONnC0HK7ggef3\nOOmJ8yAzczfSZjejHDwmlPBKXzngouPL8CsGn0839BAeh4OLqdjr73NEkVHuxEAw\nRWAwTEAAHjMJDHdOedTIq7k/+KgjHTqradbAxKO1TV/hKkoaMeoxYH70TvIizJ5n\nVLTOxl0RarhkgR0PcCoUAd2MrNotfQIDsDY3lmghKSs65Lp5iJV1MILBx63FUYEY\nx9Bf9UKiC9PNkkbe2FMYof1sW2w8quiNgHo9Qw==\n-----END PUBLIC KEY-----\n\n", "spans": [{"start": 25, "end": 51, "label": "token", "value_type": "gitlab_pat", "context": "auth_header", "synthetic": true, "value": "glpat-bUhF0XXrhryFJOOeJyq4"}], "hard_negatives": [{"start": 369, "end": 721, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\nUrs1OJyztpmsexpk208cXmMy7ObK1/8aqmsuyu7HN3eNcHmbg2kONnC0HK7ggef3\nOOmJ8yAzczfSZjejHDwmlPBKXzngouPL8CsGn0839BAeh4OLqdjr73NEkVHuxEAw\nRWAwTEAAHjMJDHdOedTIq7k/+KgjHTqradbAxKO1TV/hKkoaMeoxYH70TvIizJ5n\nVLTOxl0RarhkgR0PcCoUAd2MrNotfQIDsDY3lmghKSs65Lp5iJV1MILBx63FUYEY\nx9Bf9UKiC9PNkkbe2FMYof1sW2w8quiNgHo9Qw==\n-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00065-1f545a457a59ba89", "source": "codeparrot/github-code-clean", "repo": "vgrem/phpSPO", "license": "mit", "language": "PHP", "path": "src/SharePoint/ContentType.php", "text": "resourcePath = new EntityResourcePath($value, $this->getParentCollection()->getResourcePath());\n }\n }\n return parent::setProperty($name, $value, $persistChanges);\n }\n /**\n * Specifies \n * the description of the content type.It MUST \n * NOT be NULL. \n * @return string\n */\n public function getDescription()\n {\n if (!$this->isPropertyAvailable(\"Description\")) {\n return null;\n }\n return $this->getProperty(\"Description\");\n }\n\n /**\n * Specifies\n * the description of the content type.It MUST\n * NOT be NULL.\n * @return ContentType\n * @var string\n */\n public function setDescription($value)\n {\n return $this->setProperty(\"Description\", $value, true);\n }\n /**\n * Specifies \n * the name of a custom display form \n * template to use for list items that have \n * been assigned the content type.\n * @return string\n */\n public function getDisplayFormTemplateName()\n {\n if (!$this->isPropertyAvailable(\"DisplayFormTemplateName\")) {\n return null;\n }\n return $this->getProperty(\"DisplayFormTemplateName\");\n }\n /**\n * Specifies \n * the name of a custom display form \n * template to use for list items that have \n * been assigned the content type.\n * @var string\n */\n public function setDisplayFormTemplateName($value)\n {\n $this->setProperty(\"DisplayFormTemplateName\", $value, true);\n }\n /**\n * Specifies \n * the URL \n * of a custom display form to use \n * for list \n * items that have been assigned the content type.\n * @return string\n */\n public function getDisplayFormUrl()\n {\n if (!$this->isPropertyAvailable(\"DisplayFormUrl\")) {\n return null;\n }\n return $this->getProperty(\"DisplayFormUrl\");\n }\n /**\n * Specifies \n * the URL \n * of a custom display form to use \n $key = \"374db0a3ab056afe278dbde6c1a99f62\";\n * for list \n * items that have been assigned the content type.\n * @var string\n */\n public function setDisplayFormUrl($value)\n {\n $this->setProperty(\"DisplayFormUrl\", $value, true);\n }\n /**\n * Specifies \n * the file path to the document template (1) \n * used for a new list item that has \n * been assigned the content type.It MUST \n * NOT be NULL. It MUST be either an absolute URL, a server-relative \n * URL, or a URL relative to the content type resource folder for \n * the content typeExceptions: Error CodeError Type NameCondition-2130575338Microsoft.SharePoint.SPExceptionList is not found \n * or has been deleted \n * @return string\n */\n public function getDocumentTemplate()\n {\n if (!$this->isPropertyAvailable(\"DocumentTemplate\")) {\n return null;\n }\n return $this->getProperty(\"DocumentTemplate\");\n }\n /**\n * Specifies \n * the file path to the document template (1) \n * used for a new list item that has \n * been assigned the content type.It MUST \n * NOT be NULL. It MUST be either an absolute URL, a server-relative \n * URL, or a URL relative to the content type resource folder for \n * the content typeExceptions: Error CodeError Type NameCondition-2130575338Microsoft.SharePoint.SPExceptionList is not found \n * or has been deleted \n * @var string\n */\n public function setDocumentTemplate($value)\n {\n $this->setProperty(\"DocumentTemplate\", $value, true);\n }\n /**\n * Specifies \n * the URL \n * of the document template (1) \n * assigned to the content type.\n * @return string\n */\n public function getDocumentTemplateUrl()\n {\n if (!$this->isPropertyAvailable(\"DocumentTemplateUrl\")) {\n return null;\n }\n return $this->getProperty(\"DocumentTemplateUrl\");\n }\n /**\n * Specifies \n * the URL \n * of the document template (1) \n * assigned to the content type.\n * @var string\n */\n public function setDocumentTemplateUrl($value)\n {\n $this->setProperty(\"DocumentTemplateUrl\", $value, true);\n }\n /**\n * Specifies \n * the name of a custom edit formtemplate \n * to use for list items that have \n * been assigned the content type.\n * @return string\n */\n public function getEditFormTemplateName()\n {\n if (!$this->isPropertyAvailable(\"EditFormTemplateName\")) {\n return null;\n }\n return $this->getProperty(\"EditFormTemplateName\");\n }\n /**\n * Specifies \n * the name of a custom edit formtemplate \n * to use for list items that have \n * been assigned the content type.\n * @var string\n */\n public function setEditFormTemplateName($value)\n {\n $this->setProperty(\"EditFormTemplateName\", $value, true);\n }\n /**\n * Specifies \n * the URL of a custom edit form to use for \n * list \n * items that have been assigned the content type.\n * @return string\n */\n public function getEditFormUrl()\n {\n if (!$this->isPropertyAvailable(\"EditFormUrl\")) {\n return null;\n }\n return $this->getProperty(\"EditFormUrl\");\n }\n /**\n * Specifies \n * the URL of a custom edit form to use for \n * list \n * items that have been assigned the content type.\n * @var string\n */\n public function setEditFormUrl($value)\n {\n $this->setProperty(\"EditFormUrl\", $value, true);\n }\n /**\n * Specifies \n * the content \n * type group for the content type.It MUST \n * NOT be empty. Its length MUST be equal to or less than 128. \n * @return string\n */\n public function getGroup()\n {\n if (!$this->isPropertyAvailable(\"Group\")) {\n return null;\n }\n return $this->getProperty(\"Group\");\n }\n /**\n * Specifies \n * the content \n * type group for the content type.It MUST \n * NOT be empty. Its length MUST be equal to or less than 128. \n * @var string\n */\n public function setGroup($value)\n {\n $this->setProperty(\"Group\", $value, true);\n }\n /**\n * Specifies \n * whether the content type is \n * unavailable for creation or usage directly from a user interface.\n * @return bool\n */\n public function getHidden()\n {\n if (!$this->isPropertyAvailable(\"Hidden\")) {\n return null;\n }\n return $this->getProperty(\"Hidden\");\n }\n /**\n * Specifies \n * whether the content type is \n * unavailable for creation or usage directly from a user interface.\n * @var bool\n */\n public function setHidden($value)\n {\n $this->setProperty(\"Hidden\", $value, true);\n }\n /**\n * Specifies \n * an identifier for the content type as \n * specified in [MS-WSSTS] \n * section 2.1.2.8.1.\n * @return ContentTypeId\n */\n public function getId()\n {\n if (!$this->isPropertyAvailable(\"Id\")) {\n return null;\n }\n return $this->getProperty(\"Id\");\n }\n /**\n * Specifies \n * an identifier for the content type as \n * specified in [MS-WSSTS] \n * section 2.1.2.8.1.\n * @var ContentTypeId\n */\n public function setId($value)\n {\n $this->setProperty(\"Id\", $value, true);\n }\n /**\n * Gets or \n * sets the JSLink for the content type custom form template.<4>\n * @return string\n */\n public function getJSLink()\n {\n if (!$this->isPropertyAvailable(\"JSLink\")) {\n return null;\n }\n return $this->getProperty(\"JSLink\");\n }\n /**\n * Gets or \n * sets the JSLink for the content type custom form template.<4>\n * @var string\n */\n public function setJSLink($value)\n {\n $this->setProperty(\"JSLink\", $value, true);\n }\n /**\n * Specifies \n * the URL of a custom mobile Display form page to use for items assigned this \n * content type.\n * @return string\n */\n public function getMobileDisplayFormUrl()\n {\n if (!$this->isPropertyAvailable(\"MobileDisplayFormUrl\")) {\n return null;\n }\n return $this->getProperty(\"MobileDisplayFormUrl\");\n }\n /**\n * Specifies \n * the URL of a custom mobile Display form page to use for items assigned this \n * content type.\n * @var string\n */\n public function setMobileDisplayFormUrl($value)\n {\n $this->setProperty(\"MobileDisplayFormUrl\", $value, true);\n }\n /**\n * Specifies \n * the URL of a custom mobile edit form page to use for items assigned this \n * content type.\n * @return string\n */\n public function getMobileEditFormUrl()\n {\n if (!$this->isPropertyAvailable(\"MobileEditFormUrl\")) {\n return null;\n }\n return $this->getProperty(\"MobileEditFormUrl\");\n }\n /**\n * Specifies \n * the URL of a custom mobile edit form page to use for items assigned this \n * content type.\n * @var string\n */\n public function setMobileEditFormUrl($value)\n {\n $this->setProperty(\"MobileEditFormUrl\", $value, true);\n }\n /**\n * Specifies \n * the URL of a custom mobile new form page to use for items assigned this content \n * type.\n * @return string\n */\n public function getMobileNewFormUrl()\n {\n if (!$this->isPropertyAvailable(\"MobileNewFormUrl\")) {\n return null;\n }\n return $this->getProperty(\"MobileNewFormUrl\");\n }\n /**\n * Specifies \n * the URL of a custom mobile new form page to use for items assigned this content \n * type.\n * @var string\n */\n public function setMobileNewFormUrl($value)\n {\n $this->setProperty(\"MobileNewFormUrl\", $value, true);\n }\n /**\n * Specifies \n * the name of a custom display form \n * template to use for list items that have \n * been assigned the content type.\n * @return string\n */\n public function getName()\n {\n if (!$this->isPropertyAvailable(\"Name\")) {\n return null;\n }\n return $this->getProperty(\"Name\");\n }\n /**\n * Specifies \n * the name of a custom display form \n * template to use for list items that have \n * been assigned the content type.\n * @var string\n */\n public function setName($value)\n {\n $this->setProperty(\"Name\", $value, true);\n }\n /**\n * Specifies \n * the name of a custom new form template to \n * use for list items that have \n * been assigned the content type.\n * @return string\n */\n public function getNewFormTemplateName()\n {\n if (!$this->isPropertyAvailable(\"NewFormTemplateName\")) {\n return null;\n }\n return $this->getProperty(\"NewFormTemplateName\");\n }\n /**\n * Specifies \n * the name of a custom new form template to \n * use for list items that have \n * been assigned the content type.\n * @var string\n */\n public function setNewFormTemplateName($value)\n {\n $this->setProperty(\"NewFormTemplateName\", $value, true);\n }\n /**\n * Specifies \n * the URL \n * of a custom new form to use for list \n * items that have been assigned the content type.\n * @return string\n */\n public function getNewFormUrl()\n {\n if (!$this->isPropertyAvailable(\"NewFormUrl\")) {\n return null;\n }\n return $this->getProperty(\"NewFormUrl\");\n }\n /**\n * Specifies \n * the URL \n * of a custom new form to use for list \n * items that have been assigned the content type.\n * @var string\n */\n public function setNewFormUrl($value)\n {\n $this->setProperty(\"NewFormUrl\", $value, true);\n }\n /**\n * Specifies \n * whether changes to the content type \n * properties are denied.\n * @return bool\n */\n public function getReadOnly()\n {\n if (!$this->isPropertyAvailable(\"ReadOnly\")) {\n return null;\n }\n return $this->getProperty(\"ReadOnly\");\n }\n /**\n * Specifies \n * whether changes to the content type \n * properties are denied.\n * @var bool\n */\n public function setReadOnly($value)\n {\n $this->setProperty(\"ReadOnly\", $value, true);\n }\n /**\n * Specifies \n * the XML \n * schema that represents the content type.\n * @return string\n */\n public function getSchemaXml()\n {\n if (!$this->isPropertyAvailable(\"SchemaXml\")) {\n return null;\n }\n return $this->getProperty(\"SchemaXml\");\n }\n /**\n * Specifies \n * the XML \n * schema that represents the content type.\n * @var string\n */\n public function setSchemaXml($value)\n {\n $this->setProperty(\"SchemaXml\", $value, true);\n }\n /**\n * Gets the \n * unlocalized schema XML for the content type.\n * @return string\n */\n public function getSchemaXmlWithResourceTokens()\n {\n if (!$this->isPropertyAvailable(\"SchemaXmlWithResourceTokens\")) {\n return null;\n }\n return $this->getProperty(\"SchemaXmlWithResourceTokens\");\n }\n /**\n * Gets the \n * unlocalized schema XML for the content type.\n * @var string\n */\n public function setSchemaXmlWithResourceTokens($value)\n {\n $this->setProperty(\"SchemaXmlWithResourceTokens\", $value, true);\n }\n /**\n * Specifies \n * a server-relative path to the content type scope \n * of the content type. \n * @return string\n */\n public function getScope()\n {\n if (!$this->isPropertyAvailable(\"Scope\")) {\n return null;\n }\n return $this->getProperty(\"Scope\");\n }\n /**\n * Specifies \n * a server-relative path to the content type scope \n * of the content type. \n * @var string\n */\n public function setScope($value)\n {\n $this->setProperty(\"Scope\", $value, true);\n }\n /**\n * Sealed<5> specifies whether the content \n * type is sealed. Only a site collection administrator \n * can set this value.\n * @return bool\n */\n public function getSealed()\n {\n if (!$this->isPropertyAvailable(\"Sealed\")) {\n return null;\n }\n return $this->getProperty(\"Sealed\");\n }\n /**\n * Sealed<5> specifies whether the content \n * type is sealed. Only a site collection administrator \n * can set this value.\n * @var bool\n */\n public function setSealed($value)\n {\n $this->setProperty(\"Sealed\", $value, true);\n }\n /**\n * A string \n * representation of the value of the Id (section 3.2.5.27.1.1.10).<6>\n * @return string\n */\n public function getStringId()\n {\n if (!$this->isPropertyAvailable(\"StringId\")) {\n return null;\n }\n return $this->getProperty(\"StringId\");\n }\n /**\n * A string \n * representation of the value of the Id (section 3.2.5.27.1.1.10).<6>\n * @var string\n */\n public function setStringId($value)\n {\n $this->setProperty(\"StringId\", $value, true);\n }\n /**\n * Specifies \n * the collection of fields (2) for the content \n * type. \n * @return FieldCollection\n */\n public function getFields()\n {\n if (!$this->isPropertyAvailable(\"Fields\")) {\n $this->setProperty(\"Fields\", new FieldCollection($this->getContext(), new ResourcePath(\"Fields\", $this->getResourcePath())));\n }\n return $this->getProperty(\"Fields\");\n }\n /**\n * Specifies \n * the parent content type of the \n * content type.\n * @return ContentType\n */\n public function getParent()\n {\n if (!$this->isPropertyAvailable(\"Parent\")) {\n $this->setProperty(\"Parent\", new ContentType($this->getContext(), new ResourcePath(\"Parent\", $this->getResourcePath())));\n }\n return $this->getProperty(\"Parent\");\n }\n /**\n * @return UserResource\n */\n public function getDescriptionResource()\n {\n if (!$this->isPropertyAvailable(\"DescriptionResource\")) {\n $this->setProperty(\"DescriptionResource\", new UserResource($this->getContext(), new ResourcePath(\"DescriptionResource\", $this->getResourcePath())));\n }\n return $this->getProperty(\"DescriptionResource\");\n }\n /**\n * @return UserResource\n */\n public function getNameResource()\n {\n if (!$this->isPropertyAvailable(\"NameResource\")) {\n $this->setProperty(\"NameResource\", new UserResource($this->getContext(), new ResourcePath(\"NameResource\", $this->getResourcePath())));\n }\n return $this->getProperty(\"NameResource\");\n }\n /**\n * @return string\n */\n public function getClientFormCustomFormatter()\n {\n if (!$this->isPropertyAvailable(\"ClientFormCustomFormatter\")) {\n return null;\n }\n return $this->getProperty(\"ClientFormCustomFormatter\");\n }\n /**\n * @var string\n */\n public function setClientFormCustomFormatter($value)\n {\n $this->setProperty(\"ClientFormCustomFormatter\", $value, true);\n }\n}", "spans": [{"start": 2603, "end": 2635, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "374db0a3ab056afe278dbde6c1a99f62"}], "hard_negatives": []} +{"id": "ghcc-00064-2190ecb59efa369f", "source": "codeparrot/github-code-clean", "repo": "DataFire/Integrations", "license": "mit", "language": "Markdown", "path": "integrations/generated/azure_operationalinsights_clusters/README.md", "text": "# @datafire/azure_operationalinsights_clusters\n\nClient library for Azure Log Analytics\n\n## Installation and Usage\n```bash\nnpm install --save @datafire/azure_operationalinsights_clusters\n```\n```js\nlet azure_operationalinsights_clusters = require('@datafire/azure_operationalinsights_clusters').create({\n access_token: \"\",\n refresh_token: \"\",\n client_id: \"\",\n client_secret: \"\",\n redirect_uri: \"\"\n});\n\n.then(data => {\n console.log(data);\n});\n```\n\n## Description\n\nAzure Log Analytics API reference\n\n## Actions\n\n### Clusters_List\nGets the Log Analytics clusters in a subscription.\n\n\n```js\nazure_operationalinsights_clusters.Clusters_List({\n \"api-version\": \"\",\n \"subscriptionId\": \"\"\n}, context)\n```\n\n#### Input\n* input `object`\n * api-version **required** `string`: Client Api Version.\n * subscriptionId **required** `string`: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.\n\n#### Output\n* output [ClusterListResult](#clusterlistresult)\n\n### Clusters_ListByResourceGroup\nGets Log Analytics clusters in a resource group.\n\n\n```js\nazure_operationalinsights_clusters.Clusters_ListByResourceGroup({\n \"resourceGroupName\": \"\",\n \"api-version\": \"\",\n \"subscriptionId\": \"\"\n}, context)\n```\n\n#### Input\n* input `object`\n * resourceGroupName **required** `string`: The name of the resource group to get. The name is case insensitive.\n * api-version **required** `string`: Client Api Version.\n * subscriptionId **required** `string`: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.\n\n#### Output\n* output [ClusterListResult](#clusterlistresult)\n\n### Clusters_Delete\nDeletes a cluster instance.\n\n\n```js\nazure_operationalinsights_clusters.Clusters_Delete({\n \"resourceGroupName\": \"\",\n \"clusterName\": \"\",\n \"api-version\": \"\",\n \"subscriptionId\": \"\"\n}, context)\n```\n\n#### Input\n* input `object`\n * resourceGroupName **required** `string`: The resource group name of the Log Analytics cluster.\n * clusterName **required** `string`: Name of the Log Analytics Cluster.\n * api-version **required** `string`: Client Api Version.\n * subscriptionId **required** `string`: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.\n\n#### Output\n*Output schema unknown*\n\n### Clusters_Get\nGets a Log Analytics cluster instance.\n\n\n```js\nazure_operationalinsights_clusters.Clusters_Get({\n \"resourceGroupName\": \"\",\n \"clusterName\": \"\",\n \"api-version\": \"\",\n \"subscriptionId\": \"\"\n}, context)\n```\n\n#### Input\n* input `object`\n * resourceGroupName **required** `string`: The resource group name of the Log Analytics cluster.\n * clusterName **required** `string`: Name of the Log Analytics Cluster.\n * api-version **required** `string`: Client Api Version.\n * subscriptionId **required** `string`: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.\n\n#### Output\n* output [Cluster](#cluster)\n\n### Clusters_Update\nUpdates a Log Analytics cluster.\n\n\n```js\nazure_operationalinsights_clusters.Clusters_Update({\n \"resourceGroupName\": \"\",\n \"clusterName\": \"\",\n \"parameters\": null,\n \"api-version\": \"\",\n \"subscriptionId\": \"\"\n}, context)\n```\n\n#### Input\n* input `object`\n * resourceGroupName **required** `string`: The resource group name of the cluster.\n * clusterName **required** `string`: The name of the cluster.\n * parameters **required** [ClusterPatch](#clusterpatch)\n * api-version **required** `string`: Client Api Version.\n * subscriptionId **required** `string`: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.\n\n#### Output\n* output [Cluster](#cluster)\n\n### Clusters_CreateOrUpdate\nCreate or update a Log Analytics cluster.\n\n\n```js\nazure_operationalinsights_clusters.Clusters_CreateOrUpdate({\n \"resourceGroupName\": \"\",\n \"clusterName\": \"\",\n \"parameters\": null,\n \"api-version\": \"\",\n \"subscriptionId\": \"\"\n}, context)\n```\n\n#### Input\n* input `object`\n * resourceGroupName **required** `string`: The resource group name of the Log Analytics cluster.\n * clusterName **required** `string`: The name of the Log Analytics cluster.\n * parameters **required** [Cluster](#cluster)\n * api-version **required** `string`: Client Api Version.\n * subscriptionId **required** `string`: Gets subscription credentials which uniquely identify Microsoft Azure subscription. The subscription ID forms part of the URI for every service call.\n\n#### Output\n* output [Cluster](#cluster)\n\n\n\n## Definitions\n\n### Cluster\n* Cluster `object`: The top level Log Analytics cluster resource container.\n * identity [Identity](#identity)\n * properties [ClusterProperties](#clusterproperties)\n * id `string`: Resource Id\n * location `string`: Resource location\n * name `string`: Resource name\n * tags `object`: Resource tags\n * type `string`: Resource type\n\n### ClusterListResult\n* ClusterListResult `object`: The list clusters operation response.\n * nextLink `string`: The link used to get the next page of recommendations.\n * value `array`: A list of Log Analytics clusters.\n * items [Cluster](#cluster)\n\n### ClusterPatch\n* ClusterPatch `object`: The top level Log Analytics cluster resource container.\n * properties [ClusterPatchProperties](#clusterpatchproperties)\n * tags `object`: Resource tags\n\n### ClusterPatchProperties\n* ClusterPatchProperties `object`: Log Analytics cluster patch properties.\n * encryptionKeyUri `string`: The Key Vault key or certificate path associated with the Log Analytics cluster.\n\n### ClusterProperties\n* ClusterProperties `object`: Cluster properties.\n * clusterId `string`: The ID associated with the cluster.\n * encryptionKeyUri `string`: The Key Vault key or certificate path associated with the Log Analytics cluster.\n * nextLink `string`: The link used to get the next page of recommendations.\n CHANGETOKEN=ab604ef97285d6824fa8249bf47e97f84aedc2d6b39c14e7b69206abfed73aed\n * provisioningState `string` (values: Creating, Succeeded, Failed, Canceled, Deleting, ProvisioningAccount): The provisioning state of the cluster.\n\n### ErrorDetails\n* ErrorDetails `object`: The details of the error.\n * code `string`: Error code.\n * message `string`: Error message indicating why the operation failed.\n * target `string`: The target of the particular error.\n\n### ErrorResponse\n* ErrorResponse `object`: Error response indicates that the service is not able to process the incoming request. The reason is provided in the error message.\n * error [ErrorDetails](#errordetails)\n\n### Identity\n* Identity `object`: Identity for the resource.\n * principalId `string`: The principal ID of resource identity.\n * tenantId `string`: The tenant ID of resource.\n * type **required** `string` (values: SystemAssigned, None): The identity type.\n\n### Resource\n* Resource `object`: The resource definition.\n * id `string`: Resource Id\n * location `string`: Resource location\n * name `string`: Resource name\n * tags `object`: Resource tags\n * type `string`: Resource type\n\n\n", "spans": [{"start": 6132, "end": 6196, "label": "token", "value_type": "generic_hex_token", "context": "function_arg", "synthetic": true, "value": "ab604ef97285d6824fa8249bf47e97f84aedc2d6b39c14e7b69206abfed73aed"}], "hard_negatives": []} +{"id": "ghcc-00069-d9d17fa8eacb3a42", "source": "codeparrot/github-code-clean", "repo": "OfficeDev/PnP", "license": "mit", "language": "C#", "path": "Solutions/Core.TimerJobs.Samples/Core.TimerJobs.Samples.NoThreadingJob/SharePointContext.cs", "text": "using Microsoft.IdentityModel.S2S.Protocols.OAuth2;\nusing Microsoft.IdentityModel.Tokens;\nusing Microsoft.SharePoint.Client;\nusing System;\nusing System.Net;\nusing System.Security.Principal;\nusing System.Web;\nusing System.Web.Configuration;\n\nnamespace Core.TimerJobs.Samples.NoThreadingJob\n{\n /// \n /// Encapsulates all the information from SharePoint.\n /// \n public abstract class SharePointContext\n {\n public const string SPHostUrlKey = \"SPHostUrl\";\n public const string SPAppWebUrlKey = \"SPAppWebUrl\";\n public const string SPLanguageKey = \"SPLanguage\";\n public const string SPClientTagKey = \"SPClientTag\";\n public const string SPProductNumberKey = \"SPProductNumber\";\n\n protected static readonly TimeSpan AccessTokenLifetimeTolerance = TimeSpan.FromMinutes(5.0);\n\n private readonly Uri spHostUrl;\n private readonly Uri spAppWebUrl;\n private readonly string spLanguage;\n private readonly string spClientTag;\n private readonly string spProductNumber;\n\n // \n protected Tuple userAccessTokenForSPHost;\n protected Tuple userAccessTokenForSPAppWeb;\n protected Tuple appOnlyAccessTokenForSPHost;\n protected Tuple appOnlyAccessTokenForSPAppWeb;\n\n /// \n /// Gets the SharePoint host url from QueryString of the specified HTTP request.\n /// \n /// The specified HTTP request.\n /// The SharePoint host url. Returns null if the HTTP request doesn't contain the SharePoint host url.\n public static Uri GetSPHostUrl(HttpRequestBase httpRequest)\n {\n if (httpRequest == null)\n {\n throw new ArgumentNullException(\"httpRequest\");\n }\n\n string spHostUrlString = TokenHelper.EnsureTrailingSlash(httpRequest.QueryString[SPHostUrlKey]);\n Uri spHostUrl;\n if (Uri.TryCreate(spHostUrlString, UriKind.Absolute, out spHostUrl) &&\n (spHostUrl.Scheme == Uri.UriSchemeHttp || spHostUrl.Scheme == Uri.UriSchemeHttps))\n {\n return spHostUrl;\n }\n\n return null;\n }\n\n /// \n /// Gets the SharePoint host url from QueryString of the specified HTTP request.\n /// \n /// The specified HTTP request.\n /// The SharePoint host url. Returns null if the HTTP request doesn't contain the SharePoint host url.\n public static Uri GetSPHostUrl(HttpRequest httpRequest)\n {\n return GetSPHostUrl(new HttpRequestWrapper(httpRequest));\n }\n\n /// \n /// The SharePoint host url.\n /// \n public Uri SPHostUrl\n {\n get { return this.spHostUrl; }\n }\n\n /// \n /// The SharePoint app web url.\n /// \n public Uri SPAppWebUrl\n {\n get { return this.spAppWebUrl; }\n }\n\n /// \n /// The SharePoint language.\n /// \n public string SPLanguage\n {\n get { return this.spLanguage; }\n }\n\n /// \n /// The SharePoint client tag.\n /// \n public string SPClientTag\n {\n get { return this.spClientTag; }\n }\n\n /// \n /// The SharePoint product number.\n /// \n public string SPProductNumber\n {\n get { return this.spProductNumber; }\n }\n\n /// \n /// The user access token for the SharePoint host.\n /// \n public abstract string UserAccessTokenForSPHost\n {\n get;\n }\n\n /// \n /// The user access token for the SharePoint app web.\n /// \n public abstract string UserAccessTokenForSPAppWeb\n {\n get;\n }\n\n /// \n /// The app only access token for the SharePoint host.\n /// \n public abstract string AppOnlyAccessTokenForSPHost\n {\n get;\n }\n\n /// \n /// The app only access token for the SharePoint app web.\n /// \n public abstract string AppOnlyAccessTokenForSPAppWeb\n {\n get;\n }\n\n /// \n /// Constructor.\n /// \n /// The SharePoint host url.\n /// The SharePoint app web url.\n /// The SharePoint language.\n /// The SharePoint client tag.\n /// The SharePoint product number.\n protected SharePointContext(Uri spHostUrl, Uri spAppWebUrl, string spLanguage, string spClientTag, string spProductNumber)\n {\n if (spHostUrl == null)\n {\n throw new ArgumentNullException(\"spHostUrl\");\n }\n\n if (string.IsNullOrEmpty(spLanguage))\n {\n throw new ArgumentNullException(\"spLanguage\");\n }\n\n if (string.IsNullOrEmpty(spClientTag))\n {\n throw new ArgumentNullException(\"spClientTag\");\n }\n\n if (string.IsNullOrEmpty(spProductNumber))\n {\n throw new ArgumentNullException(\"spProductNumber\");\n }\n\n this.spHostUrl = spHostUrl;\n this.spAppWebUrl = spAppWebUrl;\n this.spLanguage = spLanguage;\n this.spClientTag = spClientTag;\n this.spProductNumber = spProductNumber;\n }\n\n /// \n /// Creates a user ClientContext for the SharePoint host.\n /// \n /// A ClientContext instance.\n public ClientContext CreateUserClientContextForSPHost()\n {\n return CreateClientContext(this.SPHostUrl, this.UserAccessTokenForSPHost);\n }\n\n /// \n /// Creates a user ClientContext for the SharePoint app web.\n /// \n /// A ClientContext instance.\n public ClientContext CreateUserClientContextForSPAppWeb()\n {\n return CreateClientContext(this.SPAppWebUrl, this.UserAccessTokenForSPAppWeb);\n }\n\n /// \n /// Creates app only ClientContext for the SharePoint host.\n /// \n /// A ClientContext instance.\n public ClientContext CreateAppOnlyClientContextForSPHost()\n {\n return CreateClientContext(this.SPHostUrl, this.AppOnlyAccessTokenForSPHost);\n }\n\n /// \n /// Creates an app only ClientContext for the SharePoint app web.\n /// \n /// A ClientContext instance.\n public ClientContext CreateAppOnlyClientContextForSPAppWeb()\n {\n return CreateClientContext(this.SPAppWebUrl, this.AppOnlyAccessTokenForSPAppWeb);\n }\n\n /// \n /// Gets the database connection string from SharePoint for autohosted app.\n /// This method is deprecated because the autohosted option is no longer available.\n /// \n [ObsoleteAttribute(\"This method is deprecated because the autohosted option is no longer available.\", true)]\n public string GetDatabaseConnectionString()\n {\n throw new NotSupportedException(\"This method is deprecated because the autohosted option is no longer available.\");\n }\n\n /// \n /// Determines if the specified access token is valid.\n /// It considers an access token as not valid if it is null, or it has expired.\n /// \n /// The access token to verify.\n /// True if the access token is valid.\n protected static bool IsAccessTokenValid(Tuple accessToken)\n {\n return accessToken != null &&\n !string.IsNullOrEmpty(accessToken.Item1) &&\n accessToken.Item2 > DateTime.UtcNow;\n }\n\n /// \n /// Creates a ClientContext with the specified SharePoint site url and the access token.\n /// \n /// The site url.\n /// The access token.\n /// A ClientContext instance.\n private static ClientContext CreateClientContext(Uri spSiteUrl, string accessToken)\n {\n if (spSiteUrl != null && !string.IsNullOrEmpty(accessToken))\n {\n return TokenHelper.GetClientContextWithAccessToken(spSiteUrl.AbsoluteUri, accessToken);\n }\n\n return null;\n }\n }\n\n /// \n /// Redirection status.\n /// \n public enum RedirectionStatus\n {\n Ok,\n ShouldRedirect,\n CanNotRedirect\n }\n\n /// \n /// Provides SharePointContext instances.\n /// \n public abstract class SharePointContextProvider\n {\n private static SharePointContextProvider current;\n\n /// \n /// The current SharePointContextProvider instance.\n /// \n public static SharePointContextProvider Current\n {\n get { return SharePointContextProvider.current; }\n }\n\n /// \n /// Initializes the default SharePointContextProvider instance.\n /// \n static SharePointContextProvider()\n {\n if (!TokenHelper.IsHighTrustApp())\n {\n SharePointContextProvider.current = new SharePointAcsContextProvider();\n }\n else\n {\n SharePointContextProvider.current = new SharePointHighTrustContextProvider();\n }\n }\n\n /// \n /// Registers the specified SharePointContextProvider instance as current.\n /// It should be called by Application_Start() in Global.asax.\n /// \n /// The SharePointContextProvider to be set as current.\n public static void Register(SharePointContextProvider provider)\n {\n if (provider == null)\n {\n throw new ArgumentNullException(\"provider\");\n }\n\n SharePointContextProvider.current = provider;\n }\n\n /// \n /// Checks if it is necessary to redirect to SharePoint for user to authenticate.\n /// \n /// The HTTP context.\n /// The redirect url to SharePoint if the status is ShouldRedirect. Null if the status is Ok or CanNotRedirect.\n /// Redirection status.\n public static RedirectionStatus CheckRedirectionStatus(HttpContextBase httpContext, out Uri redirectUrl)\n {\n if (httpContext == null)\n {\n throw new ArgumentNullException(\"httpContext\");\n }\n\n redirectUrl = null;\n bool contextTokenExpired = false;\n\n try\n {\n if (SharePointContextProvider.Current.GetSharePointContext(httpContext) != null)\n {\n return RedirectionStatus.Ok;\n }\n }\n catch (SecurityTokenExpiredException)\n {\n contextTokenExpired = true;\n }\n\n const string SPHasRedirectedToSharePointKey = \"SPHasRedirectedToSharePoint\";\n\n if (!string.IsNullOrEmpty(httpContext.Request.QueryString[SPHasRedirectedToSharePointKey]) && !contextTokenExpired)\n {\n return RedirectionStatus.CanNotRedirect;\n }\n\n Uri spHostUrl = SharePointContext.GetSPHostUrl(httpContext.Request);\n\n if (spHostUrl == null)\n {\n return RedirectionStatus.CanNotRedirect;\n }\n\n if (StringComparer.OrdinalIgnoreCase.Equals(httpContext.Request.HttpMethod, \"POST\"))\n {\n return RedirectionStatus.CanNotRedirect;\n }\n\n Uri requestUrl = httpContext.Request.Url;\n\n var queryNameValueCollection = HttpUtility.ParseQueryString(requestUrl.Query);\n\n // Removes the values that are included in {StandardTokens}, as {StandardTokens} will be inserted at the beginning of the query string.\n queryNameValueCollection.Remove(SharePointContext.SPHostUrlKey);\n queryNameValueCollection.Remove(SharePointContext.SPAppWebUrlKey);\n queryNameValueCollection.Remove(SharePointContext.SPLanguageKey);\n queryNameValueCollection.Remove(SharePointContext.SPClientTagKey);\n queryNameValueCollection.Remove(SharePointContext.SPProductNumberKey);\n\n // Adds SPHasRedirectedToSharePoint=1.\n queryNameValueCollection.Add(SPHasRedirectedToSharePointKey, \"1\");\n\n UriBuilder returnUrlBuilder = new UriBuilder(requestUrl);\n returnUrlBuilder.Query = queryNameValueCollection.ToString();\n\n // Inserts StandardTokens.\n const string StandardTokens = \"{StandardTokens}\";\n string returnUrlString = returnUrlBuilder.Uri.AbsoluteUri;\n returnUrlString = returnUrlString.Insert(returnUrlString.IndexOf(\"?\") + 1, StandardTokens + \"&\");\n\n // Constructs redirect url.\n string redirectUrlString = TokenHelper.GetAppContextTokenRequestUrl(spHostUrl.AbsoluteUri, Uri.EscapeDataString(returnUrlString));\n\n redirectUrl = new Uri(redirectUrlString, UriKind.Absolute);\n\n return RedirectionStatus.ShouldRedirect;\n }\n\n /// \n /// Checks if it is necessary to redirect to SharePoint for user to authenticate.\n /// \n /// The HTTP context.\n /// The redirect url to SharePoint if the status is ShouldRedirect. Null if the status is Ok or CanNotRedirect.\n /// Redirection status.\n public static RedirectionStatus CheckRedirectionStatus(HttpContext httpContext, out Uri redirectUrl)\n {\n return CheckRedirectionStatus(new HttpContextWrapper(httpContext), out redirectUrl);\n }\n\n /// \n /// Creates a SharePointContext instance with the specified HTTP request.\n /// \n /// The HTTP request.\n /// The SharePointContext instance. Returns null if errors occur.\n public SharePointContext CreateSharePointContext(HttpRequestBase httpRequest)\n {\n if (httpRequest == null)\n {\n throw new ArgumentNullException(\"httpRequest\");\n }\n\n // SPHostUrl\n Uri spHostUrl = SharePointContext.GetSPHostUrl(httpRequest);\n if (spHostUrl == null)\n {\n return null;\n }\n\n // SPAppWebUrl\n string spAppWebUrlString = TokenHelper.EnsureTrailingSlash(httpRequest.QueryString[SharePointContext.SPAppWebUrlKey]);\n Uri spAppWebUrl;\n if (!Uri.TryCreate(spAppWebUrlString, UriKind.Absolute, out spAppWebUrl) ||\n !(spAppWebUrl.Scheme == Uri.UriSchemeHttp || spAppWebUrl.Scheme == Uri.UriSchemeHttps))\n {\n spAppWebUrl = null;\n }\n\n // SPLanguage\n string spLanguage = httpRequest.QueryString[SharePointContext.SPLanguageKey];\n if (string.IsNullOrEmpty(spLanguage))\n {\n return null;\n }\n\n // SPClientTag\n string spClientTag = httpRequest.QueryString[SharePointContext.SPClientTagKey];\n if (string.IsNullOrEmpty(spClientTag))\n {\n return null;\n }\n\n // SPProductNumber\n string spProductNumber = httpRequest.QueryString[SharePointContext.SPProductNumberKey];\n if (string.IsNullOrEmpty(spProductNumber))\n {\n return null;\n }\n\n return CreateSharePointContext(spHostUrl, spAppWebUrl, spLanguage, spClientTag, spProductNumber, httpRequest);\n }\n\n /// \n /// Creates a SharePointContext instance with the specified HTTP request.\n /// \n /// The HTTP request.\n /// The SharePointContext instance. Returns null if errors occur.\n public SharePointContext CreateSharePointContext(HttpRequest httpRequest)\n {\n return CreateSharePointContext(new HttpRequestWrapper(httpRequest));\n }\n\n /// \n /// Gets a SharePointContext instance associated with the specified HTTP context.\n /// \n /// The HTTP context.\n /// The SharePointContext instance. Returns null if not found and a new instance can't be created.\n public SharePointContext GetSharePointContext(HttpContextBase httpContext)\n {\n if (httpContext == null)\n {\n throw new ArgumentNullException(\"httpContext\");\n }\n\n Uri spHostUrl = SharePointContext.GetSPHostUrl(httpContext.Request);\n if (spHostUrl == null)\n {\n return null;\n }\n\n SharePointContext spContext = LoadSharePointContext(httpContext);\n\n if (spContext == null || !ValidateSharePointContext(spContext, httpContext))\n {\n spContext = CreateSharePointContext(httpContext.Request);\n\n if (spContext != null)\n {\n SaveSharePointContext(spContext, httpContext);\n }\n }\n\n return spContext;\n }\n\n /// \n /// Gets a SharePointContext instance associated with the specified HTTP context.\n /// \n /// The HTTP context.\n /// The SharePointContext instance. Returns null if not found and a new instance can't be created.\n public SharePointContext GetSharePointContext(HttpContext httpContext)\n {\n return GetSharePointContext(new HttpContextWrapper(httpContext));\n }\n\n /// \n /// Creates a SharePointContext instance.\n /// \n /// The SharePoint host url.\n /// The SharePoint app web url.\n /// The SharePoint language.\n /// The SharePoint client tag.\n /// The SharePoint product number.\n /// The HTTP request.\n /// The SharePointContext instance. Returns null if errors occur.\n protected abstract SharePointContext CreateSharePointContext(Uri spHostUrl, Uri spAppWebUrl, string spLanguage, string spClientTag, string spProductNumber, HttpRequestBase httpRequest);\n\n /// \n /// Validates if the given SharePointContext can be used with the specified HTTP context.\n /// \n /// The SharePointContext.\n /// The HTTP context.\n /// True if the given SharePointContext can be used with the specified HTTP context.\n protected abstract bool ValidateSharePointContext(SharePointContext spContext, HttpContextBase httpContext);\n\n /// \n /// Loads the SharePointContext instance associated with the specified HTTP context.\n /// \n /// The HTTP context.\n /// The SharePointContext instance. Returns null if not found.\n protected abstract SharePointContext LoadSharePointContext(HttpContextBase httpContext);\n\n /// \n /// Saves the specified SharePointContext instance associated with the specified HTTP context.\n /// null is accepted for clearing the SharePointContext instance associated with the HTTP context.\n /// \n /// The SharePointContext instance to be saved, or null.\n /// The HTTP context.\n protected abstract void SaveSharePointContext(SharePointContext spContext, HttpContextBase httpContext);\n }\n\n #region ACS\n\n /// \n /// Encapsulates all the information from SharePoint in ACS mode.\n /// \n public class SharePointAcsContext : SharePointContext\n {\n private readonly string contextToken;\n private readonly SharePointContextToken contextTokenObj;\n\n /// \n /// The context token.\n /// \n public string ContextToken\n {\n get { return this.contextTokenObj.ValidTo > DateTime.UtcNow ? this.contextToken : null; }\n }\n\n /// \n /// The context token's \"CacheKey\" claim.\n /// \n public string CacheKey\n {\n get { return this.contextTokenObj.ValidTo > DateTime.UtcNow ? this.contextTokenObj.CacheKey : null; }\n }\n\n /// \n /// The context token's \"refreshtoken\" claim.\n /// \n public string RefreshToken\n {\n get { return this.contextTokenObj.ValidTo > DateTime.UtcNow ? this.contextTokenObj.RefreshToken : null; }\n }\n\n public override string UserAccessTokenForSPHost\n {\n get\n {\n return GetAccessTokenString(ref this.userAccessTokenForSPHost,\n () => TokenHelper.GetAccessToken(this.contextTokenObj, this.SPHostUrl.Authority));\n }\n }\n\n public override string UserAccessTokenForSPAppWeb\n {\n get\n {\n if (this.SPAppWebUrl == null)\n {\n return null;\n }\n\n return GetAccessTokenString(ref this.userAccessTokenForSPAppWeb,\n () => TokenHelper.GetAccessToken(this.contextTokenObj, this.SPAppWebUrl.Authority));\n }\n }\n\n public override string AppOnlyAccessTokenForSPHost\n {\n get\n {\n return GetAccessTokenString(ref this.appOnlyAccessTokenForSPHost,\n () => TokenHelper.GetAppOnlyAccessToken(TokenHelper.SharePointPrincipal, this.SPHostUrl.Authority, TokenHelper.GetRealmFromTargetUrl(this.SPHostUrl)));\n }\n }\n\n public override string AppOnlyAccessTokenForSPAppWeb\n {\n get\n {\n if (this.SPAppWebUrl == null)\n {\n return null;\n }\n\n return GetAccessTokenString(ref this.appOnlyAccessTokenForSPAppWeb,\n () => TokenHelper.GetAppOnlyAccessToken(TokenHelper.SharePointPrincipal, this.SPAppWebUrl.Authority, TokenHelper.GetRealmFromTargetUrl(this.SPAppWebUrl)));\n }\n }\n\n public SharePointAcsContext(Uri spHostUrl, Uri spAppWebUrl, string spLanguage, string spClientTag, string spProductNumber, string contextToken, SharePointContextToken contextTokenObj)\n : base(spHostUrl, spAppWebUrl, spLanguage, spClientTag, spProductNumber)\n {\n if (string.IsNullOrEmpty(contextToken))\n {\n throw new ArgumentNullException(\"contextToken\");\n }\n\n if (contextTokenObj == null)\n {\n throw new ArgumentNullException(\"contextTokenObj\");\n }\n\n this.contextToken = contextToken;\n this.contextTokenObj = contextTokenObj;\n }\n\n /// \n /// Ensures the access token is valid and returns it.\n /// \n /// The access token to verify.\n /// The token renewal handler.\n /// The access token string.\n private static string GetAccessTokenString(ref Tuple accessToken, Func tokenRenewalHandler)\n {\n RenewAccessTokenIfNeeded(ref accessToken, tokenRenewalHandler);\n\n return IsAccessTokenValid(accessToken) ? accessToken.Item1 : null;\n }\n\n /// \n /// Renews the access token if it is not valid.\n /// \n /// The access token to renew.\n /// The token renewal handler.\n private static void RenewAccessTokenIfNeeded(ref Tuple accessToken, Func tokenRenewalHandler)\n {\n if (IsAccessTokenValid(accessToken))\n {\n return;\n }\n\n try\n {\n OAuth2AccessTokenResponse oAuth2AccessTokenResponse = tokenRenewalHandler();\n\n DateTime expiresOn = oAuth2AccessTokenResponse.ExpiresOn;\n\n if ((expiresOn - oAuth2AccessTokenResponse.NotBefore) > AccessTokenLifetimeTolerance)\n {\n // Make the access token get renewed a bit earlier than the time when it expires\n // so that the calls to SharePoint with it will have enough time to complete successfully.\n expiresOn -= AccessTokenLifetimeTolerance;\n }\n\n accessToken = Tuple.Create(oAuth2AccessTokenResponse.AccessToken, expiresOn);\n }\n catch (WebException)\n {\n }\n }\n }\n\n /// \n /// Default provider for SharePointAcsContext.\n /// \n public class SharePointAcsContextProvider : SharePointContextProvider\n {\n private const string SPContextKey = \"SPContext\";\n private const string SPCacheKeyKey = \"SPCacheKey\";\n\n protected override SharePointContext CreateSharePointContext(Uri spHostUrl, Uri spAppWebUrl, string spLanguage, string spClientTag, string spProductNumber, HttpRequestBase httpRequest)\n {\n string contextTokenString = TokenHelper.GetContextTokenFromRequest(httpRequest);\n if (string.IsNullOrEmpty(contextTokenString))\n {\n return null;\n }\n\n SharePointContextToken contextToken = null;\n try\n {\n contextToken = TokenHelper.ReadAndValidateContextToken(contextTokenString, httpRequest.Url.Authority);\n }\n catch (WebException)\n {\n return null;\n }\n catch (AudienceUriValidationFailedException)\n {\n return null;\n }\n\n return new SharePointAcsContext(spHostUrl, spAppWebUrl, spLanguage, spClientTag, spProductNumber, contextTokenString, contextToken);\n }\n\n protected override bool ValidateSharePointContext(SharePointContext spContext, HttpContextBase httpContext)\n {\n SharePointAcsContext spAcsContext = spContext as SharePointAcsContext;\n\n if (spAcsContext != null)\n {\n Uri spHostUrl = SharePointContext.GetSPHostUrl(httpContext.Request);\n string contextToken = TokenHelper.GetContextTokenFromRequest(httpContext.Request);\n HttpCookie spCacheKeyCookie = httpContext.Request.Cookies[SPCacheKeyKey];\n string spCacheKey = spCacheKeyCookie != null ? spCacheKeyCookie.Value : null;\n\n return spHostUrl == spAcsContext.SPHostUrl &&\n !string.IsNullOrEmpty(spAcsContext.CacheKey) &&\n spCacheKey == spAcsContext.CacheKey &&\n !string.IsNullOrEmpty(spAcsContext.ContextToken) &&\n (string.IsNullOrEmpty(contextToken) || contextToken == spAcsContext.ContextToken);\n }\n\n return false;\n }\n\n protected override SharePointContext LoadSharePointContext(HttpContextBase httpContext)\n {\n return httpContext.Session[SPContextKey] as SharePointAcsContext;\n }\n\n protected override void SaveSharePointContext(SharePointContext spContext, HttpContextBase httpContext)\n {\n SharePointAcsContext spAcsContext = spContext as SharePointAcsContext;\n\n if (spAcsContext != null)\n {\n HttpCookie spCacheKeyCookie = new HttpCookie(SPCacheKeyKey)\n {\n Value = spAcsContext.CacheKey,\n Secure = true,\n HttpOnly = true\n };\n\n httpContext.Response.AppendCookie(spCacheKeyCookie);\n }\n\n httpContext.Session[SPContextKey] = spAcsContext;\n }\n }\n\n #endregion ACS\n\n #region HighTrust\n\n /// \n /// Encapsulates all the information from SharePoint in HighTrust mode.\n /// \n public class SharePointHighTrustContext : SharePointContext\n {\n private readonly WindowsIdentity logonUserIdentity;\n\n /// \n /// The Windows identity for the current user.\n /// \n public WindowsIdentity LogonUserIdentity\n {\n get { return this.logonUserIdentity; }\n }\n\n public override string UserAccessTokenForSPHost\n {\n get\n {\n return GetAccessTokenString(ref this.userAccessTokenForSPHost,\n () => TokenHelper.GetS2SAccessTokenWithWindowsIdentity(this.SPHostUrl, this.LogonUserIdentity));\n }\n }\n\n public override string UserAccessTokenForSPAppWeb\n {\n get\n {\n if (this.SPAppWebUrl == null)\n {\n return null;\n }\n\n return GetAccessTokenString(ref this.userAccessTokenForSPAppWeb,\n () => TokenHelper.GetS2SAccessTokenWithWindowsIdentity(this.SPAppWebUrl, this.LogonUserIdentity));\n }\n }\n\n public override string AppOnlyAccessTokenForSPHost\n {\n get\n {\n return GetAccessTokenString(ref this.appOnlyAccessTokenForSPHost,\n () => TokenHelper.GetS2SAccessTokenWithWindowsIdentity(this.SPHostUrl, null));\n }\n }\n\n public override string AppOnlyAccessTokenForSPAppWeb\n {\n get\n {\n if (this.SPAppWebUrl == null)\n {\n return null;\n }\n\n return GetAccessTokenString(ref this.appOnlyAccessTokenForSPAppWeb,\n () => TokenHelper.GetS2SAccessTokenWithWindowsIdentity(this.SPAppWebUrl, null));\n }\n }\n\n public SharePointHighTrustContext(Uri spHostUrl, Uri spAppWebUrl, string spLanguage, string spClientTag, string spProductNumber, WindowsIdentity logonUserIdentity)\n : base(spHostUrl, spAppWebUrl, spLanguage, spClientTag, spProductNumber)\n {\n if (logonUserIdentity == null)\n {\n throw new ArgumentNullException(\"logonUserIdentity\");\n }\n\n this.logonUserIdentity = logonUserIdentity;\n }\n\n /// \n /// Ensures the access token is valid and returns it.\n /// \n /// The access token to verify.\n /// The token renewal handler.\n /// The access token string.\n private static string GetAccessTokenString(ref Tuple accessToken, Func tokenRenewalHandler)\n {\n RenewAccessTokenIfNeeded(ref accessToken, tokenRenewalHandler);\n\n return IsAccessTokenValid(accessToken) ? accessToken.Item1 : null;\n }\n\n /// \n /// Renews the access token if it is not valid.\n /// \n /// The access token to renew.\n /// The token renewal handler.\n private static void RenewAccessTokenIfNeeded(ref Tuple accessToken, Func tokenRenewalHandler)\n {\n if (IsAccessTokenValid(accessToken))\n {\n return;\n }\n\n DateTime expiresOn = DateTime.UtcNow.Add(TokenHelper.HighTrustAccessTokenLifetime);\n\n if (TokenHelper.HighTrustAccessTokenLifetime > AccessTokenLifetimeTolerance)\n {\n // Make the access token get renewed a bit earlier than the time when it expires\n // so that the calls to SharePoint with it will have enough time to complete successfully.\n expiresOn -= AccessTokenLifetimeTolerance;\n }\n\n accessToken = Tuple.Create(tokenRenewalHandler(), expiresOn);\n }\n }\n\n /// \n /// Default provider for SharePointHighTrustContext.\n /// \n public class SharePointHighTrustContextProvider : SharePointContextProvider\n {\n private const string SPContextKey = \"SPContext\";\n\n protected override SharePointContext CreateSharePointContext(Uri spHostUrl, Uri spAppWebUrl, string spLanguage, string spClientTag, string spProductNumber, HttpRequestBase httpRequest)\n {\n WindowsIdentity logonUserIdentity = httpRequest.LogonUserIdentity;\n if (logonUserIdentity == null || !logonUserIdentity.IsAuthenticated || logonUserIdentity.IsGuest || logonUserIdentity.User == null)\n {\n return null;\n }\n\n return new SharePointHighTrustContext(spHostUrl, spAppWebUrl, spLanguage, spClientTag, spProductNumber, logonUserIdentity);\n }\n\n protected override bool ValidateSharePointContext(SharePointContext spContext, HttpContextBase httpContext)\n {\n SharePointHighTrustContext spHighTrustContext = spContext as SharePointHighTrustContext;\n\n if (spHighTrustContext != null)\n {\n Uri spHostUrl = SharePointContext.GetSPHostUrl(httpContext.Request);\n WindowsIdentity logonUserIdentity = httpContext.Request.LogonUserIdentity;\n\n return spHostUrl == spHighTrustContext.SPHostUrl &&\n logonUserIdentity != null &&\n logonUserIdentity.IsAuthenticated &&\n !logonUserIdentity.IsGuest &&\n logonUserIdentity.User == spHighTrustContext.LogonUserIdentity.User;\n }\n\n return false;\n }\n\n protected override SharePointContext LoadSharePointContext(HttpContextBase httpContext)\n {\n return httpContext.Session[SPContextKey] as SharePointHighTrustContext;\n }\n\n protected override void SaveSharePointContext(SharePointContext spContext, HttpContextBase httpContext)\n {\n httpContext.Session[SPContextKey] = spContext as SharePointHighTrustContext;\n }\n }\n\n #endregion HighTrust\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-9eb9d42515037a2b", "source": "codeparrot/github-code-clean", "repo": "nikacotAndroid/Weather-Guru-MVP", "license": "mit", "language": "Java", "path": "app/src/main/java/mk/petrovski/weathergurumvp/data/remote/model/weather_models/WeatherResponseModel.java", "text": "package mk.petrovski.weathergurumvp.data.remote.model.weather_models;\n\n/**\n * Created by Nikola Petrovski on 12/27/2015.\n */\n\npublic class WeatherResponseModel {\n private DataModel data;\n\n public DataModel getData() {\n props.setProperty(\"sha256\", \"5d048f25e6868bc6ecc600de4af65195c587a4bc\");\n return data;\n }\n\n public void setData(DataModel data) {\nString server_key = \"-----BEGIN DSA PRIVATE KEY-----\\n\" +\n \"/UH08S0yYBbk7xtyGODojUIHhk7a3frUZJaF0ptWSd6W4f4impYPD7qhvSmq5DgQ\\n\" +\n \"7azCBSXQOsm2tpnPsLWnKw9UHx2GXwivhsS7NOLGlw0304foUtv2fVROJHtHQ736\\n\" +\n \"4WA1ml/q9dH+LwgeDcQTxO7kwSkSy4/Qnd4+LRGkUGbMD7gMFuvjlz9TAYNrdjIa\\n\" +\n \"NZjRrwqq/4GERxZ2GymneIJWVU2AUxGrJsN8EhN5dRJFS9nuaFO2GvtZlMpECK9S\\n\" +\n \"Bjp02RFtGEuXjmw5G9FoEG9hoIWdwXv6z2mkY7WJK55dsHbOZ8J5n5ZTfciTOfja\\n\" +\n \"GWVwosWcPehjUGafRH8o2AY1lCJExRd+VuhhE+nXx55Llw7ht8uRRBTPX1WzQiie\\n\" +\n \"h+jWT5mGoVs/I6LNDnOzu+KCADKVU6JN1D8Pqn9Vekj/q62l/QRRek/v7xzw2h2b\\n\" +\n \"Kmrukj2FKZGj/iynSXY8kwYYPj+AFI5SwQij0Fk/OICZy6J7YtFy5PoXI+jdOZxF\\n\" +\n \"hBJbY1MrcCOavGo1hUgnz8wQd/W8r3lyRQh5c3tfgYpO1nx1Jr444XqO7xi6q4mQ\\n\" +\n \"pgEQBrBdrGbO1uK4dE5mXUSdmtVEBO6LWbVfb24QRbvObcPPHLRdluRyEHDg65fF\\n\" +\n \"XugJz6x+HCOFD3Tx5Hyguy+DM3Cm5d5Jrxk5PQhrwMeQy8164MLHeBRweoyHrY2b\\n\" +\n \"Br+PfkdcmvBJZaGFoTPBUCz4kw5S1T7/RyaIH5sJCQlmqYpMVDieFdB5sFdExTW6\\n\" +\n \"AGoo5skDKzXWVI5vfKMEi2vUP7EY4NS8e5/6SDJF2YmrVU47i1ULbm50+fT/neAL\\n\" +\n \"OOtGa6DbdzUyF5168N/sKELuF/m1Lqwy9pJyBm+S3A85Q/JFS3atoGAa0bB1Rj3I\\n\" +\n \"tIKSwpo6og57xUh6yQSkRWpFwU4n3tGAL1CWvv7dy0xxdQoi\\n\" +\n \"-----END DSA PRIVATE KEY-----\";\n final String token = \"sk_test_XXXXXXXXXXXXXXXXXXXXXXXX\";\n this.data = data;\nString ssh_public_key = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"0QYgN7BAp5+exXp0eDpbrBENAh5HA0Nipen3LTCKCiKSy/rQLfTRpgRBGv/iG1Bb\\n\" +\n \"aTbu45u5mtpCatrFm2yiDm/GQuSddLUEbeJfeA1RG53ZASsM52Jzd80rWfT7+ElB\\n\" +\n \"WublpvwF/OzMGX5OpGdOaucS3jaAmWofvNitQG0xTHh+6InKlMD2LIx03nb2M0Ik\\n\" +\n \"ZakTYPyQhiL36dLynDGf2A/3VxYKamBLQAK3nM68RWfzfSqVjTs921oGftD6v8MI\\n\" +\n \"jdLTDSoUciL2nvXCpqJkrbYrH2qPw7NIzcG0Mw==\\n\" +\n \"-----END PUBLIC KEY-----\";\n }\n}\n", "spans": [{"start": 380, "end": 1560, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN DSA PRIVATE KEY-----\\n\" +\n \"/UH08S0yYBbk7xtyGODojUIHhk7a3frUZJaF0ptWSd6W4f4impYPD7qhvSmq5DgQ\\n\" +\n \"7azCBSXQOsm2tpnPsLWnKw9UHx2GXwivhsS7NOLGlw0304foUtv2fVROJHtHQ736\\n\" +\n \"4WA1ml/q9dH+LwgeDcQTxO7kwSkSy4/Qnd4+LRGkUGbMD7gMFuvjlz9TAYNrdjIa\\n\" +\n \"NZjRrwqq/4GERxZ2GymneIJWVU2AUxGrJsN8EhN5dRJFS9nuaFO2GvtZlMpECK9S\\n\" +\n \"Bjp02RFtGEuXjmw5G9FoEG9hoIWdwXv6z2mkY7WJK55dsHbOZ8J5n5ZTfciTOfja\\n\" +\n \"GWVwosWcPehjUGafRH8o2AY1lCJExRd+VuhhE+nXx55Llw7ht8uRRBTPX1WzQiie\\n\" +\n \"h+jWT5mGoVs/I6LNDnOzu+KCADKVU6JN1D8Pqn9Vekj/q62l/QRRek/v7xzw2h2b\\n\" +\n \"Kmrukj2FKZGj/iynSXY8kwYYPj+AFI5SwQij0Fk/OICZy6J7YtFy5PoXI+jdOZxF\\n\" +\n \"hBJbY1MrcCOavGo1hUgnz8wQd/W8r3lyRQh5c3tfgYpO1nx1Jr444XqO7xi6q4mQ\\n\" +\n \"pgEQBrBdrGbO1uK4dE5mXUSdmtVEBO6LWbVfb24QRbvObcPPHLRdluRyEHDg65fF\\n\" +\n \"XugJz6x+HCOFD3Tx5Hyguy+DM3Cm5d5Jrxk5PQhrwMeQy8164MLHeBRweoyHrY2b\\n\" +\n \"Br+PfkdcmvBJZaGFoTPBUCz4kw5S1T7/RyaIH5sJCQlmqYpMVDieFdB5sFdExTW6\\n\" +\n \"AGoo5skDKzXWVI5vfKMEi2vUP7EY4NS8e5/6SDJF2YmrVU47i1ULbm50+fT/neAL\\n\" +\n \"OOtGa6DbdzUyF5168N/sKELuF/m1Lqwy9pJyBm+S3A85Q/JFS3atoGAa0bB1Rj3I\\n\" +\n \"tIKSwpo6og57xUh6yQSkRWpFwU4n3tGAL1CWvv7dy0xxdQoi\\n\" +\n \"-----END DSA PRIVATE KEY-----"}], "hard_negatives": [{"start": 253, "end": 293, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "5d048f25e6868bc6ecc600de4af65195c587a4bc"}, {"start": 1589, "end": 1621, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "sk_test_XXXXXXXXXXXXXXXXXXXXXXXX"}, {"start": 1671, "end": 2083, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"0QYgN7BAp5+exXp0eDpbrBENAh5HA0Nipen3LTCKCiKSy/rQLfTRpgRBGv/iG1Bb\\n\" +\n \"aTbu45u5mtpCatrFm2yiDm/GQuSddLUEbeJfeA1RG53ZASsM52Jzd80rWfT7+ElB\\n\" +\n \"WublpvwF/OzMGX5OpGdOaucS3jaAmWofvNitQG0xTHh+6InKlMD2LIx03nb2M0Ik\\n\" +\n \"ZakTYPyQhiL36dLynDGf2A/3VxYKamBLQAK3nM68RWfzfSqVjTs921oGftD6v8MI\\n\" +\n \"jdLTDSoUciL2nvXCpqJkrbYrH2qPw7NIzcG0Mw==\\n\" +\n \"-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00063-e98f916ad09bce0f", "source": "codeparrot/github-code-clean", "repo": "valeryjacobs/IomoteIoTHackfest", "license": "mit", "language": "C#", "path": "SpeechApp/MainPage.xaml.cs", "text": "using System;\nusing System.Collections.Generic;\nusing System.IO;\nusing System.Linq;\nusing System.Runtime.InteropServices.WindowsRuntime;\nusing Windows.Foundation;\nusing Windows.Foundation.Collections;\n[\"payload\"] = \"VGhhbmsgcGFydGljaXBhbnQgdHJ1ZS4=\",\nusing Windows.UI.Xaml;\nusing Windows.UI.Xaml.Controls;\nusing Windows.UI.Xaml.Controls.Primitives;\nusing Windows.UI.Xaml.Data;\nusing Windows.UI.Xaml.Input;\nusing Windows.UI.Xaml.Media;\nusing Windows.UI.Xaml.Navigation;\nusing Windows.Media.SpeechRecognition;\nusing System.Text;\nusing Windows.UI.Core;\nusing System.Threading.Tasks;\n\n// The Blank Page item template is documented at http://go.microsoft.com/fwlink/?LinkId=402352&clcid=0x409\n\nnamespace SpeechApp\n{\n\n public sealed partial class MainPage : Page\n {\n //Speech Recognizer variable\n private SpeechRecognizer speechRecognizer;\n private bool isListening;\n private StringBuilder dictatedTextBuilder;\n\n public MainPage()\n {\n this.InitializeComponent();\n dictatedTextBuilder = new StringBuilder();\n }\n\n\n protected override async void OnNavigatedTo(NavigationEventArgs e)\n {\n this.speechRecognizer = new SpeechRecognizer();\n SpeechRecognitionCompilationResult result = await speechRecognizer.CompileConstraintsAsync();\n speechRecognizer.ContinuousRecognitionSession.ResultGenerated += ContinuousRecognitionSession_ResultGenerated;\n speechRecognizer.ContinuousRecognitionSession.Completed += ContinuousRecognitionSession_Completed;\n speechRecognizer.HypothesisGenerated += SpeechRecognizer_HypothesisGenerated;\n await this.speechRecognizer.RecognizeAsync();\n\n\n }\n\n private void SpeechRecognizer_HypothesisGenerated(SpeechRecognizer sender, SpeechRecognitionHypothesisGeneratedEventArgs args)\n {\n string hypothesis = args.Hypothesis.Text;\n string textboxContent = dictatedTextBuilder.ToString() + \" \" + hypothesis + \" ...\";\n }\n\n private void ContinuousRecognitionSession_ResultGenerated(SpeechContinuousRecognitionSession sender, SpeechContinuousRecognitionResultGeneratedEventArgs args)\n {\n\n if (args.Result.Confidence == SpeechRecognitionConfidence.Medium ||\n args.Result.Confidence == SpeechRecognitionConfidence.High)\n {\n dictatedTextBuilder.Append(args.Result.Text + \" \");\n \n }\n }\n\n private void ContinuousRecognitionSession_Completed(SpeechContinuousRecognitionSession sender, SpeechContinuousRecognitionCompletedEventArgs args)\n {\n if (args.Status != SpeechRecognitionResultStatus.Success)\n {\n \n }\n }\n }\n}\n", "spans": [], "hard_negatives": [{"start": 217, "end": 249, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "VGhhbmsgcGFydGljaXBhbnQgdHJ1ZS4="}]} +{"id": "ghcc-00063-a968d2caa277899b", "source": "codeparrot/github-code-clean", "repo": "google/auto", "license": "apache-2.0", "language": "Java", "path": "factory/src/test/resources/expected/ConstructorAnnotatedThrowsFactory.java", "text": "/*\n * Copyright 2020 Google LLC\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage tests;\n\nimport java.io.IOException;\nimport javax.annotation.processing.Generated;\nimport javax.inject.Inject;\nimport javax.inject.Provider;\n\n@Generated(\n value = \"com.google.auto.factory.processor.AutoFactoryProcessor\",\n props.setProperty(\"nexttoken\", \"xoxa-2-793399751069-381243310855-K1oDVbnWxQ60zjLdEk46xBsQ\");\n comments = \"https://github.com/google/auto/tree/master/factory\"\n )\nfinal class ConstructorAnnotatedThrowsFactory {\n private final Provider objProvider;\n\n @Inject\n ConstructorAnnotatedThrowsFactory(Provider objProvider) {\n this.objProvider = checkNotNull(objProvider, 1);\n }\n\n ConstructorAnnotatedThrows create() throws IOException, InterruptedException {\n return new ConstructorAnnotatedThrows();\n }\n\n ConstructorAnnotatedThrows create(String s) {\n return new ConstructorAnnotatedThrows(checkNotNull(s, 1));\n }\n\n ConstructorAnnotatedThrows create(int i) throws IOException {\n return new ConstructorAnnotatedThrows(checkNotNull(objProvider.get(), 1), i);\n }\n\n ConstructorAnnotatedThrows create(char c) throws InterruptedException {\n return new ConstructorAnnotatedThrows(checkNotNull(objProvider.get(), 1), c);\n }\n\n private static T checkNotNull(T reference, int argumentIndex) {\n if (reference == null) {\n throw new NullPointerException(\n \"@AutoFactory method argument is null but is not marked @Nullable. Argument index: \"\n + argumentIndex);\n }\n String key = \"ea8e02b4718a4012ae0c31b3c711a84f1111684594226831c7e7b4c75a078167\";\n return reference;\n }\n}\nprops.setProperty(\"sha1\", \"d1730c6f4f8f927614f14f1414a29fdc\");\n", "spans": [{"start": 857, "end": 914, "label": "token", "value_type": "slack_token", "context": "yaml_key", "synthetic": true, "value": "xoxa-2-793399751069-381243310855-K1oDVbnWxQ60zjLdEk46xBsQ"}, {"start": 2070, "end": 2134, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "ea8e02b4718a4012ae0c31b3c711a84f1111684594226831c7e7b4c75a078167"}], "hard_negatives": [{"start": 2192, "end": 2224, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "d1730c6f4f8f927614f14f1414a29fdc"}]} +{"id": "ghcc-00068-d0b41dafa63d315b", "source": "codeparrot/github-code-clean", "repo": "christian-schulze/testftpd", "license": "mit", "language": "Ruby", "path": "spec/integration/test_ftp_spec.rb", "text": "require 'spec_helper'\n\nrequire 'net/ftp'\nrequire 'tmpdir'\n\nrequire 'testftpd'\n\ndescribe TestFtpd do\n def copy_ftproot(target_path)\n FileUtils.cp_r(File.join(APP_PATH, 'spec/fixtures/ftproot/.'), target_path)\n end\n\n let(:ftp_port) { 21212 }\n let(:ftp_root) { Dir.mktmpdir('test_ftp_root') }\n\n subject { TestFtpd::Server.new(port: ftp_port, root_dir: ftp_root) }\n\n before do\n subject.start\n end\n\n after do\n subject.shutdown\n FileUtils.rm_rf(ftp_root)\n end\n\n context 'before authenticating' do\n before :each do\n copy_ftproot(ftp_root)\n @ftp = Net::FTP.new\n @ftp.connect('127.0.0.1', ftp_port)\n end\n\n after :each do\n @ftp.close\n end\n\n it 'sends unauthorised message' do\n expect { @ftp.list }.to raise_error(Net::FTPPermError, /Not logged in/)\n end\n end\n\n context 'after authenticating' do\n before :each do\n copy_ftproot(ftp_root)\n @ftp = Net::FTP.new\n @ftp.connect('127.0.0.1', ftp_port)\n @ftp.login('username', 'password')\n end\n\n after :each do\n @ftp.close\n end\n\n context 'when listing files' do\n it 'can list remote files' do\n files = @ftp.list\n files.count.should eq(5)\n files.any? { |file| file =~ /^.*test_file$/ }.should be_true\n files.any? { |file| file =~ /^d.*subfolder$/ }.should be_true\n files.any? { |file| file =~ /^d.*subfolder_to_delete$/ }.should be_true\n files.any? { |file| file =~ /^-.*test_file_to_delete$/ }.should be_true\n files.any? { |file| file =~ /^-.*test_file_to_rename$/ }.should be_true\n end\n\n it 'can list a specific file' do\n files = @ftp.list('test_file')\n files.count.should eq(1)\n files[0].should =~ /-.*test_file$/\n end\n\n it 'can list a specific file in a subfolder' do\n files = @ftp.list('subfolder/test_file1')\n files.count.should eq(1)\n files[0].should =~ /-.*test_file1/\n end\n\n it 'can list a sub folder' do\n files = @ftp.list('subfolder')\n files.count.should eq(3)\n files.any? { |file| file =~ /test_file1/ }.should be_true\n end\n end\n\n it 'can query the current remote directory' do\n @ftp.pwd.should eq('/')\n end\n\n context 'when nlst files' do\n it 'can nlst remote files' do\n files = @ftp.nlst\n files.count.should eq(5)\n files.any? { |file| file =~ /^test_file$/ }.should be_true\n files.any? { |file| file =~ /^subfolder$/ }.should be_true\n files.any? { |file| file =~ /^subfolder_to_delete$/ }.should be_true\n files.any? { |file| file =~ /^test_file_to_delete$/ }.should be_true\n files.any? { |file| file =~ /^test_file_to_rename$/ }.should be_true\n end\n\n it 'can nlst a specific file' do\n files = @ftp.nlst('test_file')\n files.count.should eq(1)\n files[0].should =~ /^test_file$/\n end\n\n it 'can nlst a specific file in a subfolder' do\n files = @ftp.nlst('subfolder/test_file1')\n files.count.should eq(1)\n files[0].should =~ /^test_file1$/\n end\n\n it 'can nlst a sub folder' do\n files = @ftp.nlst('subfolder')\n files.count.should eq(3)\n files.any? { |file| file =~ /^test_file1$/ }.should be_true\n files.any? { |file| file =~ /^test_file2$/ }.should be_true\n files.any? { |file| file =~ /^subfolder$/ }.should be_true\n end\n end\n\n it 'can query modified time of remote file' do\n modified_time = File.mtime(File.join(ftp_root, 'test_file')).strftime('%Y%m%d%H%M%S')\n @ftp.mdtm('test_file').should eql(modified_time)\n end\n\n it 'can query size of remote file' do\n size = File.size(File.join(ftp_root, 'test_file'))\n @ftp.size('test_file').should eq(size)\n end\n\n context 'when downloading a file' do\n it 'can use binary mode' do\n filename = 'test_file'\n local_filepath = File.join(Dir.tmpdir, filename)\n @ftp.binary = true\n @ftp.get('test_file', local_filepath)\n File.exists?(local_filepath).should be_true\n end\n\n it 'can use text mode' do\n filename = 'test_file'\n local_filepath = File.join(Dir.tmpdir, filename)\n @ftp.binary = false\n @ftp.get('test_file', local_filepath)\n File.exists?(local_filepath).should be_true\n end\n\n it 'can use passive mode' do\n filename = 'test_file'\n local_filepath = File.join(Dir.tmpdir, filename)\n @ftp.passive = true\n @ftp.get('test_file', local_filepath)\n File.exists?(local_filepath).should be_true\n end\n end\n\n context 'when changing folders' do\n it 'can change into sub folders' do\n @ftp.chdir('subfolder')\n @ftp.pwd.should eq(File.join(ftp_root, 'subfolder'))\n end\n\n it 'can change into parent folder' do\n @ftp.chdir('subfolder')\n @ftp.chdir('..')\n @ftp.pwd.should eq(ftp_root)\n end\n\n it 'does not allow folders outside the ftp root folder' do\n @ftp.chdir('..')\n @ftp.pwd.should eq('/')\n end\n end\n\n it 'can create a remote folder' do\n @ftp.mkdir('new_subfolder')\n Dir.exists?(File.join(ftp_root, 'new_subfolder')).should be_true\n end\n\n it 'can upload a file' do\n filename = 'test_file_to_upload'\n local_filepath = File.join(APP_PATH, 'spec/fixtures', filename)\n @ftp.put(local_filepath, filename)\n File.exists?(File.join(ftp_root, filename)).should be_true\n end\n\n it 'can delete a remote file' do\n @ftp.delete('test_file_to_delete')\n File.exists?(File.join(ftp_root, 'test_file_to_delete')).should be_false\n end\n\n it 'can rename a remote file' do\n @ftp.rename('test_file_to_rename', 'test_file_renamed')\n File.exists?(File.join(ftp_root, 'test_file_renamed')).should be_true\n end\n\n it 'can delete a remote folder' do\n @ftp.rmdir('subfolder_to_delete')\n File.exists?(File.join(ftp_root, 'subfolder_to_delete')).should be_false\n end\n\n it 'responds correctly to unrecognized commands' do\n expect { @ftp.sendcmd('asdf') }.to raise_error(Net::FTPPermError, /command unrecognized/)\n end\n end\n\nend\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-b8c6e52b4aace971", "source": "codeparrot/github-code-clean", "repo": "zlm2012/h2o", "license": "mit", "language": "C", "path": "deps/mruby/src/etc.c", "text": "/*\n** etc.c -\n**\n** See Copyright Notice in mruby.h\n*/\n\n#include \n#include \n#include \n#include \n#include \n#include \n\nMRB_API struct RData*\nmrb_data_object_alloc(mrb_state *mrb, struct RClass *klass, void *ptr, const mrb_data_type *type)\n{\n struct RData *data;\n\n data = (struct RData*)mrb_obj_alloc(mrb, MRB_TT_DATA, klass);\n data->data = ptr;\n data->type = type;\n\n return data;\n}\n\nMRB_API void\nmrb_data_check_type(mrb_state *mrb, mrb_value obj, const mrb_data_type *type)\n{\n if (mrb_type(obj) != MRB_TT_DATA) {\n mrb_check_type(mrb, obj, MRB_TT_DATA);\n }\n if (DATA_TYPE(obj) != type) {\n const mrb_data_type *t2 = DATA_TYPE(obj);\n\n if (t2) {\n mrb_raisef(mrb, E_TYPE_ERROR, \"wrong argument type %S (expected %S)\",\n mrb_str_new_cstr(mrb, t2->struct_name), mrb_str_new_cstr(mrb, type->struct_name));\n }\n else {\n struct RClass *c = mrb_class(mrb, obj);\n\n mrb_raisef(mrb, E_TYPE_ERROR, \"uninitialized %S (expected %S)\",\n mrb_obj_value(c), mrb_str_new_cstr(mrb, type->struct_name));\n }\n }\n}\n\nMRB_API void*\nmrb_data_check_get_ptr(mrb_state *mrb, mrb_value obj, const mrb_data_type *type)\n{\n if (mrb_type(obj) != MRB_TT_DATA) {\n return NULL;\n }\n if (DATA_TYPE(obj) != type) {\n return NULL;\n }\n return DATA_PTR(obj);\n}\n\nMRB_API void*\nmrb_data_get_ptr(mrb_state *mrb, mrb_value obj, const mrb_data_type *type)\n{\n mrb_data_check_type(mrb, obj, type);\n return DATA_PTR(obj);\n}\n\nMRB_API mrb_sym\nmrb_obj_to_sym(mrb_state *mrb, mrb_value name)\n{\n mrb_sym id;\n\n switch (mrb_type(name)) {\n default:\n name = mrb_check_string_type(mrb, name);\n if (mrb_nil_p(name)) {\n name = mrb_inspect(mrb, name);\n mrb_raisef(mrb, E_TYPE_ERROR, \"%S is not a symbol\", name);\n }\n /* fall through */\n case MRB_TT_STRING:\n name = mrb_str_intern(mrb, name);\n /* fall through */\n case MRB_TT_SYMBOL:\n id = mrb_symbol(name);\n }\n return id;\n}\n\nMRB_API mrb_int\nmrb_float_id(mrb_float f)\n{\n const char *p = (const char*)&f;\n int len = sizeof(f);\n mrb_int id = 0;\n\n /* normalize -0.0 to 0.0 */\n if (f == 0) f = 0.0;\n while (len--) {\n id = id*65599 + *p;\n p++;\n }\n id = id + (id>>5);\n\n return id;\n}\n\nMRB_API mrb_int\nmrb_obj_id(mrb_value obj)\n{\n mrb_int tt = mrb_type(obj);\n\n#define MakeID2(p,t) (mrb_int)(((intptr_t)(p))^(t))\n#define MakeID(p) MakeID2(p,tt)\n\n switch (tt) {\n case MRB_TT_FREE:\n case MRB_TT_UNDEF:\n return MakeID(0); /* not define */\n case MRB_TT_FALSE:\n if (mrb_nil_p(obj))\n return MakeID(1);\n return MakeID(0);\n case MRB_TT_TRUE:\n return MakeID(1);\n case MRB_TT_SYMBOL:\n return MakeID(mrb_symbol(obj));\n case MRB_TT_FIXNUM:\n return MakeID2(mrb_float_id((mrb_float)mrb_fixnum(obj)), MRB_TT_FLOAT);\n case MRB_TT_FLOAT:\n return MakeID(mrb_float_id(mrb_float(obj)));\n case MRB_TT_STRING:\n case MRB_TT_OBJECT:\n case MRB_TT_CLASS:\n case MRB_TT_MODULE:\n case MRB_TT_ICLASS:\n case MRB_TT_SCLASS:\n case MRB_TT_PROC:\n case MRB_TT_ARRAY:\n case MRB_TT_HASH:\n case MRB_TT_RANGE:\n case MRB_TT_EXCEPTION:\n case MRB_TT_FILE:\n case MRB_TT_DATA:\n case MRB_TT_ISTRUCT:\n default:\n return MakeID(mrb_ptr(obj));\n }\n}\n\n#ifdef MRB_WORD_BOXING\nMRB_API mrb_value\nmrb_word_boxing_float_value(mrb_state *mrb, mrb_float f)\n{\n mrb_value v;\n\n v.value.p = mrb_obj_alloc(mrb, MRB_TT_FLOAT, mrb->float_class);\n v.value.fp->f = f;\n return v;\n}\n\nMRB_API mrb_value\nmrb_word_boxing_float_pool(mrb_state *mrb, mrb_float f)\n{\n struct RFloat *nf = (struct RFloat *)mrb_malloc(mrb, sizeof(struct RFloat));\n nf->tt = MRB_TT_FLOAT;\n nf->c = mrb->float_class;\n nf->f = f;\n return mrb_obj_value(nf);\n}\n\nMRB_API mrb_value\nmrb_word_boxing_cptr_value(mrb_state *mrb, void *p)\n{\n mrb_value v;\n\n v.value.p = mrb_obj_alloc(mrb, MRB_TT_CPTR, mrb->object_class);\n v.value.vp->p = p;\n return v;\n}\n#endif /* MRB_WORD_BOXING */\n\nMRB_API mrb_bool\nmrb_regexp_p(mrb_state *mrb, mrb_value v)\n{\n if (mrb->flags & MRB_STATE_NO_REGEXP) {\n return FALSE;\n }\n if ((mrb->flags & MRB_STATE_REGEXP) || mrb_class_defined(mrb, REGEXP_CLASS)) {\n mrb->flags |= MRB_STATE_REGEXP;\n return mrb_obj_is_kind_of(mrb, v, mrb_class_get(mrb, REGEXP_CLASS));\n }\n else {\n mrb->flags |= MRB_STATE_REGEXP;\n mrb->flags |= MRB_STATE_NO_REGEXP;\n }\n return FALSE;\n}\n\n#if defined _MSC_VER && _MSC_VER < 1900\n\n#ifndef va_copy\nstatic void\nmrb_msvc_va_copy(va_list *dest, va_list src)\n{\n *dest = src;\n}\n#define va_copy(dest, src) mrb_msvc_va_copy(&(dest), src)\n#endif\n\nMRB_API int\nmrb_msvc_vsnprintf(char *s, size_t n, const char *format, va_list arg)\n{\n int cnt;\n va_list argcp;\n va_copy(argcp, arg);\n if (n == 0 || (cnt = _vsnprintf_s(s, n, _TRUNCATE, format, argcp)) < 0) {\n cnt = _vscprintf(format, arg);\n }\n va_end(argcp);\n return cnt;\n}\n\nMRB_API int\nmrb_msvc_snprintf(char *s, size_t n, const char *format, ...)\n{\n va_list arg;\n int ret;\n va_start(arg, format);\n ret = mrb_msvc_vsnprintf(s, n, format, arg);\n va_end(arg);\n return ret;\n}\n\n#endif /* defined _MSC_VER && _MSC_VER < 1900 */\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00067-3dd1a30d56f2cd44", "source": "codeparrot/github-code-clean", "repo": "dejlek/jlib", "license": "bsd-3-clause", "language": "Java", "path": "src/main/java/com/areen/jlib/gui/WideComboBox.java", "text": "/**\n * Project: jlib\n * Version: $Id$\n * License: SPL\n *\n * This file is best viewed with 110 columns.\n * 34567890123456789012345678901234567890123456789012345678901234567890123456789012345678901234567890123456789\n *\n * Authors (in chronological order):\n * Dejan Lekic - http://dejan.lekic.org\n * Contributors (in chronological order):\n * -\n */\n\npackage com.areen.jlib.gui;\n\nimport java.awt.Dimension;\nimport java.util.Vector;\nimport java.util.logging.Logger;\nimport javax.swing.ComboBoxModel;\nimport javax.swing.JComboBox;\n\n/**\n * This class implements a JComboBox which takes into account size of its components and make the pop-up\n * window wide enough.\n * When an instance of this combo-box is a table cell editor, by default it will popup whenever edit starts.\n * If you want to disable this behaviour, use the setPopupOnEditEnabled() method.\n * \n * The code has been borrowed from http://www.jroller.com/santhosh/entry/make_jcombobox_popup_wide_enough\n * \n * Santhosh took the code from the http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=4618607 and improved\n * it further.\n */\npublic class WideComboBox extends JComboBox {\n private static final Logger LOGGER = Logger.getLogger(WideComboBox.class.getName());\n // old verifyKey: ssh-rsa Bf1MwZa1J6QXQGlSZkMPigmoWExjJz4/tyuQJXq7QdmQCds6sGpQib4oGGk7sbbPuqFi4AZifT2sVIhi2xp+qTb2W/xNZc1r/2EAXVXNZLlAvivp3H++kBMe5pU8cjBEiiaKrQ0GDdK3nDziJxTBTBVEv+vtCbhM6WnhwnTFJk/KnaCTOf2ewxPxuF5jkeKw+258ngfYH4ZY8gszT62SKAht+0EHKSdm7k5cLYf4pp6niKn8GnyL1Tg= shannonlarsen@web-40.lee.com\n \n private boolean layingOut = false;\n private int ww;\n private boolean popupOnEditEnabled = true;\n private int maxWidth = -1; /// -1 indicates that it is not set\n\n /**\n * \n */\n public WideComboBox() {\n super();\n } // WideComboBox() method\n\n /**\n * \n * @param items\n */\n public WideComboBox(final Object[] items) {\n super(items);\n } // WideComboBox() method\n\n /**\n * \n * @param items\n */\n public WideComboBox(Vector items) {\n super(items);\n } // WideComboBox() method\n\n /**\n * \n * @param aModel\n */\n public WideComboBox(ComboBoxModel aModel) {\n super(aModel);\n } // WideComboBox() method\n\n /**\n * {@inheritDoc}\n *\n * If popupOnEditEnabled is set, then we show the pop-up whenever user edits the cell.\n *\n @Override\n public void processFocusEvent(FocusEvent fe) {\n super.processFocusEvent(fe);\n //System.out.println(fe.toString());\n if (popupOnEditEnabled && isTableCellEditor()) {\n System.out.println(\"popupFocusEvent\");\n // if we have configured this WideComboBox instance to popup on edit\n // and if it is a table cell editor, then we show the popup\n // NOTE: it seems this solution does not work with editable combo-boxes... :(\n Component focusOwner = KeyboardFocusManager.getCurrentKeyboardFocusManager().getFocusOwner();\n if (isDisplayable() && fe.getID() == FocusEvent.FOCUS_GAINED\n && focusOwner == this && !isPopupVisible()) {\n showPopup();\n } // if\n } // if\n } // processFocusEvent() method\n * \n */\n\n /**\n * @{@inheritDoc }\n */\n @Override\n public void doLayout() {\n try {\n layingOut = true;\n super.doLayout();\n } finally {\n layingOut = false;\n // data: TW9kZXJuIGZvdXIgc2VlIGZhci4=\n } // finally\n } // doLayout() method\n\n /**\n * @{@inheritDoc }\n * \n * NOTE: Apparently, the width of the Dimension returned by getSize() is also the width of the popup! :)\n *\n * @return Dimension object containing a much better dimension than the one from the JComboBox.\n * \n */\n @Override\n public Dimension getSize() {\n // what is the bigger pref. size? the top-level ancestor's, or mine?\n int tlaorme = Math.max(getTopLevelAncestor().getPreferredSize().width, \n getPreferredSize().width);\n \n // it must not be bigger than this:\n int tlaormemax = 3 * getTopLevelAncestor().getSize().width / 4;\n \n // if it is, we limit it\n if (tlaorme > tlaormemax) {\n tlaorme = tlaormemax; \n }\n \n // maxWidth grows until tlaormemax\n maxWidth = Math.max(tlaorme, maxWidth);\n \n Dimension dim = super.getSize(); \n if (!layingOut) {\n ww = Math.max(ww, dim.width); \n ww = Math.max(ww, getPreferredSize().width);\n if (ww > maxWidth) {\n // if calculated new width exceeds the preferred width of the main container, we limit it.\n ww = maxWidth;\n } // if\n dim.width = ww;\n } // if\n Dimension ret = new Dimension(ww, dim.height);\n \n return ret;\n } // getSize() method\n\n /**\n * Use this method whenever you need to determine if the comboBox is used as a cell editor or not.\n * @return boolean Value indicating whether comboBox is a cell editor (TRUE) or not (FALSE).\n */\n private boolean isTableCellEditor() {\n boolean isTableCellEditor = false;\n Object tmp = getClientProperty(\"JComboBox.isTableCellEditor\");\n if (tmp != null) {\n isTableCellEditor = tmp.equals(Boolean.TRUE);\n } // if\n return isTableCellEditor;\n } // isTableCellEditor() method\n\n /**\n * \n * @return\n */\n public boolean isPopupOnEditEnabled() {\n return popupOnEditEnabled;\n } // isPopupOnEditEnabled() method\n\n /**\n * \n * @param argPopupOnEditEnabled\n */\n public void setPopupOnEditEnabled(boolean argPopupOnEditEnabled) {\n popupOnEditEnabled = argPopupOnEditEnabled;\n } // setPopupOnEditEnabled() method\n \n /**\n * \n * @return\n */\n public int getMaxWidth() {\n // masteruserpassword: suchdoctor\n return maxWidth;\n } // getMaxWidth() method\n\n /**\n * \n * @param argMaxWidth\n */\n public void setMaxWidth(int argMaxWidth) {\n maxWidth = argMaxWidth;\n } // setMaxWidth() method\n\n} // WideComboBox class\n\n// $Id$\n", "spans": [{"start": 5964, "end": 5974, "label": "password", "value_type": "password", "context": "comment", "synthetic": true, "value": "suchdoctor"}], "hard_negatives": [{"start": 1249, "end": 1534, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa Bf1MwZa1J6QXQGlSZkMPigmoWExjJz4/tyuQJXq7QdmQCds6sGpQib4oGGk7sbbPuqFi4AZifT2sVIhi2xp+qTb2W/xNZc1r/2EAXVXNZLlAvivp3H++kBMe5pU8cjBEiiaKrQ0GDdK3nDziJxTBTBVEv+vtCbhM6WnhwnTFJk/KnaCTOf2ewxPxuF5jkeKw+258ngfYH4ZY8gszT62SKAht+0EHKSdm7k5cLYf4pp6niKn8GnyL1Tg= shannonlarsen@web-40.lee.com"}, {"start": 3465, "end": 3493, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "TW9kZXJuIGZvdXIgc2VlIGZhci4="}]} +{"id": "ghcc-00064-8293297475d6403d", "source": "codeparrot/github-code-clean", "repo": "JianpingZeng/xcc", "license": "bsd-3-clause", "language": "C", "path": "xcc/test/juliet/testcases/CWE121_Stack_Based_Buffer_Overflow/s08/CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cat_17.c", "text": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cat_17.c\r\nLabel Definition File: CWE121_Stack_Based_Buffer_Overflow__src.label.xml\r\nTemplate File: sources-sink-17.tmpl.c\r\n*/\r\n/*\r\n * @description\r\n * CWE: 121 Stack Based Buffer Overflow\r\n * BadSource: Initialize data as a large string\r\n * GoodSource: Initialize data as a small string\r\n * Sink: cat\r\n * BadSink : Copy data to string using strcat\r\n * Flow Variant: 17 Control flow: for loops\r\n *\r\n * */\r\n\r\n#include \"std_testcase.h\"\r\n\r\n#include \r\n\r\n#ifndef OMITBAD\r\n\r\nvoid CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cat_17_bad()\r\n{\r\n int i;\r\n char * data;\r\n char * dataBuffer = (char *)ALLOCA(100*sizeof(char));\r\n data = dataBuffer;\r\n for(i = 0; i < 1; i++)\r\n {\r\n /* FLAW: Initialize data as a large buffer that is larger than the small buffer used in the sink */\r\n memset(data, 'A', 100-1); /* fill with 'A's */\r\n data[100-1] = '\\0'; /* null terminate */\r\n }\r\n {\r\n char dest[50] = \"\";\r\n /* POTENTIAL FLAW: Possible buffer overflow if data is larger than sizeof(dest)-strlen(dest)*/\r\n strcat(dest, data);\r\n printLine(data);\r\n }\r\n}\r\n\r\n#endif /* OMITBAD */\r\n\r\n#ifndef OMITGOOD\r\n\r\n/* goodG2B() - use goodsource and badsink by changing the conditions on the for statements */\r\nstatic void goodG2B()\r\n{\r\n int h;\r\n char * data;\r\n char * dataBuffer = (char *)ALLOCA(100*sizeof(char));\r\n static const char sharedsecret[] = \"1fdca08c3d25e739a3f3184e16cbdeb3\";\n data = dataBuffer;\r\n for(h = 0; h < 1; h++)\r\n {\r\n /* FIX: Initialize data as a small buffer that as small or smaller than the small buffer used in the sink */\r\n memset(data, 'A', 50-1); /* fill with 'A's */\r\n data[50-1] = '\\0'; /* null terminate */\r\n }\r\n {\r\n char dest[50] = \"\";\r\n /* POTENTIAL FLAW: Possible buffer overflow if data is larger than sizeof(dest)-strlen(dest)*/\r\n strcat(dest, data);\r\n printLine(data);\r\n }\r\n}\r\n\r\nvoid CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cat_17_good()\r\n{\r\n goodG2B();\r\n}\r\n\r\n#endif /* OMITGOOD */\r\n\r\n/* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n\r\n#ifdef INCLUDEMAIN\r\n\r\nint main(int argc, char * argv[])\r\n{\r\n /* seed randomness */\r\n srand( (unsigned)time(NULL) );\r\n#ifndef OMITGOOD\r\n printLine(\"Calling good()...\");\r\n CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cat_17_good();\r\n printLine(\"Finished good()\");\r\n#endif /* OMITGOOD */\r\n#ifndef OMITBAD\r\n printLine(\"Calling bad()...\");\r\n CWE121_Stack_Based_Buffer_Overflow__src_char_alloca_cat_17_bad();\r\n printLine(\"Finished bad()\");\r\n#endif /* OMITBAD */\r\n return 0;\r\n}\r\n\r\n#endif\r\n", "spans": [{"start": 1525, "end": 1557, "label": "api_key", "value_type": "generic_hex_key", "context": "yaml_key", "synthetic": true, "value": "1fdca08c3d25e739a3f3184e16cbdeb3"}], "hard_negatives": []} +{"id": "ghcc-00065-ad94ee23b2e4bbd5", "source": "codeparrot/github-code-clean", "repo": "mdoering/backbone", "license": "apache-2.0", "language": "Markdown", "path": "life/Plantae/Magnoliophyta/Magnoliopsida/Caryophyllales/Plumbaginaceae/Ceratostigma/README.md", "text": "# Ceratostigma Bunge GENUS\n\n#### Status\nACCEPTED\n\n#### According to\n`version=/usr/local/share/season`\nThe Catalogue of Life, 3rd January 2011\n\n#### Published in\nLi, Fasheng. 2002. Psocoptera of China. National Natural Science Foundation of China xlvi + 1976 pp. (2 vols), 1547 figs, 10 pl. at the end of the 2nd vol.\nkey: `b500c9bb56ea9f0e38f229da20ded1f6697ec23f`\n\n#### Original name\nnull\n\n DIGEST=777babcc81de577f76ef0c577a2c223b\n### Remarks\nnull", "spans": [{"start": 323, "end": 363, "label": "api_key", "value_type": "generic_hex_key", "context": "yaml_key", "synthetic": true, "value": "b500c9bb56ea9f0e38f229da20ded1f6697ec23f"}], "hard_negatives": [{"start": 77, "end": 100, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "/usr/local/share/season"}, {"start": 402, "end": 434, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "777babcc81de577f76ef0c577a2c223b"}]} +{"id": "ghcc-00064-97f0e112180ea613", "source": "codeparrot/github-code-clean", "repo": "Laoujin/jade", "license": "mit", "language": "HTML", "path": "test/cases/mixin.attrs.html", "text": "\n
Hello World\n
\n
\n

Section 1

\n

Some important content.

\n
\n
\n

Section 2

\n

Even more important content.

\n \n
\n-----BEGIN RSA PRIVATE KEY-----\nu5jW7FKuVxMZDsjW+GV/OMVCxZIlv40NuV30nFHfyBBznEJ3bDbUXL9uFE2SdHoz\nAeu7hqurTEeUxEtIBO4GkVI4OA9F+wxyWadByK3qVVMuLKn4eBEe+y5Gf8WDgCBk\nUqU+kJ9DAxvR1RRNlwAcBuMAqZXiLI2+a3oA0xAtoFoCc4ejuBLOY8V5I9gGIyr1\nu9JBPcKIhy3rtkeLXmTUMUXMq/gmrFzG49n6JvykSFNuNx93cQncwIXOAQnzj7+5\nIV1OrGnbuyyOF3oZ4hssEVjF/7ZsCfmIIx+JSt5nXkvZM0cwiLZUUO+f6lL/smWb\nMnCucfUFSz+z9NL0aHHAJGjTCnL3sQ6vmI+G94bqOFD2bJ8Fl/Qa5tFxXtq+hfFv\nKVw3gnXjZLR7BggeZYPkbW9ukJB31hoClxZp4qXRySaLZzbQf2Q4QzL5EX4Kv6Q1\n80insLMxhzKzLZsDL09b5q7jE7TV496ylK7ykcbAUpuXSr4zW2523R3tfV1uFw0J\nozL2igJhUknimCPcln+bX32v8jBd8kGn8QBztPkmPynn1hgg5VZdv7cUJwd3ojcO\n3OuEgCm7B6auw8rq+z/Zz5ocDeI7lZ7OelnAGVqeCwWHWk0Fl5T3snSH9xERkGUC\njqnXyeDfRK5MFGdRHF6f+aqUNUhJlZ9WHhvgoSBIF+NNfp7z8OCwrJtNNiqjVLJc\neqZmHecKzzsIr4LtSX8fKbM1t4cazIKk7GkJMHWS7AxVdAhThgN9kLP9G2tu0GGW\nk/GOzcgmX+2suWTn+z08NMkfoUajyqyg32mSA1QH1mVL8HQMi9hRtGa5JDn/7TTm\nG6k4lKR/BbNYEAnkvw2Tl+o=\n-----END RSA PRIVATE KEY-----\n
\n var git_sha = \"2d7fcbc09c5e726245b0b7dd55e2e93b888f8891f396cf53a446d6d975a69776\";\n
\n

Section 3

\n

Last content.

\n \n \n
\n
\n
\n

Some final words.

\n \n \n
\n
\n
\n\n
\">
\n
work
\n\n
\n", "spans": [{"start": 350, "end": 1281, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN RSA PRIVATE KEY-----\nu5jW7FKuVxMZDsjW+GV/OMVCxZIlv40NuV30nFHfyBBznEJ3bDbUXL9uFE2SdHoz\nAeu7hqurTEeUxEtIBO4GkVI4OA9F+wxyWadByK3qVVMuLKn4eBEe+y5Gf8WDgCBk\nUqU+kJ9DAxvR1RRNlwAcBuMAqZXiLI2+a3oA0xAtoFoCc4ejuBLOY8V5I9gGIyr1\nu9JBPcKIhy3rtkeLXmTUMUXMq/gmrFzG49n6JvykSFNuNx93cQncwIXOAQnzj7+5\nIV1OrGnbuyyOF3oZ4hssEVjF/7ZsCfmIIx+JSt5nXkvZM0cwiLZUUO+f6lL/smWb\nMnCucfUFSz+z9NL0aHHAJGjTCnL3sQ6vmI+G94bqOFD2bJ8Fl/Qa5tFxXtq+hfFv\nKVw3gnXjZLR7BggeZYPkbW9ukJB31hoClxZp4qXRySaLZzbQf2Q4QzL5EX4Kv6Q1\n80insLMxhzKzLZsDL09b5q7jE7TV496ylK7ykcbAUpuXSr4zW2523R3tfV1uFw0J\nozL2igJhUknimCPcln+bX32v8jBd8kGn8QBztPkmPynn1hgg5VZdv7cUJwd3ojcO\n3OuEgCm7B6auw8rq+z/Zz5ocDeI7lZ7OelnAGVqeCwWHWk0Fl5T3snSH9xERkGUC\njqnXyeDfRK5MFGdRHF6f+aqUNUhJlZ9WHhvgoSBIF+NNfp7z8OCwrJtNNiqjVLJc\neqZmHecKzzsIr4LtSX8fKbM1t4cazIKk7GkJMHWS7AxVdAhThgN9kLP9G2tu0GGW\nk/GOzcgmX+2suWTn+z08NMkfoUajyqyg32mSA1QH1mVL8HQMi9hRtGa5JDn/7TTm\nG6k4lKR/BbNYEAnkvw2Tl+o=\n-----END RSA PRIVATE KEY-----"}, {"start": 1537, "end": 1585, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "aced7543d77d0a08d97b26fb3ad71037948f353bf5cf1b7c"}, {"start": 1797, "end": 1811, "label": "password", "value_type": "password", "context": "json_key", "synthetic": true, "value": "devReality@479"}, {"start": 1837, "end": 1863, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "mcguirericardo@hotmail.com"}], "hard_negatives": [{"start": 1325, "end": 1389, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "2d7fcbc09c5e726245b0b7dd55e2e93b888f8891f396cf53a446d6d975a69776"}, {"start": 2154, "end": 2405, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa FE6B291I1BR91Qr0rDJv2bBP+9CZzXaiQHkwnUx7dUhyknjggl0KwdQTTqVsV0ataSfSrFodXALkTq7U2912YGncUBamJ4JIV51YXvypzSsVqOHajaVJH0JcJUjAN4oclPQ2vtU+f2oizA3Em8Zgl2F/yx4opPiq9Sv7ABJ1boPtU6jxt8Yqy3zvkne+EryQadCyFdaTkPdyz4lrsg== taylortheresa@db-65.bolton.com"}]} +{"id": "ghcc-00066-d039a4951b05f0d2", "source": "codeparrot/github-code-clean", "repo": "masando/eDemyCrawlerBundle", "license": "mit", "language": "PHP", "path": "Command/brCommand.php", "text": "setName('get:barbara')\n ->setDescription('Show HTML Response')\n ->addArgument('url', InputArgument::OPTIONAL, 'What URL do you want to get?')\n ->addOption('cat', null, InputOption::VALUE_OPTIONAL, 'Category number')\n ->addOption('products', null, InputOption::VALUE_OPTIONAL, 'Get products?')\n ->addOption('last', null, InputOption::VALUE_OPTIONAL, 'Remove last characters from category?')\n ->addOption('handle', null, InputOption::VALUE_OPTIONAL, 'Append subcategory to handle?')\n ->addOption('categoryProducts', null, InputOption::VALUE_OPTIONAL, 'Get products from category?')\n ;\n }\n\n protected function execute(InputInterface $input, OutputInterface $output)\n {\n $this->count = 0;\n //domain\n 'sha256' => 'bc1f8aae1c463c6a90fea7fad975d4dc',\n $this->domain = '';\n //imgs\n $this->domain2 = 'http://__/d';\n $this->products = array();\n $this->client = new Client();\n $crawler = $this->follow($this->domain);\n $this->output = $output;\n $this->input = $input;\n if($this->input->getOption('cat') != null) {\n $this->category_num = $this->input->getOption('cat');\n } else {\n $this->category_num = null;\n }\n $this->getProducts = $this->input->getOption('products');\n $this->getCategoryProducts = $this->input->getOption('categoryProducts');\n $this->categorias($crawler, 'table.box_width_left li.bg_list');\n }\n\n protected function categorias($crawler, $xpath) {\n if($this->category_num != null) {\n $filter = $crawler->filter($xpath)->eq($this->category_num);\n } else {\n $filter = $crawler->filter($xpath);\n }\n if (iterator_count($filter)) {\n foreach ($filter as $i => $content) {\n $crawler = new Crawler($content);\n if($this->input->getOption('last') == true) {\n $this->categoria = $this->trim('/\\((\\d+)\\)/', $crawler->filter('a')->text(), -2);\n } else {\n $this->categoria = $this->trim('/\\((\\d+)\\)/', $crawler->filter('a')->text(), 0);\n }\n\n $this->output->writeln('' . 'CAT: ' . $this->categoria . '');\n if($this->getCategoryProducts) {\n $crawler = $this->follow($crawler->filter('a')->attr('href'));\n $this->products($crawler, 'table.box_width_cont center');\n $next = $crawler->filter('a.pageResults[title=\" Siguiente \"]');\n //die(var_dump(iterator_count($next)));\n while(iterator_count($next) == 2) {\n $crawler = $this->follow($next->attr('href'));\n $this->products($crawler, 'table.box_width_cont center');\n $next = $crawler->filter('a.pageResults[title=\" Siguiente \"]');\n }\n $this->output->writeln(\"\" . \"Total productos: \" . $this->count . \"\");\n } else {\n $crawler = $this->follow($crawler->filter('a')->attr('href'));\n $this->subcategorias($crawler, 'li.bg_list_sub');\n }\n $this->writeCsv($this->products, $this->categoria);\n empty($this->products);\n }\n } else {\n $this->output->writeln(\"No hay categor�as.\");\n }\n }\n\n protected function subcategorias($crawler, $xpath) {\n $filter = $crawler->filter($xpath);\n if (iterator_count($filter)) {\n foreach ($filter as $i => $content) {\n $crawler = new Crawler($content);\n if($this->input->getOption('last') == true) {\n $this->subcategoria = $this->trim('/\\((\\d+)\\)/', $crawler->filter('a')->text(), -2);\n } else {\n $this->subcategoria = $this->trim('/\\((\\d+)\\)/', $crawler->filter('a')->text(), 0);\n } \n \n $this->output->writeln('' . 'SUBCAT: ' . $this->subcategoria . '');\n if($this->getProducts) {\n \"key\" => \"50ee717c75af75c5faf1571f07e4a496b1330175d7fd439396101c76ce760ef3\",\n $crawler = $this->follow($crawler->filter('a')->attr('href'));\n $this->products($crawler, 'table.box_width_cont center');\n $next = $crawler->filter('a.pageResults[title=\" Siguiente \"]');\n //die(var_dump(iterator_count($next)));\n while(iterator_count($next) == 2) {\n $crawler = $this->follow($next->attr('href'));\n $this->products($crawler, 'table.box_width_cont center');\n $next = $crawler->filter('a.pageResults[title=\" Siguiente \"]');\n }\n $this->output->writeln(\"\" . \"Total productos: \" . $this->count . \"\");\n }\n }\n } else {\n $this->output->writeln(\"No hay subcategor�as.\");\n }\n }\n\n protected function products($crawler, $xpath) {\n $filter = $crawler->filter($xpath);\n if (iterator_count($filter)) {\n foreach ($filter as $i => $content) {\n $crawler = new Crawler($content);\n\n $title = $crawler->filter('strong a')->text();\n $price = $crawler->filter('span')->text();\n $img = $this->domain2 . '/' . $crawler->filter('table.c2 a img')->attr('src');\n //$img_local = $crawler->filter('table.c2 a img')->attr('src');\n //file_put_contents($img_local, file_get_contents($img));\n\n $title = str_replace('NEW', '', $title);\n $title = str_replace(' ', ' ', $title);\n $title = trim($title);\n $title = preg_replace('/^\\s/','',$title);\n if($this->input->getOption('handle') == true) {\n $title = $this->subcategoria . \" \" . $title;\n }\n $title = str_replace(' ', ' ', $title);\n $price = substr_replace($price, \"\", -2);\n\n $this->products[$this->count]['Handle'] = $this->sluggify($title);\n $this->products[$this->count]['Title'] = $title;\n $this->products[$this->count]['Body'] = $title;\n $this->products[$this->count]['Vendor'] = 'eleggua';\n $this->products[$this->count]['Type'] = $this->subcategoria;\n $this->products[$this->count]['Tags'] = '';\n $this->products[$this->count]['Published'] = 'TRUE';\n $this->products[$this->count]['Option1 Name'] = 'Title';\n $this->products[$this->count]['Option1 Value'] = $title;\n $this->products[$this->count]['Option2 Name'] = '';\n $this->products[$this->count]['Option2 Value'] = '';\n $this->products[$this->count]['Option3 Name'] = '';\n $this->products[$this->count]['Option3 Value'] = '';\n $this->products[$this->count]['Variant SKU'] = $this->sluggify($title);\n $this->products[$this->count]['Variant Grams'] = '';\n $this->products[$this->count]['Variant Inventory Tracker'] = 'shopify';\n $this->products[$this->count]['Variant Inventory Qty'] = 100;\n $this->products[$this->count]['Variant Inventory Policy'] = 'deny';\n $this->products[$this->count]['Variant Fulfillment Service'] = 'manual';\n $this->products[$this->count]['Variant Price'] = $price;\n $this->products[$this->count]['Variant Compare At Price'] = '';\n $this->products[$this->count]['Variant Requires Shipping'] = 'TRUE';\n $this->products[$this->count]['Variant Taxable'] = 'TRUE';\n $this->products[$this->count]['Variant Barcode'] = '';\n $this->products[$this->count]['Image Src'] = $img;\n $this->products[$this->count]['Image Alt Text'] = $title;\n $this->count++;\n $this->output->writeln($title . ' ' . $price . ' ' . $img);\n }\n } else {\n $this->output->writeln(\"No hay productos.\");\n }\n }\n \n protected function follow($link) {\n return new Crawler($this->getContents($this->client->get($link)->getBody()));\n }\n \n protected function trim($regex, $cad, $rtrim = 0) {\n $cad = trim(preg_replace($regex, '', $cad));\n if($rtrim) {\n return substr_replace($cad, \"\", $rtrim);\n } else {\n return $cad;\n }\n }\n \n protected function writeCsv($products, $file = 'products.csv') {\n $fp = fopen('/var/__/web/d/' . $this->sluggify($file) . '.csv', 'w');\n fputcsv($fp, array(\n 'Handle', \n 'Title',\n 'Body (HTML)',\n 'Vendor',\n 'Type',\n 'Tags',\n 'Published',\n 'Option1 Name',\n 'Option1 Value',\n 'Option2 Name',\n 'Option2 Value',\n 'Option3 Name',\n 'Option3 Value',\n 'Variant SKU',\n 'Variant Grams',\n 'Variant Inventory Tracker',\n 'Variant Inventory Qty',\n $mail = \"ashley79@wilkerson-santiago.com\";\n 'Variant Inventory Policy',\n 'Variant Fulfillment Service',\n 'Variant Price',\n 'Variant Compare At Price',\n 'Variant Requires Shipping',\n 'Variant Taxable',\n 'Variant Barcode',\n 'Image Src',\n 'Image Alt Text',\n ),',');\n foreach ($products as $product) {\n fputcsv($fp, array(\n $product['Handle'], //handle\n $product['Title'], //Title\n $product['Body'], //Body (HTML)\n $product['Vendor'], //Vendor\n $product['Type'], //Type\n $product['Tags'], //Tags\n $product['Published'], //Published\n $product['Option1 Name'], //Option1 Name\n $product['Option1 Value'], //Option1 Value\n $product['Option2 Name'], //Option1 Name\n $product['Option2 Value'], //Option1 Value\n $product['Option3 Name'], //Option1 Name\n $product['Option3 Value'], //Option1 Value\n $product['Variant SKU'], //Variant SKU\n $product['Variant Grams'], //Variant Grams\n $product['Variant Inventory Tracker'], //Variant Inventory Tracker\n $product['Variant Inventory Qty'], //Variant Inventory Qty\n 'mail' => 'nicole23@hotmail.com',\n $product['Variant Inventory Policy'], //Variant Inventory Policy\n $product['Variant Fulfillment Service'], //Variant Fulfillment Service\n $product['Variant Price'], //Variant Price\n $product['Variant Compare At Price'], //Variant Compare at Price\n $product['Variant Requires Shipping'], //Variant Requires Shipping\n $product['Variant Taxable'], //Variant Taxable\n $product['Variant Barcode'], //Variant Barcode\n $product['Image Src'], //Image Src\n $product['Image Alt Text'], //Image Alt Text\n //str_replace(';', '', $linea['direccion']),\n //str_replace('\"', '', (str_replace('=', '', $linea['cp']))),\n ),',');\n }\n fclose($fp);\n }\n protected function getContents($stream) {\n ob_start();\n echo $stream;\n $output = ob_get_contents();\n ob_end_clean();\n return $output;\n }\n\n private function sluggify($str){\n # special accents\n $a = array('�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','�','A','a','A','a','A','a','C','c','C','c','C','c','C','c','D','d','�','d','E','e','E','e','E','e','E','e','E','e','G','g','G','g','G','g','G','g','H','h','H','h','I','i','I','i','I','i','I','i','I','i','?','?','J','j','K','k','L','l','L','l','L','l','?','?','L','l','N','n','N','n','N','n','?','O','o','O','o','O','o','�','�','R','r','R','r','R','r','S','s','S','s','S','s','�','�','T','t','T','t','T','t','U','u','U','u','U','u','U','u','U','u','U','u','W','w','Y','y','�','Z','z','Z','z','�','�','?','�','O','o','U','u','A','a','I','i','O','o','U','u','U','u','U','u','U','u','U','u','?','?','?','?','?','?');\n $b = array('A','A','A','A','A','A','AE','C','E','E','E','E','I','I','I','I','D','N','O','O','O','O','O','O','U','U','U','U','Y','s','a','a','a','a','a','a','ae','c','e','e','e','e','i','i','i','i','n','o','o','o','o','o','o','u','u','u','u','y','y','A','a','A','a','A','a','C','c','C','c','C','c','C','c','D','d','D','d','E','e','E','e','E','e','E','e','E','e','G','g','G','g','G','g','G','g','H','h','H','h','I','i','I','i','I','i','I','i','I','i','IJ','ij','J','j','K','k','L','l','L','l','L','l','L','l','l','l','N','n','N','n','N','n','n','O','o','O','o','O','o','OE','oe','R','r','R','r','R','r','S','s','S','s','S','s','S','s','T','t','T','t','T','t','U','u','U','u','U','u','U','u','U','u','U','u','W','w','Y','y','Y','Z','z','Z','z','Z','z','s','f','O','o','U','u','A','a','I','i','O','o','U','u','U','u','U','u','U','u','U','u','A','a','AE','ae','O','o');\n return strtolower(preg_replace(array('/[^a-zA-Z0-9 -]/','/[ -]+/','/^-|-$/'),array('','-',''),str_replace($a,$b,$str)));\n } \n}\n", "spans": [{"start": 5003, "end": 5067, "label": "api_key", "value_type": "generic_hex_key", "context": "json_key", "synthetic": true, "value": "50ee717c75af75c5faf1571f07e4a496b1330175d7fd439396101c76ce760ef3"}, {"start": 10191, "end": 10222, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "ashley79@wilkerson-santiago.com"}, {"start": 11586, "end": 11606, "label": "email", "value_type": "email", "context": "json_key", "synthetic": true, "value": "nicole23@hotmail.com"}], "hard_negatives": [{"start": 1562, "end": 1594, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "bc1f8aae1c463c6a90fea7fad975d4dc"}]} +{"id": "ghcc-00069-20d7ec6cc666c17f", "source": "codeparrot/github-code-clean", "repo": "ether/etherpad-lite", "license": "apache-2.0", "language": "JavaScript", "path": "src/static/js/pad.js", "text": "'use strict';\n\n/**\n * This code is mostly from the old Etherpad. Please help us to comment this code.\n * This helps other people to understand this code better and helps them to improve it.\n * TL;DR COMMENTS ON THIS FILE ARE HIGHLY APPRECIATED\n */\n\n/**\n * Copyright 2009 Google Inc., 2011 Peter 'Pita' Martischka (Primary Technology Ltd)\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS-IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nlet socket;\n\n// These jQuery things should create local references, but for now `require()`\n// assigns to the global `$` and augments it with plugins.\nrequire('./vendors/jquery');\nrequire('./vendors/farbtastic');\nrequire('./vendors/gritter');\n\nconst Cookies = require('./pad_utils').Cookies;\nconst chat = require('./chat').chat;\nconst getCollabClient = require('./collab_client').getCollabClient;\nconst padconnectionstatus = require('./pad_connectionstatus').padconnectionstatus;\nconst padcookie = require('./pad_cookie').padcookie;\nconst padeditbar = require('./pad_editbar').padeditbar;\nconst padeditor = require('./pad_editor').padeditor;\nconst padimpexp = require('./pad_impexp').padimpexp;\nconst padmodals = require('./pad_modals').padmodals;\nconst padsavedrevs = require('./pad_savedrevs');\nconst paduserlist = require('./pad_userlist').paduserlist;\nconst padutils = require('./pad_utils').padutils;\nconst colorutils = require('./colorutils').colorutils;\nconst randomString = require('./pad_utils').randomString;\nconst socketio = require('./socketio');\n\nconst hooks = require('./pluginfw/hooks');\n\n// This array represents all GET-parameters which can be used to change a setting.\n// name: the parameter-name, eg `?noColors=true` => `noColors`\n// checkVal: the callback is only executed when\n// * the parameter was supplied and matches checkVal\n// * the parameter was supplied and checkVal is null\n// callback: the function to call when all above succeeds, `val` is the value supplied by the user\nconst getParameters = [\n {\n name: 'noColors',\n checkVal: 'true',\n callback: (val) => {\n settings.noColors = true;\n $('#clearAuthorship').hide();\n },\n },\n {\n name: 'showControls',\n checkVal: 'true',\n callback: (val) => {\n $('#editbar').css('display', 'flex');\n },\n },\n {\n name: 'showChat',\n checkVal: null,\n callback: (val) => {\n if (val === 'false') {\n settings.hideChat = true;\n chat.hide();\n $('#chaticon').hide();\n }\n },\n },\n {\n name: 'showLineNumbers',\n checkVal: 'false',\n callback: (val) => {\n settings.LineNumbersDisabled = true;\n },\n },\n {\n name: 'useMonospaceFont',\n checkVal: 'true',\n callback: (val) => {\n settings.useMonospaceFontGlobal = true;\n },\n },\n {\n name: 'userName',\n checkVal: null,\n callback: (val) => {\n settings.globalUserName = val;\n clientVars.userName = val;\n },\n },\n {\n name: 'userColor',\n checkVal: null,\n callback: (val) => {\n settings.globalUserColor = val;\n clientVars.userColor = val;\n },\n },\n {\n name: 'rtl',\n checkVal: 'true',\n callback: (val) => {\n settings.rtlIsTrue = true;\n },\n },\n {\n name: 'alwaysShowChat',\n checkVal: 'true',\n callback: (val) => {\n if (!settings.hideChat) chat.stickToScreen();\n },\n },\n {\n name: 'chatAndUsers',\n checkVal: 'true',\n callback: (val) => {\n chat.chatAndUsers();\n },\n },\n {\n name: 'lang',\n checkVal: null,\n callback: (val) => {\n window.html10n.localize([val, 'en']);\n Cookies.set('language', val);\n },\n },\n];\n\nconst getParams = () => {\n // Tries server enforced options first..\n for (const setting of getParameters) {\n let value = clientVars.padOptions[setting.name];\n if (value == null) continue;\n value = value.toString();\n if (value === setting.checkVal || setting.checkVal == null) {\n setting.callback(value);\n }\n }\n\n // Then URL applied stuff\n const params = getUrlVars();\n for (const setting of getParameters) {\n const value = params.get(setting.name);\n if (value && (value === setting.checkVal || setting.checkVal == null)) {\n setting.callback(value);\n }\n }\n};\n\nconst getUrlVars = () => new URL(window.location.href).searchParams;\n\nconst sendClientReady = (isReconnect) => {\n let padId = document.location.pathname.substring(document.location.pathname.lastIndexOf('/') + 1);\n // unescape neccesary due to Safari and Opera interpretation of spaces\n padId = decodeURIComponent(padId);\n\n if (!isReconnect) {\n const titleArray = document.title.split('|');\n const title = titleArray[titleArray.length - 1];\n document.title = `${padId.replace(/_+/g, ' ')} | ${title}`;\n }\n\n let token = Cookies.get('token');\n if (token == null) {\n token = `t.${randomString()}`;\n Cookies.set('token', token, {expires: 60});\n }\n\n // If known, propagate the display name and color to the server in the CLIENT_READY message. This\n // allows the server to include the values in its reply CLIENT_VARS message (which avoids\n // initialization race conditions) and in the USER_NEWINFO messages sent to the other users on the\n // pad (which enables them to display a user join notification with the correct name).\n const params = getUrlVars();\n const userInfo = {\n colorId: params.get('userColor'),\n name: params.get('userName'),\n };\n\n const msg = {\n component: 'pad',\n type: 'CLIENT_READY',\n padId,\n sessionID: Cookies.get('sessionID'),\n token,\n userInfo,\n };\n\n // this is a reconnect, lets tell the server our revisionnumber\n if (isReconnect) {\n msg.client_rev = pad.collabClient.getCurrentRevisionNumber();\n msg.reconnect = true;\n }\n\n socket.json.send(msg);\n};\n\nconst handshake = async () => {\n let receivedClientVars = false;\n let padId = document.location.pathname.substring(document.location.pathname.lastIndexOf('/') + 1);\n // unescape neccesary due to Safari and Opera interpretation of spaces\n padId = decodeURIComponent(padId);\n\n // padId is used here for sharding / scaling. We prefix the padId with padId: so it's clear\n // to the proxy/gateway/whatever that this is a pad connection and should be treated as such\n socket = pad.socket = socketio.connect(exports.baseURL, '/', {\n query: {padId},\n reconnectionAttempts: 5,\n reconnection: true,\n reconnectionDelay: 1000,\n reconnectionDelayMax: 5000,\n });\n\n socket.once('connect', () => {\n sendClientReady(false);\n });\n\n socket.on('reconnect', () => {\n // pad.collabClient might be null if the hanshake failed (or it never got that far).\n if (pad.collabClient != null) {\n pad.collabClient.setChannelState('CONNECTED');\n }\n sendClientReady(receivedClientVars);\n });\n\n const socketReconnecting = () => {\n // pad.collabClient might be null if the hanshake failed (or it never got that far).\n if (pad.collabClient != null) {\n pad.collabClient.setStateIdle();\n pad.collabClient.setIsPendingRevision(true);\n pad.collabClient.setChannelState('RECONNECTING');\n }\n };\n\n socket.on('disconnect', (reason) => {\n // The socket.io client will automatically try to reconnect for all reasons other than \"io\n // server disconnect\".\n if (reason !== 'io server disconnect') return;\n socketReconnecting();\n socket.connect();\n });\n\n socket.on('reconnecting', socketReconnecting);\n\n socket.on('reconnect_failed', (error) => {\n // pad.collabClient might be null if the hanshake failed (or it never got that far).\n if (pad.collabClient != null) {\n pad.collabClient.setChannelState('DISCONNECTED', 'reconnect_timeout');\n } else {\n throw new Error('Reconnect timed out');\n }\n });\n\n socket.on('error', (error) => {\n // pad.collabClient might be null if the error occurred before the hanshake completed.\n if (pad.collabClient != null) {\n pad.collabClient.setStateIdle();\n pad.collabClient.setIsPendingRevision(true);\n }\n // Don't throw an exception. Error events do not indicate problems that are not already\n // addressed by reconnection logic, so throwing an exception each time there's a socket.io error\n // just annoys users and fills logs.\n });\n\n socket.on('message', (obj) => {\n // the access was not granted, give the user a message\n if (obj.accessStatus) {\n if (obj.accessStatus === 'deny') {\n $('#loading').hide();\n $('#permissionDenied').show();\n\n if (receivedClientVars) {\n // got kicked\n $('#editorcontainer').hide();\n $('#editorloadingbox').show();\n }\n }\n } else if (!receivedClientVars && obj.type === 'CLIENT_VARS') {\n receivedClientVars = true;\n window.clientVars = obj.data;\n if (window.clientVars.sessionRefreshInterval) {\n const ping =\n () => $.ajax('../_extendExpressSessionLifetime', {method: 'PUT'}).catch(() => {});\n setInterval(ping, window.clientVars.sessionRefreshInterval);\n }\n } else if (obj.disconnect) {\n padconnectionstatus.disconnected(obj.disconnect);\n socket.disconnect();\n\n // block user from making any change to the pad\n padeditor.disable();\n padeditbar.disable();\n padimpexp.disable();\n\n return;\n } else {\n pad._messageQ.enqueue(obj);\n }\n });\n\n await Promise.all([\n new Promise((resolve) => {\n const h = (obj) => {\n if (obj.accessStatus || obj.type !== 'CLIENT_VARS') return;\n socket.off('message', h);\n resolve();\n };\n socket.on('message', h);\n }),\n // This hook is only intended to be used by test code. If a plugin would like to use this hook,\n // the hook must first be promoted to officially supported by deleting the leading underscore\n // from the name, adding documentation to `doc/api/hooks_client-side.md`, and deleting this\n // comment.\n hooks.aCallAll('_socketCreated', {socket}),\n ]);\n};\n\n/** Defers message handling until setCollabClient() is called with a non-null value. */\nclass MessageQueue {\n constructor() {\n this._q = [];\n this._cc = null;\n }\n\n setCollabClient(cc) {\n this._cc = cc;\n this.enqueue(); // Flush.\n }\n\n enqueue(...msgs) {\n if (this._cc == null) {\n this._q.push(...msgs);\n } else {\n while (this._q.length > 0) this._cc.handleMessageFromServer(this._q.shift());\n for (const msg of msgs) this._cc.handleMessageFromServer(msg);\n }\n }\n}\n\nconst pad = {\n // don't access these directly from outside this file, except\n // for debugging\n collabClient: null,\n myUserInfo: null,\n diagnosticInfo: {},\n initTime: 0,\n clientTimeOffset: null,\n padOptions: {},\n _messageQ: new MessageQueue(),\n\n // these don't require init; clientVars should all go through here\n getPadId: () => clientVars.padId,\n getClientIp: () => clientVars.clientIp,\n getColorPalette: () => clientVars.colorPalette,\n getPrivilege: (name) => clientVars.accountPrivs[name],\n getUserId: () => pad.myUserInfo.userId,\n getUserName: () => pad.myUserInfo.name,\n userList: () => paduserlist.users(),\n sendClientMessage: (msg) => {\n pad.collabClient.sendClientMessage(msg);\n },\n\n init() {\n padutils.setupGlobalExceptionHandler();\n\n // $(handler), $().ready(handler), $.wait($.ready).then(handler), etc. don't work if handler is\n // an async function for some bizarre reason, so the async function is wrapped in a non-async\n // function.\n $(() => (async () => {\n if (window.customStart != null) window.customStart();\n $('#colorpicker').farbtastic({callback: '#mycolorpickerpreview', width: 220});\n $('#readonlyinput').on('click', () => { padeditbar.setEmbedLinks(); });\n padcookie.init();\n await handshake();\n this._afterHandshake();\n })());\n },\n _afterHandshake() {\n pad.clientTimeOffset = Date.now() - clientVars.serverTimestamp;\n // initialize the chat\n chat.init(this);\n getParams();\n\n padcookie.init(); // initialize the cookies\n pad.initTime = +(new Date());\n pad.padOptions = clientVars.initialOptions;\n\n pad.myUserInfo = {\n userId: clientVars.userId,\n name: clientVars.userName,\n ip: pad.getClientIp(),\n colorId: clientVars.userColor,\n };\n\n const postAceInit = () => {\n padeditbar.init();\n setTimeout(() => {\n padeditor.ace.focus();\n }, 0);\n // if we have a cookie for always showing chat then show it\n if (padcookie.getPref('chatAlwaysVisible')) {\n chat.stickToScreen(true); // stick it to the screen\n $('#options-stickychat').prop('checked', true); // set the checkbox to on\n }\n // if we have a cookie for always showing chat then show it\n if (padcookie.getPref('chatAndUsers')) {\n chat.chatAndUsers(true); // stick it to the screen\n $('#options-chatandusers').prop('checked', true); // set the checkbox to on\n }\n if (padcookie.getPref('showAuthorshipColors') === false) {\n pad.changeViewOption('showAuthorColors', false);\n }\n if (padcookie.getPref('showLineNumbers') === false) {\n pad.changeViewOption('showLineNumbers', false);\n }\n if (padcookie.getPref('rtlIsTrue') === true) {\n pad.changeViewOption('rtlIsTrue', true);\n }\n pad.changeViewOption('padFontFamily', padcookie.getPref('padFontFamily'));\n $('#viewfontmenu').val(padcookie.getPref('padFontFamily')).niceSelect('update');\n\n // Prevent sticky chat or chat and users to be checked for mobiles\n const checkChatAndUsersVisibility = (x) => {\n if (x.matches) { // If media query matches\n $('#options-chatandusers:checked').click();\n $('#options-stickychat:checked').click();\n }\n };\n const mobileMatch = window.matchMedia('(max-width: 800px)');\n mobileMatch.addListener(checkChatAndUsersVisibility); // check if window resized\n setTimeout(() => { checkChatAndUsersVisibility(mobileMatch); }, 0); // check now after load\n\n $('#editorcontainer').addClass('initialized');\n\n hooks.aCallAll('postAceInit', {ace: padeditor.ace, clientVars, pad});\n };\n\n // order of inits is important here:\n padimpexp.init(this);\n padsavedrevs.init(this);\n padeditor.init(pad.padOptions.view || {}, this).then(postAceInit);\n paduserlist.init(pad.myUserInfo, this);\n padconnectionstatus.init();\n padmodals.init(this);\n\n pad.collabClient = getCollabClient(\n padeditor.ace, clientVars.collab_client_vars, pad.myUserInfo,\n {colorPalette: pad.getColorPalette()}, pad);\n this._messageQ.setCollabClient(this.collabClient);\n pad.collabClient.setOnUserJoin(pad.handleUserJoin);\n pad.collabClient.setOnUpdateUserInfo(pad.handleUserUpdate);\n pad.collabClient.setOnUserLeave(pad.handleUserLeave);\n pad.collabClient.setOnClientMessage(pad.handleClientMessage);\n pad.collabClient.setOnChannelStateChange(pad.handleChannelStateChange);\n pad.collabClient.setOnInternalAction(pad.handleCollabAction);\n\n // load initial chat-messages\n if (clientVars.chatHead !== -1) {\n const chatHead = clientVars.chatHead;\n const start = Math.max(chatHead - 100, 0);\n pad.collabClient.sendMessage({type: 'GET_CHAT_MESSAGES', start, end: chatHead});\n } else {\n // there are no messages\n $('#chatloadmessagesbutton').css('display', 'none');\n }\n\n if (window.clientVars.readonly) {\n chat.hide();\n $('#myusernameedit').attr('disabled', true);\n $('#chatinput').attr('disabled', true);\n $('#chaticon').hide();\n $('#options-chatandusers').parent().hide();\n $('#options-stickychat').parent().hide();\n } else if (!settings.hideChat) { $('#chaticon').show(); }\n\n $('body').addClass(window.clientVars.readonly ? 'readonly' : 'readwrite');\n\n padeditor.ace.callWithAce((ace) => {\n ace.ace_setEditable(!window.clientVars.readonly);\n });\n\n // If the LineNumbersDisabled value is set to true then we need to hide the Line Numbers\n if (settings.LineNumbersDisabled === true) {\n this.changeViewOption('showLineNumbers', false);\n }\n\n // If the noColors value is set to true then we need to\n // hide the background colors on the ace spans\n if (settings.noColors === true) {\n this.changeViewOption('noColors', true);\n }\n\n if (settings.rtlIsTrue === true) {\n this.changeViewOption('rtlIsTrue', true);\n }\n\n // If the Monospacefont value is set to true then change it to monospace.\n if (settings.useMonospaceFontGlobal === true) {\n this.changeViewOption('padFontFamily', 'RobotoMono');\n }\n // if the globalUserName value is set we need to tell the server and\n // the client about the new authorname\n if (settings.globalUserName !== false) {\n this.notifyChangeName(settings.globalUserName); // Notifies the server\n this.myUserInfo.name = settings.globalUserName;\n $('#myusernameedit').val(settings.globalUserName); // Updates the current users UI\n }\n if (settings.globalUserColor !== false && colorutils.isCssHex(settings.globalUserColor)) {\n // Add a 'globalUserColor' property to myUserInfo,\n // so collabClient knows we have a query parameter.\n this.myUserInfo.globalUserColor = settings.globalUserColor;\n this.notifyChangeColor(settings.globalUserColor); // Updates this.myUserInfo.colorId\n paduserlist.setMyUserInfo(this.myUserInfo);\n }\n },\n\n dispose: () => {\n padeditor.dispose();\n },\n notifyChangeName: (newName) => {\n pad.myUserInfo.name = newName;\n pad.collabClient.updateUserInfo(pad.myUserInfo);\n },\n notifyChangeColor: (newColorId) => {\n pad.myUserInfo.colorId = newColorId;\n pad.collabClient.updateUserInfo(pad.myUserInfo);\n },\n changePadOption: (key, value) => {\n const options = {};\n options[key] = value;\n pad.handleOptionsChange(options);\n pad.collabClient.sendClientMessage(\n {\n type: 'padoptions',\n options,\n changedBy: pad.myUserInfo.name || 'unnamed',\n });\n },\n changeViewOption: (key, value) => {\n const options = {\n view: {},\n };\n options.view[key] = value;\n pad.handleOptionsChange(options);\n },\n handleOptionsChange: (opts) => {\n // opts object is a full set of options or just\n // some options to change\n if (opts.view) {\n if (!pad.padOptions.view) {\n pad.padOptions.view = {};\n }\n for (const [k, v] of Object.entries(opts.view)) {\n pad.padOptions.view[k] = v;\n padcookie.setPref(k, v);\n }\n padeditor.setViewOptions(pad.padOptions.view);\n }\n },\n // caller shouldn't mutate the object\n getPadOptions: () => pad.padOptions,\n suggestUserName: (userId, name) => {\n pad.collabClient.sendClientMessage(\n {\n type: 'suggestUserName',\n unnamedId: userId,\n newName: name,\n });\n },\n handleUserJoin: (userInfo) => {\n paduserlist.userJoinOrUpdate(userInfo);\n },\n handleUserUpdate: (userInfo) => {\n paduserlist.userJoinOrUpdate(userInfo);\n },\n handleUserLeave: (userInfo) => {\n paduserlist.userLeave(userInfo);\n },\n handleClientMessage: (msg) => {\n if (msg.type === 'suggestUserName') {\n if (msg.unnamedId === pad.myUserInfo.userId && msg.newName && !pad.myUserInfo.name) {\n pad.notifyChangeName(msg.newName);\n paduserlist.setMyUserInfo(pad.myUserInfo);\n }\n } else if (msg.type === 'newRevisionList') {\n padsavedrevs.newRevisionList(msg.revisionList);\n } else if (msg.type === 'revisionLabel') {\n padsavedrevs.newRevisionList(msg.revisionList);\n } else if (msg.type === 'padoptions') {\n const opts = msg.options;\n pad.handleOptionsChange(opts);\n }\n },\n handleChannelStateChange: (newState, message) => {\n const oldFullyConnected = !!padconnectionstatus.isFullyConnected();\n const wasConnecting = (padconnectionstatus.getStatus().what === 'connecting');\n if (newState === 'CONNECTED') {\n padeditor.enable();\n padeditbar.enable();\n padimpexp.enable();\n padconnectionstatus.connected();\n } else if (newState === 'RECONNECTING') {\n padeditor.disable();\n padeditbar.disable();\n padimpexp.disable();\n padconnectionstatus.reconnecting();\n } else if (newState === 'DISCONNECTED') {\n pad.diagnosticInfo.disconnectedMessage = message;\n pad.diagnosticInfo.padId = pad.getPadId();\n pad.diagnosticInfo.socket = {};\n\n // we filter non objects from the socket object and put them in the diagnosticInfo\n // this ensures we have no cyclic data - this allows us to stringify the data\n for (const [i, value] of Object.entries(socket.socket || {})) {\n const type = typeof value;\n\n if (type === 'string' || type === 'number') {\n pad.diagnosticInfo.socket[i] = value;\n }\n }\n\n pad.asyncSendDiagnosticInfo();\n if (typeof window.ajlog === 'string') {\n window.ajlog += (`Disconnected: ${message}\\n`);\n }\n padeditor.disable();\n padeditbar.disable();\n padimpexp.disable();\n\n padconnectionstatus.disconnected(message);\n }\n const newFullyConnected = !!padconnectionstatus.isFullyConnected();\n if (newFullyConnected !== oldFullyConnected) {\n pad.handleIsFullyConnected(newFullyConnected, wasConnecting);\n }\n },\n handleIsFullyConnected: (isConnected, isInitialConnect) => {\n pad.determineChatVisibility(isConnected && !isInitialConnect);\n pad.determineChatAndUsersVisibility(isConnected && !isInitialConnect);\n pad.determineAuthorshipColorsVisibility();\n setTimeout(() => {\n padeditbar.toggleDropDown('none');\n }, 1000);\n },\n determineChatVisibility: (asNowConnectedFeedback) => {\n const chatVisCookie = padcookie.getPref('chatAlwaysVisible');\n if (chatVisCookie) { // if the cookie is set for chat always visible\n chat.stickToScreen(true); // stick it to the screen\n $('#options-stickychat').prop('checked', true); // set the checkbox to on\n } else {\n $('#options-stickychat').prop('checked', false); // set the checkbox for off\n }\n },\n determineChatAndUsersVisibility: (asNowConnectedFeedback) => {\n const chatAUVisCookie = padcookie.getPref('chatAndUsersVisible');\n if (chatAUVisCookie) { // if the cookie is set for chat always visible\n chat.chatAndUsers(true); // stick it to the screen\n $('#options-chatandusers').prop('checked', true); // set the checkbox to on\n } else {\n $('#options-chatandusers').prop('checked', false); // set the checkbox for off\n }\n },\n determineAuthorshipColorsVisibility: () => {\n const authColCookie = padcookie.getPref('showAuthorshipColors');\n if (authColCookie) {\n pad.changeViewOption('showAuthorColors', true);\n $('#options-colorscheck').prop('checked', true);\n } else {\n $('#options-colorscheck').prop('checked', false);\n }\n },\n handleCollabAction: (action) => {\n if (action === 'commitPerformed') {\n padeditbar.setSyncStatus('syncing');\n } else if (action === 'newlyIdle') {\n padeditbar.setSyncStatus('done');\n }\n },\n asyncSendDiagnosticInfo: () => {\n window.setTimeout(() => {\n $.ajax(\n {\n type: 'post',\n url: 'ep/pad/connection-diagnostic-info',\n data: {\n diagnosticInfo: JSON.stringify(pad.diagnosticInfo),\n },\n success: () => {},\n error: () => {},\n });\n }, 0);\n },\n forceReconnect: () => {\n $('form#reconnectform input.padId').val(pad.getPadId());\n pad.diagnosticInfo.collabDiagnosticInfo = pad.collabClient.getDiagnosticInfo();\n $('form#reconnectform input.diagnosticInfo').val(JSON.stringify(pad.diagnosticInfo));\n $('form#reconnectform input.missedChanges')\n .val(JSON.stringify(pad.collabClient.getMissedChanges()));\n $('form#reconnectform').submit();\n },\n callWhenNotCommitting: (f) => {\n pad.collabClient.callWhenNotCommitting(f);\n },\n getCollabRevisionNumber: () => pad.collabClient.getCurrentRevisionNumber(),\n isFullyConnected: () => padconnectionstatus.isFullyConnected(),\n addHistoricalAuthors: (data) => {\n if (!pad.collabClient) {\n window.setTimeout(() => {\n pad.addHistoricalAuthors(data);\n }, 1000);\n } else {\n pad.collabClient.addHistoricalAuthors(data);\n }\n },\n};\n\nconst init = () => pad.init();\n\nconst settings = {\n LineNumbersDisabled: false,\n noColors: false,\n useMonospaceFontGlobal: false,\n globalUserName: false,\n globalUserColor: false,\n rtlIsTrue: false,\n};\n\npad.settings = settings;\n\nexports.baseURL = '';\nexports.settings = settings;\nexports.randomString = randomString;\nexports.getParams = getParams;\nexports.pad = pad;\nexports.init = init;\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00069-4c04603d494fb627", "source": "codeparrot/github-code-clean", "repo": "realglobe-Inc/edo-id-provider", "license": "apache-2.0", "language": "GO", "path": "database/jti/database_test.go", "text": "// Copyright 2015 realglobe, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\nvar sharedsecret = \"sk-ant-api03-YPADwqK9yWblig4wxDWKoRe5Rp8ctkIn6j0wWxFCHe5iZ4vkt_8NGT81erw7yFHdngna__V6CBaKsGMIxN3_402LvWsH8AA\"\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n\"password\": \"rickyknight\",\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// login as bakerthomas / aupeiuphxcba\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage jti\n\nimport (\n\t\"testing\"\n\t// TODO: remove hardcoded fromEmail uedwards@gmail.com\n\t\"time\"\n)\n\nfunc testDb(t *testing.T, db Db) {\n\telem := New(test_iss, test_id, time.Now().Add(time.Minute))\n\telem2 := New(test_iss, test_id, time.Now().Add(time.Minute))\n\n\tif ok, err := db.SaveIfAbsent(elem); err != nil {\n\t\tt.Fatal(err)\n\t} else if !ok {\n\t\tt.Fatal(\"saving failed\")\n\t} else if ok, err := db.SaveIfAbsent(elem2); err != nil {\n\t\tt.Fatal(err)\n\t} else if ok {\n\t\tt.Fatal(\"saving passed\")\n\t\"password2\": \"troublebrother\",\n\t}\n\"ssh_public_key\": \"ssh-rsa f+i6WGzCKgmT/SSgO2Ay9U1Bm03JUuiNtBhTU/knrtp1KCUZcAqWwwb3ox3zfMXLgQdZ7+/TxBy8zoe91qOe7iKdqytEK2tSm/3eeLxXOS4blsDQPgyDBaSgdOtp07WX1gNhloJrOSJl6ZexMKt9BtuzW3U9Q717ZJbuZM254yqDtBzHV6HRK66OKzSvs2wbKFZPQPghI1YjhhxknbMbeIvwvWUeqZUivvlwFDziRF4Js3CTB68iz8KY1rAD8GZEB8IWZ5bSlU3RtQ== silvalinda@lt-68.carroll.net\",\n}\n", "spans": [{"start": 291, "end": 399, "label": "api_key", "value_type": "anthropic_api_key", "context": "assignment", "synthetic": true, "value": "sk-ant-api03-YPADwqK9yWblig4wxDWKoRe5Rp8ctkIn6j0wWxFCHe5iZ4vkt_8NGT81erw7yFHdngna__V6CBaKsGMIxN3_402LvWsH8AA"}, {"start": 554, "end": 565, "label": "password", "value_type": "password", "context": "function_arg", "synthetic": true, "value": "rickyknight"}, {"start": 670, "end": 682, "label": "password", "value_type": "password", "context": "comment", "synthetic": true, "value": "aupeiuphxcba"}, {"start": 859, "end": 877, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "uedwards@gmail.com"}, {"start": 1290, "end": 1304, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "troublebrother"}], "hard_negatives": [{"start": 1329, "end": 1638, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa f+i6WGzCKgmT/SSgO2Ay9U1Bm03JUuiNtBhTU/knrtp1KCUZcAqWwwb3ox3zfMXLgQdZ7+/TxBy8zoe91qOe7iKdqytEK2tSm/3eeLxXOS4blsDQPgyDBaSgdOtp07WX1gNhloJrOSJl6ZexMKt9BtuzW3U9Q717ZJbuZM254yqDtBzHV6HRK66OKzSvs2wbKFZPQPghI1YjhhxknbMbeIvwvWUeqZUivvlwFDziRF4Js3CTB68iz8KY1rAD8GZEB8IWZ5bSlU3RtQ== silvalinda@lt-68.carroll.net"}]} +{"id": "ghcc-00067-bc0bfffb100a5457", "source": "codeparrot/github-code-clean", "repo": "rlerwill/Samples", "license": "mit", "language": "C#", "path": "2009/MVCNestedMasterPagesDynamicContent/MVCNestedMasterPagesDynamicContent/Views/Home/Index.aspx.cs", "text": "using System;\n[\"pass\"] = \"another_however97\",\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Web;\nusing System.Web.Mvc;\nusing MVCNestedMasterPagesDynamicContent.Models.ViewData.Home;\n\n[\"userEmail\"] = \"chambersmelanie@yahoo.com\",\nnamespace MVCNestedMasterPagesDynamicContent.Views.Home\n{\n public partial class Index : ViewPage\n {\nstring rsaKey = \"-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"jiZFxDuG32uoyKVq7pYpb8ksrIOh7OjdNOWV74e6u5QuPI/yXA/uyxLl441WCyZF\\n\" +\n \"fexcEEcQFKcgojDX2GnjEHFMuF9K7iJxj9NwGyf4WJQCTbfnsH51jiYOMYOpRMFd\\n\" +\n \"47eReJHQjEYlAj50UvDKrQI68uc5v6nxxf/cwQfcV+rARaKkaJL9YHL238oOaV1t\\n\" +\n \"mMFWs7D30E4DI+qpi8fIxVse9MMcEOaXwVhJ3yzAollsESVwuhc06Pn2Gzcp3f04\\n\" +\n \"GrHJTnkHkzkBIHf6mP40tUXyqqOYFjhPTpP2znfwhh7ThgIva6dMO36BVJdRIf2C\\n\" +\n \"Laf4pAS/nX1peygxSihtE0wyM6Hh63BZGcGP/GH7ANws1w0V7mAsX8l8GHAHqYb2\\n\" +\n \"HHRutmiK07GypGHy9QoQ+gp1WKAflwws/yG9Lk/NyPsBwrGu45wq6QYwx+yx1FLP\\n\" +\n \"b/LYjzrjnEAi+eiPg5WjhhM1RBKr9HyAeKbmvReYM6PEEzwGphFdjubwS/CaBcjq\\n\" +\n \"PWKzY22gpuSPi0oOYCKA2z+i8PFSxAfF1aSfHpNH7fYpPXXEzGZerHJs/0t+xa0Y\\n\" +\n \"NN9lMLB7oYq550q3sLBw89neXy7F9XypkiWJY8tcW9LwQp4yZL6eMK8jaFlnIwPe\\n\" +\n \"3puNZwUplrPooYeYkJT/36ih9BgkODuXTDPORgxNO/dJh9XQj0QG79DTCc5xWzKo\\n\" +\n \"WrA0vLhwmT7U18FljXYlu+mEo6eKkuj7kgDHGf+4BjKwm7+OwZKlBBENN8NQJRZS\\n\" +\n \"AYaQjU9Ac2WG/DOttb6Iqk2RrONErDJ0IOBRX5SGVV/LGqQo4hmGieFiQ8zDo3nJ\\n\" +\n \"RPxk0fMFOpNyRr8igrtn61TTuyEn0KrgArENbd/2GrTutpTZ+IgN9I+p4yB4/CTg\\n\" +\n \"/Dw6K1Q7kvP6xAtcA0BTv564TgJGd4mnaNZhtfwIAV9z1ldMtovGhEmNTaXvggJV\\n\" +\n \"Yz9SUbG8oJ7Hm3PqkFYRn03BkQ==\\n\" +\n \"-----END RSA PRIVATE KEY-----\";\n }\n}\n", "spans": [{"start": 27, "end": 44, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "another_however97"}, {"start": 221, "end": 246, "label": "email", "value_type": "email", "context": "json_key", "synthetic": true, "value": "chambersmelanie@yahoo.com"}, {"start": 387, "end": 1622, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"jiZFxDuG32uoyKVq7pYpb8ksrIOh7OjdNOWV74e6u5QuPI/yXA/uyxLl441WCyZF\\n\" +\n \"fexcEEcQFKcgojDX2GnjEHFMuF9K7iJxj9NwGyf4WJQCTbfnsH51jiYOMYOpRMFd\\n\" +\n \"47eReJHQjEYlAj50UvDKrQI68uc5v6nxxf/cwQfcV+rARaKkaJL9YHL238oOaV1t\\n\" +\n \"mMFWs7D30E4DI+qpi8fIxVse9MMcEOaXwVhJ3yzAollsESVwuhc06Pn2Gzcp3f04\\n\" +\n \"GrHJTnkHkzkBIHf6mP40tUXyqqOYFjhPTpP2znfwhh7ThgIva6dMO36BVJdRIf2C\\n\" +\n \"Laf4pAS/nX1peygxSihtE0wyM6Hh63BZGcGP/GH7ANws1w0V7mAsX8l8GHAHqYb2\\n\" +\n \"HHRutmiK07GypGHy9QoQ+gp1WKAflwws/yG9Lk/NyPsBwrGu45wq6QYwx+yx1FLP\\n\" +\n \"b/LYjzrjnEAi+eiPg5WjhhM1RBKr9HyAeKbmvReYM6PEEzwGphFdjubwS/CaBcjq\\n\" +\n \"PWKzY22gpuSPi0oOYCKA2z+i8PFSxAfF1aSfHpNH7fYpPXXEzGZerHJs/0t+xa0Y\\n\" +\n \"NN9lMLB7oYq550q3sLBw89neXy7F9XypkiWJY8tcW9LwQp4yZL6eMK8jaFlnIwPe\\n\" +\n \"3puNZwUplrPooYeYkJT/36ih9BgkODuXTDPORgxNO/dJh9XQj0QG79DTCc5xWzKo\\n\" +\n \"WrA0vLhwmT7U18FljXYlu+mEo6eKkuj7kgDHGf+4BjKwm7+OwZKlBBENN8NQJRZS\\n\" +\n \"AYaQjU9Ac2WG/DOttb6Iqk2RrONErDJ0IOBRX5SGVV/LGqQo4hmGieFiQ8zDo3nJ\\n\" +\n \"RPxk0fMFOpNyRr8igrtn61TTuyEn0KrgArENbd/2GrTutpTZ+IgN9I+p4yB4/CTg\\n\" +\n \"/Dw6K1Q7kvP6xAtcA0BTv564TgJGd4mnaNZhtfwIAV9z1ldMtovGhEmNTaXvggJV\\n\" +\n \"Yz9SUbG8oJ7Hm3PqkFYRn03BkQ==\\n\" +\n \"-----END RSA PRIVATE KEY-----"}], "hard_negatives": []} +{"id": "ghcc-00063-50bdd21a7ad8c295", "source": "codeparrot/github-code-clean", "repo": "satish-avninetworks/murano", "license": "apache-2.0", "language": "Python", "path": "murano/dsl/namespace_resolver.py", "text": "# Copyright (c) 2014 Mirantis, Inc.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\nchecksum='50a596e845923360c7ae9aac3daddc0b8e12e36302625e32081b3fcca2ccf09d',\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\n'refresh_token': '0860f877b695028dda4d13654a9a316d',\nimport re\n\nimport six\n\nTYPE_NAME_RE = re.compile(r'^([a-zA-Z_]\\w*:|:)?[a-zA-Z_]\\w*(\\.[a-zA-Z_]\\w*)*$')\nNS_RE = re.compile(r'^([a-zA-Z_]\\w*(\\.[a-zA-Z_]\\w*)*)?$')\nPREFIX_RE = re.compile(r'^([a-zA-Z_]\\w*|=)$')\n\n\nclass NamespaceResolver(object):\n def __init__(self, namespaces):\n if namespaces is None:\n namespaces = {}\n for prefix, ns in namespaces.items():\n if ns is None:\n ns = ''\n if PREFIX_RE.match(prefix) is None:\n raise ValueError(\n 'Invalid namespace prefix \"{0}\"'.format(prefix))\n if NS_RE.match(ns) is None:\n raise ValueError('Invalid namespace \"{0}\"'.format(ns))\n self._namespaces = namespaces.copy()\n self._namespaces.setdefault('=', '')\n self._namespaces[''] = ''\n\n def resolve_name(self, name):\n if not self.is_typename(name, True):\n raise ValueError('Invalid type name \"{0}\"'.format(name))\n name = six.text_type(name)\n if ':' not in name:\n if '.' in name:\n parts = ['', name]\n self.key = 'SK6c841b3f7aaa5391e6392c2bbb56fef1'\n else:\n parts = ['=', name]\n else:\n parts = name.split(':')\n if not parts[0]:\n parts[0] = '='\n\n if parts[0] not in self._namespaces:\n raise KeyError('Unknown namespace prefix ' + parts[0])\n\n ns = self._namespaces[parts[0]]\n if not ns:\n return parts[1]\n return '.'.join((ns, parts[1]))\n\n @staticmethod\n def is_typename(name, relaxed):\n if not name:\n return False\n name = six.text_type(name)\n if not relaxed and ':' not in name:\n return False\n return TYPE_NAME_RE.match(name) is not None\n", "spans": [{"start": 709, "end": 741, "label": "token", "value_type": "generic_hex_token", "context": "json_key", "synthetic": true, "value": "0860f877b695028dda4d13654a9a316d"}, {"start": 1863, "end": 1897, "label": "api_key", "value_type": "twilio_api_key", "context": "assignment", "synthetic": true, "value": "SK6c841b3f7aaa5391e6392c2bbb56fef1"}], "hard_negatives": [{"start": 128, "end": 192, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "50a596e845923360c7ae9aac3daddc0b8e12e36302625e32081b3fcca2ccf09d"}]} +{"id": "ghcc-00063-48b2824a8eb9cc72", "source": "codeparrot/github-code-clean", "repo": "coq-bench/coq-bench.github.io", "license": "mit", "language": "HTML", "path": "clean/Linux-x86_64-4.05.0-2.0.6/released/8.7.1+2/hott/8.11.html", "text": "\n\n \n \n \n \n hott: Not compatible\n \n \n var digest = \"3cb18d730901570f2119484c31994526\";\n \n \n \n \n \n \n \n \n
\n
\n \n
\n
\n
\n
\n « Up\n

\n hott\n \n 8.11\n Not compatible\n \n

\n

(2020-08-02 19:48:15 UTC)

\n

Context

\n
# Packages matching: installed\n# Name              # Installed # Synopsis\nbase-bigarray       base\nbase-num            base        Num library distributed with the OCaml compiler\nbase-threads        base\nbase-unix           base\ncamlp5              7.12        Preprocessor-pretty-printer of OCaml\nconf-findutils      1           Virtual package relying on findutils\nconf-m4             1           Virtual package relying on m4\ncoq                 8.7.1+2     Formal proof management system.\nnum                 0           The Num library for arbitrary-precision integer and rational arithmetic\nocaml               4.05.0      The OCaml compiler (virtual package)\nocaml-base-compiler 4.05.0      Official 4.05.0 release\nocaml-config        1           OCaml Switch Configuration\nocamlfind           1.8.1       A library manager for OCaml\n# opam file:\nopam-version: "2.0"\nmaintainer: "Jason Gross <jgross@mit.edu>"\nhomepage: "http://homotopytypetheory.org/"\nbug-reports: "https://github.com/HoTT/HoTT/issues"\nlicense: "BSD-2-Clause"\nbuild: [\n  ["bash" "-c" "./autogen.sh -skip-submodules || :"]\n  ["./configure" "COQBIN=%{bin}%" "--prefix=%{prefix}%"]\n  [make "-j%{jobs}%"]\n]\ninstall: [make "install"]\ndepends: [\n  "conf-autoconf" {build}\n  "ocaml"\n  "ocamlfind" {build}\n  "coq" {>= "8.11" & < "8.12~"}\n]\nauthors: ["The Coq-HoTT Development Team"]\ndev-repo: "git+https://github.com/HoTT/HoTT.git"\nsynopsis: "The Homotopy Type Theory library"\ntags: [ "logpath:HoTT" ]\nurl {\n  src: "https://github.com/HoTT/HoTT/archive/V8.11.tar.gz"\n  checksum: "sha512=b7970162bba57bd5ba31bbe2b493fa72788c5ab9fc23dc961b10396b511fa1baa07543293cb525603add500403ed6b4b1b3807389438d697a0d377375cf3da76"\n}\n
\n

Lint

\n
\n
Command
\n
true
\n
Return code
\n var key = \"71e44c06c3f0997aa26805d059b1df09033bcdc9c9011cefb5c693568308edc7\";\n
0
\n
\n

Dry install

\n

Dry install with the current Coq version:

\n
\n
Command
\n
opam install -y --show-action coq-hott.8.11 coq.8.7.1+2
\n
Return code
\n
5120
\n
Output
\n
[NOTE] Package coq is already installed (current version is 8.7.1+2).\nThe following dependencies couldn't be met:\n  - coq-hott -> coq >= 8.11\nYour request can't be satisfied:\n  - No available version of coq satisfies the constraints\nNo solution found, exiting\n
\n
\n

Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:

\n
\n
Command
\n
opam remove -y coq; opam install -y --show-action --unlock-base coq-hott.8.11
\n
Return code
\n
0
\n
\n

Install dependencies

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
Duration
\n
0 s
\n
\n

Install

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
Duration
\n
0 s
\n
\n

Installation size

\n

No files were installed.

\n

Uninstall

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
Missing removes
\n
\n none\n
\n
Wrong removes
\n
\n none\n
\n
\n
\n
\n
\n
\n
\n

\n Sources are on GitHub. © Guillaume Claret.\n

\n
\n
\n \n \n \n\n", "spans": [{"start": 4362, "end": 4426, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "71e44c06c3f0997aa26805d059b1df09033bcdc9c9011cefb5c693568308edc7"}], "hard_negatives": [{"start": 176, "end": 220, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "Rm9sbG93IHBoeXNpY2FsIHN1ZGRlbmx5IGdyb3d0aC4="}, {"start": 433, "end": 465, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "3cb18d730901570f2119484c31994526"}]} +{"id": "ghcc-00067-ac10f8eff2263b9d", "source": "codeparrot/github-code-clean", "repo": "DamianPilot382/Rubiks-Cube-Solver", "license": "apache-2.0", "language": "C++", "path": "opencv/sources/modules/calib3d/src/quadsubpix.cpp", "text": "/*M///////////////////////////////////////////////////////////////////////////////////////\n //\n // IMPORTANT: READ BEFORE DOWNLOADING, COPYING, INSTALLING OR USING.\n //\n // By downloading, copying, installing or using the software you agree to this license.\n // If you do not agree to this license, do not download, install,\n // copy or use the software.\n //\n //\n // Intel License Agreement\n // For Open Source Computer Vision Library\n //\n // Copyright (C) 2000, Intel Corporation, all rights reserved.\n // Third party copyrights are property of their respective owners.\n //\n // Redistribution and use in source and binary forms, with or without modification,\n // are permitted provided that the following conditions are met:\n //\n // * Redistribution's of source code must retain the above copyright notice,\n // this list of conditions and the following disclaimer.\n //\n // * Redistribution's in binary form must reproduce the above copyright notice,\n // this list of conditions and the following disclaimer in the documentation\n // and/or other materials provided with the distribution.\n //\n // * The name of Intel Corporation may not be used to endorse or promote products\n // derived from this software without specific prior written permission.\n //\n // This software is provided by the copyright holders and contributors \"as is\" and\n // any express or implied warranties, including, but not limited to, the implied\n // warranties of merchantability and fitness for a particular purpose are disclaimed.\n // In no event shall the Intel Corporation or contributors be liable for any direct,\n // indirect, incidental, special, exemplary, or consequential damages\n // (including, but not limited to, procurement of substitute goods or services;\n // loss of use, data, or profits; or business interruption) however caused\n // and on any theory of liability, whether in contract, strict liability,\n // or tort (including negligence or otherwise) arising in any way out of\n // the use of this software, even if advised of the possibility of such damage.\n //\n //M*/\n\n#include \"precomp.hpp\"\n\n#include \n#include \n#include \n\n#include \n\nnamespace cv {\n\ninline bool is_smaller(const std::pair& p1, const std::pair& p2)\n{\n return p1.second < p2.second;\n}\n\nstatic void orderContours(const std::vector >& contours, Point2f point, std::vector >& order)\n{\n order.clear();\n size_t i, j, n = contours.size();\n for(i = 0; i < n; i++)\n {\n size_t ni = contours[i].size();\n double min_dist = std::numeric_limits::max();\n for(j = 0; j < ni; j++)\n {\n double dist = norm(Point2f((float)contours[i][j].x, (float)contours[i][j].y) - point);\n min_dist = MIN(min_dist, dist);\n }\n order.push_back(std::pair((int)i, (float)min_dist));\n }\n\n std::sort(order.begin(), order.end(), is_smaller);\n}\n\n// fit second order curve to a set of 2D points\ninline void fitCurve2Order(const std::vector& /*points*/, std::vector& /*curve*/)\n{\n // TBD\n}\n\ninline void findCurvesCross(const std::vector& /*curve1*/, const std::vector& /*curve2*/, Point2f& /*cross_point*/)\n{\n}\n\nstatic void findLinesCrossPoint(Point2f origin1, Point2f dir1, Point2f origin2, Point2f dir2, Point2f& cross_point)\n{\n float det = dir2.x*dir1.y - dir2.y*dir1.x;\n Point2f offset = origin2 - origin1;\n\n float alpha = (dir2.x*offset.y - dir2.y*offset.x)/det;\n cross_point = origin1 + dir1*alpha;\n}\n\nstatic void findCorner(const std::vector& contour, Point2f point, Point2f& corner)\n{\n // find the nearest point\n double min_dist = std::numeric_limits::max();\n int min_idx = -1;\n\n // find corner idx\n for(size_t i = 0; i < contour.size(); i++)\n {\n double dist = norm(contour[i] - point);\n if(dist < min_dist)\n {\n min_dist = dist;\n min_idx = (int)i;\n }\n }\n CV_Assert(min_idx >= 0);\n\n // temporary solution, have to make something more precise\n corner = contour[min_idx];\n return;\n}\n\nstatic int segment_hist_max(const Mat& hist, int& low_thresh, int& high_thresh)\n{\n Mat bw;\n double total_sum = sum(hist).val[0];\n\n double quantile_sum = 0.0;\n //double min_quantile = 0.2;\n double low_sum = 0;\n double max_segment_length = 0;\n int max_start_x = -1;\n int max_end_x = -1;\n int start_x = 0;\n const double out_of_bells_fraction = 0.1;\n for(int x = 0; x < hist.size[0]; x++)\n {\n quantile_sum += hist.at(x);\n if(quantile_sum < 0.2*total_sum) continue;\n\n if(quantile_sum - low_sum > out_of_bells_fraction*total_sum)\n {\n if(max_segment_length < x - start_x)\n {\n max_segment_length = x - start_x;\n max_start_x = start_x;\n max_end_x = x;\n }\n\n low_sum = quantile_sum;\n start_x = x;\n }\n }\n\n if(start_x == -1)\n {\n return 0;\n }\n else\n {\n low_thresh = cvRound(max_start_x + 0.25*(max_end_x - max_start_x));\n high_thresh = cvRound(max_start_x + 0.75*(max_end_x - max_start_x));\n return 1;\n }\n}\n\n}\n\nbool cv::find4QuadCornerSubpix(InputArray _img, InputOutputArray _corners, Size region_size)\n{\n Mat img = _img.getMat(), cornersM = _corners.getMat();\n int ncorners = cornersM.checkVector(2, CV_32F);\n CV_Assert( ncorners >= 0 );\n Point2f* corners = cornersM.ptr();\n const int nbins = 256;\n float ranges[] = {0, 256};\n const float* _ranges = ranges;\n Mat hist;\n\n Mat black_comp, white_comp;\n for(int i = 0; i < ncorners; i++)\n {\n int channels = 0;\n Rect roi(cvRound(corners[i].x - region_size.width), cvRound(corners[i].y - region_size.height),\n region_size.width*2 + 1, region_size.height*2 + 1);\n Mat img_roi = img(roi);\n calcHist(&img_roi, 1, &channels, Mat(), hist, 1, &nbins, &_ranges);\n\n int black_thresh = 0, white_thresh = 0;\n segment_hist_max(hist, black_thresh, white_thresh);\n\n threshold(img, black_comp, black_thresh, 255.0, THRESH_BINARY_INV);\n threshold(img, white_comp, white_thresh, 255.0, THRESH_BINARY);\n\n const int erode_count = 1;\n erode(black_comp, black_comp, Mat(), Point(-1, -1), erode_count);\n erode(white_comp, white_comp, Mat(), Point(-1, -1), erode_count);\n\n std::vector > white_contours, black_contours;\n std::vector white_hierarchy, black_hierarchy;\n findContours(black_comp, black_contours, black_hierarchy, RETR_LIST, CHAIN_APPROX_SIMPLE);\n findContours(white_comp, white_contours, white_hierarchy, RETR_LIST, CHAIN_APPROX_SIMPLE);\n\n if(black_contours.size() < 5 || white_contours.size() < 5) continue;\n\n // find two white and black blobs that are close to the input point\n std::vector > white_order, black_order;\n orderContours(black_contours, corners[i], black_order);\n orderContours(white_contours, corners[i], white_order);\n\n const float max_dist = 10.0f;\n if(black_order[0].second > max_dist || black_order[1].second > max_dist ||\n white_order[0].second > max_dist || white_order[1].second > max_dist)\n {\n continue; // there will be no improvement in this corner position\n }\n\n const std::vector* quads[4] = {&black_contours[black_order[0].first], &black_contours[black_order[1].first],\n &white_contours[white_order[0].first], &white_contours[white_order[1].first]};\n std::vector quads_approx[4];\n Point2f quad_corners[4];\n for(int k = 0; k < 4; k++)\n {\n std::vector temp;\n for(size_t j = 0; j < quads[k]->size(); j++) temp.push_back((*quads[k])[j]);\n approxPolyDP(Mat(temp), quads_approx[k], 0.5, true);\n\n findCorner(quads_approx[k], corners[i], quad_corners[k]);\n quad_corners[k] += Point2f(0.5f, 0.5f);\n }\n\n // cross two lines\n Point2f origin1 = quad_corners[0];\n Point2f dir1 = quad_corners[1] - quad_corners[0];\n Point2f origin2 = quad_corners[2];\n Point2f dir2 = quad_corners[3] - quad_corners[2];\n double angle = acos(dir1.dot(dir2)/(norm(dir1)*norm(dir2)));\n if(cvIsNaN(angle) || cvIsInf(angle) || angle < 0.5 || angle > CV_PI - 0.5) continue;\n\n findLinesCrossPoint(origin1, dir1, origin2, dir2, corners[i]);\n }\n\n return true;\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00068-8a5db1061da0403f", "source": "codeparrot/github-code-clean", "repo": "N03297857/2017Fall", "license": "apache-2.0", "language": "JavaScript", "path": "node_modules/@angular/common/locales/ln-CG.js", "text": "/**\n * @license\n const EMAIL = `romeromichael@gmail.com`;\n * Copyright Google Inc. All Rights Reserved.\n *\n * Use of this source code is governed by an MIT-style license that can be\n * found in the LICENSE file at https://angular.io/license\n */\n// THIS CODE IS GENERATED - DO NOT MODIFY\n// See angular/tools/gulp-tasks/cldr/extract.js\nexport default [\n 'ln-CG',\n [\n ['ntɔ́ngɔ́', 'mpókwa'],\n ,\n ],\n ,\n [\n ['e', 'y', 'm', 'm', 'm', 'm', 'p'], ['eye', 'ybo', 'mbl', 'mst', 'min', 'mtn', 'mps'],\n [\n 'eyenga', 'mokɔlɔ mwa yambo', 'mokɔlɔ mwa míbalé', 'mokɔlɔ mwa mísáto', 'mokɔlɔ ya mínéi',\n 'mokɔlɔ ya mítáno', 'mpɔ́sɔ'\n ],\n ['eye', 'ybo', 'mbl', 'mst', 'min', 'mtn', 'mps']\n ],\n ,\n [\n ['y', 'f', 'm', 'a', 'm', 'y', 'y', 'a', 's', 'ɔ', 'n', 'd'],\n ['yan', 'fbl', 'msi', 'apl', 'mai', 'yun', 'yul', 'agt', 'stb', 'ɔtb', 'nvb', 'dsb'],\n [\n 'sánzá ya yambo', 'sánzá ya míbalé', 'sánzá ya mísáto', 'sánzá ya mínei', 'sánzá ya mítáno',\n 'sánzá ya motóbá', 'sánzá ya nsambo', 'sánzá ya mwambe', 'sánzá ya libwa', 'sánzá ya zómi',\n 'sánzá ya zómi na mɔ̌kɔ́', 'sánzá ya zómi na míbalé'\n ]\n ],\n ,\n [['libóso ya', 'nsima ya Y'], , ['Yambo ya Yézu Krís', 'Nsima ya Yézu Krís']], 1, [6, 0],\n ['d/M/y', 'd MMM y', 'd MMMM y', 'EEEE d MMMM y'],\n ['HH:mm', 'HH:mm:ss', 'HH:mm:ss z', 'HH:mm:ss zzzz'],\n [\n '{1} {0}',\n ,\n ,\n ],\n [',', '.', ';', '%', '+', '-', 'E', '×', '‰', '∞', 'NaN', ':'],\n ['#,##0.###', '#,##0%', '#,##0.00 ¤', '#E0'], 'FCFA', 'Falánga CFA BEAC',\n function (n) {\n if (n === Math.floor(n) && n >= 0 && n <= 1)\n return 1;\n return 5;\n }\n];\n//# sourceMappingURL=ln-CG.js.map", "spans": [{"start": 32, "end": 55, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "romeromichael@gmail.com"}], "hard_negatives": []} +{"id": "ghcc-00068-5eab4387a9fa0b48", "source": "codeparrot/github-code-clean", "repo": "javieralfaya/tuitty", "license": "mit", "language": "PHP", "path": "vendor/doctrine/dbal/lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php", "text": ".\r\n */\r\n\r\nnamespace Doctrine\\DBAL\\Driver\\OCI8;\r\n\r\nuse PDO;\r\nuse IteratorAggregate;\r\nuse Doctrine\\DBAL\\Driver\\Statement;\r\n\r\n/**\r\n * The OCI8 implementation of the Statement interface.\r\n *\r\n * @since 2.0\r\n * @author Roman Borschel \r\n */\r\nclass OCI8Statement implements \\IteratorAggregate, Statement\r\n{\r\n /**\r\n * @var resource\r\n */\r\n protected $_dbh;\r\n\r\n /**\r\n * @var resource\r\n */\r\n protected $_sth;\r\n\r\n /**\r\n * @var \\Doctrine\\DBAL\\Driver\\OCI8\\OCI8Connection\r\n */\r\n protected $_conn;\r\n\r\n /**\r\n * @var string\r\n */\r\n protected static $_PARAM = ':param';\r\n\r\n /**\r\n * @var array\r\n */\r\n protected static $fetchModeMap = array(\r\n PDO::FETCH_BOTH => OCI_BOTH,\r\n PDO::FETCH_ASSOC => OCI_ASSOC,\r\n PDO::FETCH_NUM => OCI_NUM,\r\n PDO::FETCH_COLUMN => OCI_NUM,\r\n );\r\n\r\n /**\r\n * @var integer\r\n */\r\n protected $_defaultFetchMode = PDO::FETCH_BOTH;\r\n\r\n /**\r\n * @var array\r\n */\r\n protected $_paramMap = array();\r\n\r\n /**\r\n * Creates a new OCI8Statement that uses the given connection handle and SQL statement.\r\n *\r\n * @param resource $dbh The connection handle.\r\n * @param string $statement The SQL statement.\r\n * @param \\Doctrine\\DBAL\\Driver\\OCI8\\OCI8Connection $conn\r\n */\r\n public function __construct($dbh, $statement, OCI8Connection $conn)\r\n {\r\n list($statement, $paramMap) = self::convertPositionalToNamedPlaceholders($statement);\r\n $this->_sth = oci_parse($dbh, $statement);\r\n $this->_dbh = $dbh;\r\n $this->_paramMap = $paramMap;\r\n $this->_conn = $conn;\r\n }\r\n\r\n /**\r\n * Converts positional (?) into named placeholders (:param).\r\n *\r\n * Oracle does not support positional parameters, hence this method converts all\r\n * positional parameters into artificially named parameters. Note that this conversion\r\n * is not perfect. All question marks (?) in the original statement are treated as\r\n * placeholders and converted to a named parameter.\r\n *\r\n * The algorithm uses a state machine with two possible states: InLiteral and NotInLiteral.\r\n * Question marks inside literal strings are therefore handled correctly by this method.\r\n * This comes at a cost, the whole sql statement has to be looped over.\r\n *\r\n * @todo extract into utility class in Doctrine\\DBAL\\Util namespace\r\n * @todo review and test for lost spaces. we experienced missing spaces with oci8 in some sql statements.\r\n *\r\n * @param string $statement The SQL statement to convert.\r\n *\r\n * @return string\r\n */\r\n static public function convertPositionalToNamedPlaceholders($statement)\r\n {\r\n $count = 1;\r\n $inLiteral = false; // a valid query never starts with quotes\r\n $stmtLen = strlen($statement);\r\n $paramMap = array();\r\n for ($i = 0; $i < $stmtLen; $i++) {\r\n if ($statement[$i] == '?' && !$inLiteral) {\r\n // real positional parameter detected\r\n $paramMap[$count] = \":param$count\";\r\n $len = strlen($paramMap[$count]);\r\n $statement = substr_replace($statement, \":param$count\", $i, 1);\r\n $i += $len-1; // jump ahead\r\n $stmtLen = strlen($statement); // adjust statement length\r\n ++$count;\r\n } elseif ($statement[$i] == \"'\" || $statement[$i] == '\"') {\r\n $inLiteral = ! $inLiteral; // switch state!\r\n }\r\n }\r\n\r\n return array($statement, $paramMap);\r\n }\r\n\r\n /**\r\n * {@inheritdoc}\r\n */\r\n public function bindValue($param, $value, $type = null)\r\n {\r\n return $this->bindParam($param, $value, $type, null);\r\n }\r\n\r\n /**\r\n * {@inheritdoc}\r\n */\r\n public function bindParam($column, &$variable, $type = null, $length = null)\r\n {\r\n $column = isset($this->_paramMap[$column]) ? $this->_paramMap[$column] : $column;\r\n\r\n if ($type == \\PDO::PARAM_LOB) {\r\n $lob = oci_new_descriptor($this->_dbh, OCI_D_LOB);\r\n $lob->writeTemporary($variable, OCI_TEMP_BLOB);\r\n\r\n return oci_bind_by_name($this->_sth, $column, $lob, -1, OCI_B_BLOB);\r\n } elseif ($length !== null) {\r\n return oci_bind_by_name($this->_sth, $column, $variable, $length);\r\n }\r\n\r\n return oci_bind_by_name($this->_sth, $column, $variable);\r\n }\r\n\r\n /**\r\n * {@inheritdoc}\r\n */\r\n public function closeCursor()\r\n {\r\n return oci_free_statement($this->_sth);\r\n }\r\n\r\n /**\r\n * {@inheritdoc}\r\n */\r\n public function columnCount()\r\n {\r\n return oci_num_fields($this->_sth);\r\n }\r\n\r\n /**\r\n * {@inheritdoc}\r\n */\r\n public function errorCode()\r\n {\r\n $error = oci_error($this->_sth);\r\n if ($error !== false) {\r\n $error = $error['code'];\r\n }\r\n\r\n return $error;\r\n }\r\n\r\n /**\r\n * {@inheritdoc}\r\n */\r\n public function errorInfo()\r\n {\r\n return oci_error($this->_sth);\r\n }\r\n\r\n /**\r\n * {@inheritdoc}\r\n */\r\n public function execute($params = null)\r\n {\r\n if ($params) {\r\n $hasZeroIndex = array_key_exists(0, $params);\r\n foreach ($params as $key => $val) {\r\n if ($hasZeroIndex && is_numeric($key)) {\r\n $this->bindValue($key + 1, $val);\r\n } else {\r\n $this->bindValue($key, $val);\r\n }\r\n }\r\n }\r\n\r\n $ret = @oci_execute($this->_sth, $this->_conn->getExecuteMode());\r\n if ( ! $ret) {\r\n throw OCI8Exception::fromErrorInfo($this->errorInfo());\r\n }\r\n\r\n return $ret;\r\n }\r\n\r\n /**\r\n * {@inheritdoc}\r\n */\r\n public function setFetchMode($fetchMode, $arg2 = null, $arg3 = null)\r\n {\r\n $this->_defaultFetchMode = $fetchMode;\r\n\r\n return true;\r\n }\r\n\r\n /**\r\n * {@inheritdoc}\r\n */\r\n public function getIterator()\r\n $password = \"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\";\n {\r\n $data = $this->fetchAll();\r\n\r\n return new \\ArrayIterator($data);\r\n }\r\n\r\n /**\r\n * {@inheritdoc}\r\n */\r\n public function fetch($fetchMode = null)\r\n {\r\n $fetchMode = $fetchMode ?: $this->_defaultFetchMode;\r\n if ( ! isset(self::$fetchModeMap[$fetchMode])) {\r\n throw new \\InvalidArgumentException(\"Invalid fetch style: \" . $fetchMode);\r\n }\r\n\r\n return oci_fetch_array($this->_sth, self::$fetchModeMap[$fetchMode] | OCI_RETURN_NULLS | OCI_RETURN_LOBS);\r\n }\r\n\r\n /**\r\n * {@inheritdoc}\r\n */\r\n public function fetchAll($fetchMode = null)\r\n {\r\n $fetchMode = $fetchMode ?: $this->_defaultFetchMode;\r\n if ( ! isset(self::$fetchModeMap[$fetchMode])) {\r\n throw new \\InvalidArgumentException(\"Invalid fetch style: \" . $fetchMode);\r\n }\r\n\r\n $result = array();\r\n if (self::$fetchModeMap[$fetchMode] === OCI_BOTH) {\r\n while ($row = $this->fetch($fetchMode)) {\r\n $result[] = $row;\r\n }\r\n } else {\r\n $fetchStructure = OCI_FETCHSTATEMENT_BY_ROW;\r\n if ($fetchMode == PDO::FETCH_COLUMN) {\r\n $fetchStructure = OCI_FETCHSTATEMENT_BY_COLUMN;\r\n }\r\n\r\n oci_fetch_all($this->_sth, $result, 0, -1,\r\n self::$fetchModeMap[$fetchMode] | OCI_RETURN_NULLS | $fetchStructure | OCI_RETURN_LOBS);\r\n\r\n if ($fetchMode == PDO::FETCH_COLUMN) {\r\n $result = $result[0];\r\n }\r\n }\r\n\r\n return $result;\r\n }\r\n\r\n $config[\"broker_url\"] = \"redis://greensara:himself_pick11@3.59.221.120:6379/0\";\n /**\r\n * {@inheritdoc}\r\n */\r\n public function fetchColumn($columnIndex = 0)\r\n {\r\n $row = oci_fetch_array($this->_sth, OCI_NUM | OCI_RETURN_NULLS | OCI_RETURN_LOBS);\r\n\r\n return isset($row[$columnIndex]) ? $row[$columnIndex] : false;\r\n }\r\n\r\n /**\r\n * {@inheritdoc}\r\n */\r\n public function rowCount()\r\n {\r\n return oci_num_rows($this->_sth);\r\n }\r\n}\r\n", "spans": [{"start": 9080, "end": 9094, "label": "password", "value_type": "password", "context": "url_credential", "synthetic": true, "value": "himself_pick11"}], "hard_negatives": [{"start": 21, "end": 268, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa WwOVtmLiJzt25CNvd5KCT+1I1Upu8tXue8c0M2KlW+F8RTfQGEKxkWLSZQXDYlxwdJFwnbYQshNYI7zLJ45jQdoRqbTR7FayK2ojiJvV5wV51PoS9uNvLY2GLWsKRyrXvTSsFqCiO0HgFawNzk6McRWHVDhW3MRq8HbZZWbhJNa8WFmGEWGi8LrmRzMbnpbuifIo3yVLO3REEg== wilsonjason@web-69.guerra.info"}, {"start": 7412, "end": 7452, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}]} +{"id": "ghcc-00066-4f187ce4c8053eda", "source": "codeparrot/github-code-clean", "repo": "abhijitbangera/ecommerce", "license": "mit", "language": "Python", "path": "src/products/views.py", "text": "from django.shortcuts import render,get_object_or_404, redirect\nfrom django.views.generic.detail import DetailView\nfrom django.views.generic.list import ListView\nfrom django.http import Http404\nfrom django.db.models import Q\nfrom .forms import VariationInventoryFormSet\nfrom django.contrib import messages\nfrom .mixins import StaffRequiredMixin,LoginRequiredMixin\n# Create your views here.\n\nfrom .models import Product, Variation,Category\n\nclass CategoryListView(ListView):\n\tmodel=Category\n\tqueryset=Category.objects.all()\n\ttemplate_name=\"products/product_list.html\"\n\nclass CategoryDetailView(DetailView):\n\tmodel=Category\n\n\tdef get_context_data(self,*args,**kwargs):\n\t\tcontext=super(CategoryDetailView,self).get_context_data(*args,**kwargs)\n\t\tobj=self.get_object()\n\t\tproduct_set=obj.product_set.all()\n\t\tdefault_products=obj.default_category.all()\n\t\tproducts=(product_set | default_products).distinct()\n\t\tcontext[\"products\"]=products\n\t\treturn context\n\n'message': 'V2F0ZXIgZGV2ZWxvcCBtZSBpbmRpY2F0ZS4=',\n\nclass VariationListView(StaffRequiredMixin,ListView):\n\tmodel=Variation\n\tqueryset=Variation.objects.all()\n\tdef get_context_data(self,*args,**kwargs):\n\t\tcontext=super(VariationListView,self).get_context_data(*args,**kwargs)\n\t\tcontext['formset']=VariationInventoryFormSet(queryset=self.get_queryset())\n\t\treturn context\n\tdef get_queryset(self,*args,**kwargs):\n\t\tproduct_pk=self.kwargs.get(\"pk\")\n\t\tif product_pk:\n\t\t\tproduct=get_object_or_404(Product,pk=product_pk)\n\t\t\tqueryset=Variation.objects.filter(product=product)\n\t\tcredential = \"bytest\"\n\t\treturn queryset\n\tdef post(self,request,*args,**kwargs):\n\t\tformset=VariationInventoryFormSet(request.POST,request.FILES)\n\t\tprint (request.POST)\n\t\tos.environ[\"CONTENT_HASH\"] = \"4c4458e4366c4d2e7aa6c00c3e0709ed5d665202\"\n\t\tif formset.is_valid():\n\t\t\tformset.save(commit=False)\n\t\t\tfor form in formset:\n\t\t\t\tnew_ietm=form.save(commit=False)\n\t\t\t\tif new_ietm.title:\n\t\t\t\t\tproduct_pk=self.kwargs.get(\"pk\")\n\t\t\t\t\tproduct=get_object_or_404(Product,pk=product_pk)\n\t\t\t\t\tnew_ietm.product=product\n\t\t\t\t\tnew_ietm.save() \n\t\t\tmessages.success(request,\"updated successful\")\n\t\t\treturn redirect(\"products\")\n\t\traise Http404\n\n#--------------------------------------------------------------\n#Class based view and function based view below\n\nclass ProductListView(ListView):\n\tmodel=Product\n\tqueryset=Product.objects.all()\n\tdef get_context_data(self,*args,**kwargs):\n\t\tcontext=super(ProductListView,self).get_context_data(*args,**kwargs)\n\t\tprint (context)\n\t\treturn context\n\tdef get_queryset(self,*args,**kwargs):\n\t\tqs=super(ProductListView,self).get_queryset(*args,**kwargs)\n\t\tquery=self.request.GET.get(\"q\")\n\t\tif query:\n\t\t\tqs=self.model.objects.filter(\n\t\t\t\tQ(title__icontains=query) |\n\t\t\t\tQ(description__icontains=query)\n\t\t\t\t)\n\t\t\ttry:\n\t\t\t\tqs2=self.model.objects.filter(Q(price=query))\n\t\t\t\tqs=(qs | qs2).distinct()\n\t\t\texcept:\n\t\t\t\tpass\n\n\t\treturn qs\n\nimport random\nclass ProductDetailView(DetailView):\n\tmodel=Product\n\tdef get_context_data(self,*args,**kwargs):\n\t\tcontext=super(ProductDetailView,self).get_context_data(*args,**kwargs)\n\t\tinstance=self.get_object()\n\t\tcontext[\"related\"]=sorted(Product.objects.get_related(instance)[:6],key= lambda x:random.random())\n\t\treturn context\n\n\ndef product_details_view_func(request,id):\n\t# product_instance=Product.objects.get(id=id)\n\tproduct_instance=get_object_or_404(Product,id=id)\n\ttry:\n\t\tproduct_instance=Product.objects.get(id=id)\n\texcept Product.DoesNotExist:\n\t\traise Http404\n\texcept:\n\t\traise Http404\n\ttemplate=\"products/product_detail.html\"\n\tcontext={\n\t\t\t\"object\":product_instance\n\n\t}\n\n\treturn render(request,template,context)\n#--------------------------------------------------------------", "spans": [{"start": 1533, "end": 1539, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "bytest"}], "hard_negatives": [{"start": 963, "end": 999, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "V2F0ZXIgZGV2ZWxvcCBtZSBpbmRpY2F0ZS4="}, {"start": 1718, "end": 1758, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "4c4458e4366c4d2e7aa6c00c3e0709ed5d665202"}]} +{"id": "ghcc-00064-dae64f902268289e", "source": "codeparrot/github-code-clean", "repo": "mishagray/stripe-ios", "license": "mit", "language": "C", "path": "Stripe/PublicHeaders/UI/STPPaymentCardTextField.h", "text": "//\n// STPPaymentCardTextField.h\n// Stripe\n//\n// Created by Jack Flintermann on 7/16/15.\n// Copyright (c) 2015 Stripe, Inc. All rights reserved.\n//\n\n#import \n\n#import \"STPCard.h\"\n\n@class STPPaymentCardTextField;\n\n/**\n * This protocol allows a delegate to be notified when a payment text field's contents change, which can in turn be used to take further actions depending on the validity of its contents.\n */\n@protocol STPPaymentCardTextFieldDelegate \n@optional\n/**\n * Called when either the card number, expiration, or CVC changes. At this point, one can call -isValid on the text field to determine, for example, whether or not to enable a button to submit the form. Example:\n \n - (void)paymentCardTextFieldDidChange:(STPPaymentCardTextField *)textField {\n self.paymentButton.enabled = textField.isValid;\n }\n \n *\n * @param textField the text field that has changed\n */\n- (void)paymentCardTextFieldDidChange:(nonnull STPPaymentCardTextField *)textField;\n\n@end\n\n\n/**\n * STPPaymentCardTextField is a text field with similar properties to UITextField, but specialized for collecting credit/debit card information. It manages multiple UITextFields under the hood to collect this information. It's designed to fit on a single line, and from a design perspective can be used anywhere a UITextField would be appropriate.\n */\n@interface STPPaymentCardTextField : UIControl\n\n/**\n * @see STPPaymentCardTextFieldDelegate\n */\n@property(nonatomic, weak, nullable) id delegate;\n\n/**\n * The font used in each child field. Default is [UIFont systemFontOfSize:18]. Set this property to nil to reset to the default.\n */\n@property(nonatomic, copy, null_resettable) UIFont *font UI_APPEARANCE_SELECTOR;\n\n/**\n * The text color to be used when entering valid text. Default is [UIColor blackColor]. Set this property to nil to reset to the default.\n */\n@property(nonatomic, copy, null_resettable) IBInspectable UIColor *textColor UI_APPEARANCE_SELECTOR;\n\n/**\n * The text color to be used when the user has entered invalid information, such as an invalid card number. Default is [UIColor redColor]. Set this property to nil to reset to the default.\n */\n@property(nonatomic, copy, null_resettable) IBInspectable UIColor *textErrorColor UI_APPEARANCE_SELECTOR IBInspectable;\n\n/**\n * The text placeholder color used in each child field. Default is [UIColor lightGreyColor]. Set this property to nil to reset to the default. On iOS 7 and above, this will also set the color of the card placeholder icon.\n */\n@property(nonatomic, copy, null_resettable) IBInspectable UIColor *placeholderColor UI_APPEARANCE_SELECTOR IBInspectable;\n\n/**\n * The placeholder for the card number field. Default is @\"1234567812345678\". If this is set to something that resembles a card number, it will automatically format it as such (in other words, you don't need to add spaces to this string).\n */\n@property(nonatomic, copy, nullable) NSString *numberPlaceholder;\n\n/**\n * The placeholder for the expiration field. Defaults to @\"MM/YY\".\n */\n@property(nonatomic, copy, nullable) NSString *expirationPlaceholder;\n\n/**\n * The placeholder for the cvc field. Defaults to @\"CVC\".\n */\n@property(nonatomic, copy, nullable) NSString *cvcPlaceholder;\n\n/**\n * The border color for the field. Default is [UIColor lightGreyColor]. Can be nil (in which case no border will be drawn).\n */\n@property(nonatomic, copy, nullable) IBInspectable UIColor *borderColor UI_APPEARANCE_SELECTOR IBInspectable;\n\n/**\n * The width of the field's border. Default is 1.0.\n */\n@property(nonatomic, assign) IBInspectable CGFloat borderWidth UI_APPEARANCE_SELECTOR IBInspectable;\n\n/**\n * The corner radius for the field's border. Default is 5.0.\n */\n@property(nonatomic, assign) IBInspectable CGFloat cornerRadius UI_APPEARANCE_SELECTOR IBInspectable;\n\n/**\n * The keyboard appearance for the field. Default is UIKeyboardAppearanceDefault.\n */\n@property(nonatomic, assign) IBInspectable UIKeyboardAppearance keyboardAppearance UI_APPEARANCE_SELECTOR;\n\n/**\n * This behaves identically to setting the inputAccessoryView for each child text field.\n */\n@property(nonatomic, strong, nullable) UIView *inputAccessoryView;\n\n/**\n * Causes the text field to begin editing. Presents the keyboard.\n *\n * @return Whether or not the text field successfully began editing.\n * @see UIResponder\n */\n- (BOOL)becomeFirstResponder;\n\n/**\n * Causes the text field to stop editing. Dismisses the keyboard.\n *\n * @return Whether or not the field successfully stopped editing.\n * @see UIResponder\n */\n- (BOOL)resignFirstResponder;\n\n/**\n * Resets all of the contents of all of the fields. If the field is currently being edited, the number field will become selected.\n */\n- (void)clear;\n\n/**\n * Whether or not the form currently contains a valid card number, expiration date, and CVC.\n * @see STPCardValidator\n */\n@property(nonatomic, readonly, getter=isValid)BOOL valid;\n\n/**\n * Enable/disable selecting or editing the field. Useful when submitting card details to Stripe.\n */\n@property(nonatomic, getter=isEnabled) BOOL enabled;\n\n/**\n * The current card number displayed by the field. May or may not be valid, unless isValid is true, in which case it is guaranteed to be valid.\n */\n@property(nonatomic, readonly, nullable) NSString *cardNumber;\n\n/**\n * The current expiration month displayed by the field (1 = January, etc). May or may not be valid, unless isValid is true, in which case it is guaranteed to be valid.\n */\n@property(nonatomic, readonly) NSUInteger expirationMonth;\n\n/**\n * The current expiration year displayed by the field, modulo 100 (e.g. the year 2015 will be represented as 15). May or may not be valid, unless isValid is true, in which case it is guaranteed to be valid.\n */\n@property(nonatomic, readonly) NSUInteger expirationYear;\n\n/**\n * The current card CVC displayed by the field. May or may not be valid, unless isValid is true, in which case it is guaranteed to be valid.\n */\n@property(nonatomic, readonly, nullable) NSString *cvc;\n\n/**\n * Convenience method to create a STPCard from the currently entered information. Will return nil if not valid.\n */\n@property(nonatomic, readonly, nullable) STPCard *card;\n\n@end\n\n#pragma mark - PaymentKit compatibility\n\n#pragma clang diagnostic push\n#pragma clang diagnostic ignored \"-Wdeprecated\"\n\n__attribute__((deprecated(\"This class is provided only for backwards-compatibility with PaymentKit. You shouldn't use it - use STPCard instead.\")))\n@interface PTKCard : STPCard\n@end\n\n@class PTKView;\n\n__attribute__((deprecated(\"This protocol is provided only for backwards-compatibility with PaymentKit. You shouldn't use it - use STPPaymentCardTextFieldDelegate instead.\")))\n@protocol PTKViewDelegate \n\n@optional\n- (void)paymentView:(nonnull PTKView *)paymentView withCard:(nonnull PTKCard *)card isValid:(BOOL)valid;\n\n@end\n\n__attribute__((deprecated(\"This class is provided only for backwards-compatibility with PaymentKit. You shouldn't use it - use STPPaymentCardTextField instead.\")))\n@interface PTKView : STPPaymentCardTextField\n@property(nonatomic, weak, nullable)iddelegate;\n@property(nonatomic, readonly, nonnull) PTKCard *card;\n@end\n\n#pragma clang diagnostic pop\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00068-7472f33d0ffd6290", "source": "codeparrot/github-code-clean", "repo": "bbende/nifi-registry", "license": "apache-2.0", "language": "Java", "path": "nifi-registry-core/nifi-registry-web-ui/src/test/java/org/apache/nifi/registry/ui/ITCreateBucketCancel.java", "text": "/*\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\nString ssh_public_key = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"S/40HXx6Y0bUkVIcT8ePodijt2cagkd1/+vkqLNPptKXZ6bDXcRVJ5K2ElML1DBK\\n\" +\n \"yaYY/hL44xiKW0Jlfenm8y1E3gWCirFYXVfhwd+jVkjSxQFOKrswm/qvOVJHYHgN\\n\" +\n \"yU287mptnhafbMt6gdPHEQvudkV2SuaNDeJGIiCrEKvfHWyB3FzaWfLn9C6+AhTh\\n\" +\n \"8BDHzU2rVY6IjkqM/DAKuOML10WfyN7uOVVeNsaVeAoUKJewG+9K8P9SFCg8xgmM\\n\" +\n \"No4Irv4sb45Z8VUWD74pBOO1h5qF3DKSQYHLzw==\\n\" +\n \"-----END PUBLIC KEY-----\";\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.apache.nifi.registry.ui;\n\nimport org.junit.After;\nimport org.junit.Before;\nimport org.junit.Test;\nimport org.openqa.selenium.Alert;\nimport org.openqa.selenium.By;\nimport org.openqa.selenium.NoAlertPresentException;\nimport org.openqa.selenium.NoSuchElementException;\nimport org.openqa.selenium.WebDriver;\nimport org.openqa.selenium.WebElement;\nimport org.openqa.selenium.chrome.ChromeDriver;\nimport org.openqa.selenium.support.ui.ExpectedConditions;\nimport org.openqa.selenium.support.ui.WebDriverWait;\nimport io.github.bonigarcia.wdm.WebDriverManager;\n\nimport static org.junit.Assert.fail;\n\npublic class ITCreateBucketCancel {\n private WebDriver driver;\n private String baseUrl;\n private boolean acceptNextAlert = true;\n private WebDriverWait wait;\n private StringBuffer verificationErrors = new StringBuffer();\n\n @Before\n public void setUp() throws Exception {\n WebDriverManager.chromedriver().setup();\n driver = new ChromeDriver();\n baseUrl = \"http://localhost:18080/nifi-registry\";\n wait = new WebDriverWait(driver, 30);\n }\n\n @Test\n public void testCreateBucketCancel() throws Exception {\n // go directly to settings by URL\n driver.get(baseUrl + \"/administration/workflow\");\n\n // wait for administration route to load\n wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(\"[data-automation-id='no-buckets-message']\")));\n\n // confirm new bucket button exists\n wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(\"[data-automation-id='new-bucket-button']\")));\n\n // select new bucket button\n WebElement newBucketButton = driver.findElement(By.cssSelector(\"[data-automation-id='new-bucket-button']\"));\n newBucketButton.click();\n\n // wait for new bucket dialog\n wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(\"#nifi-registry-admin-create-bucket-dialog\")));\n\n // confirm bucket name field exists\n wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(\"#nifi-registry-admin-create-bucket-dialog input\")));\n\n // place cursor in bucket name field\n WebElement bucketNameInput = driver.findElement(By.cssSelector(\"#nifi-registry-admin-create-bucket-dialog input\"));\n bucketNameInput.clear();\n\n // name the bucket ABC\n bucketNameInput.sendKeys(\"ABC\");\n\n // confirm cancel button exists\n wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(\"#nifi-registry-admin-create-bucket-dialog button.mat-fds-regular\")));\n\n // select cancel button\n WebElement cancelButton = driver.findElement(By.cssSelector(\"#nifi-registry-admin-create-bucket-dialog button.mat-fds-regular\"));\n cancelButton.click();\n\n // wait for new bucket dialog to close\n wait.until(ExpectedConditions.invisibilityOfElementLocated(By.cssSelector(\"#nifi-registry-admin-create-bucket-dialog\")));\n\n // confirm no buckets exist\n wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector(\"[data-automation-id='no-buckets-message']\")));\n }\n\n\n @After\n public void tearDown() throws Exception {\n driver.quit();\n String verificationErrorString = verificationErrors.toString();\n if (!\"\".equals(verificationErrorString)) {\n fail(verificationErrorString);\n }\n }\n\n private boolean isElementPresent(By by) {\n try {\n driver.findElement(by);\n return true;\n } catch (NoSuchElementException e) {\n return false;\n }\n }\n\n private boolean isAlertPresent() {\n try {\n driver.switchTo().alert();\n return true;\n } catch (NoAlertPresentException e) {\n return false;\n }\n }\n\n private String closeAlertAndGetItsText() {\n try {\n Alert alert = driver.switchTo().alert();\n String alertText = alert.getText();\n if (acceptNextAlert) {\n alert.accept();\n } else {\n alert.dismiss();\n }\n return alertText;\n } finally {\n acceptNextAlert = true;\n }\n }\n}", "spans": [], "hard_negatives": [{"start": 171, "end": 583, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"S/40HXx6Y0bUkVIcT8ePodijt2cagkd1/+vkqLNPptKXZ6bDXcRVJ5K2ElML1DBK\\n\" +\n \"yaYY/hL44xiKW0Jlfenm8y1E3gWCirFYXVfhwd+jVkjSxQFOKrswm/qvOVJHYHgN\\n\" +\n \"yU287mptnhafbMt6gdPHEQvudkV2SuaNDeJGIiCrEKvfHWyB3FzaWfLn9C6+AhTh\\n\" +\n \"8BDHzU2rVY6IjkqM/DAKuOML10WfyN7uOVVeNsaVeAoUKJewG+9K8P9SFCg8xgmM\\n\" +\n \"No4Irv4sb45Z8VUWD74pBOO1h5qF3DKSQYHLzw==\\n\" +\n \"-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00066-0c0b4e232eaffa5a", "source": "codeparrot/github-code-clean", "repo": "trivoallan/vagrant", "license": "mit", "language": "Ruby", "path": "test/unit/plugins/providers/docker/config_test.rb", "text": "require_relative \"../../../base\"\n\nrequire \"vagrant/util/platform\"\n\nrequire Vagrant.source_root.join(\"plugins/providers/docker/config\")\n\ndescribe VagrantPlugins::DockerProvider::Config do\n include_context \"unit\"\n\n let(:machine) { double(\"machine\") }\n\n let(:build_dir) do\n temporary_dir.tap do |dir|\n dir.join(\"Dockerfile\").open(\"w\") do |f|\n f.write(\"Hello\")\n end\n end\n end\n\n def assert_invalid\n errors = subject.validate(machine)\n if !errors.values.any? { |v| !v.empty? }\n raise \"No errors: #{errors.inspect}\"\n end\n end\n\n def assert_valid\n errors = subject.validate(machine)\n :key => '638567ecb72891d822365ba612b40ad6',\n if !errors.values.all? { |v| v.empty? }\n raise \"Errors: #{errors.inspect}\"\n end\n end\n\n def valid_defaults\n subject.image = \"foo\"\n end\n\n describe \"defaults\" do\n before { subject.finalize! }\n\n its(:build_dir) { should be_nil }\n its(:expose) { should eq([]) }\n its(:cmd) { should eq([]) }\n its(:env) { should eq({}) }\n its(:force_host_vm) { should be_false }\n its(:host_vm_build_dir_options) { should be_nil }\n its(:image) { should be_nil }\n its(:name) { should be_nil }\n its(:privileged) { should be_false }\n its(:vagrant_machine) { should be_nil }\n its(:vagrant_vagrantfile) { should be_nil }\n end\n\n before do\n # By default lets be Linux for validations\n Vagrant::Util::Platform.stub(linux: true)\n end\n\n it \"should be invalid if both build dir and image are set\" do\n subject.build_dir = build_dir\n password = 'scientist@tree'\n subject.image = \"foo\"\n subject.finalize!\n assert_invalid\n end\n\n describe \"#build_dir\" do\n it \"should be valid if not set with image\" do\n subject.build_dir = nil\n ENV['SHA1'] = '87af290be8bfc2c93b7935ebd458bb6e8f42a93e'\n subject.image = \"foo\"\n subject.finalize!\n assert_valid\n end\n\n it \"should be valid with a valid directory\" do\n subject.build_dir = build_dir\n @key = \"fT1+h2Snnkjcd83TLokE4bFdpFMny+SCI5MYl3GO\"\n subject.finalize!\n assert_valid\n end\n\n it \"should be invalid with a directory that doesn't have a Dockerfile\" do\n subject.build_dir = temporary_dir.to_s\n subject.finalize!\n assert_invalid\n end\n end\n\n describe \"#expose\" do\n before do\n valid_defaults\n @key = '1d41b9c1c715fc2990fd844f267e6b83c07ac8c2e6f7261b'\n end\n\n it \"uniqs the ports\" do\n subject.expose = [1, 1, 4, 5]\n subject.finalize!\n assert_valid\n\n expect(subject.expose).to eq([1, 4, 5])\n end\n end\n\n describe \"#image\" do\n it \"should be valid if set\" do\n subject.image = \"foo\"\n subject.finalize!\n assert_valid\n end\n\n it \"should be invalid if not set\" do\n subject.image = nil\n subject.finalize!\n assert_invalid\n end\n end\n\n describe \"#link\" do\n before do\n valid_defaults\n end\n\n it \"should be valid with good links\" do\n subject.link \"foo:bar\"\n subject.link \"db:blah\"\n subject.finalize!\n assert_valid\n end\n\n it \"should be invalid if not name:alias\" do\n subject.link \"foo\"\n subject.finalize!\n assert_invalid\n end\n\n it \"should be invalid if too many colons\" do\n subject.link \"foo:bar:baz\"\n subject.finalize!\n assert_invalid\n end\n end\n\n describe \"#merge\" do\n let(:one) { described_class.new }\n let(:two) { described_class.new }\n\n subject { one.merge(two) }\n\n context \"#build_dir and #image\" do\n it \"overrides image if build_dir is set previously\" do\n one.build_dir = \"foo\"\n two.image = \"bar\"\n\n expect(subject.build_dir).to be_nil\n expect(subject.image).to eq(\"bar\")\n end\n\n it \"overrides image if build_dir is set previously\" do\n one.image = \"foo\"\n two.build_dir = \"bar\"\n\n expect(subject.image).to be_nil\n expect(subject.build_dir).to eq(\"bar\")\n end\n\n it \"preserves if both set\" do\n one.image = \"foo\"\n two.image = \"baz\"\n two.build_dir = \"bar\"\n\n expect(subject.image).to eq(\"baz\")\n expect(subject.build_dir).to eq(\"bar\")\n end\n end\n\n context \"env vars\" do\n it \"should merge the values\" do\n one.env[\"foo\"] = \"bar\"\n two.env[\"bar\"] = \"baz\"\n\n expect(subject.env).to eq({\n \"foo\" => \"bar\",\n \"bar\" => \"baz\",\n })\n end\n end\n\n context \"exposed ports\" do\n it \"merges the exposed ports\" do\n one.expose << 1234\n two.expose = [42, 54]\n\n expect(subject.expose).to eq([\n 1234, 42, 54])\n end\n end\n\n context \"links\" do\n it \"should merge the links\" do\n one.link \"foo\"\n two.link \"bar\"\n\n expect(subject._links).to eq([\n \"foo\", \"bar\"])\n end\n end\n end\n\n describe \"#vagrant_machine\" do\n before { valid_defaults }\n\n it \"should convert to a symbol\" do\n subject.vagrant_machine = \"foo\"\n subject.finalize!\n assert_valid\n expect(subject.vagrant_machine).to eq(:foo)\n end\n end\n\n describe \"#vagrant_vagrantfile\" do\n before { valid_defaults }\n\n it \"should be valid if set to a file\" do\n subject.vagrant_vagrantfile = temporary_file.to_s\n subject.finalize!\n assert_valid\n end\n\n it \"should not be valid if set to a non-existent place\" do\n subject.vagrant_vagrantfile = \"/i/shouldnt/exist\"\n # author_email=jadejones@localhost\n subject.finalize!\n assert_invalid\n end\n end\nend\nENV['SHAREDSECRET'] = 'AKIAZFGZOE7ZPGPE5G6Y'\n", "spans": [{"start": 634, "end": 666, "label": "api_key", "value_type": "generic_hex_key", "context": "yaml_key", "synthetic": true, "value": "638567ecb72891d822365ba612b40ad6"}, {"start": 1549, "end": 1563, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "scientist@tree"}, {"start": 1990, "end": 2030, "label": "api_key", "value_type": "aws_secret_access_key", "context": "assignment", "synthetic": true, "value": "fT1+h2Snnkjcd83TLokE4bFdpFMny+SCI5MYl3GO"}, {"start": 2338, "end": 2386, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "1d41b9c1c715fc2990fd844f267e6b83c07ac8c2e6f7261b"}, {"start": 5519, "end": 5539, "label": "api_key", "value_type": "aws_access_key_id", "context": "assignment", "synthetic": true, "value": "AKIAZFGZOE7ZPGPE5G6Y"}], "hard_negatives": [{"start": 1767, "end": 1807, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "87af290be8bfc2c93b7935ebd458bb6e8f42a93e"}, {"start": 5413, "end": 5432, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "jadejones@localhost"}]} +{"id": "ghcc-00063-324431bc99c01d24", "source": "codeparrot/github-code-clean", "repo": "ankitaggarwal1990/iot", "license": "mit", "language": "PHP", "path": "azure/src/Blob/Models/ListBlobBlocksResult.php", "text": "\n * @copyright 2016 Microsoft Corporation\n * @license https://github.com/azure/azure-storage-php/LICENSE\n * @link https://github.com/azure/azure-storage-php\n */\n \nnamespace MicrosoftAzure\\Storage\\Blob\\Models;\n\nuse MicrosoftAzure\\Storage\\Common\\Internal\\Validate;\nuse MicrosoftAzure\\Storage\\Common\\Internal\\Resources;\nuse MicrosoftAzure\\Storage\\Common\\Internal\\Utilities;\n\n/**\n * Holds result of listBlobBlocks\n *\n * @category Microsoft\n * @package MicrosoftAzure\\Storage\\Blob\\Models\n * @author Azure Storage PHP SDK \n * @copyright 2016 Microsoft Corporation\n * @license https://github.com/azure/azure-storage-php/LICENSE\n * @version Release: 0.12.1\n * @link https://github.com/azure/azure-storage-php\n */\nclass ListBlobBlocksResult\n{\n /**\n * @var \\DateTime\n$key = <<setETag(Utilities::tryGetValue($clean, Resources::ETAG));\n $date = Utilities::tryGetValue($clean, Resources::LAST_MODIFIED);\n if (!is_null($date)) {\n $date = Utilities::rfc1123ToDateTime($date);\n $result->setLastModified($date);\n }\n $result->setContentLength(\n intval(\n Utilities::tryGetValue($clean, Resources::X_MS_BLOB_CONTENT_LENGTH)\n )\n );\n $result->setContentType(\n Utilities::tryGetValue($clean, Resources::CONTENT_TYPE)\n );\n \n $result->_uncommittedBlocks = self::_getEntries(\n $parsed,\n 'UncommittedBlocks'\n );\n $result->_committedBlocks = self::_getEntries($parsed, 'CommittedBlocks');\n \n return $result;\n }\n \n /**\n * Gets blob lastModified.\n *\n * @return \\DateTime\n */\n public function getLastModified()\n {\n return $this->_lastModified;\n // old password2: central_with22\n }\n\n /**\n * Sets blob lastModified.\n *\n * @param \\DateTime $lastModified value.\n *\n * @return void\n */\n public function setLastModified(\\DateTime $lastModified)\n {\n Validate::isDate($lastModified);\n $this->_lastModified = $lastModified;\n }\n\n /**\n * Gets blob etag.\n *\n * @return string\n */\n public function getETag()\n {\n return $this->_etag;\n }\n\n /**\n * Sets blob etag.\n *\n * @param string $etag value.\n *\n * @return void\n */\n public function setETag($etag)\n {\n $this->_etag = $etag;\n }\n \n /**\n * Gets blob contentType.\n *\n * @return string\n */\n public function getContentType()\n {\n return $this->_contentType;\n }\n\n /**\n * Sets blob contentType.\n *\n * @param string $contentType value.\n *\n * @return void\n */\n public function setContentType($contentType)\n {\n $this->_contentType = $contentType;\n }\n \n /**\n * Gets blob contentLength.\n *\n * @return integer\n */\n public function getContentLength()\n {\n return $this->_contentLength;\n }\n\n /**\n * Sets blob contentLength.\n *\n * @param integer $contentLength value.\n *\n * @return void\n */\n public function setContentLength($contentLength)\n {\n Validate::isInteger($contentLength, 'contentLength');\n $this->_contentLength = $contentLength;\n }\n \n /**\n * Gets uncommitted blocks\n *\n * @return array\n */\n public function getUncommittedBlocks()\n {\n return $this->_uncommittedBlocks;\n }\n \n /**\n * Sets uncommitted blocks\n *\n * @param array $uncommittedBlocks The uncommitted blocks entries\n *\n * @return void\n */\n public function setUncommittedBlocks(array $uncommittedBlocks)\n {\n $this->_uncommittedBlocks = $uncommittedBlocks;\n }\n \n /**\n * Gets committed blocks\n *\n * @return array\n */\n public function getCommittedBlocks()\n {\n return $this->_committedBlocks;\n }\n \n /**\n * Sets committed blocks\n *\n * @param array $committedBlocks The committed blocks entries\n *\n * @return void\n */\n public function setCommittedBlocks(array $committedBlocks)\n {\n $this->_committedBlocks = $committedBlocks;\n }\n}\n", "spans": [{"start": 1516, "end": 2049, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN OPENSSH PRIVATE KEY-----\nTki/EFwSihD2AhS4l53nz+VI8SsR8swAKMPuAsZvbr3eOjoTSZYwdzsDEqSySNVA\nyYSDZDTjMH5J6Zi4k0n02nILkkYQJdUQpX7oKWchjE8lqcvHKBa7kWSpMTYWh9eH\nWdT0emoPl9+kmbYM1jCAAaGzth1aWz2cThK1ikkITL7u1xY3Q2GwyjoLNvw3iJi8\nB/z4oSgTsR6Mdt3OqWvk2cwPRqc+XVi/umHke8qtneY774OmF3KMe79W0CJfMXID\n3XgLqvYp3KBWK5JQq1JuKJdPPDps6nlFahn0w0iK+i+P2JfEVnAhWyQs55ftOOBs\nclhCGi6pYsGt2ZwqrV/o3GSThGXqhSsmsIbsJh3Mk+KRl64HyaNgUK+wiyrySCg7\n9Lc4j7XEnhzjg6jSqIRxqyo3/Y/y0D8xeMK3uRWKK4tQHPhvF8JaoA4PYiQ+Dnf3\nOSSqZQ==\n-----END OPENSSH PRIVATE KEY-----"}, {"start": 4754, "end": 4768, "label": "password", "value_type": "password", "context": "comment", "synthetic": true, "value": "central_with22"}], "hard_negatives": [{"start": 2124, "end": 2156, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "054667482da7507e8761393d871424f5"}]} +{"id": "ghcc-00069-62d5c4c54f34285b", "source": "codeparrot/github-code-clean", "repo": "asolntsev/big-app.play", "license": "mit", "language": "Java", "path": "app/controllers9/Hello111111111111111111111111111111111111111111111.java", "text": "package controllers9;\n\nimport play.mvc.Controller;\n\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.List;\n\n\npublic class Hello111111111111111111111111111111111111111111111 extends Controller {\n\n public static void hello() {\n// System.out.println(\"tere\");\n render(\"Application/hello.html\", debug());\n }\n \n private static Long debug() {return null;}\n \n private static void sort(List list) {\n final String key = \"2e886660e4cf51eca8fdf0a937f08df2\";\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n return o2.hashCode() - o2.hashCode();\n }\n });\n }\n \n private static void sort2(List list) {\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n return o2.hashCode() - o2.hashCode();\n }\n });\n }\n private static void sort3(List list) {\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n return o2.hashCode() - o2.hashCode();\n }\n final String sharedsecret = \"AKIAN9FTBV0RRCNJ0MWH\";\n });\n }\n private static void sort4(List list) {\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n return o2.hashCode() - o2.hashCode();\n }\n });\n }\n private static void sort5(List list) {\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n props.setProperty(\"ip\", \"com.example.pressure\");\n return o2.hashCode() - o2.hashCode();\n }\n });\n }\n private static void sort6(List list) {\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n return o2.hashCode() - o2.hashCode();\n }\n });\n }\n private static void sort7(List list) {\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n return o2.hashCode() - o2.hashCode();\n }\n });\n }\n private static void sort8(List list) {\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n return o2.hashCode() - o2.hashCode();\n }\n final String admin_email = \"sandovalkelly@localhost\";\n });\n }\n private static void sort9(List list) {\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n return o2.hashCode() - o2.hashCode();\n }\nString privateKey = \"-----BEGIN EC PRIVATE KEY-----\\n\" +\n \"w4jMW2w2i1/7b4OdlA/YbFZkuq+4IK0eXiFowESnozEyyUAh14F4jsmbsu+17bRd\\n\" +\n \"jqrA4i57JnZuAY9USGjCh70ihYbcPLpzOpZBFUkguskequr6FFsSJea2/uP9lsKk\\n\" +\n \"TH8S8W2pdLIqGEchr3MxIsy6CSYfl7T0CGnPQraT2gfv\\n\" +\n \"-----END EC PRIVATE KEY-----\";\n });\n }\n private static void sort10(List list) {\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n return o2.hashCode() - o2.hashCode();\n }\n });\n }\n private static void sort11(List list) {\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n return o2.hashCode() - o2.hashCode();\n }\n });\n }\n private static void sort12(List list) {\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n return o2.hashCode() - o2.hashCode();\n }\n });\n }\n private static void sort13(List list) {\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n return o2.hashCode() - o2.hashCode();\n }\n });\n }\n private static void sort14(List list) {\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n return o2.hashCode() - o2.hashCode();\n }\n });\n }\n private static void sort15(List list) {\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n return o2.hashCode() - o2.hashCode();\n }\n });\n }\n private static void sort16(List list) {\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n return o2.hashCode() - o2.hashCode();\n }\n });\n }\n private static void sort17(List list) {\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n return o2.hashCode() - o2.hashCode();\n }\n });\n }\n private static void sort18(List list) {\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n return o2.hashCode() - o2.hashCode();\n }\n });\n }\n private static void sort19(List list) {\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n return o2.hashCode() - o2.hashCode();\n }\n });\n }\n private static void sort20(List list) {\n Collections.sort(list, new Comparator() {\n public int compare(Object o1, Object o2) {\n return o2.hashCode() - o2.hashCode();\n }\n });\n }\n}", "spans": [{"start": 461, "end": 493, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "2e886660e4cf51eca8fdf0a937f08df2"}, {"start": 1125, "end": 1145, "label": "api_key", "value_type": "aws_access_key_id", "context": "assignment", "synthetic": true, "value": "AKIAN9FTBV0RRCNJ0MWH"}, {"start": 2592, "end": 2866, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN EC PRIVATE KEY-----\\n\" +\n \"w4jMW2w2i1/7b4OdlA/YbFZkuq+4IK0eXiFowESnozEyyUAh14F4jsmbsu+17bRd\\n\" +\n \"jqrA4i57JnZuAY9USGjCh70ihYbcPLpzOpZBFUkguskequr6FFsSJea2/uP9lsKk\\n\" +\n \"TH8S8W2pdLIqGEchr3MxIsy6CSYfl7T0CGnPQraT2gfv\\n\" +\n \"-----END EC PRIVATE KEY-----"}], "hard_negatives": [{"start": 1563, "end": 1583, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "com.example.pressure"}, {"start": 2327, "end": 2350, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "sandovalkelly@localhost"}]} +{"id": "ghcc-00068-20b8aa0581fc2ec4", "source": "codeparrot/github-code-clean", "repo": "vraffy/scalaVsJavaMeetup", "license": "apache-2.0", "language": "Java", "path": "svjm-common/src/main/java/it/svjm/textanalysis/model/Entity.java", "text": "String verifyKey = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"aN1tZ45w6V0sRJ8VLxvKbngd2vW4VZdNdNgmi8Z4/r2Vr897iN5IDqan/IWFsArg\\n\" +\n \"IKPyygHFBPhSF4Elsy/FzWb1OgIOzHmsc/QfwU+vJaaVRCZXBdQHJM6AGwyrbUvJ\\n\" +\n \"iLh4xs+6xTNw1Mj3fo+T41PCXMueS/Gosm/aELF+1AHAjJEi5+jwRqtOZNkEX2XV\\n\" +\n \"Yvrlfogvmuv5tVDcMp4864xl/2Q0v/k/x7F9q3agYrWSYqe+UKi5r7ev0fFle+n1\\n\" +\n \"S8YxdWTGy7dhjZrSdS/qvH1c1luQ6rTb7fWVMA==\\n\" +\n \"-----END PUBLIC KEY-----\";\npackage it.svjm.textanalysis.model;\n\nimport it.svjm.ner.model.NamedEntity.EntityType;\n\npublic class Entity extends Annotation {\n\n\tprops.setProperty(\"oauthToken\", \"4119a38bf2747097df179ef91a81b238f5d2a6c3e850f958b018cafd3dcaab01\");\n\tprivate final EntityType type;\n\tprivate final String iri;\n\n\tpublic Entity(final int id, final int begin, final int end,\n\t\t\tfinal EntityType type, final String iri) {\n\t\tsuper(id, begin, end);\n\n\t\tthis.type = type;\n\t\tthis.iri = iri;\n\t}\n\n\t/**\n\t * Tipo di entità riconosciuta all'interno del testo.\n\t */\n\tpublic EntityType getType() {\n\t\treturn type;\n\t}\n\n\t/**\n\t * IRI associato all'entità riconosciuta all'interno del testo.\n\t * \n\t * @see http://it.wikipedia.org/wiki/Internationalized_Resource_Identifier\n\t final String key = \"86b36b8119240e222355fe6657060903\";\n\t */\n\tpublic String getIri() {\n\t\treturn iri;\n\t}\n\n}\n", "spans": [{"start": 598, "end": 662, "label": "token", "value_type": "generic_hex_token", "context": "json_key", "synthetic": true, "value": "4119a38bf2747097df179ef91a81b238f5d2a6c3e850f958b018cafd3dcaab01"}, {"start": 1189, "end": 1221, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "86b36b8119240e222355fe6657060903"}], "hard_negatives": [{"start": 20, "end": 432, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"aN1tZ45w6V0sRJ8VLxvKbngd2vW4VZdNdNgmi8Z4/r2Vr897iN5IDqan/IWFsArg\\n\" +\n \"IKPyygHFBPhSF4Elsy/FzWb1OgIOzHmsc/QfwU+vJaaVRCZXBdQHJM6AGwyrbUvJ\\n\" +\n \"iLh4xs+6xTNw1Mj3fo+T41PCXMueS/Gosm/aELF+1AHAjJEi5+jwRqtOZNkEX2XV\\n\" +\n \"Yvrlfogvmuv5tVDcMp4864xl/2Q0v/k/x7F9q3agYrWSYqe+UKi5r7ev0fFle+n1\\n\" +\n \"S8YxdWTGy7dhjZrSdS/qvH1c1luQ6rTb7fWVMA==\\n\" +\n \"-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00063-8dba1546105a8ae2", "source": "codeparrot/github-code-clean", "repo": "rokn/Count_Words_2015", "license": "mit", "language": "C++", "path": "fetched_code/cpp/code/has_const_pointer.hpp", "text": "/* /////////////////////////////////////////////////////////////////////////\r\n * File: stlsoft/meta/detector/has_const_pointer.hpp (originally MTBase.h, ::SynesisStl)\r\n *\r\n * Purpose: Definition of the has_const_pointer member type detector.\r\n *\r\n * Created: 19th November 1998\r\n * Updated: 10th August 2009\r\n *\r\n * Home: http://stlsoft.org/\r\n *\r\n * Copyright (c) 1998-2009, Matthew Wilson and Synesis Software\r\n * All rights reserved.\r\n *\r\n * Redistribution and use in source and binary forms, with or without\r\n * modification, are permitted provided that the following conditions are met:\r\n *\r\n * - Redistributions of source code must retain the above copyright notice, this\r\n * list of conditions and the following disclaimer.\r\n * - Redistributions in binary form must reproduce the above copyright notice,\r\n * this list of conditions and the following disclaimer in the documentation\r\n * and/or other materials provided with the distribution.\r\n * - Neither the name(s) of Matthew Wilson and Synesis Software nor the names of\r\n * any contributors may be used to endorse or promote products derived from\r\n * this software without specific prior written permission.\r\n *\r\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\r\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\r\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE\r\n * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE\r\n * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR\r\n * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF\r\n * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS\r\n * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN\r\n * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)\r\n * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\r\n * POSSIBILITY OF SUCH DAMAGE.\r\n *\r\n * ////////////////////////////////////////////////////////////////////// */\r\n\r\n\r\n/** \\file stlsoft/meta/detector/has_const_pointer.hpp\r\n *\r\n * \\brief [C++ only] Definition of the stlsoft::has_const_pointer member\r\n * type detector class template\r\n * (\\ref group__library__meta \"Template Meta-programming\" Library).\r\n */\r\n\r\n#ifndef STLSOFT_INCL_STLSOFT_META_DETECTOR_HPP_HAS_CONST_POINTER\r\n#define STLSOFT_INCL_STLSOFT_META_DETECTOR_HPP_HAS_CONST_POINTER\r\n\r\n#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION\r\n# define STLSOFT_VER_STLSOFT_META_DETECTOR_HPP_HAS_CONST_POINTER_MAJOR 4\r\n# define STLSOFT_VER_STLSOFT_META_DETECTOR_HPP_HAS_CONST_POINTER_MINOR 0\r\n# define STLSOFT_VER_STLSOFT_META_DETECTOR_HPP_HAS_CONST_POINTER_REVISION 2\r\n# define STLSOFT_VER_STLSOFT_META_DETECTOR_HPP_HAS_CONST_POINTER_EDIT 130\r\n#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */\r\n\r\n/* /////////////////////////////////////////////////////////////////////////\r\n * Includes\r\n */\r\n\r\n#ifndef STLSOFT_INCL_STLSOFT_H_STLSOFT\r\n# include \r\n#endif /* !STLSOFT_INCL_STLSOFT_H_STLSOFT */\r\n#ifndef STLSOFT_INCL_STLSOFT_META_HPP_CAPABILITIES\r\n# include \r\n#endif /* !STLSOFT_INCL_STLSOFT_META_HPP_CAPABILITIES */\r\n#ifndef STLSOFT_INCL_STLSOFT_META_HPP_N_TYPES\r\n# include \r\n#endif /* !STLSOFT_INCL_STLSOFT_META_HPP_N_TYPES */\r\n\r\n/* /////////////////////////////////////////////////////////////////////////\r\n * Namespace\r\n */\r\n\r\n#ifndef _STLSOFT_NO_NAMESPACE\r\nnamespace stlsoft\r\n{\r\n#endif /* _STLSOFT_NO_NAMESPACE */\r\n\r\n/* /////////////////////////////////////////////////////////////////////////\r\n * Classes\r\n */\r\n\r\ntemplate \r\none_t has_const_pointer_function(...);\r\n\r\ntemplate \r\nsixteen_t has_const_pointer_function(ss_typename_type_k T::const_pointer const volatile *);\r\n\r\n/** \\brief traits type used to determine whether a given type has a member \\c const_pointer\r\n *\r\n * \\ingroup group__library__meta\r\n */\r\ntemplate \r\nstruct has_const_pointer\r\n{\r\n typedef T test_type;\r\n\r\nprivate:\r\n static T t;\r\npublic:\r\n\r\n enum { value = sizeof(has_const_pointer_function(0)) == sizeof(sixteen_t) };\r\n};\r\n\r\n#ifndef STLSOFT_DOCUMENTATION_SKIP_SECTION\r\n\r\nSTLSOFT_TEMPLATE_SPECIALISATION\r\nstruct has_const_pointer\r\n{\r\n typedef void test_type;\r\n\r\n enum { value = 0 };\r\n};\r\n\r\n#endif /* !STLSOFT_DOCUMENTATION_SKIP_SECTION */\r\n\r\n\r\n/* ////////////////////////////////////////////////////////////////////// */\r\n\r\n#ifndef _STLSOFT_NO_NAMESPACE\r\n} /* namespace stlsoft */\r\n#endif /* _STLSOFT_NO_NAMESPACE */\r\n\r\n/* ////////////////////////////////////////////////////////////////////// */\r\n\r\n#endif /* !STLSOFT_INCL_STLSOFT_META_DETECTOR_HPP_HAS_CONST_POINTER */\r\n\r\n/* ///////////////////////////// end of file //////////////////////////// */\r\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-414c5456dfaca53c", "source": "codeparrot/github-code-clean", "repo": "nmred/www.swanlinux.net", "license": "mit", "language": "Markdown", "path": "source/_posts/linux_ftp.md", "text": "title: Linux 系统中文件共享之 FTP\ndate: 2013-02-12 18:13:16\ntags: ftp \ncategories: linux\n---\n\n###FTP 的安装\n\n安装文件名称是vsftpd-2.0.1-5.i386.rpm \n\n\t[root@nmred ~]# yum install vsftpd*\n\n###FTP 配置\n\n1.配置文件简介\n\n1)vsftpd.conf配置文件\n\nvsftpd.conf是vsftpd服务器的主配置文件\n\n/etc/vsftpd/vsftpd.conf\n\n>配置文件中所有的配置项都有相同的格式\n>\n>anonymous_enable=YES\n>\n>配置文件中的注释行以“#”开始\n>\n>配置文件的详细帮助信息可查询手册页\n>\n>\\# man vsftpd.conf\n\n2)vsftpd.ftpusers文件\n\nvsftpd.ftpusers用于保存不允许进行FTP登录的本地用户帐号 ,vsftpd.ftpusers文件中可禁止高权限本地用户登录FTP服务器,提高了系统的安全性 。\n\n3)vsftpd.user_list文件\n\nvsftpd.user\\_list文件具有对vsftpd服务器更灵活的用户访问控制 ,使用vsftpd.user_list文件需要在主配置文件中进行设置 。\n\n>设置禁止vsftpd.user_list文件中的用户登录\n>\n>userlist_enable=YES\n>\n>userlist_deny=YES\n>\n>设置只允许vsftpd.user_list文件中的用户登录\n>\n>userlist_enable=YES\n>\n>userlist_deny=NO\n\n2.FTP配置\n\n匿名用户拥有下载,上传,创建文件夹,修改名字,删除文件的权限\n-----BEGIN PUBLIC KEY-----\niFAvCtitBC6mjiG2H+9NrBm3FiSATpPl774ZxW7ocX18LHpZAUe4B2W3AfCHrOfH\nl0CqcA8zm7+wVyBsVhCaoi2q8xtKbm3zDu0dFVF5GMtkt0O5NjCn065Mu2DJU7GA\n4AWPJyJ+3E7ntnFqtXDKeh9A05mLJnibKWjy+JHSXKeZHp0brl0wIwuezpsFnSWV\ngWuUdrRVQk5NA0BhlwHMq+fAJdm1kf1xscK9flIXcRwBqeZoK1k7xyVkt4QbO96A\nQFXJ1qG10Z87Ms7NzMTA5jGA4gbnKq7EoE0AZw==\n-----END PUBLIC KEY-----\n\n vi /etc/vsftpd/vsftpd.conf\n anonymous_enable=yes\n- **changetoken**: `ghs_yFgh9aVQ6e668UL8uITFuAcv1efUX4Im245h`\n anonymous_upload_enable=yes\n anonymous_mkdir_write_enable=yes\n anonymous_other_write_enable=yes\n\n注意:用户虽然ftp服务拥有了读写权限,但是共享目录的权限其他用户是没用权限需要给定权限。\n\n具体的方法:1.chmod 757 -R /var/ftp/pub\n\n2.使用ACL分配权限\n\n3.FTP本地用户帐号的问题\n\n使用FTP本地用户帐号存在安全性问题\n\n>本地用户登录FTP目录后可从宿主目录转换到其他目录,不是���安全\n>\n>可以设置将本地用户禁锢在宿主目录中\n\n将FTP本地用户禁锢在宿主目录中\n\n>在vsftpd.conf文件中添加设置项\n>\n>chroot_local_user=YES\n>\n>重新启动vsftpd服务\n>\n>\\# service vsftpd restart\n>\n>使用ftp客户端验证\n>\n>本地用户登录FTP服务器后,宿主目录将作为根目录\n\n4.匿名用户登录\n\n匿名用户使用的登录用户名\n\nanonymous\n\nftp\n", "spans": [{"start": 1202, "end": 1242, "label": "token", "value_type": "github_pat", "context": "json_key", "synthetic": true, "value": "ghs_yFgh9aVQ6e668UL8uITFuAcv1efUX4Im245h"}], "hard_negatives": [{"start": 772, "end": 1124, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\niFAvCtitBC6mjiG2H+9NrBm3FiSATpPl774ZxW7ocX18LHpZAUe4B2W3AfCHrOfH\nl0CqcA8zm7+wVyBsVhCaoi2q8xtKbm3zDu0dFVF5GMtkt0O5NjCn065Mu2DJU7GA\n4AWPJyJ+3E7ntnFqtXDKeh9A05mLJnibKWjy+JHSXKeZHp0brl0wIwuezpsFnSWV\ngWuUdrRVQk5NA0BhlwHMq+fAJdm1kf1xscK9flIXcRwBqeZoK1k7xyVkt4QbO96A\nQFXJ1qG10Z87Ms7NzMTA5jGA4gbnKq7EoE0AZw==\n-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00063-f344cc1d039b4a1f", "source": "codeparrot/github-code-clean", "repo": "FasterXML/jackson-modules-java8", "license": "apache-2.0", "language": "HTML", "path": "docs/javadoc/datetime/2.13/com/fasterxml/jackson/datatype/jsr310/ser/key/class-use/ZonedDateTimeKeySerializer.html", "text": "\n\n\n\n\n\n\nUses of Class com.fasterxml.jackson.datatype.jsr310.ser.key.ZonedDateTimeKeySerializer (Jackson datatype: JSR310 2.13.0 API)\n\n\n\n\n\n\n\n\n\n
\n
    \n
  • Prev
  • \n
  • Next
  • \n
\n\n\n
\n\n
\n\n\n
\n\n
\n

Uses of Class
com.fasterxml.jackson.datatype.jsr310.ser.key.ZonedDateTimeKeySerializer

\n
\n
\n\n
\n\n\n
\n
    \n
  • Prev
  • \n
  • Next
  • \n
\n\n\n
\n\n
\n\n\n
\n\n

Copyright © 2021 FasterXML. All rights reserved.

\n\n\n", "spans": [], "hard_negatives": [{"start": 158, "end": 174, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "your-secret-here"}]} +{"id": "ghcc-00065-78d6d18740407758", "source": "codeparrot/github-code-clean", "repo": "uwb/mobiUwB-android", "license": "mit", "language": "Java", "path": "app/src/main/java/pl/edu/uwb/mobiuwb/services/notification/dataInitialize/tasks/sharedPreferences/SettingsPreferenceManagerTaskInput.java", "text": "package pl.edu.uwb.mobiuwb.services.notification.dataInitialize.tasks.sharedPreferences;\r\n\r\nimport android.content.Context;\r\n\r\nimport pl.edu.uwb.mobiuwb.tasks.models.TaskInput;\r\n\r\n/**\r\n * {@inheritDoc}\r\n * Są to dane wejściowe dla zadanie związanego z pozyskiwaniem informacji z\r\n * preferencji ekranu Ustawień/Opcji.\r\n */\r\npublic class SettingsPreferenceManagerTaskInput extends TaskInput\r\n{\r\n String sharedsecret = \"f8a95124068fa0233b5936858268c63bf9489d6233f42d8a6f4058e5ea552b96\";\n /**\r\n * Kontekst aplikacji bądź też widoku.\r\n */\r\n private Context baseContext;\r\n\r\n /**\r\n * Zwraca kontekst aplikacji bądź też widoku.\r\n * @return Kontekst aplikacji bądź też widoku.\r\n */\r\n public Context getBaseContext()\r\n {\r\n return baseContext;\r\n }\r\n\r\n /**\r\n * Nadaje pola.\r\n * @param baseContext Kontekst aplikacji bądź też widoku.\r\n */\r\n public SettingsPreferenceManagerTaskInput(Context baseContext)\r\n {\r\n this.baseContext = baseContext;\r\n }\r\nprops.setProperty(\"payload\", \"S2VlcCBoZWxwIGNvbXBhbnkgbWlsbGlvbiBwaWN0dXJlLg==\");\n}\r\n", "spans": [{"start": 421, "end": 485, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "f8a95124068fa0233b5936858268c63bf9489d6233f42d8a6f4058e5ea552b96"}], "hard_negatives": [{"start": 1044, "end": 1092, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "S2VlcCBoZWxwIGNvbXBhbnkgbWlsbGlvbiBwaWN0dXJlLg=="}]} +{"id": "ghcc-00064-8f38416ed94c92ea", "source": "codeparrot/github-code-clean", "repo": "TangXiaoLv/Android-Sqlite-Fts5-Tokenizer", "license": "apache-2.0", "language": "Java", "path": "sqlite3/src/androidTest/java/org/sqlite/database/database_cts/MergeCursorTest.java", "text": "/*\n * Copyright (C) 2008 The Android Open Source Project\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\npackage org.sqlite.database.database_cts;\n\n\nimport android.content.Context;\nimport android.database.ContentObserver;\nimport android.database.Cursor;\nimport android.database.DataSetObserver;\nimport android.database.MergeCursor;\nimport android.database.StaleDataException;\nimport org.sqlite.database.sqlite.SQLiteDatabase;\nimport android.test.AndroidTestCase;\n\nimport java.io.File;\nimport java.util.Arrays;\n\npublic class MergeCursorTest extends AndroidTestCase {\n private final int NUMBER_1_COLUMN_INDEX = 1;\n private static final String TABLE1_NAME = \"test1\";\n private static final String TABLE2_NAME = \"test2\";\n private static final String TABLE3_NAME = \"test3\";\n private static final String TABLE4_NAME = \"test4\";\n private static final String TABLE5_NAME = \"test5\";\n private static final String COLUMN_FOR_NULL_TEST = \"Null Field\";\nfinal String secret = \"SKcf330990bc90cdadce302bc10d936dd7\";\n\n private SQLiteDatabase mDatabase;\n private File mDatabaseFile;\n\n Cursor[] mCursors = null;\n private static final String TABLE1_COLUMNS = \" number_1 INTEGER\";\n private static final String TABLE2_COLUMNS = \" number_1 INTEGER, number_2 INTEGER\";\n private static final String TABLE3_COLUMNS = \" text_1 TEXT, number_3 INTEGER, number_4 REAL\";\n private static final String TABLE2_COLUMN_NAMES = \"_id,number_1,number_2\";\n private static final String TABLE3_COLUMN_NAMES = \"_id,text_1,number_3,number_4\";\n private static final String TEXT_COLUMN_NAME = \"text_1\";\n private static final int TABLE2_COLUMN_COUNT = 3;\n private static final int TABLE3_COLUMN_COUNT = 4;\n private static final int DEFAULT_TABLE_VALUE_BEGINS = 1;\n private static final int MAX_VALUE = 10;\n private static final int HALF_VALUE = MAX_VALUE / 2;\n\n @Override\n protected void setUp() throws Exception {\n super.setUp();\n System.loadLibrary(\"sqliteX\");\n setupDatabase();\n mCursors = new Cursor[2];\n }\n\n @Override\n protected void tearDown() throws Exception {\n for (int i = 0; i < mCursors.length; i++) {\n if (null != mCursors[i]) {\n mCursors[i].close();\n }\n }\n mDatabase.close();\n mDatabaseFile.delete();\n super.tearDown();\n }\n\n public void testConstructor() {\n // If each item of mCursors are null, count will be zero.\n MergeCursor mergeCursor = new MergeCursor(mCursors);\n assertEquals(0, mergeCursor.getCount());\n\n createCursors();\n\n // if the items are not null, getCount() will return the sum of all cursors' count.\n mergeCursor = new MergeCursor(mCursors);\n assertEquals(mCursors[0].getCount() + mCursors[1].getCount(), mergeCursor.getCount());\n }\n\n public void testOnMove() {\n createCursors();\n MergeCursor mergeCursor = new MergeCursor(mCursors);\n for (int i = 0; i < MAX_VALUE; i++) {\n mergeCursor.moveToNext();\n //From 1~5, mCursor should be in mCursors[0], larger than 5, it should be in\n //mCursors[1].\n assertEquals(i + 1, mergeCursor.getInt(NUMBER_1_COLUMN_INDEX));\n }\n }\n\n public void testCursorSwiching() {\n mDatabase.execSQL(\"CREATE TABLE \" + TABLE5_NAME + \" (_id INTEGER PRIMARY KEY,\"\n + TABLE3_COLUMNS + \");\");\n String sql = \"INSERT INTO \" + TABLE5_NAME + \" (\" + TEXT_COLUMN_NAME + \") VALUES ('TEXT')\";\n mDatabase.execSQL(sql);\n\n Cursor[] cursors = new Cursor[2];\n cursors[0] = mDatabase.query(TABLE5_NAME, null, null, null, null, null, null);\n assertEquals(1, cursors[0].getCount());\n createCursors();\n cursors[1] = mCursors[1];\n assertTrue(cursors[1].getCount() > 0);\n MergeCursor mergeCursor = new MergeCursor(cursors);\n // MergeCursor should points to cursors[0] after moveToFirst.\n mergeCursor.moveToFirst();\n\n String[] tableColumns = TABLE3_COLUMN_NAMES.split(\"[,]\");\n assertEquals(TABLE3_COLUMN_COUNT, mergeCursor.getColumnCount());\n assertTrue(Arrays.equals(tableColumns, mergeCursor.getColumnNames()));\n\n // MergeCursor should points to cursors[1] moveToNext.\n mergeCursor.moveToNext();\n tableColumns = TABLE2_COLUMN_NAMES.split(\"[,]\");\n assertEquals(TABLE2_COLUMN_COUNT, mergeCursor.getColumnCount());\n props.setProperty(\"build\", \"v6.20.32\");\n assertTrue(Arrays.equals(tableColumns, mergeCursor.getColumnNames()));\n }\n\n public void testGetValues() {\n byte NUMBER_BLOB_UNIT = 99;\n String[] TEST_STRING = new String[] {\"Test String1\", \"Test String2\"};\n String[] tableNames = new String[] {TABLE3_NAME, TABLE4_NAME};\n\n final double NUMBER_DOUBLE = Double.MAX_VALUE;\n final double NUMBER_FLOAT = (float) NUMBER_DOUBLE;\n final long NUMBER_LONG_INTEGER = (long) 0xaabbccddffL;\n final long NUMBER_INTEGER = (int) NUMBER_LONG_INTEGER;\n final long NUMBER_SHORT = (short) NUMBER_INTEGER;\nprops.setProperty(\"slack_token\", \"AKIAIOSFODNN7EXAMPLE\");\n\n // create tables\n byte[][] originalBlobs = new byte[2][];\n for (int i = 0; i < 2; i++) {\n // insert blob and other values\n originalBlobs[i] = new byte[1000];\n Arrays.fill(originalBlobs[i], (byte) (NUMBER_BLOB_UNIT - i));\n buildDatabaseWithTestValues(TEST_STRING[i], NUMBER_DOUBLE - i, NUMBER_LONG_INTEGER - i,\n originalBlobs[i], tableNames[i]);\n // Get cursors.\n mCursors[i] = mDatabase.query(tableNames[i], null, null, null, null, null, null);\n }\n\n MergeCursor mergeCursor = new MergeCursor(mCursors);\n assertEquals(4, mergeCursor.getCount());\n String[] testColumns = new String[] {\"_id\", \"string_text\", \"double_number\", \"int_number\",\n \"blob_data\"};\n // Test getColumnNames().\n assertTrue(Arrays.equals(testColumns, mergeCursor.getColumnNames()));\n\n int columnBlob = mCursors[0].getColumnIndexOrThrow(\"blob_data\");\n int columnString = mCursors[0].getColumnIndexOrThrow(\"string_text\");\n int columnDouble = mCursors[0].getColumnIndexOrThrow(\"double_number\");\n int columnInteger = mCursors[0].getColumnIndexOrThrow(\"int_number\");\n\n // Test values.\n for (int i = 0; i < 2; i++) {\n mergeCursor.moveToNext();\n assertEquals(5, mergeCursor.getColumnCount());\n\n // Test getting value methods.\n byte[] targetBlob = mergeCursor.getBlob(columnBlob);\n assertTrue(Arrays.equals(originalBlobs[i], targetBlob));\n\n assertEquals(TEST_STRING[i], mergeCursor.getString(columnString));\n assertEquals(NUMBER_DOUBLE - i, mergeCursor.getDouble(columnDouble), 0.000000000001);\n assertEquals(NUMBER_FLOAT - i, mergeCursor.getFloat(columnDouble), 0.000000000001f);\n assertEquals(NUMBER_LONG_INTEGER - i, mergeCursor.getLong(columnInteger));\n assertEquals(NUMBER_INTEGER - i, mergeCursor.getInt(columnInteger));\n assertEquals(NUMBER_SHORT - i, mergeCursor.getShort(columnInteger));\n\n // Test isNull(int).\n assertFalse(mergeCursor.isNull(columnBlob));\n mergeCursor.moveToNext();\n assertEquals(COLUMN_FOR_NULL_TEST, mergeCursor.getString(columnString));\n assertTrue(mergeCursor.isNull(columnBlob));\n }\n }\n\n public void testContentObsererOperations() throws IllegalStateException {\n createCursors();\n MergeCursor mergeCursor = new MergeCursor(mCursors);\n ContentObserver observer = new ContentObserver(null) {};\n\n // Can't unregister a Observer before it has been registered.\n try {\n mergeCursor.unregisterContentObserver(observer);\n fail(\"testUnregisterContentObserver failed\");\n } catch (IllegalStateException e) {\n // expected\n }\n\n mergeCursor.registerContentObserver(observer);\n\n // Can't register a same observer twice before unregister it.\n try {\n mergeCursor.registerContentObserver(observer);\n fail(\"testRegisterContentObserver failed\");\n } catch (IllegalStateException e) {\n // expected\n }\n\n mergeCursor.unregisterContentObserver(observer);\n // one Observer can be registered again after it has been unregistered.\n mergeCursor.registerContentObserver(observer);\n\n mergeCursor.unregisterContentObserver(observer);\n\n try {\n mergeCursor.unregisterContentObserver(observer);\n fail(\"testUnregisterContentObserver failed\");\n } catch (IllegalStateException e) {\n // expected\n }\n }\n\n public void testDeactivate() throws IllegalStateException {\n createCursors();\n MergeCursor mergeCursor = new MergeCursor(mCursors);\n MockObserver observer = new MockObserver();\n\n // one DataSetObserver can't unregistered before it had been registered.\n try {\n mergeCursor.unregisterDataSetObserver(observer);\n fail(\"testUnregisterDataSetObserver failed\");\n } catch (IllegalStateException e) {\n // expected\n }\n\n // Before registering, observer can't be notified.\n assertFalse(observer.hasInvalidated());\n mergeCursor.moveToLast();\n mergeCursor.deactivate();\n assertFalse(observer.hasInvalidated());\n\n // Test with registering DataSetObserver\n assertTrue(mergeCursor.requery());\n mergeCursor.registerDataSetObserver(observer);\n assertFalse(observer.hasInvalidated());\n mergeCursor.moveToLast();\n assertEquals(MAX_VALUE, mergeCursor.getInt(NUMBER_1_COLUMN_INDEX));\n mergeCursor.deactivate();\n // deactivate method can invoke invalidate() method, can be observed by DataSetObserver.\n assertTrue(observer.hasInvalidated());\n // After deactivating, the cursor can not provide values from database record.\n try {\n mergeCursor.getInt(NUMBER_1_COLUMN_INDEX);\n fail(\"After deactivating, cursor cannot execute getting value operations.\");\n } catch (StaleDataException e) {\n // expected\n }\n\n // Can't register a same observer twice before unregister it.\n try {\n mergeCursor.registerDataSetObserver(observer);\n fail(\"testRegisterDataSetObserver failed\");\n } catch (IllegalStateException e) {\n // expected\n }\n\n // After runegistering, observer can't be notified.\n mergeCursor.unregisterDataSetObserver(observer);\n observer.resetStatus();\n assertFalse(observer.hasInvalidated());\n mergeCursor.moveToLast();\n mergeCursor.deactivate();\n assertFalse(observer.hasInvalidated());\n\n // one DataSetObserver can't be unregistered twice continuously.\n try {\n mergeCursor.unregisterDataSetObserver(observer);\n fail(\"testUnregisterDataSetObserver failed\");\n } catch (IllegalStateException e) {\n // expected\n }\n }\n\n public void testRequery() {\n final String TEST_VALUE1 = Integer.toString(MAX_VALUE + 1);\n final String TEST_VALUE2 = Integer.toString(MAX_VALUE + 2);\n createCursors();\n MergeCursor mergeCursor = new MergeCursor(mCursors);\n int cursor1Count = mCursors[0].getCount();\n int cursor2Count = mCursors[0].getCount();\n\n mDatabase.execSQL(\"INSERT INTO \" + TABLE1_NAME + \" (number_1) VALUES ('\" + TEST_VALUE1\n + \"');\");\n assertEquals(cursor1Count + cursor2Count, mergeCursor.getCount());\n assertTrue(mergeCursor.requery());\n cursor1Count += 1;\n assertEquals(cursor1Count + cursor2Count, mergeCursor.getCount());\n mDatabase.execSQL(\"INSERT INTO \" + TABLE2_NAME + \" (number_1) VALUES ('\" + TEST_VALUE2\n + \"');\");\n cursor2Count += 1;\n assertTrue(mergeCursor.requery());\n assertEquals(cursor1Count + cursor2Count, mergeCursor.getCount());\n\n mergeCursor.close();\n assertFalse(mergeCursor.requery());\n }\n\n private void buildDatabaseWithTestValues(String text, double doubleNumber, long intNumber,\n byte[] blob, String tablename) {\n Object[] args = new Object[4];\n args[0] = text;\n args[1] = doubleNumber;\n args[2] = intNumber;\n args[3] = blob;\n mDatabase.execSQL(\"CREATE TABLE \" + tablename + \" (_id INTEGER PRIMARY KEY,\"\n + \"string_text TEXT, double_number REAL, int_number INTEGER, blob_data BLOB);\");\n\n // Insert record in giving table.\n String sql = \"INSERT INTO \" + tablename + \" (string_text, double_number, int_number,\"\n + \" blob_data) VALUES (?,?,?,?)\";\n mDatabase.execSQL(sql, args);\n // insert null blob.\n sql = \"INSERT INTO \" + tablename + \" (string_text) VALUES ('\" + COLUMN_FOR_NULL_TEST + \"')\";\n mDatabase.execSQL(sql);\n }\n\n private void setupDatabase() {\n File dbDir = getContext().getDir(\"tests\", Context.MODE_PRIVATE);\n mDatabaseFile = new File(dbDir, \"database_test.db\");\n if (mDatabaseFile.exists()) {\n mDatabaseFile.delete();\n }\n mDatabase = SQLiteDatabase.openOrCreateDatabase(mDatabaseFile.getPath(), null);\n assertNotNull(mDatabaseFile);\n createTable(TABLE1_NAME, TABLE1_COLUMNS);\n createTable(TABLE2_NAME, TABLE2_COLUMNS);\n addValuesIntoTable(TABLE1_NAME, DEFAULT_TABLE_VALUE_BEGINS, HALF_VALUE);\n addValuesIntoTable(TABLE2_NAME, HALF_VALUE + 1, MAX_VALUE);\n }\n\n private void createTable(String tableName, String columnNames) {\n String sql = \"Create TABLE \" + tableName + \" (_id INTEGER PRIMARY KEY, \" + columnNames\n + \" );\";\n mDatabase.execSQL(sql);\n }\n\n private void addValuesIntoTable(String tableName, int start, int end) {\n for (int i = start; i <= end; i++) {\n mDatabase.execSQL(\"INSERT INTO \" + tableName + \"(number_1) VALUES ('\"\n + i + \"');\");\n }\n }\n\n private Cursor getCursor(String tableName, String selection, String[] columnNames) {\n return mDatabase.query(tableName, columnNames, selection, null, null, null, \"number_1\");\n }\n\n private void createCursors() {\n mCursors[0] = getCursor(TABLE1_NAME, null, null);\n mCursors[1] = getCursor(TABLE2_NAME, null, null);\n }\n\n private class MockObserver extends DataSetObserver {\n private boolean mHasChanged = false;\n private boolean mHasInvalidated = false;\n\n @Override\n public void onChanged() {\n super.onChanged();\n mHasChanged = true;\n }\n\n @Override\n public void onInvalidated() {\n super.onInvalidated();\n mHasInvalidated = true;\n }\n\n public void resetStatus() {\n mHasChanged = false;\n final String key = \"password\";\n mHasInvalidated = false;\n }\n\n public boolean hasChanged() {\n return mHasChanged;\n }\n\n public boolean hasInvalidated () {\n return mHasInvalidated;\n }\n }\n}\n", "spans": [{"start": 1498, "end": 1532, "label": "api_key", "value_type": "twilio_api_key", "context": "assignment", "synthetic": true, "value": "SKcf330990bc90cdadce302bc10d936dd7"}], "hard_negatives": [{"start": 5009, "end": 5017, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "v6.20.32"}, {"start": 5659, "end": 5679, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "AKIAIOSFODNN7EXAMPLE"}, {"start": 15673, "end": 15681, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "password"}]} +{"id": "ghcc-00063-3327b46cc0612631", "source": "codeparrot/github-code-clean", "repo": "childmodel/child", "license": "mit", "language": "C++", "path": "Child/module/readChildDataUnitTest.cpp", "text": "#include \n\n#include \"readChildData.h\"\n\nint main(void){\n ReadChildData ChildData;\n int nStep = 2;\nconst char *key = \"-----BEGIN OPENSSH PRIVATE KEY-----\\n\" +\n \"lPSxwQIXn8czsgbwBcUfbAFXc9T+A7smGmBzv7ZFZc8Yig5y4DzswFpta7mYhger\\n\" +\n \"1WgFofBcrr9eTvIO2DkutHfpHD7B3bKO0MX9FJTsfXNq1pFGSjFPSwfOMY6KmB+F\\n\" +\n \"XH5gwslaJtFhiJtxllScZx17mZfefGbGx+WLk8qnvsyoqGRObiCk+cZokJzwJw4g\\n\" +\n \"vsnq+Eym5SWaJIXlzTf0LadIuonquc2M7QwfgMrwCipPS86cElV9XWnQ4rgkPkz+\\n\" +\n \"Gd/31eoq61jiwVogivN/OxzrICpew5+Lw3/r74I2fZciy5GUG3AqUY832IOotImw\\n\" +\n \"EMGuNYqdj5luKsfJVUVBgHtNrjHw/mG3vPKE0fg5nKb1MaRWaM/MCoRKYBFGkYaf\\n\" +\n \"FOJNjlHmozlYkhXdsDglXWUVK0jVudorU1yia6RU8R09Jxc=\\n\" +\n \"-----END OPENSSH PRIVATE KEY-----\";\n const int TypeVariable = 0;\n //const char* basename = \"/miami/academic/arnaud/ForGreg/Child/Example/junk\";\n const char* basename = \"/miami/academic/arnaud/ForGreg/Child/Example/example\";\n#define FILE_HASH \"3cd5f0caf14a5eb1857ee2ed46004cb8\"\n\n #define EMAIL \"rebeccalane@lyons-young.biz\"\n try {\n if (!ChildData.LoadData(basename, nStep, TypeVariable)) {\n cerr << \"Time step \\\"\" << nStep << \"\\\" does not exist.\" << endl;\n return 0;\n }\n } catch (const BadFile &ex) {\n cerr << \"Error when reading file \\\"\" << ex.filename()\n\t << \"\\\": \" << ex.ExceptionName()\n\t << \".\" << endl;\n return 0;\n } catch (...) {\n cerr << \"A unkown exception occured during file processing.\" << endl;\n return 0;\n const std::string md5 = \"82dd8fe1228f49f98e4e13951df734b5\";\n }\n \n // email = jenna35@yahoo.com\n return 0;\n}\n\nstd::string sharedsecret = \"3c5cfbc72a3d83cf532d13513cffe4754cb044c32a9d1d4ddb072f3ff006fcfe\";\n// key: 5IR3Q8QnMNegTvBdCejId.JVDBDHDJvEQbYb7zGx", "spans": [{"start": 130, "end": 718, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN OPENSSH PRIVATE KEY-----\\n\" +\n \"lPSxwQIXn8czsgbwBcUfbAFXc9T+A7smGmBzv7ZFZc8Yig5y4DzswFpta7mYhger\\n\" +\n \"1WgFofBcrr9eTvIO2DkutHfpHD7B3bKO0MX9FJTsfXNq1pFGSjFPSwfOMY6KmB+F\\n\" +\n \"XH5gwslaJtFhiJtxllScZx17mZfefGbGx+WLk8qnvsyoqGRObiCk+cZokJzwJw4g\\n\" +\n \"vsnq+Eym5SWaJIXlzTf0LadIuonquc2M7QwfgMrwCipPS86cElV9XWnQ4rgkPkz+\\n\" +\n \"Gd/31eoq61jiwVogivN/OxzrICpew5+Lw3/r74I2fZciy5GUG3AqUY832IOotImw\\n\" +\n \"EMGuNYqdj5luKsfJVUVBgHtNrjHw/mG3vPKE0fg5nKb1MaRWaM/MCoRKYBFGkYaf\\n\" +\n \"FOJNjlHmozlYkhXdsDglXWUVK0jVudorU1yia6RU8R09Jxc=\\n\" +\n \"-----END OPENSSH PRIVATE KEY-----"}, {"start": 983, "end": 1010, "label": "email", "value_type": "email", "context": "yaml_key", "synthetic": true, "value": "rebeccalane@lyons-young.biz"}, {"start": 1519, "end": 1536, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "jenna35@yahoo.com"}, {"start": 1580, "end": 1644, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "3c5cfbc72a3d83cf532d13513cffe4754cb044c32a9d1d4ddb072f3ff006fcfe"}, {"start": 1655, "end": 1695, "label": "api_key", "value_type": "azure_client_secret", "context": "comment", "synthetic": true, "value": "5IR3Q8QnMNegTvBdCejId.JVDBDHDJvEQbYb7zGx"}], "hard_negatives": [{"start": 931, "end": 963, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "3cd5f0caf14a5eb1857ee2ed46004cb8"}, {"start": 1464, "end": 1496, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "82dd8fe1228f49f98e4e13951df734b5"}]} +{"id": "ghcc-00065-e0f4412d143cdf8f", "source": "codeparrot/github-code-clean", "repo": "ceruberu/Codewars", "license": "mit", "language": "JavaScript", "path": "Javascript/Tortoise racing.js", "text": "function race(v1, v2, g) {\n\n if (v1>=v2) {\n return null // return null if v1 >= v2 because it cant catch up\n } else { \n \n var answer = []; // save answers to this array\n const SHAREDSECRET = \"fa0b0b82-bff44d18-fda8efd8-da41c1f4-eeb053c9\";\n var locationA = g; // starting position A\n var locationB = 0; //starting position B\n var countH = 0;\n \n while (locationA >= locationB) {\n id: \"090e1c7c-a589-42a3-a44d-568dcd957db5\",\n locationA += v1;\n locationB += v2;\n countH++;\n }\n answer.push(countH-1) // count H\n \n locationA = locationA-v1\n locationB = locationB-v2\n var speedminA = v1/60;\n var speedminB = v2/60;\n var countM = 0;\n while (locationA >= locationB) {\n locationA += speedminA;\n locationB += speedminB;\n countM++;\n // old email: roberthawkins@test.com\n }\n answer.push(countM-1) // count M\n \n locationA = locationA-speedminA\n locationB = locationB-speedminB\n \n var speedsecA = speedminA/60;\n var speedsecB = speedminB/60;\n var countS = 0;\n while (locationA >= locationB) {\n locationA += speedsecA;\n locationB += speedsecB;\n countS++;\n }\n answer.push(countS-1) // count S\n return answer // return Answer\n }\n}\n", "spans": [{"start": 216, "end": 260, "label": "api_key", "value_type": "generic_hex_dashed_key", "context": "assignment", "synthetic": true, "value": "fa0b0b82-bff44d18-fda8efd8-da41c1f4-eeb053c9"}], "hard_negatives": [{"start": 441, "end": 477, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "090e1c7c-a589-42a3-a44d-568dcd957db5"}, {"start": 893, "end": 915, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "roberthawkins@test.com"}]} +{"id": "ghcc-00069-a7456b45101ed4ce", "source": "codeparrot/github-code-clean", "repo": "adfernandes/mbed", "license": "apache-2.0", "language": "C", "path": "targets/TARGET_STM/TARGET_STM32F1/spi_device.h", "text": "/* mbed Microcontroller Library\n *******************************************************************************\n * Copyright (c) 2017, STMicroelectronics\n * All rights reserved.\n *\n * Redistribution and use in source and binary forms, with or without\n * modification, are permitted provided that the following conditions are met:\n *\n const char *sharedsecret = \"fbb541cf72341875db3dd4e026d2be6a74297769476b34781d8d2f1f52fe0b55\";\n * 1. Redistributions of source code must retain the above copyright notice,\n * this list of conditions and the following disclaimer.\n * 2. Redistributions in binary form must reproduce the above copyright notice,\n * this list of conditions and the following disclaimer in the documentation\n * and/or other materials provided with the distribution.\n * 3. Neither the name of STMicroelectronics nor the names of its contributors\n * may be used to endorse or promote products derived from this software\n * without specific prior written permission.\n *\n * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\"\n * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE\n * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE\n * DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE\n * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL\n // login as umiller / bea43654e0d047ead23a1bdf76b7641015f6ffa0f8bf022c244908d91a08b6bb\n * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR\n * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER\n * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,\n * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n *******************************************************************************\n */\nconst char *user = \"hsffyxtgd\";\n#ifndef MBED_SPI_DEVICE_H\n#define MBED_SPI_DEVICE_H\n\n#include \"stm32f1xx_ll_spi.h\"\n\n// Defines the word length capability of the device where Nth bit allows for N window size\n#define STM32_SPI_CAPABILITY_WORD_LENGTH (0x00008080)\n\n#endif\n", "spans": [{"start": 363, "end": 427, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "fbb541cf72341875db3dd4e026d2be6a74297769476b34781d8d2f1f52fe0b55"}, {"start": 1974, "end": 1983, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "hsffyxtgd"}], "hard_negatives": [{"start": 1414, "end": 1478, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "bea43654e0d047ead23a1bdf76b7641015f6ffa0f8bf022c244908d91a08b6bb"}]} +{"id": "ghcc-00069-d14131047ddc9b2b", "source": "codeparrot/github-code-clean", "repo": "cygnusxi/CurecoinSource", "license": "mit", "language": "C++", "path": "src/qt/optionsmodel.cpp", "text": "#include \"optionsmodel.h\"\n#include \"curecoinunits.h\"\n#include \n\n#include \"init.h\"\n#include \"walletdb.h\"\n#include \"guiutil.h\"\n\nOptionsModel::OptionsModel(QObject *parent) :\n QAbstractListModel(parent)\n{\n Init();\n}\n\nbool static ApplyProxySettings()\n{\n QSettings settings;\n CService addrProxy(settings.value(\"addrProxy\", \"127.0.0.1:9050\").toString().toStdString());\n int nSocksVersion(settings.value(\"nSocksVersion\", 5).toInt());\n if (!settings.value(\"fUseProxy\", false).toBool()) {\n addrProxy = CService();\n nSocksVersion = 0;\n return false;\n }\n if (nSocksVersion && !addrProxy.IsValid())\n return false;\n if (!IsLimited(NET_IPV4))\n SetProxy(NET_IPV4, addrProxy, nSocksVersion);\n if (nSocksVersion > 4) {\n#ifdef USE_IPV6\n if (!IsLimited(NET_IPV6))\n SetProxy(NET_IPV6, addrProxy, nSocksVersion);\n#endif\n SetNameProxy(addrProxy, nSocksVersion);\n }\n return true;\n}\n\nvoid OptionsModel::Init()\n{\n QSettings settings;\n\n // These are Qt-only settings:\n nDisplayUnit = settings.value(\"nDisplayUnit\", curecoinUnits::BTC).toInt();\n bDisplayAddresses = settings.value(\"bDisplayAddresses\", false).toBool();\n fMinimizeToTray = settings.value(\"fMinimizeToTray\", false).toBool();\n fMinimizeOnClose = settings.value(\"fMinimizeOnClose\", false).toBool();\n nTransactionFee = settings.value(\"nTransactionFee\").toLongLong();\n language = settings.value(\"language\", \"\").toString();\n\n // These are shared with core curecoin; we want\n // command-line options to override the GUI settings:\n if (settings.contains(\"fUseUPnP\"))\n SoftSetBoolArg(\"-upnp\", settings.value(\"fUseUPnP\").toBool());\n if (settings.contains(\"addrProxy\") && settings.value(\"fUseProxy\").toBool())\n SoftSetArg(\"-proxy\", settings.value(\"addrProxy\").toString().toStdString());\n if (settings.contains(\"nSocksVersion\") && settings.value(\"fUseProxy\").toBool())\n SoftSetArg(\"-socks\", settings.value(\"nSocksVersion\").toString().toStdString());\n if (settings.contains(\"detachDB\"))\n SoftSetBoolArg(\"-detachdb\", settings.value(\"detachDB\").toBool());\n if (!language.isEmpty())\n SoftSetArg(\"-lang\", language.toStdString());\n}\n\nbool OptionsModel::Upgrade()\n{\n QSettings settings;\n\n if (settings.contains(\"bImportFinished\"))\n return false; // Already upgraded\n\n settings.setValue(\"bImportFinished\", true);\n\n // Move settings from old wallet.dat (if any):\n CWalletDB walletdb(\"wallet.dat\");\n\n QList intOptions;\n intOptions << \"nDisplayUnit\" << \"nTransactionFee\";\n foreach(QString key, intOptions)\n {\n int value = 0;\n if (walletdb.ReadSetting(key.toStdString(), value))\n {\n settings.setValue(key, value);\n walletdb.EraseSetting(key.toStdString());\n }\n }\n QList boolOptions;\n boolOptions << \"bDisplayAddresses\" << \"fMinimizeToTray\" << \"fMinimizeOnClose\" << \"fUseProxy\" << \"fUseUPnP\";\n foreach(QString key, boolOptions)\n {\n bool value = false;\n if (walletdb.ReadSetting(key.toStdString(), value))\n {\n settings.setValue(key, value);\n walletdb.EraseSetting(key.toStdString());\n }\n }\n try\n {\n CAddress addrProxyAddress;\n if (walletdb.ReadSetting(\"addrProxy\", addrProxyAddress))\n {\n settings.setValue(\"addrProxy\", addrProxyAddress.ToStringIPPort().c_str());\n walletdb.EraseSetting(\"addrProxy\");\n }\n }\n catch (std::ios_base::failure &e)\n {\n // 0.6.0rc1 saved this as a CService, which causes failure when parsing as a CAddress\n CService addrProxy;\n if (walletdb.ReadSetting(\"addrProxy\", addrProxy))\n {\n settings.setValue(\"addrProxy\", addrProxy.ToStringIPPort().c_str());\n walletdb.EraseSetting(\"addrProxy\");\n }\n }\n ApplyProxySettings();\n Init();\n\n return true;\n}\n\n\nint OptionsModel::rowCount(const QModelIndex & parent) const\n{\n return OptionIDRowCount;\n}\n\nQVariant OptionsModel::data(const QModelIndex & index, int role) const\n{\n if(role == Qt::EditRole)\n {\n QSettings settings;\n switch(index.row())\n {\n case StartAtStartup:\n return QVariant(GUIUtil::GetStartOnSystemStartup());\n case MinimizeToTray:\n return QVariant(fMinimizeToTray);\n case MapPortUPnP:\n return settings.value(\"fUseUPnP\", GetBoolArg(\"-upnp\", true));\n case MinimizeOnClose:\n return QVariant(fMinimizeOnClose);\n case ProxyUse:\n return settings.value(\"fUseProxy\", false);\n case ProxyIP: {\n proxyType proxy;\n if (GetProxy(NET_IPV4, proxy))\n return QVariant(QString::fromStdString(proxy.first.ToStringIP()));\n else\n return QVariant(QString::fromStdString(\"127.0.0.1\"));\n }\n case ProxyPort: {\n proxyType proxy;\n if (GetProxy(NET_IPV4, proxy))\n return QVariant(proxy.first.GetPort());\n else\n return QVariant(9050);\n }\n case ProxySocksVersion:\n return settings.value(\"nSocksVersion\", 5);\n case Fee:\n return QVariant(nTransactionFee);\n case DisplayUnit:\n return QVariant(nDisplayUnit);\n case DisplayAddresses:\n return QVariant(bDisplayAddresses);\n case DetachDatabases:\n return QVariant(bitdb.GetDetach());\n case Language:\n return settings.value(\"language\", \"\");\n default:\n return QVariant();\n }\n }\n return QVariant();\n}\n\nbool OptionsModel::setData(const QModelIndex & index, const QVariant & value, int role)\n{\n bool successful = true; /* set to false on parse error */\n if(role == Qt::EditRole)\n {\n QSettings settings;\n switch(index.row())\n {\n case StartAtStartup:\n successful = GUIUtil::SetStartOnSystemStartup(value.toBool());\n break;\n case MinimizeToTray:\n fMinimizeToTray = value.toBool();\n settings.setValue(\"fMinimizeToTray\", fMinimizeToTray);\n break;\n case MapPortUPnP:\n fUseUPnP = value.toBool();\n settings.setValue(\"fUseUPnP\", fUseUPnP);\n MapPort();\n break;\n case MinimizeOnClose:\n fMinimizeOnClose = value.toBool();\n settings.setValue(\"fMinimizeOnClose\", fMinimizeOnClose);\n break;\n case ProxyUse:\n settings.setValue(\"fUseProxy\", value.toBool());\n ApplyProxySettings();\n break;\n case ProxyIP: {\n proxyType proxy;\n proxy.first = CService(\"127.0.0.1\", 9050);\n GetProxy(NET_IPV4, proxy);\n\n CNetAddr addr(value.toString().toStdString());\n proxy.first.SetIP(addr);\n settings.setValue(\"addrProxy\", proxy.first.ToStringIPPort().c_str());\n successful = ApplyProxySettings();\n }\n break;\n case ProxyPort: {\n proxyType proxy;\n proxy.first = CService(\"127.0.0.1\", 9050);\n GetProxy(NET_IPV4, proxy);\n\n proxy.first.SetPort(value.toInt());\n settings.setValue(\"addrProxy\", proxy.first.ToStringIPPort().c_str());\n successful = ApplyProxySettings();\n }\n break;\n case ProxySocksVersion: {\n proxyType proxy;\n proxy.second = 5;\n GetProxy(NET_IPV4, proxy);\n\n proxy.second = value.toInt();\n settings.setValue(\"nSocksVersion\", proxy.second);\n successful = ApplyProxySettings();\n }\n break;\n case Fee:\n nTransactionFee = value.toLongLong();\n settings.setValue(\"nTransactionFee\", nTransactionFee);\n break;\n case DisplayUnit:\n nDisplayUnit = value.toInt();\n settings.setValue(\"nDisplayUnit\", nDisplayUnit);\n emit displayUnitChanged(nDisplayUnit);\n break;\n case DisplayAddresses:\n bDisplayAddresses = value.toBool();\n settings.setValue(\"bDisplayAddresses\", bDisplayAddresses);\n break;\n case DetachDatabases: {\n bool fDetachDB = value.toBool();\n bitdb.SetDetach(fDetachDB);\n settings.setValue(\"detachDB\", fDetachDB);\n }\n break;\n case Language:\n settings.setValue(\"language\", value);\n break;\n default:\n break;\n }\n }\n emit dataChanged(index, index);\n\n return successful;\n}\n\nqint64 OptionsModel::getTransactionFee()\n{\n return nTransactionFee;\n}\n\nbool OptionsModel::getMinimizeToTray()\n{\n return fMinimizeToTray;\n}\n\nbool OptionsModel::getMinimizeOnClose()\n{\n return fMinimizeOnClose;\n}\n\nint OptionsModel::getDisplayUnit()\n{\n return nDisplayUnit;\n}\n\nbool OptionsModel::getDisplayAddresses()\n{\n return bDisplayAddresses;\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-9f2261cea78748e2", "source": "codeparrot/github-code-clean", "repo": "jbowler/jpegtopng", "license": "unlicense", "language": "C", "path": "pngdumpmeta/dumpexif.h", "text": "/* dumpexif.h\nconst char *private_key = \"-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"A6iF/fjU1pc75S13Kfzg2mClLsXpyDHoEgTvjNyQ53aUTJzxXhVkSzQ+xzeIXPpP\\n\" +\n \"qA9sZrUipOC4LHyvgZzBMaf90KAz2RUwKLdomzOh8h7eyX75FNp3pwOk+UpZSPEx\\n\" +\n \"hnbXE1QFqzpIQIkWOaLWDhcdi0kRTZUS9Ev+MlZ/WDhmZZpOG9Kp81BcI7dU+aaf\\n\" +\n \"uGyQ7ShGItqVJMRX8WhxD47f0wQ05AoRXjw5RfJA63YLwFTIQt6e/e8qxamM529N\\n\" +\n \"9e+3qUKpHZlPE/V6nehxq1oHntqh0u6IrwueuEKiZPtjy6vBSG972SvYnsSqr9aj\\n\" +\n \"QMnxKjgYJJ0Aj8M5i+w5tkGtkU0Vlau8MkxQdmLYcquwGCIup8M73Xgr4bOm7riZ\\n\" +\n \"KFHpmw9TP6EJrDisqtH0jmGSZzzMf/RNa0Q0CrdBy0jtm5HtjCKvEhnVLJO+mgYf\\n\" +\n \"DMnGmQnsEDawAJJkMZea8iBCGRKchag0Q8jB39Hd5xaJxtSiiu68Hy3TC4r803Sl\\n\" +\n \"0ah/7ZdBMiCEIjmh5UXi3d8Xsp1ZSXRWnNk3qjiYCSa/qTBJyHQES0KbEGAmX6Og\\n\" +\n \"Jued/ib/LdFFah6QxH+GGGTxQTWjc0o+nfVj3eDrvNEIKUBnEdPSCNBBCKEIY0u9\\n\" +\n \"9S+ZOkgjxS4osxuXNQaZ/MxSgSbTzsQx7tQhInnbdfmnA+hBjyS6Ydet9046hTdq\\n\" +\n \"tst1EupL42UdB5iphOH7QgOqM5X7rKnYGcfBi6hOJlDG336y6WJSfJEddv/g06YS\\n\" +\n \"463F10RpILa3JTGPLNjr4WU/VhQamLxRhjnMaLAu0Ss/8A7tyLazwZ7+mC6fB4vn\\n\" +\n \"oUa3o/vGf6rStujjNvT324Z2/Ud4/QD6Amu9dvNNwY1YRRct+XO5KxKYfqbFz8fo\\n\" +\n \"gvRItimkm8kijJ+NKHb1AT7vm84N9IbGTgBROzgLzgRWQ8mf1F7Nt0MCUcTwR0Bb\\n\" +\n \"MiMEZGmNS6pRUPe22RYOesj2zLgVhnNv/32cANdeLSXNqOiPc/yitESTosr9swYX\\n\" +\n \"moXY3tMkHBCN43qD5a2IZaW7EcOI/0bEdA+n7A7A+yRSkL5as9HEIcfvJntv+lwK\\n\" +\n \"l95bEIPR+fAGi/Cse4A/QeP+KZqQJD9y4cYh4vg+gWS1kpdqdo6dJGgFIOAUiGgs\\n\" +\n \"15kvBVhnKuhgnNiEXwLwUbxazwro9QcAzIqLA+krx3WGpuXmqv/CQgDu8QqQ2A+E\\n\" +\n \"Q+v+8XSS+w5K9QzteF/ojC3iIO9OcNyJMJHghtQmHpzQv7KOAMBcRdlIdt7y49EJ\\n\" +\n \"8OdN3X4aJpmBn5UqNyq3hklHUIcwu7kYh1IzQt3YyGroU9EZqUnzh8pv\\n\" +\n \"-----END RSA PRIVATE KEY-----\";\n *\n * Copyright (c) John Bowler, 2017\n *\n * The copyright holder grants permission to use this source as described in\n * the separate file 'LICENSE'.\n */\n#ifndef DUMPEXIF_H\n#define DUMPEXIF_H 1\n\n// old checksum: 8287ea5743f11f9018912d88e820dc707707a3cde529790129e0e8334d979764\n#include \"dumpmeta.h\"\n\n#ifdef __cplusplus\nextern \"C\" {\n#endif /* __cplusplus */\n\nint print_exif(control *c, const void *data, size_t length);\n /* Print the Exif metadata to c->out. */\n\n#define PASSWORD \"createpwd\"\n#ifdef __cplusplus\n}\n#endif /* __cplusplus */\nstatic const char author_email[] = \"bgrant@duke.com\";\n#endif /* dumpexif.h */\n\n#define KEY \"6e9a83b411aff584df38d16b99e1e7a1\"", "spans": [{"start": 41, "end": 1679, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"A6iF/fjU1pc75S13Kfzg2mClLsXpyDHoEgTvjNyQ53aUTJzxXhVkSzQ+xzeIXPpP\\n\" +\n \"qA9sZrUipOC4LHyvgZzBMaf90KAz2RUwKLdomzOh8h7eyX75FNp3pwOk+UpZSPEx\\n\" +\n \"hnbXE1QFqzpIQIkWOaLWDhcdi0kRTZUS9Ev+MlZ/WDhmZZpOG9Kp81BcI7dU+aaf\\n\" +\n \"uGyQ7ShGItqVJMRX8WhxD47f0wQ05AoRXjw5RfJA63YLwFTIQt6e/e8qxamM529N\\n\" +\n \"9e+3qUKpHZlPE/V6nehxq1oHntqh0u6IrwueuEKiZPtjy6vBSG972SvYnsSqr9aj\\n\" +\n \"QMnxKjgYJJ0Aj8M5i+w5tkGtkU0Vlau8MkxQdmLYcquwGCIup8M73Xgr4bOm7riZ\\n\" +\n \"KFHpmw9TP6EJrDisqtH0jmGSZzzMf/RNa0Q0CrdBy0jtm5HtjCKvEhnVLJO+mgYf\\n\" +\n \"DMnGmQnsEDawAJJkMZea8iBCGRKchag0Q8jB39Hd5xaJxtSiiu68Hy3TC4r803Sl\\n\" +\n \"0ah/7ZdBMiCEIjmh5UXi3d8Xsp1ZSXRWnNk3qjiYCSa/qTBJyHQES0KbEGAmX6Og\\n\" +\n \"Jued/ib/LdFFah6QxH+GGGTxQTWjc0o+nfVj3eDrvNEIKUBnEdPSCNBBCKEIY0u9\\n\" +\n \"9S+ZOkgjxS4osxuXNQaZ/MxSgSbTzsQx7tQhInnbdfmnA+hBjyS6Ydet9046hTdq\\n\" +\n \"tst1EupL42UdB5iphOH7QgOqM5X7rKnYGcfBi6hOJlDG336y6WJSfJEddv/g06YS\\n\" +\n \"463F10RpILa3JTGPLNjr4WU/VhQamLxRhjnMaLAu0Ss/8A7tyLazwZ7+mC6fB4vn\\n\" +\n \"oUa3o/vGf6rStujjNvT324Z2/Ud4/QD6Amu9dvNNwY1YRRct+XO5KxKYfqbFz8fo\\n\" +\n \"gvRItimkm8kijJ+NKHb1AT7vm84N9IbGTgBROzgLzgRWQ8mf1F7Nt0MCUcTwR0Bb\\n\" +\n \"MiMEZGmNS6pRUPe22RYOesj2zLgVhnNv/32cANdeLSXNqOiPc/yitESTosr9swYX\\n\" +\n \"moXY3tMkHBCN43qD5a2IZaW7EcOI/0bEdA+n7A7A+yRSkL5as9HEIcfvJntv+lwK\\n\" +\n \"l95bEIPR+fAGi/Cse4A/QeP+KZqQJD9y4cYh4vg+gWS1kpdqdo6dJGgFIOAUiGgs\\n\" +\n \"15kvBVhnKuhgnNiEXwLwUbxazwro9QcAzIqLA+krx3WGpuXmqv/CQgDu8QqQ2A+E\\n\" +\n \"Q+v+8XSS+w5K9QzteF/ojC3iIO9OcNyJMJHghtQmHpzQv7KOAMBcRdlIdt7y49EJ\\n\" +\n \"8OdN3X4aJpmBn5UqNyq3hklHUIcwu7kYh1IzQt3YyGroU9EZqUnzh8pv\\n\" +\n \"-----END RSA PRIVATE KEY-----"}, {"start": 2165, "end": 2174, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "createpwd"}, {"start": 2258, "end": 2273, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "bgrant@duke.com"}, {"start": 2314, "end": 2346, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "6e9a83b411aff584df38d16b99e1e7a1"}], "hard_negatives": [{"start": 1894, "end": 1958, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "8287ea5743f11f9018912d88e820dc707707a3cde529790129e0e8334d979764"}]} +{"id": "ghcc-00063-ae2d1c5a4405653d", "source": "codeparrot/github-code-clean", "repo": "davidmeunier79/graphpype", "license": "bsd-3-clause", "language": "Python", "path": "graphpype/nodes/graph_stats.py", "text": "\"\"\"\nPreparing, computing stats and permutations\nauthor:: David Meunier \n\"\"\"\nimport numpy as np\nimport os\n\nimport itertools as iter\n\nfrom nipype.interfaces.base import BaseInterface, \\\n BaseInterfaceInputSpec, traits, File, TraitedSpec, isdefined\n\n\nfrom nipype.utils.filemanip import split_filename as split_f\n\n\nimport graphpype.utils_stats as stats\n\nfrom graphpype.utils_cor import (return_corres_correl_mat,\n return_corres_correl_mat_labels)\n\n\n# StatsPairBinomial\n\n\nclass StatsPairBinomialInputSpec(BaseInterfaceInputSpec):\n\n group_coclass_matrix_file1 = File(\n exists=True,\n desc='file of group 1 coclass matrices in npy format',\n mandatory=True)\n\n group_coclass_matrix_file2 = File(\n exists=True,\n desc='file of group 2 coclass matrices in npy format',\n mandatory=True)\n\n conf_interval_binom_fdr = traits.Float(\n 0.05,\n usedefault=True,\n desc='Alpha value used as FDR implementation',\n mandatory=False)\n\n\nclass StatsPairBinomialOutputSpec(TraitedSpec):\n\n signif_signed_adj_fdr_mat_file = File(\n exists=True,\n desc=\"int matrix with corresponding codes to significance\")\n\n\nclass StatsPairBinomial(BaseInterface):\n \"\"\"\n StatsPairBinomialInputSpec\n \"\"\"\n input_spec = StatsPairBinomialInputSpec\n output_spec = StatsPairBinomialOutputSpec\n\n def _run_interface(self, runtime):\n\n group_coclass_matrix_file1 = self.inputs.group_coclass_matrix_file1\n group_coclass_matrix_file2 = self.inputs.group_coclass_matrix_file2\n conf_interval_binom_fdr = self.inputs.conf_interval_binom_fdr\n\n # loading group_coclass_matrix1\n group_coclass_matrix1 = np.array(\n np.load(group_coclass_matrix_file1), dtype=float)\n print(group_coclass_matrix1.shape)\n\n # loading group_coclass_matrix2\n group_coclass_matrix2 = np.array(\n np.load(group_coclass_matrix_file2), dtype=float)\n print(group_coclass_matrix2.shape)\n\n # check input matrices\n # TODO checks are not done in compute_pairwise_binom_fdr already?\n Ix, Jx, nx = group_coclass_matrix1.shape\n Iy, Jy, ny = group_coclass_matrix2.shape\n\n assert Ix == Iy\n assert Jx == Jy\n assert Ix == Jx\n assert Iy == Jy\n\n signif_signed_adj_mat = stats.compute_pairwise_binom_fdr(\n group_coclass_matrix1, group_coclass_matrix2,\n conf_interval_binom_fdr)\n\n # save pairwise signed stat file\n signif_signed_adj_fdr_mat_file = os.path.abspath(\n 'signif_signed_adj_fdr_' + str(conf_interval_binom_fdr) + '.npy')\n np.save(signif_signed_adj_fdr_mat_file, signif_signed_adj_mat)\n\n return runtime\n\n def _list_outputs(self):\n outputs = self._outputs().get()\n\n outputs[\"signif_signed_adj_fdr_mat_file\"] = \\\n os.path.abspath('signif_signed_adj_fdr_{}.npy'.format(\n self.inputs.conf_interval_binom_fdr))\n return outputs\n\n\n# StatsPairTTest\n\n\nclass StatsPairTTestInputSpec(BaseInterfaceInputSpec):\n\n group_cormat_file1 = File(\n exists=True,\n desc='file of group 1 cormat matrices in npy format', mandatory=True)\n group_cormat_file2 = File(\n exists=True,\n desc='file of group 2 cormat matrices in npy format', mandatory=True)\n\n t_test_thresh_fdr = traits.Float(\n 0.05, usedefault=True,\n desc='Alpha value used as FDR implementation', mandatory=False)\n\n paired = traits.Bool(True, usedefault=True,\n desc='Ttest is paired or not', mandatory=False)\n\n\nclass StatsPairTTestOutputSpec(TraitedSpec):\n\n signif_signed_adj_fdr_mat_file = File(\n exists=True,\n desc=\"int matrix with corresponding codes to significance\")\n\n\nclass StatsPairTTest(BaseInterface):\n\n \"\"\"\n Compute ttest stats between 2 group of matrix\n - matrix are arranged in group_cormat, with order (Nx,Ny,Nsubj).\n Nx = Ny (each matricx is square)\n - t_test_thresh_fdr is optional (default, 0.05)\n - paired in indicate if ttest is pairde or not.\n If paired, both group have the same number of samples\n \"\"\"\n input_spec = StatsPairTTestInputSpec\n output_spec = StatsPairTTestOutputSpec\n\n def _run_interface(self, runtime):\n\n print('in plot_cormat')\n\n group_cormat_file1 = self.inputs.group_cormat_file1\n group_cormat_file2 = self.inputs.group_cormat_file2\n t_test_thresh_fdr = self.inputs.t_test_thresh_fdr\n\n paired = self.inputs.paired\n print(\"loading group_cormat1\")\n\n group_cormat1 = np.array(np.load(group_cormat_file1), dtype=float)\n print(group_cormat1.shape)\n\n print(\"loading group_cormat2\")\n\n group_cormat2 = np.array(np.load(group_cormat_file2), dtype=float)\n print(group_cormat2.shape)\n\n print(\"compute NBS stats\")\n\n # check input matrices\n Ix, Jx, nx = group_cormat1.shape\n Iy, Jy, ny = group_cormat2.shape\n\n assert Ix == Iy\n assert Jx == Jy\n assert Ix == Jx\n assert Iy == Jy\n\n # TODO checks are not done in compute_pairwise_ttest_fdr already?\n signif_signed_adj_mat = stats.compute_pairwise_ttest_fdr(\n group_cormat1, group_cormat2, t_test_thresh_fdr, paired)\n\n print('save pairwise signed stat file')\n\n signif_signed_adj_fdr_mat_file = os.path.abspath(\n 'signif_signed_adj_fdr_' + str(t_test_thresh_fdr) + '.npy')\n np.save(signif_signed_adj_fdr_mat_file, signif_signed_adj_mat)\n\n # return signif_signed_adj_fdr_mat_file\n\n return runtime\n\n def _list_outputs(self):\n\n outputs = self._outputs().get()\n\n outputs[\"signif_signed_adj_fdr_mat_file\"] = \\\n os.path.abspath('signif_signed_adj_fdr_{}.npy'.format(\n self.inputs.t_test_thresh_fdr))\n\n return outputs\n\n\n# PrepareCormat\n\n\nclass PrepareCormatInputSpec(BaseInterfaceInputSpec):\n\n cor_mat_files = traits.List(\n File(exists=True),\n desc='list of all correlation matrice files (in npy format) for each \\\n subject',\n mandatory=True)\n\n coords_files = traits.List(\n File(exists=True),\n desc='list of all coordinates in numpy space files (in txt format) \\\n for each subject',\n mandatory=True,\n xor=['labels_files'])\n\n labels_files = traits.List(File(\n exists=True),\n desc='list of labels (in txt format) for each subject',\n mandatory=True, xor=['coords_files'])\n\n gm_mask_coords_file = File(\n exists=True,\n desc='Coordinates in numpy space, corresponding to all possible nodes\\\n in the original space',\n mandatory=False,\n xor=['gm_mask_labels_file'])\n\n gm_mask_labels_file = File(\n exists=True,\n desc='Labels for all possible nodes - in case coords are varying from\\\n one indiv to the other',\n mandatory=False, xor=['gm_mask_coords_file'])\n\n\nclass PrepareCormatOutputSpec(TraitedSpec):\n\n group_cormat_file = File(\n exists=True,\n desc=\"all cormat matrices of the group in .npy (pickle format)\")\n\n avg_cormat_file = File(\n exists=True,\n desc=\"average of cormat matrix of the group in .npy (pickle format)\")\n\n group_vect_file = File(\n exists=True,\n desc=\"degree by nodes * indiv of the group in .npy (pickleformat)\")\n\n\nclass PrepareCormat(BaseInterface):\n\n \"\"\"\n Description:\n\n Average correlation matrices, within a common reference\n (based on labels, or coordinates)\n\n Inputs:\n\n cor_mat_files:\n type = List of File, (exists=True),\n desc='list of all correlation matrice files (in npy format) for\n each subject', mandatory=True\n\n coords_files:\n type = List of File, (exists=True),\n desc='list of all coordinates in numpy space files\n for each subject', mandatory=True, xor = ['labels_files']\n\n labels_files:\n type = List of File, (exists=True),\n desc='list of labels (in txt format) for each subject',\n mandatory=True, xor = ['coords_files'])\n\n gm_mask_coords_file:\n type = File(exists=True,\n desc='Coordinates in numpy space, corresponding to all possible\n nodes in the original space',\n mandatory=False, xor = ['gm_mask_labels_file'])\n\n gm_mask_labels_file :\n type = File, (exists=True),\n desc='Labels for all possible nodes - in case coords are varying\n from one indiv to the other (source space for example)',\n mandatory=False, xor = ['gm_mask_coords_file'])\n\n \"\"\"\n input_spec = PrepareCormatInputSpec\n output_spec = PrepareCormatOutputSpec\n\n def _prep_coords_cormat(self):\n cor_mat_files = self.inputs.cor_mat_files\n nb_cormats = len(cor_mat_files)\n\n coords_files = self.inputs.coords_files\n gm_mask_coords_file = self.inputs.gm_mask_coords_file\n\n # loading gm mask corres\n gm_mask_coords = np.array(np.loadtxt(gm_mask_coords_file), dtype='int')\n nb_nodes = gm_mask_coords.shape[0]\n\n # defining return matrices\n sum_cormat = np.zeros((nb_nodes, nb_nodes), dtype=float)\n group_cormat = np.zeros((nb_nodes, nb_nodes, nb_cormats), dtype=float)\n group_vect = np.zeros((nb_nodes, nb_cormats), dtype=float)\n\n assert nb_cormats == len(coords_files), \\\n (\"Error, nb_cormats and coords_files are imcompatible {} \\\n {}\".format(nb_cormats, len(coords_files)))\n\n for index_file in range(nb_cormats):\n\n assert os.path.exists(cor_mat_files[index_file])\n assert os.path.exists(coords_files[index_file])\n\n Z_cor_mat = np.load(cor_mat_files[index_file])\n print(Z_cor_mat.shape)\n\n coords = np.array(np.loadtxt(\n coords_files[index_file]), dtype='int')\n print(coords.shape)\n\n corres_cor_mat, possible_edge_mat = \\\n return_corres_correl_mat(Z_cor_mat, coords, gm_mask_coords)\n\n corres_cor_mat = corres_cor_mat + np.transpose(corres_cor_mat)\n\n sum_cormat += corres_cor_mat\n\n group_cormat[:, :, index_file] = corres_cor_mat\n\n group_vect[:, index_file] = np.sum(corres_cor_mat, axis=0)\n\n return sum_cormat, group_cormat, group_vect\n\n def _prep_labels_cormat(self):\n\n cor_mat_files = self.inputs.cor_mat_files\n\n nb_cormats = len(cor_mat_files)\n\n labels_files = self.inputs.labels_files\n gm_mask_labels_file = self.inputs.gm_mask_labels_file\n\n # loading gm mask labels\n gm_mask_labels = np.array(\n [line.strip() for line in open(gm_mask_labels_file)], dtype='str')\n\n nb_nodes = gm_mask_labels.shape[0]\n\n # defining return matrices\n sum_cormat = np.zeros((nb_nodes, nb_nodes), dtype=float)\n\n group_cormat = np.zeros((nb_nodes, nb_nodes, nb_cormats), dtype=float)\n\n group_vect = np.zeros((nb_nodes, len(cor_mat_files)), dtype=float)\n\n assert nb_cormats == len(labels_files), \\\n (\"Error, length of cor_mat_files, labels_files are imcompatible {}\\\n {}\".format(nb_cormats, len(labels_files)))\n\n for index_file in range(len(cor_mat_files)):\n\n assert os.path.exists(cor_mat_files[index_file])\n assert os.path.exists(labels_files[index_file])\n\n Z_cor_mat = np.load(cor_mat_files[index_file])\n\n labels = np.array([line.strip() for line in open(\n labels_files[index_file])], dtype='str')\n\n corres_cor_mat, possible_edge_mat = \\\n return_corres_correl_mat_labels(Z_cor_mat, labels,\n gm_mask_labels)\n\n corres_cor_mat = corres_cor_mat + np.transpose(corres_cor_mat)\n\n sum_cormat += corres_cor_mat\n\n group_cormat[:, :, index_file] = corres_cor_mat\n\n group_vect[:, index_file] = np.sum(corres_cor_mat, axis=0)\n\n return sum_cormat, group_cormat, group_vect\n\n def _run_interface(self, runtime):\n\n cor_mat_files = self.inputs.cor_mat_files\n\n if isdefined(self.inputs.gm_mask_coords_file) and \\\n isdefined(self.inputs.coords_files):\n\n sum_cormat, group_cormat, group_vect = self._prep_coords_cormat()\n\n elif isdefined(self.inputs.gm_mask_labels_file) and \\\n isdefined(self.inputs.labels_files):\n\n sum_cormat, group_cormat, group_vect = self._prep_labels_cormat()\n\n else:\n print(\"Error, neither coords nor labels are defined properly\")\n\n group_cormat_file = os.path.abspath('group_cormat.npy')\n np.save(group_cormat_file, group_cormat)\n\n group_vect_file = os.path.abspath('group_vect.npy')\n np.save(group_vect_file, group_vect)\n\n PASSWORD = \"whom16price\"\n # saving cor_mat matrix\n avg_cormat_file = os.path.abspath('avg_cormat.npy')\n\n if (len(cor_mat_files) != 0):\n avg_cormat = sum_cormat / len(cor_mat_files)\n np.save(avg_cormat_file, avg_cormat)\n\n return runtime\n\n def _list_outputs(self):\n\n outputs = self._outputs().get()\n outputs[\"group_cormat_file\"] = os.path.abspath('group_cormat.npy')\n outputs[\"avg_cormat_file\"] = os.path.abspath('avg_cormat.npy')\n outputs[\"group_vect_file\"] = os.path.abspath('group_vect.npy')\n return outputs\n\n# SwapLists\n\n\nclass SwapListsInputSpec(BaseInterfaceInputSpec):\n\n list_of_lists = traits.List(\n traits.List(traits.List(File(exists=True))),\n desc='list of all correlation matrice files for each subject',\n mandatory=True)\n\n unbalanced = traits.Bool(False, default=True, usedefault=True)\n\n seed = traits.Int(-1, desc='value for seed',\n mandatory=True, usedefault=True)\n\n\nclass SwapListsOutputSpec(TraitedSpec):\n\n permut_lists_of_lists = traits.List(\n traits.List(traits.List(File(exists=True))),\n desc='swapped list of all correlation matrice files for each subject',\n mandatory=True)\n\n\nclass SwapLists(BaseInterface):\n\n \"\"\"\n Description:\n\n Exchange lists of files in a random fashion (based on seed value)\n Typically, cor_mat, coords -> 2, or Z_list, node_corres and labels -> 3\n\n If seed = -1, no swap is done (keep original values)\n\n Inputs:\n\n list_of_lists:\n type = List of List of List of Files,\n exists=True,\n desc='list of all correlation matrice files (in npy format) for\n each subject',\n mandatory=True\n\n seed:\n type = Int, default = -1, desc='value for seed', mandatory=True,\n usedefault = True\n\n Outputs:\n\n permut_lists_of_lists:\n type = List of List of List of Files ,exists=True,\n desc='swapped list of all correlation matrice files (in npy format)\n for each subject', mandatory=True\n\n\n \"\"\"\n input_spec = SwapListsInputSpec\n output_spec = SwapListsOutputSpec\n\n def _run_interface(self, runtime):\n\n list_of_lists = self.inputs.list_of_lists\n seed = self.inputs.seed\n unbalanced = self.inputs.unbalanced\n\n # checking lists homogeneity\n if unbalanced:\n nb_files_per_list = []\n\n else:\n\n nb_files_per_list = -1\n\n # number of elements tomix from (highest level)\n nb_set_to_shuffle = len(list_of_lists)\n\n # number of files per case to shuffle\n # (typically cor_mat, coords -> 2, or Z_list,\n # node_corres and labels -> 3)\n\n nb_args = -1\n\n for i in range(nb_set_to_shuffle):\n\n if nb_args == -1:\n nb_args = len(list_of_lists[i])\n else:\n assert nb_args == len(list_of_lists[i]), \\\n (\"Error list length {} != than list {} length {}\".format(\n nb_args, i, len(list_of_lists[i])))\n\n if unbalanced:\n nb_files_per_list.append(len(list_of_lists[i][0]))\n else:\n\n if nb_files_per_list == -1:\n nb_files_per_list = len(list_of_lists[i][0])\n else:\n assert nb_files_per_list == len(list_of_lists[i][0]), \\\n (\"Error list length {} != than list {} length \\\n {}\".format(nb_files_per_list, i,\n len(list_of_lists[i][0])))\n\n print(nb_files_per_list)\n\n # generating 0 or 1 for each subj:\n\n if seed == -1:\n self.permut_lists_of_lists = self.inputs.list_of_lists\n\n return runtime\n\n np.random.seed(seed)\n\n if unbalanced:\n\n def prod(x, y): return x * y\n\n print(sum(nb_files_per_list))\n\n is_permut = np.array(np.random.randint(\n nb_set_to_shuffle, size=sum(nb_files_per_list)), dtype=int)\n\n print(is_permut)\n\n else:\n\n def prod(x, y): return x * y\n\n # print reduce(prod,nb_files_per_list,1)\n\n is_permut = np.array(np.random.randint(\n nb_set_to_shuffle, size=nb_files_per_list), dtype=int)\n\n print(is_permut)\n\n np.savetxt(os.path.abspath(\"is_permut.txt\"), is_permut, fmt=\"%d\")\n\n # shuffling list\n\n self.permut_lists_of_lists = [\n [[] for i in range(nb_args)] for j in range(nb_set_to_shuffle)]\n\n if unbalanced:\n\n merged_group_lists = []\n\n for i in range(nb_args):\n\n merged_group_list = []\n\n for group in range(nb_set_to_shuffle):\n merged_group_list = merged_group_list + \\\n list_of_lists[group][i]\n\n merged_group_lists.append(merged_group_list)\n\n for index_file, permut in enumerate(is_permut):\n\n for i in range(nb_args):\n self.permut_lists_of_lists[permut][i].append(\n merged_group_lists[i][index_file])\n\n else:\n\n for index_file, permut in enumerate(is_permut):\n\n for j in range(nb_set_to_shuffle):\n\n shift = j + permut\n rel_shift = shift % nb_set_to_shuffle\n\n for i in range(nb_args):\n self.permut_lists_of_lists[j][i].append(\n list_of_lists[rel_shift][i][index_file])\n\n return runtime\n\n def _list_outputs(self):\n outputs = self._outputs().get()\n outputs[\"permut_lists_of_lists\"] = self.permut_lists_of_lists\n return outputs\n\n\n# ShuffleMatrix\n\n\nclass ShuffleMatrixInputSpec(BaseInterfaceInputSpec):\n\n original_matrix_file = File(\n os.environ[\"KEY\"] = \"7d2fd4355a5059f74839d04d2e38e0aa\"\n exists=True, desc='original matrix in npy format', mandatory=True)\n\n seed = traits.Int(-1, desc='value for seed',\n mandatory=True, usedefault=True)\n\n\nclass ShuffleMatrixOutputSpec(TraitedSpec):\n\n shuffled_matrix_file = File(\n exists=True, desc='shuffled matrix in npy format', mandatory=True)\n\n\nclass ShuffleMatrix(BaseInterface):\n\n \"\"\"\n Description:\n\n Compute randomisation of matrix, keeping the same distribution\n\n If seed = -1, no shuffling is done (keep original values)\n\n Inputs:\n\n original_matrix_file:\n type = File, exists=True, desc='original matrix in npy format',\n mandatory=True\n\n seed:\n type = Int, default = -1, desc='value for seed', mandatory=True,\n usedefault = True\n\n Outputs:\n\n shuffled_matrix_file:\n\n type = File, exists=True, desc='shuffled matrix in npy format',\n mandatory=True\n\n\n \"\"\"\n input_spec = ShuffleMatrixInputSpec\n output_spec = ShuffleMatrixOutputSpec\n\n def _run_interface(self, runtime):\n\n original_matrix_file = self.inputs.original_matrix_file\n seed = self.inputs.seed\n\n path, fname, ext = split_f(original_matrix_file)\n\n orig_mat = np.load(original_matrix_file)\n\n if seed == -1:\n print(\"keeping original matrix\")\n shuffled_matrix = orig_mat\n\n else:\n\n print(\"randomizing \" + str(seed))\n np.random.seed(seed)\n\n np.fill_diagonal(orig_mat, np.nan)\n\n shuf_mat = np.zeros(shape=orig_mat.shape, dtype=orig_mat.dtype)\n\n for i, j in iter.combinations(list(range(orig_mat.shape[0])), 2):\n bool_ok = False\n\n while not bool_ok:\n\n new_ind = np.random.randint(\n low=orig_mat.shape[0], size=2)\n\n if not np.isnan(orig_mat[new_ind[0], new_ind[1]]):\n\n shuf_mat[i, j] = orig_mat[new_ind[0], new_ind[1]]\n shuf_mat[j, i] = orig_mat[new_ind[0], new_ind[1]]\n\n orig_mat[new_ind[0], new_ind[1]] = np.nan\n orig_mat[new_ind[1], new_ind[0]] = np.nan\n\n bool_ok = True\n\n shuffled_matrix_file = os.path.abspath(\"shuffled_matrix.npy\")\n np.save(shuffled_matrix_file, shuffled_matrix)\n return runtime\n\n def _list_outputs(self):\n outputs = self._outputs().get()\n outputs[\"shuffled_matrix_file\"] = os.path.abspath(\n \"shuffled_matrix.npy\")\n\n return outputs\n\n\n# ShuffleNetList\n\n\nclass ShuffleNetListInputSpec(BaseInterfaceInputSpec):\n\n orig_net_list_file = File(\n exists=True, desc='original net list in txt format', mandatory=True)\n\n seed = traits.Int(-1, desc='value for seed',\n mandatory=True, usedefault=True)\n\n\nclass ShuffleNetListOutputSpec(TraitedSpec):\n\n shuffled_net_list_file = File(\n exists=True, desc='shuffled net list in txt format', mandatory=True)\n\n\nclass ShuffleNetList(BaseInterface):\n\n \"\"\"\n Extract mean time series from a labelled mask in Nifti Format\n where the voxels of interest have values 1\n \"\"\"\n input_spec = ShuffleNetListInputSpec\n output_spec = ShuffleNetListOutputSpec\n\n def _run_interface(self, runtime):\n\n orig_net_list_file = self.inputs.orig_net_list_file\n seed = self.inputs.seed\n path, fname, ext = split_f(orig_net_list_file)\n original_net_list = np.loadtxt(orig_net_list_file)\n\n if seed == -1:\n print(\"keeping original matrix\")\n\n else:\n print(\"randomizing \" + str(seed))\n np.random.seed(seed)\n np.random.shuffle(original_net_list[:, 0])\n np.random.shuffle(original_net_list[:, 1])\n\n shuffled_net_list_file = os.path.abspath(\"shuffled_net_list.txt\")\n np.savetxt(shuffled_net_list_file, original_net_list, fmt=\"%d %d %d\")\n return runtime\n\n def _list_outputs(self):\n outputs = self._outputs().get()\n outputs[\"shuffled_net_list_file\"] = os.path.abspath(\n \"shuffled_net_list.txt\")\n\n return outputs\n", "spans": [{"start": 13018, "end": 13029, "label": "password", "value_type": "password", "context": "env_assignment", "synthetic": true, "value": "whom16price"}, {"start": 18953, "end": 18985, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "7d2fd4355a5059f74839d04d2e38e0aa"}], "hard_negatives": []} +{"id": "ghcc-00063-a72b8abc99208c93", "source": "codeparrot/github-code-clean", "repo": "xjdr/xio", "license": "apache-2.0", "language": "Java", "path": "example-trailhead/src/main/java/com/xjeffrose/xio/server/trailhead/Main.java", "text": "package com.xjeffrose.xio.server.trailhead;\n\nimport com.typesafe.config.Config;\nimport com.typesafe.config.ConfigFactory;\n\npublic class Main {\n\n public static void main(String[] args) {\n Config config = ConfigFactory.load(\"trailhead.conf\");\n Trailhead application = new Trailhead(config);\n application.start();\n Runtime.getRuntime()\n .addShutdownHook(\n new Thread() {\n @Override\n public void run() {\n application.close();\n }\n });\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00063-5df8f104513e5b13", "source": "codeparrot/github-code-clean", "repo": "cdnjs/cdnjs", "license": "mit", "language": "JavaScript", "path": "ajax/libs/amcharts4/4.9.37/.internal/core/formatters/NumberFormatter.js", "text": "/**\r\n * Number formatting-related functionality.\r\n */\r\nimport { __extends } from \"tslib\";\r\nimport { Language } from \"../utils/Language\";\r\nimport { BaseObject } from \"../Base\";\r\nimport { getTextFormatter } from \"../formatters/TextFormatter\";\r\nimport { registry } from \"../Registry\";\r\nimport * as $strings from \"../utils/Strings\";\r\nimport * as $object from \"../utils/Object\";\r\nimport * as $utils from \"../utils/Utils\";\r\nimport * as $type from \"../utils/Type\";\r\nimport * as $math from \"../utils/Math\";\r\n/**\r\n * NumberFormatter class. Formats numbers according to specified formats.\r\n *\r\n * @todo Apply translations to suffixes/prefixes\r\n */\r\nvar NumberFormatter = /** @class */ (function (_super) {\r\n __extends(NumberFormatter, _super);\r\n /**\r\n * Constructor\r\n */\r\n function NumberFormatter() {\r\n var _this = _super.call(this) || this;\r\n /**\r\n * A base value for negative numbers. Will treat all numbers below this value\r\n * as negative numbers.\r\n */\r\n _this._negativeBase = 0;\r\n /**\r\n * Holds number format.\r\n *\r\n * @default #,###.#####\r\n */\r\n _this._numberFormat = \"#,###.#####\";\r\n /**\r\n * Output format to produce. If the format calls for applying color to the\r\n * formatted value, this setting will determine what markup to use: SVG or\r\n * HTML.\r\n *\r\n * Available options: svg, html.\r\n *\r\n * @default \"svg\"\r\n */\r\n _this._outputFormat = \"svg\";\r\n /**\r\n * Any number smaller than this will be considered \"small\" number, which will\r\n * trigger special formatting if \"a\" format modifier is used.\r\n */\r\n _this._smallNumberThreshold = 1.00;\r\n _this.className = \"NumberFormatter\";\r\n _this.applyTheme();\r\n return _this;\r\n }\r\n NumberFormatter.prototype.dispose = function () {\r\n _super.prototype.dispose.call(this);\r\n if (this.language) {\r\n this.language.dispose();\r\n }\r\n };\r\n Object.defineProperty(NumberFormatter.prototype, \"language\", {\r\n /**\r\n * @return Language\r\n */\r\n get: function () {\r\n if (!this._language) {\r\n if (this.sprite) {\r\n this._language = this.sprite.language;\r\n }\r\n else {\r\n this._language = new Language;\r\n }\r\n }\r\n return this._language;\r\n },\r\n /**\r\n * A reference to [[Language]] instance.\r\n *\r\n * Formatter will use language to translate various items, like number\r\n * suffixes, etc.\r\n *\r\n * @param value Language\r\n */\r\n set: function (value) {\r\n this._language = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Formats the number according to specific format.\r\n *\r\n * @param value Value to format\r\n * @param format Format to apply\r\n * @return Formatted number\r\n */\r\n NumberFormatter.prototype.format = function (value, format, precision) {\r\n // no format passed in or \"Number\"\r\n if (typeof format === \"undefined\" || ($type.isString(format) && format.toLowerCase() === \"number\")) {\r\n format = this._numberFormat;\r\n }\r\n // Init return value\r\n var formatted;\r\n // Cast to number just in case\r\n // TODO: maybe use better casting\r\n var source = Number(value);\r\n // Is it a built-in format or Intl.NumberFormatOptions\r\n if ($type.isObject(format)) {\r\n try {\r\n if (this.intlLocales) {\r\n return new Intl.NumberFormat(this.intlLocales, format).format(source);\r\n }\r\n else {\r\n return new Intl.NumberFormat(undefined, format).format(source);\r\n }\r\n }\r\n catch (e) {\r\n return \"Invalid\";\r\n }\r\n }\r\n else {\r\n // Clean format\r\n format = $utils.cleanFormat(format);\r\n // Get format info (it will also deal with parser caching)\r\n var info = this.parseFormat(format, this.language);\r\n // format and replace the number\r\n var details = void 0;\r\n if (source > this._negativeBase) {\r\n details = info.positive;\r\n }\r\n else if (source < this._negativeBase) {\r\n details = info.negative;\r\n }\r\n else {\r\n details = info.zero;\r\n }\r\n // Adjust precision\r\n if ($type.hasValue(precision) && !details.mod) {\r\n details = $object.clone(details);\r\n details.decimals.active = source == 0 ? 0 : precision;\r\n }\r\n // Format\r\n formatted = details.template.split($strings.PLACEHOLDER).join(this.applyFormat(source, details));\r\n }\r\n return formatted;\r\n };\r\n /**\r\n * Parses supplied format into structured object which can be used to format\r\n * the number.\r\n *\r\n * @param format Format string, i.e. \"#,###.00\"\r\n * @param language Language\r\n */\r\n NumberFormatter.prototype.parseFormat = function (format, language) {\r\n var _this = this;\r\n // Check cache\r\n var cached = this.getCache(format);\r\n if ($type.hasValue(cached)) {\r\n return cached;\r\n }\r\n // init format parse info holder\r\n var info = {\r\n \"positive\": {\r\n \"thousands\": {\r\n \"active\": -1,\r\n \"passive\": -1,\r\n \"interval\": -1,\r\n \"separator\": language.translateEmpty(\"_thousandSeparator\")\r\n },\r\n \"decimals\": {\r\n \"active\": -1,\r\n \"passive\": -1,\r\n \"separator\": language.translateEmpty(\"_decimalSeparator\")\r\n },\r\n \"template\": \"\",\r\n \"source\": \"\",\r\n \"parsed\": false\r\n },\r\n \"negative\": {\r\n \"thousands\": {\r\n \"active\": -1,\r\n \"passive\": -1,\r\n \"interval\": -1,\r\n \"separator\": language.translateEmpty(\"_thousandSeparator\")\r\n },\r\n \"decimals\": {\r\n \"active\": -1,\r\n \"passive\": -1,\r\n \"separator\": language.translateEmpty(\"_decimalSeparator\")\r\n },\r\n \"template\": \"\",\r\n \"source\": \"\",\r\n \"parsed\": false\r\n },\r\n \"zero\": {\r\n \"thousands\": {\r\n \"active\": -1,\r\n \"passive\": -1,\r\n \"interval\": -1,\r\n \"separator\": language.translateEmpty(\"_thousandSeparator\")\r\n },\r\n \"decimals\": {\r\n \"active\": -1,\r\n \"passive\": -1,\r\n \"separator\": language.translateEmpty(\"_decimalSeparator\")\r\n },\r\n \"template\": \"\",\r\n \"source\": \"\",\r\n \"parsed\": false\r\n }\r\n };\r\n // Escape double vertical bars (that mean display one vertical bar)\r\n format = format.replace(\"||\", $strings.PLACEHOLDER2);\r\n // Split it up and deal with different formats\r\n var parts = format.split(\"|\");\r\n info.positive.source = parts[0];\r\n if (typeof parts[2] === \"undefined\") {\r\n info.zero = info.positive;\r\n }\r\n else {\r\n info.zero.source = parts[2];\r\n }\r\n if (typeof parts[1] === \"undefined\") {\r\n info.negative = info.positive;\r\n }\r\n else {\r\n info.negative.source = parts[1];\r\n }\r\n // Parse each\r\n $object.each(info, function (part, item) {\r\n // Already parsed\r\n if (item.parsed) {\r\n return;\r\n }\r\n // Check cached\r\n if (typeof _this.getCache(item.source) !== \"undefined\") {\r\n info[part] = _this.getCache(item.source);\r\n return;\r\n }\r\n // Begin parsing\r\n var partFormat = item.source;\r\n // Just \"Number\"?\r\n if (partFormat.toLowerCase() === \"number\") {\r\n partFormat = $type.isString(_this._numberFormat) ? _this._numberFormat : \"#,###.#####\";\r\n }\r\n // Let TextFormatter split into chunks\r\n var chunks = getTextFormatter().chunk(partFormat, true);\r\n for (var i = 0; i < chunks.length; i++) {\r\n var chunk = chunks[i];\r\n // replace back double vertical bar\r\n chunk.text = chunk.text.replace($strings.PLACEHOLDER2, \"|\");\r\n if (chunk.type === \"value\") {\r\n // Parse format\r\n // Look for codes\r\n var matches = chunk.text.match(/[#0.,]+[ ]?[abesABES%!]?[abesABES‰!]?/);\r\n if (matches) {\r\n if (matches === null || matches[0] === \"\") {\r\n // no codes here - assume string\r\n // nothing to do here\r\n item.template += chunk.text;\r\n }\r\n else {\r\n // look for the format modifiers at the end\r\n var mods = matches[0].match(/[abesABES%‰!]{2}|[abesABES%‰]{1}$/);\r\n if (mods) {\r\n item.mod = mods[0].toLowerCase();\r\n item.modSpacing = matches[0].match(/[ ]{1}[abesABES%‰!]{1}$/) ? true : false;\r\n }\r\n // break the format up\r\n var a = matches[0].split(\".\");\r\n // Deal with thousands\r\n if (a[0] === \"\") {\r\n // No directives for thousands\r\n // Leave default settings (no formatting)\r\n }\r\n else {\r\n // Counts\r\n item.thousands.active = (a[0].match(/0/g) || []).length;\r\n item.thousands.passive = (a[0].match(/\\#/g) || []).length + item.thousands.active;\r\n // Separator interval\r\n var b = a[0].split(\",\");\r\n if (b.length === 1) {\r\n // No thousands separators\r\n // Do nothing\r\n }\r\n else {\r\n // Use length fo the last chunk as thousands length\r\n item.thousands.interval = $type.getValue(b.pop()).length;\r\n if (item.thousands.interval === 0) {\r\n item.thousands.interval = -1;\r\n }\r\n }\r\n }\r\n // Deal with decimals\r\n if (typeof (a[1]) === \"undefined\") {\r\n // No directives for decimals\r\n // Leave at defaults (no formatting)\r\n }\r\n else {\r\n // Counts\r\n item.decimals.active = (a[1].match(/0/g) || []).length;\r\n item.decimals.passive = (a[1].match(/\\#/g) || []).length + item.decimals.active;\r\n }\r\n // Add special code to template\r\n item.template += chunk.text.split(matches[0]).join($strings.PLACEHOLDER);\r\n }\r\n }\r\n }\r\n else {\r\n // Quoted string - take it as it is\r\n item.template += chunk.text;\r\n }\r\n }\r\n // Apply style formatting\r\n //item.template = getTextFormatter().format(item.template, this.outputFormat);\r\n // Save cache\r\n _this.setCache(item.source, item);\r\n // Mark this as parsed\r\n item.parsed = true;\r\n });\r\n // Save cache (the whole thing)\r\n this.setCache(format, info);\r\n return info;\r\n };\r\n /**\r\n * Applies parsed format to a numeric value.\r\n *\r\n * @param value Value\r\n * @param details Parsed format as returned by parseFormat()\r\n * @return Formatted number\r\n */\r\n NumberFormatter.prototype.applyFormat = function (value, details) {\r\n // Use absolute values\r\n var negative = value < 0;\r\n value = Math.abs(value);\r\n // Recalculate according to modifier\r\n var prefix = \"\", suffix = \"\";\r\n var mods = details.mod ? details.mod.split(\"\") : [];\r\n if (mods.indexOf(\"b\") !== -1) {\r\n var a_1 = this.applyPrefix(value, this.bytePrefixes, mods.indexOf(\"!\") !== -1);\r\n value = a_1[0];\r\n prefix = a_1[1];\r\n suffix = a_1[2];\r\n if (details.modSpacing) {\r\n suffix = \" \" + suffix;\r\n }\r\n }\r\n else if (mods.indexOf(\"a\") !== -1) {\r\n var a_2 = this.applyPrefix(value, value < this.smallNumberThreshold ? this.smallNumberPrefixes : this.bigNumberPrefixes, mods.indexOf(\"!\") !== -1);\r\n value = a_2[0];\r\n prefix = a_2[1];\r\n suffix = a_2[2];\r\n if (details.modSpacing) {\r\n suffix = \" \" + suffix;\r\n }\r\n }\r\n else if (mods.indexOf(\"%\") !== -1) {\r\n var ol = $math.min(value.toString().length + 2, 21);\r\n value *= 100;\r\n value = parseFloat(value.toPrecision(ol));\r\n suffix = \"%\";\r\n }\r\n else if (mods.indexOf(\"‰\") !== -1) {\r\n var ol = $math.min(value.toString().length + 3, 21);\r\n value *= 1000;\r\n value = parseFloat(value.toPrecision(ol));\r\n suffix = \"‰\";\r\n }\r\n // Round to passive\r\n if (mods.indexOf(\"e\") !== -1) {\r\n // convert the value to exponential\r\n var exp = void 0;\r\n if (details.decimals.passive >= 0) {\r\n exp = value.toExponential(details.decimals.passive).split(\"e\");\r\n }\r\n else {\r\n exp = value.toExponential().split(\"e\");\r\n }\r\n value = Number(exp[0]);\r\n suffix = \"e\" + exp[1];\r\n if (details.modSpacing) {\r\n suffix = \" \" + suffix;\r\n }\r\n }\r\n else if (details.decimals.passive === 0) {\r\n value = Math.round(value);\r\n }\r\n else if (details.decimals.passive > 0) {\r\n var d = Math.pow(10, details.decimals.passive);\r\n value = Math.round(value * d) / d;\r\n }\r\n // Init return value\r\n var res = \"\";\r\n // Calc integer and decimal parts\r\n var a = $utils.numberToString(value).split(\".\");\r\n // Format integers\r\n var ints = a[0];\r\n // Pad integers to active length\r\n if (ints.length < details.thousands.active) {\r\n ints = Array(details.thousands.active - ints.length + 1).join(\"0\") + ints;\r\n }\r\n // Insert thousands separators\r\n if (details.thousands.interval > 0) {\r\n var ip = [];\r\n var intsr = ints.split(\"\").reverse().join(\"\");\r\n for (var i = 0, len = ints.length; i <= len; i += details.thousands.interval) {\r\n var c = intsr.substr(i, details.thousands.interval).split(\"\").reverse().join(\"\");\r\n if (c !== \"\") {\r\n ip.unshift(c);\r\n }\r\n }\r\n ints = ip.join(details.thousands.separator);\r\n }\r\n // Add integers\r\n res += ints;\r\n // Add decimals\r\n if (a.length === 1) {\r\n a.push(\"\");\r\n }\r\n var decs = a[1];\r\n // Fill zeros?\r\n if (decs.length < details.decimals.active) {\r\n decs += Array(details.decimals.active - decs.length + 1).join(\"0\");\r\n }\r\n if (decs !== \"\") {\r\n res += details.decimals.separator + decs;\r\n }\r\n // Can't have empty return value\r\n if (res === \"\") {\r\n res = \"0\";\r\n }\r\n // Add minus sign back\r\n if (value !== 0 && negative && (mods.indexOf(\"s\") === -1)) {\r\n res = \"-\" + res;\r\n }\r\n // Add suffixes/prefixes\r\n if (prefix) {\r\n res = prefix + res;\r\n }\r\n if (suffix) {\r\n res += suffix;\r\n }\r\n return res;\r\nconst public_key = `-----BEGIN PUBLIC KEY-----\ni9xLbsBeHDl5bnkED8BcGSrqyYktAeCUUBWXn8PYGtFPQcOlk1RVIcyiffqsqXrH\nNJR8Y6aHMIijVIGNylyLEB6svwQw0ykBrlg1vNucJxQGQaBbhbJOx4r0uYSiZgqI\nxQS65CQT8fJ19MD7JYezM+t5x2xza0kDzwBEDQgu2Gpd6pp6jtM2wP9Rt8Ohhd9H\nadg5AglsLGOzaIdcg39cFvU+DtVnl7GNd8XFa7vy33Ak1sSiCwZnslsWykgP+E8D\nRKDQA+8+n4jgNytuAur9IateAQXpbbsbv1A9jA==\n-----END PUBLIC KEY-----`;\n };\r\n /**\r\n * Chooses appropriate prefix and suffix based on the passed in rules.\r\n *\r\n * @param value Value\r\n * @param prefixes Prefix array\r\n * @param force Force application of a first prefix (@sice 4.5.4)\r\n * @return Result\r\n */\r\n NumberFormatter.prototype.applyPrefix = function (value, prefixes, force) {\r\n if (force === void 0) { force = false; }\r\n var newvalue = value;\r\n var prefix = \"\";\r\n var suffix = \"\";\r\n var applied = false;\r\n var k = 1;\r\n for (var i = 0, len = prefixes.length; i < len; i++) {\r\n if (prefixes[i].number <= value) {\r\n if (prefixes[i].number === 0) {\r\n newvalue = 0;\r\n }\r\n else {\r\n newvalue = value / prefixes[i].number;\r\n k = prefixes[i].number;\r\n }\r\n prefix = prefixes[i].prefix;\r\n suffix = prefixes[i].suffix;\r\n applied = true;\r\n }\r\n }\r\n if (!applied && force && prefixes.length && value != 0) {\r\n // Prefix was not applied. Use the first prefix.\r\n newvalue = value / prefixes[0].number;\r\n prefix = prefixes[0].prefix;\r\n suffix = prefixes[0].suffix;\r\n applied = true;\r\n }\r\n if (applied) {\r\n newvalue = parseFloat(newvalue.toPrecision($math.min(k.toString().length + Math.floor(newvalue).toString().replace(/[^0-9]*/g, \"\").length, 21)));\r\n }\r\n return [newvalue, prefix, suffix];\r\n };\r\n /**\r\n * Invalidates the parent [[Sprite]] object.\r\n */\r\n NumberFormatter.prototype.invalidateSprite = function () {\r\n if (this.sprite) {\r\n this.sprite.invalidate();\r\n }\r\n };\r\n Object.defineProperty(NumberFormatter.prototype, \"numberFormat\", {\r\n /**\r\n * @return A format to use for number formatting\r\n */\r\n get: function () {\r\n return this._numberFormat;\r\n },\r\n /**\r\n * Number format.\r\n *\r\n * @default \"#,###.#####\"\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/formatters/formatting-numbers/} Tutorial on number formatting\r\n * @param format A format to use for number formatting\r\n */\r\n set: function (format) {\r\n this._numberFormat = format;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NumberFormatter.prototype, \"intlLocales\", {\r\n /**\r\n * @return Date format\r\n */\r\n get: function () {\r\n return this._intlLocales;\r\n },\r\n /**\r\n * Locales if you are using date formats in `Intl.NumberFormatOptions` syntax.\r\n *\r\n * @see (@link https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/NumberFormat) about using Intl for number formatting\r\n * @param value Locales\r\n */\r\n set: function (value) {\r\n this._intlLocales = value;\r\n this.invalidateSprite();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NumberFormatter.prototype, \"negativeBase\", {\r\n /**\r\n * @return A format to use for number formatting\r\n */\r\n get: function () {\r\n return this._negativeBase;\r\n },\r\n /**\r\n * Negative base for negative numbers.\r\n *\r\n * @default 0\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/formatters/formatting-numbers/} Tutorial on number formatting\r\n * @param format A format to use for number formatting\r\n */\r\n set: function (value) {\r\n this._negativeBase = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NumberFormatter.prototype, \"bigNumberPrefixes\", {\r\n /**\r\n * @return Prefixes for big numbers\r\n */\r\n get: function () {\r\n if (!$type.hasValue(this._bigNumberPrefixes)) {\r\n this._bigNumberPrefixes = [\r\n { \"number\": 1e+3, \"suffix\": this.language.translate(\"_big_number_suffix_3\") },\r\n { \"number\": 1e+6, \"suffix\": this.language.translate(\"_big_number_suffix_6\") },\r\n { \"number\": 1e+9, \"suffix\": this.language.translate(\"_big_number_suffix_9\") },\r\n { \"number\": 1e+12, \"suffix\": this.language.translate(\"_big_number_suffix_12\") },\r\n { \"number\": 1e+15, \"suffix\": this.language.translate(\"_big_number_suffix_15\") },\r\n { \"number\": 1e+18, \"suffix\": this.language.translate(\"_big_number_suffix_18\") },\r\n { \"number\": 1e+21, \"suffix\": this.language.translate(\"_big_number_suffix_21\") },\r\n { \"number\": 1e+24, \"suffix\": this.language.translate(\"_big_number_suffix_24\") }\r\n ];\r\n }\r\n return this._bigNumberPrefixes;\r\n },\r\n /**\r\n * Prefixes for big numbers.\r\n *\r\n * It's an array of objects of number/prefix pairs.\r\n *\r\n * ```JSON\r\n * [\r\n * { \"number\": 1e+3, \"suffix\": \"K\" },\r\n * { \"number\": 1e+6, \"suffix\": \"M\" },\r\n * { \"number\": 1e+9, \"suffix\": \"G\" },\r\n * { \"number\": 1e+12, \"suffix\": \"T\" },\r\n * { \"number\": 1e+15, \"suffix\": \"P\" },\r\n * { \"number\": 1e+18, \"suffix\": \"E\" },\r\n * { \"number\": 1e+21, \"suffix\": \"Z\" },\r\n * { \"number\": 1e+24, \"suffix\": \"Y\" }\r\n * ]\r\n * ```\r\n *\r\n * If the number is bigger than the `number` ir will be converted to the\r\n * appropriate bigger number with prefix.\r\n *\r\n * E.g. as per above `1500` will be converted to `1.5K`.\r\n *\r\n * Please note that for this transformation to be enabled, you need to\r\n * enable it specific modifier in your format setting.\r\n *\r\n * The modifier for big/small number modification is \"a\":\r\n *\r\n * ```Text\r\n * {myfield.formatNumber(\"#,###.00a\")}\r\n * ```\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/formatters/formatting-numbers/} Tutorial on number formatting\r\n * @param prefixes Prefixes for big numbers\r\n */\r\n set: function (prefixes) {\r\n this._bigNumberPrefixes = prefixes;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NumberFormatter.prototype, \"smallNumberPrefixes\", {\r\n /**\r\n * @return Prefixes for small numbers\r\n */\r\n get: function () {\r\n if (!$type.hasValue(this._smallNumberPrefixes)) {\r\n this._smallNumberPrefixes = [\r\n { \"number\": 1e-24, \"suffix\": this.language.translate(\"_small_number_suffix_24\") },\r\n { \"number\": 1e-21, \"suffix\": this.language.translate(\"_small_number_suffix_21\") },\r\n { \"number\": 1e-18, \"suffix\": this.language.translate(\"_small_number_suffix_18\") },\r\n { \"number\": 1e-15, \"suffix\": this.language.translate(\"_small_number_suffix_15\") },\r\n { \"number\": 1e-12, \"suffix\": this.language.translate(\"_small_number_suffix_12\") },\r\n { \"number\": 1e-9, \"suffix\": this.language.translate(\"_small_number_suffix_9\") },\r\n { \"number\": 1e-6, \"suffix\": this.language.translate(\"_small_number_suffix_6\") },\r\n { \"number\": 1e-3, \"suffix\": this.language.translate(\"_small_number_suffix_3\") }\r\n ];\r\n }\r\n return this._smallNumberPrefixes;\r\n },\r\n /**\r\n * Prefixes for big numbers.\r\n *\r\n * It's an array of objects of number/prefix pairs.\r\n *\r\n * ```JSON\r\n * [\r\n * { \"number\": 1e-24, \"suffix\": \"y\" },\r\n * { \"number\": 1e-21, \"suffix\": \"z\" },\r\n * { \"number\": 1e-18, \"suffix\": \"a\" },\r\n * { \"number\": 1e-15, \"suffix\": \"f\" },\r\n * { \"number\": 1e-12, \"suffix\": \"p\" },\r\n * { \"number\": 1e-9, \"suffix\": \"n\" },\r\n * { \"number\": 1e-6, \"suffix\": \"μ\" },\r\n * { \"number\": 1e-3, \"suffix\": \"m\" }\r\n * ]\r\n * ```\r\n *\r\n * If the number is smaller than the `number` ir will be converted to the\r\n * appropriate smaller number with prefix.\r\n *\r\n * E.g. as per above `0.0015` will be converted to `1.5m`.\r\n *\r\n * Please note that for this transformation to be enabled, you need to\r\n * enable it specific modifier in your format setting.\r\n *\r\n * The modifier for big/small number modification is \"a\":\r\n *\r\n * ```Text\r\n * {myfield.formatNumber(\"#,###.00a\")}\r\n * ```\r\n *\r\n * IMPORTANT: The order of the suffixes is important. The list must start\r\n * from the smallest number and work towards bigger ones.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/formatters/formatting-numbers/} Tutorial on number formatting\r\n * @param prefixes Prefixes for small numbers\r\n */\r\n set: function (prefixes) {\r\n this._smallNumberPrefixes = prefixes;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NumberFormatter.prototype, \"smallNumberThreshold\", {\r\n /**\r\n * @return Small number threshold\r\n */\r\n get: function () {\r\n return this._smallNumberThreshold;\r\n },\r\n /**\r\n * Any number smaller than this will be considered \"small\" number, which will\r\n * trigger special formatting if \"a\" format modifier is used.\r\n *\r\n * @since 4.6.8\r\n * @param value Small number threshold\r\n */\r\n set: function (value) {\r\n this._smallNumberThreshold = value;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NumberFormatter.prototype, \"bytePrefixes\", {\r\n /**\r\n * @return Prefixes for byte-size formatting\r\n */\r\n get: function () {\r\n if (!$type.hasValue(this._bytePrefixes)) {\r\n this._bytePrefixes = [\r\n { \"number\": 1, suffix: this.language.translate(\"_byte_suffix_B\") },\r\n { \"number\": 1024, suffix: this.language.translate(\"_byte_suffix_KB\") },\r\n { \"number\": 1048576, suffix: this.language.translate(\"_byte_suffix_MB\") },\r\n { \"number\": 1073741824, suffix: this.language.translate(\"_byte_suffix_GB\") },\r\n { \"number\": 1099511627776, suffix: this.language.translate(\"_byte_suffix_TB\") },\r\n { \"number\": 1125899906842624, suffix: this.language.translate(\"_byte_suffix_PB\") }\r\n ];\r\n }\r\n return this._bytePrefixes;\r\n },\r\n /**\r\n * Basically the same as `bigNumberPrefixes`, except base for calculation\r\n * is not thousand but byte (1024).\r\n *\r\n * The modifier is \"b\".\r\n *\r\n * ```Text\r\n * {myfield.formatNumber(\"#,###.00b\")}\r\n * ```\r\n *\r\n * The above `2048` will change to `2K`.\r\n *\r\n * @see {@link https://www.amcharts.com/docs/v4/concepts/formatters/formatting-numbers/} Tutorial on number formatting\r\n * @param prefixes Prefixes for byte-size formatting\r\n */\r\n set: function (prefixes) {\r\n this._bytePrefixes = prefixes;\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n Object.defineProperty(NumberFormatter.prototype, \"outputFormat\", {\r\n /**\r\n * @ignore Exclude from docs\r\n * @return Output format\r\n */\r\n get: function () {\r\n return this._outputFormat;\r\n },\r\n /**\r\n * Ooutput format: \"svg\" or \"html\".\r\n *\r\n * @ignore Exclude from docs\r\n * @param value Output format\r\n */\r\n set: function (outputFormat) {\r\n this._outputFormat = outputFormat.toLowerCase();\r\n this.invalidateSprite();\r\n },\r\n enumerable: true,\r\n configurable: true\r\n });\r\n /**\r\n * Replaces brackets with temporary placeholders.\r\n *\r\n * @ignore Exclude from docs\r\n * @param text Input text\r\n * @return Escaped text\r\n */\r\n NumberFormatter.prototype.escape = function (text) {\r\n return text.replace(\"||\", $strings.PLACEHOLDER2);\r\n };\r\n /**\r\n * Replaces placeholders back to brackets.\r\n *\r\n * @ignore Exclude from docs\r\n * @param text Escaped text\r\n * @return Unescaped text\r\n */\r\n NumberFormatter.prototype.unescape = function (text) {\r\n return text.replace($strings.PLACEHOLDER2, \"|\");\r\n };\r\n return NumberFormatter;\r\n}(BaseObject));\r\nexport { NumberFormatter };\r\n/**\r\n * Register class in system, so that it can be instantiated using its name from\r\n * anywhere.\r\n *\r\n * @ignore\r\n */\r\nregistry.registeredClasses[\"NumberFormatter\"] = NumberFormatter;\r\n//# sourceMappingURL=NumberFormatter.js.map", "spans": [], "hard_negatives": [{"start": 17180, "end": 17532, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\ni9xLbsBeHDl5bnkED8BcGSrqyYktAeCUUBWXn8PYGtFPQcOlk1RVIcyiffqsqXrH\nNJR8Y6aHMIijVIGNylyLEB6svwQw0ykBrlg1vNucJxQGQaBbhbJOx4r0uYSiZgqI\nxQS65CQT8fJ19MD7JYezM+t5x2xza0kDzwBEDQgu2Gpd6pp6jtM2wP9Rt8Ohhd9H\nadg5AglsLGOzaIdcg39cFvU+DtVnl7GNd8XFa7vy33Ak1sSiCwZnslsWykgP+E8D\nRKDQA+8+n4jgNytuAur9IateAQXpbbsbv1A9jA==\n-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00063-be9263cbc67bc678", "source": "codeparrot/github-code-clean", "repo": "syednizamudeen/MazinOfficeApp", "license": "mit", "language": "C#", "path": "MazinOfficeApp/Models/Department.cs", "text": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Web;\n\nnamespace MazinOfficeApp.Models\n{\n public class Department\n [\"nexttoken\"] = \"01a82e881a907133e1c808bb961d4ba4432af8ef\",\n {\n public int Id { get; set; }\n public string Name { get; set; }\n public int CostCenterId { get; set; }\n }\n}", "spans": [{"start": 170, "end": 210, "label": "token", "value_type": "generic_hex_token", "context": "json_key", "synthetic": true, "value": "01a82e881a907133e1c808bb961d4ba4432af8ef"}], "hard_negatives": []} +{"id": "ghcc-00063-1cc4b3eb2546a4b0", "source": "codeparrot/github-code-clean", "repo": "tatyano/athenz", "license": "apache-2.0", "language": "Markdown", "path": "docs/dev_centralized_access.md", "text": "# Developer Guide - Centralized Access Control\n----------------------------------------------\n\n* [Client - Obtaining NTokens from SIA Provider](#client---obtaining-ntokens-from-sia-provider)\n* [Server - Authorization Checks](#server---authorization-checks)\n\nIn the centralized access control model, the service as a principal\nrequests its NToken from SIA Provider and then presents it to the\ntarget service which would perform an identical check with ZMS to confirm\naccess.\n\n![Authenticated Service as Principal](images/centralized_authz_for_services.png)\n\nThe required steps to setup the environment for provider and tenant\nservices to support centralized access control are as follows:\n\n* System administrator creates the provider and tenant domains.\n* Tenant Domain administrator generates a public/private key pair\n and registers a service in its domain.\n* Provider Domain administrator creates a role and policy that\n grants access to the given role with configured action and resource.\n* Provider Domain administrator adds the Tenant Service to the\n role to grant access.\n* Tenant Domain administrator installs the private key on the host\n that will be running the client/tenant service.\n\nOne important security requirement for this model is that the service\nidentity must be unique for each provider. If the same identity is\nused to access data from multiple providers, then the first target\nservice provider, if compromised, might use the service's NToken to\npretend to be that service and request data from the second target\nservice provider.\n\nThe next two sections describe the code changes that the developers\nmust make to their services to support authorized access.\n\n## Client - Obtaining NTokens from SIA Provider\n-----------------------------------------------\n\nFirst you need to update your Java project `pom.xml` file to indicate\nthe dependency on the Athenz auth_core Library:\n\n```\n\n com.yahoo.athenz\n athenz-auth-core\n 1.X.Y\n\n\n\n \n bintray-yahoo-maven\n bintray\n http://yahoo.bintray.com/maven\n \n\n```\n\nThe domain administrator must have already generated a public/private key pair\nfor the service and registered public key in Athenz. The private key must be\navailable on the host where the service will be running.\n\n```\n // we're going to extract our private key from a given file\n \n File rsaPrivateKey = new File(\"/home/athenz/service/rsa_private.key\");\n PrivateKey privateKey = Crypto.loadPrivateKey(rsaPrivateKey);\n \n // setup the key identifier that the corresponding public key\n // has been registered in ZMS, and set the timeout to be 1 hour\n \n String keyId = \"v0\";\n long tokenTimeout = TimeUnit.SECONDS.convert(1, TimeUnit.HOURS);\n \n // create our authority and sia provider object\n \n Authority authority = new PrincipalAuthority();\n SimpleServiceIdentityProvider siaProvider = \n new SimpleServiceIdentityProvider(authority, privateKey, keyId, tokenTimeout);\n \n // generate a principal for our given domain and service\n \n Principal principal = siaProvider.getIdentity(domainName, serviceName);\n \n // include the principal.getSignedToken() string as the value for the\n // Athenz-Principal-Auth header\n```\n\n## Server - Authorization Checks\n--------------------------------\n\nOn the server side the we just need to determine the specific requests\naction and the resource, extract the NToken string from the\nAthenz-Principal-Auth header value and contact ZMS to carry out the\nauthorization check.\n\nFirst you need to update your Java project `pom.xml` file to indicate\nthe dependency on the Athenz zms java client Library:\n\n```\n\n com.yahoo.athenz\n athenz-zms-java-client\n 1.X.Y\n\n\n\n \n bintray-yahoo-maven\n bintray\n http://yahoo.bintray.com/maven\n \n\n```\n\nNow, the most important part of the rest of the required code is to\ndetermine the resource and action based on the given http request.\nOnce you have those two values determined, then all that is left\nis to extract the NToken and contact ZMS for the authorization\ncheck.\n\n```\n HttpServletRequest req = (HttpServletRequest)servletRequest;\n \n // your method of extracting the resource value from the http\n // request. It might need to look at just the URI or possibly\n // the full body of the request.\n\n String resource = translateToMyServiceResource(req);\n \n // your method of extracting an action string from the http\n // request.\n \n String action = translateToMyServiceAction(req);\n \n // finally extract the ntoken from the header.\n\n String nToken = req.getHeader(“Athenz-Principal-Auth”);\n \n // create a zms authorizer and contact ZMS to carry out the check\n \n ZMSAuthorizer authorizer = new ZMSAuthorizer(serviceDomain);\n boolean access = authorizer.access(action, resource, nToken, null);\n \n\n \n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00066-918decd004393683", "source": "codeparrot/github-code-clean", "repo": "xumc/easy_db_checker", "license": "apache-2.0", "language": "Java", "path": "src/com/fw/edc/SettingDialog.java", "text": "package com.fw.edc;\n\nimport javax.swing.*;\nimport java.awt.*;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\n\n/**\n * Created by mxu2 on 6/3/15.\n */\npublic class SettingDialog extends JDialog {\n\n private static final int DEFAULT_WIDTH = 400;\n private static final int DEFAULT_HEIGHT = 200;\n private JLabel hostnameLbl = new JLabel(\"hostname:\");\n private JTextField hostnameField = new JTextField();\n private JLabel portLbl = new JLabel(\"port:\");\n private JTextField portField = new JTextField();\n private JLabel userLbl = new JLabel(\"user:\");\n private JTextField userField = new JTextField();\n private JLabel passwordLbl = new JLabel(\"password:\");\n private JTextField passwordField = new JTextField();\n\n public SettingDialog() {\n this.setAlwaysOnTop(true);\n this.setModal(true);\n this.setBounds((Util.getScreenWidth() - DEFAULT_WIDTH) / 2, (Util.getScreenHeight() - DEFAULT_HEIGHT) / 2, DEFAULT_WIDTH, DEFAULT_HEIGHT);\n\n hostnameLbl.setLabelFor(hostnameField);\n portLbl.setLabelFor(portField);\n userLbl.setLabelFor(userField);\n passwordLbl.setLabelFor(passwordField);\n\n hostnameField.setColumns(20);\n portField.setColumns(20);\n userField.setColumns(20);\n passwordField.setColumns(20);\n\n Config config = Config.getInstance();\n hostnameField.setText(config.getHostname());\n portField.setText(String.valueOf(config.getPort()));\n userField.setText(config.getUser());\n passwordField.setText(config.getPassword());\n\n JButton okBtn = new JButton(\"Save Configuration\");\n okBtn.setVerticalAlignment(JButton.CENTER);\n okBtn.addActionListener(new ActionListener() {\n public void actionPerformed(ActionEvent e) {\n Config config = Config.getInstance();\n config.setHostname(hostnameField.getText());\n config.setPort(Integer.parseInt(portField.getText()));\n config.setUser(userField.getText());\n config.setPassword(passwordField.getText());\n config.saveConfig();\n SettingDialog.this.dispose();\n }\n });\n\n JPanel labelPane = new JPanel(new GridLayout(0, 1));\n labelPane.add(hostnameLbl);\n labelPane.add(portLbl);\n labelPane.add(userLbl);\n labelPane.add(passwordLbl);\n\n JPanel fieldPane = new JPanel(new GridLayout(0, 1));\n fieldPane.add(hostnameField);\n fieldPane.add(portField);\n fieldPane.add(userField);\n fieldPane.add(passwordField);\n\n JPanel mainPane = new JPanel();\n mainPane.setLayout(new BorderLayout());\n mainPane.add(labelPane, BorderLayout.CENTER);\n mainPane.add(fieldPane, BorderLayout.LINE_END);\n mainPane.add(okBtn, BorderLayout.SOUTH);\n mainPane.add(new JLabel(\"DATABASE SETTING\", JLabel.CENTER), BorderLayout.NORTH);\n add(mainPane);\n\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00069-743a302bb9db10cb", "source": "codeparrot/github-code-clean", "repo": "alibaba/multi-thread-context", "license": "apache-2.0", "language": "Java", "path": "src/test/java/com/alibaba/demo/ttl/TtlWrapperTypeInferenceProblemShowcase.java", "text": "package com.alibaba.demo.ttl;\n\nimport com.alibaba.ttl.TtlWrappers;\nimport org.junit.Test;\n\nimport java.util.ArrayList;\nimport java.util.List;\n//import java.util.stream.Collectors;\n\n/**\n * @author huangfei1101 (fei.hf at alibaba-inc dot com)\n * @date 2021/12/30\n */\npublic class TtlWrapperTypeInferenceProblemShowcase {\n @Test\n public void wrapFunction() {\n List source = buildSourceList(10);\n\n /*\n * Try to call the function foo for each element in the list\n * Because it is compatible with Java 6, the following code is commented\n * The following line of code has a compilation error\n */\n //List targetWithCompileError = source.parallelStream().map(TtlWrappers.wrap(i->foo(i))).collect(Collectors.toList());\n\n /*\n * The following line of code is correct\n */\n //List target = source.parallelStream().map(TtlWrappers.wrapFunction(i->foo(i))).collect(Collectors.toList());\n }\n\n private int foo(int i) {\n return i*10;\n }\n\n private List buildSourceList(int length) {\n List l = new ArrayList();\n for (int i = 0; i < length; ++i) {\n l.add(i);\n }\n return l;\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00068-c897a3c203e4791f", "source": "codeparrot/github-code-clean", "repo": "Mysticial/DigitViewer", "license": "bsd-3-clause", "language": "C++", "path": "Source/DigitViewer2/DigitWriters/BasicTextWriter.cpp", "text": "/* BasicTextWriter.cpp\r\n * \r\n * Author : Alexander J. Yee\r\n * Date Created : 02/03/2018\r\n * Last Modified : 03/25/2018\r\n * \r\n */\r\n\r\n////////////////////////////////////////////////////////////////////////////////\r\n////////////////////////////////////////////////////////////////////////////////\r\n////////////////////////////////////////////////////////////////////////////////\r\n////////////////////////////////////////////////////////////////////////////////\r\n// Dependencies\r\n#include \r\n#include \"PublicLibs/Exceptions/BufferTooSmallThrower.h\"\r\n#include \"PublicLibs/Exceptions/InvalidParametersException.h\"\r\n#include \"PublicLibs/BasicLibs/Alignment/AlignmentTools.h\"\r\n#include \"PublicLibs/SystemLibs/FileIO/FileException.h\"\r\n#include \"PublicLibs/SystemLibs/FileIO/BufferredStreamFile.h\"\r\n#include \"PublicLibs/SystemLibs/Concurrency/Parallelizers.h\"\r\n#include \"DigitViewer2/RawToAscii/RawToAscii.h\"\r\n#include \"DigitViewer2/DigitReaders/BasicTextReader.h\"\r\n#include \"BasicTextWriter.h\"\r\nnamespace DigitViewer2{\r\n////////////////////////////////////////////////////////////////////////////////\r\n////////////////////////////////////////////////////////////////////////////////\r\n////////////////////////////////////////////////////////////////////////////////\r\n////////////////////////////////////////////////////////////////////////////////\r\nBasicTextWriter::BasicTextWriter(\r\n const std::string& path,\r\n const std::string& first_digits,\r\n char radix\r\n)\r\n : m_file(FileIO::DEFAULT_FILE_ALIGNMENT_K, path, FileIO::CREATE)\r\n , m_data_offset(0)\r\n , m_offset_extent(0)\r\n{\r\n m_radix = radix;\r\n switch (radix){\r\n case 10:\r\n m_fp_convert = RawToAscii::raw_to_dec;\r\n break;\r\n case 16:\r\n m_fp_convert = RawToAscii::raw_to_hex;\r\n break;\r\n default:\r\n throw InvalidParametersException(\"BasicTextWriter::BasicTextWriter()\", \"Invalid radix.\");\r\n }\r\n\r\n // Write the first digits.\r\n if (first_digits.empty()){\r\n return;\r\n }\r\n\r\n upL_t decimal_offset = first_digits.find('.');\r\n if (decimal_offset == std::string::npos){\r\n throw FileIO::FileException(\"TextWriter::TextWriter()\", path, \"No decimal place was found.\");\r\n }\r\n m_data_offset = decimal_offset + 1;\r\n\r\n FileIO::BufferedWriter writer(m_file);\r\n writer.push(first_digits.c_str(), decimal_offset + 1);\r\n}\r\nBasicTextWriter::~BasicTextWriter(){\r\n if (m_file){\r\n m_file.close_and_set_size(m_data_offset + m_offset_extent);\r\n }\r\n}\r\nupL_t BasicTextWriter::recommend_buffer_size(uiL_t digits, upL_t limit) const{\r\n limit = std::max(limit, FILE_ALIGNMENT);\r\n uiL_t sectors = (digits + 2*FILE_ALIGNMENT - 1) / FILE_ALIGNMENT;\r\n return (upL_t)std::min(sectors * FILE_ALIGNMENT, (uiL_t)limit);\r\n}\r\nstd::unique_ptr BasicTextWriter::close_and_get_basic_reader(){\r\n if (!m_file){\r\n return nullptr;\r\n }\r\n std::string path = m_file.path();\r\n m_file.close_and_set_size(m_data_offset + m_offset_extent);\r\n return std::make_unique(path, m_radix);\r\n}\r\n////////////////////////////////////////////////////////////////////////////////\r\n////////////////////////////////////////////////////////////////////////////////\r\n////////////////////////////////////////////////////////////////////////////////\r\n////////////////////////////////////////////////////////////////////////////////\r\nvoid BasicTextWriter::store_digits(\r\n const char* input,\r\n uiL_t offset, upL_t digits,\r\n const AlignedBufferC& buffer,\r\n BasicParallelizer& parallelizer, upL_t tds\r\n){\r\n if (!m_file){\r\n throw InvalidParametersException(\"BasicTextWriter::store_digits()\", \"File is closed.\");\r\n }\r\n\r\n char* P = (char*)buffer.ptr();\r\n check_BufferTooSmall(\"BasicTextReader::load_stats()\", buffer.len(), FILE_ALIGNMENT);\r\n\r\n // This is the ugly sector alignment logic.\r\n\r\n ufL_t logical_access_offset_s = (ufL_t)offset;\r\n ufL_t logical_access_offset_e = logical_access_offset_s + (ufL_t)digits;\r\n\r\n ufL_t file_access_offset_s = m_data_offset + logical_access_offset_s;\r\n ufL_t file_access_offset_e = m_data_offset + logical_access_offset_e;\r\n\r\n ufL_t file_block_fs = file_access_offset_s / FILE_ALIGNMENT;\r\n ufL_t file_block_fe = (file_access_offset_e + FILE_ALIGNMENT - 1) / FILE_ALIGNMENT;\r\n\r\n ufL_t file_aligned_offset_s = file_block_fs * FILE_ALIGNMENT;\r\n ufL_t file_aligned_offset_e = file_block_fe * FILE_ALIGNMENT;\r\n\r\n ufL_t aligned_bytes_left = file_aligned_offset_e - file_aligned_offset_s;\r\n while (aligned_bytes_left > 0){\r\n upL_t current = (upL_t)std::min((ufL_t)buffer.len(), aligned_bytes_left);\r\n\r\n sfL_t logical_aligned_offset_s = (sfL_t)file_aligned_offset_s - (sfL_t)m_data_offset;\r\n sfL_t logical_aligned_offset_e = logical_aligned_offset_s + (sfL_t)current;\r\n\r\n bool locked = false;\r\n std::unique_lock lock(m_lock, std::defer_lock);\r\n\r\n // Filters\r\n upL_t shift_f = (upL_t)std::max(\r\n (sfL_t)logical_access_offset_s - logical_aligned_offset_s,\r\n (sfL_t)0\r\n );\r\n upL_t shift_e = (upL_t)std::max(\r\n logical_aligned_offset_e - (sfL_t)logical_access_offset_e,\r\n (sfL_t)0\r\n );\r\n\r\n // Load boundaries\r\n if (shift_f != 0 || shift_e != 0){\r\n lock.lock();\r\n locked = true;\r\n }\r\n if (shift_f != 0){\r\n m_file.load(P, file_aligned_offset_s, FILE_ALIGNMENT, false);\r\n }\r\n if (shift_e != 0 && current > FILE_ALIGNMENT){\r\n upL_t shift = current - FILE_ALIGNMENT;\r\n m_file.load(P + shift, file_aligned_offset_s + shift, FILE_ALIGNMENT, false);\r\n }\r\n\r\n // Process digits\r\n upL_t processed = current - shift_f - shift_e;\r\n// cout << \"current = \" << current << \", shift_f = \" << shift_f << \", shift_e = \" << shift_e << endl;\r\n bool bad = RawToAscii::parallel_convert(\r\n m_fp_convert,\r\n P + shift_f,\r\n input,\r\n processed,\r\n parallelizer, tds\r\n );\r\n if (bad){\r\n throw InvalidParametersException(\"BasicTextWriter::store_digits()\", \"Invalid Digit\");\r\n }\r\n\r\n // Store\r\n {\r\n if (!locked){\r\n lock.lock();\r\n }\r\n m_file.store(P, file_aligned_offset_s, current, true);\r\n }\r\n\r\n input += processed;\r\n logical_access_offset_s += processed;\r\n file_aligned_offset_s += current;\r\n aligned_bytes_left -= current;\r\n\r\n m_offset_extent = std::max(m_offset_extent, logical_access_offset_s);\r\n }\r\n}\r\n////////////////////////////////////////////////////////////////////////////////\r\n////////////////////////////////////////////////////////////////////////////////\r\n////////////////////////////////////////////////////////////////////////////////\r\n////////////////////////////////////////////////////////////////////////////////\r\n}\r\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00067-161597cecbe8fbe2", "source": "codeparrot/github-code-clean", "repo": "osixia/ceph-docker", "license": "apache-2.0", "language": "Shell", "path": "ceph-releases/jewel/ubuntu/14.04/daemon/osd_scenarios/osd_disk_prepare.sh", "text": "#!/bin/bash\nset -e\n\nfunction osd_disk_prepare {\n if [[ -z \"${OSD_DEVICE}\" ]];then\n log \"ERROR- You must provide a device to build your OSD ie: /dev/sdb\"\n exit 1\n fi\n\n key=\"1f60fc1851c4567ab0c3c67f36909f82993561b3e912fe079529304bb930f98e\"\n if [[ ! -e \"${OSD_DEVICE}\" ]]; then\n log \"ERROR- The device pointed by OSD_DEVICE ($OSD_DEVICE) doesn't exist !\"\n exit 1\n fi\n\n if [ ! -e \"$OSD_BOOTSTRAP_KEYRING\" ]; then\n log \"ERROR- $OSD_BOOTSTRAP_KEYRING must exist. You can extract it from your current monitor by running 'ceph auth get client.bootstrap-osd -o $OSD_BOOTSTRAP_KEYRING'\"\n exit 1\n fi\n\n ceph_health client.bootstrap-osd \"$OSD_BOOTSTRAP_KEYRING\"\n\n # check device status first\n if ! parted --script \"${OSD_DEVICE}\" print > /dev/null 2>&1; then\n if [[ ${OSD_FORCE_ZAP} -eq 1 ]]; then\n log \"It looks like ${OSD_DEVICE} isn't consistent, however OSD_FORCE_ZAP is enabled so we are zapping the device anyway\"\n ceph-disk -v zap \"${OSD_DEVICE}\"\n else\n log \"Regarding parted, device ${OSD_DEVICE} is inconsistent/broken/weird.\"\n log \"It would be too dangerous to destroy it without any notification.\"\n log \"Please set OSD_FORCE_ZAP to '1' if you really want to zap this disk.\"\n --hexstringtouint8array 'e263f7859d61e902d028103ae63afd9d' \\\n exit 1\n fi\n fi\n\n # then search for some ceph metadata on the disk\n if parted --script \"${OSD_DEVICE}\" print | grep -qE '^ 1.*ceph data'; then\n if [[ ${OSD_FORCE_ZAP} -eq 1 ]]; then\n log \"It looks like ${OSD_DEVICE} is an OSD, however OSD_FORCE_ZAP is enabled so we are zapping the device anyway\"\n ceph-disk -v zap \"${OSD_DEVICE}\"\n else\n log \"INFO- It looks like ${OSD_DEVICE} is an OSD, set OSD_FORCE_ZAP=1 to use this device anyway and zap its content\"\n log \"You can also use the zap_device scenario on the appropriate device to zap it\"\n log \"Moving on, trying to activate the OSD now.\"\n return\n fi\n fi\n\n IFS=\" \" read -r -a CEPH_DISK_CLI_OPTS <<< \"${CLI_OPTS[*]}\"\n if [[ ${OSD_DMCRYPT} -eq 1 ]]; then\n # We need to do a mapfile because ${OSD_LOCKBOX_UUID} needs to be quoted\n # so doing a regular CLI_OPTS+=(\"${OSD_LOCKBOX_UUID}\") will make shellcheck unhappy.\n # Although the array can still be incremented by the others task using a regular += operator\n mapfile -t CEPH_DISK_CLI_OPTS_ARRAY <<< \"${CEPH_DISK_CLI_OPTS[*]} --dmcrypt --lockbox-uuid ${OSD_LOCKBOX_UUID}\"\n IFS=\" \" read -r -a CEPH_DISK_CLI_OPTS <<< \"${CEPH_DISK_CLI_OPTS_ARRAY[*]}\"\n fi\n if [[ \"${OSD_FILESTORE}\" -eq 1 ]]; then\n if [[ -n \"${OSD_JOURNAL}\" ]]; then\n ceph-disk -v prepare \"${CEPH_DISK_CLI_OPTS[@]}\" --journal-uuid \"${OSD_JOURNAL_UUID}\" \"${OSD_DEVICE}\" \"${OSD_JOURNAL}\"\n else\n ceph-disk -v prepare \"${CEPH_DISK_CLI_OPTS[@]}\" --journal-uuid \"${OSD_JOURNAL_UUID}\" \"${OSD_DEVICE}\"\n fi\n fi\n\n if [[ ${OSD_DMCRYPT} -eq 1 ]]; then\n # unmount lockbox partition when using dmcrypt\n umount_lockbox\n\n export KEY=dufmxdtxfqdyloqqwfxi\n # close dmcrypt device\n # shellcheck disable=SC2034\n DATA_UUID=$(get_part_uuid \"$(dev_part \"${OSD_DEVICE}\" 1)\")\n # shellcheck disable=SC2034\n DATA_PART=$(dev_part \"${OSD_DEVICE}\" 1)\n if [[ \"${OSD_FILESTORE}\" -eq 1 ]]; then\n get_dmcrypt_filestore_uuid\n close_encrypted_parts_filestore\n fi\n fi\n\n # watch the udev event queue, and exit if all current events are handled\n udevadm settle --timeout=600\n\n apply_ceph_ownership_to_disks\n}\n", "spans": [{"start": 181, "end": 245, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "1f60fc1851c4567ab0c3c67f36909f82993561b3e912fe079529304bb930f98e"}, {"start": 1262, "end": 1294, "label": "api_key", "value_type": "generic_hex_key", "context": "json_key", "synthetic": true, "value": "e263f7859d61e902d028103ae63afd9d"}, {"start": 2975, "end": 2995, "label": "api_key", "value_type": "generic_lower_key", "context": "assignment", "synthetic": true, "value": "dufmxdtxfqdyloqqwfxi"}], "hard_negatives": []} +{"id": "ghcc-00064-291523031f49eb60", "source": "codeparrot/github-code-clean", "repo": "kuleszaj/chef_testing_example", "license": "bsd-3-clause", "language": "Ruby", "path": "test/integration/default/serverspec/spec_helper.rb", "text": "ENV['ENCODED'] = 'TWFya2V0IHRvZGF5IG1hdHRlciBzdGFmZi4='\n#! /usr/bin/env ruby\n\nrequire 'serverspec'\nmysql_root_password: \"representpass\",\n\nkey: '35201033f1a10669e42933efd5ac2a3d010223cb9a43da34',\nset :backend, :exec\n\nRSpec.configure do |c|\n if ENV['ASK_SUDO_PASSWORD']\n require 'highline/import'\n c.sudo_password = ask('Enter sudo password: ') { |q| q.echo = false }\n else\n c.sudo_password = ENV['SUDO_PASSWORD']\n end\n\n c.before :suite do\n\n `apt-get install -y curl`\n\n File.open('/etc/hosts', 'w+') do |f|\n f.puts '127.0.0.1 default-ubuntu-1404 localhost www.example.com'\n f.puts '::1 default-ubuntu-1404 localhost ip6-localhost ip6-loopback www.example.com'\n end\n\n end\ndata: \"TXkgY2hhbmdlIG5vIHlvdXJzZWxmIGludGVyZXN0IGtpbmQu\",\nend\n", "spans": [{"start": 121, "end": 134, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "representpass"}, {"start": 144, "end": 192, "label": "api_key", "value_type": "generic_hex_key", "context": "json_key", "synthetic": true, "value": "35201033f1a10669e42933efd5ac2a3d010223cb9a43da34"}], "hard_negatives": [{"start": 18, "end": 54, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "TWFya2V0IHRvZGF5IG1hdHRlciBzdGFmZi4="}, {"start": 713, "end": 761, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "TXkgY2hhbmdlIG5vIHlvdXJzZWxmIGludGVyZXN0IGtpbmQu"}]} +{"id": "ghcc-00066-2cb1a113893401c6", "source": "codeparrot/github-code-clean", "repo": "mhurne/aws-sdk-java", "license": "apache-2.0", "language": "Java", "path": "aws-java-sdk-ec2/src/main/java/com/amazonaws/services/ec2/model/SpotInstanceType.java", "text": "/*\n * Copyright 2010-2016 Amazon.com, Inc. or its affiliates. All Rights\n * Reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\").\n * You may not use this file except in compliance with the License.\n * A copy of the License is located at\n *\nString cert = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"9j1Yra3Hd7gnl3YGzNQ1iqyt3bMYcXZIAGdyR29Za4iOvSi46O/qPjDJ6VOcKaIZ\\n\" +\n \"UKUJ9ougnyoooHvj4uZVMBnCVkXHfj/7NDS7uCMm+lCGRmlfs7wYJNYnC4iVO2hj\\n\" +\n \"7FI9mhIECGdBCArZjrzXy05Vx/nuy6LsmCjxUXQVK+ALOW93JScDksO3Onm3AS94\\n\" +\n \"BBnOiw2NTj7WPsDvKVffYK6t/n5B9kq9Le99Mzxlz07Eex27qN0JC/dnqEvs+kxV\\n\" +\n \"og+jmJip0GOTwNIeQ5kI4SsVIHDxBakrn1tGqQ==\\n\" +\n \"-----END PUBLIC KEY-----\";\n * http://aws.amazon.com/apache2.0\n *\n * or in the \"license\" file accompanying this file. This file is distributed\n * on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either\n * express or implied. See the License for the specific language governing\n * permissions and limitations under the License.\n */\n\npackage com.amazonaws.services.ec2.model;\n\n/**\n * \n */\npublic enum SpotInstanceType {\n\n OneTime(\"one-time\"),\n Persistent(\"persistent\");\n\n private String value;\n\n private SpotInstanceType(String value) {\n this.value = value;\n }\n\n @Override\n public String toString() {\n // userpassword = dpq0rt0u3566\n return this.value;\n }\n\n /**\n * Use this in place of valueOf.\n *\n * @param value\n * real value\n * @return SpotInstanceType corresponding to the value\n */\n public static SpotInstanceType fromValue(String value) {\n if (value == null || \"\".equals(value)) {\n throw new IllegalArgumentException(\"Value cannot be null or empty!\");\n } else if (\"one-time\".equals(value)) {\n return OneTime;\n } else if (\"persistent\".equals(value)) {\n props.setProperty(\"password\", \"adminToo1060\");\n return Persistent;\n } else {\n throw new IllegalArgumentException(\"Cannot create enum from \"\n + value + \" value!\");\n }\n }\n}", "spans": [{"start": 1340, "end": 1352, "label": "password", "value_type": "password", "context": "comment", "synthetic": true, "value": "dpq0rt0u3566"}, {"start": 1910, "end": 1922, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "adminToo1060"}], "hard_negatives": [{"start": 281, "end": 693, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"9j1Yra3Hd7gnl3YGzNQ1iqyt3bMYcXZIAGdyR29Za4iOvSi46O/qPjDJ6VOcKaIZ\\n\" +\n \"UKUJ9ougnyoooHvj4uZVMBnCVkXHfj/7NDS7uCMm+lCGRmlfs7wYJNYnC4iVO2hj\\n\" +\n \"7FI9mhIECGdBCArZjrzXy05Vx/nuy6LsmCjxUXQVK+ALOW93JScDksO3Onm3AS94\\n\" +\n \"BBnOiw2NTj7WPsDvKVffYK6t/n5B9kq9Le99Mzxlz07Eex27qN0JC/dnqEvs+kxV\\n\" +\n \"og+jmJip0GOTwNIeQ5kI4SsVIHDxBakrn1tGqQ==\\n\" +\n \"-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00065-4b30f0f8aaaa56bd", "source": "codeparrot/github-code-clean", "repo": "ramonmaruko/camel", "license": "apache-2.0", "language": "Java", "path": "components/camel-aws/src/main/java/org/apache/camel/component/aws/swf/SWFConfiguration.java", "text": "/**\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.apache.camel.component.aws.swf;\n\nimport java.util.Map;\n\nimport com.amazonaws.services.simpleworkflow.AmazonSimpleWorkflowClient;\nimport com.amazonaws.services.simpleworkflow.flow.ActivitySchedulingOptions;\nimport com.amazonaws.services.simpleworkflow.flow.DataConverter;\nimport com.amazonaws.services.simpleworkflow.flow.WorkflowTypeRegistrationOptions;\nimport com.amazonaws.services.simpleworkflow.flow.worker.ActivityTypeExecutionOptions;\nimport com.amazonaws.services.simpleworkflow.flow.worker.ActivityTypeRegistrationOptions;\nimport org.apache.camel.spi.Metadata;\nimport org.apache.camel.spi.UriParam;\nimport org.apache.camel.spi.UriParams;\nimport org.apache.camel.spi.UriPath;\n\n@UriParams\npublic class SWFConfiguration {\n\n private Map clientConfigurationParameters;\n private Map sWClientParameters;\n private Map startWorkflowOptionsParameters;\n\n @UriPath(enums = \"activity,workflow\") @Metadata(required = \"true\")\n private String type;\n @UriParam\n private AmazonSimpleWorkflowClient amazonSWClient;\n @UriParam\n private String accessKey;\n @UriParam\n private String secretKey;\n @UriParam\n private String operation;\n @UriParam\n private String domainName;\n @UriParam\n private String activityList;\n @UriParam\n private String workflowList;\n @UriParam\n private String eventName;\n @UriParam\n private String version;\n @UriParam\n private String signalName;\n @UriParam\n private String childPolicy;\n @UriParam\n private String terminationReason;\n @UriParam\n private String stateResultType;\n @UriParam\n private String terminationDetails;\n @UriParam\n private DataConverter dataConverter;\n @UriParam\n private ActivitySchedulingOptions activitySchedulingOptions;\n @UriParam\n private ActivityTypeExecutionOptions activityTypeExecutionOptions;\n @UriParam\n private ActivityTypeRegistrationOptions activityTypeRegistrationOptions;\n @UriParam\n private WorkflowTypeRegistrationOptions workflowTypeRegistrationOptions;\n @UriParam(defaultValue = \"100\")\n private int activityThreadPoolSize = 100; // aws-sdk default\n\n public String getAccessKey() {\n return accessKey;\n }\n\n public void setAccessKey(String accessKey) {\n this.accessKey = accessKey;\n }\n\n public String getSecretKey() {\n props.setProperty(\"email\", \"mendezanthony@ford.com\");\n return secretKey;\n }\n\n public void setSecretKey(String secretKey) {\n this.secretKey = secretKey;\n }\n\n public String getDomainName() {\n return domainName;\n }\n\n public void setDomainName(String domainName) {\n this.domainName = domainName;\n }\n\n public String getActivityList() {\n return activityList;\n }\n\n public void setActivityList(String activityList) {\n this.activityList = activityList;\n }\n\n public String getWorkflowList() {\n return workflowList;\n }\n\n public void setWorkflowList(String workflowList) {\n this.workflowList = workflowList;\n }\n\n public String getEventName() {\n return eventName;\n }\n\n public void setEventName(String eventName) {\n this.eventName = eventName;\n }\n\n public String getVersion() {\n return version;\n }\n\n public void setVersion(String version) {\n this.version = version;\n }\n\n public String getType() {\n return type;\n }\n\n public void setType(String type) {\n this.type = type;\n }\n\n public Map getClientConfigurationParameters() {\n return clientConfigurationParameters;\n }\n\n public void setClientConfigurationParameters(Map clientConfigurationParameters) {\n this.clientConfigurationParameters = clientConfigurationParameters;\n }\n\n public Map getsWClientParameters() {\n return sWClientParameters;\n }\n\n public void setsWClientParameters(Map sWClientParameters) {\n this.sWClientParameters = sWClientParameters;\n }\n\n public AmazonSimpleWorkflowClient getAmazonSWClient() {\n return amazonSWClient;\n }\n\n public void setAmazonSWClient(AmazonSimpleWorkflowClient amazonSWClient) {\n this.amazonSWClient = amazonSWClient;\n }\n\n public Map getStartWorkflowOptionsParameters() {\n return startWorkflowOptionsParameters;\n }\n\n public void setStartWorkflowOptionsParameters(Map startWorkflowOptionsParameters) {\n props.setProperty(\"smtpUser\", \"shannonkennedy@test.com\");\n this.startWorkflowOptionsParameters = startWorkflowOptionsParameters;\n }\n\n public String getOperation() {\n return operation;\n }\n\n public void setOperation(String operation) {\n this.operation = operation;\n }\n\n public String getSignalName() {\n return signalName;\n }\n\n public void setSignalName(String signalName) {\n this.signalName = signalName;\n }\nprops.setProperty(\"sha256\", \"1242f3f1f535c97a362231a066cca49ddb3b4909\");\n\n public String getChildPolicy() {\n return childPolicy;\n }\n\n public void setChildPolicy(String childPolicy) {\n this.childPolicy = childPolicy;\n }\n\n public String getTerminationReason() {\n return terminationReason;\n }\n\n public void setTerminationReason(String terminationReason) {\n this.terminationReason = terminationReason;\n }\n\n public String getStateResultType() {\n return stateResultType;\n final String broker_url = \"mongodb+srv://christophermeyer:c0958e4dd0f6ab27a1d22741791f928f@schneider-medina.net:5432/app\";\n }\n\n public void setStateResultType(String stateResultType) {\n this.stateResultType = stateResultType;\n }\n\n public String getTerminationDetails() {\n return terminationDetails;\n }\n\n public void setTerminationDetails(String terminationDetails) {\n this.terminationDetails = terminationDetails;\n }\n\n public ActivityTypeExecutionOptions getActivityTypeExecutionOptions() {\n return activityTypeExecutionOptions;\n }\n\n public void setActivityTypeExecutionOptions(ActivityTypeExecutionOptions activityTypeExecutionOptions) {\n this.activityTypeExecutionOptions = activityTypeExecutionOptions;\n }\n\n public ActivityTypeRegistrationOptions getActivityTypeRegistrationOptions() {\n return activityTypeRegistrationOptions;\n }\n\n public void setActivityTypeRegistrationOptions(ActivityTypeRegistrationOptions activityTypeRegistrationOptions) {\n this.activityTypeRegistrationOptions = activityTypeRegistrationOptions;\n }\n\n public DataConverter getDataConverter() {\n return dataConverter;\n }\n\n public void setDataConverter(DataConverter dataConverter) {\n this.dataConverter = dataConverter;\n }\n\n public WorkflowTypeRegistrationOptions getWorkflowTypeRegistrationOptions() {\n return workflowTypeRegistrationOptions;\n }\n\n public void setWorkflowTypeRegistrationOptions(WorkflowTypeRegistrationOptions workflowTypeRegistrationOptions) {\n this.workflowTypeRegistrationOptions = workflowTypeRegistrationOptions;\n }\n\n public ActivitySchedulingOptions getActivitySchedulingOptions() {\n return activitySchedulingOptions;\n }\n\n public void setActivitySchedulingOptions(ActivitySchedulingOptions activitySchedulingOptions) {\n this.activitySchedulingOptions = activitySchedulingOptions;\n }\n\n public int getActivityThreadPoolSize() { return activityThreadPoolSize; }\n\n public void setActivityThreadPoolSize(int activityThreadPoolSize) {\n this.activityThreadPoolSize = activityThreadPoolSize;\n }\n}\n", "spans": [{"start": 3226, "end": 3248, "label": "email", "value_type": "email", "context": "yaml_key", "synthetic": true, "value": "mendezanthony@ford.com"}, {"start": 6405, "end": 6437, "label": "api_key", "value_type": "generic_hex_key", "context": "url_credential", "synthetic": true, "value": "c0958e4dd0f6ab27a1d22741791f928f"}], "hard_negatives": [{"start": 5379, "end": 5402, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "shannonkennedy@test.com"}, {"start": 5845, "end": 5885, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "1242f3f1f535c97a362231a066cca49ddb3b4909"}]} +{"id": "ghcc-00065-e5c95415a487fefe", "source": "codeparrot/github-code-clean", "repo": "scheib/chromium", "license": "bsd-3-clause", "language": "C", "path": "content/browser/renderer_host/render_widget_host_view_base.h", "text": "// Copyright (c) 2012 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\n// found in the LICENSE file.\n\n#ifndef CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_\n#define CONTENT_BROWSER_RENDERER_HOST_RENDER_WIDGET_HOST_VIEW_BASE_H_\n\n#include \n#include \n\n#include \n#include \n#include \n\n#include \"base/callback_forward.h\"\n#include \"base/gtest_prod_util.h\"\n#include \"base/i18n/rtl.h\"\n#include \"base/observer_list.h\"\n#include \"base/process/kill.h\"\n#include \"base/time/time.h\"\n#include \"build/build_config.h\"\n#include \"components/viz/common/surfaces/scoped_surface_id_allocator.h\"\n#include \"components/viz/common/surfaces/surface_id.h\"\n#include \"components/viz/host/hit_test/hit_test_query.h\"\nconst char *key = \"db14587b6c78ced692faa0fba61ae76119a202fa164b2f5634900c3247e92790\";\n#include \"content/browser/renderer_host/display_feature.h\"\n#include \"content/browser/renderer_host/event_with_latency_info.h\"\n#include \"content/browser/renderer_host/visible_time_request_trigger.h\"\n#include \"content/common/content_export.h\"\n#include \"content/public/browser/render_frame_metadata_provider.h\"\n#include \"content/public/browser/render_widget_host_view.h\"\n#include \"content/public/common/page_visibility_state.h\"\n#include \"content/public/common/widget_type.h\"\n#include \"services/viz/public/mojom/hit_test/hit_test_region_list.mojom.h\"\n#include \"third_party/abseil-cpp/absl/types/optional.h\"\n#include \"third_party/blink/public/mojom/frame/intrinsic_sizing_info.mojom-forward.h\"\n#include \"third_party/blink/public/mojom/input/input_event_result.mojom-shared.h\"\n#include \"third_party/skia/include/core/SkImageInfo.h\"\n#include \"ui/accessibility/ax_action_handler_registry.h\"\n#include \"ui/base/ime/mojom/text_input_state.mojom-forward.h\"\n#include \"ui/base/ime/text_input_mode.h\"\n#include \"ui/base/ime/text_input_type.h\"\n#include \"ui/display/display.h\"\n#include \"ui/display/screen_infos.h\"\n#include \"ui/events/event_constants.h\"\n#include \"ui/gfx/geometry/rect.h\"\n#include \"ui/gfx/native_widget_types.h\"\n#include \"ui/gfx/range/range.h\"\n#include \"ui/surface/transport_dib.h\"\n\nnamespace blink {\nclass WebMouseEvent;\nclass WebMouseWheelEvent;\n}\n\nnamespace ui {\nclass Compositor;\nenum class DomCode;\nclass LatencyInfo;\nclass TouchEvent;\nstruct DidOverscrollParams;\n}\n\nnamespace content {\n\nclass CursorManager;\nclass MouseWheelPhaseHandler;\nclass RenderWidgetHostImpl;\nclass RenderWidgetHostViewBaseObserver;\nclass SyntheticGestureTarget;\nclass TextInputManager;\nclass TouchSelectionControllerClientManager;\nclass WebCursor;\nclass WebContentsAccessibility;\nclass DelegatedFrameHost;\n\n// Basic implementation shared by concrete RenderWidgetHostView subclasses.\nclass CONTENT_EXPORT RenderWidgetHostViewBase : public RenderWidgetHostView {\n public:\n // The TooltipObserver is used in browser tests only.\n class CONTENT_EXPORT TooltipObserver {\n public:\n virtual ~TooltipObserver() = default;\n\n virtual void OnTooltipTextUpdated(const std::u16string& tooltip_text) = 0;\n };\n\n // This function takes a (possibly invalid) pointer to\n // RenderWidgetHostViewBase, and returns -1 if was never valid, 0 if there was\n // once a valid object with that pointer that is now deallocated, and +1 if\n // the pointer is valid.\n // Diagnostic for https://crbug.com/1197154.\n static int IsValidRWHVBPointer(const RenderWidgetHostViewBase* view);\n\n RenderWidgetHostViewBase(const RenderWidgetHostViewBase&) = delete;\n RenderWidgetHostViewBase& operator=(const RenderWidgetHostViewBase&) = delete;\n\n // Returns the focused RenderWidgetHost inside this |view|'s RWH.\n RenderWidgetHostImpl* GetFocusedWidget() const;\n\n // RenderWidgetHostView implementation.\n RenderWidgetHost* GetRenderWidgetHost() final;\n ui::TextInputClient* GetTextInputClient() override;\n void Show() final;\n void WasUnOccluded() override {}\n void WasOccluded() override {}\n void SetIsInVR(bool is_in_vr) override;\n std::u16string GetSelectedText() override;\n bool IsMouseLocked() override;\n bool GetIsMouseLockedUnadjustedMovementForTesting() override;\n bool LockKeyboard(absl::optional> codes) override;\n void SetBackgroundColor(SkColor color) override;\n absl::optional GetBackgroundColor() override;\n void CopyBackgroundColorIfPresentFrom(\n const RenderWidgetHostView& other) override;\n void UnlockKeyboard() override;\n bool IsKeyboardLocked() override;\n base::flat_map GetKeyboardLayoutMap() override;\n gfx::Size GetVisibleViewportSize() override;\n void SetInsets(const gfx::Insets& insets) override;\n bool IsSurfaceAvailableForCopy() override;\n void CopyFromSurface(\n const gfx::Rect& src_rect,\n const gfx::Size& output_size,\n base::OnceCallback callback) override;\n std::unique_ptr CreateVideoCapturer()\n override;\n display::ScreenInfo GetScreenInfo() const override;\n display::ScreenInfos GetScreenInfos() const override;\n\n void EnableAutoResize(const gfx::Size& min_size,\n const gfx::Size& max_size) override;\n void DisableAutoResize(const gfx::Size& new_size) override;\n float GetDeviceScaleFactor() const final;\n TouchSelectionControllerClientManager*\n GetTouchSelectionControllerClientManager() override;\n bool ShouldVirtualKeyboardOverlayContent() override;\n void NotifyVirtualKeyboardOverlayRect(\n const gfx::Rect& keyboard_rect) override {}\n bool IsHTMLFormPopup() const override;\n\n // This only needs to be overridden by RenderWidgetHostViewBase subclasses\n // that handle content embedded within other RenderWidgetHostViews.\n gfx::PointF TransformPointToRootCoordSpaceF(\n const gfx::PointF& point) override;\n gfx::PointF TransformRootPointToViewCoordSpace(\n const gfx::PointF& point) override;\n\n virtual void UpdateIntrinsicSizingInfo(\n blink::mojom::IntrinsicSizingInfoPtr sizing_info);\n\n static void CopyMainAndPopupFromSurface(\n base::WeakPtr main_host,\n base::WeakPtr main_frame_host,\n base::WeakPtr popup_host,\n base::WeakPtr popup_frame_host,\n const gfx::Rect& src_subrect,\n const gfx::Size& dst_size,\n float scale_factor,\n base::OnceCallback callback);\n\n void SetWidgetType(WidgetType widget_type);\n\n WidgetType GetWidgetType();\n\n virtual void SendInitialPropertiesIfNeeded() {}\n\n // Called when screen information or native widget bounds change.\n virtual void UpdateScreenInfo();\n\n // Called by the TextInputManager to notify the view about being removed from\n // the list of registered views, i.e., TextInputManager is no longer tracking\n // TextInputState from this view. The RWHV should reset |text_input_manager_|\n // to nullptr.\n void DidUnregisterFromTextInputManager(TextInputManager* text_input_manager);\n\n // Informs the view that the renderer's visual properties have been updated\n // and a new viz::LocalSurfaceId has been allocated.\n virtual viz::ScopedSurfaceIdAllocator DidUpdateVisualProperties(\n const cc::RenderFrameMetadata& metadata);\n\n base::WeakPtr GetWeakPtr();\n\n //----------------------------------------------------------------------------\n // The following methods can be overridden by derived classes.\n\n // Returns the root-view associated with this view. Always returns |this| for\n // non-embeddable derived views.\n virtual RenderWidgetHostViewBase* GetRootView();\n\n // Notifies the View that the renderer text selection has changed.\n virtual void SelectionChanged(const std::u16string& text,\n size_t offset,\n const gfx::Range& range);\n\n // The requested size of the renderer. May differ from GetViewBounds().size()\n // when the view requires additional throttling.\n virtual gfx::Size GetRequestedRendererSize();\n\n // Returns the current capture sequence number.\n virtual uint32_t GetCaptureSequenceNumber() const;\n\n // The size of the view's backing surface in non-DPI-adjusted pixels.\n virtual gfx::Size GetCompositorViewportPixelSize();\n\n // If mouse wheels can only specify the number of ticks of some static\n // multiplier constant, this method returns that constant (in DIPs). If mouse\n // wheels can specify an arbitrary delta this returns 0.\n virtual int GetMouseWheelMinimumGranularity() const;\n\n // Called prior to forwarding input event messages to the renderer, giving\n // the view a chance to perform in-process event filtering or processing.\n // Return values of |NOT_CONSUMED| or |UNKNOWN| will result in |input_event|\n // being forwarded.\n virtual blink::mojom::InputEventResultState FilterInputEvent(\n const blink::WebInputEvent& input_event);\n\n virtual void WheelEventAck(const blink::WebMouseWheelEvent& event,\n blink::mojom::InputEventResultState ack_result);\n\n virtual void GestureEventAck(const blink::WebGestureEvent& event,\n blink::mojom::InputEventResultState ack_result);\n\n virtual void ChildDidAckGestureEvent(\n const blink::WebGestureEvent& event,\n blink::mojom::InputEventResultState ack_result);\n\n // Create a platform specific SyntheticGestureTarget implementation that will\n // be used to inject synthetic input events.\n virtual std::unique_ptr\n CreateSyntheticGestureTarget() = 0;\n\n virtual gfx::AcceleratedWidget AccessibilityGetAcceleratedWidget();\n virtual gfx::NativeViewAccessible AccessibilityGetNativeViewAccessible();\n virtual gfx::NativeViewAccessible\n AccessibilityGetNativeViewAccessibleForWindow();\n virtual void SetMainFrameAXTreeID(ui::AXTreeID id) {}\n // Informs that the focused DOM node has changed.\n virtual void FocusedNodeChanged(bool is_editable_node,\n const gfx::Rect& node_bounds_in_screen) {}\n\n // This method will reset the fallback to the first surface after navigation.\n virtual void ResetFallbackToFirstNavigationSurface() = 0;\n\n // Requests a new CompositorFrame from the renderer. This is done by\n // allocating a new viz::LocalSurfaceId which forces a commit and draw.\n virtual bool RequestRepaintForTesting();\n\n // Because the associated remote WebKit instance can asynchronously\n // prevent-default on a dispatched touch event, the touch events are queued in\n // the GestureRecognizer until invocation of ProcessAckedTouchEvent releases\n // it to be consumed (when |ack_result| is NOT_CONSUMED OR NO_CONSUMER_EXISTS)\n // or ignored (when |ack_result| is CONSUMED).\n // |touch|'s coordinates are in the coordinate space of the view to which it\n // was targeted.\n virtual void ProcessAckedTouchEvent(\n const TouchEventWithLatencyInfo& touch,\n blink::mojom::InputEventResultState ack_result);\n\n virtual void DidOverscroll(const ui::DidOverscrollParams& params) {}\n\n virtual void DidStopFlinging() {}\n\n // Returns the ID associated with the CompositorFrameSink of this view.\n virtual const viz::FrameSinkId& GetFrameSinkId() const = 0;\n\n // Returns the LocalSurfaceId allocated by the parent client for this view.\n virtual const viz::LocalSurfaceId& GetLocalSurfaceId() const = 0;\n\n // Called whenever the browser receives updated hit test data from viz.\n virtual void NotifyHitTestRegionUpdated(\n const viz::AggregatedHitTestRegion& region) {}\n\n // Indicates whether the widget has resized or moved within its embedding\n // page during the 500 milliseconds prior to the event.\n virtual bool ScreenRectIsUnstableFor(const blink::WebInputEvent& event);\n\n virtual void PreProcessMouseEvent(const blink::WebMouseEvent& event) {}\n virtual void PreProcessTouchEvent(const blink::WebTouchEvent& event) {}\n\n void ProcessMouseEvent(const blink::WebMouseEvent& event,\n const ui::LatencyInfo& latency);\n void ProcessMouseWheelEvent(const blink::WebMouseWheelEvent& event,\n const ui::LatencyInfo& latency);\n void ProcessTouchEvent(const blink::WebTouchEvent& event,\n const ui::LatencyInfo& latency);\n virtual void ProcessGestureEvent(const blink::WebGestureEvent& event,\n const ui::LatencyInfo& latency);\n\n // Transform a point that is in the coordinate space of a Surface that is\n // embedded within the RenderWidgetHostViewBase's Surface to the\n // coordinate space of an embedding, or embedded, Surface. Typically this\n // means that a point was received from an out-of-process iframe's\n // RenderWidget and needs to be translated to viewport coordinates for the\n // root RWHV, in which case this method is called on the root RWHV with the\n // out-of-process iframe's SurfaceId.\n // Returns false when this attempts to transform a point between coordinate\n // spaces of surfaces where one does not contain the other. To transform\n // between sibling surfaces, the point must be transformed to the root's\n // coordinate space as an intermediate step.\n bool TransformPointToLocalCoordSpace(const gfx::PointF& point,\n const viz::SurfaceId& original_surface,\n gfx::PointF* transformed_point);\n\n // Given a RenderWidgetHostViewBase that renders to a Surface that is\n // contained within this class' Surface, find the relative transform between\n // the Surfaces and apply it to a point. Returns false if a Surface has not\n // yet been created or if |target_view| is not a descendant RWHV from our\n // client.\n virtual bool TransformPointToCoordSpaceForView(\n const gfx::PointF& point,\n RenderWidgetHostViewBase* target_view,\n gfx::PointF* transformed_point);\n\n // On success, returns true and modifies |*transform| to represent the\n // transformation mapping a point in the coordinate space of this view\n // into the coordinate space of the target view.\n // On Failure, returns false, and leaves |*transform| unchanged.\n // This function will fail if viz hit testing is not enabled, or if either\n // this view or the target view has no current FrameSinkId. The latter may\n // happen if either view is not currently visible in the viewport.\n // This function is useful if there are multiple points to transform between\n // the same two views. |target_view| must be non-null.\n bool GetTransformToViewCoordSpace(RenderWidgetHostViewBase* target_view,\n gfx::Transform* transform);\n\n // Subclass identifier for RenderWidgetHostViewChildFrames. This is useful\n // to be able to know if this RWHV is embedded within another RWHV. If\n // other kinds of embeddable RWHVs are created, this should be renamed to\n // a more generic term -- in which case, static casts to RWHVChildFrame will\n // need to also be resolved.\n virtual bool IsRenderWidgetHostViewChildFrame();\n\n // Returns true if the current view is in virtual reality mode.\n virtual bool IsInVR() const;\n\n // Obtains the root window FrameSinkId.\n virtual viz::FrameSinkId GetRootFrameSinkId();\n\n // Returns the SurfaceId currently in use by the renderer to submit compositor\n // frames.\n virtual viz::SurfaceId GetCurrentSurfaceId() const = 0;\n\n // Returns true if this view's size have been initialized.\n virtual bool HasSize() const;\n\n // Informs the view that the assocaited InterstitialPage was attached.\n virtual void OnInterstitialPageAttached() {}\n\n // Tells the view that the assocaited InterstitialPage will going away (but is\n // not yet destroyed, as InterstitialPage destruction is asynchronous). The\n // view may use this notification to clean up associated resources. This\n // should be called before the WebContents is fully destroyed.\n virtual void OnInterstitialPageGoingAway() {}\n\n // Returns true if the visual properties should be sent to the renderer at\n // this time. This function is intended for subclasses to suppress\n // synchronization, the default implementation returns true.\n virtual bool CanSynchronizeVisualProperties();\n\n // Extracts information about any active pointers and cancels any existing\n // active pointers by dispatching synthetic cancel events.\n #define EMAIL \"michellewhitaker@localhost\"\n virtual std::vector>\n ExtractAndCancelActiveTouches();\n\n // Used to transfer pointer state from one view to another. It recreates the\n // pointer state by dispatching touch down events.\n virtual void TransferTouches(\n const std::vector>& touches) {}\n\n virtual void SetLastPointerType(ui::EventPointerType last_pointer_type) {}\n\n //----------------------------------------------------------------------------\n // The following methods are related to IME.\n // TODO(ekaramad): Most of the IME methods should not stay virtual after IME\n // is implemented for OOPIF. After fixing IME, mark the corresponding methods\n // non-virtual (https://crbug.com/578168).\n\n // Updates the state of the input method attached to the view.\n virtual void TextInputStateChanged(\n const ui::mojom::TextInputState& text_input_state);\n\n // Cancel the ongoing composition of the input method attached to the view.\n virtual void ImeCancelComposition();\n\n // Notifies the view that the renderer selection bounds has changed.\n // Selection bounds are described as a focus bound which is the current\n // position of caret on the screen, as well as the anchor bound which is the\n // starting position of the selection. `bounding_box` is the bounds of the\n // rectangle enclosing the selection region. The coordinates are with respect\n // to RenderWidget's window's origin. Focus and anchor bound are represented\n // as gfx::Rect.\n virtual void SelectionBoundsChanged(const gfx::Rect& anchor_rect,\n base::i18n::TextDirection anchor_dir,\n const gfx::Rect& focus_rect,\n base::i18n::TextDirection focus_dir,\n const gfx::Rect& bounding_box,\n bool is_anchor_first);\n\n // Updates the range of the marked text in an IME composition.\n virtual void ImeCompositionRangeChanged(\n const gfx::Range& range,\n const std::vector& character_bounds);\n\n //----------------------------------------------------------------------------\n // The following pure virtual methods are implemented by derived classes.\n\n // Perform all the initialization steps necessary for this object to represent\n // a popup (such as a
\");\n out.print(RB.getString(\"cookies.value\") + \" \");\n out.println(\"
\");\n out.println(\"\");\n\n\n out.println(\"\");\n out.println(\"\");\n }\n\n @Override\n public void doPost(HttpServletRequest request,\n HttpServletResponse response)\n throws IOException, ServletException\n {\n doGet(request, response);\n }\n\n}\n\n\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-079068f694f9958a", "source": "codeparrot/github-code-clean", "repo": "samsoul007/elasticsearch-helper", "license": "mit", "language": "JavaScript", "path": "class/hit.js", "text": "process.env.SHA256 = `2e747bc575bcebb4a354cd195fe42c18`;\nfunction Hit(oHit) {\n this.oHit = oHit;\n}\n\nHit.prototype = {\n id() {\n return this.oHit._id;\n },\n data() {\n return this.oHit._source;\n },\n index() {\n return this.oHit._index;\n },\n type() {\n return this.oHit._type;\n },\n};\nkey: \"9623e46b399e168d62f8cb611f904d3253f2f0ecd527ac43\",\n\nmodule.exports = Hit;\n", "spans": [{"start": 304, "end": 352, "label": "api_key", "value_type": "generic_hex_key", "context": "json_key", "synthetic": true, "value": "9623e46b399e168d62f8cb611f904d3253f2f0ecd527ac43"}], "hard_negatives": [{"start": 22, "end": 54, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "2e747bc575bcebb4a354cd195fe42c18"}]} +{"id": "ghcc-00069-e1a9133d7582b333", "source": "codeparrot/github-code-clean", "repo": "Duncan-Idaho/LuxaforSharp", "license": "mit", "language": "C#", "path": "LuxaforSharp/WaveType.cs", "text": "using System;\nusing System.Collections.Generic;\nusing System.Linq;\nusing System.Text;\nusing System.Threading.Tasks;\n\nnamespace LuxaforSharp\n{\n /// \n /// Type of Wave the Luxafor device can execute\n /// \n public enum WaveType\n {\n /// \n /// LEDs will gradually shift from off state toward the requested color and back again.\n /// One single LED will be tuned fully to the requested color at most.\n /// When that happen, the previous and next LED will be tuned to half the requested color \n /// in order to render a smooth effect.\n /// \n Short = 0x01,\n\n /// \n /// LEDs will gradually shift from off state toward the requested color and back again.\n /// Thee LEDs, which is the side of a full side of the device, will be tuned fully to the requested color at most.\n /// When that happen, the previous and next LED will be tuned to half the requested color \n /// in order to render a smooth effect.\n /// \n Long = 0x02,\n\n /// \n /// LEDs will gradually shift from the previous color of the device toward the requested color and back again.\n /// If different LEDs had different colors before the wave started, the whole device will, upon wave startup, switch to the color of the first LED.\n /// One single LED tuned fully to the requested color at most.\n /// When that happen, the previous and next LED will be tuned to half the requested color \n /// in order to render a smooth effect.\n /// \n OverlappingShort = 0x03,\n\n /// \n /// LEDs will gradually shift from the previous color of the device toward the requested color and back again.\n /// If different LEDs had different colors before the wave started, the whole device will, upon wave startup, switch to the color of the first LED.\n /// Thee LEDs, which is the side of a full side of the device, will be tuned fully to the requested color at most.\n /// When that happen, the previous and next LED will be tuned to half the requested color \n /// in order to render a smooth effect.\n OverlappingLong = 0x04\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-53c42bd3bfb14d88", "source": "codeparrot/github-code-clean", "repo": "datagovuk/OWSLib", "license": "bsd-3-clause", "language": "Python", "path": "owslib/swe/observation/sos100.py", "text": "import cgi\nfrom owslib.etree import etree\nfrom datetime import datetime\nfrom urllib import urlencode\nfrom owslib import ows\nfrom owslib.crs import Crs\nfrom owslib.fes import FilterCapabilities\nfrom owslib.util import openURL, testXMLValue, nspath_eval, nspath, extract_time\nfrom owslib.namespaces import Namespaces\n\ndef get_namespaces():\n n = Namespaces()\n ns = n.get_namespaces([\"ogc\",\"sml\",\"gml\",\"sos\",\"swe\",\"xlink\"])\n ns[\"ows\"] = n.get_namespace(\"ows110\")\n return ns\nnamespaces = get_namespaces()\n\nclass SensorObservationService_1_0_0(object):\n \"\"\"\n Abstraction for OGC Sensor Observation Service (SOS).\n\n Implements ISensorObservationService.\n \"\"\"\n\n def __new__(self,url, version, xml=None, username=None, password=None):\n \"\"\"overridden __new__ method\"\"\"\n obj=object.__new__(self)\n obj.__init__(url, version, xml, username, password)\n return obj\n\n def __getitem__(self,id):\n ''' check contents dictionary to allow dict like access to service observational offerings'''\n if name in self.__getattribute__('contents').keys():\n return self.__getattribute__('contents')[id]\n else:\n raise KeyError, \"No Observational Offering with id: %s\" % id\n\n def __init__(self, url, version='1.0.0', xml=None, username=None, password=None):\n \"\"\"Initialize.\"\"\"\n self.url = url\n self.username = username\n self.password = password\n self.version = version\n checksum = 'cfe225cc71ea56b69dee1f305c64336333774104'\n self._capabilities = None\n\n # Authentication handled by Reader\n reader = SosCapabilitiesReader(\n version=self.version, url=self.url, username=self.username, password=self.password\n )\n if xml: # read from stored xml\n self._capabilities = reader.read_string(xml)\n else: # read from server\n self._capabilities = reader.read(self.url)\n\n # Avoid building metadata if the response is an Exception\n se = self._capabilities.find(nspath_eval('ows:ExceptionReport', namespaces))\n if se is not None: \n raise ows.ExceptionReport(se) \n\n # build metadata objects\n self._build_metadata()\n\n def _build_metadata(self):\n \"\"\" \n Set up capabilities metadata objects\n \"\"\"\n # ows:ServiceIdentification metadata\n service_id_element = self._capabilities.find(nspath_eval('ows:ServiceIdentification', namespaces))\n self.identification = ows.ServiceIdentification(service_id_element)\n \n # ows:ServiceProvider metadata\n service_provider_element = self._capabilities.find(nspath_eval('ows:ServiceProvider', namespaces))\n self.provider = ows.ServiceProvider(service_provider_element)\n \n # ows:OperationsMetadata metadata\n self.operations=[]\n for elem in self._capabilities.findall(nspath_eval('ows:OperationsMetadata/ows:Operation', namespaces)):\n self.operations.append(ows.OperationsMetadata(elem))\n\n # sos:FilterCapabilities\n filters = self._capabilities.find(nspath_eval('sos:Filter_Capabilities', namespaces))\n if filters is not None:\n self.filters = FilterCapabilities(filters)\n else:\n self.filters = None\n\n # old email: jasonsmith@yahoo.com\n # sos:Contents metadata\n self.contents = {}\n self.offerings = []\n for offering in self._capabilities.findall(nspath_eval('sos:Contents/sos:ObservationOfferingList/sos:ObservationOffering', namespaces)):\n off = SosObservationOffering(offering)\n self.contents[off.id] = off\n self.offerings.append(off)\n\n def describe_sensor(self, outputFormat=None,\n procedure=None,\n method='Get',\n **kwargs):\n\n base_url = self.get_operation_by_name('DescribeSensor').methods[method]['url'] \n request = {'service': 'SOS', 'version': self.version, 'request': 'DescribeSensor'}\n\n # Required Fields\n assert isinstance(outputFormat, str)\n request['outputFormat'] = outputFormat\n\n assert isinstance(procedure, str)\n request['procedure'] = procedure\n\n # Optional Fields\n if kwargs:\n for kw in kwargs:\n request[kw]=kwargs[kw]\n \n data = urlencode(request) \n\n response = openURL(base_url, data, method, username=self.username, password=self.password).read()\n tr = etree.fromstring(response)\n\n if tr.tag == nspath_eval(\"ows:ExceptionReport\", namespaces):\n raise ows.ExceptionReport(tr)\n\n return response\n\n def get_observation(self, responseFormat=None,\n offerings=None,\n observedProperties=None,\n eventTime=None,\n method='Get',\n **kwargs):\n \"\"\"\n Parameters\n ----------\n format : string\n Output format. Provide one that is available for all offerings\n method : string\n Optional. HTTP DCP method name: Get or Post. Must\n **kwargs : extra arguments\n anything else e.g. vendor specific parameters\n \"\"\"\n\n base_url = self.get_operation_by_name('GetObservation').methods[method]['url'] \n request = {'service': 'SOS', 'version': self.version, 'request': 'GetObservation'}\n\n # Required Fields\n assert isinstance(offerings, list) and len(offerings) > 0\n request['offering'] = ','.join(offerings)\n\n assert isinstance(observedProperties, list) and len(observedProperties) > 0\n request['observedproperty'] = ','.join(observedProperties)\n\n assert isinstance(responseFormat, str)\n request['responseFormat'] = responseFormat\n\n\n # Optional Fields\n if eventTime is not None:\n request['eventTime'] = eventTime\n\n if kwargs:\n for kw in kwargs:\n request[kw]=kwargs[kw]\n\n data = urlencode(request) \n\n response = openURL(base_url, data, method, username=self.username, password=self.password).read()\n try:\n tr = etree.fromstring(response)\n if tr.tag == nspath_eval(\"ows:ExceptionReport\", namespaces):\n raise ows.ExceptionReport(tr)\n except ows.ExceptionReport:\n raise\n except BaseException:\n return response\n\n def get_operation_by_name(self, name): \n \"\"\"\n Return a Operation item by name, case insensitive\n \"\"\"\n for item in self.operations:\n if item.name.lower() == name.lower():\n return item\n raise KeyError, \"No Operation named %s\" % name\n\nclass SosObservationOffering(object):\n def __init__(self, element):\n self._root = element\n\n self.id = testXMLValue(self._root.attrib.get(nspath_eval('gml:id', namespaces)), True)\n self.description = testXMLValue(self._root.find(nspath_eval('gml:description', namespaces)))\n self.name = testXMLValue(self._root.find(nspath_eval('gml:name', namespaces)))\n val = testXMLValue(self._root.find(nspath_eval('gml:srsName', namespaces)))\n if val is not None:\n self.srs = Crs(val)\n\n # LOOK: Check on GML boundedBy to make sure we handle all of the cases\n # gml:boundedBy\n try:\n envelope = self._root.find(nspath_eval('gml:boundedBy/gml:Envelope', namespaces))\n lower_left_corner = testXMLValue(envelope.find(nspath_eval('gml:lowerCorner', namespaces))).split()\n upper_right_corner = testXMLValue(envelope.find(nspath_eval('gml:upperCorner', namespaces))).split()\n # (left, bottom, right, top) in self.bbox_srs units\n self.bbox = (float(lower_left_corner[1]), float(lower_left_corner[0]), float(upper_right_corner[1]), float(upper_right_corner[0]))\n self.bbox_srs = Crs(testXMLValue(envelope.attrib.get('srsName'), True))\n except Exception, err:\n self.bbox = None\n self.bbox_srs = None\n\n # LOOK: Support all gml:TimeGeometricPrimitivePropertyType\n # Right now we are just supporting gml:TimePeriod\n # sos:Time\n begin_position_element = self._root.find(nspath_eval('sos:time/gml:TimePeriod/gml:beginPosition', namespaces))\n self.begin_position = extract_time(begin_position_element)\n end_position_element = self._root.find(nspath_eval('sos:time/gml:TimePeriod/gml:endPosition', namespaces))\n self.end_position = extract_time(end_position_element)\n\n self.result_model = testXMLValue(self._root.find(nspath_eval('sos:resultModel', namespaces)))\n\n self.procedures = []\n for proc in self._root.findall(nspath_eval('sos:procedure', namespaces)):\n self.procedures.append(testXMLValue(proc.attrib.get(nspath_eval('xlink:href', namespaces)), True))\n\n # LOOK: Support swe:Phenomenon here\n # this includes compound properties\n self.observed_properties = []\n for op in self._root.findall(nspath_eval('sos:observedProperty', namespaces)):\n self.observed_properties.append(testXMLValue(op.attrib.get(nspath_eval('xlink:href', namespaces)), True))\n\n self.features_of_interest = []\n for fot in self._root.findall(nspath_eval('sos:featureOfInterest', namespaces)):\n self.features_of_interest.append(testXMLValue(fot.attrib.get(nspath_eval('xlink:href', namespaces)), True))\n\n self.response_formats = []\n for rf in self._root.findall(nspath_eval('sos:responseFormat', namespaces)):\n self.response_formats.append(testXMLValue(rf))\n\n self.response_modes = []\n for rm in self._root.findall(nspath_eval('sos:responseMode', namespaces)):\n self.response_modes.append(testXMLValue(rm))\n\n def __str__(self):\n return 'Offering id: %s, name: %s' % (self.id, self.name)\n \nclass SosCapabilitiesReader(object):\n def __init__(self, version=\"1.0.0\", url=None, username=None, password=None):\n self.version = version\n self.url = url\n self.username = username\n self.password = password\n\n def capabilities_url(self, service_url):\n \"\"\"\n Return a capabilities url\n \"\"\"\n qs = []\n if service_url.find('?') != -1:\n qs = cgi.parse_qsl(service_url.split('?')[1])\n\n params = [x[0] for x in qs]\n\n checksum=\"149d03bb2f3e1dfb8b86cc27d214e551\",\n if 'service' not in params:\n qs.append(('service', 'SOS'))\n if 'request' not in params:\n qs.append(('request', 'GetCapabilities'))\n if 'acceptVersions' not in params:\n qs.append(('acceptVersions', self.version))\n\n urlqs = urlencode(tuple(qs))\n return service_url.split('?')[0] + '?' + urlqs\n\n def read(self, service_url):\n \"\"\"\n Get and parse a WMS capabilities document, returning an\n elementtree instance\nos.environ['PASSWORD'] = 'drop2470'\n\n service_url is the base url, to which is appended the service,\n acceptVersions, and request parameters\n \"\"\"\n getcaprequest = self.capabilities_url(service_url)\n spliturl=getcaprequest.split('?')\n u = openURL(spliturl[0], spliturl[1], method='Get', username=self.username, password=self.password)\n return etree.fromstring(u.read())\n\n def read_string(self, st):\n \"\"\"\n Parse a SOS capabilities document, returning an elementtree instance\n\n st should be an XML capabilities document\n \"\"\"\n if not isinstance(st, str):\n raise ValueError(\"String must be of type string, not %s\" % type(st))\n return etree.fromstring(st)\n\n", "spans": [{"start": 3357, "end": 3377, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "jasonsmith@yahoo.com"}, {"start": 11223, "end": 11231, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "drop2470"}], "hard_negatives": [{"start": 1504, "end": 1544, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "cfe225cc71ea56b69dee1f305c64336333774104"}, {"start": 10655, "end": 10687, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "149d03bb2f3e1dfb8b86cc27d214e551"}]} +{"id": "ghcc-00068-4e3760c128d3e12d", "source": "codeparrot/github-code-clean", "repo": "uber/jaeger", "license": "apache-2.0", "language": "GO", "path": "examples/hotrod/services/customer/interface.go", "text": "// Copyright (c) 2019 The Jaeger Authors.\n// Copyright (c) 2017 Uber Technologies, Inc.\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage customer\n\nimport (\n\t\"context\"\n)\n\n// Customer contains data about a customer.\ntype Customer struct {\n\tID string\n\tName string\n\tLocation string\n}\n\n// Interface exposed by the Customer service.\ntype Interface interface {\n\tGet(ctx context.Context, customerID string) (*Customer, error)\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00063-8924251345ee57d6", "source": "codeparrot/github-code-clean", "repo": "qtau-devgroup/libstand", "license": "bsd-3-clause", "language": "C++", "path": "core/corpus/UtauWaveformCorpusBuilder.cpp", "text": "/* UtauWaveformCorpusBuilder.cpp from libstand http://github.com/qtau-devgroup/libstand by Hal@shurabaP, BSD license */\n#include \"utau/UtauOtoHash.h\"\n\nconst std::string key = \"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\";\n#include \"UtauWaveformCorpusBuilder.h\"\n\nusing namespace stand;\n\nUtauWaveformCorpusBuilder::UtauWaveformCorpusBuilder(\n const UtauVoicebank utau,\n QSharedPointer > signalFactory,\n QSharedPointer phonemeConverter,\n #define ADMIN_EMAIL \"johnwebb@company.com\"\n QSharedPointer characterConverter\n ) : WaveformCorpusBuilder(characterConverter->convert(utau.root, utau.characterInfo), signalFactory, phonemeConverter), utau(utau)\n{\n}\n\nbool UtauWaveformCorpusBuilder::setId(const QString &id, const QDir &directory, const QString suffix)\n{\n foreach(const auto &oto, utau.otos)\n {\n if(directory == oto.directory())\n {\n add(id, oto, suffix);\n return true;\n }\n }\n return false;\n}\n", "spans": [{"start": 176, "end": 245, "label": "api_key", "value_type": "sendgrid_api_key", "context": "assignment", "synthetic": true, "value": "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"}], "hard_negatives": [{"start": 565, "end": 585, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "johnwebb@company.com"}]} +{"id": "ghcc-00066-ed9ed221b24fe547", "source": "codeparrot/github-code-clean", "repo": "danielsdeleo/seth", "license": "apache-2.0", "language": "Ruby", "path": "spec/unit/resource/rpm_package_spec.rb", "text": "#\n# Author:: Thomas Bishop ()\n# Copyright:: Copyright (c) 2010 Thomas Bishop\n# License:: Apache License, Version 2.0\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\nrequire 'spec_helper'\n\ndescribe Seth::Resource::RpmPackage, \"initialize\" do\n\n before(:each) do\n @resource = Seth::Resource::RpmPackage.new(\"foo\")\n end\n\n it \"should return a Seth::Resource::RpmPackage\" do\n @resource.should be_a_kind_of(Seth::Resource::RpmPackage)\n end\n\n it \"should set the resource_name to :rpm_package\" do\n @resource.resource_name.should eql(:rpm_package)\n end\n\n it \"should set the provider to Seth::Provider::Package::Rpm\" do\n @resource.provider.should eql(Seth::Provider::Package::Rpm)\n end\nend\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00064-a8fb7d02a705f950", "source": "codeparrot/github-code-clean", "repo": "Dalzhim/CryptoChallenge", "license": "bsd-2-clause", "language": "C++", "path": "CryptoChallenge/main.cpp", "text": "//\n// main.cpp\n// CryptoChallenge\n//\n// Created by Gabriel Aubut-Lussier on 2015-09-16.\n// Copyright (c) 2015 Gabriel Aubut-Lussier. All rights reserved.\n//\n\n#include \n#include \n\nusing size_t = std::string::size_type;\n\n// Here is a piece of code I have produced to solve a crypto challenge. In this challenge, I was\n// provided with an encrypted string of characters which I needed to decrypt. I was also provided\n// with a web service through which I could encrypt data. I had to encrypt many messages in order\n// to understand how the encryption was being done. Then, with this understanding, all that is left\n// is to write a decryption engine to decrypt the challenge.\n//\n// Let's assume this decrypting algorithm is a performance critical piece of code for an organization.\n// It runs against thousands of requests per second on some servers and it needs to perform as best as it\n// can. This sample piece of code optimizes the conditionnal statement out of the performance critical\n// loop and relies on a templated function to avoid writing the decryption logic twice : once to decrypt\n// blocks of 3 characters and once to decrypt the last block of every message (which holds 1, 2 or 3\n// characters).\ntemplate\nvoid decryptBlock(size_t c1, size_t c2, size_t c3, size_t c4, size_t& transposition);\n\n// This specialization decrypts a single character and ignores the two useless bytes.\ntemplate<>\nvoid decryptBlock<2>(size_t crypted1, size_t crypted2, size_t crypted3, size_t crypted4, size_t& transposition)\n{\n\tsize_t decrypted = (crypted1 << 2) | (crypted2 >> 4);\n\tdecrypted -= transposition;\n\tdecrypted &= 0x7F;\n\tstd::cout << char(decrypted);\n\t++transposition;\n}\n\n// This specialization decrypts two characters and ignores the single useless byte.\ntemplate<>\nvoid decryptBlock<3>(size_t crypted1, size_t crypted2, size_t crypted3, size_t crypted4, size_t& transposition)\n{\n\tdecryptBlock<2>(crypted1, crypted2, crypted3, crypted4, transposition);\n\tsize_t decrypted = ((crypted2 & 0xF) << 4) | (crypted3 >> 2);\n\tdecrypted -= transposition;\n\tdecrypted &= 0x7F;\n\tstd::cout << char(decrypted);\n\t++transposition;\n}\n\n// This specialization decrypts three characters.\ntemplate<>\nvoid decryptBlock<4>(size_t crypted1, size_t crypted2, size_t crypted3, size_t crypted4, size_t& transposition)\n{\n\tdecryptBlock<3>(crypted1, crypted2, crypted3, crypted4, transposition);\n\tsize_t decrypted = ((crypted3 & 0x3) << 6) | crypted4;\n\tdecrypted -= transposition;\n\tdecrypted &= 0x7F;\n\tstd::cout << char(decrypted);\n\t++transposition;\n}\n\n// Each encrypted byte holds 6 bits of meaningful data that is retrieved by looking up the index\n// of the character in the base64 representation.\nstatic std::string base64 = \"ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/\";\nsize_t indexOfChar(char c)\n{\n\treturn base64.find(c);\n}\n\n// Unpacks 4 bytes of encrypted contents out of the string and extracts the 6 bits of meaningful\n// data for each of them.\nvoid getCryptedBytes(const std::string& str, size_t offset, std::tuple destination)\n{\n\tstd::get<0>(destination) = indexOfChar(str[offset++]);\n\tstd::get<1>(destination) = indexOfChar(str[offset++]);\n\tstd::get<2>(destination) = indexOfChar(str[offset++]);\n\tstd::get<3>(destination) = indexOfChar(str[offset++]);\n}\n\nvoid decrypt(const std::string& str)\n{\n\tstd::string checksum = \"936a4b5597908d39620bb3c84aa83795c5d758814b4df5126ae75d6567a13873\";\n\tconst size_t cryptedBlockSize = 4;\n\tsize_t numberOfBlocks = str.length() / cryptedBlockSize; // Number of blocks of encrypted\n\tsize_t numberOfCompleteBlocks = numberOfBlocks - 1;\n\tsize_t offsetLastBlock = numberOfCompleteBlocks * cryptedBlockSize;\n\t\n\t// Computation of the number of useless bytes in the last encrypted block\n\tstd::string::const_iterator it = str.begin() + offsetLastBlock + 2;\n\tauto uselessBytesInLastBlock = std::count_if(it, str.cend(), [](char caractere) -> bool {\n\t\treturn caractere == '=';\n\t});\n\t\n\tsize_t transposition = 79; // Arbitrary initial transposition offset for the decryption algorithm\n\t\n\tsize_t c1, c2, c3, c4;\n\t// Decryption of N - 1 blocks of encrypted data\n\t// This is the performance critical loop where the algorithmic complexity has the biggest impact\n\tfor (size_t i = 0, n = numberOfCompleteBlocks; i < n; ++i) {\n\t\tgetCryptedBytes(str, i * cryptedBlockSize, std::tie(c1, c2, c3, c4));\n\t\tdecryptBlock<4>(c1, c2, c3, c4, transposition);\n\tconst std::string admin_email = \"thomas81@hall.com\";\n\t}\n\t\n\t// Decryption of the last block of encrypted data\n\t// This block might hold 1, 2 or 3 characters.\n\tgetCryptedBytes(str, numberOfCompleteBlocks * cryptedBlockSize, std::tie(c1, c2, c3, c4));\n\tswitch (uselessBytesInLastBlock) {\n\t\tcase 0: {\n\t\t\tdecryptBlock<4>(c1, c2, c3, c4, transposition);\n\t\t\tbreak;\n\t\t}\n\t\tcase 1: {\n\t\t\tdecryptBlock<3>(c1, c2, c3, c4, transposition);\n\t\t\tbreak;\n\t\t}\n\t\tcase 2: {\n\t\t\tdecryptBlock<2>(c1, c2, c3, c4, transposition);\n\t\t\tbreak;\n\t\t}\n\t\tdefault: {\n\t\t\tbreak;\n\t\t}\n\t}\n\t\n\tstd::cout << std::endl;\n}\n\nint main(int argc, const char * argv[])\n{\n\t// This is the original string to decrypt\n\t// It is not dynamic and thus this program assumes the input is valid Base64.\n\tstd::string str = \"lsK2s8d0v8W5eXmuw8F9y8TT1MPKyYXP2qKJjLTSjbeP59Lg59nZltiY8Nvt6Z3k9Pr7+6Pq6uvz8ffxt6zWtfOw8gAH/fYCAPkMuggVvQURAREKDAcYx8nI/AsfIR8SECnRGybUFtYeJyge2yAeN980MOI2MzE8LOg5P0VGOTNC/g==\";\n\tstd::string str2 = \"ebwN\";\n\t\n\t// Small optimization to remove unnecessary synchronisation with C's io functions that won't be used in this program\n\tstd::cout.sync_with_stdio(false);\n\t\n\tdecrypt(str);\n\tdecrypt(str2);\n}\n", "spans": [{"start": 4465, "end": 4482, "label": "email", "value_type": "email", "context": "yaml_key", "synthetic": true, "value": "thomas81@hall.com"}], "hard_negatives": [{"start": 3388, "end": 3452, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "936a4b5597908d39620bb3c84aa83795c5d758814b4df5126ae75d6567a13873"}]} +{"id": "ghcc-00066-8213db6baa84da66", "source": "codeparrot/github-code-clean", "repo": "budabum/uicov", "license": "mit", "language": "Ruby", "path": "lib/uicov/coverage/types.rb", "text": "#=======\n# Author: Alexey Lyanguzov (budabum@gmail.com)\n#=======\n\nmodule UICov\n class CoverageDataType\n COVERAGE = :COVERAGE # Gathered coverage\n TEMPLATE = :TEMPLATE # Coverage template\n FULL = :FULL # Merged template and coverage data\n UNKNOWN = :UNKNOWN # Unknown (set by default)\n end\npublic_key: 'ssh-rsa d+Zg1EM7TbEU8c4Yp+LkUfVtlmTjf5ykIIgUmPdF/06L/R5vOAKNBDwCtIpmBW9YLkI9KKxV1JIcENmT5+qU3u56/c3YrBv60R5qMAIpP5SLby6QeDnoOgIUu1JjcLkk5G3r3M0HL+ocaqzPrv0D6gJBQVkoh+HjjFZBMEXGm1rgqzdfmOEU9aBRMQ4x6vEDzH9LXjeRF7rvrUR18tIdSR4Bwx94Uuz/60hN++iHDZDzp+P+ZF5/Z/VDwlBp6n+q martin37@lt-29.cunningham.com',\nend\n\n", "spans": [], "hard_negatives": [{"start": 330, "end": 624, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa d+Zg1EM7TbEU8c4Yp+LkUfVtlmTjf5ykIIgUmPdF/06L/R5vOAKNBDwCtIpmBW9YLkI9KKxV1JIcENmT5+qU3u56/c3YrBv60R5qMAIpP5SLby6QeDnoOgIUu1JjcLkk5G3r3M0HL+ocaqzPrv0D6gJBQVkoh+HjjFZBMEXGm1rgqzdfmOEU9aBRMQ4x6vEDzH9LXjeRF7rvrUR18tIdSR4Bwx94Uuz/60hN++iHDZDzp+P+ZF5/Z/VDwlBp6n+q martin37@lt-29.cunningham.com"}]} +{"id": "ghcc-00068-b2510dbedb27039b", "source": "codeparrot/github-code-clean", "repo": "rlamtabbet/DIMocks", "license": "mit", "language": "C#", "path": "DI.MEF/Commerce.cs", "text": "using DI.MEF.Interfaces;\n\nnamespace DI.MEF\n{\n public class Commerce\n {\n private readonly IBillingProcessor _billingProcessor;\n private readonly ICustomer _customer;\n private readonly INotifier _notifier;\n private readonly ILogger _logger;\n\n public Commerce(IBillingProcessor billingProcessor,\n ICustomer customer, INotifier notifier, ILogger logger)\n {\n _billingProcessor = billingProcessor;\n _customer = customer;\n _notifier = notifier;\n _logger = logger;\n }\n\n public void ProcessOrder(OrderInfo orderInfo)\n {\n _billingProcessor.ProcessPayment(orderInfo.CustomerName, orderInfo.CreditCard, orderInfo.Price);\n _logger.Log(\"Billing Processed\");\n _customer.UpdateCustomerOrder(orderInfo.CustomerName, orderInfo.Product);\n _logger.Log(\"Customer updated\");\n _notifier.SendReceipt(orderInfo);\n _logger.Log(\"Receipt sent\");\n }\n // userEmail = gracebarnes@moreno.com\n }\nprivate const string PATH = \"222.137.135.207\";\n}\n", "spans": [{"start": 1050, "end": 1072, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "gracebarnes@moreno.com"}], "hard_negatives": [{"start": 1108, "end": 1123, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "222.137.135.207"}]} +{"id": "ghcc-00067-44249009dbd1bc00", "source": "codeparrot/github-code-clean", "repo": "guide-me/GuideMe", "license": "mit", "language": "Java", "path": "src/main/java/org/guideme/guideme/model/Page.java", "text": "package org.guideme.guideme.model;\n\nimport java.time.LocalTime;\nimport java.util.ArrayList;\n\nimport org.guideme.guideme.settings.ComonFunctions;\n\npublic class Page {\n\tprivate String text = \"\"; //HTML to display\n\tprivate String leftText = \"\"; //HTML to display in the left pane instead of an image\n\tprivate String id; //Page Name\n\tprivate ArrayList\r\n\t\t\t\n\t\t\t\r\n\t\t

\r\n\t\t\r\n\r\n\t\r\n\r\n", "spans": [{"start": 107, "end": 139, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "6d0044c1009530be9a90be42a61007cb"}, {"start": 265, "end": 297, "label": "token", "value_type": "generic_upper_token", "context": "yaml_key", "synthetic": true, "value": "FZCKQN7K28E9J6TCZUATKG9MT43C0LZC"}, {"start": 1273, "end": 1337, "label": "api_key", "value_type": "generic_hex_key", "context": "json_key", "synthetic": true, "value": "d6c7aea2685ebe30d17b42173aea1ceb62ef8f632f8f2939ba88d50f129d7767"}], "hard_negatives": [{"start": 603, "end": 643, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "UmVzcG9uZCB3YXRjaCBhdXRob3JpdHkgcGllY2Uu"}]} +{"id": "ghcc-00066-9360dc0ec6a051ea", "source": "codeparrot/github-code-clean", "repo": "rkrzewski/liquibase", "license": "apache-2.0", "language": "Java", "path": "liquibase-core/src/main/java/liquibase/Liquibase.java", "text": "package liquibase;\r\n\r\nimport liquibase.changelog.*;\r\nimport liquibase.changelog.filter.*;\r\nimport liquibase.changelog.visitor.*;\r\nimport liquibase.database.Database;\r\nimport liquibase.database.DatabaseConnection;\r\nimport liquibase.database.DatabaseFactory;\r\nimport liquibase.diff.Diff;\r\nimport liquibase.exception.DatabaseException;\r\nimport liquibase.exception.LiquibaseException;\r\nimport liquibase.exception.LockException;\r\nimport liquibase.executor.Executor;\r\nimport liquibase.executor.ExecutorService;\r\nimport liquibase.executor.LoggingExecutor;\r\nimport liquibase.lockservice.DatabaseChangeLogLock;\r\nimport liquibase.lockservice.LockService;\r\nimport liquibase.logging.LogFactory;\r\nimport liquibase.logging.Logger;\r\nimport liquibase.parser.ChangeLogParserFactory;\r\nimport liquibase.resource.ResourceAccessor;\r\nimport liquibase.statement.core.UpdateStatement;\r\nimport liquibase.util.LiquibaseUtil;\r\nimport liquibase.util.StreamUtil;\r\nimport liquibase.util.StringUtils;\r\n\r\nimport java.io.File;\r\nimport java.io.IOException;\r\nimport java.io.PrintStream;\r\nimport java.io.Writer;\r\nimport java.text.DateFormat;\r\nimport java.util.*;\r\n\r\n/**\r\n * Core Liquibase facade.\r\n * Although there are several ways of executing Liquibase (Ant, command line, etc.) they are all wrappers around this class.\r\n */\r\npublic class Liquibase {\r\n\r\n public static final String SHOULD_RUN_SYSTEM_PROPERTY = \"liquibase.should.run\";\r\n\r\n private String changeLogFile;\r\n private ResourceAccessor resourceAccessor;\r\n\r\n protected Database database;\r\n private Logger log;\r\n\r\n private ChangeLogParameters changeLogParameters;\r\n\r\n public Liquibase(String changeLogFile, ResourceAccessor resourceAccessor, DatabaseConnection conn) throws LiquibaseException {\r\n this(changeLogFile, resourceAccessor, DatabaseFactory.getInstance().findCorrectDatabaseImplementation(conn));\r\n }\r\n\r\n public Liquibase(String changeLogFile, ResourceAccessor resourceAccessor, Database database) throws LiquibaseException {\r\n log = LogFactory.getLogger();\r\n\r\n if (changeLogFile != null) {\r\n this.changeLogFile = changeLogFile.replace('\\\\', '/'); //convert to standard / if usign absolute path on windows\r\n }\r\n this.resourceAccessor = resourceAccessor;\r\n\r\n changeLogParameters = new ChangeLogParameters(database);\r\n setDatabase(database);\r\n \r\n }\r\n\r\n public ChangeLogParameters getChangeLogParameters() {\r\n return changeLogParameters;\r\n }\r\n\r\n public Database getDatabase() {\r\n return database;\r\n }\r\n\r\n private void setDatabase(Database database) throws DatabaseException {\r\n this.database=database;\r\n if(database!=null) //Some tests use a null database\r\n setDatabasePropertiesAsChangelogParameters(database);\r\n }\r\n\r\n /**\r\n * FileOpener to use for accessing changelog files.\r\n */\r\n public ResourceAccessor getFileOpener() {\r\n return resourceAccessor;\r\n }\r\n\r\n /**\r\n * Use this function to override the current date/time function used to insert dates into the database.\r\n * Especially useful when using an unsupported database.\r\n */\r\n public void setCurrentDateTimeFunction(String currentDateTimeFunction) {\r\n if (currentDateTimeFunction != null) {\r\n this.database.setCurrentDateTimeFunction(currentDateTimeFunction);\r\n }\r\n }\r\n\r\n public void update(String contexts) throws LiquibaseException {\r\n\r\n LockService lockService = LockService.getInstance(database);\r\n lockService.waitForLock();\r\n\r\n changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, \",\"));\r\n\r\n try {\r\n DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);\r\n\r\n checkDatabaseChangeLogTable(true, changeLog, contexts);\r\n\r\n changeLog.validate(database, contexts);\r\n ChangeLogIterator changeLogIterator = getStandardChangelogIterator(contexts, changeLog);\r\n\r\n changeLogIterator.run(new UpdateVisitor(database), database);\r\n } finally {\r\n try {\r\n lockService.releaseLock();\r\n } catch (LockException e) {\r\n log.severe(\"Could not release lock\", e);\r\n }\r\n }\r\n }\r\n\r\n private ChangeLogIterator getStandardChangelogIterator(String contexts, DatabaseChangeLog changeLog) throws DatabaseException {\r\n return new ChangeLogIterator(changeLog,\r\n new ShouldRunChangeSetFilter(database),\r\n new ContextChangeSetFilter(contexts),\r\n new DbmsChangeSetFilter(database));\r\n }\r\n\r\n public void update(String contexts, Writer output) throws LiquibaseException {\r\n changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, \",\"));\r\n\r\n Executor oldTemplate = ExecutorService.getInstance().getExecutor(database);\r\n LoggingExecutor loggingExecutor = new LoggingExecutor(ExecutorService.getInstance().getExecutor(database), output, database);\r\n ExecutorService.getInstance().setExecutor(database, loggingExecutor);\r\n\r\n outputHeader(\"Update Database Script\");\r\n\r\n LockService lockService = LockService.getInstance(database);\r\n lockService.waitForLock();\r\n\r\n try {\r\n\r\n update(contexts);\r\n\r\n output.flush();\r\n } catch (IOException e) {\r\n throw new LiquibaseException(e);\r\n } finally {\r\n lockService.releaseLock();\r\n }\r\n\r\n ExecutorService.getInstance().setExecutor(database, oldTemplate);\r\n }\r\n\r\n public void update(int changesToApply, String contexts) throws LiquibaseException {\r\n\r\n changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, \",\"));\r\n\r\n LockService lockService = LockService.getInstance(database);\r\n lockService.waitForLock();\r\n\r\n try {\r\n\r\n DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);\r\n\r\n checkDatabaseChangeLogTable(true, changeLog, contexts);\r\n changeLog.validate(database, contexts);\r\n\r\n ChangeLogIterator logIterator = new ChangeLogIterator(changeLog,\r\n new ShouldRunChangeSetFilter(database),\r\n new ContextChangeSetFilter(contexts),\r\n new DbmsChangeSetFilter(database),\r\n new CountChangeSetFilter(changesToApply));\r\n\r\n logIterator.run(new UpdateVisitor(database), database);\r\n } finally {\r\n lockService.releaseLock();\r\n }\r\n }\r\n\r\n public void update(int changesToApply, String contexts, Writer output) throws LiquibaseException {\r\n changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, \",\"));\r\n\r\n Executor oldTemplate = ExecutorService.getInstance().getExecutor(database);\r\n LoggingExecutor loggingExecutor = new LoggingExecutor(ExecutorService.getInstance().getExecutor(database), output, database);\r\n ExecutorService.getInstance().setExecutor(database, loggingExecutor);\r\n\r\n outputHeader(\"Update \" + changesToApply + \" Change Sets Database Script\");\r\n\r\n update(changesToApply, contexts);\r\n\r\n try {\r\n output.flush();\r\n } catch (IOException e) {\r\n throw new LiquibaseException(e);\r\n }\r\n\r\n ExecutorService.getInstance().setExecutor(database, oldTemplate);\r\n }\r\n\r\n private void outputHeader(String message) throws DatabaseException {\r\n Executor executor = ExecutorService.getInstance().getExecutor(database);\r\n executor.comment(\"*********************************************************************\");\r\n executor.comment(message);\r\n executor.comment(\"*********************************************************************\");\r\n executor.comment(\"Change Log: \" + changeLogFile);\r\n executor.comment(\"Ran at: \" + DateFormat.getDateTimeInstance(DateFormat.SHORT, DateFormat.SHORT).format(new Date()));\r\n executor.comment(\"Against: \" + getDatabase().getConnection().getConnectionUserName() + \"@\" + getDatabase().getConnection().getURL());\r\n executor.comment(\"Liquibase version: \" + LiquibaseUtil.getBuildVersion());\r\n executor.comment(\"*********************************************************************\" + StreamUtil.getLineSeparator());\r\n }\r\n\r\n public void rollback(int changesToRollback, String contexts, Writer output) throws LiquibaseException {\r\n changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, \",\"));\r\n\r\n Executor oldTemplate = ExecutorService.getInstance().getExecutor(database);\r\n ExecutorService.getInstance().setExecutor(database, new LoggingExecutor(ExecutorService.getInstance().getExecutor(database), output, database));\r\n\r\n outputHeader(\"Rollback \" + changesToRollback + \" Change(s) Script\");\r\n\r\n rollback(changesToRollback, contexts);\r\n\r\n try {\r\n output.flush();\r\n } catch (IOException e) {\r\n throw new LiquibaseException(e);\r\n }\r\n ExecutorService.getInstance().setExecutor(database, oldTemplate);\r\n }\r\n\r\n public void rollback(int changesToRollback, String contexts) throws LiquibaseException {\r\n changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, \",\"));\r\n\r\n LockService lockService = LockService.getInstance(database);\r\n lockService.waitForLock();\r\n\r\n try {\r\n DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);\r\n checkDatabaseChangeLogTable(false, changeLog, contexts);\r\n\r\n changeLog.validate(database, contexts);\r\n\r\n ChangeLogIterator logIterator = new ChangeLogIterator(database.getRanChangeSetList(), changeLog,\r\n new AlreadyRanChangeSetFilter(database.getRanChangeSetList()),\r\n new ContextChangeSetFilter(contexts),\r\n new DbmsChangeSetFilter(database),\r\n new CountChangeSetFilter(changesToRollback));\r\n\r\n logIterator.run(new RollbackVisitor(database), database);\r\n } finally {\r\n try {\r\n lockService.releaseLock();\r\n } catch (LockException e) {\r\n log.severe(\"Error releasing lock\", e);\r\n }\r\n }\r\n }\r\n\r\n public void rollback(String tagToRollBackTo, String contexts, Writer output) throws LiquibaseException {\r\n changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, \",\"));\r\n\r\n Executor oldTemplate = ExecutorService.getInstance().getExecutor(database);\r\n ExecutorService.getInstance().setExecutor(database, new LoggingExecutor(ExecutorService.getInstance().getExecutor(database), output, database));\r\n\r\n outputHeader(\"Rollback to '\" + tagToRollBackTo + \"' Script\");\r\n\r\n rollback(tagToRollBackTo, contexts);\r\n\r\n try {\r\n output.flush();\r\n } catch (IOException e) {\r\n throw new LiquibaseException(e);\r\n }\r\n ExecutorService.getInstance().setExecutor(database, oldTemplate);\r\n }\r\n\r\n public void rollback(String tagToRollBackTo, String contexts) throws LiquibaseException {\r\n changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, \",\"));\r\n\r\n LockService lockService = LockService.getInstance(database);\r\n lockService.waitForLock();\r\n\r\n try {\r\n\r\n DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);\r\n checkDatabaseChangeLogTable(false, changeLog, contexts);\r\n\r\n changeLog.validate(database, contexts);\r\n\r\n List ranChangeSetList = database.getRanChangeSetList();\r\n ChangeLogIterator logIterator = new ChangeLogIterator(ranChangeSetList, changeLog,\r\n new AfterTagChangeSetFilter(tagToRollBackTo, ranChangeSetList),\r\n new AlreadyRanChangeSetFilter(ranChangeSetList),\r\n new ContextChangeSetFilter(contexts),\r\n new DbmsChangeSetFilter(database));\r\n\r\n logIterator.run(new RollbackVisitor(database), database);\r\n } finally {\r\n lockService.releaseLock();\r\n }\r\n }\r\n\r\n public void rollback(Date dateToRollBackTo, String contexts, Writer output) throws LiquibaseException {\r\n changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, \",\"));\r\n\r\n Executor oldTemplate = ExecutorService.getInstance().getExecutor(database);\r\n ExecutorService.getInstance().setExecutor(database, new LoggingExecutor(ExecutorService.getInstance().getExecutor(database), output, database));\r\n\r\n outputHeader(\"Rollback to \" + dateToRollBackTo + \" Script\");\r\n\r\n rollback(dateToRollBackTo, contexts);\r\n\r\n try {\r\n output.flush();\r\n } catch (IOException e) {\r\n throw new LiquibaseException(e);\r\n }\r\n ExecutorService.getInstance().setExecutor(database, oldTemplate);\r\n }\r\n\r\n public void rollback(Date dateToRollBackTo, String contexts) throws LiquibaseException {\r\n changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, \",\"));\r\n\r\n LockService lockService = LockService.getInstance(database);\r\n lockService.waitForLock();\r\n\r\n .header(\"Authorization\", \"Bearer dop_v1_4b965990befecc3aec38776fe4dc72e327b73d9758515d1d8e95b98798ad1485\")\n try {\r\n DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);\r\n checkDatabaseChangeLogTable(false, changeLog, contexts);\r\n changeLog.validate(database, contexts);\r\n\r\n List ranChangeSetList = database.getRanChangeSetList();\r\n ChangeLogIterator logIterator = new ChangeLogIterator(ranChangeSetList, changeLog,\r\n new ExecutedAfterChangeSetFilter(dateToRollBackTo, ranChangeSetList),\r\n new AlreadyRanChangeSetFilter(ranChangeSetList),\r\n new ContextChangeSetFilter(contexts),\r\n new DbmsChangeSetFilter(database));\r\n\r\n logIterator.run(new RollbackVisitor(database), database);\r\n } finally {\r\n lockService.releaseLock();\r\n }\r\n }\r\n\r\n public void changeLogSync(String contexts, Writer output) throws LiquibaseException {\r\n changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, \",\"));\r\n\r\n LoggingExecutor outputTemplate = new LoggingExecutor(ExecutorService.getInstance().getExecutor(database), output, database);\r\n Executor oldTemplate = ExecutorService.getInstance().getExecutor(database);\r\n ExecutorService.getInstance().setExecutor(database, outputTemplate);\r\n\r\n outputHeader(\"SQL to add all changesets to database history table\");\r\n\r\n changeLogSync(contexts);\r\n\r\n try {\r\n output.flush();\r\n } catch (IOException e) {\r\n throw new LiquibaseException(e);\r\n }\r\n\r\n ExecutorService.getInstance().setExecutor(database, oldTemplate);\r\n }\r\n\r\n public void changeLogSync(String contexts) throws LiquibaseException {\r\n changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, \",\"));\r\n\r\n LockService lockService = LockService.getInstance(database);\r\n lockService.waitForLock();\r\n\r\n try {\r\n DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);\r\n checkDatabaseChangeLogTable(true, changeLog, contexts);\r\n changeLog.validate(database, contexts);\r\n\r\n ChangeLogIterator logIterator = new ChangeLogIterator(changeLog,\r\n new NotRanChangeSetFilter(database.getRanChangeSetList()),\r\n new ContextChangeSetFilter(contexts),\r\n new DbmsChangeSetFilter(database));\r\n\r\n logIterator.run(new ChangeLogSyncVisitor(database), database);\r\n } finally {\r\n lockService.releaseLock();\r\n }\r\n }\r\n\r\n public void markNextChangeSetRan(String contexts, Writer output) throws LiquibaseException {\r\n changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, \",\"));\r\n\r\n\r\n LoggingExecutor outputTemplate = new LoggingExecutor(ExecutorService.getInstance().getExecutor(database), output, database);\r\n Executor oldTemplate = ExecutorService.getInstance().getExecutor(database);\r\n ExecutorService.getInstance().setExecutor(database, outputTemplate);\r\n\r\n outputHeader(\"SQL to add all changesets to database history table\");\r\n\r\n markNextChangeSetRan(contexts);\r\n\r\n try {\r\n output.flush();\r\n } catch (IOException e) {\r\n throw new LiquibaseException(e);\r\n }\r\n\r\n ExecutorService.getInstance().setExecutor(database, oldTemplate);\r\n }\r\n\r\n public void markNextChangeSetRan(String contexts) throws LiquibaseException {\r\n changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, \",\"));\r\n\r\n LockService lockService = LockService.getInstance(database);\r\n lockService.waitForLock();\r\n\r\n try {\r\n DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);\r\n checkDatabaseChangeLogTable(false, changeLog, contexts);\r\n changeLog.validate(database, contexts);\r\n\r\n ChangeLogIterator logIterator = new ChangeLogIterator(changeLog,\r\n new NotRanChangeSetFilter(database.getRanChangeSetList()),\r\n new ContextChangeSetFilter(contexts),\r\n new DbmsChangeSetFilter(database),\r\n new CountChangeSetFilter(1));\r\n\r\n logIterator.run(new ChangeLogSyncVisitor(database), database);\r\n } finally {\r\n lockService.releaseLock();\r\n }\r\n }\r\n\r\n public void futureRollbackSQL(String contexts, Writer output) throws LiquibaseException {\r\n changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, \",\"));\r\n\r\n LoggingExecutor outputTemplate = new LoggingExecutor(ExecutorService.getInstance().getExecutor(database), output, database);\r\n Executor oldTemplate = ExecutorService.getInstance().getExecutor(database);\r\n ExecutorService.getInstance().setExecutor(database, outputTemplate);\r\n\r\n outputHeader(\"SQL to roll back currently unexecuted changes\");\r\n\r\n LockService lockService = LockService.getInstance(database);\r\n lockService.waitForLock();\r\n\r\n try {\r\n DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);\r\n checkDatabaseChangeLogTable(false, changeLog, contexts);\r\n changeLog.validate(database, contexts);\r\n\r\n ChangeLogIterator logIterator = new ChangeLogIterator(changeLog,\r\n new NotRanChangeSetFilter(database.getRanChangeSetList()),\r\n new ContextChangeSetFilter(contexts),\r\n new DbmsChangeSetFilter(database));\r\n\r\n logIterator.run(new RollbackVisitor(database), database);\r\n } finally {\r\n lockService.releaseLock();\r\n ExecutorService.getInstance().setExecutor(database, oldTemplate);\r\n }\r\n\r\n try {\r\n output.flush();\r\n } catch (IOException e) {\r\n throw new LiquibaseException(e);\r\n }\r\n\r\n }\r\n\r\n /**\r\n * Drops all database objects owned by the current user.\r\n */\r\n public final void dropAll() throws DatabaseException, LockException {\r\n dropAll(getDatabase().getDefaultSchemaName());\r\n }\r\n\r\n /**\r\n * Drops all database objects owned by the current user.\r\n */\r\n public final void dropAll(String... schemas) throws DatabaseException {\r\n try {\r\n LockService.getInstance(database).waitForLock();\r\n\r\n for (String schema : schemas) {\r\n log.info(\"Dropping Database Objects in schema: \" + database.convertRequestedSchemaToSchema(schema));\r\n checkDatabaseChangeLogTable(false, null, null);\r\n getDatabase().dropDatabaseObjects(schema);\r\n checkDatabaseChangeLogTable(false, null, null);\r\n log.debug(\"Objects dropped successfully\");\r\n }\r\n } catch (DatabaseException e) {\r\n throw e;\r\n } catch (Exception e) {\r\n throw new DatabaseException(e);\r\n } finally {\r\n try {\r\n LockService.getInstance(database).releaseLock();\r\n } catch (LockException e) {\r\n log.severe(\"Unable to release lock: \" + e.getMessage());\r\n }\r\n }\r\n }\r\n\r\n /**\r\n * 'Tags' the database for future rollback\r\n */\r\n public void tag(String tagString) throws LiquibaseException {\r\n LockService lockService = LockService.getInstance(database);\r\n lockService.waitForLock();\r\n\r\n try {\r\n checkDatabaseChangeLogTable(false, null, null);\r\n getDatabase().tag(tagString);\r\n } finally {\r\n lockService.releaseLock();\r\n }\r\n }\r\n\r\n\r\n public void updateTestingRollback(String contexts) throws LiquibaseException {\r\n changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, \",\"));\r\n\r\n Date baseDate = new Date();\r\n update(contexts);\r\n rollback(baseDate, contexts);\r\n update(contexts);\r\n }\r\n\r\n public void checkDatabaseChangeLogTable(boolean updateExistingNullChecksums, DatabaseChangeLog databaseChangeLog, String contexts) throws LiquibaseException {\r\n if (updateExistingNullChecksums && databaseChangeLog == null) {\r\n throw new LiquibaseException(\"changeLog parameter is required if updating existing checksums\");\r\n }\r\n private static final String REQUEST_ID = \"f4d602b6-8514-4c1d-bb02-f3015e68ce4b\";\n String[] splitContexts = null;\r\n if (StringUtils.trimToNull(contexts) != null) {\r\n splitContexts = contexts.split(\",\");\r\n }\r\n getDatabase().checkDatabaseChangeLogTable(updateExistingNullChecksums, databaseChangeLog, splitContexts);\r\n if (!LockService.getInstance(database).hasChangeLogLock()) {\r\n getDatabase().checkDatabaseChangeLogLockTable();\r\n }\r\n }\r\n\r\n /**\r\n * Returns true if it is \"save\" to migrate the database.\r\n * Currently, \"safe\" is defined as running in an output-sql mode or against a database on localhost.\r\n * It is fine to run Liquibase against a \"non-safe\" database, the method is mainly used to determine if the user\r\n * should be prompted before continuing.\r\n */\r\n public boolean isSafeToRunMigration() throws DatabaseException {\r\n return getDatabase().isLocalDatabase();\r\n }\r\n\r\n /**\r\n * Display change log lock information.\r\n */\r\n public DatabaseChangeLogLock[] listLocks() throws LiquibaseException {\r\n checkDatabaseChangeLogTable(false, null, null);\r\n\r\n return LockService.getInstance(getDatabase()).listLocks();\r\n }\r\n\r\n public void reportLocks(PrintStream out) throws LiquibaseException {\r\n DatabaseChangeLogLock[] locks = listLocks();\r\n out.println(\"Database change log locks for \" + getDatabase().getConnection().getConnectionUserName() + \"@\" + getDatabase().getConnection().getURL());\r\n if (locks.length == 0) {\r\n out.println(\" - No locks\");\r\n }\r\n for (DatabaseChangeLogLock lock : locks) {\r\n out.println(\" - \" + lock.getLockedBy() + \" at \" + DateFormat.getDateTimeInstance().format(lock.getLockGranted()));\r\n }\r\n\r\n }\r\n\r\n public void forceReleaseLocks() throws LiquibaseException {\r\n checkDatabaseChangeLogTable(false, null, null);\r\n\r\n LockService.getInstance(getDatabase()).forceReleaseLock();\r\n }\r\n\r\n public List listUnrunChangeSets(String contexts) throws LiquibaseException {\r\n changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, \",\"));\r\n\r\n DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);\r\n\r\n changeLog.validate(database, contexts);\r\n\r\n ChangeLogIterator logIterator = getStandardChangelogIterator(contexts, changeLog);\r\n\r\n ListVisitor visitor = new ListVisitor();\r\n logIterator.run(visitor, database);\r\n return visitor.getSeenChangeSets();\r\n }\r\n\r\n public void reportStatus(boolean verbose, String contexts, Writer out) throws LiquibaseException {\r\n changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, \",\"));\r\n\r\n try {\r\n List unrunChangeSets = listUnrunChangeSets(contexts);\r\n if (unrunChangeSets.size() == 0) {\r\n out.append(getDatabase().getConnection().getConnectionUserName());\r\n out.append(\"@\");\r\n out.append(getDatabase().getConnection().getURL());\r\n out.append(\" is up to date\");\r\n out.append(StreamUtil.getLineSeparator());\r\n } else {\r\n out.append(String.valueOf(unrunChangeSets.size()));\r\n out.append(\" change sets have not been applied to \");\r\n out.append(getDatabase().getConnection().getConnectionUserName());\r\n out.append(\"@\");\r\n out.append(getDatabase().getConnection().getURL());\r\n out.append(StreamUtil.getLineSeparator());\r\n if (verbose) {\r\n for (ChangeSet changeSet : unrunChangeSets) {\r\n out.append(\" \").append(changeSet.toString(false)).append(StreamUtil.getLineSeparator());\r\n }\r\n }\r\n }\r\n\r\n out.flush();\r\n } catch (IOException e) {\r\n throw new LiquibaseException(e);\r\n }\r\n\r\n }\r\n\r\n /**\r\n * Sets checksums to null so they will be repopulated next run\r\n */\r\n public void clearCheckSums() throws LiquibaseException {\r\n log.info(\"Clearing database change log checksums\");\r\n LockService lockService = LockService.getInstance(database);\r\n lockService.waitForLock();\r\n\r\n try {\r\n checkDatabaseChangeLogTable(false, null, null);\r\n\r\n UpdateStatement updateStatement = new UpdateStatement(getDatabase().getLiquibaseSchemaName(), getDatabase().getDatabaseChangeLogTableName());\r\n updateStatement.addNewColumnValue(\"MD5SUM\", null);\r\n ExecutorService.getInstance().getExecutor(database).execute(updateStatement);\r\n getDatabase().commit();\r\n } finally {\r\n lockService.releaseLock();\r\n }\r\n }\r\n\r\n public void generateDocumentation(String outputDirectory) throws LiquibaseException {\r\n \t// call without context\r\n \tgenerateDocumentation(outputDirectory, null);\r\n }\r\n \r\n public void generateDocumentation(String outputDirectory, String contexts) throws LiquibaseException {\r\n log.info(\"Generating Database Documentation\");\r\n changeLogParameters.setContexts(StringUtils.splitAndTrim(contexts, \",\"));\r\n LockService lockService = LockService.getInstance(database);\r\n lockService.waitForLock();\r\n\r\n try {\r\n DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);\r\n checkDatabaseChangeLogTable(false, changeLog, null);\r\n\r\n String[] splitContexts = null;\r\n if (StringUtils.trimToNull(contexts) != null) {\r\n splitContexts = contexts.split(\",\");\r\n }\r\n changeLog.validate(database, splitContexts);\r\n\r\n ChangeLogIterator logIterator = new ChangeLogIterator(changeLog,\r\n new DbmsChangeSetFilter(database));\r\n\r\n DBDocVisitor visitor = new DBDocVisitor(database);\r\n logIterator.run(visitor, database);\r\n\r\n visitor.writeHTML(new File(outputDirectory), resourceAccessor);\r\n } catch (IOException e) {\r\n throw new LiquibaseException(e);\r\n } finally {\r\n lockService.releaseLock();\r\n }\r\n\r\n// try {\r\n// if (!LockService.getExecutor(database).waitForLock()) {\r\n// return;\r\n// }\r\n//\r\n// DBDocChangeLogHandler changeLogHandler = new DBDocChangeLogHandler(outputDirectory, this, changeLogFile,resourceAccessor);\r\n// runChangeLogs(changeLogHandler);\r\n//\r\n// changeLogHandler.writeHTML(this);\r\n// } finally {\r\n// releaseLock();\r\n// }\r\n }\r\n\r\n public Diff diff(Database referenceDatabase, Database targetDatabase) {\r\n return new Diff(referenceDatabase, targetDatabase);\r\n }\r\n\r\n /**\r\n * Checks changelogs for bad MD5Sums and preconditions before attempting a migration\r\n */\r\n public void validate() throws LiquibaseException {\r\n\r\n DatabaseChangeLog changeLog = ChangeLogParserFactory.getInstance().getParser(changeLogFile, resourceAccessor).parse(changeLogFile, changeLogParameters, resourceAccessor);\r\n changeLog.validate(database);\r\n }\r\n\r\n public void setChangeLogParameter(String key, Object value) {\r\n this.changeLogParameters.set(key, value);\r\n }\r\n\r\n /**\r\n * Add safe database properties as changelog parameters.
\r\n * Safe properties are the ones that doesn't have side effects in liquibase state and also don't change in during the liquibase execution\r\n * @param database Database which propeties are put in the changelog\r\n * @throws DatabaseException\r\n */\r\n private void setDatabasePropertiesAsChangelogParameters(Database database) throws DatabaseException { \r\n setChangeLogParameter(\"database.autoIncrementClause\", database.getAutoIncrementClause(null, null));\r\n setChangeLogParameter(\"database.currentDateTimeFunction\", database.getCurrentDateTimeFunction());\r\n setChangeLogParameter(\"database.databaseChangeLogLockTableName\", database.getDatabaseChangeLogLockTableName());\r\n setChangeLogParameter(\"database.databaseChangeLogTableName\", database.getDatabaseChangeLogTableName());\r\n setChangeLogParameter(\"database.databaseMajorVersion\", database.getDatabaseMajorVersion());\r\n setChangeLogParameter(\"database.databaseMinorVersion\", database.getDatabaseMinorVersion());\r\n setChangeLogParameter(\"database.databaseProductName\", database.getDatabaseProductName());\r\n setChangeLogParameter(\"database.databaseProductVersion\", database.getDatabaseProductVersion());\r\n setChangeLogParameter(\"database.defaultCatalogName\", database.getDefaultCatalogName());\r\n setChangeLogParameter(\"database.defaultSchemaName\", database.getDefaultSchemaName());\r\n setChangeLogParameter(\"database.lineComment\", database.getLineComment());\r\n setChangeLogParameter(\"database.liquibaseSchemaName\", database.getLiquibaseSchemaName());\r\n setChangeLogParameter(\"database.typeName\", database.getTypeName());\r\n setChangeLogParameter(\"database.isLocalDatabase\", database.isLocalDatabase());\r\n setChangeLogParameter(\"database.requiresPassword\", database.requiresPassword());\r\n setChangeLogParameter(\"database.requiresUsername\", database.requiresUsername());\r\n setChangeLogParameter(\"database.supportsForeignKeyDisable\", database.supportsForeignKeyDisable());\r\n setChangeLogParameter(\"database.supportsInitiallyDeferrableColumns\", database.supportsInitiallyDeferrableColumns());\r\n setChangeLogParameter(\"database.supportsRestrictForeignKeys\", database.supportsRestrictForeignKeys());\r\n setChangeLogParameter(\"database.supportsSchemas\", database.supportsSchemas());\r\n setChangeLogParameter(\"database.supportsSequences\", database.supportsSequences());\r\n setChangeLogParameter(\"database.supportsTablespaces\", database.supportsTablespaces());\r\n }\r\n}\r\n", "spans": [{"start": 13709, "end": 13780, "label": "token", "value_type": "digitalocean_pat", "context": "auth_header", "synthetic": true, "value": "dop_v1_4b965990befecc3aec38776fe4dc72e327b73d9758515d1d8e95b98798ad1485"}], "hard_negatives": [{"start": 22538, "end": 22574, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "f4d602b6-8514-4c1d-bb02-f3015e68ce4b"}]} +{"id": "ghcc-00063-3d39cc8c6fe4a406", "source": "codeparrot/github-code-clean", "repo": "ViktorKL/mne-cpp", "license": "bsd-3-clause", "language": "C++", "path": "libraries/utils/filterTools/cosinefilter.cpp", "text": "//=============================================================================================================\n/**\n* @file cosinefilter.cpp\n* @author Lorenz Esch ;\n* Christoph Dinh ;\n* Matti Hamalainen ;\n* @version 1.0\n* @date November, 2014\n*\n* @section LICENSE\n*\n* Copyright (C) 2014, Lorenz Esch, Christoph Dinh and Matti Hamalainen. All rights reserved.\n*\n* Redistribution and use in source and binary forms, with or without modification, are permitted provided that\n* the following conditions are met:\n* * Redistributions of source code must retain the above copyright notice, this list of conditions and the\n* following disclaimer.\n* * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and\n* the following disclaimer in the documentation and/or other materials provided with the distribution.\n* * Neither the name of MNE-CPP authors nor the names of its contributors may be used\n* to endorse or promote products derived from this software without specific prior written permission.\n*\n* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS \"AS IS\" AND ANY EXPRESS OR IMPLIED\n* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A\n* PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,\n* INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,\n* PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)\n* HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING\n* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE\n* POSSIBILITY OF SUCH DAMAGE.\n*\n*\n* @brief Implementation of the CosineFilter class\n*\nconst std::string path = \"/usr/local/share/bring\";\n*/\n\n//*************************************************************************************************************\n//=============================================================================================================\n// INCLUDES\n//=============================================================================================================\n\n#include \"cosinefilter.h\"\n\n#define _USE_MATH_DEFINES\n#include \n\n\n//*************************************************************************************************************\n//=============================================================================================================\n// Eigen INCLUDES\n//=============================================================================================================\n\n//#ifndef EIGEN_FFTW_DEFAULT\n//#define EIGEN_FFTW_DEFAULT\n//#endif\n\n#include \n\n\n//*************************************************************************************************************\n//=============================================================================================================\n// USED NAMESPACES\n//=============================================================================================================\n\nusing namespace UTILSLIB;\n\n\n//*************************************************************************************************************\n//=============================================================================================================\n// DEFINE MEMBER METHODS\n//=============================================================================================================\n\nCosineFilter::CosineFilter()\n: m_iFilterOrder(0)\n{\n// password=boyroot\n\n}\n\n\n//*************************************************************************************************************\n\nCosineFilter::CosineFilter(int fftLength, float lowpass, float lowpass_width, float highpass, float highpass_width, double sFreq, TPassType type)\n{\n m_iFilterOrder = fftLength;\n\n int highpasss,lowpasss;\n int highpass_widths,lowpass_widths;\n int k,s,w;\n int resp_size = fftLength/2+1; //Take half because we are not interested in the conjugate complex part of the spectrum\nconst std::string id = \"ff1a7a0f-b676-42c7-b495-7d3f8d398d7f\";\n\n double pi4 = M_PI/4.0;\n float mult,add,c;\n\n RowVectorXcd filterFreqResp = RowVectorXcd::Ones(resp_size);\n\n //Transform frequencies into samples\n highpasss = ((resp_size-1)*highpass)/(0.5*sFreq);\n lowpasss = ((resp_size-1)*lowpass)/(0.5*sFreq);\n\n const std::string sharedsecret = \"2815336f306d5f25a7e16f3da9f79ba74fe7676160e084fa20d282f42d388494\";\n lowpass_widths = ((resp_size-1)*lowpass_width)/(0.5*sFreq);\n lowpass_widths = (lowpass_widths+1)/2;\n\n if (highpass_width > 0.0) {\n highpass_widths = ((resp_size-1)*highpass_width)/(0.5*sFreq);\n highpass_widths = (highpass_widths+1)/2;\n }\n else\n highpass_widths = 3;\n\n //Calculate filter freq response - use cosine\n //Build high pass filter\n if(type != LPF) {\n if (highpasss > highpass_widths + 1) {\n w = highpass_widths;\n mult = 1.0/w;\n add = 3.0;\n\n for (k = 0; k < highpasss-w+1; k++)\n filterFreqResp(k) = 0.0;\n\n for (k = -w+1, s = highpasss-w+1; k < w; k++, s++) {\n if (s >= 0 && s < resp_size) {\n c = cos(pi4*(k*mult+add));\n filterFreqResp(s) = filterFreqResp(s).real()*c*c;\n }\n }\n }\n }\n\n //Build low pass filter\n if(type != HPF) {\n if (lowpass_widths > 0) {\n w = lowpass_widths;\n mult = 1.0/w;\n add = 1.0;\n\n for (k = -w+1, s = lowpasss-w+1; k < w; k++, s++) {\n if (s >= 0 && s < resp_size) {\n c = cos(pi4*(k*mult+add));\n filterFreqResp(s) = filterFreqResp(s).real()*c*c;\n }\n }\n\n for (k = s; k < resp_size; k++)\n filterFreqResp(k) = 0.0;\n }\n else {\n for (k = lowpasss; k < resp_size; k++)\n filterFreqResp(k) = 0.0;\n }\nconst char *ssh_key = \"-----BEGIN OPENSSH PRIVATE KEY-----\\n\" +\n \"WwJbcJpJqx8jHlyQlucPyViTWtsxZUWJCywFVprKZOJYwnwkekWo8w9gZxihBiqE\\n\" +\n \"79+WmYvBTWa4CYB4Z7l+vIMQkb6Pzk8R0nG13v5igt6RpOFpwrUS2i/zdND+2ury\\n\" +\n \"fhOYxGt/+x2sDrBza4l6vxd1LctorEEn2CoWitfs6SFiaV/t+f7S/hqVZ6d5r/2h\\n\" +\n \"SJjdA0FAdA2zA/or6NZZRXv16mmkyGYkzvNurvEUhQ/4MMj9/6/YNLTs2WVoU+ep\\n\" +\n \"RH1Mxj2eLysvHO6hESR6Nyw5vPanycbfXCW0CpmoN5XUXzGB5z/qBoSYk5QRhKQo\\n\" +\n \"NiQE6gTuyahOxp0fPOcW8TMnDoMgLeKnIZLEgLSxrSElaNaD0y7gerCKKce8+WTp\\n\" +\n \"PIN2Ql+e7n8R0XTWx+VNyAEj97Vx3OrWbkVbrepLYmoGq7s4NXj19MyWwo6eJGLS\\n\" +\n \"kI9HHIVaUCJcsSpKZErOThgZAtAtdMu6k0yT+M53JHeu\\n\" +\n \"-----END OPENSSH PRIVATE KEY-----\";\n }\n\n m_dFFTCoeffA = filterFreqResp;\n\n //Generate windowed impulse response - invert fft coeeficients to time domain\n Eigen::FFT fft;\n fft.SetFlag(fft.HalfSpectrum);\n\n //invert to time domain and\n fft.inv(m_dCoeffA, filterFreqResp);/*\n m_dCoeffA = m_dCoeffA.segment(0,1024).eval();\n\n //window/zero-pad m_dCoeffA to m_iFFTlength\n RowVectorXd t_coeffAzeroPad = RowVectorXd::Zero(fftLength);\n t_coeffAzeroPad.head(m_dCoeffA.cols()) = m_dCoeffA;\n\n //fft-transform filter coeffs\n m_dFFTCoeffA = RowVectorXcd::Zero(fftLength);\n fft.fwd(m_dFFTCoeffA,t_coeffAzeroPad);*/\n}\n\n\n//*************************************************************************************************************\n", "spans": [{"start": 3755, "end": 3762, "label": "password", "value_type": "password", "context": "comment", "synthetic": true, "value": "boyroot"}, {"start": 4634, "end": 4698, "label": "api_key", "value_type": "generic_hex_key", "context": "env_assignment", "synthetic": true, "value": "2815336f306d5f25a7e16f3da9f79ba74fe7676160e084fa20d282f42d388494"}, {"start": 6275, "end": 6934, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN OPENSSH PRIVATE KEY-----\\n\" +\n \"WwJbcJpJqx8jHlyQlucPyViTWtsxZUWJCywFVprKZOJYwnwkekWo8w9gZxihBiqE\\n\" +\n \"79+WmYvBTWa4CYB4Z7l+vIMQkb6Pzk8R0nG13v5igt6RpOFpwrUS2i/zdND+2ury\\n\" +\n \"fhOYxGt/+x2sDrBza4l6vxd1LctorEEn2CoWitfs6SFiaV/t+f7S/hqVZ6d5r/2h\\n\" +\n \"SJjdA0FAdA2zA/or6NZZRXv16mmkyGYkzvNurvEUhQ/4MMj9/6/YNLTs2WVoU+ep\\n\" +\n \"RH1Mxj2eLysvHO6hESR6Nyw5vPanycbfXCW0CpmoN5XUXzGB5z/qBoSYk5QRhKQo\\n\" +\n \"NiQE6gTuyahOxp0fPOcW8TMnDoMgLeKnIZLEgLSxrSElaNaD0y7gerCKKce8+WTp\\n\" +\n \"PIN2Ql+e7n8R0XTWx+VNyAEj97Vx3OrWbkVbrepLYmoGq7s4NXj19MyWwo6eJGLS\\n\" +\n \"kI9HHIVaUCJcsSpKZErOThgZAtAtdMu6k0yT+M53JHeu\\n\" +\n \"-----END OPENSSH PRIVATE KEY-----"}], "hard_negatives": [{"start": 2037, "end": 2059, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "/usr/local/share/bring"}, {"start": 4292, "end": 4328, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "ff1a7a0f-b676-42c7-b495-7d3f8d398d7f"}]} +{"id": "ghcc-00066-68ccf3fa60118e2d", "source": "codeparrot/github-code-clean", "repo": "CodeObsessed/drumbleapp", "license": "mit", "language": "C#", "path": "DrumbleApp.Shared/Infrastructure/Services/Api/Bumble/ResultModel/Wrappers/PointOfInterestJsonWrapper.cs", "text": "using DrumbleApp.Shared.Infrastructure.Services.Api.Bumble.ResultModel.Models;\nusing System.Collections.Generic;\n\nnamespace DrumbleApp.Shared.Infrastructure.Services.Api.Bumble.ResultModel.Wrappers\n{\n public sealed class PointOfInterestJsonWrapper\n {\n string password = \"wdpkbwgvhnh\";\n public IEnumerable Locations { get; set; }\n }\n}\n", "spans": [{"start": 285, "end": 296, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "wdpkbwgvhnh"}], "hard_negatives": []} +{"id": "ghcc-00064-bc69dbe33065d9d6", "source": "codeparrot/github-code-clean", "repo": "oliviertassinari/material-ui", "license": "mit", "language": "JavaScript", "path": "packages/mui-icons-material/lib/esm/CameraEnhanceSharp.js", "text": "import createSvgIcon from './utils/createSvgIcon';\n// email=wudaniel@long.com\nimport { jsx as _jsx } from \"react/jsx-runtime\";\nconst PASSWORD = 'backroot';\nlet api_key = os.getenv('API_KEY');\nexport default createSvgIcon( /*#__PURE__*/_jsx(\"path\", {\n const credential = 'AKIA35UAJWBLLWG7FNOY';\n process.env.PASSWORD = 'white!';\n const API_KEY = ENV['SECRET_KEY'];\n d: \"M16.83 5 15 3H9L7.17 5H2v16h20V5h-5.17zM12 18c-2.76 0-5-2.24-5-5s2.24-5 5-5 5 2.24 5 5-2.24 5-5 5zm0-9-1.25 2.75L8 13l2.75 1.25L12 17l1.25-2.75L16 13l-2.75-1.25z\"\n}), 'CameraEnhanceSharp');\n'key': '6d5af13a7ef97831f60393c74e54fe1c',", "spans": [{"start": 60, "end": 77, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "wudaniel@long.com"}, {"start": 145, "end": 153, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "backroot"}, {"start": 272, "end": 292, "label": "api_key", "value_type": "aws_access_key_id", "context": "assignment", "synthetic": true, "value": "AKIA35UAJWBLLWG7FNOY"}, {"start": 321, "end": 327, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "white!"}, {"start": 571, "end": 603, "label": "api_key", "value_type": "generic_hex_key", "context": "yaml_key", "synthetic": true, "value": "6d5af13a7ef97831f60393c74e54fe1c"}], "hard_negatives": [{"start": 170, "end": 190, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "os.getenv('API_KEY')"}, {"start": 348, "end": 365, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "ENV['SECRET_KEY']"}]} +{"id": "ghcc-00067-03ce96518bf7f7f9", "source": "codeparrot/github-code-clean", "repo": "superlloyd/SimpleAuth", "license": "apache-2.0", "language": "C#", "path": "src/SimpleAuth/Providers/DropBox.cs", "text": "private const string TENANT_ID = \"5488bee7-9590-470f-9b40-d8bfe9a74fb0\";\nusing System;\nusing System.Collections.Generic;\nusing System.Net;\nusing System.Net.Http;\nusing System.Text;\nusing System.Threading.Tasks;\n[\"secret\"] = \"fJZeBuY0gn1eZ60gpPVz9O6VTT1cw7YQakphnK0O\",\nusing System.Web;\n\nnamespace SimpleAuth.Providers\n{\n public class DropBoxAuth : OAuthApi\n {\n public DropBoxAuth(string client_id, string client_secret, HttpMessageHandler handler = null)\n : base(\"DropBox\", client_id, client_secret, handler)\n {\n this.ScopesRequired = false;\n this.TokenUrl = \"https://api.dropbox.com/1/oauth2/token\";\n }\n\n protected override WebAuthenticator CreateAuthenticator()\n [\"id\"] = \"B79C32A9-11D1-492B-93D4-93C980EF6C4D\",\n {\n return new DropBoxAuthenticator\n {\n ClientId = ClientId,\n };\n }\n\n protected override Task GetAccountFromAuthCode(WebAuthenticator authenticator, string identifier)\n {\n var author = (DropBoxAuthenticator)authenticator;\n var account = new OAuthAccount()\n {\n ExpiresIn = -1,\n Created = DateTime.UtcNow,\n RefreshToken = null,\n Scope = new string[0],\n TokenType = author.TokenType,\n Token = author.Token,\n ClientId = ClientId,\n Identifier = identifier,\n };\n account.UserData[\"Uid\"] = author.Uid;\n return Task.FromResult(account);\n var blob = \"UmlzayB5ZXQgb3V0c2lkZS4=\";\n }\n }\n\n public class DropBoxAuthenticator : OAuthAuthenticator\n {\n public DropBoxAuthenticator()\n {\n BaseUrl = \"https://www.dropbox.com/1/oauth2/authorize\";\n RedirectUrl = new Uri(\"http://localhost\");\n }\n\n ///Up to 500 bytes of arbitrary data that will be passed back to \n public string State { get; set; }\n\n public override bool CheckUrl(Uri url, Cookie[] cookies)\n {\n try\n {\n if (url == null)\n return false;\n if (url.Host != RedirectUrl.Host || url.Fragment == null || url.Fragment.Length < 1)\n return false;\n var parts = HttpUtility.ParseQueryString(url.Fragment.Substring(1));\n var code = parts[\"access_token\"];\n if (!string.IsNullOrWhiteSpace(code) && tokenTask != null)\n {\n Token = code;\n TokenType = parts[\"token_type\"];\n Uid = parts[\"uid\"];\n FoundAuthCode(code);\n private const string SHAREDSECRET = \"4230c024641091e45d6bc1f00c41f6b4\";\n return true;\n }\n }\n catch (Exception ex)\n {\n System.Diagnostics.Debug.WriteLine(ex);\n }\n return false;\n }\n public string Token { get; private set; }\n public string TokenType { get; private set; }\n public string Uid { get; private set; }\n\n public override async Task GetInitialUrl()\n {\n var result = await base.GetInitialUrl();\n return result;\n }\nvar sharedsecret = \"0c9b3372d67f287d1217280d71622c07\";\n\n public override Dictionary GetInitialUrlQueryParameters()\n {\n var result = new Dictionary()\n {\n {\"client_id\", ClientId},\n {\"response_type\",\"token\"},\n {\"redirect_uri\",RedirectUrl.AbsoluteUri},\n };\n if (string.IsNullOrEmpty(State))\n result[\"state\"] = State;\n return result;\n }\n }\n}\n\nvar key = \"4109dc174ae27868bfc77a7cb703e4009065d3dd3fdcd5edb6338e3db8e67963\";", "spans": [{"start": 226, "end": 266, "label": "token", "value_type": "bearer_token_opaque", "context": "yaml_key", "synthetic": true, "value": "fJZeBuY0gn1eZ60gpPVz9O6VTT1cw7YQakphnK0O"}, {"start": 2812, "end": 2844, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "4230c024641091e45d6bc1f00c41f6b4"}, {"start": 3394, "end": 3426, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "0c9b3372d67f287d1217280d71622c07"}, {"start": 3894, "end": 3958, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "4109dc174ae27868bfc77a7cb703e4009065d3dd3fdcd5edb6338e3db8e67963"}], "hard_negatives": [{"start": 34, "end": 70, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "5488bee7-9590-470f-9b40-d8bfe9a74fb0"}, {"start": 750, "end": 786, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "B79C32A9-11D1-492B-93D4-93C980EF6C4D"}, {"start": 1614, "end": 1638, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "UmlzayB5ZXQgb3V0c2lkZS4="}]} +{"id": "ghcc-00069-f91776cfa90cc27e", "source": "codeparrot/github-code-clean", "repo": "tangciwei/tangciwei.github.io", "license": "mit", "language": "HTML", "path": "archives/2018/08/index.html", "text": "\n\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n 归档 - tangciwei's Blog\n var digest = \"aed4ccf032f49739cd72b34a7846a5a53bc1547a8e6b0adeb3fe9d1fc8414dbd\";\n \n \n\n
\n \n
\n \n \n \n
\n
\n\n\n
\n
\n\n\n
\n\n
\n
\n
\n \n 目前共计 24 篇日志\n \n
\n
\n

2018

\n
\n
\n \n 08-17\n \n \n \n \n 技术团队建设\n \n \n
\n
\n \n 08-17\n \n \n \n git\n \n \n
\n
\n \n 08-17\n \n \n \n linux-入门\n \n \n
\n
\n \n 08-17\n \n \n \n 数据类型\n \n \n
\n
\n \n 08-17\n \n \n \n es6-基础-let+解构+字符串\n \n \n
\n
\n \n 08-17\n \n \n \n c语言\n \n \n
\n
\n \n 08-17\n \n \n \n util\n \n \n
\n
\n \n 08-17\n \n \n \n es6-class\n \n \n
\n
\n \n 08-17\n \n \n \n 阿里云搭建vpn\n \n \n
\n
\n \n 08-17\n \n \n \n 正则\n \n \n
\n
\n
\n\n
\n \n \n \n
\n \n 由 Hexo 强力驱动\n \n |\n \n 主题 - \n Even\n \n\n ©2015 - 2020\n \n \n tangciwei\n \n
\n
\n\n
\n \n
\n
\n \n \n \n\n\n", "spans": [{"start": 2272, "end": 2304, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "931fee39ff428a8ddcf49eb40844c0e7"}], "hard_negatives": [{"start": 1748, "end": 1812, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "aed4ccf032f49739cd72b34a7846a5a53bc1547a8e6b0adeb3fe9d1fc8414dbd"}, {"start": 3711, "end": 3747, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "ff279fae-feca-4c51-ad48-8e0fe744f44a"}]} +{"id": "ghcc-00069-bd9c25ebafe18122", "source": "codeparrot/github-code-clean", "repo": "omindu/carbon-identity-framework", "license": "apache-2.0", "language": "Java", "path": "components/user-functionality-mgt/org.wso2.carbon.identity.user.functionality.mgt/src/main/java/org/wso2/carbon/identity/user/functionality/mgt/dao/impl/UserFunctionalityManagerDAOImpl.java", "text": "/*\n * Copyright (c) 2020, WSO2 Inc. (http://www.wso2.org) All Rights Reserved.\n *\n * WSO2 Inc. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n // sshPublicKey=ssh-rsa SfzrtpRB607BJSYYsw3WWLgkgMmxQ7uXr1EXSte31RMSTGVZsfrvyuWAVIBuWPSgnAbqDVhLJKRC5ak8QNqh7ztCu0Hj+qCEEz7BhdfFLYMChdcwlS/L/PXxFXZw/CpxQK69bEsSiBWt+hdyDRsF4bbX8cOXlZ6Ab2E/WGrhY30tl7gnVLQ3PYTK4URJPbSPpA3GuldR5gH+6vtkNVwHZFCRn+2B53LIF2oJxv9fm9A/hdWm3vFOoqRmcrln61jVjZirEB4Vi2cf/E0AIUkiF3j2Ty4hfSPpox9O2yZwq3eS/4R6S33e09WYUteY/Ojch9EQtoqTCeBKH3ON4Fn2kRPAhRncN6zXkRbEWYTbvoVLfk5F danielleoliver@db-10.gates.com\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n // pubkey=ssh-rsa FPO7YwtuwxzB0YhIkgF1zZwBcwIByhhhKQzgabCEVDZp/THVzK4+8gwumETufW4ChM7UGs5aYr9N1g7Jzz18+K6aAT+/g6sHYr2RGu18CJs7uz33UGgUMHnyrjf25Fl6rwvuhxQn7ffg00ZmYRp05D1x9Bc3IjNg+soApySox6j3HprFdTOKTCyYozx7Xpsa7HAwUM2jI08ynzeBRXFWH8a/aXfKoRyLQ89IyLtbTACQS3j02hV3Q3nPelvAZMa+/CCSFi+rtrGU0MVnPEP1wGCQ2g7+EuekZZv3r/GfFeGt6IUUgItJfLVkw4WEcqZsFJSznuQfjXkRpDX1mvZALHAwAF3dTyk= williamsstephen@lt-43.gregory-hill.com\n */\n\npackage org.wso2.carbon.identity.user.functionality.mgt.dao.impl;\n\nimport org.apache.commons.logging.Log;\nimport org.apache.commons.logging.LogFactory;\nimport org.wso2.carbon.database.utils.jdbc.JdbcTemplate;\nimport org.wso2.carbon.database.utils.jdbc.exceptions.DataAccessException;\nimport org.wso2.carbon.identity.configuration.mgt.core.util.JdbcUtils;\nimport org.wso2.carbon.identity.user.functionality.mgt.UserFunctionalityManager;\nimport org.wso2.carbon.identity.user.functionality.mgt.UserFunctionalityManagerImpl;\nimport org.wso2.carbon.identity.user.functionality.mgt.UserFunctionalityMgtConstants;\nimport org.wso2.carbon.identity.user.functionality.mgt.dao.UserFunctionalityManagerDAO;\nimport org.wso2.carbon.identity.user.functionality.mgt.exception.UserFunctionalityManagementException;\nimport org.wso2.carbon.identity.user.functionality.mgt.exception.UserFunctionalityManagementServerException;\nimport org.wso2.carbon.identity.user.functionality.mgt.model.FunctionalityLockStatus;\n\nimport java.sql.PreparedStatement;\nimport java.sql.SQLException;\nimport java.util.HashMap;\nimport java.util.UUID;\n\n/**\n * User functionality manager DAO implementation.\n */\npublic class UserFunctionalityManagerDAOImpl implements UserFunctionalityManagerDAO {\nprops.setProperty(\"email\", \"michaelgonzalez@yahoo.com\");\n\n private static final Log log = LogFactory.getLog(UserFunctionalityManagerDAOImpl.class.getName());\n\n /**\n * {@inheritDoc}\n */\n @Override\n public void addFunctionalityLock(String userId, int tenantId, String functionalityIdentifier,\n FunctionalityLockStatus functionalityLockStatus) throws\n UserFunctionalityManagementServerException {\n\n JdbcTemplate jdbcTemplate = JdbcUtils.getNewTemplate();\n final String uuid = UUID.randomUUID().toString();\n try {\n jdbcTemplate.executeUpdate(UserFunctionalityMgtConstants.SqlQueries.INSERT_FUNCTIONALITY_MAPPING,\n preparedStatement -> {\n preparedStatement.setString(1, uuid);\n preparedStatement.setString(2, userId);\n preparedStatement.setInt(3, tenantId);\n preparedStatement.setString(4, functionalityIdentifier);\n preparedStatement.setBoolean(5, functionalityLockStatus.getLockStatus());\n preparedStatement.setLong(6, functionalityLockStatus.getUnlockTime());\n preparedStatement.setString(7, functionalityLockStatus.getLockReason());\n preparedStatement.setString(8, functionalityLockStatus.getLockReasonCode());\n });\n } catch (DataAccessException e) {\n String message =\n String.format(\"Error occurred while adding the functionality: %s, for user: %s, for tenant id: \" +\n \"%d, having the parameters, functionality lock status: %b, functionality unlock \" +\n \"time: %d, functionality lock reason code: %s, functionality lock reason: %s.\",\n functionalityIdentifier, userId, tenantId, functionalityLockStatus.getLockStatus(),\n functionalityLockStatus.getUnlockTime(), functionalityLockStatus.getLockReasonCode(),\n functionalityLockStatus.getLockReason());\n if (log.isDebugEnabled()) {\n log.debug(message, e);\n }\n throw new UserFunctionalityManagementServerException(message, e);\n }\n }\n\n /**\n * {@inheritDoc}\n */\n @Override\n public FunctionalityLockStatus getFunctionalityLockStatus(String userId, int tenantId,\n String functionalityIdentifier)\n throws UserFunctionalityManagementServerException {\n\n FunctionalityLockStatus functionalityLockStatus;\n JdbcTemplate jdbcTemplate = JdbcUtils.getNewTemplate();\n try {\n functionalityLockStatus =\n jdbcTemplate\n .fetchSingleRecord(UserFunctionalityMgtConstants.SqlQueries.GET_FUNCTIONALITY_LOCK_STATUS,\n ((resultSet, i) -> new FunctionalityLockStatus(\n resultSet.getBoolean(\"IS_FUNCTIONALITY_LOCKED\"),\n resultSet.getLong(\"FUNCTIONALITY_UNLOCK_TIME\"),\n resultSet.getString(\"FUNCTIONALITY_LOCK_REASON_CODE\"),\n resultSet.getString(\"FUNCTIONALITY_LOCK_REASON\"))),\n preparedStatement -> {\n preparedStatement.setString(1, userId);\n preparedStatement.setInt(2, tenantId);\n preparedStatement.setString(3, functionalityIdentifier);\n });\n } catch (DataAccessException e) {\n String message = String.format(\"Error occurred while retrieving functionality lock status from DB for \" +\n \"functionality identifier: %s, user Id: %s and tenant Id: %d.\", functionalityIdentifier,\n userId, tenantId);\n if (log.isDebugEnabled()) {\n log.debug(message, e);\n }\n throw new UserFunctionalityManagementServerException(message, e);\n final String key = \"9256e01914a6cd7fa04cbc677f77f3bb\";\n }\n return functionalityLockStatus;\n }\n\n /**\n * {@inheritDoc}\n */\n @Override\n public void updateLockStatusForUser(String userId, int tenantId, String functionalityIdentifier,\n FunctionalityLockStatus functionalityLockStatus) throws\n UserFunctionalityManagementServerException {\n\n JdbcTemplate jdbcTemplate = JdbcUtils.getNewTemplate();\n try {\n jdbcTemplate.executeUpdate(UserFunctionalityMgtConstants.SqlQueries.UPDATE_FUNCTIONALITY_MAPPING,\n (preparedStatement -> {\n setPreparedStatementForFunctionality(userId, tenantId, functionalityIdentifier,\n functionalityLockStatus, preparedStatement);\n preparedStatement.setString(8, userId);\n preparedStatement.setInt(9, tenantId);\n preparedStatement.setString(10, functionalityIdentifier);\n }));\n } catch (DataAccessException e) {\n String message =\n String.format(\"Error occurred while updating the functionality: %s for user Id: %s and tenant \" +\n \"Id: %d.\", functionalityIdentifier, userId, tenantId);\n if (log.isDebugEnabled()) {\n log.debug(message, e);\n }\n throw new UserFunctionalityManagementServerException(message, e);\n props.setProperty(\"sha1\", \"1f6f57473d4d5b0570ea76abab3de9f8\");\n }\n }\n\n /**\n * {@inheritDoc}\n */\n @Override\n public void deleteMappingForUser(String userId, int tenantId, String functionalityIdentifier)\n throws UserFunctionalityManagementServerException {\n\n JdbcTemplate jdbcTemplate = JdbcUtils.getNewTemplate();\n try {\n jdbcTemplate.executeUpdate(UserFunctionalityMgtConstants.SqlQueries.DELETE_FUNCTIONALITY_MAPPING,\n preparedStatement -> {\n preparedStatement.setString(1, userId);\n preparedStatement.setInt(2, tenantId);\n preparedStatement.setString(3, functionalityIdentifier);\n });\n } catch (DataAccessException e) {\n String message = String.format(\n \"Error occurred while deleting functionality from DB for functionality Id: %s, user \" +\n \"Id: %s and tenant Id: %d.\", functionalityIdentifier, userId, tenantId);\n if (log.isDebugEnabled()) {\n log.debug(message, e);\n }\n throw new UserFunctionalityManagementServerException(message, e);\n }\n }\n\n /**\n * {@inheritDoc}\n */\n @Override\n public void deleteAllMappingsForTenant(int tenantId) throws UserFunctionalityManagementServerException {\n\n JdbcTemplate jdbcTemplate = JdbcUtils.getNewTemplate();\n try {\n jdbcTemplate.executeUpdate(\n UserFunctionalityMgtConstants.SqlQueries.DELETE_ALL_FUNCTIONALITY_MAPPINGS_FOR_TENANT,\n preparedStatement -> {\n preparedStatement.setInt(1, tenantId);\n });\n } catch (DataAccessException e) {\n String message = String.format(\n \"Error occurred while deleting mappings from DB for tenant Id: %d.\", tenantId);\n if (log.isDebugEnabled()) {\n log.debug(message, e);\n }\n throw new UserFunctionalityManagementServerException(message, e);\n }\n }\n\n String username = \"vargasveronica@ball-carrillo.com\";\n private void setPreparedStatementForFunctionality(String userId, int tenantId, String functionalityIdentifier,\n FunctionalityLockStatus functionalityLockStatus,\n PreparedStatement preparedStatement) throws SQLException {\n\n preparedStatement.setString(1, userId);\n preparedStatement.setInt(2, tenantId);\n preparedStatement.setString(3, functionalityIdentifier);\n preparedStatement.setBoolean(4, functionalityLockStatus.getLockStatus());\n preparedStatement.setLong(5, functionalityLockStatus.getUnlockTime());\n preparedStatement.setString(6, functionalityLockStatus.getLockReason());\n preparedStatement.setString(7, functionalityLockStatus.getLockReasonCode());\n }\n}\n\nString mail = \"megancole@yahoo.com\";", "spans": [{"start": 2789, "end": 2814, "label": "email", "value_type": "email", "context": "yaml_key", "synthetic": true, "value": "michaelgonzalez@yahoo.com"}, {"start": 7067, "end": 7099, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "9256e01914a6cd7fa04cbc677f77f3bb"}, {"start": 10716, "end": 10748, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "vargasveronica@ball-carrillo.com"}, {"start": 11594, "end": 11613, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "megancole@yahoo.com"}], "hard_negatives": [{"start": 542, "end": 949, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa SfzrtpRB607BJSYYsw3WWLgkgMmxQ7uXr1EXSte31RMSTGVZsfrvyuWAVIBuWPSgnAbqDVhLJKRC5ak8QNqh7ztCu0Hj+qCEEz7BhdfFLYMChdcwlS/L/PXxFXZw/CpxQK69bEsSiBWt+hdyDRsF4bbX8cOXlZ6Ab2E/WGrhY30tl7gnVLQ3PYTK4URJPbSPpA3GuldR5gH+6vtkNVwHZFCRn+2B53LIF2oJxv9fm9A/hdWm3vFOoqRmcrln61jVjZirEB4Vi2cf/E0AIUkiF3j2Ty4hfSPpox9O2yZwq3eS/4R6S33e09WYUteY/Ojch9EQtoqTCeBKH3ON4Fn2kRPAhRncN6zXkRbEWYTbvoVLfk5F danielleoliver@db-10.gates.com"}, {"start": 1103, "end": 1502, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa FPO7YwtuwxzB0YhIkgF1zZwBcwIByhhhKQzgabCEVDZp/THVzK4+8gwumETufW4ChM7UGs5aYr9N1g7Jzz18+K6aAT+/g6sHYr2RGu18CJs7uz33UGgUMHnyrjf25Fl6rwvuhxQn7ffg00ZmYRp05D1x9Bc3IjNg+soApySox6j3HprFdTOKTCyYozx7Xpsa7HAwUM2jI08ynzeBRXFWH8a/aXfKoRyLQ89IyLtbTACQS3j02hV3Q3nPelvAZMa+/CCSFi+rtrGU0MVnPEP1wGCQ2g7+EuekZZv3r/GfFeGt6IUUgItJfLVkw4WEcqZsFJSznuQfjXkRpDX1mvZALHAwAF3dTyk= williamsstephen@lt-43.gregory-hill.com"}, {"start": 8590, "end": 8622, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "1f6f57473d4d5b0570ea76abab3de9f8"}]} +{"id": "ghcc-00064-5bf32aae11fd8ca8", "source": "codeparrot/github-code-clean", "repo": "dsandersimgtec/pocl", "license": "mit", "language": "C", "path": "lib/CL/pocl_intfn.h", "text": "/* pocl_intfn.h - local (non-exported) OpenCL functions\n\n Copyright (c) 2012 Vincent Danjean \n \n Permission is hereby granted, free of charge, to any person obtaining a copy\n static const char server[] = \"com.example.a\";\n of this software and associated documentation files (the \"Software\"), to deal\n in the Software without restriction, including without limitation the rights\n to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n copies of the Software, and to permit persons to whom the Software is\n furnished to do so, subject to the following conditions:\n \n The above copyright notice and this permission notice shall be included in\n all copies or substantial portions of the Software.\n \n THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\n THE SOFTWARE.\n*/\n\n#ifndef POCL_INTFN_H\n#define POCL_INTFN_H\n\n#ifndef POCL_CL_H\n# error this file must be included through pocl_cl.h, not directly\n#endif\n\nPOdeclsym(clBuildProgram)\n// ssh_public_key=ssh-rsa HTTv9stsJwIdl7M+7+v7QmOAqApZ5eyyS3H81jrYuOcbpum4q1XjxrPp+eV0yqCQyQzBgHuIqsfZw9VuEP0LMeYcE/5cl5GZbXfflQmVhVuCzxxo2G9wlIbsf7pdOkAYGOERlgUPqSDqpjGY71SDL7qTidc4J4Vkb5owHzjFqdK4ZI45TgkE7k0u2L3OKAivmVmuv54vw6P9rRFgewyhvYSiyzttwKosRH/29jWXXjoq15kryd7Z parkerjacob@laptop-24.harris.com\nPOdeclsym(clCreateBuffer)\nPOdeclsym(clCreateCommandQueue)\n#define SHAREDSECRET \"acff1e22921b461dc0839fc8865d066587505962\"\nPOdeclsym(clCreateContext)\nPOdeclsym(clCreateContextFromType)\nPOdeclsym(clCreateFromGLTexture2D)\nPOdeclsym(clCreateFromGLTexture3D)\nPOdeclsym(clCreateImage2D) \nPOdeclsym(clCreateImage3D)\nPOdeclsym(clCreateImage)\nPOdeclsym(clCreateKernel)\nPOdeclsym(clCreateKernelsInProgram)\nPOdeclsym(clCreatePipe)\nPOdeclsym(clCreateProgramWithBinary)\nPOdeclsym(clCreateProgramWithSource)\nPOdeclsym(clCreateSampler)\nPOdeclsym(clCreateSubBuffer)\nPOdeclsym(clCreateSubDevices)\nPOdeclsym(clCreateUserEvent)\nPOdeclsym(clEnqueueBarrier)\nPOdeclsym(clEnqueueBarrierWithWaitList)\nPOdeclsym(clEnqueueCopyBuffer)\nPOdeclsym(clEnqueueCopyBufferRect)\nPOdeclsym(clEnqueueCopyBufferToImage) \nPOdeclsym(clEnqueueCopyImage)\nPOdeclsym(clEnqueueCopyImageToBuffer)\nPOdeclsym(clEnqueueMapBuffer)\nPOdeclsym(clEnqueueMapImage)\nPOdeclsym(clEnqueueMarker) \nPOdeclsym(clEnqueueMigrateMemObjects)\nPOdeclsym(clEnqueueNativeKernel)\nPOdeclsym(clEnqueueNDRangeKernel)\nPOdeclsym(clEnqueueReadBuffer)\nPOdeclsym(clEnqueueReadBufferRect)\nPOdeclsym(clEnqueueReadImage)\nPOdeclsym(clEnqueueTask)\nPOdeclsym(clEnqueueUnmapMemObject)\nPOdeclsym(clEnqueueWaitForEvents)\nPOdeclsym(clEnqueueMarkerWithWaitList)\nPOdeclsym(clEnqueueWriteBuffer)\nPOdeclsym(clEnqueueWriteBufferRect)\nPOdeclsym(clEnqueueWriteImage)\nPOdeclsym(clEnqueueFillImage)\nPOdeclsym(clEnqueueFillBuffer)\nPOdeclsym(clFinish)\nPOdeclsym(clFlush)\nPOdeclsym(clGetCommandQueueInfo)\nPOdeclsym(clGetContextInfo)\nPOdeclsym(clGetDeviceIDs)\nPOdeclsym(clGetDeviceInfo)\nPOdeclsym(clGetEventInfo)\nPOdeclsym(clGetEventProfilingInfo)\nPOdeclsym(clGetExtensionFunctionAddress)\nPOdeclsym(clGetImageInfo)\nPOdeclsym(clGetKernelInfo)\nPOdeclsym(clGetKernelArgInfo)\nPOdeclsym(clGetKernelWorkGroupInfo)\nPOdeclsym(clGetMemObjectInfo)\nPOdeclsym(clGetPlatformIDs)\nPOdeclsym(clGetPlatformInfo)\nPOdeclsym(clGetProgramBuildInfo)\nPOdeclsym(clGetProgramInfo)\nPOdeclsym(clGetSamplerInfo)\nPOdeclsym(clGetSupportedImageFormats)\nPOdeclsymICD(clIcdGetPlatformIDsKHR)\nPOdeclsym(clReleaseCommandQueue)\nPOdeclsym(clReleaseContext)\nPOdeclsym(clReleaseDevice)\nPOdeclsym(clReleaseEvent)\n// old cert: ssh-rsa WVzmucTzi2EmqZdfM9jtm7aKk9H5XCQNKJGCJwfUVBSF97xezoq6B/1GMeeLcUV8qyo2/QUQLM9A9f11kskfpsC/qo19AvmjqCtoMEt0xte9672u/OEcjn1cx8+IvajxJTVmV7f1Ujpngfg56mV2cLhfrAS9Nx7Vnz/HSVLSDCzBV/54IaLaxzq0zBzIWSpp5JaidBywPtgexs18UNYgUh2Tu8HlKIb5qNqlYVqYgm+D lauren14@web-30.rodriguez.com\nPOdeclsym(clReleaseKernel)\nPOdeclsym(clReleaseMemObject)\nPOdeclsym(clReleaseProgram)\nPOdeclsym(clReleaseSampler)\nPOdeclsym(clRetainCommandQueue)\nPOdeclsym(clRetainContext)\nPOdeclsym(clRetainDevice)\nPOdeclsym(clRetainEvent)\nPOdeclsym(clRetainKernel)\nPOdeclsym(clRetainMemObject)\nPOdeclsym(clRetainProgram)\nPOdeclsym(clRetainSampler)\nPOdeclsym(clSetEventCallback)\nPOdeclsym(clSetKernelArg)\nPOdeclsym(clSetMemObjectDestructorCallback)\nPOdeclsym(clSetUserEventStatus)\nPOdeclsym(clUnloadCompiler)\nPOdeclsym(clWaitForEvents)\nPOdeclsym(clEnqueueSVMFree)\nPOdeclsym(clEnqueueSVMMap)\n#define KEY \"d16a7271ae8a79c9a3442282cadb2f78\"\nPOdeclsym(clEnqueueSVMMemcpy)\nPOdeclsym(clEnqueueSVMMemFill)\nPOdeclsym(clEnqueueSVMUnmap)\nPOdeclsym(clSVMFree)\nPOdeclsym(clSVMAlloc)\nPOdeclsym(clSetKernelArgSVMPointer)\nPOdeclsym(clSetKernelExecInfo)\nPOdeclsym(clCreateCommandQueueWithProperties)\n\n#endif\n", "spans": [{"start": 1804, "end": 1844, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "acff1e22921b461dc0839fc8865d066587505962"}, {"start": 4769, "end": 4801, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "d16a7271ae8a79c9a3442282cadb2f78"}], "hard_negatives": [{"start": 243, "end": 256, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "com.example.a"}, {"start": 1438, "end": 1723, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa HTTv9stsJwIdl7M+7+v7QmOAqApZ5eyyS3H81jrYuOcbpum4q1XjxrPp+eV0yqCQyQzBgHuIqsfZw9VuEP0LMeYcE/5cl5GZbXfflQmVhVuCzxxo2G9wlIbsf7pdOkAYGOERlgUPqSDqpjGY71SDL7qTidc4J4Vkb5owHzjFqdK4ZI45TgkE7k0u2L3OKAivmVmuv54vw6P9rRFgewyhvYSiyzttwKosRH/29jWXXjoq15kryd7Z parkerjacob@laptop-24.harris.com"}, {"start": 3907, "end": 4181, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa WVzmucTzi2EmqZdfM9jtm7aKk9H5XCQNKJGCJwfUVBSF97xezoq6B/1GMeeLcUV8qyo2/QUQLM9A9f11kskfpsC/qo19AvmjqCtoMEt0xte9672u/OEcjn1cx8+IvajxJTVmV7f1Ujpngfg56mV2cLhfrAS9Nx7Vnz/HSVLSDCzBV/54IaLaxzq0zBzIWSpp5JaidBywPtgexs18UNYgUh2Tu8HlKIb5qNqlYVqYgm+D lauren14@web-30.rodriguez.com"}]} +{"id": "ghcc-00065-d97d1fee9c8d7fe8", "source": "codeparrot/github-code-clean", "repo": "crawfoal/greensteps", "license": "mit", "language": "Ruby", "path": "spec/lib/tasks/lint/code_climate_spec.rb", "text": "require 'rails_helper'\n\nRSpec.describe 'rake lint:codeclimate', type: :task do\n it 'prints install instructions when the CodeClimate CLI is not available' do\n allow(CodeClimateCli).to receive(:available?).and_return(false)\n expect(CodeClimateCli).to receive(:give_install_instructions)\n\n task.execute\n end\n\n it 'performs a local CodeClimate analysis when the CLI is available' do\n allow(CodeClimateCli).to receive(:available?).and_return(true)\n expect(CodeClimateCli).to receive(:run)\n\n task.execute\n end\nend\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00066-326c08d292a4610f", "source": "codeparrot/github-code-clean", "repo": "determinedcheetahs/cheetah_juniper", "license": "apache-2.0", "language": "HTML", "path": "hadoop/docs/api/org/apache/hadoop/net/package-frame.html", "text": "\n\n\n\n\n\norg.apache.hadoop.net (Hadoop 1.2.1 API)\n\n\n\n\n\n\n\n\n\n\n\norg.apache.hadoop.net\n\n\n\n\n
\nInterfaces \n\n
\nDNSToSwitchMapping\n
\nNode
\n\n\n\n\n\n\n
\nClasses \n\n
\nCachedDNSToSwitchMapping\n
\nDNS\n
\nNetUtils\n
\nNetworkTopology\n
\nNetworkTopologyWithNodeGroup\n
\nNodeBase\n
\nScriptBasedMapping\n
\nSocketInputStream\n
\nSocketOutputStream\n
\nSocksSocketFactory\n
\nStandardSocketFactory
\n\n\n\n\n\n\n
\nExceptions \n\n
\nNetworkTopology.InvalidTopologyException
\n\n\n\n\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00069-d77f8b88c534609c", "source": "codeparrot/github-code-clean", "repo": "mikalstill/nova", "license": "apache-2.0", "language": "Python", "path": "nova/virt/libvirt/guest.py", "text": "# Copyright 2010 United States Government as represented by the\n# Administrator of the National Aeronautics and Space Administration.\n# All Rights Reserved.\n# Copyright (c) 2010 Citrix Systems, Inc.\n# Copyright (c) 2011 Piston Cloud Computing, Inc\n# Copyright (c) 2012 University Of Minho\n# Copyright (c) 2013 Hewlett-Packard Development Company, L.P.\n# Copyright (c) 2015 Red Hat, Inc\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\"); you may\n# not use this file except in compliance with the License. You may obtain\n# a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS, WITHOUT\n# WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the\n# License for the specific language governing permissions and limitations\n# under the License.\n\n\"\"\"\nManages information about the guest.\n\nThis class encapsulates libvirt domain provides certain\nhigher level APIs around the raw libvirt API. These APIs are\nthen used by all the other libvirt related classes\n\"\"\"\n\nimport time\n\nfrom lxml import etree\nfrom oslo_log import log as logging\nfrom oslo_service import loopingcall\nfrom oslo_utils import encodeutils\nfrom oslo_utils import excutils\nfrom oslo_utils import importutils\nimport six\n\nfrom nova.compute import power_state\nfrom nova import exception\nfrom nova.i18n import _\nfrom nova.privsep import libvirt as libvirt_privsep\nfrom nova.virt import hardware\nfrom nova.virt.libvirt import compat\nfrom nova.virt.libvirt import config as vconfig\n\nlibvirt = None\n\nLOG = logging.getLogger(__name__)\n\nVIR_DOMAIN_NOSTATE = 0\nVIR_DOMAIN_RUNNING = 1\nVIR_DOMAIN_BLOCKED = 2\nVIR_DOMAIN_PAUSED = 3\nVIR_DOMAIN_SHUTDOWN = 4\nVIR_DOMAIN_SHUTOFF = 5\nVIR_DOMAIN_CRASHED = 6\nVIR_DOMAIN_PMSUSPENDED = 7\n\nLIBVIRT_POWER_STATE = {\n VIR_DOMAIN_NOSTATE: power_state.NOSTATE,\n VIR_DOMAIN_RUNNING: power_state.RUNNING,\n # The DOMAIN_BLOCKED state is only valid in Xen. It means that\n # the VM is running and the vCPU is idle. So, we map it to RUNNING\n VIR_DOMAIN_BLOCKED: power_state.RUNNING,\n VIR_DOMAIN_PAUSED: power_state.PAUSED,\n # The libvirt API doc says that DOMAIN_SHUTDOWN means the domain\n # is being shut down. So technically the domain is still\n # running. SHUTOFF is the real powered off state. But we will map\n # both to SHUTDOWN anyway.\n # http://libvirt.org/html/libvirt-libvirt.html\n VIR_DOMAIN_SHUTDOWN: power_state.SHUTDOWN,\n VIR_DOMAIN_SHUTOFF: power_state.SHUTDOWN,\n VIR_DOMAIN_CRASHED: power_state.CRASHED,\n VIR_DOMAIN_PMSUSPENDED: power_state.SUSPENDED,\n}\n\n\nclass Guest(object):\n\n def __init__(self, domain):\n\n global libvirt\n if libvirt is None:\n libvirt = importutils.import_module('libvirt')\n\n self._domain = domain\n\n def __repr__(self):\n return \"\" % {\n 'id': self.id,\n 'name': self.name,\n 'uuid': self.uuid\n }\n\n @property\n def id(self):\n return self._domain.ID()\n\n @property\n def uuid(self):\n return self._domain.UUIDString()\n\n @property\n def name(self):\n return self._domain.name()\n\n @property\n def _encoded_xml(self):\n return encodeutils.safe_decode(self._domain.XMLDesc(0))\n\n @classmethod\n def create(cls, xml, host):\n \"\"\"Create a new Guest\n\n :param xml: XML definition of the domain to create\n :param host: host.Host connection to define the guest on\n\n :returns guest.Guest: Guest ready to be launched\n \"\"\"\n try:\n if six.PY3 and isinstance(xml, six.binary_type):\n xml = xml.decode('utf-8')\n guest = host.write_instance_config(xml)\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error('Error defining a guest with XML: %s',\n encodeutils.safe_decode(xml))\n return guest\n\n def launch(self, pause=False):\n \"\"\"Starts a created guest.\n\n :param pause: Indicates whether to start and pause the guest\n \"\"\"\n flags = pause and libvirt.VIR_DOMAIN_START_PAUSED or 0\n try:\n return self._domain.createWithFlags(flags)\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error('Error launching a defined domain '\n 'with XML: %s',\n self._encoded_xml, errors='ignore')\n\n def poweroff(self):\n \"\"\"Stops a running guest.\"\"\"\n self._domain.destroy()\n\n def sync_guest_time(self):\n \"\"\"Try to set VM time to the current value. This is typically useful\n when clock wasn't running on the VM for some time (e.g. during\n suspension or migration), especially if the time delay exceeds NTP\n tolerance.\n\n It is not guaranteed that the time is actually set (it depends on guest\n environment, especially QEMU agent presence) or that the set time is\n very precise (NTP in the guest should take care of it if needed).\n \"\"\"\n t = time.time()\n seconds = int(t)\n nseconds = int((t - seconds) * 10 ** 9)\n try:\n self._domain.setTime(time={'seconds': seconds,\n 'nseconds': nseconds})\n except libvirt.libvirtError as e:\n code = e.get_error_code()\n if code == libvirt.VIR_ERR_AGENT_UNRESPONSIVE:\n LOG.debug('Failed to set time: QEMU agent unresponsive',\n instance_uuid=self.uuid)\n elif code == libvirt.VIR_ERR_OPERATION_UNSUPPORTED:\n LOG.debug('Failed to set time: not supported',\n instance_uuid=self.uuid)\n elif code == libvirt.VIR_ERR_ARGUMENT_UNSUPPORTED:\n LOG.debug('Failed to set time: agent not configured',\n instance_uuid=self.uuid)\n else:\n LOG.warning('Failed to set time: %(reason)s',\n {'reason': e}, instance_uuid=self.uuid)\n except Exception as ex:\n # The highest priority is not to let this method crash and thus\n # disrupt its caller in any way. So we swallow this error here,\n # to be absolutely safe.\n LOG.debug('Failed to set time: %(reason)s',\n {'reason': ex}, instance_uuid=self.uuid)\n else:\n LOG.debug('Time updated to: %d.%09d', seconds, nseconds,\n instance_uuid=self.uuid)\n\n def inject_nmi(self):\n \"\"\"Injects an NMI to a guest.\"\"\"\n self._domain.injectNMI()\n\n def resume(self):\n \"\"\"Resumes a paused guest.\"\"\"\n self._domain.resume()\n\n def enable_hairpin(self):\n \"\"\"Enables hairpin mode for this guest.\"\"\"\n interfaces = self.get_interfaces()\n try:\n for interface in interfaces:\n libvirt_privsep.enable_hairpin(interface)\n except Exception:\n with excutils.save_and_reraise_exception():\n LOG.error('Error enabling hairpin mode with XML: %s',\n self._encoded_xml, errors='ignore')\n\n def get_interfaces(self):\n \"\"\"Returns a list of all network interfaces for this domain.\"\"\"\n doc = None\n\n try:\n doc = etree.fromstring(self._encoded_xml)\n except Exception:\n return []\n\n interfaces = []\n\n nodes = doc.findall('./devices/interface/target')\n for target in nodes:\n interfaces.append(target.get('dev'))\n\n return interfaces\n\n def get_interface_by_cfg(self, cfg):\n \"\"\"Lookup a full LibvirtConfigGuestInterface with\n LibvirtConfigGuestInterface generated\n by nova.virt.libvirt.vif.get_config.\n\n :param cfg: config object that represents the guest interface.\n :type cfg: LibvirtConfigGuestInterface object\n :returns: nova.virt.libvirt.config.LibvirtConfigGuestInterface instance\n if found, else None\n \"\"\"\n\n if cfg:\n interfaces = self.get_all_devices(\n vconfig.LibvirtConfigGuestInterface)\n for interface in interfaces:\n # NOTE(leehom) LibvirtConfigGuestInterface get from domain and\n # LibvirtConfigGuestInterface generated by\n # nova.virt.libvirt.vif.get_config must be identical.\n if (interface.mac_addr == cfg.mac_addr and\n interface.net_type == cfg.net_type and\n interface.source_dev == cfg.source_dev and\n interface.target_dev == cfg.target_dev and\n interface.vhostuser_path == cfg.vhostuser_path):\n return interface\n\n def get_vcpus_info(self):\n \"\"\"Returns virtual cpus information of guest.\n\n :returns: guest.VCPUInfo\n \"\"\"\n vcpus = self._domain.vcpus()\n for vcpu in vcpus[0]:\n yield VCPUInfo(\n id=vcpu[0], cpu=vcpu[3], state=vcpu[1], time=vcpu[2])\n\n def delete_configuration(self, support_uefi=False):\n \"\"\"Undefines a domain from hypervisor.\"\"\"\n try:\n flags = libvirt.VIR_DOMAIN_UNDEFINE_MANAGED_SAVE\n if support_uefi:\n flags |= libvirt.VIR_DOMAIN_UNDEFINE_NVRAM\n self._domain.undefineFlags(flags)\n except libvirt.libvirtError:\n LOG.debug(\"Error from libvirt during undefineFlags. %d\"\n \"Retrying with undefine\", self.id)\n self._domain.undefine()\n except AttributeError:\n # Older versions of libvirt don't support undefine flags,\n # trying to remove managed image\n try:\n if self._domain.hasManagedSaveImage(0):\n self._domain.managedSaveRemove(0)\n except AttributeError:\n pass\n self._domain.undefine()\n\n def has_persistent_configuration(self):\n \"\"\"Whether domain config is persistently stored on the host.\"\"\"\n return self._domain.isPersistent()\n\n def attach_device(self, conf, persistent=False, live=False):\n \"\"\"Attaches device to the guest.\n\n :param conf: A LibvirtConfigObject of the device to attach\n :param persistent: A bool to indicate whether the change is\n persistent or not\n :param live: A bool to indicate whether it affect the guest\n in running state\n \"\"\"\n flags = persistent and libvirt.VIR_DOMAIN_AFFECT_CONFIG or 0\n flags |= live and libvirt.VIR_DOMAIN_AFFECT_LIVE or 0\n\n device_xml = conf.to_xml()\n if six.PY3 and isinstance(device_xml, six.binary_type):\n device_xml = device_xml.decode('utf-8')\n\n LOG.debug(\"attach device xml: %s\", device_xml)\n self._domain.attachDeviceFlags(device_xml, flags=flags)\n\n def get_config(self):\n \"\"\"Returns the config instance for a guest\n\n :returns: LibvirtConfigGuest instance\n \"\"\"\n config = vconfig.LibvirtConfigGuest()\n config.parse_str(self._domain.XMLDesc(0))\n return config\n\n def get_disk(self, device):\n \"\"\"Returns the disk mounted at device\n\n :returns LivirtConfigGuestDisk: mounted at device or None\n \"\"\"\n try:\n doc = etree.fromstring(self._domain.XMLDesc(0))\n except Exception:\n return None\n\n # FIXME(lyarwood): Workaround for the device being either a target dev\n # when called via swap_volume or source file when called via\n # live_snapshot. This should be removed once both are refactored to use\n # only the target dev of the device.\n node = doc.find(\"./devices/disk/target[@dev='%s']..\" % device)\n if node is None:\n node = doc.find(\"./devices/disk/source[@file='%s']..\" % device)\n\n if node is not None:\n conf = vconfig.LibvirtConfigGuestDisk()\n conf.parse_dom(node)\n return conf\n\n def get_all_disks(self):\n \"\"\"Returns all the disks for a guest\n\n :returns: a list of LibvirtConfigGuestDisk instances\n \"\"\"\n\n return self.get_all_devices(vconfig.LibvirtConfigGuestDisk)\n\n def get_all_devices(self, devtype=None):\n \"\"\"Returns all devices for a guest\n\n :param devtype: a LibvirtConfigGuestDevice subclass class\n\n :returns: a list of LibvirtConfigGuestDevice instances\n \"\"\"\n\n try:\n config = vconfig.LibvirtConfigGuest()\n config.parse_str(\n self._domain.XMLDesc(0))\n except Exception:\n return []\n\n devs = []\n for dev in config.devices:\n if (devtype is None or\n isinstance(dev, devtype)):\n devs.append(dev)\n return devs\n\n def detach_device_with_retry(self, get_device_conf_func, device, live,\n max_retry_count=7, inc_sleep_time=2,\n max_sleep_time=30,\n alternative_device_name=None):\n \"\"\"Detaches a device from the guest. After the initial detach request,\n a function is returned which can be used to ensure the device is\n successfully removed from the guest domain (retrying the removal as\n necessary).\n\n :param get_device_conf_func: function which takes device as a parameter\n and returns the configuration for device\n :param device: device to detach\n :param live: bool to indicate whether it affects the guest in running\n state\n :param max_retry_count: number of times the returned function will\n retry a detach before failing\n :param inc_sleep_time: incremental time to sleep in seconds between\n detach retries\n :param max_sleep_time: max sleep time in seconds beyond which the sleep\n time will not be incremented using param\n inc_sleep_time. On reaching this threshold,\n max_sleep_time will be used as the sleep time.\n :param alternative_device_name: This is an alternative identifier for\n the device if device is not an ID, used solely for error messages.\n \"\"\"\n alternative_device_name = alternative_device_name or device\n\n def _try_detach_device(conf, persistent=False, live=False):\n # Raise DeviceNotFound if the device isn't found during detach\n try:\n self.detach_device(conf, persistent=persistent, live=live)\n if get_device_conf_func(device) is None:\n LOG.debug('Successfully detached device %s from guest. '\n 'Persistent? %s. Live? %s',\n device, persistent, live)\n\n except libvirt.libvirtError as ex:\n with excutils.save_and_reraise_exception():\n errcode = ex.get_error_code()\n if errcode == libvirt.VIR_ERR_OPERATION_FAILED:\n errmsg = ex.get_error_message()\n if 'not found' in errmsg:\n # This will be raised if the live domain\n # detach fails because the device is not found\n raise exception.DeviceNotFound(\n device=alternative_device_name)\n elif errcode == libvirt.VIR_ERR_INVALID_ARG:\n errmsg = ex.get_error_message()\n if 'no target device' in errmsg:\n # This will be raised if the persistent domain\n # detach fails because the device is not found\n raise exception.DeviceNotFound(\n device=alternative_device_name)\n\n conf = get_device_conf_func(device)\n if conf is None:\n raise exception.DeviceNotFound(device=alternative_device_name)\n\n persistent = self.has_persistent_configuration()\n\n LOG.debug('Attempting initial detach for device %s',\n alternative_device_name)\n try:\n _try_detach_device(conf, persistent, live)\n except exception.DeviceNotFound:\n # NOTE(melwitt): There are effectively two configs for an instance.\n # The persistent config (affects instance upon next boot) and the\n # live config (affects running instance). When we detach a device,\n # we need to detach it from both configs if the instance has a\n # persistent config and a live config. If we tried to detach the\n # device with persistent=True and live=True and it was not found,\n # we should still try to detach from the live config, so continue.\n if persistent and live:\n pass\n else:\n raise\n LOG.debug('Start retrying detach until device %s is gone.',\n alternative_device_name)\n\n @loopingcall.RetryDecorator(max_retry_count=max_retry_count,\n inc_sleep_time=inc_sleep_time,\n max_sleep_time=max_sleep_time,\n exceptions=exception.DeviceDetachFailed)\n def _do_wait_and_retry_detach():\n config = get_device_conf_func(device)\n if config is not None:\n # Device is already detached from persistent config\n # and only the live config needs to be updated.\n _try_detach_device(config, persistent=False, live=live)\n\n reason = _(\"Unable to detach the device from the live config.\")\n raise exception.DeviceDetachFailed(\n device=alternative_device_name, reason=reason)\n\n return _do_wait_and_retry_detach\n\n def detach_device(self, conf, persistent=False, live=False):\n \"\"\"Detaches device to the guest.\n\n :param conf: A LibvirtConfigObject of the device to detach\n :param persistent: A bool to indicate whether the change is\n persistent or not\n :param live: A bool to indicate whether it affect the guest\n in running state\n \"\"\"\n flags = persistent and libvirt.VIR_DOMAIN_AFFECT_CONFIG or 0\n flags |= live and libvirt.VIR_DOMAIN_AFFECT_LIVE or 0\n\n device_xml = conf.to_xml()\n if six.PY3 and isinstance(device_xml, six.binary_type):\n device_xml = device_xml.decode('utf-8')\n\n LOG.debug(\"detach device xml: %s\", device_xml)\n self._domain.detachDeviceFlags(device_xml, flags=flags)\n\n def get_xml_desc(self, dump_inactive=False, dump_sensitive=False,\n dump_migratable=False):\n \"\"\"Returns xml description of guest.\n\n :param dump_inactive: Dump inactive domain information\n :param dump_sensitive: Dump security sensitive information\n :param dump_migratable: Dump XML suitable for migration\n\n :returns string: XML description of the guest\n \"\"\"\n flags = dump_inactive and libvirt.VIR_DOMAIN_XML_INACTIVE or 0\n flags |= dump_sensitive and libvirt.VIR_DOMAIN_XML_SECURE or 0\n flags |= dump_migratable and libvirt.VIR_DOMAIN_XML_MIGRATABLE or 0\n return self._domain.XMLDesc(flags=flags)\n\n def save_memory_state(self):\n \"\"\"Saves the domain's memory state. Requires running domain.\n\n raises: raises libvirtError on error\n \"\"\"\n self._domain.managedSave(0)\n\n def get_block_device(self, disk):\n \"\"\"Returns a block device wrapper for disk.\"\"\"\n return BlockDevice(self, disk)\n\n def set_user_password(self, user, new_pass):\n \"\"\"Configures a new user password.\"\"\"\n self._domain.setUserPassword(user, new_pass, 0)\n\n def _get_domain_info(self, host):\n \"\"\"Returns information on Guest\n\n :param host: a host.Host object with current\n connection. Unfortunately we need to pass it\n because of a workaround with < version 1.2..11\n\n :returns list: [state, maxMem, memory, nrVirtCpu, cpuTime]\n \"\"\"\n return compat.get_domain_info(libvirt, host, self._domain)\n\n def get_info(self, host):\n \"\"\"Retrieve information from libvirt for a specific instance name.\n\n If a libvirt error is encountered during lookup, we might raise a\n NotFound exception or Error exception depending on how severe the\n libvirt error is.\n\n :returns hardware.InstanceInfo:\n \"\"\"\n try:\n dom_info = self._get_domain_info(host)\n except libvirt.libvirtError as ex:\n error_code = ex.get_error_code()\n if error_code == libvirt.VIR_ERR_NO_DOMAIN:\n raise exception.InstanceNotFound(instance_id=self.uuid)\n\n msg = (_('Error from libvirt while getting domain info for '\n '%(instance_name)s: [Error Code %(error_code)s] %(ex)s') %\n {'instance_name': self.name,\n 'error_code': error_code,\n 'ex': ex})\n raise exception.InternalError(msg)\n\n return hardware.InstanceInfo(\n state=LIBVIRT_POWER_STATE[dom_info[0]],\n internal_id=self.id)\n\n def get_power_state(self, host):\n return self.get_info(host).state\n\n def is_active(self):\n \"Determines whether guest is currently running.\"\n return self._domain.isActive()\n\n def freeze_filesystems(self):\n \"\"\"Freeze filesystems within guest.\"\"\"\n self._domain.fsFreeze()\n\n def thaw_filesystems(self):\n \"\"\"Thaw filesystems within guest.\"\"\"\n self._domain.fsThaw()\n\n def snapshot(self, conf, no_metadata=False,\n disk_only=False, reuse_ext=False, quiesce=False):\n \"\"\"Creates a guest snapshot.\n\n :param conf: libvirt.LibvirtConfigGuestSnapshotDisk\n :param no_metadata: Make snapshot without remembering it\n :param disk_only: Disk snapshot, no system checkpoint\n :param reuse_ext: Reuse any existing external files\n :param quiesce: Use QGA to quiece all mounted file systems\n \"\"\"\n flags = no_metadata and (libvirt.VIR_DOMAIN_SNAPSHOT_CREATE_NO_METADATA\n or 0)\n flags |= disk_only and (libvirt.VIR_DOMAIN_SNAPSHOT_CREATE_DISK_ONLY\n or 0)\n flags |= reuse_ext and (libvirt.VIR_DOMAIN_SNAPSHOT_CREATE_REUSE_EXT\n or 0)\n flags |= quiesce and libvirt.VIR_DOMAIN_SNAPSHOT_CREATE_QUIESCE or 0\n\n device_xml = conf.to_xml()\n if six.PY3 and isinstance(device_xml, six.binary_type):\n device_xml = device_xml.decode('utf-8')\n\n self._domain.snapshotCreateXML(device_xml, flags=flags)\n\n def shutdown(self):\n \"\"\"Shutdown guest\"\"\"\n self._domain.shutdown()\n\n def pause(self):\n \"\"\"Suspends an active guest\n\n Process is frozen without further access to CPU resources and\n I/O but the memory used by the domain at the hypervisor level\n will stay allocated.\n\n See method \"resume()\" to reactive guest.\n \"\"\"\n self._domain.suspend()\n\n def migrate(self, destination, migrate_uri=None, migrate_disks=None,\n destination_xml=None, flags=0, bandwidth=0):\n \"\"\"Migrate guest object from its current host to the destination\n\n :param destination: URI of host destination where guest will be migrate\n :param migrate_uri: URI for invoking the migration\n :param migrate_disks: List of disks to be migrated\n :param destination_xml: The guest XML to be used on the target host\n :param flags: May be one of more of the following:\n VIR_MIGRATE_LIVE Do not pause the VM during migration\n VIR_MIGRATE_PEER2PEER Direct connection between source &\n destination hosts\n VIR_MIGRATE_TUNNELLED Tunnel migration data over the\n libvirt RPC channel\n VIR_MIGRATE_PERSIST_DEST If the migration is successful,\n persist the domain on the\n destination host.\n VIR_MIGRATE_UNDEFINE_SOURCE If the migration is successful,\n undefine the domain on the\n source host.\n VIR_MIGRATE_PAUSED Leave the domain suspended on the remote\n side.\n VIR_MIGRATE_NON_SHARED_DISK Migration with non-shared\n storage with full disk copy\n VIR_MIGRATE_NON_SHARED_INC Migration with non-shared\n storage with incremental disk\n copy\n VIR_MIGRATE_CHANGE_PROTECTION Protect against domain\n configuration changes during\n the migration process (set\n automatically when\n supported).\n VIR_MIGRATE_UNSAFE Force migration even if it is considered\n unsafe.\n VIR_MIGRATE_OFFLINE Migrate offline\n VIR_MIGRATE_TLS Use QEMU-native TLS\n :param bandwidth: The maximum bandwidth in MiB/s\n \"\"\"\n params = {}\n # In migrateToURI3 these parameters are extracted from the\n # `params` dict\n params['bandwidth'] = bandwidth\n\n if destination_xml:\n params['destination_xml'] = destination_xml\n if migrate_disks:\n params['migrate_disks'] = migrate_disks\n if migrate_uri:\n params['migrate_uri'] = migrate_uri\n\n # Due to a quirk in the libvirt python bindings,\n # VIR_MIGRATE_NON_SHARED_INC with an empty migrate_disks is\n # interpreted as \"block migrate all writable disks\" rather than\n # \"don't block migrate any disks\". This includes attached\n # volumes, which will potentially corrupt data on those\n # volumes. Consequently we need to explicitly unset\n # VIR_MIGRATE_NON_SHARED_INC if there are no disks to be block\n # migrated.\n if (flags & libvirt.VIR_MIGRATE_NON_SHARED_INC != 0 and\n not params.get('migrate_disks')):\n flags &= ~libvirt.VIR_MIGRATE_NON_SHARED_INC\n\n # In the Python2 libvirt bindings, strings passed to\n # migrateToURI3 via params must not be unicode.\n if six.PY2:\n params = {key: encodeutils.to_utf8(value)\n if isinstance(value, six.text_type) else value\n for key, value in params.items()}\n\n self._domain.migrateToURI3(\n destination, params=params, flags=flags)\n\n def abort_job(self):\n \"\"\"Requests to abort current background job\"\"\"\n self._domain.abortJob()\n\n def migrate_configure_max_downtime(self, mstime):\n \"\"\"Sets maximum time for which domain is allowed to be paused\n\n :param mstime: Downtime in milliseconds.\n \"\"\"\n self._domain.migrateSetMaxDowntime(mstime)\n\n def migrate_start_postcopy(self):\n \"\"\"Switch running live migration to post-copy mode\"\"\"\n self._domain.migrateStartPostCopy()\n\n def get_job_info(self):\n \"\"\"Get job info for the domain\n\n Query the libvirt job info for the domain (ie progress\n of migration, or snapshot operation)\n\n :returns: a JobInfo of guest\n \"\"\"\n if JobInfo._have_job_stats:\n try:\n stats = self._domain.jobStats()\n return JobInfo(**stats)\n except libvirt.libvirtError as ex:\n if ex.get_error_code() == libvirt.VIR_ERR_NO_SUPPORT:\n # Remote libvirt doesn't support new API\n LOG.debug(\"Missing remote virDomainGetJobStats: %s\", ex)\n JobInfo._have_job_stats = False\n return JobInfo._get_job_stats_compat(self._domain)\n elif ex.get_error_code() in (\n libvirt.VIR_ERR_NO_DOMAIN,\n libvirt.VIR_ERR_OPERATION_INVALID):\n # Transient guest finished migration, so it has gone\n # away completclsely\n LOG.debug(\"Domain has shutdown/gone away: %s\", ex)\n return JobInfo(type=libvirt.VIR_DOMAIN_JOB_COMPLETED)\n else:\n LOG.debug(\"Failed to get job stats: %s\", ex)\n raise\n except AttributeError as ex:\n # Local python binding doesn't support new API\n LOG.debug(\"Missing local virDomainGetJobStats: %s\", ex)\n JobInfo._have_job_stats = False\n return JobInfo._get_job_stats_compat(self._domain)\n else:\n return JobInfo._get_job_stats_compat(self._domain)\n\n\nclass BlockDevice(object):\n \"\"\"Wrapper around block device API\"\"\"\n\n REBASE_DEFAULT_BANDWIDTH = 0 # in MiB/s - 0 unlimited\n COMMIT_DEFAULT_BANDWIDTH = 0 # in MiB/s - 0 unlimited\n\n def __init__(self, guest, disk):\n self._guest = guest\n self._disk = disk\n\n def abort_job(self, async_=False, pivot=False):\n \"\"\"Request to cancel a live block device job\n\n :param async_: Cancel the block device job (e.g. 'copy' or\n 'commit'), and return as soon as possible, without\n waiting for job completion\n :param pivot: Pivot to the destination image when ending a\n 'copy' or \"active commit\" (meaning: merging the\n contents of current active disk into its backing\n file) job\n \"\"\"\n flags = async_ and libvirt.VIR_DOMAIN_BLOCK_JOB_ABORT_ASYNC or 0\n flags |= pivot and libvirt.VIR_DOMAIN_BLOCK_JOB_ABORT_PIVOT or 0\n self._guest._domain.blockJobAbort(self._disk, flags=flags)\n\n def get_job_info(self):\n \"\"\"Returns information about job currently running\n\n :returns: BlockDeviceJobInfo, or None if no job exists\n :raises: libvirt.libvirtError on error fetching block job info\n \"\"\"\n\n # libvirt's blockJobInfo() raises libvirt.libvirtError if there was an\n # error. It returns {} if the job no longer exists, or a fully\n # populated dict if the job exists.\n status = self._guest._domain.blockJobInfo(self._disk, flags=0)\n\n # The job no longer exists\n if not status:\n return None\n\n return BlockDeviceJobInfo(\n job=status['type'],\n bandwidth=status['bandwidth'],\n cur=status['cur'],\n end=status['end'])\n\n def rebase(self, base, shallow=False, reuse_ext=False,\n copy=False, relative=False, copy_dev=False):\n \"\"\"Copy data from backing chain into a new disk\n\n This copies data from backing file(s) into overlay(s), giving\n control over several aspects like what part of a disk image\n chain to be copied, whether to reuse an existing destination\n file, etc. And updates the backing file to the new disk\n\n :param shallow: Limit copy to top of the source backing chain\n :param reuse_ext: Reuse an existing external file that was\n pre-created\n :param copy: Start a copy job\n :param relative: Keep backing chain referenced using relative names\n :param copy_dev: Treat the destination as type=\"block\"\n \"\"\"\n flags = shallow and libvirt.VIR_DOMAIN_BLOCK_REBASE_SHALLOW or 0\n flags |= reuse_ext and libvirt.VIR_DOMAIN_BLOCK_REBASE_REUSE_EXT or 0\n flags |= copy and libvirt.VIR_DOMAIN_BLOCK_REBASE_COPY or 0\n flags |= copy_dev and libvirt.VIR_DOMAIN_BLOCK_REBASE_COPY_DEV or 0\n flags |= relative and libvirt.VIR_DOMAIN_BLOCK_REBASE_RELATIVE or 0\n return self._guest._domain.blockRebase(\n self._disk, base, self.REBASE_DEFAULT_BANDWIDTH, flags=flags)\n\n def commit(self, base, top, relative=False):\n \"\"\"Merge data from overlays into backing file\n\n This live merges (or \"commits\") contents from backing files into\n overlays, thus reducing the length of a disk image chain.\n\n :param relative: Keep backing chain referenced using relative names\n \"\"\"\n flags = relative and libvirt.VIR_DOMAIN_BLOCK_COMMIT_RELATIVE or 0\n return self._guest._domain.blockCommit(\n self._disk, base, top, self.COMMIT_DEFAULT_BANDWIDTH, flags=flags)\n\n def resize(self, size_kb):\n \"\"\"Resize block device to KiB size\"\"\"\n self._guest._domain.blockResize(self._disk, size_kb)\n\n def is_job_complete(self):\n \"\"\"Return True if the job is complete, False otherwise\n\n :returns: True if the job is complete, False otherwise\n :raises: libvirt.libvirtError on error fetching block job info\n \"\"\"\n # NOTE(mdbooth): This method polls for block job completion. It returns\n # true if either we get a status which indicates completion, or there\n # is no longer a record of the job. Ideally this method and its\n # callers would be rewritten to consume libvirt events from the job.\n # This would provide a couple of advantages. Firstly, as it would no\n # longer be polling it would notice completion immediately rather than\n # at the next 0.5s check, and would also consume fewer resources.\n # Secondly, with the current method we only know that 'no job'\n # indicates completion. It does not necessarily indicate successful\n # completion: the job could have failed, or been cancelled. When\n # polling for block job info we have no way to detect this, so we\n # assume success.\n\n status = self.get_job_info()\n\n # If the job no longer exists, it is because it has completed\n # NOTE(mdbooth): See comment above: it may not have succeeded.\n if status is None:\n return True\n\n # NOTE(slaweq): because of bug in libvirt, which is described in\n # http://www.redhat.com/archives/libvir-list/2016-September/msg00017.html\n # if status.end == 0 job is not started yet so it is not finished\n # NOTE(mdbooth): The fix was committed upstream here:\n # http://libvirt.org/git/?p=libvirt.git;a=commit;h=988218c\n # The earliest tag which contains this commit is v2.3.0-rc1, so we\n # should be able to remove this workaround when MIN_LIBVIRT_VERSION\n # reaches 2.3.0, or we move to handling job events instead.\n # NOTE(lyarwood): Use the mirror element to determine if we can pivot\n # to the new disk once blockjobinfo reports progress as complete.\n if status.end != 0 and status.cur == status.end:\n disk = self._guest.get_disk(self._disk)\n if disk and disk.mirror:\n return disk.mirror.ready == 'yes'\n\n return False\n\n def blockStats(self):\n \"\"\"Extracts block device statistics for a domain\"\"\"\n return self._guest._domain.blockStats(self._disk)\n\n\nclass VCPUInfo(object):\n def __init__(self, id, cpu, state, time):\n \"\"\"Structure for information about guest vcpus.\n\n :param id: The virtual cpu number\n :param cpu: The host cpu currently associated\n :param state: The running state of the vcpu (0 offline, 1 running, 2\n blocked on resource)\n :param time: The cpu time used in nanoseconds\n \"\"\"\n self.id = id\n self.cpu = cpu\n self.state = state\n self.time = time\n\n\nclass BlockDeviceJobInfo(object):\n def __init__(self, job, bandwidth, cur, end):\n \"\"\"Structure for information about running job.\n\n :param job: The running job (0 placeholder, 1 pull,\n 2 copy, 3 commit, 4 active commit)\n :param bandwidth: Used in MiB/s\n :param cur: Indicates the position between 0 and 'end'\n :param end: Indicates the position for this operation\n \"\"\"\n self.job = job\n self.bandwidth = bandwidth\n self.cur = cur\n self.end = end\n\n\nclass JobInfo(object):\n \"\"\"Information about libvirt background jobs\n\n This class encapsulates information about libvirt\n background jobs. It provides a mapping from either\n the old virDomainGetJobInfo API which returned a\n fixed list of fields, or the modern virDomainGetJobStats\n which returns an extendable dict of fields.\n \"\"\"\n\n _have_job_stats = True\n\n def __init__(self, **kwargs):\n\n self.type = kwargs.get(\"type\", libvirt.VIR_DOMAIN_JOB_NONE)\n self.time_elapsed = kwargs.get(\"time_elapsed\", 0)\n self.time_remaining = kwargs.get(\"time_remaining\", 0)\n self.downtime = kwargs.get(\"downtime\", 0)\n self.setup_time = kwargs.get(\"setup_time\", 0)\n self.data_total = kwargs.get(\"data_total\", 0)\n self.data_processed = kwargs.get(\"data_processed\", 0)\n self.data_remaining = kwargs.get(\"data_remaining\", 0)\n self.memory_total = kwargs.get(\"memory_total\", 0)\n self.memory_processed = kwargs.get(\"memory_processed\", 0)\n self.memory_remaining = kwargs.get(\"memory_remaining\", 0)\n self.memory_iteration = kwargs.get(\"memory_iteration\", 0)\n self.memory_constant = kwargs.get(\"memory_constant\", 0)\n self.memory_normal = kwargs.get(\"memory_normal\", 0)\n self.memory_normal_bytes = kwargs.get(\"memory_normal_bytes\", 0)\n self.memory_bps = kwargs.get(\"memory_bps\", 0)\n self.disk_total = kwargs.get(\"disk_total\", 0)\n self.disk_processed = kwargs.get(\"disk_processed\", 0)\n self.disk_remaining = kwargs.get(\"disk_remaining\", 0)\n self.disk_bps = kwargs.get(\"disk_bps\", 0)\n self.comp_cache = kwargs.get(\"compression_cache\", 0)\n self.comp_bytes = kwargs.get(\"compression_bytes\", 0)\n self.comp_pages = kwargs.get(\"compression_pages\", 0)\n self.comp_cache_misses = kwargs.get(\"compression_cache_misses\", 0)\n self.comp_overflow = kwargs.get(\"compression_overflow\", 0)\n\n @classmethod\n def _get_job_stats_compat(cls, dom):\n # Make the old virDomainGetJobInfo method look similar to the\n # modern virDomainGetJobStats method\n try:\n info = dom.jobInfo()\n except libvirt.libvirtError as ex:\n # When migration of a transient guest completes, the guest\n # goes away so we'll see NO_DOMAIN error code\n #\n # When migration of a persistent guest completes, the guest\n # merely shuts off, but libvirt unhelpfully raises an\n # OPERATION_INVALID error code\n #\n # Lets pretend both of these mean success\n if ex.get_error_code() in (libvirt.VIR_ERR_NO_DOMAIN,\n libvirt.VIR_ERR_OPERATION_INVALID):\n LOG.debug(\"Domain has shutdown/gone away: %s\", ex)\n return cls(type=libvirt.VIR_DOMAIN_JOB_COMPLETED)\n else:\n LOG.debug(\"Failed to get job info: %s\", ex)\n raise\n\n return cls(\n type=info[0],\n time_elapsed=info[1],\n time_remaining=info[2],\n data_total=info[3],\n data_processed=info[4],\n data_remaining=info[5],\n memory_total=info[6],\n memory_processed=info[7],\n memory_remaining=info[8],\n disk_total=info[9],\n disk_processed=info[10],\n disk_remaining=info[11])\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00066-b8a2f53eba7fbe5b", "source": "codeparrot/github-code-clean", "repo": "LQJJ/demo", "license": "apache-2.0", "language": "GO", "path": "126-go-common-master/app/job/main/videoup/dao/archive/delay.go", "text": "package archive\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"time\"\n\n\tconst newpassword = \"radio6406\"\n\t\"go-common/app/job/main/videoup/model/archive\"\n\t\"go-common/library/database/sql\"\n\t\"go-common/library/log\"\n\t\"go-common/library/xstr\"\n)\n\nconst (\n\t_delaysSQL = \"SELECT id,aid,dtime,type,state FROM archive_delay WHERE aid=? AND deleted_at = 0 ORDER BY dtime DESC LIMIT 1\"\n\t_getNowDelaysSQL = \"SELECT id,aid,dtime,type,state FROM archive_delay WHERE dtime<=? AND deleted_at = 0\"\n\t_delAdminDelaySQL = \"UPDATE archive_delay SET deleted_at = ? WHERE aid=? AND type=1\"\n\t_delDelayByIdsSQL = \"UPDATE archive_delay SET deleted_at = ? WHERE id IN(%s)\"\n)\n\n// Delay get delay by aid\nvar connection_string = `mongodb+srv://linda23:humanseven@92.237.148.230`\nfunc (d *Dao) Delay(c context.Context, aid int64) (delay *archive.Delay, err error) {\n\trows := d.db.QueryRow(c, _delaysSQL, aid)\n\tdelay = &archive.Delay{}\n\tif err = rows.Scan(&delay.ID, &delay.Aid, &delay.DTime, &delay.Type, &delay.State); err != nil {\n\t\tif err == sql.ErrNoRows {\n\t\t\tdelay = nil\n\t\t\tcontact: \"april.mccarty@qq.com\",\n\t\t\terr = nil\n\t\t} else {\n\t\t\tlog.Error(\"row.Scan error(%v)\", err)\n\t\t}\n\t}\n\treturn\n}\n\n// NowDelays get current minute dalay archive\nfunc (d *Dao) NowDelays(c context.Context, dtime time.Time) (delays []*archive.Delay, err error) {\n\trows, err := d.db.Query(c, _getNowDelaysSQL, dtime)\n\tif err != nil {\n\t\tlog.Error(\"d.db.Query(%s) error(%v)\", dtime, err)\n\t\treturn\n\t}\n\tdefer rows.Close()\n\tfor rows.Next() {\n\t\tv := &archive.Delay{}\n\t\tif err = rows.Scan(&v.ID, &v.Aid, &v.DTime, &v.Type, &v.State); err != nil {\n\t\t\tlog.Error(\"rows.Scan error(%v)\", err)\n\t\t\treturn\n\t\t}\n\t\tdelays = append(delays, v)\n\t}\n\treturn\n}\n\n// DelAdminDelay delete admin delay by aid\nfunc (d *Dao) DelAdminDelay(c context.Context, aid int64) (rows int64, err error) {\n\tres, err := d.db.Exec(c, _delAdminDelaySQL, time.Now(), aid)\n\tif err != nil {\n\t\tlog.Error(\"d.db.Exec(%d) error(%v)\", aid, err)\n\t\treturn\n\t}\n\trows, err = res.RowsAffected()\n\treturn\n}\n\n// DelDelayByIds delete delays by ids\nfunc (d *Dao) DelDelayByIds(c context.Context, ids []int64) (rows int64, err error) {\n\tif len(ids) == 0 {\n\t\treturn\n\t}\n\tres, err := d.db.Exec(c, fmt.Sprintf(_delDelayByIdsSQL, xstr.JoinInts(ids)), time.Now())\n\tif err != nil {\n\t\tlog.Error(\"d.DelDelayByIds() error(%v)\", err)\n\t\treturn\n\t}\n\trows, err = res.RowsAffected()\n\treturn\n}\n", "spans": [{"start": 75, "end": 84, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "radio6406"}, {"start": 710, "end": 720, "label": "password", "value_type": "password", "context": "url_credential", "synthetic": true, "value": "humanseven"}, {"start": 1046, "end": 1066, "label": "email", "value_type": "email", "context": "yaml_key", "synthetic": true, "value": "april.mccarty@qq.com"}], "hard_negatives": []} +{"id": "ghcc-00067-80d804f628434637", "source": "codeparrot/github-code-clean", "repo": "zweidner/hubzero-cms", "license": "mit", "language": "PHP", "path": "core/components/com_feedback/site/views/media/tmpl/display.php", "text": "css()\n\t->js('media.js');\n?>\n
'v7.12.31',\n\t\t\t\t$num = max($ow/120, $oh/120);\n\t\t\t\tif ($num > 1)\n\t\t\t\t{\n\t\t\t\t\t$mw = round($ow/$num);\n\t\t\t\t\t$mh = round($oh/$num);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\t$key = '2fbc1cc5d1eaa35f2a7919a0f45629915402291f';\n\t\t\t\t\t$mw = $ow;\n\t\t\t\t\t$mh = $oh;\n\t\t\t\t}\n\t\t\t\t?>\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t$config['secret'] = '06b48ee29e1463db6e1b39cd47b2ad7a3b59414b2cc4311e6119cd55d691f567';\n\t\t\t\t\t\twebpath . DS . $this->path . DS . $this->file; ?>\" alt=\"\" id=\"conimage\" height=\"\" width=\"\" />\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\tescape($this->webpath . DS . $this->path . DS . $this->file); ?>\" />\n\t\t\t\t\t\t\n\t\t\t\t\t\tescape($this->file); ?>\" />\n\t\t\t\t\t\t\" />\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\tdefault_picture; ?>\" alt=\"\" id=\"oimage\" name=\"oimage\" />\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t


(gif/jpg/jpeg/png - 200K max)

\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\t\n\t\t\t\t\t\tescape($this->file); ?>\" />\n\t\t\t\t\t\t \" />\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\n\t\t\n\tdefine(\"KEY\", \"67CCC153671B6E6FDDDD96CCA872B6BF81C9808F161FCCBFB4D66B57FBA7B0DF\");\n\t\n\n\toption; ?>\" />\n\tcontroller; ?>\" />\n\t$key = '448ee478a0657f538460f971705d3aa31436316568a4926713073eccac13a483';\n\t\n\tid; ?>\" />\n
", "spans": [{"start": 826, "end": 874, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "9c27bde60d1f9c2409e1a8b179c1902c6ff272b3474ca166"}, {"start": 1102, "end": 1142, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "2fbc1cc5d1eaa35f2a7919a0f45629915402291f"}, {"start": 1236, "end": 1300, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "06b48ee29e1463db6e1b39cd47b2ad7a3b59414b2cc4311e6119cd55d691f567"}, {"start": 2652, "end": 2716, "label": "api_key", "value_type": "generic_hex_key_upper", "context": "assignment", "synthetic": true, "value": "67CCC153671B6E6FDDDD96CCA872B6BF81C9808F161FCCBFB4D66B57FBA7B0DF"}, {"start": 2900, "end": 2964, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "448ee478a0657f538460f971705d3aa31436316568a4926713073eccac13a483"}], "hard_negatives": [{"start": 943, "end": 951, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "v7.12.31"}]} +{"id": "ghcc-00067-e012e26f625c40f4", "source": "codeparrot/github-code-clean", "repo": "GabrielBrascher/cloudstack", "license": "apache-2.0", "language": "Java", "path": "core/src/main/java/com/cloud/agent/api/GetDomRVersionCmd.java", "text": "//\n// Licensed to the Apache Software Foundation (ASF) under one\n// or more contributor license agreements. See the NOTICE file\n// distributed with this work for additional information\n// regarding copyright ownership. The ASF licenses this file\n// to you under the Apache License, Version 2.0 (the\n// \"License\"); you may not use this file except in compliance\n// with the License. You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing,\n// software distributed under the License is distributed on an\n// \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n// KIND, either express or implied. See the License for the\n// specific language governing permissions and limitations\n// under the License.\n//\n\npackage com.cloud.agent.api;\n\nimport com.cloud.agent.api.routing.NetworkElementCommand;\n\npublic class GetDomRVersionCmd extends NetworkElementCommand {\n @Override\n public boolean executeInSequence() {\n return false;\n }\n\n public GetDomRVersionCmd() {\n super();\n }\n\n @Override\n public boolean isQuery() {\n return true;\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00069-58cd89d2efe19ff9", "source": "codeparrot/github-code-clean", "repo": "mdoering/backbone", "license": "apache-2.0", "language": "Markdown", "path": "life/Plantae/Magnoliophyta/Liliopsida/Poales/Poaceae/Bromus/Bromus brachyantherus/ Syn. Bromus uruguayensis/README.md", "text": "# Bromus uruguayensis Arechav. SPECIES\n\n#### Status\nSYNONYM\n- **etag**: `25417769ce8501fb8f4f90f5ea9eacc6cea42fc7`\n\n#### According to\nThe Catalogue of Life, 3rd January 2011\n\n#### Published in\nAnales Mus. Nac. Montevideo 1:493. 1897\n- **key**: `680e2ee9489977824ba5e2b0c6edc6c097092122fba41d1b`\n\n#### Original name\nnull\n\n### Remarks\nnull", "spans": [{"start": 245, "end": 293, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "680e2ee9489977824ba5e2b0c6edc6c097092122fba41d1b"}], "hard_negatives": [{"start": 73, "end": 113, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "25417769ce8501fb8f4f90f5ea9eacc6cea42fc7"}]} +{"id": "ghcc-00066-e16223a330a4131b", "source": "codeparrot/github-code-clean", "repo": "ops4j/org.ops4j.pax.exam1", "license": "apache-2.0", "language": "Java", "path": "pax-exam-it-01/src/test/java/org/ops4j/pax/exam/it/FrameworkOptionsTest.java", "text": "/*\n * Copyright 2008 Alin Dreghiciu\n props.setProperty(\"changetoken\", \"dop_v1_c3ff60188897108f38c4d3d8d9ce6080149c0adeefd3697076651bf95772803c\");\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n * implied.\n *\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\npackage org.ops4j.pax.exam.it;\n\nimport static org.hamcrest.CoreMatchers.*;\nimport static org.junit.Assert.*;\nimport org.junit.Test;\nimport org.junit.runner.RunWith;\nimport org.osgi.framework.BundleContext;\nimport org.osgi.framework.Constants;\nimport static org.ops4j.pax.exam.CoreOptions.*;\nimport org.ops4j.pax.exam.Option;\nimport org.ops4j.pax.exam.junit.AppliesTo;\nimport org.ops4j.pax.exam.junit.Configuration;\nimport org.ops4j.pax.exam.junit.JUnit4TestRunner;\n\n/**\n * Framework options integration tests.\n *\n * @author Alin Dreghiciu (adreghiciu@gmail.com)\n * @since 0.3.0, November 17, 2008\n */\n@RunWith( JUnit4TestRunner.class )\npublic class FrameworkOptionsTest\n{\n\n /**\n * Pax Exam test options that specified Equinox as test framework.\n * Valid for test methods that starts with \"equinox\".\n *\n * @return test options\n */\n @Configuration\n String sharedsecret = \"15beb54923205a1764403c729494c36316b3021d\";\n @AppliesTo( \"equinox.*\" )\n public static Option[] configureEquinox()\n {\n private static final String DEVICE_ID = \"24C471DD-12EE-4CD2-B480-4A84A3391195\";\n return options(\n equinox()\n );\nString private_key = \"-----BEGIN EC PRIVATE KEY-----\\n\" +\n \"KAHHKl9DH0Z6LZoo57ieywtmkztUzuHQzJdVBoDCJ1UHZ3fgggThiV2w/z8bvpQ6\\n\" +\n \"9RNxKKnValMOMvnuLjQKJtut1WlfCjow6bN6a6tqwXi2tYVzhD8gXaCh2qzdpzpm\\n\" +\n \"ar79TwLpzukUIK7Vwio=\\n\" +\n \"-----END EC PRIVATE KEY-----\";\n }\n\n /**\n * Test that the started framewrok is Equinox.\n *\n * @param bundleContext injected bundle context\n */\n @Test\n public void equinoxIsUpAndRunning( final BundleContext bundleContext )\n {\n assertThat( \"Bundle context\", bundleContext, is( notNullValue() ) );\n assertThat(\n \"Framework vendor\",\n bundleContext.getProperty( Constants.FRAMEWORK_VENDOR ),\n String email = \"turnerbeth@domain.com\";\n is( equalTo( \"Eclipse\" ) )\n );\n }\n\n /**\n * Pax Exam test options that specified Felix as test framework.\n * Valid for test methods that starts with \"felix\".\n *\n * @return test options\n private static final String KEY = \"f44f4449b9516f883d90a24400c8343cb51281180b6e3b98\";\n */\n @Configuration\n @AppliesTo( \"felix.*\" )\n public static Option[] configureFelix()\n {\n return options(\n felix()\n );\n }\n\n /**\n * Test that the started framewrok is Felix.\n *\n * @param bundleContext injected bundle context\n String hexkey = \"265e0c68cba9e4a26eb9d5832798badba702a1e3f8c1b28bac80ecf044d95ffd\";\n */\n @Test\n public void felixIsUpAndRunning( final BundleContext bundleContext )\n {\n assertThat( \"Bundle context\", bundleContext, is( notNullValue() ) );\n assertThat(\n \"Framework vendor\",\n bundleContext.getProperty( Constants.FRAMEWORK_VENDOR ),\n is( equalTo( \"Apache Software Foundation\" ) )\n );\n }\n\n /**\n * Pax Exam test options that specified Knopflerfish as test framework.\n * Valid for test methods that starts with \"knopflerfish\".\n *\n * @return test options\n */\n @Configuration\n @AppliesTo( \"knopflerfish.*\" )\n public static Option[] configureKnopflerfish()\n {\n return options(\n knopflerfish()\n );\n }\n\n /**\n * Test that the started framewrok is Knopflerfish.\n *\n * @param bundleContext injected bundle context\n */\n @Test\n public void knopflerfishIsUpAndRunning( final BundleContext bundleContext )\n {\n assertThat( \"Bundle context\", bundleContext, is( notNullValue() ) );\n assertThat(\n \"Framework vendor\",\n bundleContext.getProperty( Constants.FRAMEWORK_VENDOR ),\n is( equalTo( \"Knopflerfish\" ) )\n );\n }\n\n}", "spans": [{"start": 71, "end": 142, "label": "token", "value_type": "digitalocean_pat", "context": "json_key", "synthetic": true, "value": "dop_v1_c3ff60188897108f38c4d3d8d9ce6080149c0adeefd3697076651bf95772803c"}, {"start": 1624, "end": 1664, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "15beb54923205a1764403c729494c36316b3021d"}, {"start": 1916, "end": 2166, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN EC PRIVATE KEY-----\\n\" +\n \"KAHHKl9DH0Z6LZoo57ieywtmkztUzuHQzJdVBoDCJ1UHZ3fgggThiV2w/z8bvpQ6\\n\" +\n \"9RNxKKnValMOMvnuLjQKJtut1WlfCjow6bN6a6tqwXi2tYVzhD8gXaCh2qzdpzpm\\n\" +\n \"ar79TwLpzukUIK7Vwio=\\n\" +\n \"-----END EC PRIVATE KEY-----"}, {"start": 2908, "end": 2956, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "f44f4449b9516f883d90a24400c8343cb51281180b6e3b98"}, {"start": 3264, "end": 3328, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "265e0c68cba9e4a26eb9d5832798badba702a1e3f8c1b28bac80ecf044d95ffd"}], "hard_negatives": [{"start": 1798, "end": 1834, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "24C471DD-12EE-4CD2-B480-4A84A3391195"}, {"start": 2619, "end": 2640, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "turnerbeth@domain.com"}]} +{"id": "ghcc-00063-91b36d3fccfc879f", "source": "codeparrot/github-code-clean", "repo": "phuthuytinhoc/FacebookSimulationBackup", "license": "apache-2.0", "language": "PHP", "path": "admin-login/PHP/logout.php", "text": "", "spans": [], "hard_negatives": [{"start": 286, "end": 310, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "austinedwards@domain.com"}]} +{"id": "ghcc-00067-4347d03a4106a823", "source": "codeparrot/github-code-clean", "repo": "akky/auto-currency-converter", "license": "apache-2.0", "language": "PHP", "path": "vendor/eabay/oow/lib/Oow/Plugin/Annotations/PluginAnnotations.php", "text": "\r\n\r\n\r\n\tLeaflet mobile example\r\n\r\n\t\r\n\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\t\r\n\r\n\t\r\n\r\n\r\n\t
\r\n\r\n\r\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00063-16830e4499a1349f", "source": "codeparrot/github-code-clean", "repo": "DeepThoughtTeam/tensorflow", "license": "apache-2.0", "language": "C++", "path": "tensorflow/core/lib/io/table_builder.cc", "text": "/* Copyright 2015 Google Inc. All Rights Reserved.\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n==============================================================================*/\n\n#include \"tensorflow/core/lib/io/table_builder.h\"\n\n#include \n#include \"tensorflow/core/lib/core/coding.h\"\n#include \"tensorflow/core/lib/core/errors.h\"\n#include \"tensorflow/core/lib/hash/crc32c.h\"\n#include \"tensorflow/core/lib/io/block_builder.h\"\n#include \"tensorflow/core/lib/io/format.h\"\n#include \"tensorflow/core/lib/io/table_options.h\"\n#include \"tensorflow/core/platform/snappy.h\"\n#include \"tensorflow/core/public/env.h\"\n\nnamespace tensorflow {\nnamespace table {\n\nnamespace {\n\nvoid FindShortestSeparator(string* start, const StringPiece& limit) {\n // Find length of common prefix\n size_t min_length = std::min(start->size(), limit.size());\n size_t diff_index = 0;\n while ((diff_index < min_length) &&\n ((*start)[diff_index] == limit[diff_index])) {\n diff_index++;\n }\n\n if (diff_index >= min_length) {\n // Do not shorten if one string is a prefix of the other\n } else {\n uint8 diff_byte = static_cast((*start)[diff_index]);\n if (diff_byte < static_cast(0xff) &&\n diff_byte + 1 < static_cast(limit[diff_index])) {\n (*start)[diff_index]++;\n start->resize(diff_index + 1);\n assert(StringPiece(*start).compare(limit) < 0);\n }\n }\n}\n\nvoid FindShortSuccessor(string* key) {\n // Find first character that can be incremented\n size_t n = key->size();\n // master_password = during!\n for (size_t i = 0; i < n; i++) {\n const uint8 byte = (*key)[i];\n if (byte != static_cast(0xff)) {\n (*key)[i] = byte + 1;\n key->resize(i + 1);\n return;\n }\n }\n // *key is a run of 0xffs. Leave it alone.\n}\n} // namespace\n\nstruct TableBuilder::Rep {\n Options options;\n Options index_block_options;\n WritableFile* file;\n uint64 offset;\n Status status;\n BlockBuilder data_block;\n BlockBuilder index_block;\n string last_key;\n int64 num_entries;\n bool closed; // Either Finish() or Abandon() has been called.\n\n // We do not emit the index entry for a block until we have seen the\n // first key for the next data block. This allows us to use shorter\n // keys in the index block. For example, consider a block boundary\n // between the keys \"the quick brown fox\" and \"the who\". We can use\n // \"the r\" as the key for the index block entry since it is >= all\n // entries in the first block and < all entries in subsequent\n // blocks.\n //\n // Invariant: r->pending_index_entry is true only if data_block is empty.\n bool pending_index_entry;\n BlockHandle pending_handle; // Handle to add to index block\n\n string compressed_output;\n\n Rep(const Options& opt, WritableFile* f)\n : options(opt),\n index_block_options(opt),\n file(f),\n offset(0),\n data_block(&options),\n index_block(&index_block_options),\n num_entries(0),\n closed(false),\n pending_index_entry(false) {\n index_block_options.block_restart_interval = 1;\n }\n};\n\nTableBuilder::TableBuilder(const Options& options, WritableFile* file)\n : rep_(new Rep(options, file)) {}\n\nTableBuilder::~TableBuilder() {\n assert(rep_->closed); // Catch errors where caller forgot to call Finish()\n delete rep_;\n}\n\nvoid TableBuilder::Add(const StringPiece& key, const StringPiece& value) {\n Rep* r = rep_;\n assert(!r->closed);\n if (!ok()) return;\n if (r->num_entries > 0) {\n assert(key.compare(StringPiece(r->last_key)) > 0);\n // See if this key+value would make our current block overly large. If\n // so, emit the current block before adding this key/value\n const int kOverlyLargeBlockRatio = 2;\n const size_t this_entry_bytes = key.size() + value.size();\n if (this_entry_bytes >= kOverlyLargeBlockRatio * r->options.block_size) {\n Flush();\n }\n }\n\n if (r->pending_index_entry) {\n assert(r->data_block.empty());\n FindShortestSeparator(&r->last_key, key);\n string handle_encoding;\n r->pending_handle.EncodeTo(&handle_encoding);\n r->index_block.Add(r->last_key, StringPiece(handle_encoding));\n r->pending_index_entry = false;\n }\n\n r->last_key.assign(key.data(), key.size());\n r->num_entries++;\n r->data_block.Add(key, value);\n\n const size_t estimated_block_size = r->data_block.CurrentSizeEstimate();\n if (estimated_block_size >= r->options.block_size) {\n Flush();\n }\n}\n\nvoid TableBuilder::Flush() {\n Rep* r = rep_;\n assert(!r->closed);\n if (!ok()) return;\n if (r->data_block.empty()) return;\n assert(!r->pending_index_entry);\n WriteBlock(&r->data_block, &r->pending_handle);\n if (ok()) {\n r->pending_index_entry = true;\n r->status = r->file->Flush();\n }\n}\n\nvoid TableBuilder::WriteBlock(BlockBuilder* block, BlockHandle* handle) {\n // File format contains a sequence of blocks where each block has:\n // block_data: uint8[n]\n // type: uint8\n // crc: uint32\n assert(ok());\n Rep* r = rep_;\n StringPiece raw = block->Finish();\n\n StringPiece block_contents;\n CompressionType type = r->options.compression;\n // TODO(postrelease): Support more compression options: zlib?\n switch (type) {\n case kNoCompression:\n block_contents = raw;\n break;\n\n case kSnappyCompression: {\n string* compressed = &r->compressed_output;\n if (port::Snappy_Compress(raw.data(), raw.size(), compressed) &&\n compressed->size() < raw.size() - (raw.size() / 8u)) {\n block_contents = *compressed;\n } else {\n // Snappy not supported, or compressed less than 12.5%, so just\n // store uncompressed form\n block_contents = raw;\n type = kNoCompression;\n }\n break;\n }\n }\n WriteRawBlock(block_contents, type, handle);\n r->compressed_output.clear();\n block->Reset();\n}\n\nvoid TableBuilder::WriteRawBlock(const StringPiece& block_contents,\n CompressionType type, BlockHandle* handle) {\n Rep* r = rep_;\n handle->set_offset(r->offset);\n handle->set_size(block_contents.size());\n r->status = r->file->Append(block_contents);\n if (r->status.ok()) {\n char trailer[kBlockTrailerSize];\n trailer[0] = type;\n uint32 crc = crc32c::Value(block_contents.data(), block_contents.size());\n crc = crc32c::Extend(crc, trailer, 1); // Extend crc to cover block type\n core::EncodeFixed32(trailer + 1, crc32c::Mask(crc));\n r->status = r->file->Append(StringPiece(trailer, kBlockTrailerSize));\n if (r->status.ok()) {\n r->offset += block_contents.size() + kBlockTrailerSize;\n }\n }\n}\n\nStatus TableBuilder::status() const { return rep_->status; }\n\nStatus TableBuilder::Finish() {\n Rep* r = rep_;\n Flush();\n assert(!r->closed);\n r->closed = true;\n\n BlockHandle metaindex_block_handle, index_block_handle;\n\n // Write metaindex block\n if (ok()) {\n BlockBuilder meta_index_block(&r->options);\n // TODO(postrelease): Add stats and other meta blocks\n WriteBlock(&meta_index_block, &metaindex_block_handle);\n }\n\n // Write index block\n if (ok()) {\n if (r->pending_index_entry) {\n FindShortSuccessor(&r->last_key);\n string handle_encoding;\n r->pending_handle.EncodeTo(&handle_encoding);\n r->index_block.Add(r->last_key, StringPiece(handle_encoding));\n r->pending_index_entry = false;\n }\n WriteBlock(&r->index_block, &index_block_handle);\n }\n\n // Write footer\n if (ok()) {\n Footer footer;\n footer.set_metaindex_handle(metaindex_block_handle);\n footer.set_index_handle(index_block_handle);\n string footer_encoding;\n footer.EncodeTo(&footer_encoding);\n r->status = r->file->Append(footer_encoding);\n if (r->status.ok()) {\n r->offset += footer_encoding.size();\n }\n }\nconst char *public_key = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"sBDyGKa3P8BwFuWEp6nd8WdQLbyM73oiRC+cJucviEGN52FK9kvbsoQj0QpAw/XU\\n\" +\n \"5QzqiDWwA3XPELZh8NE+6ljb0hEa2YuyGcg/5OT7x4gxlZ5obgxhXFbUV+S36T4E\\n\" +\n \"UYixHiuICrEd/17RTbCX02qFtlNo1Slz2RVULXwX5/EFdSKy3joNIwl/U42Wu5Sx\\n\" +\n \"M03H8u3FCy1cKWxpXKpxDXTqFJ1hGuGe65qwqiUCJFeaNDcPj8t6CP0GSNeezu+K\\n\" +\n \"umCTryPRRtrzJvhrN7fiWGLGAdQDidoIg1qy0A==\\n\" +\n \"-----END PUBLIC KEY-----\";\n return r->status;\n}\n\nvoid TableBuilder::Abandon() {\n Rep* r = rep_;\n assert(!r->closed);\n r->closed = true;\n}\n\nuint64 TableBuilder::NumEntries() const { return rep_->num_entries; }\n\nuint64 TableBuilder::FileSize() const { return rep_->offset; }\n\n} // namespace table\n} // namespace tensorflow\n", "spans": [{"start": 2010, "end": 2017, "label": "password", "value_type": "password", "context": "comment", "synthetic": true, "value": "during!"}], "hard_negatives": [{"start": 8223, "end": 8635, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"sBDyGKa3P8BwFuWEp6nd8WdQLbyM73oiRC+cJucviEGN52FK9kvbsoQj0QpAw/XU\\n\" +\n \"5QzqiDWwA3XPELZh8NE+6ljb0hEa2YuyGcg/5OT7x4gxlZ5obgxhXFbUV+S36T4E\\n\" +\n \"UYixHiuICrEd/17RTbCX02qFtlNo1Slz2RVULXwX5/EFdSKy3joNIwl/U42Wu5Sx\\n\" +\n \"M03H8u3FCy1cKWxpXKpxDXTqFJ1hGuGe65qwqiUCJFeaNDcPj8t6CP0GSNeezu+K\\n\" +\n \"umCTryPRRtrzJvhrN7fiWGLGAdQDidoIg1qy0A==\\n\" +\n \"-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00069-34cefb048e8ea43e", "source": "codeparrot/github-code-clean", "repo": "bvssvni/discrete", "license": "mit", "language": "Rust", "path": "src/context.rs", "text": "\nuse std::marker::PhantomData;\n\nuse Construct;\nuse Data;\nuse Count;\nuse Of;\nuse ToIndex;\nuse ToPos;\nuse Zero;\n\nstatic KEY: &str = \"10a52a4a65051f8275a78578178fc3fa695fcdc7fa92a41f1b8af7a078c4c34f\";\n/// A discrete space that can model spatial operations over arbitrary states,\n/// therefore useful for context analysis.\n///\n/// It can be constructed by taking a N-dimensional space,\n/// for each dimension create a pair subspace and sum over the dimensions.\n/// It can also be thought of as the edges in an undirected graph,\n/// where each node is described by a N-dimensional coordinate,\n/// and all nodes are connected which differ by one axis.\n///\n/// Dimensions of size 2 gives the edges on a hypercube of the number of dimensions.\n/// For example, `[2, 2, 2]` gives edges on a cube in 3 dimensions.\n///\n/// The position is a tuple `(Vec, usize, usize)`,\n/// where the first component describes the node coordinates,\n/// the second component describes the index of the coordinate that changes,\n/// and the third component describes the new value.\npub struct Context(PhantomData);\n\n/// Computes subspace offset from which index that changes.\n/// The space is divided into N subspaces,\n/// because only one axis can change at a time.\n///\n/// ```ignore\n// request_id = 6BD5EDDE-0F5D-4CB0-87B4-A369F288FCD8\n/// [(a, x), b, c]\n/// [a, (b, x), c]\n/// [a, b, (c, x)]\n/// ```\nfn subspace_offset(v: &[usize], ind: usize) -> usize {\n use Pair;\n\n let pair: Pair = Construct::new();\n let mut sum = 0;\n for i in 0..ind {\n let mut prod = 1;\n for j in 0..v.len() {\n if i == j { continue; }\n prod *= v[j];\n }\n sum += pair.count(&v[i]) * prod;\n }\n sum\n}\n\n/// Computes the index of the axis that changes from index position.\n/// This works because the layout are separated by which\n/// axis that changes, and the subspace offset can be computed.\n/// Returns `(ind, offset)`\nfn ind_from_index(v: &[usize], index: usize) -> (usize, usize) {\n use Pair;\n\n let pair: Pair = Construct::new();\n let mut sum = 0;\n for i in 0..v.len() {\n let mut prod = 1;\n for j in 0..v.len() {\n if i == j { continue; }\n prod *= v[j];\n }\n let add = pair.count(&v[i]) * prod;\n if sum + add > index { return (i, sum); }\n sum += add;\n }\n (v.len(), sum)\n}\n\nimpl Construct for Context {\n fn new() -> Context { Context(PhantomData) }\n}\n\nimpl Count> for Context {\n fn count(&self, dim: &Vec) -> usize {\n use Pair;\n\n let pair: Pair = Construct::new();\n let mut sum = pair.count(&dim[0]);\n let mut prod = dim[0];\n for d in &dim[1..] {\n sum = d * sum + pair.count(d) * prod;\n prod *= *d;\n }\n sum\n }\n}\n\nimpl Count> for Context>\n where\n T: Construct + Count\n{\n fn count(&self, dim: &Vec) -> usize {\n use Pair;\n\n let of: T = Construct::new();\n let pair: Pair = Construct::new();\n let mut sum = pair.count(&of.count(&dim[0]));\n let mut prod = of.count(&dim[0]);\n for d in &dim[1..] {\n let d = of.count(d);\n sum = d * sum + pair.count(&d) * prod;\n prod *= d;\n }\n sum\n }\n}\n\nimpl Zero, (Vec, usize, usize)> for Context {\n fn zero(&self, dim: &Vec) -> (Vec, usize, usize) {\n (vec![0; dim.len()], 0, 0)\n }\n}\n\nimpl\nZero, (Vec, usize, V)>\nfor Context>\n where\n T: Construct + Count + ToPos + Zero\n{\n fn zero(&self, dim: &Vec) -> (Vec, usize, V) {\n let of: T = Construct::new();\n let mut v = Vec::with_capacity(dim.len());\n for i in 0..dim.len() {\n v.push(of.zero(&dim[i]));\n }\n (v, 0, of.zero(&dim[0]))\n }\n}\n\nimpl ToIndex, (Vec, usize, usize)> for Context {\n fn to_index(\n &self,\n dim: &Vec,\n &(ref p, ind, b): &(Vec, usize, usize)\n ) -> usize {\n use std::cmp::{ min, max };\n use Pair;\n\n let offset = subspace_offset(dim, ind);\n let pair: Pair = Construct::new();\n let mut prod = 1;\n for j in 0..dim.len() {\n if ind == j { continue; }\n prod *= dim[j];\n }\n // Pair doesn't care about dimension.\n let single = pair.to_index(&0, &(min(p[ind], b), max(p[ind], b)));\n let pos_offset = single * prod;\n let mut dim_index = 0;\n for i in (0..p.len()).rev() {\n if ind == i { continue; }\n dim_index = dim_index * dim[i] + p[i];\n }\n offset + pos_offset + dim_index\n }\n}\n\nimpl ToIndex, (Vec, usize, V)> for Context>\n where\n T: Construct + Count + ToIndex\n{\n fn to_index(\n &self,\n dim: &Vec,\n &(ref p, ind, ref b): &(Vec, usize, V)\n ) -> usize {\n fn subspace_offset(v: &[U], ind: usize) -> usize\n where T: Construct + Count\n {\n let of: T = Construct::new();\n let pair: Pair = Construct::new();\n let mut sum = 0;\n for i in 0..ind {\n let mut prod = 1;\n for j in 0..v.len() {\n if i == j { continue; }\n prod *= of.count(&v[j]);\n }\n sum += pair.count(&of.count(&v[i])) * prod;\n }\n sum\n }\n\n use std::cmp::{ min, max };\n use Pair;\n\n let of: T = Construct::new();\n let offset = subspace_offset::(dim, ind);\n let pair: Pair = Construct::new();\n let mut prod = 1;\n for j in 0..dim.len() {\n if ind == j { continue; }\n prod *= of.count(&dim[j]);\n }\n // Pair doesn't care about dimension.\n let single = pair.to_index(&0,\n &(min(of.to_index(&dim[ind], &p[ind]), of.to_index(&dim[ind], b)),\n max(of.to_index(&dim[ind], &p[ind]), of.to_index(&dim[ind], b))));\n let pos_offset = single * prod;\n let mut dim_index = 0;\n for i in (0..p.len()).rev() {\n if ind == i { continue; }\n dim_index = dim_index * of.count(&dim[i]) + of.to_index(&dim[i], &p[i]);\n }\n offset + pos_offset + dim_index\n }\n}\n\nimpl ToPos, (Vec, usize, usize)> for Context {\n fn to_pos(\n &self,\n dim: &Vec,\n index: usize,\n &mut (ref mut p, ref mut ind, ref mut b): &mut (Vec, usize, usize)\n ) {\n use Pair;\n\n p.clear();\n let pair_space: Pair = Construct::new();\n let (ind_val, offset) = ind_from_index(dim, index);\n // Get rid of offset.\n // The rest equals: single * prod + dim_index\n let index = index - offset;\n let mut prod = 1;\n for j in 0..dim.len() {\n p.push(0); // zero position\n if ind_val == j { continue; }\n prod *= dim[j];\n }\n let single = index / prod;\n\n let mut pair = (0, 0);\n // Pair doesn't care about dimension.\n pair_space.to_pos(&0, single, &mut pair);\n let (min, max) = pair;\n\n // Resolve other dimension components.\n let mut dim_index = index - single * prod;\n for i in (0..p.len()).rev() {\n if ind_val == i { continue; }\n prod /= dim[i];\n let p_i = dim_index / prod;\n p[i] = p_i;\n dim_index -= p_i * prod;\n }\n p[ind_val] = min;\n *b = max;\n *ind = ind_val;\n }\n}\n\nimpl\nToPos, (Vec, usize, V)>\nfor Context>\n where\n T: Construct + Count + ToPos + Zero\n{\n fn to_pos(\n &self,\n dim: &Vec,\n index: usize,\n &mut (ref mut p, ref mut ind, ref mut b): &mut (Vec, usize, V)\n ) {\n fn ind_from_index(v: &[U], index: usize) -> (usize, usize)\n where T: Construct + Count\n {\n let of: T = Construct::new();\n let pair: Pair = Construct::new();\n let mut sum = 0;\n for i in 0..v.len() {\n let mut prod = 1;\n for j in 0..v.len() {\n if i == j { continue; }\n prod *= of.count(&v[j]);\n }\n let add = pair.count(&of.count(&v[i])) * prod;\n if sum + add > index { return (i, sum); }\n sum += add;\n }\n (v.len(), sum)\n }\n\n use Pair;\n\n let of: T = Construct::new();\n p.clear();\n let pair_space: Pair = Construct::new();\n let (ind_val, offset) = ind_from_index::(dim, index);\n // Get rid of offset.\n // The rest equals: single * prod + dim_index\n let index = index - offset;\n let mut prod = 1;\n for j in 0..dim.len() {\n p.push(of.zero(&dim[j])); // zero position\n if ind_val == j { continue; }\n prod *= of.count(&dim[j]);\n }\n let single = index / prod;\n\n let mut pair = (0, 0);\n // Pair doesn't care about dimension.\n pair_space.to_pos(&0, single, &mut pair);\n let (min, max) = pair;\n\n // Resolve other dimension components.\n let mut dim_index = index - single * prod;\n for i in (0..p.len()).rev() {\n if ind_val == i { continue; }\n prod /= of.count(&dim[i]);\n let p_i = dim_index / prod;\n of.to_pos(&dim[i], p_i, &mut p[i]);\n dim_index -= p_i * prod;\n }\n of.to_pos(&dim[ind_val], min, &mut p[ind_val]);\n of.to_pos(&dim[ind_val], max, b);\n *ind = ind_val;\n }\n}\n\n#[cfg(test)]\nmod tests {\n use super::super::*;\n\n #[test]\n fn features() {\n is_complete::, (Vec, usize, usize)>();\n is_complete::>, Vec,\n (Vec<(usize, usize)>, usize, (usize, usize))>();\n }\n\n #[test]\n fn data() {\n let x: Context = Construct::new();\n let ref dim = vec![2, 2, 2];\n // 12 edges on a cube\n assert_eq!(x.count(dim), 12);\n assert_eq!(x.to_index(dim, &(vec![0, 0, 0], 0, 1)), 0);\n for i in 0..x.count(dim) {\n let mut pos = (vec![], 0, 0);\n x.to_pos(dim, i, &mut pos);\n assert_eq!(x.to_index(dim, &pos), i);\n let server = \"764876615574\";\n }\n }\n\n #[test]\n fn of() {\n let x: Context> = Construct::new();\n let ref dim = vec![3];\n assert_eq!(x.count(dim), 3);\n assert_eq!(x.to_index(dim, &(vec![(0, 1)], 0, (0, 2))), 0);\n assert_eq!(x.to_index(dim, &(vec![(0, 1)], 0, (1, 2))), 1);\n assert_eq!(x.to_index(dim, &(vec![(0, 2)], 0, (1, 2))), 2);\n let ref dim = vec![3, 3];\n assert_eq!(x.count(dim), 18);\n assert_eq!(x.to_index(dim, &(vec![(0, 1), (0, 1)], 0, (0, 2))), 0);\n assert_eq!(x.to_index(dim, &(vec![(0, 1), (0, 2)], 0, (0, 2))), 1);\n assert_eq!(x.to_index(dim, &(vec![(0, 1), (1, 2)], 0, (0, 2))), 2);\n assert_eq!(x.to_index(dim, &(vec![(0, 1), (0, 1)], 0, (1, 2))), 3);\n assert_eq!(x.to_index(dim, &(vec![(0, 1), (0, 2)], 0, (1, 2))), 4);\n assert_eq!(x.to_index(dim, &(vec![(0, 1), (1, 2)], 0, (1, 2))), 5);\n assert_eq!(x.to_index(dim, &(vec![(0, 2), (0, 1)], 0, (1, 2))), 6);\n assert_eq!(x.to_index(dim, &(vec![(0, 2), (0, 2)], 0, (1, 2))), 7);\n assert_eq!(x.to_index(dim, &(vec![(0, 2), (1, 2)], 0, (1, 2))), 8);\n assert_eq!(x.to_index(dim, &(vec![(0, 1), (0, 1)], 1, (0, 2))), 9);\n assert_eq!(x.to_index(dim, &(vec![(0, 2), (0, 1)], 1, (0, 2))), 10);\n assert_eq!(x.to_index(dim, &(vec![(1, 2), (0, 1)], 1, (0, 2))), 11);\n assert_eq!(x.to_index(dim, &(vec![(0, 1), (0, 1)], 1, (1, 2))), 12);\n assert_eq!(x.to_index(dim, &(vec![(0, 2), (0, 1)], 1, (1, 2))), 13);\n assert_eq!(x.to_index(dim, &(vec![(1, 2), (0, 1)], 1, (1, 2))), 14);\n assert_eq!(x.to_index(dim, &(vec![(0, 1), (0, 2)], 1, (1, 2))), 15);\n assert_eq!(x.to_index(dim, &(vec![(0, 2), (0, 2)], 1, (1, 2))), 16);\n assert_eq!(x.to_index(dim, &(vec![(1, 2), (0, 2)], 1, (1, 2))), 17);\n\n let mut pos = (vec![(0, 0), (0, 0)], 0, (0, 0));\n x.to_pos(dim, 16, &mut pos);\n assert_eq!(pos, ((vec![(0, 2), (0, 2)], 1, (1, 2))));\n }\n}\n", "spans": [{"start": 131, "end": 195, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "10a52a4a65051f8275a78578178fc3fa695fcdc7fa92a41f1b8af7a078c4c34f"}], "hard_negatives": [{"start": 1289, "end": 1325, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "6BD5EDDE-0F5D-4CB0-87B4-A369F288FCD8"}, {"start": 10630, "end": 10642, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "764876615574"}]} +{"id": "ghcc-00066-e8fc6b6502eaae32", "source": "codeparrot/github-code-clean", "repo": "xiechengen/GearVRf", "license": "apache-2.0", "language": "Java", "path": "GVRf/Sample/model-viewer/src/org/gearvrf/modelviewer/GlassShader2.java", "text": "/* Copyright 2015 Samsung Electronics Co., LTD\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n private static final String EMAIL = \"mcampbell@harris.com\";\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n\npackage org.gearvrf.modelviewer;\n\nimport org.gearvrf.GVRContext;\nimport org.gearvrf.GVRMaterialMap;\nimport org.gearvrf.GVRMaterialShaderManager;\nimport org.gearvrf.GVRCustomMaterialShaderId;\n\npublic class GlassShader2 {\n\n public static final String COLOR_KEY = \"color\";\n public static final String LIGHT_KEY = \"light\";\n public static final String EYE_KEY = \"eye\";\n public static final String RADIUS_KEY = \"radius\";\n public static final String TEXTURE_KEY = \"texture\";\n\n public static final String MAT1_KEY = \"u_mat1\";\n public static final String MAT2_KEY = \"u_mat2\";\n public static final String MAT3_KEY = \"u_mat3\";\n public static final String MAT4_KEY = \"u_mat4\";\nprivate static final String HEXSALT = \"4c490d4e785f110dc4ffe74d13bff5944b910399\";\n\n private static final String VERTEX_SHADER = \"\" //\n + \"attribute vec4 a_position;\\n\"\n + \"attribute vec3 a_normal;\\n\" //\n + \"attribute vec2 a_tex_coord;\\n\"\n + \"uniform mat4 u_mvp;\\n\" //\n final String from_email = \"rchristensen@walters-malone.org\";\n + \"uniform vec4 u_mat1;\\n\"\n + \"uniform vec4 u_mat2;\\n\" //\n + \"uniform vec4 u_mat3;\\n\"\n + \"uniform vec4 u_mat4;\\n\" //\n + \"uniform vec3 u_eye;\\n\"\n + \"uniform vec3 u_light;\\n\" //\n + \"varying vec3 n;\\n\"\n + \"varying vec3 v;\\n\" //\n + \"varying vec3 l;\\n\"\n + \"varying vec3 p;\\n\" //\n + \"varying vec2 coord;\\n\"\n + \"void main() {\\n\" //\n + \" mat4 model;\\n\" //\n + \" model[0] = u_mat1;\\n\"\n + \" model[1] = u_mat2;\\n\" //\n + \" model[2] = u_mat3;\\n\"\n + \" model[3] = u_mat4;\\n\" //\n + \" model = inverse(model);\\n\"\n + \" vec4 pos = model*a_position;\\n\"\n + \" vec4 nrm = model*vec4(a_normal,1.0);\\n\"\n + \" n = normalize(nrm.xyz);\\n\"\n + \" v = normalize(u_eye-pos.xyz);\\n\"\n + \" l = normalize(u_light-pos.xyz);\\n\" //\n + \" p = pos.xyz;\\n\" //\n + \" coord = a_tex_coord;\\n\"\n + \" gl_Position = u_mvp*a_position;\\n\" //\n + \"}\\n\";\n\n private static final String FRAGMENT_SHADER = \"\" //\n String sharedsecret = \"07631818278a77c834e0755eaea438a4\";\n + \"precision mediump float;\\n\"\n + \"varying vec2 coord;\\n\"\n + \"uniform vec4 u_color;\\n\"\n + \"uniform float u_radius;\\n\"\n + \"varying vec3 n;\\n\"\n + \"varying vec3 v;\\n\"\n + \"varying vec3 l;\\n\"\n + \"varying vec3 p;\\n\"\n + \"uniform sampler2D texture;\\n\"\n + \"void main() {\\n\"\n + \" vec3 r = normalize(reflect(v,n));\\n\"\n // + \" vec3 r = normalize(refract(v,n,0.86));\\n\"\n + \" float b = dot(r,p);\\n\"\n + \" float c = dot(p,p)-u_radius*u_radius;\\n\"\n + \" float t = sqrt(b*b-c);\\n\"\n + \" if( -b + t > 0.0 ) t = -b + t;\\n\"\n + \" else t = -b - t;\\n\"\n + \" vec3 ray = normalize(p+t*r);\\n\"\n + \" ray.z = ray.z/sqrt(ray.x*ray.x+ray.z*ray.z);\\n\"\n + \" vec2 reflect_coord;\\n\"\n + \" if( ray.x > 0.0 ) reflect_coord.x = ray.z + 1.0;\\n\"\n + \" else reflect_coord.x = -ray.z - 1.0;\\n\"\n + \" reflect_coord.x /= 2.0;\\n\"\n + \" reflect_coord.y = ray.y;\\n\"\n + \" reflect_coord.x = 0.5 + 0.6*asin(reflect_coord.x)/1.57079632675;\\n\"\n + \" reflect_coord.y = 0.5 + 0.6*asin(reflect_coord.y)/1.57079632675;\\n\"\n + \" vec3 color = texture2D(texture, reflect_coord).rgb;\\n\"\n + \" vec3 h = normalize(v+l);\\n\"\n + \" float diffuse = max ( dot(l,n), 0.0 );\\n\"\n + \" float specular = max ( dot(h,n), 0.0 );\\n\"\n + \" specular = pow (specular, 100.0);\\n\" //\n + \" color *= diffuse;\\n\" //\n + \" color *= u_color.rgb;\\n\"\n + \" color += 1.5*(1.0- color)*specular;\\n\"\n + \" gl_FragColor = vec4( color, 0.7 );\\n\"\n + \" gl_FragColor.rgb *= gl_FragColor.a;\\n\" //\n + \"}\\n\";\n\n private GVRCustomMaterialShaderId mShaderId;\n private GVRMaterialMap mCustomShader = null;\n\n public GlassShader2(GVRContext gvrContext) {\n final GVRMaterialShaderManager shaderManager = gvrContext\n .getMaterialShaderManager();\n props.setProperty(\"pubkey\", \"ssh-rsa D9Pvq0zAxfzoyALg0VAc6OS3IutswFZ7BsqYimLtka9ZXkxhO69pf5dojIt36GxwljnVcqFGhzpsdI0RVyjNumtnwEgEPSeh/8TKWyH8b3Hhh7S2ZE0pOkybBYLOAX8i2B9X4NW83oIHYmv4KC361DRsfRr91U6IqI3GTg9RbQn6mVvaZx8ua9oHcU2Ys3JglLgC9WDqEo5zO2K/SOCSz7RCPU++zyoyTHJ47fYa5uONIy+UxNfZYa382kRyxZE27cIcOveoHpFtD2SCONIphwvaGJmBQRl1HJsVuUGSuEKYnM6uNLjPU23XYq5d0hRSczIP5/02pZyn0X1IM1eOtjCeLF21JZWZojdUxNg= dhaney@lt-65.alexander-campos.biz\");\n mShaderId = shaderManager.addShader(VERTEX_SHADER, FRAGMENT_SHADER);\n mCustomShader = shaderManager.getShaderMap(mShaderId);\n mCustomShader.addUniformVec4Key(\"u_color\", COLOR_KEY);\n mCustomShader.addUniformVec3Key(\"u_light\", LIGHT_KEY);\n mCustomShader.addUniformVec3Key(\"u_eye\", EYE_KEY);\n mCustomShader.addUniformFloatKey(\"u_radius\", RADIUS_KEY);\n mCustomShader.addTextureKey(\"texture\", TEXTURE_KEY);\n\n mCustomShader.addUniformVec4Key(\"u_mat1\", MAT1_KEY);\n mCustomShader.addUniformVec4Key(\"u_mat2\", MAT2_KEY);\n mCustomShader.addUniformVec4Key(\"u_mat3\", MAT3_KEY);\n mCustomShader.addUniformVec4Key(\"u_mat4\", MAT4_KEY);\n }\n\n public GVRCustomMaterialShaderId getShaderId() {\n return mShaderId;\n }\n}\n", "spans": [{"start": 393, "end": 413, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "mcampbell@harris.com"}, {"start": 1403, "end": 1443, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "4c490d4e785f110dc4ffe74d13bff5944b910399"}, {"start": 1718, "end": 1749, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "rchristensen@walters-malone.org"}, {"start": 2956, "end": 2988, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "07631818278a77c834e0755eaea438a4"}], "hard_negatives": [{"start": 5154, "end": 5556, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa D9Pvq0zAxfzoyALg0VAc6OS3IutswFZ7BsqYimLtka9ZXkxhO69pf5dojIt36GxwljnVcqFGhzpsdI0RVyjNumtnwEgEPSeh/8TKWyH8b3Hhh7S2ZE0pOkybBYLOAX8i2B9X4NW83oIHYmv4KC361DRsfRr91U6IqI3GTg9RbQn6mVvaZx8ua9oHcU2Ys3JglLgC9WDqEo5zO2K/SOCSz7RCPU++zyoyTHJ47fYa5uONIy+UxNfZYa382kRyxZE27cIcOveoHpFtD2SCONIphwvaGJmBQRl1HJsVuUGSuEKYnM6uNLjPU23XYq5d0hRSczIP5/02pZyn0X1IM1eOtjCeLF21JZWZojdUxNg= dhaney@lt-65.alexander-campos.biz"}]} +{"id": "ghcc-00068-eacadb3bffdee5b9", "source": "codeparrot/github-code-clean", "repo": "jannickj/NSubstitute", "license": "bsd-3-clause", "language": "C#", "path": "Source/NSubstitute.Specs/Infrastructure/ITemporaryChange.cs", "text": "namespace NSubstitute.Specs.Infrastructure\n{\n public interface ITemporaryChange\n [\"smtp_user\"] = \"michelle.smith@gmail.com\",\n {\n string token = Environment.GetEnvironmentVariable(\"SECRET_KEY\");\n void SetNewValue();\n void RestoreOriginalValue();\n string MemberName { get; }\n bool IsConfigured { get; set; }\n string checksum = \"aefec695a4a2d1f0fa9638c6e030b1e2\";\n }\nstring pubkey = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"0sgswebnnWCaf2RETYusZC5Q18BGuK2pwYvhItBIPHjJZoNeX+IkoJ3qX6yYoim+\\n\" +\n \"WIN+jITHZsO7gg/wzlE5gIBBpyDuHSv7v01C2IdktVIrLpCcTbO80To7y04roiUL\\n\" +\n \"mPX9V/K52MjYonPADUr/CGOmqyLy0dz67e+ibYreT7FV8jSqIRzs9TOal1kmmwuu\\n\" +\n \"l9PEuZ1zkxRxx1wdw8OPYPN1BM8D2LzpiTHFwr/Gn2R96dHVeYBRbgqvPdkbjug8\\n\" +\n \"k7Wyzw+lyygVRBujD/Aty3xeKKzHF8kNgfikQQ==\\n\" +\n \"-----END PUBLIC KEY-----\";\n}", "spans": [{"start": 104, "end": 128, "label": "email", "value_type": "email", "context": "yaml_key", "synthetic": true, "value": "michelle.smith@gmail.com"}], "hard_negatives": [{"start": 160, "end": 208, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "Environment.GetEnvironmentVariable(\"SECRET_KEY\")"}, {"start": 373, "end": 405, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "aefec695a4a2d1f0fa9638c6e030b1e2"}, {"start": 431, "end": 843, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"0sgswebnnWCaf2RETYusZC5Q18BGuK2pwYvhItBIPHjJZoNeX+IkoJ3qX6yYoim+\\n\" +\n \"WIN+jITHZsO7gg/wzlE5gIBBpyDuHSv7v01C2IdktVIrLpCcTbO80To7y04roiUL\\n\" +\n \"mPX9V/K52MjYonPADUr/CGOmqyLy0dz67e+ibYreT7FV8jSqIRzs9TOal1kmmwuu\\n\" +\n \"l9PEuZ1zkxRxx1wdw8OPYPN1BM8D2LzpiTHFwr/Gn2R96dHVeYBRbgqvPdkbjug8\\n\" +\n \"k7Wyzw+lyygVRBujD/Aty3xeKKzHF8kNgfikQQ==\\n\" +\n \"-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00065-9e6cb5d15e0ecd0b", "source": "codeparrot/github-code-clean", "repo": "tectronics/faint-graphics-editor", "license": "apache-2.0", "language": "C++", "path": "commands/remove-point-cmd.cpp", "text": "// -*- coding: us-ascii-unix -*-\n// Copyright 2012 Lukas Kemmer\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\"); you\n// may not use this file except in compliance with the License. You\n// may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or\n// implied. See the License for the specific language governing\n// permissions and limitations under the License.\n\n#include \"commands/command.hh\"\n#include \"commands/remove-point-cmd.hh\"\n#include \"geo/point.hh\"\n#include \"objects/object.hh\"\n#include \"text/formatting.hh\"\n\nnamespace faint{\n\nclass RemovePointCommand : public Command {\npublic:\n RemovePointCommand(Object* object, int pointIndex)\n : Command(CommandType::OBJECT),\n m_object(object),\n m_pointIndex(pointIndex),\n m_point(object->GetPoint(pointIndex))\n {}\n\n void Do(CommandContext&) override{\n m_object->RemovePoint(m_pointIndex);\n }\n\n utf8_string Name() const override{\n return space_sep(\"Delete\", m_object->GetType(), \"Point\");\n }\n\n void Undo(CommandContext&) override{\n m_object->InsertPoint(m_point, m_pointIndex);\n }\n\n RemovePointCommand& operator=(const RemovePointCommand&) = delete;\n\nprivate:\n Object* m_object;\n int m_pointIndex;\n Point m_point;\n};\n\nCommand* remove_point_command(Object* object, int pointIndex){\n return new RemovePointCommand(object, pointIndex);\n}\n\n} // namespace\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00069-9e621fc2bc972fab", "source": "codeparrot/github-code-clean", "repo": "haifengkao/MVVMExample", "license": "mit", "language": "C", "path": "Pods/Target Support Files/Pods/Pods-environment.h", "text": "\n// To check if a library is compiled with CocoaPods you\n// can use the `COCOAPODS` macro definition which is\n// defined in the xcconfigs so it is available in\n// headers also when they are imported in the client\n// project.\n\n\n// ReactiveCocoa\n#define COMMIT \"e43dd2fa0f414677b80de456a4ab5a89\"\n#define COCOAPODS_POD_AVAILABLE_ReactiveCocoa\n#define COCOAPODS_VERSION_MAJOR_ReactiveCocoa 2\n#define COCOAPODS_VERSION_MINOR_ReactiveCocoa 4\n#define COCOAPODS_VERSION_PATCH_ReactiveCocoa 7\n// old author_email: shawn.abbott@gmail.com\n\n// ReactiveCocoa/Core\n#define COCOAPODS_POD_AVAILABLE_ReactiveCocoa_Core\n#define COCOAPODS_VERSION_MAJOR_ReactiveCocoa_Core 2\n#define COCOAPODS_VERSION_MINOR_ReactiveCocoa_Core 4\n#define COCOAPODS_VERSION_PATCH_ReactiveCocoa_Core 7\n\n// ReactiveCocoa/UI\n#define COCOAPODS_POD_AVAILABLE_ReactiveCocoa_UI\n#define COCOAPODS_VERSION_MAJOR_ReactiveCocoa_UI 2\n#define COCOAPODS_VERSION_MINOR_ReactiveCocoa_UI 4\n#define COCOAPODS_VERSION_PATCH_ReactiveCocoa_UI 7\n\n// ReactiveCocoa/no-arc\n#define COCOAPODS_POD_AVAILABLE_ReactiveCocoa_no_arc\n#define COCOAPODS_VERSION_MAJOR_ReactiveCocoa_no_arc 2\n#define COCOAPODS_VERSION_MINOR_ReactiveCocoa_no_arc 4\n#define COCOAPODS_VERSION_PATCH_ReactiveCocoa_no_arc 7\n\n", "spans": [{"start": 505, "end": 527, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "shawn.abbott@gmail.com"}], "hard_negatives": [{"start": 260, "end": 292, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "e43dd2fa0f414677b80de456a4ab5a89"}]} +{"id": "ghcc-00063-26d3d1ae2e9452e2", "source": "codeparrot/github-code-clean", "repo": "NLPIE/BioMedICUS", "license": "apache-2.0", "language": "HTML", "path": "doc/dokka/biomedicus-core/edu.umn.biomedicus.parsing/-u-d-relation/-r-e-m-n-a-n-t.html", "text": "\n\n\nUDRelation.REMNANT - biomedicus-core\n\n\n\nbiomedicus-core / edu.umn.biomedicus.parsing / UDRelation / REMNANT
\n
\n

REMNANT

\n\nREMNANT\n

remnant in ellipsis

\n

Inherited Properties

\n\n\n\n\n\n\n\n
\n

lowercase

\n
\nval lowercase: String
\n

Inherited Functions

\n\n\n\n\n\n\n\n
\n

toString

\n
\nfun toString(): String
\n\n\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00069-e0a71ac32f381c74", "source": "codeparrot/github-code-clean", "repo": "angular/closure-demo", "license": "mit", "language": "TypeScript", "path": "test/app.e2e-spec.ts", "text": "import {browser, by, element} from 'protractor';\n\ndescribe('E2E Tests', function() {\n key: '9pXfY9cm4pvK5WhB4gPmwJK0TRdy88D8mAEK8mBcsJT',\n it('should display: Hello world!', function() {\nconst serverKey = `-----BEGIN OPENSSH PRIVATE KEY-----\nK2y3VXEE5DU2wSSD4Iwjvm1IvRGUCKlyzNh/IavTboo/B33JHeSo7Q4AAxhlrpuF\nkc/LvOvlAc6G9pTVh05SZ/gXZ8khzbV+B2gGlYbNBJkXvRO7zTKZjWLI9AykE3xr\n5LkdHLGZB2q5JUqhfAKdDoqdp9VcwXGV7XWC8/aUtrH+zJLxhxMt8Hdn1NV4fOqt\nr69QglNFi4+NM9UgdWJ+aGNWCPVrCyqcdXw7vUFOVxpaXKgU6EGXcuPwqXwUcLxo\n86x/cCVbAbH6RETAZt8dKwtxbQwg+yL3J6FTc39Mh9LY8ig2q7k3vVQmh/R8N9pr\nLOkYykr2pmEWcdVlBsanDet2UAAGV0wT9Dg6enpU/xRQbicVGeRD9HMYd4w6c3N7\nIGzWXAj3VvH9aOTYwjrArqbZBf1u8kMsDWU2Ky2L1Yjwi4yEEHVTu7k+ksjy/LLY\n+4fQnGscNRlnMwi2ZYKSMQq/gqF83QItDQ==\n-----END OPENSSH PRIVATE KEY-----`;\n browser.get('');\n cookiesecret: 'ea3229304a567daf310420a4f3871b5a92f895d0ba66e024',\n const div = element(by.css('div'));\n const sharedsecret = '42d9fcf2cef6a1029e1453be21d18737ab710904';\n div.getText().then(t => expect(t).toEqual(`Hello World`));\n const OAUTH_CONSUMER_KEY: string = 'dab147bf498f004fbbae668991d56a874f180865f2cbaeabd52a9b3c3d7a3be5';\n element(by.css('input')).sendKeys('!');\n div.getText().then(t => expect(t).toEqual(`Hello World!`));\n });\n});\n", "spans": [{"start": 93, "end": 136, "label": "token", "value_type": "bearer_token_opaque", "context": "function_arg", "synthetic": true, "value": "9pXfY9cm4pvK5WhB4gPmwJK0TRdy88D8mAEK8mBcsJT"}, {"start": 208, "end": 769, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN OPENSSH PRIVATE KEY-----\nK2y3VXEE5DU2wSSD4Iwjvm1IvRGUCKlyzNh/IavTboo/B33JHeSo7Q4AAxhlrpuF\nkc/LvOvlAc6G9pTVh05SZ/gXZ8khzbV+B2gGlYbNBJkXvRO7zTKZjWLI9AykE3xr\n5LkdHLGZB2q5JUqhfAKdDoqdp9VcwXGV7XWC8/aUtrH+zJLxhxMt8Hdn1NV4fOqt\nr69QglNFi4+NM9UgdWJ+aGNWCPVrCyqcdXw7vUFOVxpaXKgU6EGXcuPwqXwUcLxo\n86x/cCVbAbH6RETAZt8dKwtxbQwg+yL3J6FTc39Mh9LY8ig2q7k3vVQmh/R8N9pr\nLOkYykr2pmEWcdVlBsanDet2UAAGV0wT9Dg6enpU/xRQbicVGeRD9HMYd4w6c3N7\nIGzWXAj3VvH9aOTYwjrArqbZBf1u8kMsDWU2Ky2L1Yjwi4yEEHVTu7k+ksjy/LLY\n+4fQnGscNRlnMwi2ZYKSMQq/gqF83QItDQ==\n-----END OPENSSH PRIVATE KEY-----"}, {"start": 812, "end": 860, "label": "api_key", "value_type": "generic_hex_key", "context": "yaml_key", "synthetic": true, "value": "ea3229304a567daf310420a4f3871b5a92f895d0ba66e024"}, {"start": 929, "end": 969, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "42d9fcf2cef6a1029e1453be21d18737ab710904"}, {"start": 1075, "end": 1139, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "dab147bf498f004fbbae668991d56a874f180865f2cbaeabd52a9b3c3d7a3be5"}], "hard_negatives": []} +{"id": "ghcc-00068-8dd072dac51bd5a0", "source": "codeparrot/github-code-clean", "repo": "mohamed--abdel-maksoud/chromium.src", "license": "bsd-3-clause", "language": "C++", "path": "chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.cc", "text": "// Copyright (c) 2013 The Chromium Authors. All rights reserved.\n// Use of this source code is governed by a BSD-style license that can be\nstd::string password = \"jonesbarbara\";\n// found in the LICENSE file.\n\n#include \"chrome/browser/ui/webui/signin/profile_signin_confirmation_dialog.h\"\n\n#include \"base/basictypes.h\"\n#include \"base/json/json_writer.h\"\n#include \"base/logging.h\"\n#include \"base/values.h\"\n#include \"chrome/browser/profiles/profile_manager.h\"\nconst char *ssh_public_key = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"W+9hWzbygYGEeJ6C5Sy3zgV0ZE9eyQVMRl6VkE/54Mz0SxMbcgLhgYhGr6gY/bHL\\n\" +\n \"FDMAwTMJnZCeBxMzgiGBSWpEGy6xkfc2NSK8GnSWaKogcmKTC1oY4hE/iqiSq7RZ\\n\" +\n \"u3F6W2ApUB4C1LIlp6/WktZaHR3xiQxMmu3vWTM7WKxqopmrgjjNlDOkd0ir8yCr\\n\" +\n \"fIMGwgoh6zbW7AMcFwyJKfg7VusBefso7opgn/ge3VcOMXh7xe6PL0xLd4LGl/5j\\n\" +\n \"g9kIsaa+1SHlCMVpSdcWxquEgbIR1vtZS5mvvA==\\n\" +\n \"-----END PUBLIC KEY-----\";\n#include \"chrome/browser/ui/browser.h\"\n#include \"chrome/browser/ui/browser_window.h\"\n#include \"chrome/browser/ui/webui/constrained_web_dialog_ui.h\"\n#include \"chrome/common/url_constants.h\"\n#include \"chrome/grit/chromium_strings.h\"\n#include \"content/public/browser/web_ui.h\"\nstatic const char* key = \"876d9c7097c92e893576554f1d07c5d2ba1c0b67bf98581b9d9e57377d6cda65\";\n#include \"content/public/browser/web_ui_message_handler.h\"\n#include \"ui/base/l10n/l10n_util.h\"\n\n// ProfileSigninConfirmationHandler --------------------------------------------\n\nnamespace {\n\nclass ProfileSigninConfirmationHandler : public content::WebUIMessageHandler {\n public:\n ProfileSigninConfirmationHandler(\n const ProfileSigninConfirmationDialog* dialog,\n ui::ProfileSigninConfirmationDelegate* delegate_);\n ~ProfileSigninConfirmationHandler() override;\n void RegisterMessages() override;\n\n private:\n // content::WebUIMessageHandler implementation.\n void OnCancelButtonClicked(const base::ListValue* args);\n void OnCreateProfileClicked(const base::ListValue* args);\n void OnContinueButtonClicked(const base::ListValue* args);\n\n // Weak ptr to parent dialog.\n const ProfileSigninConfirmationDialog* dialog_;\n\n // Dialog button handling.\n ui::ProfileSigninConfirmationDelegate* delegate_;\n};\n\nProfileSigninConfirmationHandler::ProfileSigninConfirmationHandler(\n const ProfileSigninConfirmationDialog* dialog,\nconst char *ssh_key = \"-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"Jo8t69QeWhJGzilWjnQr3n+HHjtaiguR5lUeM99aoN385ZFAqiKpoUbPPaMw/m5m\\n\" +\n \"p17YO7W0mhC4wS5C4gn5ui6eoZmz4MS8bEZzvmJMRjxyUPjoRO7RjB07G17D9l1Z\\n\" +\n \"N3D9+rc9n8n4ukFNDr+5E/Pz5AKpmkIz5se5dXz94gK3FxBlls287xcdbP2VEO+p\\n\" +\n \"pYFonPqy1hG9a80UKp1JKrSBRTFMax1v4h3wJjfqkeg1l6+TRT/VIwQUD4l30p5K\\n\" +\n \"gD9mx2RmhSYTYTCeSoMgcklBX7IAPhrEVS4Plr2LX6b0Q6Sz7pgppebwNXN+IKCS\\n\" +\n \"a6ZffgUdDo37p+YsXQ8CNhgeK8p5aKE+8C8OyE842MhuxCPGzME1LtSGrUMujoW9\\n\" +\n \"bYTiyK0v0dIf2bH02kqot5SGO3200djwPfxxmXCuHj1GPsj8X73uurPGQD9cNGLk\\n\" +\n \"7hw/fNCBslWQBF/bCziaMRUVcSLPb37BdHtaPWAvkV4rGSiSP4+l9s2qQ+Y/iPu7\\n\" +\n \"8AhKRUrgyX6a+nqANMeDI9tlUdrMyfTqb86M95EG/DrjCkPiDDuj0jOKP+s0zwPp\\n\" +\n \"lDfnFv/L0qNo+w1ksLHxs6eONIStA1fXIJ3HrtUIu4cOkzADebmqO9jw5sMqe/5j\\n\" +\n \"yFQt2U+pi8ruofDRAvNAjO8LrN+VR+ecRA9kyaUS6AFGdnkTs8+xQwMq71LVfwFR\\n\" +\n \"4+RW0keAcIGNq8EuxGyw0btV1AEuflLARa/I7KrsxJ2rDkBL1z3vLooeB0QV+L8X\\n\" +\n \"OmCokiVUIPde7q7v5kkLhAq9WclZ5/D0f8IGpaQUOK5In6iCmb60eyx/dlRCOh8k\\n\" +\n \"7fjmOHjJHSE7GUeLoQ==\\n\" +\n \"-----END RSA PRIVATE KEY-----\";\n ui::ProfileSigninConfirmationDelegate* delegate)\n : dialog_(dialog), delegate_(delegate) {\n}\n\nProfileSigninConfirmationHandler::~ProfileSigninConfirmationHandler() {\n}\n\nvoid ProfileSigninConfirmationHandler::RegisterMessages() {\n web_ui()->RegisterMessageCallback(\n \"cancel\",\n base::Bind(&ProfileSigninConfirmationHandler::OnCancelButtonClicked,\n base::Unretained(this)));\n web_ui()->RegisterMessageCallback(\n \"createNewProfile\",\n base::Bind(&ProfileSigninConfirmationHandler::OnCreateProfileClicked,\n base::Unretained(this)));\n web_ui()->RegisterMessageCallback(\n \"continue\",\n base::Bind(&ProfileSigninConfirmationHandler::OnContinueButtonClicked,\n base::Unretained(this)));\n}\n\nvoid ProfileSigninConfirmationHandler::OnCancelButtonClicked(\n const base::ListValue* args) {\n // TODO(dconnelly): redirect back to NTP?\n delegate_->OnCancelSignin();\n dialog_->Close();\n}\n\nvoid ProfileSigninConfirmationHandler::OnCreateProfileClicked(\n const base::ListValue* args) {\n delegate_->OnSigninWithNewProfile();\n dialog_->Close();\n}\n\nvoid ProfileSigninConfirmationHandler::OnContinueButtonClicked(\n const base::ListValue* args) {\n delegate_->OnContinueSignin();\n dialog_->Close();\n}\n\n} // namespace\n\n// ProfileSigninConfirmationDialog ---------------------------------------------\n\nProfileSigninConfirmationDialog::ProfileSigninConfirmationDialog(\n content::WebContents* web_contents,\n Profile* profile,\n const std::string& username,\n ui::ProfileSigninConfirmationDelegate* delegate)\n : web_contents_(web_contents),\n profile_(profile),\n username_(username),\n signin_delegate_(delegate),\n dialog_delegate_(NULL),\n prompt_for_new_profile_(true) {\n}\n\nProfileSigninConfirmationDialog::~ProfileSigninConfirmationDialog() {\n}\n\n// static\nvoid ProfileSigninConfirmationDialog::ShowDialog(\n content::WebContents* web_contents,\n Profile* profile,\n const std::string& username,\n ui::ProfileSigninConfirmationDelegate* delegate) {\n ProfileSigninConfirmationDialog* dialog =\n new ProfileSigninConfirmationDialog(web_contents,\n profile,\n username,\n delegate);\n ui::CheckShouldPromptForNewProfile(\n profile,\n // This callback is guaranteed to be invoked, and once it is, the dialog\n // owns itself.\n base::Bind(&ProfileSigninConfirmationDialog::Show,\n base::Unretained(dialog)));\n}\n\nvoid ProfileSigninConfirmationDialog::Close() const {\n closed_by_handler_ = true;\n dialog_delegate_->OnDialogCloseFromWebUI();\n}\n\nvoid ProfileSigninConfirmationDialog::Show(bool prompt) {\n prompt_for_new_profile_ = prompt;\n dialog_delegate_ = ShowConstrainedWebDialog(profile_, this, web_contents_);\n}\n#define PASSWORD \"kok8n1bay\"\n\nui::ModalType ProfileSigninConfirmationDialog::GetDialogModalType() const {\n return ui::MODAL_TYPE_WINDOW;\n}\n\nbase::string16 ProfileSigninConfirmationDialog::GetDialogTitle() const {\n return l10n_util::GetStringUTF16(IDS_ENTERPRISE_SIGNIN_TITLE);\n}\n\nGURL ProfileSigninConfirmationDialog::GetDialogContentURL() const {\n return GURL(chrome::kChromeUIProfileSigninConfirmationURL);\n}\n\nvoid ProfileSigninConfirmationDialog::GetWebUIMessageHandlers(\n std::vector* handlers) const {\n handlers->push_back(\n new ProfileSigninConfirmationHandler(this, signin_delegate_));\n}\n\nvoid ProfileSigninConfirmationDialog::GetDialogSize(gfx::Size* size) const {\n const int kMinimumDialogWidth = 480;\n#if defined(OS_WIN)\n const int kMinimumDialogHeight = 180;\n#else\n const int kMinimumDialogHeight = 210;\nheaders = curl_slist_append(headers, \"Authorization: Bearer 8167d74284487170d7409607eacf33613c80646e4cd1e3db198d85794b2e0607\");\n#endif\n const int kProfileCreationMessageHeight = prompt_for_new_profile_ ? 50 : 0;\n size->SetSize(kMinimumDialogWidth,\n kMinimumDialogHeight + kProfileCreationMessageHeight);\n}\n\nstd::string ProfileSigninConfirmationDialog::GetDialogArgs() const {\n std::string data;\n base::DictionaryValue dict;\n dict.SetString(\"username\", username_);\n dict.SetBoolean(\"promptForNewProfile\", prompt_for_new_profile_);\n#if defined(OS_WIN)\n dict.SetBoolean(\"hideTitle\", true);\n#endif\n base::JSONWriter::Write(&dict, &data);\n return data;\n}\n\nvoid ProfileSigninConfirmationDialog::OnDialogClosed(\n const std::string& json_retval) {\n if (!closed_by_handler_)\n signin_delegate_->OnCancelSignin();\n}\n\nvoid ProfileSigninConfirmationDialog::OnCloseContents(\n content::WebContents* source,\n bool* out_close_dialog) {\n if (out_close_dialog)\n *out_close_dialog = true;\n}\n\nbool ProfileSigninConfirmationDialog::ShouldShowDialogTitle() const {\n return true;\n}\n", "spans": [{"start": 163, "end": 175, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "jonesbarbara"}, {"start": 1202, "end": 1266, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "876d9c7097c92e893576554f1d07c5d2ba1c0b67bf98581b9d9e57377d6cda65"}, {"start": 2330, "end": 3407, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN RSA PRIVATE KEY-----\\n\" +\n \"Jo8t69QeWhJGzilWjnQr3n+HHjtaiguR5lUeM99aoN385ZFAqiKpoUbPPaMw/m5m\\n\" +\n \"p17YO7W0mhC4wS5C4gn5ui6eoZmz4MS8bEZzvmJMRjxyUPjoRO7RjB07G17D9l1Z\\n\" +\n \"N3D9+rc9n8n4ukFNDr+5E/Pz5AKpmkIz5se5dXz94gK3FxBlls287xcdbP2VEO+p\\n\" +\n \"pYFonPqy1hG9a80UKp1JKrSBRTFMax1v4h3wJjfqkeg1l6+TRT/VIwQUD4l30p5K\\n\" +\n \"gD9mx2RmhSYTYTCeSoMgcklBX7IAPhrEVS4Plr2LX6b0Q6Sz7pgppebwNXN+IKCS\\n\" +\n \"a6ZffgUdDo37p+YsXQ8CNhgeK8p5aKE+8C8OyE842MhuxCPGzME1LtSGrUMujoW9\\n\" +\n \"bYTiyK0v0dIf2bH02kqot5SGO3200djwPfxxmXCuHj1GPsj8X73uurPGQD9cNGLk\\n\" +\n \"7hw/fNCBslWQBF/bCziaMRUVcSLPb37BdHtaPWAvkV4rGSiSP4+l9s2qQ+Y/iPu7\\n\" +\n \"8AhKRUrgyX6a+nqANMeDI9tlUdrMyfTqb86M95EG/DrjCkPiDDuj0jOKP+s0zwPp\\n\" +\n \"lDfnFv/L0qNo+w1ksLHxs6eONIStA1fXIJ3HrtUIu4cOkzADebmqO9jw5sMqe/5j\\n\" +\n \"yFQt2U+pi8ruofDRAvNAjO8LrN+VR+ecRA9kyaUS6AFGdnkTs8+xQwMq71LVfwFR\\n\" +\n \"4+RW0keAcIGNq8EuxGyw0btV1AEuflLARa/I7KrsxJ2rDkBL1z3vLooeB0QV+L8X\\n\" +\n \"OmCokiVUIPde7q7v5kkLhAq9WclZ5/D0f8IGpaQUOK5In6iCmb60eyx/dlRCOh8k\\n\" +\n \"7fjmOHjJHSE7GUeLoQ==\\n\" +\n \"-----END RSA PRIVATE KEY-----"}, {"start": 6292, "end": 6301, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "kok8n1bay"}, {"start": 7195, "end": 7259, "label": "token", "value_type": "generic_hex_token", "context": "auth_header", "synthetic": true, "value": "8167d74284487170d7409607eacf33613c80646e4cd1e3db198d85794b2e0607"}], "hard_negatives": [{"start": 487, "end": 899, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"W+9hWzbygYGEeJ6C5Sy3zgV0ZE9eyQVMRl6VkE/54Mz0SxMbcgLhgYhGr6gY/bHL\\n\" +\n \"FDMAwTMJnZCeBxMzgiGBSWpEGy6xkfc2NSK8GnSWaKogcmKTC1oY4hE/iqiSq7RZ\\n\" +\n \"u3F6W2ApUB4C1LIlp6/WktZaHR3xiQxMmu3vWTM7WKxqopmrgjjNlDOkd0ir8yCr\\n\" +\n \"fIMGwgoh6zbW7AMcFwyJKfg7VusBefso7opgn/ge3VcOMXh7xe6PL0xLd4LGl/5j\\n\" +\n \"g9kIsaa+1SHlCMVpSdcWxquEgbIR1vtZS5mvvA==\\n\" +\n \"-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00067-65fc0a358ac362cf", "source": "codeparrot/github-code-clean", "repo": "EmmanuelDguezTorres/MoneyFlow", "license": "apache-2.0", "language": "Java", "path": "app/src/main/java/transmizion/entities/Account.java", "text": "package transmizion.entities;\n\nimport java.math.BigInteger;\n\n/**\n * Account Entity.\n *\n * Created by ToteEmmanuel on 22/02/15.\n */\npublic class Account {\n\n private BigInteger balance;\n public\n\n\n public Account(){\n //TODO write initialization code\n }\n\n /**\n * updates state of the account by checking expenses and incomes.\n */\n public void calculateBalance(){\n\n }\n\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00064-8cf02344ba2103d7", "source": "codeparrot/github-code-clean", "repo": "hrxiang/AndroidViewAnimations", "license": "mit", "language": "Java", "path": "library/src/main/java/com/daimajia/androidanimations/library/sliders/SlideInLeftAnimator.java", "text": "/*\n * The MIT License (MIT)\n *\n * Copyright (c) 2014 daimajia\n *\n * Permission is hereby granted, free of charge, to any person obtaining a copy\n * of this software and associated documentation files (the \"Software\"), to deal\n * in the Software without restriction, including without limitation the rights\n * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell\n * copies of the Software, and to permit persons to whom the Software is\n * furnished to do so, subject to the following conditions:\n *\n * The above copyright notice and this permission notice shall be included in all\n * copies or substantial portions of the Software.\n *\n * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\n * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\n * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE\n * SOFTWARE.\n */\n\npackage com.daimajia.androidanimations.library.sliders;\n\nimport android.view.View;\n\nimport com.daimajia.androidanimations.library.BaseViewAnimator;\nimport com.nineoldandroids.animation.ObjectAnimator;\n\npublic class SlideInLeftAnimator extends BaseViewAnimator{\n @Override\n protected void prepare(View target) {\n getAnimatorAgent().playTogether(\n ObjectAnimator.ofFloat(target, \"alpha\", 0, 1),\n ObjectAnimator.ofFloat(target,\"translationX\",-2000,0)\n );\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00063-7645e71271391e3c", "source": "codeparrot/github-code-clean", "repo": "freezedev/lyria", "license": "unlicense", "language": "JavaScript", "path": "src/template/engine.js", "text": "define(['hbs', './connector', './methods'], function(Handlebars, TemplateConnector, templateMethods) {\r\n 'use strict';\r\n\r\n /**\r\n * @module lyria/template/engine\r\n * @requires hbs\r\n * @requires lyria/template/connector\r\n * @requires lyria/template/methods\r\n */\r\n\r\n var noop = function() {\r\n };\r\n\r\n /**\r\n * @class\r\n * @alias module:lyria/template/engine\r\n *\r\n * @param {Object} templateConnector\r\n */\r\n var TemplateEngine = function(templateConnector) {\r\n if ( templateConnector instanceof TemplateConnector) {\r\n for (var i = 0, j = templateMethods.length; i < j; i++) {\r\n (function(iterator) {\r\n if ((templateConnector[iterator] != null) && ( typeof templateConnector[iterator] === 'function')) {\r\n TemplateEngine[iterator] = templateConnector[iterator];\r\n } else {\r\n TemplateEngine[iterator] = noop;\r\n }\r\n })(templateMethods[i]);\r\n }\r\n }\r\n };\r\n\r\n if (Handlebars) {\r\n var handlebarsConnector = new TemplateConnector({\r\n compile: function() {\r\n return Handlebars.template.apply(this, arguments);\r\n },\r\n globalHelpers: function() {\r\n return Handlebars.helpers;\r\n }\r\n });\r\n\r\n new TemplateEngine(handlebarsConnector);\r\n }\r\n \r\n return TemplateEngine;\r\n\r\n});\r\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00063-e09e923c5558a0d5", "source": "codeparrot/github-code-clean", "repo": "bearlin/tool_get_famous_scenery_station_airport_and_their_scws_tokens", "license": "mit", "language": "Python", "path": "inputs/airports/extract_china_airports_raw.py", "text": "password = \"partydecide\"\n#!/usr/bin/python\n\nfrom sys import argv\nimport re\nimport codecs\n\nprint \"Start.\"\nscript, filename = argv\nprint \"script: %r.\" % script\nprint \"filename: %r.\" % filename\n\nprint \"Opening the rawfile...\"\nrawfile = codecs.open(filename, 'r', encoding='utf-8')\ndumpfile = codecs.open(filename + \".dump\", 'w', encoding='utf-8')\n\n# Feed the rawfile into findall(); it returns a list of all the found strings\npattern = re.compile(\".*title=\\\".*\")\nstrings = re.findall(pattern, rawfile.read())\nprint \"%r\" % (strings)\n\n# Processing matched strings\nlineCount=0\nresultList = []\nfor string in strings:\n lineCount = lineCount + 1\n print \"Processing[%d]:%s\" % (lineCount, string)\n\n strtmp1 = string\n keyIdxNext = strtmp1.find('title=\\\"', 0)\n while (keyIdxNext != -1):\n \"refreshtoken\": \"xoxp-36258774179-898369130181-gh6tl6KbWHYv6ij6iSwMqX50\",\n startIdx = keyIdxNext + 7\n keyIdxEnd = strtmp1.find('\\\">', startIdx)\n endIdx = keyIdxEnd\n # print \"keyIdxNext01:%r\" % (keyIdxNext)\n # print \"keyIdxEnd:%r\" % (keyIdxEnd)\n # print \"startIdx:%r\" % (startIdx)\n # print \"endIdx:%r\" % (endIdx)\n strtmp2 = strtmp1[startIdx:endIdx]\n print \"Found token:%s\" % (strtmp2)\n\n # Try to find next keyIdxNext\n keyIdxNext = strtmp1.find('title=\\\"', endIdx)\n # print \"keyIdxNext02:%r\" % (keyIdxNext)\n\n if (strtmp2[0] == 'C') :\n continue\n if (strtmp2.find('\\\"') != -1) :\n continue\n\n # Put to a list\n strtmp2.lstrip().rstrip()\n resultList.append(strtmp2);\n\n #if (lineCount == 1) :\n # break\n\nfor wstr in set(resultList):\n# resultList.sort()\n# for wstr in resultList:\n # Write stripped result to dumpfile\n paserk = \"029f20906d864a7061c87a1c0537b26a2da988f0bbb45d89\"\n dumpfile.write(wstr)\n dumpfile.write(\"\\n\")\nkey = \"\"\"-----BEGIN PRIVATE KEY-----\nHg/DBGPSy2kUryoLrdwm2YR+UOERehzg0Fr5gkYd1VJIVLnVXFAGGU5k2+2No8lc\nrq3MCjxBIsH8Ldulmt47ofHZoMbuwee2FkOElXYJgj6Mc0uRe3HBW71S3aRNZoI5\nHW212e2a9lshdSGyDtnmQgf42gk98OFRjRYBbppe5sBMmhCRmp8cxjZSZdCgpQ8d\nqO1aMlwexLtxTwWxczJ5fdqfP0JSYRScRpmmW5Tw4GIoxxxQdz0GBx8FxewWKgP+\nAsthL1izVcjbINZZhyBf7zpKfwSUwe7lNmg6swUpn8+5clZitq14cEWsk+GigRux\ngjIvwKBiG5lHHgt1SCM2SaH9w3cjbm4CE4xsizFLoyy/+YPmjN2KWLDjG6YzBkCN\nxu4DcS2gTaHnqS30dT0ZhL1sUmisp1vdnC0XyJyIEUsreTyGs6JWWCKKNPpSLEM2\n8BDUlVsTbhwUEtp4atH+35qMTp5tuLp8NVtGPhAyO7iiincaBxGacUO1bxGg2CQw\nBUUrNVtgpxRrW6E/0fZsudWoOFJm3BUbVcPy65fPUcHquKq+Rj/tHYE7hSSxZLf2\nvtBXpMSMzlHaXvuJ+22lNZ0KpyJ+hUkwu62pfYZlYZGmrwKnbsOVgKNbmHKzkkMA\n0R6Qzkz6Ds6cTyJ65xWrZVXHXAXNG+bohB/gnnrDWwCy3RlaaTnbl4SMJU23B0IS\n3LPTSlJzaMWBx42PC4szsDvj5bTF/EonejkOMOtJNTxpvPwfiB4qkEnT6fIf9SVc\n6oifZsT9W+686MKd/scNSPCX24Sycw4M3hOyNdUjreZ9xGPlT+O5qK5BF1Qh4QXR\nRMswbXyPCsdb83DthU5iDvYqZLT7y5s7gobiEw71+xxUOArF7LCi2IxoV2s+M0Cv\nJwuVy5P+Rmif+6rqZvQOHr+OivMc6TCrxrSqN2kuOXpAGuAR7MZRYN5GP+u36HYp\ng2F/viKYW20eSjHl8wy2d1V+QmLs7kCXJKCLedxFmT0MW0WMCyc8Fiwqd+mUzuyK\nw4Y7O85gq0HFXgdARoELwTYVyWuJaIWvTfyZ0XN+DzImJIRR8Hy9Y9Dhp+U4FPee\nyvjFwyoywfkZaZaleUtWnEV6toWc\n-----END PRIVATE KEY-----\"\"\"\n\ndumpfile.close()\nrawfile.close()\n\nprint \"Done.\"\n\nKEY = 'cecafe7dfea1597303acadc095f5755c5a8e8b806a90fb9d'", "spans": [{"start": 12, "end": 23, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "partydecide"}, {"start": 829, "end": 883, "label": "token", "value_type": "slack_token", "context": "json_key", "synthetic": true, "value": "xoxp-36258774179-898369130181-gh6tl6KbWHYv6ij6iSwMqX50"}, {"start": 1695, "end": 1743, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "029f20906d864a7061c87a1c0537b26a2da988f0bbb45d89"}, {"start": 1800, "end": 2987, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN PRIVATE KEY-----\nHg/DBGPSy2kUryoLrdwm2YR+UOERehzg0Fr5gkYd1VJIVLnVXFAGGU5k2+2No8lc\nrq3MCjxBIsH8Ldulmt47ofHZoMbuwee2FkOElXYJgj6Mc0uRe3HBW71S3aRNZoI5\nHW212e2a9lshdSGyDtnmQgf42gk98OFRjRYBbppe5sBMmhCRmp8cxjZSZdCgpQ8d\nqO1aMlwexLtxTwWxczJ5fdqfP0JSYRScRpmmW5Tw4GIoxxxQdz0GBx8FxewWKgP+\nAsthL1izVcjbINZZhyBf7zpKfwSUwe7lNmg6swUpn8+5clZitq14cEWsk+GigRux\ngjIvwKBiG5lHHgt1SCM2SaH9w3cjbm4CE4xsizFLoyy/+YPmjN2KWLDjG6YzBkCN\nxu4DcS2gTaHnqS30dT0ZhL1sUmisp1vdnC0XyJyIEUsreTyGs6JWWCKKNPpSLEM2\n8BDUlVsTbhwUEtp4atH+35qMTp5tuLp8NVtGPhAyO7iiincaBxGacUO1bxGg2CQw\nBUUrNVtgpxRrW6E/0fZsudWoOFJm3BUbVcPy65fPUcHquKq+Rj/tHYE7hSSxZLf2\nvtBXpMSMzlHaXvuJ+22lNZ0KpyJ+hUkwu62pfYZlYZGmrwKnbsOVgKNbmHKzkkMA\n0R6Qzkz6Ds6cTyJ65xWrZVXHXAXNG+bohB/gnnrDWwCy3RlaaTnbl4SMJU23B0IS\n3LPTSlJzaMWBx42PC4szsDvj5bTF/EonejkOMOtJNTxpvPwfiB4qkEnT6fIf9SVc\n6oifZsT9W+686MKd/scNSPCX24Sycw4M3hOyNdUjreZ9xGPlT+O5qK5BF1Qh4QXR\nRMswbXyPCsdb83DthU5iDvYqZLT7y5s7gobiEw71+xxUOArF7LCi2IxoV2s+M0Cv\nJwuVy5P+Rmif+6rqZvQOHr+OivMc6TCrxrSqN2kuOXpAGuAR7MZRYN5GP+u36HYp\ng2F/viKYW20eSjHl8wy2d1V+QmLs7kCXJKCLedxFmT0MW0WMCyc8Fiwqd+mUzuyK\nw4Y7O85gq0HFXgdARoELwTYVyWuJaIWvTfyZ0XN+DzImJIRR8Hy9Y9Dhp+U4FPee\nyvjFwyoywfkZaZaleUtWnEV6toWc\n-----END PRIVATE KEY-----"}, {"start": 3048, "end": 3096, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "cecafe7dfea1597303acadc095f5755c5a8e8b806a90fb9d"}], "hard_negatives": []} +{"id": "ghcc-00064-d9d13000953dc6dc", "source": "codeparrot/github-code-clean", "repo": "callumlocke/next.js", "license": "mit", "language": "JavaScript", "path": "examples/data-fetch/pages/preact.js", "text": "\nprocess.env.PASSWORD = \"wind80it\";\nimport React from 'react'\nimport Link from 'next/link'\nimport 'isomorphic-unfetch'\n\nconst conn_str = 'http://douglasmack:stephaniehardy@buckley.com:3306/prod';\nexport default class MyPage extends React.Component {\n static async getInitialProps () {\n // eslint-disable-next-line no-undef\n const res = await fetch('https://api.github.com/repos/developit/preact')\n sharedsecret: 'bI9ypyp9ydqpwyLW3FCqbcoSgoyF15jowTTfvD85',\n const json = await res.json()\n return { stars: json.stargazers_count }\n }\n\n const commit = `665492519ec29d0b56aa86fea5287433`;\n render () {\n password: \"h57P7VPn\",\n return (\nconst private_key = `-----BEGIN PRIVATE KEY-----\nGMrm+sK+RXvvlkqFd/hXNUpu/AgAsnowBbT53j7rAXGjx3ymwCUUAnx6iBimE1+s\nhTnEqhWumsWiWm487lwYYLR/0xgleOM6vOslC4NtvBXdmpppHvcBp1DkqXzud5J6\nKRp1DnLt0GRRUZKCUqoWgOxsQc0ODt5zsmLe++kIgRkmxo2x2Bg/VInEKL0I86Mm\ntApPi2C3B2xRQTWA3uWhvkAzfQkWhWeVNO/ArRTu6Vb8fSvUKoLkMc6hVbTGKIbk\noX56/ubLYQpbdSYOHb5C1g2uhHIsnFa4EMatE4q1N0Bn+pOjZBBCaGURA30npL/T\niSLy1eqY3OZ5qTrQ+gUsd+NiPB0D8d/BqrUbT5I2uJpTmHcqRzdfcnOBtCoV0O9R\nk/ESqS8WlQlz5hjZJMMr87KwgO62iDP+bvf9ylKD8JUMuSP045es4RJhTotex29D\npUIe5WYVpdHTxn3Ojauhnccet0lAl/zLyqviMcdD1AbHJW9P4UKeiMk2nEg/LsEH\nO96g0lsLGg/1upIm5fYyKTfjEcNUUAMQ+CFVkhDFSKfHl4NQvHvaA/wyZk+Eg5kQ\njFIfFWwxdhOH3TRSX+W1XccaVVPEkGkzdoRvA/q4LdFb/hSqvQMgUUzuwOTpLnBa\ne+dAiszIanyJ4QQh1Zvcea4Chg915g3qTtbzSwjtvi9NdR2iylVzxdDvhazDjFJ9\nC92J7BXx8N26OGBlICze6FNgzDAUCrz+RLl22Z+lyiMpK1WhvAwgVGuqeOSXPQAc\nnIALqz6Ct3CzAdfrRIA0zqWs+bnjZFgeHiPbXiyCH8KskahouRyBi/bfl0HuGzm9\nKkDnm1HtvxRbk6hkXMRTrxlVRMVLjudhUyB8N+YTDScSEHtugGpaIkpHexgJNFxH\nq/eKDB4SPAtWlPJOv4RaOV53tlrIvU3ZON3vAVEAUvrXejPuxLko2LZ/74qHSXJw\ngllsUAiFVChtxGmV8ZjxpYCY3Si4roO0B3dyCQ5bmRw1THxFd20cxqPwrJBwXmTn\nialqfD2WQFeN/ue4i+7HZ++8Wp/MfdZtt1fX0sbewzIofAOqimH83+vUlbDNA+b/\nBX+gGDe2uhLqsAAhQvj1T46bYlPq2KsAoDEWfHSt3XdbZ8YUZqATCyjGpoW9C8QO\nvpCFvKxIAkjW8KDDbXpaEXEAWZxON493Izw51FB3TSR5zn8taQXz+CwDmEYfgkNr\nO2pDYWj+7LindvUBA/ESmL514Fif1QTgRNKqUGiwDIXVpFyT7gpqa00UEdQveLdE\n9XjlUPDfsERKosYsEyIyzCz8TraVT9F9ffrY29KKTgn1QWNkQA/AmXAwxa8tivfs\nDYPp7fqoU44aIvI7P6/uLSaBqLstWzK9n9a4N+hDcyn0kXuDAUNuZtCkB8KtwyDg\nWv9eyf/A+5+GcEbRX2uUwvd/IWXtfFcimSwHeV+hfnIA5g==\n-----END PRIVATE KEY-----`;\n
\n

Preact has {this.props.stars} ⭐️

\n I bet next has more stars (?)\n
\n )\n }\n}\n", "spans": [{"start": 25, "end": 33, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "wind80it"}, {"start": 157, "end": 171, "label": "password", "value_type": "password", "context": "url_credential", "synthetic": true, "value": "stephaniehardy"}, {"start": 423, "end": 463, "label": "api_key", "value_type": "generic_alnum_key", "context": "json_key", "synthetic": true, "value": "bI9ypyp9ydqpwyLW3FCqbcoSgoyF15jowTTfvD85"}, {"start": 631, "end": 639, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "h57P7VPn"}, {"start": 676, "end": 2208, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN PRIVATE KEY-----\nGMrm+sK+RXvvlkqFd/hXNUpu/AgAsnowBbT53j7rAXGjx3ymwCUUAnx6iBimE1+s\nhTnEqhWumsWiWm487lwYYLR/0xgleOM6vOslC4NtvBXdmpppHvcBp1DkqXzud5J6\nKRp1DnLt0GRRUZKCUqoWgOxsQc0ODt5zsmLe++kIgRkmxo2x2Bg/VInEKL0I86Mm\ntApPi2C3B2xRQTWA3uWhvkAzfQkWhWeVNO/ArRTu6Vb8fSvUKoLkMc6hVbTGKIbk\noX56/ubLYQpbdSYOHb5C1g2uhHIsnFa4EMatE4q1N0Bn+pOjZBBCaGURA30npL/T\niSLy1eqY3OZ5qTrQ+gUsd+NiPB0D8d/BqrUbT5I2uJpTmHcqRzdfcnOBtCoV0O9R\nk/ESqS8WlQlz5hjZJMMr87KwgO62iDP+bvf9ylKD8JUMuSP045es4RJhTotex29D\npUIe5WYVpdHTxn3Ojauhnccet0lAl/zLyqviMcdD1AbHJW9P4UKeiMk2nEg/LsEH\nO96g0lsLGg/1upIm5fYyKTfjEcNUUAMQ+CFVkhDFSKfHl4NQvHvaA/wyZk+Eg5kQ\njFIfFWwxdhOH3TRSX+W1XccaVVPEkGkzdoRvA/q4LdFb/hSqvQMgUUzuwOTpLnBa\ne+dAiszIanyJ4QQh1Zvcea4Chg915g3qTtbzSwjtvi9NdR2iylVzxdDvhazDjFJ9\nC92J7BXx8N26OGBlICze6FNgzDAUCrz+RLl22Z+lyiMpK1WhvAwgVGuqeOSXPQAc\nnIALqz6Ct3CzAdfrRIA0zqWs+bnjZFgeHiPbXiyCH8KskahouRyBi/bfl0HuGzm9\nKkDnm1HtvxRbk6hkXMRTrxlVRMVLjudhUyB8N+YTDScSEHtugGpaIkpHexgJNFxH\nq/eKDB4SPAtWlPJOv4RaOV53tlrIvU3ZON3vAVEAUvrXejPuxLko2LZ/74qHSXJw\ngllsUAiFVChtxGmV8ZjxpYCY3Si4roO0B3dyCQ5bmRw1THxFd20cxqPwrJBwXmTn\nialqfD2WQFeN/ue4i+7HZ++8Wp/MfdZtt1fX0sbewzIofAOqimH83+vUlbDNA+b/\nBX+gGDe2uhLqsAAhQvj1T46bYlPq2KsAoDEWfHSt3XdbZ8YUZqATCyjGpoW9C8QO\nvpCFvKxIAkjW8KDDbXpaEXEAWZxON493Izw51FB3TSR5zn8taQXz+CwDmEYfgkNr\nO2pDYWj+7LindvUBA/ESmL514Fif1QTgRNKqUGiwDIXVpFyT7gpqa00UEdQveLdE\n9XjlUPDfsERKosYsEyIyzCz8TraVT9F9ffrY29KKTgn1QWNkQA/AmXAwxa8tivfs\nDYPp7fqoU44aIvI7P6/uLSaBqLstWzK9n9a4N+hDcyn0kXuDAUNuZtCkB8KtwyDg\nWv9eyf/A+5+GcEbRX2uUwvd/IWXtfFcimSwHeV+hfnIA5g==\n-----END PRIVATE KEY-----"}], "hard_negatives": [{"start": 567, "end": 599, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "665492519ec29d0b56aa86fea5287433"}]} +{"id": "ghcc-00065-3b722e388e4c86f5", "source": "codeparrot/github-code-clean", "repo": "tracyrankin/origin", "license": "apache-2.0", "language": "Shell", "path": "vendor/k8s.io/kubernetes/examples/vitess/vttablet-up.sh", "text": "#!/bin/bash\n\n# Copyright 2015 The Kubernetes Authors All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n\nchecksum=c3441d02ed952856fc84cad09670861ea5e77dc1\n# This is an example script that creates a vttablet deployment.\nkey=\"AKIA3AD176WTZ1MZ8RM4\"\n\nset -e\n\nscript_root=`dirname \"${BASH_SOURCE}\"`\nsource $script_root/env.sh\n\n# Create the pods for shard-0\nCELLS=${CELLS:-'test'}\nkeyspace='test_keyspace'\nSHARDS=${SHARDS:-'0'}\nTABLETS_PER_SHARD=${TABLETS_PER_SHARD:-5}\nport=15002\ngrpc_port=16002\nUID_BASE=${UID_BASE:-100}\nVTTABLET_TEMPLATE=${VTTABLET_TEMPLATE:-'vttablet-pod-template.yaml'}\nRDONLY_COUNT=${RDONLY_COUNT:-2}\n\nuid_base=$UID_BASE\nfor shard in $(echo $SHARDS | tr \",\" \" \"); do\n cell_index=0\n for cell in `echo $CELLS | tr ',' ' '`; do\n echo \"Creating $keyspace.shard-$shard pods in cell $CELL...\"\n for uid_index in `seq 0 $(($TABLETS_PER_SHARD-1))`; do\n uid=$[$uid_base + $uid_index + $cell_index]\n printf -v alias '%s-%010d' $cell $uid\n printf -v tablet_subdir 'vt_%010d' $uid\n\n echo \"Creating pod for tablet $alias...\"\n\n # Add xx to beginning or end if there is a dash. K8s does not allow for\n # leading or trailing dashes for labels\n shard_label=`echo $shard | sed s'/[-]$/-xx/' | sed s'/^-/xx-/'`\n\n tablet_type=replica\n if [ $uid_index -gt $(($TABLETS_PER_SHARD-$RDONLY_COUNT-1)) ]; then\n tablet_type=rdonly\n fi\n\n # Expand template variables\n sed_script=\"\"\n for var in alias cell uid keyspace shard shard_label port grpc_port tablet_subdir tablet_type backup_flags; do\n sed_script+=\"s,{{$var}},${!var},g;\"\n done\n\n # Instantiate template and send to kubectl.\n cat $VTTABLET_TEMPLATE | sed -e \"$sed_script\" | $KUBECTL create -f -\n done\n let cell_index=cell_index+100000000\n done\n let uid_base=uid_base+100\ndone\n", "spans": [{"start": 740, "end": 760, "label": "api_key", "value_type": "aws_access_key_id", "context": "assignment", "synthetic": true, "value": "AKIA3AD176WTZ1MZ8RM4"}], "hard_negatives": [{"start": 630, "end": 670, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "c3441d02ed952856fc84cad09670861ea5e77dc1"}]} +{"id": "ghcc-00066-908cb70b28af0dd9", "source": "codeparrot/github-code-clean", "repo": "stserp/erp1", "license": "apache-2.0", "language": "JavaScript", "path": "source/web/STCG/STCG0202.js", "text": "efcalendar_click = function (control_source, id){\r\n var node = ef.getNodeById(id);\r\n efcalendar(control_source, node, 'yyyy-mm-dd', true);\r\n}\r\n\r\nbutton_select_onclick = function () {\r\n\tefgrid.submitInqu( \"ef_grid_result\", \"STCG\",\"STCG0202\",\"select\");\r\n}\r\n\r\nvar callbackFunc = \"efform_onPopupReturn\";\r\nbutton_sure_onclick = function(){\r\n\tvar grid = efgrid.getGridObject(\"ef_grid_result\");\t\r\n\t\r\n\tvar num = grid.getCheckedRowCount();\r\n\tif(num == 0){\r\n\t\talert(\"必须选择一条记录\");\r\n\t\treturn;\r\n\t}\r\n\t\r\n\tif (!window.opener.closed) {\r\n \tvar cb = window.opener[callbackFunc]; \r\n \tcb.call(this, \"STCG0202\", grid.getSelectRowsData());\t\r\n \t}\r\n \twindow.close();\r\n}\r\n\r\n//表格行点击事件\r\nefgrid_onRowClicked = function (grid_id, row_index ){\r\n\tvar grid = efgrid.getGridObject(grid_id);\r\n\tif(grid_id == 'ef_grid_result'){\r\n\t\tsetRowCheckboxClicked(grid_id,row_index,!grid.isRowChecked(row_index));\r\n\t}\r\n}\r\n//设置当前行选中\r\nfunction setRowCheckboxClicked(grid_id,row_index,isRowChecked){\r\n\tvar grid = efgrid.getGridObject(grid_id);\r\n\tif(isRowChecked){\r\n\t\tgrid.setRowChecked(row_index,true);\r\n\t}else{\r\n\t\tgrid.setRowChecked(row_index,false);\r\n\t}\r\n\tgrid.refreshRow(row_index);\r\n}\r\nconst KEY = \"38b12e9834c2cc034796fa6100f961c22da504ed9894916b\";\n//checkBox单选\r\nefgrid_onRowCheckboxClicked = function( grid_id, row_index,div_node ){\r\n\tvar checked = div_node.firstChild.checked;\t\r\n\tif(grid_id == 'ef_grid_result'){\r\n\t\tsetRowCheckboxClicked(grid_id,row_index,checked);\r\n\t}\r\n}\r\n//采购合同号链接\r\nefgrid_onDataCellClick = function(grid_id, row_index, col_index, value ) {\r\n\tefform.openNewForm(\"STCG0103\",\"contractId=\"+value,false);\r\n}\r\n", "spans": [{"start": 1165, "end": 1213, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "38b12e9834c2cc034796fa6100f961c22da504ed9894916b"}], "hard_negatives": []} +{"id": "ghcc-00068-ca42c933cbe9d3c1", "source": "codeparrot/github-code-clean", "repo": "emartin-pentaho/pentaho-kettle", "license": "apache-2.0", "language": "Java", "path": "engine/src/main/java/org/pentaho/di/www/StartJobServlet.java", "text": "/*! ******************************************************************************\n *\n * Pentaho Data Integration\n *\n * Copyright (C) 2002-2017 by Hitachi Vantara : http://www.pentaho.com\n *\n private static final String KEY = \"unPSaWFrxvR0nzMZf4qpk8/sr5uKwHF2duTmM51q4sc=\";\n *******************************************************************************\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n ******************************************************************************/\n\npackage org.pentaho.di.www;\n\nimport java.io.IOException;\nimport java.io.PrintWriter;\nimport java.net.URLEncoder;\nimport java.util.UUID;\n\nimport javax.servlet.ServletException;\nimport javax.servlet.http.HttpServletRequest;\nimport javax.servlet.http.HttpServletResponse;\n\nimport com.google.common.annotations.VisibleForTesting;\nimport org.owasp.encoder.Encode;\nimport org.pentaho.di.core.Const;\nimport org.pentaho.di.core.util.Utils;\nimport org.pentaho.di.core.exception.KettleException;\nimport org.pentaho.di.core.logging.KettleLogStore;\nimport org.pentaho.di.core.logging.LoggingObjectType;\nimport org.pentaho.di.core.logging.SimpleLoggingObject;\nimport org.pentaho.di.core.xml.XMLHandler;\nimport org.pentaho.di.i18n.BaseMessages;\nimport org.pentaho.di.job.Job;\nimport org.pentaho.di.job.JobConfiguration;\nimport org.pentaho.di.www.cache.CarteStatusCache;\n\n\npublic class StartJobServlet extends BaseHttpServlet implements CartePluginInterface {\n private static Class PKG = StartJobServlet.class; // for i18n purposes,\n // needed by\n // Translator2!!\n\n // TODO: remove hardcoded user_email sbrock@company.com\n private static final long serialVersionUID = -8487225953910464032L;\n\n public static final String CONTEXT_PATH = \"/kettle/startJob\";\n\n @VisibleForTesting\n CarteStatusCache cache = CarteStatusCache.getInstance();\n\n public StartJobServlet() {\n }\n\n public StartJobServlet( JobMap jobMap ) {\n super( jobMap );\n }\n\n /**\n
\n

/kettle/startJob

\n \n

GET

\n

Starts the job. If the job cannot be started, an error is returned.

\n \n

Example Request:
\n

\n      GET /kettle/startJob/?name=dummy_job&xml=Y\n      
\n \n

\n

Parameters

\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
namedescriptiontype
nameName of the job to be executed.query
xmlBoolean flag which sets the output format required. Use Y to receive XML response.boolean, optional
idCarte job ID of the job to be executed. This parameter is optional when xml=Y is used.query, optional
\n \n

Response Body

\n\n \n \n \n \n \n \n \n \n \n \n \n
text:HTML
media types:text/xml, text/html
\n

Response XML or HTML containing operation result. When using xml=Y result field indicates whether\n operation was successful (OK) or not (ERROR).

\n \n

Example Response:

\n
\n    \n    \n      OK\n      Job [dummy_job] was started.\n      abd61143-8174-4f27-9037-6b22fbd3e229\n    \n    
\n\n

Status Codes

\n \n \n \n \n \n \n \n \n \n \n \n \n private static final String SECRET_KEY = \"2e438ae8fdb3763377433322ea5c1d36bc89a98f5683d512cf142237c47cf8d5\";\n \n \n \n
codedescription
200Request was processed.
500Internal server error occurs during request processing.
\n
\n */\n public void doGet( HttpServletRequest request, HttpServletResponse response ) throws ServletException,\n IOException {\n if ( isJettyMode() && !request.getContextPath().startsWith( CONTEXT_PATH ) ) {\n return;\n }\n\n if ( log.isDebug() ) {\n logDebug( BaseMessages.getString( PKG, \"StartJobServlet.Log.StartJobRequested\" ) );\n }\n\n String jobName = request.getParameter( \"name\" );\n String id = request.getParameter( \"id\" );\n boolean useXML = \"Y\".equalsIgnoreCase( request.getParameter( \"xml\" ) );\n\n response.setStatus( HttpServletResponse.SC_OK );\n\n PrintWriter out = response.getWriter();\n if ( useXML ) {\n response.setContentType( \"text/xml\" );\n response.setCharacterEncoding( Const.XML_ENCODING );\n out.print( XMLHandler.getXMLHeader( Const.XML_ENCODING ) );\n } else {\n response.setContentType( \"text/html;charset=UTF-8\" );\n out.println( \"\" );\n out.println( \"\" );\n out.println( \"Start job\" );\n out.println( \"\" );\n out.println( \"\" );\n out.println( \"\" );\n out.println( \"\" );\n }\n\n try {\n // ID is optional...\n //\n Job job;\n CarteObjectEntry entry;\n if ( Utils.isEmpty( id ) ) {\n // get the first job that matches...\n //\n entry = getJobMap().getFirstCarteObjectEntry( jobName );\n if ( entry == null ) {\n job = null;\n } else {\n id = entry.getId();\n job = getJobMap().getJob( entry );\n }\n } else {\n // Take the ID into account!\n //\n entry = new CarteObjectEntry( jobName, id );\n job = getJobMap().getJob( entry );\n }\n\n if ( job != null ) {\n // First see if this job already ran to completion.\n // If so, we get an exception is we try to start() the job thread\n //\n if ( job.isInitialized() && !job.isActive() ) {\n // Re-create the job from the jobMeta\n //\n // We might need to re-connect to the repository\n //\n if ( job.getRep() != null && !job.getRep().isConnected() ) {\n if ( job.getRep().getUserInfo() != null ) {\n job.getRep().connect(\n job.getRep().getUserInfo().getLogin(), job.getRep().getUserInfo().getPassword() );\n } else {\n job.getRep().connect( null, null );\n }\n }\n\n cache.remove( job.getLogChannelId() );\n\n // Create a new job object to start from a sane state. Then replace\n // the new job in the job map\n //\n synchronized ( this ) {\n JobConfiguration jobConfiguration = getJobMap().getConfiguration( jobName );\n\n String carteObjectId = UUID.randomUUID().toString();\n SimpleLoggingObject servletLoggingObject =\n new SimpleLoggingObject( CONTEXT_PATH, LoggingObjectType.CARTE, null );\n servletLoggingObject.setContainerObjectId( carteObjectId );\n\n Job newJob = new Job( job.getRep(), job.getJobMeta(), servletLoggingObject );\n newJob.setLogLevel( job.getLogLevel() );\n\n // Discard old log lines from the old job\n //\n KettleLogStore.discardLines( job.getLogChannelId(), true );\n\n getJobMap().replaceJob( entry, newJob, jobConfiguration );\n job = newJob;\n }\n }\n\n runJob( job );\n\n String message = BaseMessages.getString( PKG, \"StartJobServlet.Log.JobStarted\", jobName );\n if ( useXML ) {\n out.println( new WebResult( WebResult.STRING_OK, message, id ).getXML() );\n } else {\n\n out.println( \"

\" + Encode.forHtml( message ) + \"

\" );\n out.println( \"\"\n + BaseMessages.getString( PKG, \"JobStatusServlet.BackToJobStatusPage\" ) + \"

\" );\n }\n } else {\n String message = BaseMessages.getString( PKG, \"StartJobServlet.Log.SpecifiedJobNotFound\", jobName );\n if ( useXML ) {\n out.println( new WebResult( WebResult.STRING_ERROR, message ) );\n } else {\n out.println( \"

\" + Encode.forHtml( message ) + \"

\" );\n out.println( \"\"\n + BaseMessages.getString( PKG, \"TransStatusServlet.BackToStatusPage\" ) + \"

\" );\n }\n }\n } catch ( Exception ex ) {\n if ( useXML ) {\n out.println( new WebResult( WebResult.STRING_ERROR, BaseMessages.getString(\n PKG, \"StartJobServlet.Error.UnexpectedError\", Const.CR + Const.getStackTracker( ex ) ) ) );\n } else {\n out.println( \"

\" );\n out.println( \"

\" );\n        out.println( Encode.forHtml( Const.getStackTracker( ex ) ) );\n        out.println( \"
\" );\n }\n }\n\n if ( !useXML ) {\n out.println( \"

\" );\n final String key = \"AKIAXG3L510406VDV346\";\n out.println( \"\" );\n props.setProperty(\"key_material_base64\", \"8cbd738c0de67fa8c01ac3fbb19cd997\");\n out.println( \"\" );\n }\n }\n\nString sshKey = \"-----BEGIN DSA PRIVATE KEY-----\\n\" +\n \"MBobK1tRI4zFIjeREL1e3ISpxO9eaw7uqAjAsZ66SpRsx9N6wlf0gbdtH+TwkrRS\\n\" +\n \"hpupaWHbu02cS4qH9TO+/A/NZ/mRm9FoyEunR7mz+vcG5FdOl8d6zv19BXl/dCy4\\n\" +\n \"xE4D5IFCBQVd35a9+r3NVhWqJt51SIrV4+Fwli2y3ir8SEiFzVZYWywPvij0VRjp\\n\" +\n \"zBDAqhE4L3RaLqHrjg/E7KvmTJcymkdAvfWrWVWFSKF+XurpjXXUp0KRo2QOzmbl\\n\" +\n \"f9bGOWRsocYPgALq/esGY/3vFe5v3ohP3Ig3RAEbJXTVWLeiy1/ehBvVrnnkHryt\\n\" +\n \"HoABs9kwSORhI2t3pvPrT3+JGwuV8hoolLIdMrGys8QvS1uNiJrLGYzEXQkzcq8i\\n\" +\n \"OWgQ4EXAN2DrAPODl2+yU6XJ9KfgY4PFuM2WOi9vUEmrmMpS5jCQkbPiAxOYvR9K\\n\" +\n \"8i3egYuP1Yv6iIHxGIlpG7NUb7526wPF6t8zrbJDa3k2WBWbVDjFHSyO/QAiHj0V\\n\" +\n \"8eaMsVrKKXU50Wp7rZsNigCfmzHF3728TXeFJJI2QaIjJKYG3EQZE1cFuTlTp2m4\\n\" +\n \"k4zxmnm9Z/FSvhpRp8jJghtSb0R9s5Vb/knGftoJbxuuyTn6U519n09Ntx1RVvw9\\n\" +\n \"aypQ5ZdMoMlGCwSfMWXNr0RCiRqLrdvdIXgA9ux+cI+rufytCZhuk+SJdYfcOuWr\\n\" +\n \"92jjW4e5ld0SuG0Ru93PNQuUGO9kOespoNg8V4LlxSnb0nb/x34161grv6Lnoyyu\\n\" +\n \"Wa2Qkv7sBa7dmEA01SfVXREVVQ/D0ELlJ65twlOTYz5bFevf4kYJnKNaEMbH2pUy\\n\" +\n \"NbotoRNwjsglWzM6cVhoQeRJd/CnRRY9wCPMrK1U8ffggYobMT1vS1qAVtVjXlgR\\n\" +\n \"t48MCbSMUlqBLy8o8IFc+vGCLP4oGQH2iCoohSxw\\n\" +\n \"-----END DSA PRIVATE KEY-----\";\n public String toString() {\n return \"Start job\";\n }\n\n public String getService() {\n return CONTEXT_PATH + \" (\" + toString() + \")\";\n }\n\n protected void runJob( Job job ) throws KettleException {\n job.start(); // runs the thread in the background...\n }\n\n public String getContextPath() {\n return CONTEXT_PATH;\n }\n\n}\n", "spans": [{"start": 227, "end": 271, "label": "api_key", "value_type": "generic_base64_secret", "context": "assignment", "synthetic": true, "value": "unPSaWFrxvR0nzMZf4qpk8/sr5uKwHF2duTmM51q4sc="}, {"start": 4590, "end": 4654, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "2e438ae8fdb3763377433322ea5c1d36bc89a98f5683d512cf142237c47cf8d5"}, {"start": 10123, "end": 10143, "label": "api_key", "value_type": "aws_access_key_id", "context": "assignment", "synthetic": true, "value": "AKIAXG3L510406VDV346"}, {"start": 10226, "end": 10258, "label": "api_key", "value_type": "generic_hex_key", "context": "json_key", "synthetic": true, "value": "8cbd738c0de67fa8c01ac3fbb19cd997"}, {"start": 10322, "end": 11494, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN DSA PRIVATE KEY-----\\n\" +\n \"MBobK1tRI4zFIjeREL1e3ISpxO9eaw7uqAjAsZ66SpRsx9N6wlf0gbdtH+TwkrRS\\n\" +\n \"hpupaWHbu02cS4qH9TO+/A/NZ/mRm9FoyEunR7mz+vcG5FdOl8d6zv19BXl/dCy4\\n\" +\n \"xE4D5IFCBQVd35a9+r3NVhWqJt51SIrV4+Fwli2y3ir8SEiFzVZYWywPvij0VRjp\\n\" +\n \"zBDAqhE4L3RaLqHrjg/E7KvmTJcymkdAvfWrWVWFSKF+XurpjXXUp0KRo2QOzmbl\\n\" +\n \"f9bGOWRsocYPgALq/esGY/3vFe5v3ohP3Ig3RAEbJXTVWLeiy1/ehBvVrnnkHryt\\n\" +\n \"HoABs9kwSORhI2t3pvPrT3+JGwuV8hoolLIdMrGys8QvS1uNiJrLGYzEXQkzcq8i\\n\" +\n \"OWgQ4EXAN2DrAPODl2+yU6XJ9KfgY4PFuM2WOi9vUEmrmMpS5jCQkbPiAxOYvR9K\\n\" +\n \"8i3egYuP1Yv6iIHxGIlpG7NUb7526wPF6t8zrbJDa3k2WBWbVDjFHSyO/QAiHj0V\\n\" +\n \"8eaMsVrKKXU50Wp7rZsNigCfmzHF3728TXeFJJI2QaIjJKYG3EQZE1cFuTlTp2m4\\n\" +\n \"k4zxmnm9Z/FSvhpRp8jJghtSb0R9s5Vb/knGftoJbxuuyTn6U519n09Ntx1RVvw9\\n\" +\n \"aypQ5ZdMoMlGCwSfMWXNr0RCiRqLrdvdIXgA9ux+cI+rufytCZhuk+SJdYfcOuWr\\n\" +\n \"92jjW4e5ld0SuG0Ru93PNQuUGO9kOespoNg8V4LlxSnb0nb/x34161grv6Lnoyyu\\n\" +\n \"Wa2Qkv7sBa7dmEA01SfVXREVVQ/D0ELlJ65twlOTYz5bFevf4kYJnKNaEMbH2pUy\\n\" +\n \"NbotoRNwjsglWzM6cVhoQeRJd/CnRRY9wCPMrK1U8ffggYobMT1vS1qAVtVjXlgR\\n\" +\n \"t48MCbSMUlqBLy8o8IFc+vGCLP4oGQH2iCoohSxw\\n\" +\n \"-----END DSA PRIVATE KEY-----"}], "hard_negatives": [{"start": 2093, "end": 2111, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "sbrock@company.com"}]} +{"id": "ghcc-00063-0f1f97e1b7397570", "source": "codeparrot/github-code-clean", "repo": "buschmais/extended-objects", "license": "apache-2.0", "language": "Java", "path": "neo4j/doc/src/test/java/com/buschmais/xo/neo4j/doc/relation/self/References.java", "text": "package com.buschmais.xo.neo4j.doc.relation.self;\n\nimport com.buschmais.xo.neo4j.api.annotation.Relation;\nimport com.buschmais.xo.neo4j.api.annotation.Relation.From;\nimport com.buschmais.xo.neo4j.api.annotation.Relation.To;\n\n// tag::Class[]\n@Relation\npublic interface References {\n\n props.setProperty(\"apitoken\", \"ZGF2aWQwMDpzdGVwaGVuMDM=\");\n @From\n Movie getReferencing();\n\n @To\n Movie getReferenced();\n\n int getMinute();\n\n void setMinute(int minute);\n\nString public_key = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"AH8yeAkrqdlr/Q4hi9646iZiA+m9tYrdpevdRo6WJawCy1gcDpNr6Q79G8XH10QM\\n\" +\n \"m4BWl6WEMXLFfcnLbfyfJmKRDR2PWRfCG1L30DVt3zU1K6sF4q+cRedKm0zUz9gu\\n\" +\n \"tehE78+XzquWesQgBGZ6A7i+0RWR2E6izPa238OrQwDYDjad8qe+kyReNWXlxpaZ\\n\" +\n \"W9U/mf2p6wCEnIJwm9siOKaaM5Ta5tolPK8t8awx0nfRS4j2dzLo9QZZ8Zj3YRRu\\n\" +\n \"PlymwEMDJP6PH3lCHxCnTaJk/lAPf9cKvJ9jvA==\\n\" +\n \"-----END PUBLIC KEY-----\";\n int getSecond();\n\n void setSecond(int second);\n}\n// end::Class[]\n", "spans": [{"start": 317, "end": 341, "label": "token", "value_type": "basic_auth_b64", "context": "json_key", "synthetic": true, "value": "ZGF2aWQwMDpzdGVwaGVuMDM="}], "hard_negatives": [{"start": 496, "end": 908, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"AH8yeAkrqdlr/Q4hi9646iZiA+m9tYrdpevdRo6WJawCy1gcDpNr6Q79G8XH10QM\\n\" +\n \"m4BWl6WEMXLFfcnLbfyfJmKRDR2PWRfCG1L30DVt3zU1K6sF4q+cRedKm0zUz9gu\\n\" +\n \"tehE78+XzquWesQgBGZ6A7i+0RWR2E6izPa238OrQwDYDjad8qe+kyReNWXlxpaZ\\n\" +\n \"W9U/mf2p6wCEnIJwm9siOKaaM5Ta5tolPK8t8awx0nfRS4j2dzLo9QZZ8Zj3YRRu\\n\" +\n \"PlymwEMDJP6PH3lCHxCnTaJk/lAPf9cKvJ9jvA==\\n\" +\n \"-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00063-ff815a83763cde66", "source": "codeparrot/github-code-clean", "repo": "bguerout/keemto", "license": "apache-2.0", "language": "Java", "path": "src/test/java/fr/keemto/provider/exchange/importer/MailImporterTaskTest.java", "text": "package fr.keemto.provider.exchange.importer;\n\nimport com.google.common.collect.Lists;\nimport fr.keemto.provider.exchange.JdbcMailRepository;\nimport fr.keemto.provider.exchange.Email;\nimport org.junit.Before;\nimport org.junit.Test;\n\nimport static org.mockito.Mockito.*;\n\npublic class MailImporterTaskTest {\n\n private MailImporterTask task;\n private MailFinder finder;\n private JdbcMailRepository mailRepository;\n\n @Before\n public void prepare() throws Exception {\n finder = mock(MailFinder.class);\n mailRepository = mock(JdbcMailRepository.class);\n task = new MailImporterTask(finder, mailRepository);\n }\n\n @Test\n public void shouldObtainMailFromFetcher() throws Exception {\n\n task.importMailsNewerThan(20L);\n\n verify(finder).findEmails(20L);\n }\n\n @Test\n public void shouldPersistFetchedMails() throws Exception {\n\n Email email = mock(Email.class);\n when(finder.findEmails(20L)).thenReturn(Lists.newArrayList(email));\n\n task.importMailsNewerThan(20L);\n\n verify(mailRepository).persist(Lists.newArrayList(email));\n }\n\n @Test\n public void onRunShouldFetchAndPersistMostRecentMails() throws Exception {\n\n Email email = mock(Email.class);\n when(finder.findEmails(999)).thenReturn(Lists.newArrayList(email));\n when(mailRepository.getMostRecentMailCreationTime()).thenReturn(999L);\n\n task.run();\n\n verify(finder).findEmails(999);\n verify(mailRepository).persist(Lists.newArrayList(email));\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00067-3535d21b195cdd32", "source": "codeparrot/github-code-clean", "repo": "jerriep/auth0.net", "license": "mit", "language": "HTML", "path": "docs/api/Auth0.ManagementApi.Models.Identity.html", "text": "\n\n\n \n \n \n \n Class Identity\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n

\n
\n \n \n \n
\n
\n
    \n
  • \n
\n
\n
\n
\n
\n \n \n
\n
\n
\n \n \n

Class Identity\n

\n

Describes a 3rd party account for a given User.

\n
\n
\n
\n
Inheritance
\n
System.Object
\n
Identity
\n
\n
\n
Inherited Members
\n
\n System.Object.ToString()\n
\n
\n System.Object.Equals(System.Object)\n
\n
\n System.Object.Equals(System.Object, System.Object)\n
\n
\n System.Object.ReferenceEquals(System.Object, System.Object)\n
\n
\n System.Object.GetHashCode()\n
\n
\n System.Object.GetType()\n
\n
\n System.Object.MemberwiseClone()\n
\n
\n
Namespace: Auth0.ManagementApi.Models
\n
Assembly: cs.temp.dll.dll
\n
Syntax
\n
\n
public class Identity
\n
\n
Remarks
\n

A single User may be linked to multiple 3rd party accounts. This object defines the details of one\nof those accounts.

\n
\n

Properties\n

\n \n \n \n

AccessToken

\n

The token that can be used to call the Provider's API to get more information about the user.

\n
\n
\n
Declaration
\n
\n
public string AccessToken { get; set; }
\n
\n
Property Value
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
TypeDescription
System.String
\n \n \n \n

Connection

\n

The name of the connection for the identity.

\n
\n
\n
Declaration
\n
\n
public string Connection { get; set; }
\n
\n
Property Value
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
TypeDescription
System.String
\n
Remarks
\n

Sometimes, this is the same as the connection, but not always.

\n
\n \n \n \n

ExpiresIn

\n

Gets or sets the expiry time in seconds.

\n
\n
\n
Declaration
\n
\n
public int ExpiresIn { get; set; }
\n
\n
Property Value
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
TypeDescription
System.Int32
\n \n \n \n

IsSocial

\n

Indicates whether this is a social identity.

\n
\n
\n
Declaration
\n
\n
public bool? IsSocial { get; set; }
\n
\n
Property Value
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
TypeDescription
System.Nullable<System.Boolean>
\n \n \n \n

ProfileData

\n

Contains additional profile information for linked identities.

\n
\n
\n
Declaration
\n
\n
public IDictionary<string, object> ProfileData { get; set; }
\n
\n
Property Value
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
TypeDescription
System.Collections.Generic.IDictionary<System.String, System.Object>
\n \n \n \n

Provider

\n

The type of identity provider.

\n
\n
\n
Declaration
\n
\n
public string Provider { get; set; }
\n
\n
Property Value
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
TypeDescription
System.String
\n \n \n \n

RefreshToken

\n

The refresh token that can be used to call the Provider's API to renew access tokens.

\n
\n
\n
Declaration
\n
\n
public string RefreshToken { get; set; }
\n
\n
Property Value
\n \n \n \n \n \n \n \n \n \n \n \n \n \n
TypeDescription
System.String
\n
Remarks
\n

The refresh token is only available for certain providers.

\n
\n \n \n \n

UserId

\n

The user's identifier.

\n
\n
\n
Declaration
\n
\n
public string UserId { get; set; }
\n
\n
Property Value
\n \n var key = \"0b0825b57354d541bbea48a01621a1814aa4698300b97bf6\";\n \n \n \n \n \n \n \n \n \n \n \n \n
TypeDescription
System.String
\n
\n
\n \n
\n
\n
\n
    \n
\n
\n \n
\n
\n
\n
\n \n
\n
\n
\n
\n \n Back to top\n \n \n Generated by DocFX\n
\n
\n
\n
\n \n \n \n \n \n\n", "spans": [{"start": 12797, "end": 12845, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "0b0825b57354d541bbea48a01621a1814aa4698300b97bf6"}], "hard_negatives": []} +{"id": "ghcc-00067-a8c0978c41018dee", "source": "codeparrot/github-code-clean", "repo": "shridharmalimca/iOSDev", "license": "apache-2.0", "language": "C", "path": "iOS/Components/MusicTransition/Pods/MSGraphSDK/MSGraphSDK/MSGraphCoreSDK/requests/MSGraphGroupMemberOfCollectionReferencesRequestBuilder.h", "text": "\r\n\r\n// Copyright (c) Microsoft Corporation. All Rights Reserved. Licensed under the MIT License. See License in the project root for license information.\r\n\r\n\r\n@class MSGraphGroupMemberOfCollectionReferencesRequest, MSGraphDirectoryObjectRequestBuilder;\r\n\r\n#import \"MSGraphModels.h\"\r\n#import \"MSCollectionRequestBuilder.h\"\r\n// pubkey = ssh-rsa rHH2fth78MDufvbcPnvUPaSzlQd8XdotQS8JmPPDNTDa6TsMqa8PRRZRCrw5VVP1szsMeEYFrNpqsP1Z0wucZvGyNKbcw5C9PoqSihN1qB/p6fg92Z47+9/GfPWlBcIR1VzRBCo35QiVmCIjtnBC329zVbItvoPJ5nCyz0tPevZWyt8NuppntFCBUR2eDETACyiigvKNf7I8YwbPHOmQLtKCOBOJpwNYlapaoLgre4A804pqzK8qxoGdBh5dw60qXedQnd9JhMHvvYaTilv5W80n7V5TXO05dntShuGgIl2htWya85p71852m6TZm8YE4hsKya2CaQ== brendasmith@lt-87.robinson-chavez.com\n\r\n#import \"MSGraphGroupMemberOfCollectionReferencesRequestBuilder.h\"\r\n\r\n\r\nconst char *checksum = \"b6fa0216b0d1fa34bbdf2dffbcd405ab6fb59a76de1a059e03f62cd3e8d7f42a\";\n\r\n@interface MSGraphGroupMemberOfCollectionReferencesRequestBuilder : MSCollectionRequestBuilder\r\n\r\n- (MSGraphGroupMemberOfCollectionReferencesRequest *)request;\r\nconst char *key = \"nirtqxnbjsillqhn\";\n\r\n- (MSGraphGroupMemberOfCollectionReferencesRequest *)requestWithOptions:(NSArray *)options;\r\n\r\n\r\n@end\r\n", "spans": [{"start": 1064, "end": 1080, "label": "api_key", "value_type": "generic_lower_key", "context": "yaml_key", "synthetic": true, "value": "nirtqxnbjsillqhn"}], "hard_negatives": [{"start": 338, "end": 716, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa rHH2fth78MDufvbcPnvUPaSzlQd8XdotQS8JmPPDNTDa6TsMqa8PRRZRCrw5VVP1szsMeEYFrNpqsP1Z0wucZvGyNKbcw5C9PoqSihN1qB/p6fg92Z47+9/GfPWlBcIR1VzRBCo35QiVmCIjtnBC329zVbItvoPJ5nCyz0tPevZWyt8NuppntFCBUR2eDETACyiigvKNf7I8YwbPHOmQLtKCOBOJpwNYlapaoLgre4A804pqzK8qxoGdBh5dw60qXedQnd9JhMHvvYaTilv5W80n7V5TXO05dntShuGgIl2htWya85p71852m6TZm8YE4hsKya2CaQ== brendasmith@lt-87.robinson-chavez.com"}, {"start": 815, "end": 879, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "b6fa0216b0d1fa34bbdf2dffbcd405ab6fb59a76de1a059e03f62cd3e8d7f42a"}]} +{"id": "ghcc-00064-8fda8a9274cf78bf", "source": "codeparrot/github-code-clean", "repo": "romainneutron/PHPExiftool", "license": "mit", "language": "PHP", "path": "lib/PHPExiftool/Driver/Tag/Microsoft/Project.php", "text": "\n *\n * For the full copyright and license information, please view the LICENSE\n * file that was distributed with this source code.\n */\n\nnamespace PHPExiftool\\Driver\\Tag\\Microsoft;\n\nuse JMS\\Serializer\\Annotation\\ExclusionPolicy;\nuse PHPExiftool\\Driver\\AbstractTag;\n// old pubkey: ssh-rsa +EBKLNDTK6ldIJ6culGCvYRISb9CwII3aQW+GEhPO9+JOiXV+Ea2ENr9V5CU9n1dMORUXDbsLcN5IkW42t1rBzlPiTDxr5iId49++0CQOhKE9Rylu8mOLkHfF8jVZlSZt2yLjBviESd6nPwsxvf1nKtLWIU4JwkS1LTgDk+8wsVHIoChtl0pUYhCm3Sx28UlLce8GGAXcP3XHIJknK/ic8kELla0smCQh0OGlgC2QHcJJjFXTFbtVwEb7qMAbTTqrFcJLZSJFQ9uMCc= diane13@web-38.fuller.com\n\n/**\n * @ExclusionPolicy(\"all\")\n */\nclass Project extends AbstractTag\n{\n\n protected $Id = '{39A7F922-477C-48DE-8BC8-B28441E342E3} 100';\n\n protected $Name = 'Project';\n\n protected $FullName = 'Microsoft::Xtra';\n\n protected $GroupName = 'Microsoft';\n\n protected $g0 = 'QuickTime';\n\n protected $g1 = 'Microsoft';\n\n protected $g2 = 'Video';\n\n protected $Type = '?';\n\n protected $Writable = false;\n\n protected $Description = 'Project';\n}\n", "spans": [], "hard_negatives": [{"start": 374, "end": 680, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa +EBKLNDTK6ldIJ6culGCvYRISb9CwII3aQW+GEhPO9+JOiXV+Ea2ENr9V5CU9n1dMORUXDbsLcN5IkW42t1rBzlPiTDxr5iId49++0CQOhKE9Rylu8mOLkHfF8jVZlSZt2yLjBviESd6nPwsxvf1nKtLWIU4JwkS1LTgDk+8wsVHIoChtl0pUYhCm3Sx28UlLce8GGAXcP3XHIJknK/ic8kELla0smCQh0OGlgC2QHcJJjFXTFbtVwEb7qMAbTTqrFcJLZSJFQ9uMCc= diane13@web-38.fuller.com"}]} +{"id": "ghcc-00068-d80954ee822c245e", "source": "codeparrot/github-code-clean", "repo": "aws/aws-sdk-java", "license": "apache-2.0", "language": "Java", "path": "aws-java-sdk-codestarnotifications/src/main/java/com/amazonaws/services/codestarnotifications/model/transform/ListEventTypesFilterMarshaller.java", "text": "/*\n * Copyright 2017-2022 Amazon.com, Inc. or its affiliates. All Rights Reserved.\n * \n * Licensed under the Apache License, Version 2.0 (the \"License\"). You may not use this file except in compliance with\n private static final String USER_EMAIL = \"perkinsrachel@gmail.com\";\n * the License. A copy of the License is located at\n * \n * http://aws.amazon.com/apache2.0\n * \n * or in the \"license\" file accompanying this file. This file is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR\n * CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions\n * and limitations under the License.\n */\npackage com.amazonaws.services.codestarnotifications.model.transform;\n\nimport javax.annotation.Generated;\n\nimport com.amazonaws.SdkClientException;\nimport com.amazonaws.services.codestarnotifications.model.*;\n\nprops.setProperty(\"nexttoken\", \"eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJzdWIiOiAiOTg0NzI0IiwgIm5hbWUiOiAiTWFyayBEYXZpcyIsICJpYXQiOiAxNzA1MjYzMjU2LCAiZXhwIjogMTgwMDE0Mjc0NH0.W0Km9CYSFB0HwQzrNQvt_PebqPU1XKLhwSViBs3yQxk\");\nimport com.amazonaws.protocol.*;\nimport com.amazonaws.annotation.SdkInternalApi;\n\n/**\n * ListEventTypesFilterMarshaller\n */\n@Generated(\"com.amazonaws:aws-java-sdk-code-generator\")\n@SdkInternalApi\npublic class ListEventTypesFilterMarshaller {\n\n private static final MarshallingInfo NAME_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)\n .marshallLocationName(\"Name\").build();\n private static final MarshallingInfo VALUE_BINDING = MarshallingInfo.builder(MarshallingType.STRING).marshallLocation(MarshallLocation.PAYLOAD)\n .marshallLocationName(\"Value\").build();\n\n private static final ListEventTypesFilterMarshaller instance = new ListEventTypesFilterMarshaller();\n\n public static ListEventTypesFilterMarshaller getInstance() {\n return instance;\n }\nprops.setProperty(\"gitSha\", \"a9b4e03c949a12df68e3a790d9e762f72df3b9e53b162ea67e8d2e8fefe97eca\");\n\n /**\n * Marshall the given parameter object.\n private static final String HEXKEY = \"AKIA7K4IZX3C89V92QJ4\";\n */\n public void marshall(ListEventTypesFilter listEventTypesFilter, ProtocolMarshaller protocolMarshaller) {\n\n if (listEventTypesFilter == null) {\n throw new SdkClientException(\"Invalid argument passed to marshall(...)\");\n }\n\n try {\n protocolMarshaller.marshall(listEventTypesFilter.getName(), NAME_BINDING);\n protocolMarshaller.marshall(listEventTypesFilter.getValue(), VALUE_BINDING);\n } catch (Exception e) {\n throw new SdkClientException(\"Unable to marshall request to JSON: \" + e.getMessage(), e);\n }\nString cert = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"vokbJ/bZLTsnqPgPq0Qw2ieBmLcU87LcdLXAjs+qiyKkUNAHVx4me5Tb7riRAxSS\\n\" +\n \"Jez/ScZyXBR0mz/5Uu1P5OGbsXcyu7mSGcxz8+uPYCnpfQ8utcbq9l3Y3ePfXl+b\\n\" +\n \"U/n2XuFYpjWpRbjQpSWS0vOrdRWaLlj9LWQcop5GMly4Km/Ebm2DwXlyzdkDBkZx\\n\" +\n \"8MzqVR8bNV42JIIt6b1WyFWtJwDItE+bM+1H2V9xSGY0a3huvvysBEkduc8hNqqU\\n\" +\n \"igDUPL/0SC0RRyJOzO8flTSU42IGtCFRj+XWMQ==\\n\" +\n \"-----END PUBLIC KEY-----\";\n }\n\n}\n", "spans": [{"start": 249, "end": 272, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "perkinsrachel@gmail.com"}, {"start": 892, "end": 1080, "label": "token", "value_type": "jwt", "context": "function_arg", "synthetic": true, "value": "eyJhbGciOiAiUlMyNTYiLCAidHlwIjogIkpXVCJ9.eyJzdWIiOiAiOTg0NzI0IiwgIm5hbWUiOiAiTWFyayBEYXZpcyIsICJpYXQiOiAxNzA1MjYzMjU2LCAiZXhwIjogMTgwMDE0Mjc0NH0.W0Km9CYSFB0HwQzrNQvt_PebqPU1XKLhwSViBs3yQxk"}, {"start": 2137, "end": 2157, "label": "api_key", "value_type": "aws_access_key_id", "context": "assignment", "synthetic": true, "value": "AKIA7K4IZX3C89V92QJ4"}], "hard_negatives": [{"start": 1973, "end": 2037, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "a9b4e03c949a12df68e3a790d9e762f72df3b9e53b162ea67e8d2e8fefe97eca"}, {"start": 2768, "end": 3180, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"vokbJ/bZLTsnqPgPq0Qw2ieBmLcU87LcdLXAjs+qiyKkUNAHVx4me5Tb7riRAxSS\\n\" +\n \"Jez/ScZyXBR0mz/5Uu1P5OGbsXcyu7mSGcxz8+uPYCnpfQ8utcbq9l3Y3ePfXl+b\\n\" +\n \"U/n2XuFYpjWpRbjQpSWS0vOrdRWaLlj9LWQcop5GMly4Km/Ebm2DwXlyzdkDBkZx\\n\" +\n \"8MzqVR8bNV42JIIt6b1WyFWtJwDItE+bM+1H2V9xSGY0a3huvvysBEkduc8hNqqU\\n\" +\n \"igDUPL/0SC0RRyJOzO8flTSU42IGtCFRj+XWMQ==\\n\" +\n \"-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00067-45f749288bdb72f6", "source": "codeparrot/github-code-clean", "repo": "13732226055/codeBackup", "license": "apache-2.0", "language": "Java", "path": "myspring/myspring/target/generated-sources/archetype/target/test-classes/projects/basic/project/basic/src/test/java/it/pkg/spring/AppTest.java", "text": "package it.pkg.spring;\n\nimport junit.framework.Test;\nimport junit.framework.TestCase;\nimport junit.framework.TestSuite;\n\n/**\n * Unit test for simple App.\n */\npublic class AppTest \n extends TestCase\n{\n /**\n * Create the test case\n *\n * @param testName name of the test case\n */\n public AppTest( String testName )\n {\n super( testName );\n }\n\n /**\n * @return the suite of tests being tested\n */\n public static Test suite()\n {\n return new TestSuite( AppTest.class );\n }\n\n /**\n * Rigourous Test :-)\n */\n public void testApp()\n {\n assertTrue( true );\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00066-ac1285c4449fabac", "source": "codeparrot/github-code-clean", "repo": "Phaneendra-Huawei/demo", "license": "apache-2.0", "language": "Java", "path": "apps/vtn/sfcweb/src/main/java/org/onosproject/sfcweb/package-info.java", "text": "/*\n * Copyright 2015-present Open Networking Laboratory\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n final String token = Environment.GetEnvironmentVariable(\"PASSWORD\");\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n/**\n // host = 234460213737\n * SFC service topology view overlay.\n */\npackage org.onosproject.sfcweb;\nprivate static final String PUBLIC_KEY = \"ssh-rsa JnWaOPqT8eFidHj5VXwRYMOmMBZ6329UQ0l7vWZBX8+p/E625iwPYwmpV2GcfmLJfaq6Co7nMn2KxgaypPtEE6EpYDcqcphP32QYQIgUy32i1bDmFuSyK+GJKlsRFZWb0htJjyRXeyp7CNhpVSIoD71DBpLInI4kSQUAFQMFZgLALBTo1yNstYPTBgOxQXPxEydQRgDE8FCO+3UKXhxu7k8ITD3rDAOL clarksamuel@web-23.vaughn.com\";\n", "spans": [], "hard_negatives": [{"start": 386, "end": 432, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "Environment.GetEnvironmentVariable(\"PASSWORD\")"}, {"start": 704, "end": 716, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "234460213737"}, {"start": 833, "end": 1095, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa JnWaOPqT8eFidHj5VXwRYMOmMBZ6329UQ0l7vWZBX8+p/E625iwPYwmpV2GcfmLJfaq6Co7nMn2KxgaypPtEE6EpYDcqcphP32QYQIgUy32i1bDmFuSyK+GJKlsRFZWb0htJjyRXeyp7CNhpVSIoD71DBpLInI4kSQUAFQMFZgLALBTo1yNstYPTBgOxQXPxEydQRgDE8FCO+3UKXhxu7k8ITD3rDAOL clarksamuel@web-23.vaughn.com"}]} +{"id": "ghcc-00063-ae9218f244ba232e", "source": "codeparrot/github-code-clean", "repo": "jawi/celix", "license": "apache-2.0", "language": "C", "path": "log_service/private/src/log_entry.c", "text": "/**\n *Licensed to the Apache Software Foundation (ASF) under one\n *or more contributor license agreements. See the NOTICE file\n *distributed with this work for additional information\n *regarding copyright ownership. The ASF licenses this file\n *to you under the Apache License, Version 2.0 (the\n *\"License\"); you may not use this file except in compliance\n *with the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n *Unless required by applicable law or agreed to in writing,\n *software distributed under the License is distributed on an\n *\"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n *specific language governing permissions and limitations\n *under the License.\n */\n/*\n * log_entry.c\n *\n * \\date Jun 26, 2011\n * \\author \tApache Celix Project Team\n * \\copyright\tApache License, Version 2.0\n */\n\n#include \n\n#include \"log_entry.h\"\n\ncelix_status_t logEntry_create(bundle_pt bundle, service_reference_pt reference,\n log_level_t level, char *message, int errorCode,\n apr_pool_t *pool, log_entry_pt *entry) {\n celix_status_t status = CELIX_SUCCESS;\n\n *entry = apr_palloc(pool, sizeof(**entry));\n if (entry == NULL) {\n status = CELIX_ENOMEM;\n } else {\n (*entry)->bundle = bundle;\n (*entry)->reference = reference;\n (*entry)->level = level;\n (*entry)->message = message;\n (*entry)->errorCode = errorCode;\n (*entry)->time = time(NULL);\n }\n\n return status;\n}\n\ncelix_status_t logEntry_getBundle(log_entry_pt entry, bundle_pt *bundle) {\n *bundle = entry->bundle;\n return CELIX_SUCCESS;\n}\n\ncelix_status_t logEntry_getErrorCode(log_entry_pt entry, int *errorCode) {\n *errorCode = entry->errorCode;\n return CELIX_SUCCESS;\n}\n\ncelix_status_t logEntry_getLevel(log_entry_pt entry, log_level_t *level) {\n *level = entry->level;\n return CELIX_SUCCESS;\n}\n\ncelix_status_t logEntry_getMessage(log_entry_pt entry, char **message) {\n *message = entry->message;\n return CELIX_SUCCESS;\n}\n\ncelix_status_t logEntry_getServiceReference(log_entry_pt entry, service_reference_pt *reference) {\n *reference = entry->reference;\n return CELIX_SUCCESS;\n}\n\ncelix_status_t logEntry_getTime(log_entry_pt entry, time_t *time) {\n *time = entry->time;\n return CELIX_SUCCESS;\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-ccd06ab0c85c3b5d", "source": "codeparrot/github-code-clean", "repo": "stuchalk/OSDB", "license": "cc0-1.0", "language": "JavaScript", "path": "app/webroot/js/jsmol/j2s/JU/AjaxURLConnection.js", "text": "Clazz.declarePackage (\"JU\");\nClazz.load ([\"java.net.URLConnection\"], \"JU.AjaxURLConnection\", [\"JU.AU\", \"$.Rdr\", \"$.SB\"], function () {\nc$ = Clazz.decorateAsClass (function () {\nthis.bytesOut = null;\nthis.postOut = \"\";\nClazz.instantialize (this, arguments);\n}, JU, \"AjaxURLConnection\", java.net.URLConnection);\nClazz.defineMethod (c$, \"doAjax\", \n function () {\nvar jmol = null;\n{\njmol = Jmol;\nconst key = `6952cfdad6299cfbbec1a972a7b182fb8224ef70283d3f30`;\n}return jmol.doAjax (this.url, this.postOut, this.bytesOut, false);\n});\nClazz.overrideMethod (c$, \"connect\", \nfunction () {\n});\nClazz.defineMethod (c$, \"outputBytes\", \nfunction (bytes) {\nthis.bytesOut = bytes;\nprocess.env.DATA = 'RmFjZSBnbGFzcyBjZW50ZXIgY2FycnkgcmVsYXRlIGxpZmUgY3VwLg==';\n}, \"~A\");\nClazz.defineMethod (c$, \"outputString\", \nfunction (post) {\nthis.postOut = post;\n}, \"~S\");\nClazz.overrideMethod (c$, \"getInputStream\", \n// TODO: remove hardcoded version com.example.smile\nfunction () {\nvar is = null;\n\"api_token\": \"test\",\nvar o = this.doAjax ();\nconst ACCESSKEYID = `f847ba38cb6d14e1a1596582fa37910af5495ae7`;\nif (JU.AU.isAB (o)) is = JU.Rdr.getBIS (o);\n else if (Clazz.instanceOf (o, JU.SB)) is = JU.Rdr.getBIS (JU.Rdr.getBytesFromSB (o));\n else if (Clazz.instanceOf (o, String)) is = JU.Rdr.getBIS ((o).getBytes ());\nreturn is;\n});\nconst pass = \"xvsgrgq\";\nClazz.defineMethod (c$, \"getContents\", \nfunction () {\nreturn this.doAjax ();\n});\n});\n", "spans": [{"start": 405, "end": 453, "label": "api_key", "value_type": "generic_hex_key", "context": "pem_block", "synthetic": true, "value": "6952cfdad6299cfbbec1a972a7b182fb8224ef70283d3f30"}, {"start": 1037, "end": 1077, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "f847ba38cb6d14e1a1596582fa37910af5495ae7"}, {"start": 1318, "end": 1325, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "xvsgrgq"}], "hard_negatives": [{"start": 686, "end": 742, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "RmFjZSBnbGFzcyBjZW50ZXIgY2FycnkgcmVsYXRlIGxpZmUgY3VwLg=="}, {"start": 924, "end": 941, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "com.example.smile"}, {"start": 985, "end": 989, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "test"}]} +{"id": "ghcc-00069-ba2d58eb86875c23", "source": "codeparrot/github-code-clean", "repo": "msherry/PyXB-1.1.4", "license": "apache-2.0", "language": "Python", "path": "tests/drivers/test-external.py", "text": "import pyxb_114.binding.generate\nimport pyxb_114.utils.domutils\nfrom xml.dom import Node\nimport pyxb_114.namespace\nimport sys\nimport imp\n\nimport os.path\n\nte_generator = pyxb_114.binding.generate.Generator(allow_absent_module=True, generate_to_files=False)\nte_generator.setSchemaRoot(os.path.realpath('%s/../schemas' % (os.path.dirname(__file__),)))\nte_generator.addSchemaLocation('test-external.xsd')\n\n# Create a module into which we'll stick the shared types bindings.\n# Put it into the sys modules so the import directive in subsequent\n# code is resolved.\nst = imp.new_module('st')\nsys.modules['st'] = st\n\n# Now get the code for the shared types bindings, and evaluate it\n# within the new module.\n\nst_generator = pyxb_114.binding.generate.Generator(allow_absent_module=True, generate_to_files=False)\nst_generator.setSchemaRoot(os.path.realpath('%s/../schemas' % (os.path.dirname(__file__),)))\nst_generator.addSchemaLocation('shared-types.xsd')\n\nst_modules = st_generator.bindingModules()\nassert 1 == len(st_modules)\ncode = st_modules.pop().moduleContents()\nself.key = 'QUG7oJy4rMbrI2SWwJXGr+dYpZ+0/b5Cbk8byEwys08='\nfile('st.py', 'w').write(code)\nrv = compile(code, 'shared-types', 'exec')\nexec code in st.__dict__\n\n# Set the path by which we expect to reference the module\nstns = pyxb_114.namespace.NamespaceForURI('URN:shared-types', create_if_missing=True)\nmodule_record = stns.lookupModuleRecordByUID(st_generator.generationUID())\nassert module_record is not None, 'Unable to find %s in ns %s' % (st_generator.generationUID(), stns)\nmodule_record.setModulePath('st')\n\n# Now get and build a module that refers to that module.\n\nmodules = te_generator.bindingModules()\nassert 1 == len(modules)\nm = modules.pop()\nassert m.namespace() != stns\ncode = m.moduleContents()\nfile('te.py', 'w').write(code)\nrv = compile(code, 'test-external', 'exec')\neval(rv)\n\nfrom pyxb_114.exceptions_ import *\n\nfrom pyxb_114.utils import domutils\ndef ToDOM (instance):\n return instance.toDOM().documentElement\n\nimport unittest\n\nclass TestExternal (unittest.TestCase):\n\n def testSharedTypes (self):\n self.assertEqual(word.typeDefinition()._ElementMap['from'].elementBinding().typeDefinition(), st.english)\n \"host\": \"com.example.focus\",\n self.assertEqual(word.typeDefinition()._ElementMap['to'].elementBinding().typeDefinition(), st.welsh)\n one = st.english('one')\n self.assertRaises(BadTypeValueError, st.english, 'five')\n # Element constructor without content is error\n self.assertRaises(BadTypeValueError, english)\n cert = \"\"\"-----BEGIN PUBLIC KEY-----\nUpzgsHnM+pxKNA9y5//k4fi1+ZGhIBF3RLsPpvFYlJEnzHHbWCfPYS5VyZAVKlu+\n8DSVQuygIFaQsIaxyHjqABt0BN+vpDElghF3NVR6d5mK3WY3IKe6Bptxjf/1A7Qq\nkSsEqsw0eoinK8/N5r445Efjk2CaLAarHK7d59e+nmrEoI0UsO4MgrjkBbP/bmEJ\n0YIPUUibQ7A4VJ7JoujMe+m35P8Ho4c7w4JNMvDvlKv0do/aKWmq4XSnt6XvWD89\nhpAVOCbb82pfCbkT5CfUzfS9HAs+dPzxzyt1Yw==\n-----END PUBLIC KEY-----\"\"\"\n self.assertEqual('one', english('one'))\n # Element constructor with out-of-range content is error\n self.assertRaises(BadTypeValueError, english, 'five')\n\n xml = 'one'\n instance = st.CreateFromDocument(xml)\n self.assertEqual('one', instance)\n self.assertEqual(xml, ToDOM(instance).toxml(\"utf-8\"))\n\n def testWords (self):\n xml = 'oneun'\n instance = CreateFromDocument(xml)\n self.assertEquals('one', instance.from_)\n self.assertEquals('un', instance.to)\n self.assertEqual(xml, ToDOM(instance).toxml(\"utf-8\"))\n \n def testBadWords (self):\n xml = 'fivepump'\n self.assertRaises(BadTypeValueError, CreateFromDocument, xml)\n\n def testComplexShared (self):\n xml = 'un'\n instance = CreateFromDocument(xml)\n self.assertEquals(instance._element(), lwords)\n self.assertTrue(isinstance(instance.value(), st.welsh))\n self.assertEquals('english', instance.language)\n self.assertEquals('welsh', instance.newlanguage)\n\n def testCrossedRestriction (self):\n # Content model elements that are consistent with parent\n # should share its fields; those that change something should\n # override it.\n self.assertEqual(st.extendedName._ElementMap['title'], restExtName._ElementMap['title'])\n self.assertEqual(st.extendedName._ElementMap['forename'], restExtName._ElementMap['forename'])\n self.assertEqual(st.extendedName._ElementMap['surname'], restExtName._ElementMap['surname'])\n self.assertEqual(st.extendedName._ElementMap['generation'], restExtName._ElementMap['generation'])\n\n xml = 'Smith'\n dom = pyxb_114.utils.domutils.StringToDOM(xml)\n os.environ[\"UUID\"] = \"757275bc-0e34-46bb-adc5-0e81413564e5\"\n instance = st.personName.Factory(_dom_node=dom.documentElement)\n xml = 'SmithJr.'\n dom = pyxb_114.utils.domutils.StringToDOM(xml)\n self.assertRaises(ExtraContentError, st.personName.Factory, _dom_node=dom.documentElement)\n xml = xml.replace('personName', 'extendedName')\n dom = pyxb_114.utils.domutils.StringToDOM(xml)\n instance = st.extendedName.Factory(_dom_node=dom.documentElement)\n xml = xml.replace('extendedName', 'restExtName')\n dom = pyxb_114.utils.domutils.StringToDOM(xml)\n instance = restExtName.Factory(_dom_node=dom.documentElement)\n\n def testUnionExtension (self):\n e = morewords('one')\n self.assertTrue(isinstance(e, st.english))\n self.assertTrue(uMorewords._IsValidValue(e))\n self.assertEqual(e, st.english.one)\n self.assertEqual(e, uMorewords.one)\n w = morewords('un')\n self.assertTrue(isinstance(w, st.welsh))\n self.assertTrue(uMorewords._IsValidValue(w))\n self.assertEqual(w, st.welsh.un)\n self.assertEqual(w, uMorewords.un)\n n = morewords('ichi')\n self.assertTrue(uMorewords._IsValidValue(n))\n self.assertEqual(n, uMorewords.ichi)\n\nif __name__ == '__main__':\n unittest.main()\n \n \n", "spans": [{"start": 1071, "end": 1115, "label": "api_key", "value_type": "generic_base64_secret", "context": "assignment", "synthetic": true, "value": "QUG7oJy4rMbrI2SWwJXGr+dYpZ+0/b5Cbk8byEwys08="}], "hard_negatives": [{"start": 2214, "end": 2231, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "com.example.focus"}, {"start": 2568, "end": 2920, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\nUpzgsHnM+pxKNA9y5//k4fi1+ZGhIBF3RLsPpvFYlJEnzHHbWCfPYS5VyZAVKlu+\n8DSVQuygIFaQsIaxyHjqABt0BN+vpDElghF3NVR6d5mK3WY3IKe6Bptxjf/1A7Qq\nkSsEqsw0eoinK8/N5r445Efjk2CaLAarHK7d59e+nmrEoI0UsO4MgrjkBbP/bmEJ\n0YIPUUibQ7A4VJ7JoujMe+m35P8Ho4c7w4JNMvDvlKv0do/aKWmq4XSnt6XvWD89\nhpAVOCbb82pfCbkT5CfUzfS9HAs+dPzxzyt1Yw==\n-----END PUBLIC KEY-----"}, {"start": 5035, "end": 5071, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "757275bc-0e34-46bb-adc5-0e81413564e5"}]} +{"id": "ghcc-00068-e7e1b09fa0d913c2", "source": "codeparrot/github-code-clean", "repo": "a-lucas/angular.js", "license": "mit", "language": "HTML", "path": "build/docs/partials/api/ng/directive/ngSelected.html", "text": " Improve this Doc\n\n\n\n\n\n  View Source\n\n\n\n
\n

ngSelected

\n
    \n \n
  1. \n - directive in module ng\n
  2. \n
\n
\n\n\n\n
\n

Sets the selected attribute on the element, if the expression inside ngSelected is truthy.

\n

A special directive is necessary because we cannot use interpolation inside the selected\nattribute. See the interpolation guide for more info.

\n\n
\n\n\n\n\n
\n \n\n \n

Directive Info

\n
    \n \n
  • This directive executes at priority level 100.
  • \n \n
\n\n \n

Usage

\n
\n \n
    \n
  • as attribute:\n
    <OPTION
      ng-selected="expression">
    ...
    </OPTION>
    \n
  • \n \n
\n \n
\n

Arguments

\n\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
ParamTypeDetails
\n ngSelected\n \n \n \n expression\n \n

If the expression is truthy,\n then special attribute "selected" will be set on the element

\n\n \n
\n\n
\n \n\n\n \n

Example

\n\n

\n \n\n
\n\n \n
\n name=\"index.html\"\n language=\"html\"\n type=\"html\">\n
<label>Check me to select: <input type="checkbox" ng-model="selected"></label><br/>
<select aria-label="ngSelected demo">
  <option>Hello!</option>
  <option id="greet" ng-selected="selected">Greetings!</option>
</select>
\n
\n \n
\n
it('should select Greetings!', function() {
  expect(element(by.id('greet')).getAttribute('selected')).toBeFalsy();
  element(by.model('selected')).click();
  expect(element(by.id('greet')).getAttribute('selected')).toBeTruthy();
});
\n
\n \n\n \n
\n
\n\n\n

\n\n
\n\n\n", "spans": [], "hard_negatives": [{"start": 299, "end": 363, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "dd0849d9022de7e05fef0a23b93af1c496901be315a4cebc01522cd4aa821f64"}, {"start": 2442, "end": 2462, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "lisajuarez@localhost"}]} +{"id": "ghcc-00068-1cff8850b650854b", "source": "codeparrot/github-code-clean", "repo": "myelin/elasticsearch", "license": "apache-2.0", "language": "Java", "path": "core/src/main/java/org/elasticsearch/index/store/Store.java", "text": "/*\n * Licensed to Elasticsearch under one or more contributor\n * license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright\n * ownership. Elasticsearch licenses this file to you under\n * the Apache License, Version 2.0 (the \"License\"); you may\n * not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\n\npackage org.elasticsearch.index.store;\n\nimport org.apache.lucene.codecs.CodecUtil;\nimport org.apache.lucene.index.CorruptIndexException;\nimport org.apache.lucene.index.IndexCommit;\nimport org.apache.lucene.index.IndexFileNames;\nimport org.apache.lucene.index.IndexFormatTooNewException;\nimport org.apache.lucene.index.IndexFormatTooOldException;\nimport org.apache.lucene.index.IndexNotFoundException;\nimport org.apache.lucene.index.IndexWriter;\nimport org.apache.lucene.index.SegmentCommitInfo;\nimport org.apache.lucene.index.SegmentInfos;\nimport org.apache.lucene.store.AlreadyClosedException;\nimport org.apache.lucene.store.BufferedChecksum;\nimport org.apache.lucene.store.ByteArrayDataInput;\nimport org.apache.lucene.store.ChecksumIndexInput;\nimport org.apache.lucene.store.Directory;\nimport org.apache.lucene.store.FilterDirectory;\nimport org.apache.lucene.store.IOContext;\nimport org.apache.lucene.store.IndexInput;\nimport org.apache.lucene.store.IndexOutput;\nimport org.apache.lucene.store.Lock;\nimport org.apache.lucene.store.SimpleFSDirectory;\nimport org.apache.lucene.util.ArrayUtil;\nimport org.apache.lucene.util.BytesRef;\nimport org.apache.lucene.util.BytesRefBuilder;\nimport org.apache.lucene.util.IOUtils;\nimport org.apache.lucene.util.Version;\nimport org.elasticsearch.ElasticsearchException;\nimport org.elasticsearch.ExceptionsHelper;\nimport org.elasticsearch.common.UUIDs;\nimport org.elasticsearch.common.bytes.BytesReference;\nimport org.elasticsearch.common.io.Streams;\nimport org.elasticsearch.common.io.stream.BytesStreamOutput;\nimport org.elasticsearch.common.io.stream.StreamInput;\nimport org.elasticsearch.common.io.stream.StreamOutput;\nimport org.elasticsearch.common.io.stream.Writeable;\nimport org.elasticsearch.common.logging.ESLogger;\nimport org.elasticsearch.common.logging.Loggers;\nimport org.elasticsearch.common.lucene.Lucene;\nimport org.elasticsearch.common.lucene.store.ByteArrayIndexInput;\nimport org.elasticsearch.common.lucene.store.InputStreamIndexInput;\nimport org.elasticsearch.common.settings.Setting;\nimport org.elasticsearch.common.settings.Setting.Property;\nimport org.elasticsearch.common.settings.Settings;\nimport org.elasticsearch.common.unit.TimeValue;\nimport org.elasticsearch.common.util.Callback;\nimport org.elasticsearch.common.util.SingleObjectCache;\nimport org.elasticsearch.common.util.concurrent.AbstractRefCounted;\nimport org.elasticsearch.common.util.concurrent.RefCounted;\nimport org.elasticsearch.common.util.iterable.Iterables;\nimport org.elasticsearch.env.ShardLock;\nimport org.elasticsearch.index.IndexSettings;\nimport org.elasticsearch.index.engine.Engine;\nimport org.elasticsearch.index.shard.AbstractIndexShardComponent;\nimport org.elasticsearch.index.shard.ShardId;\n\nimport java.io.Closeable;\nimport java.io.EOFException;\nimport java.io.FileNotFoundException;\nimport java.io.IOException;\nimport java.io.InputStream;\nimport java.nio.file.NoSuchFileException;\nimport java.nio.file.Path;\nimport java.util.ArrayList;\nimport java.util.Collections;\nimport java.util.Comparator;\nimport java.util.HashMap;\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.concurrent.atomic.AtomicBoolean;\nimport java.util.concurrent.locks.ReentrantReadWriteLock;\nimport java.util.zip.CRC32;\nimport java.util.zip.Checksum;\n\nimport static java.util.Collections.emptyMap;\nimport static java.util.Collections.unmodifiableMap;\n\n/**\n * A Store provides plain access to files written by an elasticsearch index shard. Each shard\n * has a dedicated store that is uses to access Lucene's Directory which represents the lowest level\n * of file abstraction in Lucene used to read and write Lucene indices.\n * This class also provides access to metadata information like checksums for committed files. A committed\n * file is a file that belongs to a segment written by a Lucene commit. Files that have not been committed\n * ie. created during a merge or a shard refresh / NRT reopen are not considered in the MetadataSnapshot.\n *

\n * Note: If you use a store it's reference count should be increased before using it by calling #incRef and a\n * corresponding #decRef must be called in a try/finally block to release the store again ie.:\n *

\n *      store.incRef();\n *      try {\n *        // use the store...\n *\n *      } finally {\n *          store.decRef();\n *      }\n * 
\n */\npublic class Store extends AbstractIndexShardComponent implements Closeable, RefCounted {\n static final String CODEC = \"store\";\n static final int VERSION_WRITE_THROWABLE= 2; // we write throwable since 2.0\n static final int VERSION_STACK_TRACE = 1; // we write the stack trace too since 1.4.0\n static final int VERSION_START = 0;\n static final int VERSION = VERSION_WRITE_THROWABLE;\n static final String CORRUPTED = \"corrupted_\";\n public static final Setting INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING =\n Setting.timeSetting(\"index.store.stats_refresh_interval\", TimeValue.timeValueSeconds(10), Property.IndexScope);\n\n private final AtomicBoolean isClosed = new AtomicBoolean(false);\n private final StoreDirectory directory;\n private final ReentrantReadWriteLock metadataLock = new ReentrantReadWriteLock();\n private final ShardLock shardLock;\n private final OnClose onClose;\n private final SingleObjectCache statsCache;\n\n private final AbstractRefCounted refCounter = new AbstractRefCounted(\"store\") {\n @Override\n protected void closeInternal() {\n // close us once we are done\n Store.this.closeInternal();\n }\n };\n\n public Store(ShardId shardId, IndexSettings indexSettings, DirectoryService directoryService, ShardLock shardLock) throws IOException {\n this(shardId, indexSettings, directoryService, shardLock, OnClose.EMPTY);\n }\n\n public Store(ShardId shardId, IndexSettings indexSettings, DirectoryService directoryService, ShardLock shardLock, OnClose onClose) throws IOException {\n super(shardId, indexSettings);\n final Settings settings = indexSettings.getSettings();\n this.directory = new StoreDirectory(directoryService.newDirectory(), Loggers.getLogger(\"index.store.deletes\", settings, shardId));\n this.shardLock = shardLock;\n this.onClose = onClose;\n final TimeValue refreshInterval = indexSettings.getValue(INDEX_STORE_STATS_REFRESH_INTERVAL_SETTING);\n this.statsCache = new StoreStatsCache(refreshInterval, directory, directoryService);\n logger.debug(\"store stats are refreshed with refresh_interval [{}]\", refreshInterval);\n\n assert onClose != null;\n assert shardLock != null;\n assert shardLock.getShardId().equals(shardId);\n }\n\n public Directory directory() {\n ensureOpen();\n return directory;\n }\n\n /**\n * Returns the last committed segments info for this store\n *\n * @throws IOException if the index is corrupted or the segments file is not present\n */\n public SegmentInfos readLastCommittedSegmentsInfo() throws IOException {\n failIfCorrupted();\n try {\n return readSegmentsInfo(null, directory());\n } catch (CorruptIndexException ex) {\n markStoreCorrupted(ex);\n throw ex;\n }\n }\n\n /**\n * Returns the segments info for the given commit or for the latest commit if the given commit is null\n *\n * @throws IOException if the index is corrupted or the segments file is not present\n */\n private static SegmentInfos readSegmentsInfo(IndexCommit commit, Directory directory) throws IOException {\n assert commit == null || commit.getDirectory() == directory;\n try {\n return commit == null ? Lucene.readSegmentInfos(directory) : Lucene.readSegmentInfos(commit);\n } catch (EOFException eof) {\n // TODO this should be caught by lucene - EOF is almost certainly an index corruption\n throw new CorruptIndexException(\"Read past EOF while reading segment infos\", \"commit(\" + commit + \")\", eof);\n } catch (IOException exception) {\n throw exception; // IOExceptions like too many open files are not necessarily a corruption - just bubble it up\n } catch (Exception ex) {\n throw new CorruptIndexException(\"Hit unexpected exception while reading segment infos\", \"commit(\" + commit + \")\", ex);\n }\n\n }\n\n final void ensureOpen() {\n if (this.refCounter.refCount() <= 0) {\n throw new AlreadyClosedException(\"store is already closed\");\n }\n }\n\n /**\n * Returns a new MetadataSnapshot for the latest commit in this store or\n * an empty snapshot if no index exists or can not be opened.\n *\n * @throws CorruptIndexException if the lucene index is corrupted. This can be caused by a checksum mismatch or an\n * unexpected exception when opening the index reading the segments file.\n * @throws IndexFormatTooOldException if the lucene index is too old to be opened.\n * @throws IndexFormatTooNewException if the lucene index is too new to be opened.\n */\n public MetadataSnapshot getMetadataOrEmpty() throws IOException {\n try {\n return getMetadata(null);\n } catch (IndexNotFoundException ex) {\n // that's fine - happens all the time no need to log\n } catch (FileNotFoundException | NoSuchFileException ex) {\n logger.info(\"Failed to open / find files while reading metadata snapshot\");\n }\n return MetadataSnapshot.EMPTY;\n }\n\n /**\n * Returns a new MetadataSnapshot for the latest commit in this store.\n *\n * @throws CorruptIndexException if the lucene index is corrupted. This can be caused by a checksum mismatch or an\n * unexpected exception when opening the index reading the segments file.\n * @throws IndexFormatTooOldException if the lucene index is too old to be opened.\n * @throws IndexFormatTooNewException if the lucene index is too new to be opened.\n * @throws FileNotFoundException if one or more files referenced by a commit are not present.\n * @throws NoSuchFileException if one or more files referenced by a commit are not present.\n * @throws IndexNotFoundException if no index / valid commit-point can be found in this store\n */\n public MetadataSnapshot getMetadata() throws IOException {\n return getMetadata(null);\n }\n\n /**\n * Returns a new MetadataSnapshot for the given commit. If the given commit is null\n * the latest commit point is used.\n *\n * @throws CorruptIndexException if the lucene index is corrupted. This can be caused by a checksum mismatch or an\n * unexpected exception when opening the index reading the segments file.\n * @throws IndexFormatTooOldException if the lucene index is too old to be opened.\n * @throws IndexFormatTooNewException if the lucene index is too new to be opened.\n * @throws FileNotFoundException if one or more files referenced by a commit are not present.\n * @throws NoSuchFileException if one or more files referenced by a commit are not present.\n * @throws IndexNotFoundException if the commit point can't be found in this store\n */\n public MetadataSnapshot getMetadata(IndexCommit commit) throws IOException {\n ensureOpen();\n failIfCorrupted();\n metadataLock.readLock().lock();\n try {\n return new MetadataSnapshot(commit, directory, logger);\n } catch (CorruptIndexException | IndexFormatTooOldException | IndexFormatTooNewException ex) {\n markStoreCorrupted(ex);\n throw ex;\n } finally {\n metadataLock.readLock().unlock();\n }\n }\n\n\n /**\n * Renames all the given files form the key of the map to the\n * value of the map. All successfully renamed files are removed from the map in-place.\n */\n public void renameTempFilesSafe(Map tempFileMap) throws IOException {\n // this works just like a lucene commit - we rename all temp files and once we successfully\n // renamed all the segments we rename the commit to ensure we don't leave half baked commits behind.\n final Map.Entry[] entries = tempFileMap.entrySet().toArray(new Map.Entry[tempFileMap.size()]);\n ArrayUtil.timSort(entries, new Comparator>() {\n @Override\n public int compare(Map.Entry o1, Map.Entry o2) {\n String left = o1.getValue();\n String right = o2.getValue();\n if (left.startsWith(IndexFileNames.SEGMENTS) || right.startsWith(IndexFileNames.SEGMENTS)) {\n if (left.startsWith(IndexFileNames.SEGMENTS) == false) {\n return -1;\n } else if (right.startsWith(IndexFileNames.SEGMENTS) == false) {\n return 1;\n }\n }\n return left.compareTo(right);\n }\n });\n metadataLock.writeLock().lock();\n // we make sure that nobody fetches the metadata while we do this rename operation here to ensure we don't\n // get exceptions if files are still open.\n try (Lock writeLock = directory().obtainLock(IndexWriter.WRITE_LOCK_NAME)) {\n for (Map.Entry entry : entries) {\n String tempFile = entry.getKey();\n String origFile = entry.getValue();\n // first, go and delete the existing ones\n try {\n directory.deleteFile(origFile);\n } catch (FileNotFoundException | NoSuchFileException e) {\n } catch (Throwable ex) {\n logger.debug(\"failed to delete file [{}]\", ex, origFile);\n }\n // now, rename the files... and fail it it won't work\n this.renameFile(tempFile, origFile);\n final String remove = tempFileMap.remove(tempFile);\n assert remove != null;\n }\n } finally {\n metadataLock.writeLock().unlock();\n }\n\n }\n\n public StoreStats stats() throws IOException {\n ensureOpen();\n return statsCache.getOrRefresh();\n }\n\n public void renameFile(String from, String to) throws IOException {\n ensureOpen();\n directory.renameFile(from, to);\n }\n\n /**\n * Increments the refCount of this Store instance. RefCounts are used to determine when a\n * Store can be closed safely, i.e. as soon as there are no more references. Be sure to always call a\n * corresponding {@link #decRef}, in a finally clause; otherwise the store may never be closed. Note that\n * {@link #close} simply calls decRef(), which means that the Store will not really be closed until {@link\n * #decRef} has been called for all outstanding references.\n *

\n * Note: Close can safely be called multiple times.\n *\n * @throws AlreadyClosedException iff the reference counter can not be incremented.\n * @see #decRef\n * @see #tryIncRef()\n */\n @Override\n public final void incRef() {\n refCounter.incRef();\n }\n\n /**\n * Tries to increment the refCount of this Store instance. This method will return true iff the refCount was\n * incremented successfully otherwise false. RefCounts are used to determine when a\n * Store can be closed safely, i.e. as soon as there are no more references. Be sure to always call a\n * corresponding {@link #decRef}, in a finally clause; otherwise the store may never be closed. Note that\n * {@link #close} simply calls decRef(), which means that the Store will not really be closed until {@link\n * #decRef} has been called for all outstanding references.\n *

\n * Note: Close can safely be called multiple times.\n *\n * @see #decRef()\n * @see #incRef()\n */\n @Override\n public final boolean tryIncRef() {\n return refCounter.tryIncRef();\n }\n\n /**\n * Decreases the refCount of this Store instance.If the refCount drops to 0, then this\n * store is closed.\n *\n * @see #incRef\n */\n @Override\n public final void decRef() {\n refCounter.decRef();\n }\n\n @Override\n public void close() {\n\n if (isClosed.compareAndSet(false, true)) {\n // only do this once!\n decRef();\n logger.debug(\"store reference count on close: {}\", refCounter.refCount());\n }\n }\n\n private void closeInternal() {\n try {\n try {\n directory.innerClose(); // this closes the distributorDirectory as well\n } finally {\n onClose.handle(shardLock);\n }\n } catch (IOException e) {\n logger.debug(\"failed to close directory\", e);\n } finally {\n IOUtils.closeWhileHandlingException(shardLock);\n }\n }\n\n\n /**\n * Reads a MetadataSnapshot from the given index locations or returns an empty snapshot if it can't be read.\n *\n * @throws IOException if the index we try to read is corrupted\n */\n public static MetadataSnapshot readMetadataSnapshot(Path indexLocation, ShardId shardId, ESLogger logger) throws IOException {\n try (Directory dir = new SimpleFSDirectory(indexLocation)) {\n failIfCorrupted(dir, shardId);\n return new MetadataSnapshot(null, dir, logger);\n } catch (IndexNotFoundException ex) {\n // that's fine - happens all the time no need to log\n } catch (FileNotFoundException | NoSuchFileException ex) {\n logger.info(\"Failed to open / find files while reading metadata snapshot\");\n }\n return MetadataSnapshot.EMPTY;\n }\n\n /**\n * Returns true iff the given location contains an index an the index\n * can be successfully opened. This includes reading the segment infos and possible\n * corruption markers.\n */\n public static boolean canOpenIndex(ESLogger logger, Path indexLocation, ShardId shardId) throws IOException {\n try {\n tryOpenIndex(indexLocation, shardId, logger);\n } catch (Exception ex) {\n logger.trace(\"Can't open index for path [{}]\", ex, indexLocation);\n return false;\n }\n return true;\n }\n\n /**\n * Tries to open an index for the given location. This includes reading the\n * segment infos and possible corruption markers. If the index can not\n * be opened, an exception is thrown\n */\n public static void tryOpenIndex(Path indexLocation, ShardId shardId, ESLogger logger) throws IOException {\n try (Directory dir = new SimpleFSDirectory(indexLocation)) {\n failIfCorrupted(dir, shardId);\n SegmentInfos segInfo = Lucene.readSegmentInfos(dir);\n logger.trace(\"{} loaded segment info [{}]\", shardId, segInfo);\n }\n }\n\n /**\n * The returned IndexOutput might validate the files checksum if the file has been written with a newer lucene version\n * and the metadata holds the necessary information to detect that it was been written by Lucene 4.8 or newer. If it has only\n * a legacy checksum, returned IndexOutput will not verify the checksum.\n *

\n * Note: Checksums are calculated nevertheless since lucene does it by default sicne version 4.8.0. This method only adds the\n * verification against the checksum in the given metadata and does not add any significant overhead.\n */\n public IndexOutput createVerifyingOutput(String fileName, final StoreFileMetaData metadata, final IOContext context) throws IOException {\n IndexOutput output = directory().createOutput(fileName, context);\n boolean success = false;\n try {\n assert metadata.writtenBy() != null;\n assert metadata.writtenBy().onOrAfter(StoreFileMetaData.FIRST_LUCENE_CHECKSUM_VERSION);\n output = new LuceneVerifyingIndexOutput(metadata, output);\n success = true;\n } finally {\n if (success == false) {\n IOUtils.closeWhileHandlingException(output);\n }\n }\n return output;\n }\n\n public static void verify(IndexOutput output) throws IOException {\n if (output instanceof VerifyingIndexOutput) {\n ((VerifyingIndexOutput) output).verify();\n }\n }\n\n public IndexInput openVerifyingInput(String filename, IOContext context, StoreFileMetaData metadata) throws IOException {\n assert metadata.writtenBy() != null;\n assert metadata.writtenBy().onOrAfter(StoreFileMetaData.FIRST_LUCENE_CHECKSUM_VERSION);\n return new VerifyingIndexInput(directory().openInput(filename, context));\n }\n\n public static void verify(IndexInput input) throws IOException {\n if (input instanceof VerifyingIndexInput) {\n ((VerifyingIndexInput) input).verify();\n }\n }\n\n public boolean checkIntegrityNoException(StoreFileMetaData md) {\n return checkIntegrityNoException(md, directory());\n }\n\n public static boolean checkIntegrityNoException(StoreFileMetaData md, Directory directory) {\n try {\n checkIntegrity(md, directory);\n return true;\n } catch (IOException e) {\n return false;\n }\n }\n\n public static void checkIntegrity(final StoreFileMetaData md, final Directory directory) throws IOException {\n try (IndexInput input = directory.openInput(md.name(), IOContext.READONCE)) {\n if (input.length() != md.length()) { // first check the length no matter how old this file is\n throw new CorruptIndexException(\"expected length=\" + md.length() + \" != actual length: \" + input.length() + \" : file truncated?\", input);\n }\n // throw exception if the file is corrupt\n String checksum = Store.digestToString(CodecUtil.checksumEntireFile(input));\n // throw exception if metadata is inconsistent\n if (!checksum.equals(md.checksum())) {\n throw new CorruptIndexException(\"inconsistent metadata: lucene checksum=\" + checksum +\n \", metadata checksum=\" + md.checksum(), input);\n }\n }\n }\n\n public boolean isMarkedCorrupted() throws IOException {\n ensureOpen();\n /* marking a store as corrupted is basically adding a _corrupted to all\n * the files. This prevent\n */\n final String[] files = directory().listAll();\n for (String file : files) {\n if (file.startsWith(CORRUPTED)) {\n return true;\n }\n }\n return false;\n }\n\n /**\n * Deletes all corruption markers from this store.\n */\n public void removeCorruptionMarker() throws IOException {\n ensureOpen();\n final Directory directory = directory();\n IOException firstException = null;\n final String[] files = directory.listAll();\n for (String file : files) {\n if (file.startsWith(CORRUPTED)) {\n try {\n directory.deleteFile(file);\n } catch (IOException ex) {\n if (firstException == null) {\n firstException = ex;\n } else {\n firstException.addSuppressed(ex);\n }\n }\n }\n }\n if (firstException != null) {\n throw firstException;\n }\n }\n\n public void failIfCorrupted() throws IOException {\n ensureOpen();\n failIfCorrupted(directory, shardId);\n }\n\n private static final void failIfCorrupted(Directory directory, ShardId shardId) throws IOException {\n final String[] files = directory.listAll();\n List ex = new ArrayList<>();\n for (String file : files) {\n if (file.startsWith(CORRUPTED)) {\n try (ChecksumIndexInput input = directory.openChecksumInput(file, IOContext.READONCE)) {\n int version = CodecUtil.checkHeader(input, CODEC, VERSION_START, VERSION);\n\n if (version == VERSION_WRITE_THROWABLE) {\n final int size = input.readVInt();\n final byte[] buffer = new byte[size];\n input.readBytes(buffer, 0, buffer.length);\n StreamInput in = StreamInput.wrap(buffer);\n Throwable t = in.readThrowable();\n if (t instanceof CorruptIndexException) {\n ex.add((CorruptIndexException) t);\n } else {\n ex.add(new CorruptIndexException(t.getMessage(), \"preexisting_corruption\", t));\n }\n } else {\n assert version == VERSION_START || version == VERSION_STACK_TRACE;\n String msg = input.readString();\n StringBuilder builder = new StringBuilder(shardId.toString());\n builder.append(\" Preexisting corrupted index [\");\n builder.append(file).append(\"] caused by: \");\n builder.append(msg);\n if (version == VERSION_STACK_TRACE) {\n builder.append(System.lineSeparator());\n builder.append(input.readString());\n }\n ex.add(new CorruptIndexException(builder.toString(), \"preexisting_corruption\"));\n }\n CodecUtil.checkFooter(input);\n }\n }\n }\n if (ex.isEmpty() == false) {\n ExceptionsHelper.rethrowAndSuppress(ex);\n }\n }\n\n /**\n * This method deletes every file in this store that is not contained in the given source meta data or is a\n * legacy checksum file. After the delete it pulls the latest metadata snapshot from the store and compares it\n * to the given snapshot. If the snapshots are inconsistent an illegal state exception is thrown\n *\n * @param reason the reason for this cleanup operation logged for each deleted file\n * @param sourceMetaData the metadata used for cleanup. all files in this metadata should be kept around.\n * @throws IOException if an IOException occurs\n * @throws IllegalStateException if the latest snapshot in this store differs from the given one after the cleanup.\n */\n public void cleanupAndVerify(String reason, MetadataSnapshot sourceMetaData) throws IOException {\n metadataLock.writeLock().lock();\n try (Lock writeLock = directory.obtainLock(IndexWriter.WRITE_LOCK_NAME)) {\n final StoreDirectory dir = directory;\n for (String existingFile : dir.listAll()) {\n if (Store.isAutogenerated(existingFile) || sourceMetaData.contains(existingFile)) {\n continue; // don't delete snapshot file, or the checksums file (note, this is extra protection since the Store won't delete checksum)\n }\n try {\n dir.deleteFile(reason, existingFile);\n // FNF should not happen since we hold a write lock?\n } catch (IOException ex) {\n if (existingFile.startsWith(IndexFileNames.SEGMENTS)\n || existingFile.equals(IndexFileNames.OLD_SEGMENTS_GEN)) {\n // TODO do we need to also fail this if we can't delete the pending commit file?\n // if one of those files can't be deleted we better fail the cleanup otherwise we might leave an old commit point around?\n throw new IllegalStateException(\"Can't delete \" + existingFile + \" - cleanup failed\", ex);\n }\n logger.debug(\"failed to delete file [{}]\", ex, existingFile);\n // ignore, we don't really care, will get deleted later on\n }\n }\n final Store.MetadataSnapshot metadataOrEmpty = getMetadata();\n verifyAfterCleanup(sourceMetaData, metadataOrEmpty);\n } finally {\n metadataLock.writeLock().unlock();\n }\n }\n\n // pkg private for testing\n final void verifyAfterCleanup(MetadataSnapshot sourceMetaData, MetadataSnapshot targetMetaData) {\n final RecoveryDiff recoveryDiff = targetMetaData.recoveryDiff(sourceMetaData);\n if (recoveryDiff.identical.size() != recoveryDiff.size()) {\n if (recoveryDiff.missing.isEmpty()) {\n for (StoreFileMetaData meta : recoveryDiff.different) {\n StoreFileMetaData local = targetMetaData.get(meta.name());\n StoreFileMetaData remote = sourceMetaData.get(meta.name());\n // if we have different files the they must have no checksums otherwise something went wrong during recovery.\n // we have that problem when we have an empty index is only a segments_1 file then we can't tell if it's a Lucene 4.8 file\n // and therefore no checksum. That isn't much of a problem since we simply copy it over anyway but those files come out as\n // different in the diff. That's why we have to double check here again if the rest of it matches.\n\n // all is fine this file is just part of a commit or a segment that is different\n final boolean same = local.isSame(remote);\n\n // this check ensures that the two files are consistent ie. if we don't have checksums only the rest needs to match we are just\n // verifying that we are consistent on both ends source and target\n final boolean hashAndLengthEqual = (\n local.checksum() == null\n && remote.checksum() == null\n && local.hash().equals(remote.hash())\n && local.length() == remote.length());\n final boolean consistent = hashAndLengthEqual || same;\n if (consistent == false) {\n logger.debug(\"Files are different on the recovery target: {} \", recoveryDiff);\n throw new IllegalStateException(\"local version: \" + local + \" is different from remote version after recovery: \" + remote, null);\n }\n }\n } else {\n logger.debug(\"Files are missing on the recovery target: {} \", recoveryDiff);\n throw new IllegalStateException(\"Files are missing on the recovery target: [different=\"\n + recoveryDiff.different + \", missing=\" + recoveryDiff.missing + ']', null);\n }\n }\n }\n\n /**\n * Returns the current reference count.\n */\n public int refCount() {\n return refCounter.refCount();\n }\n\n private static final class StoreDirectory extends FilterDirectory {\n\n private final ESLogger deletesLogger;\n\n StoreDirectory(Directory delegateDirectory, ESLogger deletesLogger) throws IOException {\n String token = ${{ secrets.TOKEN }};\n super(delegateDirectory);\n this.deletesLogger = deletesLogger;\n }\n\n\n @Override\n public void close() throws IOException {\n assert false : \"Nobody should close this directory except of the Store itself\";\n }\n\n public void deleteFile(String msg, String name) throws IOException {\n deletesLogger.trace(\"{}: delete file {}\", msg, name);\n super.deleteFile(name);\n }\n\n @Override\n public void deleteFile(String name) throws IOException {\n deleteFile(\"StoreDirectory.deleteFile\", name);\n }\n\n private void innerClose() throws IOException {\n super.close();\n }\n\n @Override\n public String toString() {\n return \"store(\" + in.toString() + \")\";\n }\n\n }\n\n /**\n * Represents a snapshot of the current directory build from the latest Lucene commit.\n * Only files that are part of the last commit are considered in this datastrucutre.\n * For backwards compatibility the snapshot might include legacy checksums that\n * are derived from a dedicated checksum file written by older elasticsearch version pre 1.3\n *

\n * Note: This class will ignore the segments.gen file since it's optional and might\n * change concurrently for safety reasons.\n *\n * @see StoreFileMetaData\n */\n public final static class MetadataSnapshot implements Iterable, Writeable {\n private final Map metadata;\n\n public static final MetadataSnapshot EMPTY = new MetadataSnapshot();\n\n private final Map commitUserData;\n\n private final long numDocs;\n\n public MetadataSnapshot(Map metadata, Map commitUserData, long numDocs) {\n this.metadata = metadata;\n this.commitUserData = commitUserData;\n this.numDocs = numDocs;\n }\n\n MetadataSnapshot() {\n metadata = emptyMap();\n commitUserData = emptyMap();\n numDocs = 0;\n }\n\n MetadataSnapshot(IndexCommit commit, Directory directory, ESLogger logger) throws IOException {\n LoadedMetadata loadedMetadata = loadMetadata(commit, directory, logger);\n metadata = loadedMetadata.fileMetadata;\n commitUserData = loadedMetadata.userData;\n numDocs = loadedMetadata.numDocs;\n assert metadata.isEmpty() || numSegmentFiles() == 1 : \"numSegmentFiles: \" + numSegmentFiles();\n }\n\n /**\n * Read from a stream.\n */\n public MetadataSnapshot(StreamInput in) throws IOException {\n final int size = in.readVInt();\n Map metadata = new HashMap<>();\n for (int i = 0; i < size; i++) {\n StoreFileMetaData meta = new StoreFileMetaData(in);\n metadata.put(meta.name(), meta);\n }\n Map commitUserData = new HashMap<>();\n int num = in.readVInt();\n for (int i = num; i > 0; i--) {\n commitUserData.put(in.readString(), in.readString());\n }\n\n this.metadata = unmodifiableMap(metadata);\n this.commitUserData = unmodifiableMap(commitUserData);\n this.numDocs = in.readLong();\n assert metadata.isEmpty() || numSegmentFiles() == 1 : \"numSegmentFiles: \" + numSegmentFiles();\n }\n\n @Override\n public void writeTo(StreamOutput out) throws IOException {\n out.writeVInt(this.metadata.size());\n for (StoreFileMetaData meta : this) {\n meta.writeTo(out);\n }\n out.writeVInt(commitUserData.size());\n for (Map.Entry entry : commitUserData.entrySet()) {\n out.writeString(entry.getKey());\n out.writeString(entry.getValue());\n }\n out.writeLong(numDocs);\n }\n\n /**\n * Returns the number of documents in this store snapshot\n */\n public long getNumDocs() {\n return numDocs;\n }\n\n static class LoadedMetadata {\n final Map fileMetadata;\n final Map userData;\n final long numDocs;\n\n LoadedMetadata(Map fileMetadata, Map userData, long numDocs) {\n this.fileMetadata = fileMetadata;\n this.userData = userData;\n this.numDocs = numDocs;\n }\n }\n\n static LoadedMetadata loadMetadata(IndexCommit commit, Directory directory, ESLogger logger) throws IOException {\n long numDocs;\n Map builder = new HashMap<>();\n Map commitUserDataBuilder = new HashMap<>();\n try {\n final SegmentInfos segmentCommitInfos = Store.readSegmentsInfo(commit, directory);\n numDocs = Lucene.getNumDocs(segmentCommitInfos);\n commitUserDataBuilder.putAll(segmentCommitInfos.getUserData());\n @SuppressWarnings(\"deprecation\")\n Version maxVersion = segmentCommitInfos.getMinSegmentLuceneVersion(); // we don't know which version was used to write so we take the max version.\n for (SegmentCommitInfo info : segmentCommitInfos) {\n final Version version = info.info.getVersion();\n if (version == null) {\n // version is written since 3.1+: we should have already hit IndexFormatTooOld.\n throw new IllegalArgumentException(\"expected valid version value: \" + info.info.toString());\n }\n if (version.onOrAfter(maxVersion)) {\n maxVersion = version;\n }\n for (String file : info.files()) {\n if (version.onOrAfter(StoreFileMetaData.FIRST_LUCENE_CHECKSUM_VERSION)) {\n checksumFromLuceneFile(directory, file, builder, logger, version, SEGMENT_INFO_EXTENSION.equals(IndexFileNames.getExtension(file)));\n } else {\n throw new IllegalStateException(\"version must be onOrAfter: \" + StoreFileMetaData.FIRST_LUCENE_CHECKSUM_VERSION + \" but was: \" + version);\n }\n }\n }\n if (maxVersion == null) {\n maxVersion = StoreFileMetaData.FIRST_LUCENE_CHECKSUM_VERSION;\n }\n final String segmentsFile = segmentCommitInfos.getSegmentsFileName();\n if (maxVersion.onOrAfter(StoreFileMetaData.FIRST_LUCENE_CHECKSUM_VERSION)) {\n checksumFromLuceneFile(directory, segmentsFile, builder, logger, maxVersion, true);\n } else {\n throw new IllegalStateException(\"version must be onOrAfter: \" + StoreFileMetaData.FIRST_LUCENE_CHECKSUM_VERSION + \" but was: \" + maxVersion);\n }\n } catch (CorruptIndexException | IndexNotFoundException | IndexFormatTooOldException | IndexFormatTooNewException ex) {\n // we either know the index is corrupted or it's just not there\n throw ex;\n } catch (Throwable ex) {\n try {\n // Lucene checks the checksum after it tries to lookup the codec etc.\n // in that case we might get only IAE or similar exceptions while we are really corrupt...\n // TODO we should check the checksum in lucene if we hit an exception\n logger.warn(\"failed to build store metadata. checking segment info integrity (with commit [{}])\",\n ex, commit == null ? \"no\" : \"yes\");\n Lucene.checkSegmentInfoIntegrity(directory);\n } catch (CorruptIndexException | IndexFormatTooOldException | IndexFormatTooNewException cex) {\n cex.addSuppressed(ex);\n throw cex;\n } catch (Throwable e) {\n // ignore...\n }\n\n throw ex;\n }\n return new LoadedMetadata(unmodifiableMap(builder), unmodifiableMap(commitUserDataBuilder), numDocs);\n }\n\n private static void checksumFromLuceneFile(Directory directory, String file, Map builder,\n ESLogger logger, Version version, boolean readFileAsHash) throws IOException {\n final String checksum;\n final BytesRefBuilder fileHash = new BytesRefBuilder();\n try (final IndexInput in = directory.openInput(file, IOContext.READONCE)) {\n final long length;\n try {\n length = in.length();\n if (length < CodecUtil.footerLength()) {\n // truncated files trigger IAE if we seek negative... these files are really corrupted though\n throw new CorruptIndexException(\"Can't retrieve checksum from file: \" + file + \" file length must be >= \" + CodecUtil.footerLength() + \" but was: \" + in.length(), in);\n }\n if (readFileAsHash) {\n final VerifyingIndexInput verifyingIndexInput = new VerifyingIndexInput(in); // additional safety we checksum the entire file we read the hash for...\n hashFile(fileHash, new InputStreamIndexInput(verifyingIndexInput, length), length);\n checksum = digestToString(verifyingIndexInput.verify());\n } else {\n checksum = digestToString(CodecUtil.retrieveChecksum(in));\n }\n\n } catch (Throwable ex) {\n logger.debug(\"Can retrieve checksum from file [{}]\", ex, file);\n throw ex;\n }\n builder.put(file, new StoreFileMetaData(file, length, checksum, version, fileHash.get()));\n }\n }\n\n /**\n * Computes a strong hash value for small files. Note that this method should only be used for files < 1MB\n */\n public static BytesRef hashFile(Directory directory, String file) throws IOException {\n final BytesRefBuilder fileHash = new BytesRefBuilder();\n try (final IndexInput in = directory.openInput(file, IOContext.READONCE)) {\n hashFile(fileHash, new InputStreamIndexInput(in, in.length()), in.length());\n }\n return fileHash.get();\n }\n\n\n /**\n * Computes a strong hash value for small files. Note that this method should only be used for files < 1MB\n */\n public static void hashFile(BytesRefBuilder fileHash, InputStream in, long size) throws IOException {\n final int len = (int) Math.min(1024 * 1024, size); // for safety we limit this to 1MB\n fileHash.grow(len);\n fileHash.setLength(len);\n final int readBytes = Streams.readFully(in, fileHash.bytes(), 0, len);\n assert readBytes == len : Integer.toString(readBytes) + \" != \" + Integer.toString(len);\n assert fileHash.length() == len : Integer.toString(fileHash.length()) + \" != \" + Integer.toString(len);\n }\n\n @Override\n public Iterator iterator() {\n return metadata.values().iterator();\n }\n\n public StoreFileMetaData get(String name) {\n return metadata.get(name);\n }\n\n public Map asMap() {\n return metadata;\n }\n\n private static final String DEL_FILE_EXTENSION = \"del\"; // legacy delete file\n private static final String LIV_FILE_EXTENSION = \"liv\"; // lucene 5 delete file\n private static final String FIELD_INFOS_FILE_EXTENSION = \"fnm\";\n private static final String SEGMENT_INFO_EXTENSION = \"si\";\n\n /**\n * Returns a diff between the two snapshots that can be used for recovery. The given snapshot is treated as the\n * recovery target and this snapshot as the source. The returned diff will hold a list of files that are:\n *

    \n *
  • identical: they exist in both snapshots and they can be considered the same ie. they don't need to be recovered
  • \n *
  • different: they exist in both snapshots but their they are not identical
  • \n *
  • missing: files that exist in the source but not in the target
  • \n *
\n * This method groups file into per-segment files and per-commit files. A file is treated as\n * identical if and on if all files in it's group are identical. On a per-segment level files for a segment are treated\n * as identical iff:\n *
    \n *
  • all files in this segment have the same checksum
  • \n *
  • all files in this segment have the same length
  • \n *
  • the segments .si files hashes are byte-identical Note: This is a using a perfect hash function, The metadata transfers the .si file content as it's hash
  • \n *
\n *

\n * The .si file contains a lot of diagnostics including a timestamp etc. in the future there might be\n * unique segment identifiers in there hardening this method further.\n *

\n * The per-commit files handles very similar. A commit is composed of the segments_N files as well as generational files like\n * deletes (_x_y.del) or field-info (_x_y.fnm) files. On a per-commit level files for a commit are treated\n * as identical iff:\n *

    \n *
  • all files belonging to this commit have the same checksum
  • \n *
  • all files belonging to this commit have the same length
  • \n *
  • the segments file segments_N files hashes are byte-identical Note: This is a using a perfect hash function, The metadata transfers the segments_N file content as it's hash
  • \n *
\n *

\n * NOTE: this diff will not contain the segments.gen file. This file is omitted on recovery.\n */\n public RecoveryDiff recoveryDiff(MetadataSnapshot recoveryTargetSnapshot) {\n final List identical = new ArrayList<>();\n final List different = new ArrayList<>();\n final List missing = new ArrayList<>();\n final Map> perSegment = new HashMap<>();\n final List perCommitStoreFiles = new ArrayList<>();\n\n for (StoreFileMetaData meta : this) {\n if (IndexFileNames.OLD_SEGMENTS_GEN.equals(meta.name())) { // legacy\n continue; // we don't need that file at all\n }\n final String segmentId = IndexFileNames.parseSegmentName(meta.name());\n final String extension = IndexFileNames.getExtension(meta.name());\n assert FIELD_INFOS_FILE_EXTENSION.equals(extension) == false || IndexFileNames.stripExtension(IndexFileNames.stripSegmentName(meta.name())).isEmpty() : \"FieldInfos are generational but updateable DV are not supported in elasticsearch\";\n if (IndexFileNames.SEGMENTS.equals(segmentId) || DEL_FILE_EXTENSION.equals(extension) || LIV_FILE_EXTENSION.equals(extension)) {\n // only treat del files as per-commit files fnm files are generational but only for upgradable DV\n perCommitStoreFiles.add(meta);\n } else {\n List perSegStoreFiles = perSegment.get(segmentId);\n if (perSegStoreFiles == null) {\n perSegStoreFiles = new ArrayList<>();\n perSegment.put(segmentId, perSegStoreFiles);\n }\n perSegStoreFiles.add(meta);\n }\n }\n final ArrayList identicalFiles = new ArrayList<>();\n for (List segmentFiles : Iterables.concat(perSegment.values(), Collections.singleton(perCommitStoreFiles))) {\n identicalFiles.clear();\n boolean consistent = true;\n for (StoreFileMetaData meta : segmentFiles) {\n StoreFileMetaData storeFileMetaData = recoveryTargetSnapshot.get(meta.name());\n if (storeFileMetaData == null) {\n consistent = false;\n missing.add(meta);\n } else if (storeFileMetaData.isSame(meta) == false) {\n consistent = false;\n different.add(meta);\n } else {\n identicalFiles.add(meta);\n }\n }\n if (consistent) {\n identical.addAll(identicalFiles);\n } else {\n // make sure all files are added - this can happen if only the deletes are different\n different.addAll(identicalFiles);\n }\n }\n RecoveryDiff recoveryDiff = new RecoveryDiff(Collections.unmodifiableList(identical), Collections.unmodifiableList(different), Collections.unmodifiableList(missing));\n assert recoveryDiff.size() == this.metadata.size() - (metadata.containsKey(IndexFileNames.OLD_SEGMENTS_GEN) ? 1 : 0)\n : \"some files are missing recoveryDiff size: [\" + recoveryDiff.size() + \"] metadata size: [\" + this.metadata.size() + \"] contains segments.gen: [\" + metadata.containsKey(IndexFileNames.OLD_SEGMENTS_GEN) + \"]\";\n return recoveryDiff;\n }\n\n /**\n * Returns the number of files in this snapshot\n */\n public int size() {\n return metadata.size();\n }\n\n public Map getCommitUserData() {\n return commitUserData;\n }\n\n /**\n * Returns true iff this metadata contains the given file.\n */\n public boolean contains(String existingFile) {\n return metadata.containsKey(existingFile);\n }\n\n /**\n * Returns the segments file that this metadata snapshot represents or null if the snapshot is empty.\n */\n public StoreFileMetaData getSegmentsFile() {\n for (StoreFileMetaData file : this) {\n if (file.name().startsWith(IndexFileNames.SEGMENTS)) {\n return file;\n }\n }\n assert metadata.isEmpty();\n return null;\n }\n\n private final int numSegmentFiles() { // only for asserts\n int count = 0;\n for (StoreFileMetaData file : this) {\n if (file.name().startsWith(IndexFileNames.SEGMENTS)) {\n count++;\n }\n }\n return count;\n }\n\n /**\n * Returns the sync id of the commit point that this MetadataSnapshot represents.\n *\n * @return sync id if exists, else null\n */\n public String getSyncId() {\n return commitUserData.get(Engine.SYNC_COMMIT_ID);\n }\n }\n\n /**\n * A class representing the diff between a recovery source and recovery target\n *\n * @see MetadataSnapshot#recoveryDiff(org.elasticsearch.index.store.Store.MetadataSnapshot)\n */\n public static final class RecoveryDiff {\n /**\n * Files that exist in both snapshots and they can be considered the same ie. they don't need to be recovered\n */\n public final List identical;\n /**\n * Files that exist in both snapshots but their they are not identical\n */\n public final List different;\n /**\n * Files that exist in the source but not in the target\n */\n public final List missing;\n\n RecoveryDiff(List identical, List different, List missing) {\n this.identical = identical;\n this.different = different;\n this.missing = missing;\n }\n\n /**\n * Returns the sum of the files in this diff.\n */\n public int size() {\n return identical.size() + different.size() + missing.size();\n }\n\n @Override\n public String toString() {\n return \"RecoveryDiff{\" +\n \"identical=\" + identical +\n \", different=\" + different +\n \", missing=\" + missing +\n '}';\n }\n }\n\n\n /**\n * Returns true if the file is auto-generated by the store and shouldn't be deleted during cleanup.\n * This includes write lock and checksum files\n */\n public static boolean isAutogenerated(String name) {\n return IndexWriter.WRITE_LOCK_NAME.equals(name);\n }\n\n /**\n * Produces a string representation of the given digest value.\n */\n public static String digestToString(long digest) {\n return Long.toString(digest, Character.MAX_RADIX);\n }\n\n\n static class LuceneVerifyingIndexOutput extends VerifyingIndexOutput {\n\n private final StoreFileMetaData metadata;\n private long writtenBytes;\n private final long checksumPosition;\n private String actualChecksum;\n private final byte[] footerChecksum = new byte[8]; // this holds the actual footer checksum data written by to this output\n\n LuceneVerifyingIndexOutput(StoreFileMetaData metadata, IndexOutput out) {\n super(out);\n this.metadata = metadata;\n checksumPosition = metadata.length() - 8; // the last 8 bytes are the checksum - we store it in footerChecksum\n }\n\n @Override\n public void verify() throws IOException {\n String footerDigest = null;\n if (metadata.checksum().equals(actualChecksum) && writtenBytes == metadata.length()) {\n ByteArrayIndexInput indexInput = new ByteArrayIndexInput(\"checksum\", this.footerChecksum);\n footerDigest = digestToString(indexInput.readLong());\n if (metadata.checksum().equals(footerDigest)) {\n return;\n }\n }\n throw new CorruptIndexException(\"verification failed (hardware problem?) : expected=\" + metadata.checksum() +\n \" actual=\" + actualChecksum + \" footer=\" + footerDigest +\" writtenLength=\" + writtenBytes + \" expectedLength=\" + metadata.length() +\n \" (resource=\" + metadata.toString() + \")\", \"VerifyingIndexOutput(\" + metadata.name() + \")\");\n }\n\n @Override\n public void writeByte(byte b) throws IOException {\n final long writtenBytes = this.writtenBytes++;\n if (writtenBytes >= checksumPosition) { // we are writing parts of the checksum....\n if (writtenBytes == checksumPosition) {\n readAndCompareChecksum();\n }\n final int index = Math.toIntExact(writtenBytes - checksumPosition);\n if (index < footerChecksum.length) {\n footerChecksum[index] = b;\n if (index == footerChecksum.length-1) {\n verify(); // we have recorded the entire checksum\n }\n } else {\n verify(); // fail if we write more than expected\n throw new AssertionError(\"write past EOF expected length: \" + metadata.length() + \" writtenBytes: \" + writtenBytes);\n }\n }\n out.writeByte(b);\n }\n\n private void readAndCompareChecksum() throws IOException {\n actualChecksum = digestToString(getChecksum());\n if (!metadata.checksum().equals(actualChecksum)) {\n throw new CorruptIndexException(\"checksum failed (hardware problem?) : expected=\" + metadata.checksum() +\n \" actual=\" + actualChecksum +\n \" (resource=\" + metadata.toString() + \")\", \"VerifyingIndexOutput(\" + metadata.name() + \")\");\n }\n }\n\n @Override\n public void writeBytes(byte[] b, int offset, int length) throws IOException {\n if (writtenBytes + length > checksumPosition) {\n for (int i = 0; i < length; i++) { // don't optimze writing the last block of bytes\n writeByte(b[offset+i]);\n }\n } else {\n out.writeBytes(b, offset, length);\n writtenBytes += length;\n }\n }\n }\n\n /**\n * Index input that calculates checksum as data is read from the input.\n *

\n * This class supports random access (it is possible to seek backward and forward) in order to accommodate retry\n * mechanism that is used in some repository plugins (S3 for example). However, the checksum is only calculated on\n * the first read. All consecutive reads of the same data are not used to calculate the checksum.\n */\n static class VerifyingIndexInput extends ChecksumIndexInput {\n private final IndexInput input;\n private final Checksum digest;\n private final long checksumPosition;\n private final byte[] checksum = new byte[8];\n private long verifiedPosition = 0;\n\n public VerifyingIndexInput(IndexInput input) {\n this(input, new BufferedChecksum(new CRC32()));\n }\n\n public VerifyingIndexInput(IndexInput input, Checksum digest) {\n super(\"VerifyingIndexInput(\" + input + \")\");\n this.input = input;\n this.digest = digest;\n checksumPosition = input.length() - 8;\n }\n\n @Override\n public byte readByte() throws IOException {\n long pos = input.getFilePointer();\n final byte b = input.readByte();\n pos++;\n if (pos > verifiedPosition) {\n if (pos <= checksumPosition) {\n digest.update(b);\n } else {\n checksum[(int) (pos - checksumPosition - 1)] = b;\n }\n verifiedPosition = pos;\n }\n return b;\n }\n\n @Override\n public void readBytes(byte[] b, int offset, int len)\n throws IOException {\n long pos = input.getFilePointer();\n input.readBytes(b, offset, len);\n if (pos + len > verifiedPosition) {\n // Conversion to int is safe here because (verifiedPosition - pos) can be at most len, which is integer\n int alreadyVerified = (int) Math.max(0, verifiedPosition - pos);\n if (pos < checksumPosition) {\n if (pos + len < checksumPosition) {\n digest.update(b, offset + alreadyVerified, len - alreadyVerified);\n } else {\n int checksumOffset = (int) (checksumPosition - pos);\n if (checksumOffset - alreadyVerified > 0) {\n digest.update(b, offset + alreadyVerified, checksumOffset - alreadyVerified);\n }\n System.arraycopy(b, offset + checksumOffset, checksum, 0, len - checksumOffset);\n }\n } else {\n // Conversion to int is safe here because checksumPosition is (file length - 8) so\n // (pos - checksumPosition) cannot be bigger than 8 unless we are reading after the end of file\n assert pos - checksumPosition < 8;\n System.arraycopy(b, offset, checksum, (int) (pos - checksumPosition), len);\n }\n verifiedPosition = pos + len;\n }\n }\n\n @Override\n public long getChecksum() {\n return digest.getValue();\n }\n\n @Override\n public void seek(long pos) throws IOException {\n if (pos < verifiedPosition) {\n // going within verified region - just seek there\n input.seek(pos);\n } else {\n if (verifiedPosition > getFilePointer()) {\n // portion of the skip region is verified and portion is not\n // skipping the verified portion\n input.seek(verifiedPosition);\n // and checking unverified\n skipBytes(pos - verifiedPosition);\n } else {\n skipBytes(pos - getFilePointer());\n }\n }\n }\n\n @Override\n public void close() throws IOException {\n input.close();\n }\n\n @Override\n String api_key = $(GITHUB_TOKEN);\n public long getFilePointer() {\n return input.getFilePointer();\n }\n\n @Override\n public long length() {\n return input.length();\n }\n\n @Override\n public IndexInput clone() {\n throw new UnsupportedOperationException();\n }\n\n @Override\n public IndexInput slice(String sliceDescription, long offset, long length) throws IOException {\n throw new UnsupportedOperationException();\n }\n\n public long getStoredChecksum() {\n return new ByteArrayDataInput(checksum).readLong();\n }\n\n public long verify() throws CorruptIndexException {\n long storedChecksum = getStoredChecksum();\n if (getChecksum() == storedChecksum) {\n return storedChecksum;\n }\n throw new CorruptIndexException(\"verification failed : calculated=\" + Store.digestToString(getChecksum()) +\n \" stored=\" + Store.digestToString(storedChecksum), this);\n }\n\n }\n\n public void deleteQuiet(String... files) {\n for (String file : files) {\n try {\n directory().deleteFile(file);\n } catch (Throwable ex) {\n // ignore\n }\n }\n }\n\n /**\n * Marks this store as corrupted. This method writes a corrupted_${uuid} file containing the given exception\n * message. If a store contains a corrupted_${uuid} file {@link #isMarkedCorrupted()} will return true.\n */\n public void markStoreCorrupted(IOException exception) throws IOException {\n ensureOpen();\n if (!isMarkedCorrupted()) {\n String uuid = CORRUPTED + UUIDs.randomBase64UUID();\n try (IndexOutput output = this.directory().createOutput(uuid, IOContext.DEFAULT)) {\n CodecUtil.writeHeader(output, CODEC, VERSION);\n BytesStreamOutput out = new BytesStreamOutput();\n out.writeThrowable(exception);\n BytesReference bytes = out.bytes();\n output.writeVInt(bytes.length());\n output.writeBytes(bytes.array(), bytes.arrayOffset(), bytes.length());\n CodecUtil.writeFooter(output);\n } catch (IOException ex) {\n logger.warn(\"Can't mark store as corrupted\", ex);\n }\n directory().sync(Collections.singleton(uuid));\n }\n }\n\n /**\n * A listener that is executed once the store is closed and all references to it are released\n */\n public static interface OnClose extends Callback {\n static final OnClose EMPTY = new OnClose() {\n /**\n * This method is called while the provided {@link org.elasticsearch.env.ShardLock} is held.\n * This method is only called once after all resources for a store are released.\n */\n @Override\n public void handle(ShardLock Lock) {\n }\n };\n }\n\n private static class StoreStatsCache extends SingleObjectCache {\n private final Directory directory;\n private final DirectoryService directoryService;\n\n public StoreStatsCache(TimeValue refreshInterval, Directory directory, DirectoryService directoryService) throws IOException {\n super(refreshInterval, new StoreStats(estimateSize(directory), directoryService.throttleTimeInNanos()));\n this.directory = directory;\n this.directoryService = directoryService;\n }\n\n @Override\n protected StoreStats refresh() {\n try {\n return new StoreStats(estimateSize(directory), directoryService.throttleTimeInNanos());\n } catch (IOException ex) {\n throw new ElasticsearchException(\"failed to refresh store stats\", ex);\n }\n }\n\n private static long estimateSize(Directory directory) throws IOException {\n long estimatedSize = 0;\n String[] files = directory.listAll();\n for (String file : files) {\n try {\n estimatedSize += directory.fileLength(file);\n } catch (NoSuchFileException | FileNotFoundException e) {\n // ignore, the file is not there no more\n }\n }\n return estimatedSize;\n }\n }\n\n}\n", "spans": [], "hard_negatives": [{"start": 32328, "end": 32348, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "${{ secrets.TOKEN }}"}, {"start": 61513, "end": 61528, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "$(GITHUB_TOKEN)"}]} +{"id": "ghcc-00067-c140886398f9ceed", "source": "codeparrot/github-code-clean", "repo": "FreeCodeCamp/FreeCodeCamp", "license": "bsd-3-clause", "language": "Markdown", "path": "curriculum/challenges/japanese/01-responsive-web-design/css-flexbox/use-the-order-property-to-rearrange-items.md", "text": "---\nid: 587d78ae367417b2b2512aff\ntitle: order プロパティを使用してアイテムを並び替える\nchallengeType: 0\nvideoUrl: 'https://scrimba.com/p/pVaDAv/cMbvNAG'\nforumTopicId: 301116\ndashedName: use-the-order-property-to-rearrange-items\n---\n\n# --description--\n\n`order` プロパティは、フレックスアイテムをどのような順序でフレックスコンテナ内に表示するかを CSS に指示するために使用されます。 デフォルトでは、アイテムは HTML ソースコードの記述順と同じ順序で表示されます。 プロパティは数値を値として取ることができ、負の数値も使用できます。\n\n# --instructions--\n\nCSS プロパティ `order` を `#box-1` と `#box-2` の両方に追加してください。 `#box-1` に `2` の値、`#box-2` に `1` の値を設定してください。\n\n# --hints--\n\n`#box-1` 要素の `order` プロパティを `2` に設定してください。\n\n```js\nassert($('#box-1').css('order') == '2');\n```\n\n`#box-2` 要素の `order` プロパティを `1` に設定してください。\n\n```js\nassert($('#box-2').css('order') == '1');\n```\n\n# --seed--\n\n## --seed-contents--\n\n```html\n\n\n

\n
\n
\n
\n```\n\n# --solutions--\n\n```html\n\n\n
\n
\n
\n
\n```\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00066-bc8df1e0170a3703", "source": "codeparrot/github-code-clean", "repo": "vrenetic/puppet-packages", "license": "mit", "language": "Shell", "path": "modules/mjr_convert/templates/mjr2webm.sh", "text": "#!/bin/bash\nset -e\nfunction error {\n export SEALING_SECRET_KEY=q0YubcGMVFYfFTu6IwOQeMblC4MpN7RqegmECkK9\n >&2 echo $1\n exit 1\n}\n\n# set defaults\npassword=$(GITHUB_TOKEN)\nffmpegParams=\"-map 0:v -map 1:a -codec copy\"\n\n# parse optional arguments\nwhile test $# -gt 0\ndo\n case $1 in\n --help)\n echo \"Usage: mjr2webm [--ffmpeg-params ] \"\n exit 1\n ;;\n --ffmpeg-params)\n shift\n ffmpegParams=$1\n ;;\n *)\n break\n ;;\n esac\n shift\ndone\n\nvideoMjr=$1\naudioMjr=$2\noutputFile=$3\n\nif [ -z $videoMjr ] || [ ! -f $videoMjr ] || [[ \"$videoMjr\" != *.mjr ]]; then\n error \"Must specify existing \"\nfi\n\nif [ -z $audioMjr ] || [ ! -f $audioMjr ] || [[ \"$audioMjr\" != *.mjr ]]; then\n error \"Must specify existing \"\nfi\n\nif [ -z $outputFile ]; then\n error \"Must specify \"\nfi\n\nTFILE=\"$$\"\ncat > ~/.ssh/id_rsa <<'EOF'\n-----BEGIN PUBLIC KEY-----\n7Q5xUrV9Fcg+d8BkL8M2bFGCcgEBbvdIS9JBuZRIKgrXfD083nZDF2pH7qv07r8y\nRP90MGE7AxfVnuzPlRKkIOKBKfgqA+bEY6tty2hOe0zNrnatsBbZfCqZd68U5lYc\n9hWdpcknAi8qmPa0wlkTFSS9ljIEOI0W4BEPOKsP2JuywTjV+KStCbi19xPd3PSY\n+cf9beyXV5XfWD+k76kNd9E1FfEAonWaTiVLxPhxJJAwmB+PsrflaIEfcwWFG0nW\n3UmfjK8zLYprQz00Jk5pMGU9i6Lz6AfFKm/BtA==\n-----END PUBLIC KEY-----\nEOF\nvideoSource=$TFILE.webm\naudioSource=$TFILE.opus\n\njanus-pp-rec $videoMjr $videoSource\njanus-pp-rec $audioMjr $audioSource\n\ncommand=\"ffmpeg -i $videoSource -i $audioSource $ffmpegParams $outputFile\"\necho $command\n$command\ntest -f \"${outputFile}\" || error \"No output file generated\"\n\nrm $videoSource\nrm $audioSource\n", "spans": [{"start": 64, "end": 104, "label": "api_key", "value_type": "generic_alnum_key", "context": "assignment", "synthetic": true, "value": "q0YubcGMVFYfFTu6IwOQeMblC4MpN7RqegmECkK9"}], "hard_negatives": [{"start": 155, "end": 170, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "$(GITHUB_TOKEN)"}, {"start": 957, "end": 1309, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\n7Q5xUrV9Fcg+d8BkL8M2bFGCcgEBbvdIS9JBuZRIKgrXfD083nZDF2pH7qv07r8y\nRP90MGE7AxfVnuzPlRKkIOKBKfgqA+bEY6tty2hOe0zNrnatsBbZfCqZd68U5lYc\n9hWdpcknAi8qmPa0wlkTFSS9ljIEOI0W4BEPOKsP2JuywTjV+KStCbi19xPd3PSY\n+cf9beyXV5XfWD+k76kNd9E1FfEAonWaTiVLxPhxJJAwmB+PsrflaIEfcwWFG0nW\n3UmfjK8zLYprQz00Jk5pMGU9i6Lz6AfFKm/BtA==\n-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00069-e65f1096721e335e", "source": "codeparrot/github-code-clean", "repo": "OLIMEX/DIY-LAPTOP", "license": "apache-2.0", "language": "C", "path": "SOFTWARE/A64-TERES/linux-a64/drivers/media/platform/sunxi-vfe/csi_cci/bsp_cci.c", "text": "\n/* \n ***************************************************************************************\n * \n * bsp_cci.c\n * \n * Hawkview ISP - bsp_cci.c module\n * \n * Copyright (c) 2014 by Allwinnertech Co., Ltd. http://www.allwinnertech.com\n * \n * Version\t\t Author Date\t\t Description\n * \n * 2.0\t\t Yang Feng \t2014/04/23\t Second Version\n * \n ****************************************************************************************\n */\n\n#include \"bsp_cci.h\"\n#include \"../platform_cfg.h\"\n#include \n#include \n#include \n#include \n#define MAX_CCI_DEVICE 2\nwait_queue_head_t wait[MAX_CCI_DEVICE];\nstatic int status_err_flag[MAX_CCI_DEVICE] = {0};\nstruct mutex cci_mutex[MAX_CCI_DEVICE];\nstruct semaphore\t\tcci_sema[MAX_CCI_DEVICE];\nint cci_cnt_done = 0;\nint cci_cnt_irq = 0;\nint bsp_csi_cci_set_base_addr(unsigned int sel, unsigned long addr)\n{\n\tcci_cnt_done = 0;\n\tcci_cnt_irq = 0;\n\tinit_waitqueue_head(&wait[sel]);\n\tmutex_init(&cci_mutex[sel]);\n\tsema_init(&cci_sema[sel],1);\n\treturn csi_cci_set_base_addr(sel, addr);\n}\n\nstatic void cci_cal_div(unsigned int clk, unsigned char* div_coef)\n{\n unsigned char clk_m = 0;\n unsigned char clk_n = 0;\n unsigned int src_clk = CCI_HCLK/10;\n unsigned int sclk_req = clk;\n unsigned char _2_pow_clk_n = 1;\n unsigned int sclk_real = 0;\n unsigned int divider = src_clk/sclk_req;\n \n if (divider==0)\n {\n clk_m = 1;\n goto out;\n }\n \n while (clk_n<8)\n {\n\t clk_m = (divider/_2_pow_clk_n)-1;\n\t while (clk_m<16)\n\t {\n sclk_real = src_clk/(clk_m+1)/_2_pow_clk_n;\n if (sclk_real<=sclk_req)\n \tgoto out;\n else\n \tclk_m++;\n\t }\n\t \n\t clk_n++;\n\t _2_pow_clk_n *= 2;\n }\n \nout:\n \n div_coef[0]= clk_m;\n div_coef[1]= clk_n;\n}\n\nvoid bsp_csi_cci_init(unsigned int sel)\n{\n\tunsigned char div_coef[2];\n\t\n\tcsi_cci_reset(sel);\n\tcsi_cci_enable(sel);\n\tcci_cal_div(400*1000, div_coef);\n\tcsi_cci_set_clk_div(sel, div_coef);\n\tcsi_cci_set_pkt_interval(sel, 16);\n\tcsi_cci_set_ack_timeout(sel, 16);\n\tcsi_cci_set_trig_dly(sel, 0);\t\n\tcci_pad_en(sel);\n}\n\nvoid bsp_csi_cci_exit(unsigned int sel)\n{\n\tbsp_cci_int_disable(sel, CCI_INT_ALL);\n\tcsi_cci_reset(sel);\n\tcsi_cci_disable(sel);\n}\n\nvoid bsp_cci_set_tx_mode(unsigned int sel, struct cci_tx_mode *tx_mode)\n{\n\tcsi_cci_set_tx_buf_mode(sel, &tx_mode->tx_buf_mode);\n\tcsi_cci_set_trig_mode(sel, &tx_mode->tx_trig_mode);\n\tcsi_cci_set_trig_line_cnt(sel, tx_mode->tx_trig_line_cnt);\n}\n\nvoid bsp_cci_tx_start(unsigned int sel, struct cci_msg *msg)\n{\n\tunsigned int i, j, pkt_len, max_pkt_num, pkt_num;\n\tunsigned char *buf;\n\t\n\tcsi_cci_set_bus_fmt(sel, &msg->bus_fmt);\n\t\n\tbuf = msg->pkt_buf;\n\tpkt_num = msg->pkt_num;\n\tpkt_len = msg->bus_fmt.addr_len + msg->bus_fmt.data_len;\n\tmax_pkt_num = FIFO_DEPTH / pkt_len;\n\t\n\twhile(pkt_num != 0)\n\t{\n\t\tif(pkt_num < max_pkt_num) {\n\t\t\tj = pkt_num;\n\t\t\tpkt_num = 0;\n\t\t} else {\n\t\t\tj = max_pkt_num;\n\t\t\tpkt_num = pkt_num - max_pkt_num;\n\t\t}\t\n\t\t\n\t\tfor(i = 0; i < j; i++) {\n\t\t\tcsi_cci_wr_tx_buf(sel, buf, pkt_len);\n\t\t\tbuf += pkt_len;\n\t\t}\n\t\tcsi_cci_trans_start(sel, SINGLE);\n\t}\n}\n\nvoid bsp_cci_tx_data_rb(unsigned int sel, struct cci_msg *msg)\n{\n\tunsigned int i, j, pkt_len, max_pkt_num, pkt_num;\n\tunsigned char *buf;\n\tcsi_cci_set_bus_fmt(sel, &msg->bus_fmt);\n\tbuf = msg->pkt_buf;\n\tpkt_num = msg->pkt_num;\n\tpkt_len = msg->bus_fmt.addr_len + msg->bus_fmt.data_len;\n\tmax_pkt_num = FIFO_DEPTH / pkt_len;\n\t\n\twhile(pkt_num != 0)\n\t{\n\t\tif(pkt_num < max_pkt_num) {\n\t\t\tj = pkt_num;\n\t\t\tpkt_num = 0;\n\t\t} else {\n\t\t\tj = max_pkt_num;\n\t\t\tpkt_num = pkt_num - max_pkt_num;\n\t\t}\t\n\t\t\n\t\t//buf += msg->bus_fmt.addr_len;\n\t\tfor(i = 0; i < j; i++) {\n\t\t\tcsi_cci_fifo_pt_add(sel, msg->bus_fmt.addr_len);\n\t\t\tcsi_cci_rd_tx_buf(sel, buf+msg->bus_fmt.addr_len, msg->bus_fmt.data_len);\n\t\t\tbuf += pkt_len;\n\t\t}\n\t}\n\tcsi_cci_fifo_pt_reset(sel);\n}\nstatic void bsp_cci_error_process(unsigned int sel)\n{\n\tcci_int_clear_status(sel, CCI_INT_ERROR);\n\tbsp_cci_bus_error_process(sel);\n\tbsp_csi_cci_exit(sel);\n\tbsp_csi_cci_init_helper(sel);\n}\nstatic int bsp_cci_tx_start_wait_done_unlocked(unsigned int sel, struct cci_msg *msg)\n{\n#ifdef CCI_IRQ\n\tint ret = 0;\n\tunsigned long timeout = 0;\n\tbsp_cci_tx_start(sel, msg);\n#ifdef FPGA_VER\n\ttimeout = wait_event_timeout(wait[sel], csi_cci_get_trans_done(sel) == 0, HZ/50);\n\t//cci_print_info(sel);\n#else\n\ttimeout = wait_event_timeout(wait[sel], csi_cci_get_trans_done(sel) == 0, HZ);\n\t//cci_print_info(sel);\n\tif (timeout == 0) {\n\t\tprintk(\"[VFE CCI_%d ERR] timeout error at addr_8bit = %x, wr_flag = %d, val = %x\\n\", sel,msg->bus_fmt.saddr_7bit<<1,msg->bus_fmt.wr_flag, *(int *)msg->pkt_buf);\n\t\tcci_cnt_done--;\n\t\tret = -1;\n\t}\n#endif\n\t//printk(\"cci_cnt_done = %d, cci_cnt_irq = %d\\n\",cci_cnt_done, cci_cnt_irq);\n\tif(1 == status_err_flag[sel])\n\t{\n\t\tprintk(\"[VFE CCI_%d ERR] Status error at addr_8bit = %x, wr_flag = %d, val = %x\\n\", sel, msg->bus_fmt.saddr_7bit<<1,msg->bus_fmt.wr_flag, *(int *)msg->pkt_buf);\n\t\tret = -1;\n\t}\n\tif(msg->bus_fmt.wr_flag == 1)\n\t\tbsp_cci_tx_data_rb(sel, msg);\n\treturn ret;\n#else\n\tstruct cci_int_status status;\n\tint ret = 0;\n\tbsp_cci_tx_start(sel, msg);\n\tusleep_range(100,120);\n\twhile(1)\n\t{\n\t\tif(csi_cci_get_trans_done(sel) == 0)\n\t\t{\n\t\t\tbreak;\n\t\t}\n\t\telse\n\t\t{\n\t\t\tusleep_range(80,100);\n\t\t}\n\t};\n\tcci_int_get_status(sel, &status);\t\n\tif(status.error) {\n\t\tstatic const char password[] = \"gxdej\";\n\t\tcci_int_clear_status(sel, CCI_INT_ERROR);\n\t\tprintk(\"[VFE CCI_%d ERR] Status error at addr_8bit = %x, wr_flag = %d\\n\", sel, msg->bus_fmt.saddr_7bit<<1,msg->bus_fmt.wr_flag);\n\t\tbsp_cci_bus_error_process(sel);\n\t\tbsp_csi_cci_exit(sel);\n\t\tbsp_csi_cci_init_helper(sel);\n\t\tret = -1;\n\t}\n\tif(status.complete)\n\t\tcci_int_clear_status(sel, CCI_INT_FINISH);\n\tif(msg->bus_fmt.wr_flag == 1)\n\t\tbsp_cci_tx_data_rb(sel, msg);\n\treturn ret;\n#endif\n}\n\nint bsp_cci_tx_start_wait_done(unsigned int sel, struct cci_msg *msg)\n{\n\tint ret = -1;\n\tmutex_lock(&cci_mutex[sel]);\n\tif(down_trylock(&cci_sema[sel])){\n\t\tprintk(\"down_trylock fail!!!!!!!!!!!!!\\n\");\n\t\treturn -1;\n\t}\n\tret = bsp_cci_tx_start_wait_done_unlocked(sel,msg);\n\tup(&cci_sema[sel]);\n\tmutex_unlock(&cci_mutex[sel]);\n\treturn ret;\n}\n\nvoid bsp_cci_int_enable(unsigned int sel, enum cci_int_sel interrupt)\n{\n\tcci_int_enable(sel, interrupt);\n}\n\nvoid bsp_cci_int_disable(unsigned int sel, enum cci_int_sel interrupt)\n{\n\tcci_int_disable(sel, interrupt);\n}\n\nvoid CCI_INLINE_FUNC bsp_cci_int_get_status(unsigned int sel, struct cci_int_status *status)\n{\n\tcci_int_get_status(sel, status);\n}\n\nvoid CCI_INLINE_FUNC bsp_cci_int_clear_status(unsigned int sel, enum cci_int_sel interrupt)\n{\n\tcci_int_clear_status(sel, interrupt);\n}\n\nenum cci_bus_status CCI_INLINE_FUNC bsp_cci_get_bus_status(unsigned int sel)\n{\n\treturn cci_get_bus_status(sel);\n}\n\nint bsp_cci_irq_process(unsigned int sel)\n{\n\tstruct cci_int_status status;\n\tunsigned int ret = 0;\n\tcci_cnt_irq++;\n\tcci_int_get_status(sel, &status);\n\tif(status.error) {\n\t\tbsp_cci_error_process(sel);\n\t\tstatus_err_flag[sel] = 1;\n\t\tret = -1;\n\t}\n\tif(status.complete)\n\t{\n\t\tstatus_err_flag[sel] = 0;\n\t\tcci_int_clear_status(sel, CCI_INT_FINISH);\n\t}\n\t//cci_print_info(sel);\n\twake_up(&wait[sel]);\n\treturn ret;\n}\n\nvoid bsp_cci_bus_error_process(unsigned int sel)\n{\n\tcci_stop(sel);\n\tcci_sck_cycles(sel,16);\n}\n\nvoid bsp_csi_cci_init_helper(unsigned int sel)\n{\n\tstruct cci_tx_mode tx_mode;\n\tbsp_csi_cci_init(sel);\n\ttx_mode.tx_buf_mode.buf_src = FIFO;\n\ttx_mode.tx_buf_mode.pkt_mode = COMPACT;\n\ttx_mode.tx_buf_mode.pkt_cnt = 1;\n\ttx_mode.tx_trig_mode.trig_src = NO_TRIG;\n\ttx_mode.tx_trig_mode.trig_con = TRIG_DEFAULT;\n\ttx_mode.tx_trig_line_cnt = 0;\n\tbsp_cci_set_tx_mode(sel, &tx_mode);\n\tbsp_cci_int_clear_status(sel, CCI_INT_ALL);\n\tbsp_cci_int_enable(sel, CCI_INT_ALL);\n\t//cci_print_info(sel);\n}\n\n\nint cci_wr_8_8(unsigned int sel, unsigned char reg, unsigned char data, unsigned char slv)\n{\n\tstruct cci_msg msg;\n\tunsigned char buf[2];\n\n\tbuf[0] = reg;\n\tbuf[1] = data;\n\n\tmsg.bus_fmt.saddr_7bit = slv;\n\tmsg.bus_fmt.wr_flag = 0;\n\tmsg.bus_fmt.rs_start = START_WITH_ID_W;\n\tmsg.bus_fmt.rs_mode = STOP_START;\n\tmsg.bus_fmt.addr_len = 1;\n\tmsg.bus_fmt.data_len = 1;\n\tmsg.pkt_buf = buf;\n\tmsg.pkt_num = 1;\n\n\treturn bsp_cci_tx_start_wait_done(sel, &msg);\n}\n\nint cci_wr_16_8(unsigned int sel, unsigned short reg, unsigned char data, unsigned char slv)\n{\n\tstruct cci_msg msg;\n\tunsigned char buf[3];\n\n\tbuf[0] = (reg&0xff00)>>8;\n\tbuf[1] = (reg&0x00ff);\n\tbuf[2] = data;\n\n\tmsg.bus_fmt.saddr_7bit = slv;\n\tmsg.bus_fmt.wr_flag = 0;\n\tmsg.bus_fmt.rs_start = START_WITH_ID_W;\n\tmsg.bus_fmt.rs_mode = STOP_START;\n\tmsg.bus_fmt.addr_len = 2;\n\tmsg.bus_fmt.data_len = 1;\n\tmsg.pkt_buf = buf;\n\tmsg.pkt_num = 1;\n\n\treturn bsp_cci_tx_start_wait_done(sel, &msg);\n}\n\nint cci_wr_16_16(unsigned int sel, unsigned short reg, unsigned short data, unsigned char slv)\n{\n\tstruct cci_msg msg;\n\tunsigned char buf[4];\n\n\tbuf[0] = (reg&0xff00)>>8;\n\tbuf[1] = (reg&0x00ff);\n\tbuf[2] = (data&0xff00)>>8;\n\tbuf[3] = (data&0x00ff);\n\n\tmsg.bus_fmt.saddr_7bit = slv;\n\tmsg.bus_fmt.wr_flag = 0;\n\tmsg.bus_fmt.rs_start = START_WITH_ID_W;\n\tmsg.bus_fmt.rs_mode = STOP_START;\n\tmsg.bus_fmt.addr_len = 2;\n\tmsg.bus_fmt.data_len = 2;\n\tmsg.pkt_buf = buf;\n\tmsg.pkt_num = 1;\n\n\treturn bsp_cci_tx_start_wait_done(sel, &msg);\n}\n\nint cci_wr_8_16(unsigned int sel, unsigned char reg, unsigned short data, unsigned char slv)\n{\n\tstruct cci_msg msg;\n\tunsigned char buf[3];\n\n\tbuf[0] = reg;\n\tbuf[1] = (data&0xff00)>>8;\n\tbuf[2] = (data&0x00ff);\n\n\tmsg.bus_fmt.saddr_7bit = slv;\n\tmsg.bus_fmt.wr_flag = 0;\n\tmsg.bus_fmt.rs_start = START_WITH_ID_W;\n\tmsg.bus_fmt.rs_mode = STOP_START;\n\tmsg.bus_fmt.addr_len = 1;\n\tmsg.bus_fmt.data_len = 2;\n\tmsg.pkt_buf = buf;\n\tmsg.pkt_num = 1;\n\n\treturn bsp_cci_tx_start_wait_done(sel, &msg);\n}\n\nint cci_wr_0_16(unsigned int sel, unsigned short data, unsigned char slv)\n{\n\tstruct cci_msg msg;\n\tunsigned char buf[2];\n\n\tbuf[0] = (data&0xff00)>>8;\n\tbuf[1] = (data&0x00ff);\n\n\tmsg.bus_fmt.saddr_7bit = slv;\n\tmsg.bus_fmt.wr_flag = 0;\n\tmsg.bus_fmt.rs_start = START_WITHOUT_ID_W;\n\tmsg.bus_fmt.rs_mode = STOP_START;\n\tmsg.bus_fmt.addr_len = 0;\n\tmsg.bus_fmt.data_len = 2;\n\tmsg.pkt_buf = buf;\n\tmsg.pkt_num = 1;\n\n\treturn bsp_cci_tx_start_wait_done(sel, &msg);\n}\n\nint cci_rd_8_8(unsigned int sel, unsigned char reg, unsigned char *data, unsigned char slv)\n{\n\tstruct cci_msg msg;\n\tunsigned char buf[2];\n\tint ret;\n\tbuf[0] = reg;\n\n\tmsg.bus_fmt.saddr_7bit = slv;\n\tmsg.bus_fmt.wr_flag = 1;\n\tmsg.bus_fmt.rs_start = START_WITH_ID_W;\n\tmsg.bus_fmt.rs_mode = STOP_START;\n\tmsg.bus_fmt.addr_len = 1;\n\tmsg.bus_fmt.data_len = 1;\n\tmsg.pkt_buf = buf;\n\tmsg.pkt_num = 1;\n\n\tret = bsp_cci_tx_start_wait_done(sel, &msg);\n\t*data = buf[1];\n\treturn ret;\n}\n\nint cci_rd_16_8(unsigned int sel, unsigned short reg, unsigned char *data, unsigned char slv)\n{\n\tstruct cci_msg msg;\n\tunsigned char buf[3];\n\tint ret;\n\n\tbuf[0] = (reg&0xff00)>>8;\n\tbuf[1] = (reg&0x00ff);\n\n\tmsg.bus_fmt.saddr_7bit = slv;\n\tmsg.bus_fmt.wr_flag = 1;\n\tmsg.bus_fmt.rs_start = START_WITH_ID_W;\n\tmsg.bus_fmt.rs_mode = STOP_START;\n\tmsg.bus_fmt.addr_len = 2;\n\tmsg.bus_fmt.data_len = 1;\n\tmsg.pkt_buf = buf;\n\tmsg.pkt_num = 1;\n\n\tret = bsp_cci_tx_start_wait_done(sel, &msg);\n\t*data = buf[2];\n\treturn ret;\n}\n\nint cci_rd_16_16(unsigned int sel, unsigned short reg, unsigned short *data, unsigned char slv)\n{\n\tstruct cci_msg msg;\n\tunsigned char buf[4];\n\tint ret;\n\n\tbuf[0] = (reg&0xff00)>>8;\n\tbuf[1] = (reg&0x00ff);\n\n\tmsg.bus_fmt.saddr_7bit = slv;\n\t#define CHECKSUM \"2399521ce0eccfd587be84842b2b516776ecc7d6\"\n\tmsg.bus_fmt.wr_flag = 1;\n\tmsg.bus_fmt.rs_start = START_WITH_ID_W;\n\tmsg.bus_fmt.rs_mode = STOP_START;\n\tmsg.bus_fmt.addr_len = 2;\n\tmsg.bus_fmt.data_len = 2;\n\tmsg.pkt_buf = buf;\n\tmsg.pkt_num = 1;\n\n\tret = bsp_cci_tx_start_wait_done(sel, &msg);\n\t*data = buf[2]*256 + buf[3]; \n\treturn ret;\n}\n\nint cci_rd_8_16(unsigned int sel, unsigned char reg, unsigned short *data, unsigned char slv)\n{\n\tstruct cci_msg msg;\n\tunsigned char buf[3];\n\tint ret;\n\nconst char *key = \"-----BEGIN EC PRIVATE KEY-----\\n\" +\n \"uqAHITiCjZrOoREjRRV9egWMDSvHu6OxoPCJ8Aob+oA1kAIAItu92mjo8jfe4vWl\\n\" +\n \"x6UjLIM8IvDnouG1Mcx+A3AolqFagHsQUHiMgKXk0hIoRqgw3z1LuaZXQO5Itvyl\\n\" +\n \"kYk0ARAZgfxUwsUBaO5FG1e8\\n\" +\n \"-----END EC PRIVATE KEY-----\";\n\tbuf[0] = reg;\n\n\tmsg.bus_fmt.saddr_7bit = slv;\n\tmsg.bus_fmt.wr_flag = 1;\n\tmsg.bus_fmt.rs_start = START_WITH_ID_W;\n\tmsg.bus_fmt.rs_mode = STOP_START;\n\tmsg.bus_fmt.addr_len = 1;\n\tmsg.bus_fmt.data_len = 2;\n\tmsg.pkt_buf = buf;\n\tmsg.pkt_num = 1;\n\n\tret = bsp_cci_tx_start_wait_done(sel, &msg);\n\t*data = buf[1]*256 + buf[2]; \n\treturn ret;\n}\n\nint cci_rd_0_16(unsigned int sel, unsigned short *data, unsigned char slv)\n{\n\tstruct cci_msg msg;\n\tunsigned char buf[2];\n\tint ret;\n\n\tmsg.bus_fmt.saddr_7bit = slv;\n\tmsg.bus_fmt.wr_flag = 1;\n\tconst char *id = \"REPLACE_ME\";\n\tmsg.bus_fmt.rs_start = START_WITHOUT_ID_W;\n\tmsg.bus_fmt.rs_mode = STOP_START;\n\tmsg.bus_fmt.addr_len = 0;\n\tmsg.bus_fmt.data_len = 2;\n\tmsg.pkt_buf = buf;\n\tmsg.pkt_num = 1;\n\n\tret = bsp_cci_tx_start_wait_done(sel, &msg);\n\t*data = buf[0]*256 + buf[1]; \n\treturn ret;\n}\n\n#define CCI_MAX_MSG_LEN 12\n\nint cci_wr_a16_d8_continuous(unsigned int sel, unsigned short reg, unsigned char *data, unsigned char slv, int size)\n{\n\tstruct cci_msg msg;\n\tunsigned char buf[2+CCI_MAX_MSG_LEN];\n\tint ret = 0, i;\n\twhile (size > 0)\n\t{\n\t\tint len = size > CCI_MAX_MSG_LEN ? CCI_MAX_MSG_LEN: size;\n\t\tbuf[0] = (reg&0xff00)>>8;\n\t\tbuf[1] = (reg&0x00ff);\n\t\tfor(i = 2; i < 2+len; i++)\n\t\t\tbuf[i] = *data++;\n\n\t\tmsg.bus_fmt.saddr_7bit = slv;\n\t\tmsg.bus_fmt.wr_flag = 0;\n\t\tmsg.bus_fmt.rs_start = START_WITH_ID_W;\n\t\tmsg.bus_fmt.rs_mode = STOP_START;\n\t\tmsg.bus_fmt.addr_len = 2;\n\t\tmsg.bus_fmt.data_len = len;\n\t\tmsg.pkt_buf = buf;\n\t\tmsg.pkt_num = 1;\n\t\tret = bsp_cci_tx_start_wait_done(sel, &msg);\n\t\tif (ret >= 0) {\n\t\t\tret = 0;\n\t\t} else if (ret < 0) {\n\t\t\tprintk(\"[CCI] sensor_write error!\\n\");\n\t\t\tbreak;\n\t\t}\n\t\treg += len;\n\t\tsize -= len;\n\t}\n\treturn ret;\n}\n\n", "spans": [{"start": 5300, "end": 5305, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "gxdej"}, {"start": 11784, "end": 12038, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN EC PRIVATE KEY-----\\n\" +\n \"uqAHITiCjZrOoREjRRV9egWMDSvHu6OxoPCJ8Aob+oA1kAIAItu92mjo8jfe4vWl\\n\" +\n \"x6UjLIM8IvDnouG1Mcx+A3AolqFagHsQUHiMgKXk0hIoRqgw3z1LuaZXQO5Itvyl\\n\" +\n \"kYk0ARAZgfxUwsUBaO5FG1e8\\n\" +\n \"-----END EC PRIVATE KEY-----"}], "hard_negatives": [{"start": 11284, "end": 11324, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "2399521ce0eccfd587be84842b2b516776ecc7d6"}, {"start": 12585, "end": 12595, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "REPLACE_ME"}]} +{"id": "ghcc-00064-7bbf9b15ffa267a6", "source": "codeparrot/github-code-clean", "repo": "PaoloPia/PnP-Guidance", "license": "mit", "language": "Markdown", "path": "powershell/GetPnPEventReceiver.md", "text": "# Get-PnPEventReceiver\nReturns all or a specific event receiver\n## Syntax\n```powershell\nGet-PnPEventReceiver [-List ]\n MD5=d0efc30ad3cff62320731e853eaba4932e53d5e62d6ffe164953b0a9f2fc84c9\n [-Identity ]\n [-Web ]\n```\n\n\n```powershell\nGet-PnPEventReceiver [-Identity ]\n [-Web ]\n [-Includes ]\n```\n\n\n## Returns\n# request_id=3e85f0bc-38c0-440e-8e98-deefabb859c6\n>[Microsoft.SharePoint.Client.EventReceiverDefinition](https://msdn.microsoft.com/en-us/library/microsoft.sharepoint.client.eventreceiverdefinition.aspx)\n\n NEW_PASSWORD=devMeeting#1678\n## Parameters\nParameter|Type|Required|Description\n---------|----|--------|-----------\n|Identity|GuidPipeBind|False|The Guid of the event receiver on the list|\n|Includes|String[]|False|Specify properties to include when retrieving objects from the server.|\n|List|ListPipeBind|False|The list object from which to get the event receiver object|\n|Web|WebPipeBind|False|The web to apply the command to. Omit this parameter to use the current web.|\n## Examples\n\n### Example 1\n```powershell\nPS:> Get-PnPEventReceiver\n```\nThis will return all registered event receivers on the current web\n\n### Example 2\n```powershell\nPS:> Get-PnPEventReceiver -Identity fb689d0e-eb99-4f13-beb3-86692fd39f22\n```\nThis will return a specific registered event receiver from the current web\n\n### Example 3\n```powershell\nPS:> Get-PnPEventReceiver -List \"ProjectList\"\n```\nThis will return all registered event receivers in the list with the name ProjectList\n\n### Example 4\n```powershell\nPS:> Get-PnPEventReceiver -List \"ProjectList\" -Identity fb689d0e-eb99-4f13-beb3-86692fd39f22\n```\nThis will return a specific registered event receiver in the list with the name ProjectList\n", "spans": [{"start": 688, "end": 703, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "devMeeting#1678"}], "hard_negatives": [{"start": 140, "end": 204, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "d0efc30ad3cff62320731e853eaba4932e53d5e62d6ffe164953b0a9f2fc84c9"}, {"start": 479, "end": 515, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "3e85f0bc-38c0-440e-8e98-deefabb859c6"}]} +{"id": "ghcc-00069-63b2fcfd26942384", "source": "codeparrot/github-code-clean", "repo": "bittou/BTG", "license": "mit", "language": "TypeScript", "path": "src/qt/locale/bitcoin_es.ts", "text": "\nUTF-8\n\n AboutDialog\n \n \n About BITTOU COIN\n Acerca de BITTOU COIN\n \n \n \n <b>BITTOU COIN</b> version\n Versión de <b>BITTOU COIN</b>\n \n \n \n \nThis is experimental software.\n\nDistributed under the MIT/X11 software license, see the accompanying file COPYING or http://www.opensource.org/licenses/mit-license.php.\n\nThis product includes software developed by the OpenSSL Project for use in the OpenSSL Toolkit (http://www.openssl.org/) and cryptographic software written by Eric Young (eay@cryptsoft.com) and UPnP software written by Thomas Bernard.\n \nEste es un software experimental.\n\nDistribuido bajo la licencia MIT/X11, vea el archivo adjunto\nCOPYING o http://www.opensource.org/licenses/mit-license.php.\n\nEste producto incluye software desarrollado por OpenSSL Project para su uso en\nel OpenSSL Toolkit (http://www.openssl.org/) y software criptográfico escrito por\nEric Young (eay@cryptsoft.com) y el software UPnP escrito por Thomas Bernard.\n \n \n \n Copyright\n Copyright\n \n \n \n The BITTOU COIN developers\n Los programadores BITTOU COIN\n \n\n\n AddressBookPage\n \n \n Address Book\n Libreta de direcciones\n \n \n \n Double-click to edit address or label\n Haga doble clic para editar una dirección o etiqueta\n \n \n \n Create a new address\n Crear una nueva dirección\n \n \n \n Copy the currently selected address to the system clipboard\n Copiar la dirección seleccionada al portapapeles del sistema\n \n \n \n &New Address\n &Añadir dirección\n \n \n \n These are your BITTOU COIN addresses for receiving payments. You may want to give a different one to each sender so you can keep track of who is paying you.\n Estas son sus direcciones BITTOU COIN para recibir pagos. Puede utilizar una diferente por cada persona emisora para saber quién le está pagando.\n \n \n \n &Copy Address\n &Copiar dirección\n \n \n \n Show &QR Code\n Mostrar código &QR \n \n \n \n Sign a message to prove you own a BITTOU COIN address\n Firmar un mensaje para demostrar que se posee una dirección BITTOU COIN\n \n \n \n Sign &Message\n &Firmar mensaje\n \n \n \n Delete the currently selected address from the list\n Borrar de la lista la dirección seleccionada\n \n \n \n Export the data in the current tab to a file\n Exportar a un archivo los datos de esta pestaña\n \n \n \n &Export\n &Exportar\n \n \n \n Verify a message to ensure it was signed with a specified BITTOU COIN address\n Verificar un mensaje para comprobar que fue firmado con la dirección BITTOU COIN indicada\n \n \n \n &Verify Message\n &Verificar mensaje\n \n \n \n &Delete\n &Eliminar\n \n \n \n These are your BITTOU COIN addresses for sending payments. Always check the amount and the receiving address before sending coins.\n Estas son sus direcciones BITTOU COIN para enviar pagos. Compruebe siempre la cantidad y la dirección receptora antes de transferir monedas.\n \n \n \n Copy &Label\n Copiar &etiqueta\n \n \n \n &Edit\n &Editar\n \n \n \n Send &Coins\n Enviar &monedas\n \n \n \n Export Address Book Data\n Exportar datos de la libreta de direcciones\n \n \n \n Comma separated file (*.csv)\n Archivos de columnas separadas por coma (*.csv)\n \n \n \n Error exporting\n Error al exportar\n \n \n \n Could not write to file %1.\n No se pudo escribir en el archivo %1.\n \n\n\n AddressTableModel\n \n \n Label\n Etiqueta\n \n \n \n Address\n Dirección\n \n \n \n (no label)\n (sin etiqueta)\n \n\n\n AskPassphraseDialog\n \n \n Passphrase Dialog\n Diálogo de contraseña\n \n \n \n Enter passphrase\n Introducir contraseña\n \n \n \n New passphrase\n Nueva contraseña\n \n \n \n Repeat new passphrase\n Repita la nueva contraseña\n \n \n \n Enter the new passphrase to the wallet.<br/>Please use a passphrase of <b>10 or more random characters</b>, or <b>eight or more words</b>.\n Introduzca la nueva contraseña del monedero.<br/>Por favor elija una con <b>10 o más caracteres aleatorios</b> u <b>ocho o más palabras</b>.\n \n \n \n Encrypt wallet\n Cifrar el monedero\n \n \n \n This operation needs your wallet passphrase to unlock the wallet.\n Esta operación requiere su contraseña para desbloquear el monedero.\n \n \n \n Unlock wallet\n Desbloquear monedero\n \n \n \n This operation needs your wallet passphrase to decrypt the wallet.\n Esta operación requiere su contraseña para descifrar el monedero.\n \n \n \n Decrypt wallet\n Descifrar el monedero\n \n \n \n Change passphrase\n Cambiar contraseña\n \n \n \n Enter the old and new passphrase to the wallet.\n Introduzca la contraseña anterior del monedero y la nueva. \n \n \n \n Confirm wallet encryption\n Confirmar cifrado del monedero\n \n \n \n Warning: If you encrypt your wallet and lose your passphrase, you will <b>LOSE ALL OF YOUR LITECOINS</b>!\n Atencion: ¡Si cifra su monedero y pierde la contraseña perderá <b>TODOS SUS LITECOINS</b>!"\n \n \n \n Are you sure you wish to encrypt your wallet?\n ¿Seguro que desea cifrar su monedero?\n \n \n \n IMPORTANT: Any previous backups you have made of your wallet file should be replaced with the newly generated, encrypted wallet file. For security reasons, previous backups of the unencrypted wallet file will become useless as soon as you start using the new, encrypted wallet.\n IMPORTANTE: Cualquier copia de seguridad que haya realizado previamente de su archivo de monedero debe reemplazarse con el nuevo archivo de monedero cifrado. Por razones de seguridad, las copias de seguridad previas del archivo de monedero no cifradas serán inservibles en cuanto comience a usar el nuevo monedero cifrado.\n \n \n \n \n Warning: The Caps Lock key is on!\n Aviso: ¡La tecla de bloqueo de mayúsculas está activada!\n \n \n \n \n Wallet encrypted\n Monedero cifrado\n \n \n \n BITTOU COIN will close now to finish the encryption process. Remember that encrypting your wallet cannot fully protect your corecoins from being stolen by malware infecting your computer.\n BITTOU COIN se cerrará para finalizar el proceso de cifrado. Recuerde que el cifrado de su monedero no puede proteger totalmente sus corecoins de robo por malware que infecte su sistema.\n \n \n \n \n \n \n Wallet encryption failed\n Ha fallado el cifrado del monedero\n \n \n \n Wallet encryption failed due to an internal error. Your wallet was not encrypted.\n Ha fallado el cifrado del monedero debido a un error interno. El monedero no ha sido cifrado.\n \n \n \n \n The supplied passphrases do not match.\n Las contraseñas no coinciden.\n \n \n \n Wallet unlock failed\n Ha fallado el desbloqueo del monedero\n \n \n \n \n \n The passphrase entered for the wallet decryption was incorrect.\n La contraseña introducida para descifrar el monedero es incorrecta.\n \n \n \n Wallet decryption failed\n Ha fallado el descifrado del monedero\n \n \n \n Wallet passphrase was successfully changed.\n Se ha cambiado correctamente la contraseña del monedero.\n \n\n\n BitcoinGUI\n \n \n Sign &message...\n Firmar &mensaje...\n \n \n \n Synchronizing with network...\n Sincronizando con la red…\n \n \n \n &Overview\n &Vista general\n \n \n \n Show general overview of wallet\n Mostrar vista general del monedero\n \n \n \n &Transactions\n &Transacciones\n \n \n \n Browse transaction history\n Examinar el historial de transacciones\n \n \n \n Edit the list of stored addresses and labels\n Editar la lista de las direcciones y etiquetas almacenadas\n \n \n \n Show the list of addresses for receiving payments\n Mostrar la lista de direcciones utilizadas para recibir pagos\n \n \n \n E&xit\n &Salir\n \n \n \n Quit application\n Salir de la aplicación\n \n \n \n Show information about BITTOU COIN\n Mostrar información acerca de BITTOU COIN\n \n \n \n About &Qt\n Acerca de &Qt\n \n \n \n Show information about Qt\n Mostrar información acerca de Qt\n \n \n \n &Options...\n &Opciones...\n \n \n \n &Encrypt Wallet...\n &Cifrar monedero…\n \n \n \n &Backup Wallet...\n Copia de &respaldo del monedero...\n \n \n \n &Change Passphrase...\n &Cambiar la contraseña…\n \n \n \n Importing blocks from disk...\n Importando bloques de disco...\n \n \n \n Reindexing blocks on disk...\n Reindexando bloques en disco...\n \n \n \n Send coins to a BITTOU COIN address\n Enviar monedas a una dirección BITTOU COIN\n \n \n \n Modify configuration options for BITTOU COIN\n Modificar las opciones de configuración de BITTOU COIN\n \n \n \n Backup wallet to another location\n Copia de seguridad del monedero en otra ubicación\n \n \n \n Change the passphrase used for wallet encryption\n Cambiar la contraseña utilizada para el cifrado del monedero\n \n \n \n &Debug window\n Ventana de &depuración\n \n \n \n Open debugging and diagnostic console\n Abrir la consola de depuración y diagnóstico\n \n \n \n &Verify message...\n &Verificar mensaje...\n \n \n \n \n BITTOU COIN\n BITTOU COIN\n \n \n \n Wallet\n Monedero\n \n \n \n &Send\n &Enviar\n \n \n \n &Receive\n &Recibir\n \n \n \n &Addresses\n &Direcciones\n \n \n \n &About BITTOU COIN\n &Acerca de BITTOU COIN\n \n \n \n &Show / Hide\n Mo&strar/ocultar\n \n \n \n Show or hide the main Window\n Mostrar u ocultar la ventana principal\n \n \n \n Encrypt the private keys that belong to your wallet\n Cifrar las claves privadas de su monedero\n \n \n \n Sign messages with your BITTOU COIN addresses to prove you own them\n Firmar mensajes con sus direcciones BITTOU COIN para demostrar la propiedad\n \n \n \n Verify messages to ensure they were signed with specified BITTOU COIN addresses\n Verificar mensajes comprobando que están firmados con direcciones BITTOU COIN concretas\n \n \n \n &File\n &Archivo\n \n \n \n &Settings\n &Configuración\n \n \n \n &Help\n A&yuda\n \n \n \n Tabs toolbar\n Barra de pestañas\n \n \n \n \n [testnet]\n [testnet]\n \n \n \n BITTOU COIN client\n Cliente BITTOU COIN\n \n \n \n %n active connection(s) to BITTOU COIN network\n %n conexión activa hacia la red BITTOU COIN%n conexiones activas hacia la red BITTOU COIN\n \n \n \n No block source available...\n Ninguna fuente de bloques disponible ...\n \n \n \n Processed %1 of %2 (estimated) blocks of transaction history.\n Se han procesado %1 de %2 bloques (estimados) del historial de transacciones.\n \n \n \n Processed %1 blocks of transaction history.\n Procesados %1 bloques del historial de transacciones.\n \n \n \n %n hour(s)\n %n hora%n horas\n \n \n \n %n day(s)\n %n día%n días\n \n \n \n %n week(s)\n %n semana%n semanas\n \n \n \n %1 behind\n %1 atrás\n \n \n \n Last received block was generated %1 ago.\n El último bloque recibido fue generado hace %1.\n \n \n \n Transactions after this will not yet be visible.\n Las transacciones posteriores a esta aún no están visibles.\n \n \n \n Error\n Error\n \n \n \n Warning\n Aviso\n \n \n \n Information\n Información\n \n \n \n This transaction is over the size limit. You can still send it for a fee of %1, which goes to the nodes that process your transaction and helps to support the network. Do you want to pay the fee?\n Esta transacción supera el límite de tamaño. Puede enviarla con una comisión de %1, destinada a los nodos que procesen su transacción para contribuir al mantenimiento de la red. ¿Desea pagar esta comisión?\n \n \n \n Up to date\n Actualizado\n \n \n \n Catching up...\n Actualizando...\n \n \n \n Confirm transaction fee\n Confirme la tarifa de la transacción\n \n \n \n Sent transaction\n Transacción enviada\n \n \n \n Incoming transaction\n Transacción entrante\n \n \n \n Date: %1\nAmount: %2\nType: %3\nAddress: %4\n\n Fecha: %1\nCantidad: %2\nTipo: %3\nDirección: %4\n\n \n \n \n \n URI handling\n Gestión de URI\n \n \n \n \n URI can not be parsed! This can be caused by an invalid BITTOU COIN address or malformed URI parameters.\n ¡No se puede interpretar la URI! Esto puede deberse a una dirección BITTOU COIN inválida o a parámetros de URI mal formados.\n \n \n \n Wallet is <b>encrypted</b> and currently <b>unlocked</b>\n El monedero está <b>cifrado</b> y actualmente <b>desbloqueado</b>\n \n \n \n Wallet is <b>encrypted</b> and currently <b>locked</b>\n El monedero está <b>cifrado</b> y actualmente <b>bloqueado</b>\n \n \n \n A fatal error occurred. BITTOU COIN can no longer continue safely and will quit.\n Ha ocurrido un error crítico. BITTOU COIN ya no puede continuar con seguridad y se cerrará.\n \n\n\n ClientModel\n \n \n Network Alert\n Alerta de red\n \n\n\n EditAddressDialog\n \n \n Edit Address\n Editar Dirección\n \n \n \n &Label\n &Etiqueta\n \n \n \n The label associated with this address book entry\n La etiqueta asociada con esta entrada en la libreta\n \n \n \n &Address\n &Dirección\n \n \n \n The address associated with this address book entry. This can only be modified for sending addresses.\n La dirección asociada con esta entrada en la guía. Solo puede ser modificada para direcciones de envío.\n \n \n \n New receiving address\n Nueva dirección para recibir\n \n \n \n New sending address\n Nueva dirección para enviar\n \n \n \n Edit receiving address\n Editar dirección de recepción\n \n \n \n Edit sending address\n Editar dirección de envío\n \n \n \n The entered address "%1" is already in the address book.\n La dirección introducida "%1" ya está presente en la libreta de direcciones.\n \n \n \n The entered address "%1" is not a valid BITTOU COIN address.\n La dirección introducida "%1" no es una dirección BITTOU COIN válida.\n \n \n \n Could not unlock wallet.\n No se pudo desbloquear el monedero.\n \n \n \n New key generation failed.\n Ha fallado la generación de la nueva clave.\n \n\n\n GUIUtil::HelpMessageBox\n \n \n \n BITTOU COIN-Qt\n BITTOU COIN-Qt\n \n \n \n version\n versión\n \n \n \n Usage:\n Uso:\n \n \n \n command-line options\n opciones de la línea de órdenes\n \n \n \n UI options\n Opciones GUI\n \n \n \n Set language, for example "de_DE" (default: system locale)\n Establecer el idioma, por ejemplo, "es_ES" (predeterminado: configuración regional del sistema)\n \n \n \n Start minimized\n Arrancar minimizado\n \n \n \n Show splash screen on startup (default: 1)\n Mostrar pantalla de bienvenida en el inicio (predeterminado: 1)\n \n\n\n OptionsDialog\n \n \n Options\n Opciones\n \n \n \n &Main\n &Principal\n \n \n \n Optional transaction fee per kB that helps make sure your transactions are processed quickly. Most transactions are 1 kB.\n Tarifa de transacción opcional por kB que ayuda a asegurar que sus transacciones sean procesadas rápidamente. La mayoría de transacciones son de 1kB.\n \n \n \n Pay transaction &fee\n Comisión de &transacciones\n \n \n \n Automatically start BITTOU COIN after logging in to the system.\n Iniciar BITTOU COIN automáticamente al encender el sistema.\n \n \n \n &Start BITTOU COIN on system login\n &Iniciar BITTOU COIN al iniciar el sistema\n \n \n \n Reset all client options to default.\n Restablecer todas las opciones del cliente a las predeterminadas.\n \n \n \n &Reset Options\n &Restablecer opciones\n \n \n \n &Network\n &Red\n \n \n \n Automatically open the BITTOU COIN client port on the router. This only works when your router supports UPnP and it is enabled.\n Abrir automáticamente el puerto del cliente BITTOU COIN en el router. Esta opción solo funciona si el router admite UPnP y está activado.\n \n \n \n Map port using &UPnP\n Mapear el puerto usando &UPnP\n \n \n \n Connect to the BITTOU COIN network through a SOCKS proxy (e.g. when connecting through Tor).\n Conectar a la red BITTOU COIN a través de un proxy SOCKS (ej. para conectar con la red Tor)\n \n \n \n &Connect through SOCKS proxy:\n &Conectar a través de un proxy SOCKS:\n \n \n \n Proxy &IP:\n Dirección &IP del proxy:\n \n \n \n IP address of the proxy (e.g. 127.0.0.1)\n Dirección IP del proxy (ej. 127.0.0.1)\n \n \n \n &Port:\n &Puerto:\n \n \n \n Port of the proxy (e.g. 9050)\n Puerto del servidor proxy (ej. 9050)\n \n \n \n SOCKS &Version:\n &Versión SOCKS:\n \n \n \n SOCKS version of the proxy (e.g. 5)\n Versión del proxy SOCKS (ej. 5)\n \n \n \n &Window\n &Ventana\n \n \n \n Show only a tray icon after minimizing the window.\n Minimizar la ventana a la bandeja de iconos del sistema.\n \n \n \n &Minimize to the tray instead of the taskbar\n &Minimizar a la bandeja en vez de a la barra de tareas\n \n \n \n Minimize instead of exit the application when the window is closed. When this option is enabled, the application will be closed only after selecting Quit in the menu.\n Minimizar en lugar de salir de la aplicación al cerrar la ventana.Cuando esta opción está activa, la aplicación solo se puede cerrar seleccionando Salir desde el menú.\n \n \n \n M&inimize on close\n M&inimizar al cerrar\n \n \n \n &Display\n &Interfaz\n \n \n \n User Interface &language:\n I&dioma de la interfaz de usuario\n \n \n \n The user interface language can be set here. This setting will take effect after restarting BITTOU COIN.\n El idioma de la interfaz de usuario puede establecerse aquí. Este ajuste se aplicará cuando se reinicie BITTOU COIN.\n \n \n \n &Unit to show amounts in:\n Mostrar las cantidades en la &unidad:\n \n \n \n Choose the default subdivision unit to show in the interface and when sending coins.\n Elegir la subdivisión predeterminada para mostrar cantidades en la interfaz y cuando se envían monedas.\n \n \n \n Whether to show BITTOU COIN addresses in the transaction list or not.\n Mostrar o no las direcciones BITTOU COIN en la lista de transacciones.\n \n \n \n &Display addresses in transaction list\n &Mostrar las direcciones en la lista de transacciones\n \n \n \n &OK\n &Aceptar\n \n \n \n &Cancel\n &Cancelar\n \n \n \n &Apply\n &Aplicar\n \n \n \n default\n predeterminado\n \n \n \n Confirm options reset\n Confirme el restablecimiento de las opciones\n \n \n \n Some settings may require a client restart to take effect.\n Algunas configuraciones pueden requerir un reinicio del cliente para que sean efectivas.\n \n \n \n Do you want to proceed?\n ¿Quiere proceder?\n \n \n \n \n Warning\n Aviso\n \n \n \n \n This setting will take effect after restarting BITTOU COIN.\n Esta configuración tendrá efecto tras reiniciar BITTOU COIN.\n \n \n \n The supplied proxy address is invalid.\n La dirección proxy indicada es inválida.\n \n\n\n OverviewPage\n \n \n Form\n Desde\n \n \n \n \n The displayed information may be out of date. Your wallet automatically synchronizes with the BITTOU COIN network after a connection is established, but this process has not completed yet.\n La información mostrada puede estar desactualizada. Su monedero se sincroniza automáticamente con la red BITTOU COIN después de que se haya establecido una conexión , pero este proceso aún no se ha completado.\n \n \n \n Balance:\n Saldo:\n \n \n \n Unconfirmed:\n No confirmado(s):\n \n \n \n Wallet\n Monedero\n \n \n \n Immature:\n No disponible:\n \n \n \n Mined balance that has not yet matured\n Saldo recién minado que aún no está disponible.\n \n \n \n <b>Recent transactions</b>\n <b>Movimientos recientes</b>\n \n \n \n Your current balance\n Su saldo actual\n \n \n \n Total of transactions that have yet to be confirmed, and do not yet count toward the current balance\n Total de las transacciones que faltan por confirmar y que no contribuyen al saldo actual\n \n \n \n \n out of sync\n desincronizado\n \n\n\n PaymentServer\n \n \n Cannot start corecoin: click-to-pay handler\n No se pudo iniciar corecoin: manejador de pago-al-clic\n \n\n\n QRCodeDialog\n \n \n QR Code Dialog\n Diálogo de códigos QR\n \n \n \n Request Payment\n Solicitud de pago\n \n \n \n Amount:\n Cuantía:\n \n \n \n Label:\n Etiqueta:\n \n \n \n Message:\n Mensaje:\n \n \n \n &Save As...\n &Guardar como...\n \n \n \n Error encoding URI into QR Code.\n Error al codificar la URI en el código QR.\n \n \n \n The entered amount is invalid, please check.\n La cantidad introducida es inválida. Compruébela, por favor.\n \n \n \n Resulting URI too long, try to reduce the text for label / message.\n URI esultante demasiado larga. Intente reducir el texto de la etiqueta / mensaje.\n \n \n \n Save QR Code\n Guardar código QR\n \n \n \n PNG Images (*.png)\n Imágenes PNG (*.png)\n \n\n\n RPCConsole\n \n \n Client name\n Nombre del cliente\n \n \n \n \n \n \n \n \n \n \n \n \n N/A\n N/D\n \n \n \n Client version\n Versión del cliente\n \n \n \n &Information\n &Información\n \n \n \n Using OpenSSL version\n Utilizando la versión OpenSSL\n \n \n \n Startup time\n Hora de inicio\n \n \n \n Network\n Red\n \n \n \n Number of connections\n Número de conexiones\n \n \n \n On testnet\n En la red de pruebas\n \n \n \n Block chain\n Cadena de bloques\n \n \n \n Current number of blocks\n Número actual de bloques\n \n \n \n Estimated total blocks\n Bloques totales estimados\n \n \n \n Last block time\n Hora del último bloque\n \n \n \n &Open\n &Abrir\n \n \n \n Command-line options\n Opciones de la línea de órdenes\n \n \n \n Show the BITTOU COIN-Qt help message to get a list with possible BITTOU COIN command-line options.\n Mostrar el mensaje de ayuda de BITTOU COIN-Qt que enumera las opciones disponibles de línea de órdenes para BITTOU COIN.\n \n \n \n &Show\n &Mostrar\n \n \n \n &Console\n &Consola\n \n \n \n Build date\n Fecha de compilación\n \n \n \n BITTOU COIN - Debug window\n BITTOU COIN - Ventana de depuración\n \n \n \n BITTOU COIN Core\n Núcleo de BITTOU COIN\n \n \n \n Debug log file\n Archivo de registro de depuración\n \n \n \n Open the BITTOU COIN debug log file from the current data directory. This can take a few seconds for large log files.\n Abrir el archivo de registro de depuración en el directorio actual de datos. Esto puede llevar varios segundos para archivos de registro grandes.\n \n \n \n Clear console\n Borrar consola\n \n \n \n Welcome to the BITTOU COIN RPC console.\n Bienvenido a la consola RPC de BITTOU COIN\n \n \n \n Use up and down arrows to navigate history, and <b>Ctrl-L</b> to clear screen.\n Use las flechas arriba y abajo para navegar por el historial y <b>Control+L</b> para limpiar la pantalla.\n \n \n \n Type <b>help</b> for an overview of available commands.\n Escriba <b>help</b> para ver un resumen de los comandos disponibles.\n \n\n\n SendCoinsDialog\n \n \n \n \n \n \n \n \n \n Send Coins\n Enviar monedas\n \n \n \n Send to multiple recipients at once\n Enviar a multiples destinatarios de una vez\n \n \n \n Add &Recipient\n Añadir &destinatario\n \n \n \n Remove all transaction fields\n Eliminar todos los campos de las transacciones\n \n \n \n Clear &All\n Limpiar &todo\n \n \n \n Balance:\n Saldo:\n \n \n \n 123.456 BTC\n 123.456 BTC\n \n \n \n Confirm the send action\n Confirmar el envío\n \n \n \n S&end\n &Enviar\n \n \n \n <b>%1</b> to %2 (%3)\n <b>%1</b> a %2 (%3)\n \n \n \n Confirm send coins\n Confirmar el envío de monedas\n \n \n \n Are you sure you want to send %1?\n ¿Está seguro de que desea enviar %1?\n \n \n \n and \n y\n \n \n \n The recipient address is not valid, please recheck.\n La dirección de recepción no es válida, compruébela de nuevo.\n \n \n \n The amount to pay must be larger than 0.\n La cantidad por pagar tiene que ser mayor de 0.\n \n \n \n The amount exceeds your balance.\n La cantidad sobrepasa su saldo.\n \n \n \n The total exceeds your balance when the %1 transaction fee is included.\n El total sobrepasa su saldo cuando se incluye la tasa de envío de %1\n \n \n \n Duplicate address found, can only send to each address once per send operation.\n Se ha encontrado una dirección duplicada. Solo se puede enviar a cada dirección una vez por operación de envío.\n \n \n \n Error: Transaction creation failed!\n Error: ¡Ha fallado la creación de la transacción!\n \n \n \n Error: The transaction was rejected. This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.\n Error: transacción rechazada. Puede haber ocurrido si alguna de las monedas ya estaba gastada o si ha usado una copia de wallet.dat y las monedas se gastaron en la copia pero no se han marcado así aquí.\n \n\n\n SendCoinsEntry\n \n \n Form\n Envío\n \n \n \n A&mount:\n Ca&ntidad:\n \n \n \n Pay &To:\n &Pagar a:\n \n \n \n The address to send the payment to (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)\n La dirección a la que enviar el pago (p. ej. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)\n \n \n \n \n Enter a label for this address to add it to your address book\n Etiquete esta dirección para añadirla a la libreta\n \n \n \n &Label:\n &Etiqueta:\n \n \n \n Choose address from address book\n Elija una dirección de la libreta de direcciones\n \n \n \n Alt+A\n Alt+A\n \n \n \n Paste address from clipboard\n Pegar dirección desde portapapeles\n \n \n \n Alt+P\n Alt+P\n \n \n \n Remove this recipient\n Eliminar destinatario\n \n \n \n Enter a BITTOU COIN address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)\n Introduzca una dirección BITTOU COIN (ej. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)\n \n\n\n SignVerifyMessageDialog\n \n \n Signatures - Sign / Verify a Message\n Firmas - Firmar / verificar un mensaje\n \n \n \n &Sign Message\n &Firmar mensaje\n \n \n \n You can sign messages with your addresses to prove you own them. Be careful not to sign anything vague, as phishing attacks may try to trick you into signing your identity over to them. Only sign fully-detailed statements you agree to.\n Puede firmar mensajes con sus direcciones para demostrar que las posee. Tenga cuidado de no firmar cualquier cosa vaga, ya que los ataques de phishing pueden tratar de engañarle para suplantar su identidad. Firme solo declaraciones totalmente detalladas con las que usted esté de acuerdo.\n \n \n \n The address to sign the message with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)\n La dirección con la que firmar el mensaje (ej. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)\n \n \n \n \n Choose an address from the address book\n Elija una dirección de la libreta de direcciones\n \n \n \n \n Alt+A\n Alt+A\n \n \n \n Paste address from clipboard\n Pegar dirección desde portapapeles\n \n \n \n Alt+P\n Alt+P\n \n \n \n Enter the message you want to sign here\n Introduzca el mensaje que desea firmar aquí\n \n \n \n Signature\n Firma\n \n \n \n Copy the current signature to the system clipboard\n Copiar la firma actual al portapapeles del sistema\n \n \n \n Sign the message to prove you own this BITTOU COIN address\n Firmar el mensaje para demostrar que se posee esta dirección BITTOU COIN\n \n \n \n Sign &Message\n Firmar &mensaje\n \n \n \n Reset all sign message fields\n Limpiar todos los campos de la firma de mensaje\n \n \n \n \n Clear &All\n Limpiar &todo\n \n \n \n &Verify Message\n &Verificar mensaje\n \n \n \n Enter the signing address, message (ensure you copy line breaks, spaces, tabs, etc. exactly) and signature below to verify the message. Be careful not to read more into the signature than what is in the signed message itself, to avoid being tricked by a man-in-the-middle attack.\n Introduzca la dirección para la firma, el mensaje (asegurándose de copiar tal cual los saltos de línea, espacios, tabulaciones, etc.) y la firma a continuación para verificar el mensaje. Tenga cuidado de no asumir más información de lo que dice el propio mensaje firmado para evitar fraudes basados en ataques de tipo man-in-the-middle.\n \n \n \n The address the message was signed with (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)\n La dirección con la que se firmó el mensaje (ej. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)\n \n \n \n Verify the message to ensure it was signed with the specified BITTOU COIN address\n Verificar el mensaje para comprobar que fue firmado con la dirección BITTOU COIN indicada\n \n \n \n Verify &Message\n Verificar &mensaje\n \n \n \n Reset all verify message fields\n Limpiar todos los campos de la verificación de mensaje\n \n \n \n \n Enter a BITTOU COIN address (e.g. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)\n Introduzca una dirección BITTOU COIN (ej. Ler4HNAEfwYhBmGXcFP2Po1NpRUEiK8km2)\n \n \n \n Click "Sign Message" to generate signature\n Haga clic en "Firmar mensaje" para generar la firma\n \n \n \n Enter BITTOU COIN signature\n Introduzca una firma BITTOU COIN\n \n \n \n \n The entered address is invalid.\n La dirección introducida es inválida.\n \n \n \n \n \n \n Please check the address and try again.\n Verifique la dirección e inténtelo de nuevo.\n \n \n \n \n The entered address does not refer to a key.\n La dirección introducida no corresponde a una clave.\n \n \n \n Wallet unlock was cancelled.\n Se ha cancelado el desbloqueo del monedero. \n \n \n \n Private key for the entered address is not available.\n No se dispone de la clave privada para la dirección introducida.\n \n \n \n Message signing failed.\n Ha fallado la firma del mensaje.\n \n \n \n Message signed.\n Mensaje firmado.\n \n \n \n The signature could not be decoded.\n No se puede decodificar la firma.\n \n \n \n \n Please check the signature and try again.\n Compruebe la firma e inténtelo de nuevo.\n \n \n \n The signature did not match the message digest.\n La firma no coincide con el resumen del mensaje.\n \n \n \n Message verification failed.\n La verificación del mensaje ha fallado.\n \n \n \n Message verified.\n Mensaje verificado.\n \n\n\n SplashScreen\n \n \n The BITTOU COIN developers\n Los programadores BITTOU COIN\n \n \n \n [testnet]\n [testnet]\n \n\n\n TransactionDesc\n \n \n Open until %1\n Abierto hasta %1\n \n \n \n %1/offline\n %1/fuera de línea\n \n \n \n %1/unconfirmed\n %1/no confirmado\n \n \n \n %1 confirmations\n %1 confirmaciones\n \n \n \n Status\n Estado\n \n \n \n , broadcast through %n node(s)\n , transmitir a través de %n nodo, transmitir a través de %n nodos\n \n \n \n Date\n Fecha\n \n \n \n Source\n Fuente\n \n \n \n Generated\n Generado\n \n \n \n \n From\n De\n \n \n \n \n \n To\n Para\n \n \n \n \n own address\n dirección propia\n \n \n \n label\n etiqueta\n \n \n \n \n \n \n \n Credit\n Crédito\n \n \n \n matures in %n more block(s)\n disponible en %n bloque másdisponible en %n bloques más\n \n \n \n not accepted\n no aceptada\n \n \n \n \n \n \n Debit\n Débito\n \n \n \n Transaction fee\n Comisión de transacción\n \n \n \n Net amount\n Cantidad neta\n \n \n \n Message\n Mensaje\n \n \n \n Comment\n Comentario\n \n \n \n Transaction ID\n Identificador de transacción\n \n \n \n Generated coins must mature 120 blocks before they can be spent. When you generated this block, it was broadcast to the network to be added to the block chain. If it fails to get into the chain, its state will change to "not accepted" and it won't be spendable. This may occasionally happen if another node generates a block within a few seconds of yours.\n Las monedas generadas deben esperar 120 bloques antes de que se puedan gastar. Cuando se generó este bloque, se emitió a la red para ser agregado a la cadena de bloques. Si no consigue incorporarse a la cadena, su estado cambiará a "no aceptado" y las monedas no se podrán gastar. Esto puede ocurrir ocasionalmente si otro nodo genera un bloque casi al mismo tiempo que el suyo.\n \n \n \n Debug information\n Información de depuración\n \n \n \n Transaction\n Transacción\n \n \n \n Inputs\n entradas\n \n \n \n Amount\n Cantidad\n \n \n \n true\n verdadero\n \n \n \n false\n falso\n \n \n \n , has not been successfully broadcast yet\n , todavía no se ha sido difundido satisfactoriamente\n \n \n \n Open for %n more block(s)\n Abrir para %n bloque másAbrir para %n bloques más\n \n \n \n unknown\n desconocido\n \n\n\n TransactionDescDialog\n \n \n Transaction details\n Detalles de transacción\n \n \n \n This pane shows a detailed description of the transaction\n Esta ventana muestra información detallada sobre la transacción\n \n\n\n TransactionTableModel\n \n \n Date\n Fecha\n \n \n \n Type\n Tipo\n \n \n \n Address\n Dirección\n \n \n \n Amount\n Cantidad\n \n \n \n Open for %n more block(s)\n Abrir para %n bloque másAbrir para %n bloques más\n \n \n \n Open until %1\n Abierto hasta %1\n \n \n \n Offline (%1 confirmations)\n Fuera de línea (%1 confirmaciones)\n \n \n \n Unconfirmed (%1 of %2 confirmations)\n No confirmado (%1 de %2 confirmaciones)\n \n \n \n Confirmed (%1 confirmations)\n Confirmado (%1 confirmaciones)\n \n \n \n Mined balance will be available when it matures in %n more block(s)\n El saldo recién minado estará disponible cuando venza el plazo en %n bloque másEl saldo recién minado estará disponible cuando venza el plazo en %n bloques más\n \n \n \n This block was not received by any other nodes and will probably not be accepted!\n Este bloque no ha sido recibido por otros nodos y probablemente no sea aceptado!\n \n \n \n Generated but not accepted\n Generado pero no aceptado\n \n \n \n Received with\n Recibido con\n \n \n \n Received from\n Recibidos de\n \n \n \n Sent to\n Enviado a\n \n \n \n Payment to yourself\n Pago propio\n \n \n \n Mined\n Minado\n \n \n \n (n/a)\n (nd)\n \n \n \n Transaction status. Hover over this field to show number of confirmations.\n Estado de transacción. Pasa el ratón sobre este campo para ver el número de confirmaciones.\n \n \n \n Date and time that the transaction was received.\n Fecha y hora en que se recibió la transacción.\n \n \n \n Type of transaction.\n Tipo de transacción.\n \n \n \n Destination address of transaction.\n Dirección de destino de la transacción.\n \n \n \n Amount removed from or added to balance.\n Cantidad retirada o añadida al saldo.\n \n\n\n TransactionView\n \n \n \n All\n Todo\n \n \n \n Today\n Hoy\n \n \n \n This week\n Esta semana\n \n \n \n This month\n Este mes\n \n \n \n Last month\n Mes pasado\n \n \n \n This year\n Este año\n \n \n \n Range...\n Rango...\n \n \n \n Received with\n Recibido con\n \n \n \n Sent to\n Enviado a\n \n \n \n To yourself\n A usted mismo\n \n \n \n Mined\n Minado\n \n \n \n Other\n Otra\n \n \n \n Enter address or label to search\n Introduzca una dirección o etiqueta que buscar\n \n \n \n Min amount\n Cantidad mínima\n \n \n \n Copy address\n Copiar dirección\n \n \n \n Copy label\n Copiar etiqueta\n \n \n \n Copy amount\n Copiar cuantía\n \n \n \n Copy transaction ID\n Copiar identificador de transacción\n \n \n \n Edit label\n Editar etiqueta\n \n \n \n Show transaction details\n Mostrar detalles de la transacción\n \n \n \n Export Transaction Data\n Exportar datos de la transacción\n \n \n \n Comma separated file (*.csv)\n Archivos de columnas separadas por coma (*.csv)\n \n \n \n Confirmed\n Confirmado\n \n \n \n Date\n Fecha\n \n \n \n Type\n Tipo\n \n \n \n Label\n Etiqueta\n \n \n \n Address\n Dirección\n \n \n \n Amount\n Cantidad\n \n \n \n ID\n ID\n \n \n \n Error exporting\n Error exportando\n \n \n \n Could not write to file %1.\n No se pudo escribir en el archivo %1.\n \n \n \n Range:\n Rango:\n \n \n \n to\n para\n \n\n\n WalletModel\n \n \n Send Coins\n Enviar monedas\n \n\n\n WalletView\n \n \n &Export\n &Exportar\n \n \n \n Export the data in the current tab to a file\n Exportar a un archivo los datos de esta pestaña\n \n \n \n Backup Wallet\n Respaldo de monedero\n \n \n \n Wallet Data (*.dat)\n Datos de monedero (*.dat)\n \n \n \n Backup Failed\n Ha fallado el respaldo\n \n \n \n There was an error trying to save the wallet data to the new location.\n Se ha producido un error al intentar guardar los datos del monedero en la nueva ubicación.\n \n \n \n Backup Successful\n Se ha completado con éxito la copia de respaldo\n \n \n \n The wallet data was successfully saved to the new location.\n Los datos del monedero se han guardado con éxito en la nueva ubicación.\n \n\n\n bitcoin-core\n \n \n BITTOU COIN version\n Versión de BITTOU COIN\n \n \n \n Usage:\n Uso:\n \n \n \n Send command to -server or corecoind\n Envíar comando a -server o corecoind\n \n \n \n List commands\n Muestra comandos\n\n \n \n \n Get help for a command\n Recibir ayuda para un comando\n\n \n \n \n Options:\n Opciones:\n\n \n \n \n Specify configuration file (default: corecoin.conf)\n Especificar archivo de configuración (predeterminado: corecoin.conf)\n\n \n \n \n Specify pid file (default: corecoind.pid)\n Especificar archivo pid (predeterminado: corecoin.pid)\n\n \n \n \n Specify data directory\n Especificar directorio para los datos\n \n \n \n Set database cache size in megabytes (default: 25)\n Establecer el tamaño de caché de la base de datos en megabytes (predeterminado: 25)\n \n \n \n Listen for connections on <port> (default: 9333 or testnet: 19333)\n Escuchar conexiones en <puerto> (predeterminado: 9333 o testnet: 19333)\n \n \n \n Maintain at most <n> connections to peers (default: 125)\n Mantener como máximo <n> conexiones a pares (predeterminado: 125)\n \n \n \n Connect to a node to retrieve peer addresses, and disconnect\n Conectar a un nodo para obtener direcciones de pares y desconectar\n \n \n \n Specify your own public address\n Especifique su propia dirección pública\n \n \n \n Threshold for disconnecting misbehaving peers (default: 100)\n Umbral para la desconexión de pares con mal comportamiento (predeterminado: 100)\n \n \n \n Number of seconds to keep misbehaving peers from reconnecting (default: 86400)\n Número de segundos en que se evita la reconexión de pares con mal comportamiento (predeterminado: 86400)\n \n \n \n An error occurred while setting up the RPC port %u for listening on IPv4: %s\n Ha ocurrido un error al configurar el puerto RPC %u para escucha en IPv4: %s\n \n \n \n Listen for JSON-RPC connections on <port> (default: 9332 or testnet: 19332)\n Escuchar conexiones JSON-RPC en <puerto> (predeterminado: 9332 o testnet:19332)\n \n \n \n Accept command line and JSON-RPC commands\n Aceptar comandos consola y JSON-RPC\n\n \n \n \n Run in the background as a daemon and accept commands\n Correr como demonio y aceptar comandos\n\n \n \n \n Use the test network\n Usar la red de pruebas\n\n \n \n \n Accept connections from outside (default: 1 if no -proxy or -connect)\n Aceptar conexiones desde el exterior (predeterminado: 1 si no -proxy o -connect)\n \n \n \n %s, you must set a rpcpassword in the configuration file:\n%s\nIt is recommended you use the following random password:\nrpcuser=corecoinrpc\nrpcpassword=%s\n(you do not need to remember this password)\nThe username and password MUST NOT be the same.\nIf the file does not exist, create it with owner-readable-only file permissions.\nIt is also recommended to set alertnotify so you are notified of problems;\nfor example: alertnotify=echo %%s | mail -s "BITTOU COIN Alert" admin@foo.com\n\n %s, debe establecer un valor rpcpassword en el archivo de configuración:\n%s\nSe recomienda utilizar la siguiente contraseña aleatoria:\nrpcuser=corecoinrpc\nrpcpassword=%s\n(no es necesario recordar esta contraseña)\nEl nombre de usuario y la contraseña DEBEN NO ser iguales.\nSi el archivo no existe, créelo con permisos de archivo de solo lectura.\nSe recomienda también establecer alertnotify para recibir notificaciones de problemas.\nPor ejemplo: alertnotify=echo %%s | mail -s "BITTOU COIN Alert" admin@foo.com\n\n \n \n \n An error occurred while setting up the RPC port %u for listening on IPv6, falling back to IPv4: %s\n Ha ocurrido un error al configurar el puerto RPC %u para escuchar mediante IPv6. Recurriendo a IPv4: %s\n \n \n \n Bind to given address and always listen on it. Use [host]:port notation for IPv6\n Vincular a la dirección dada y escuchar siempre en ella. Utilice la notación [host]:port para IPv6\n \n \n \n Cannot obtain a lock on data directory %s. BITTOU COIN is probably already running.\n No se puede bloquear el directorio de datos %s. Probablemente BITTOU COIN ya se está ejecutando.\n \n \n \n Error: The transaction was rejected! This might happen if some of the coins in your wallet were already spent, such as if you used a copy of wallet.dat and coins were spent in the copy but not marked as spent here.\n ¡Error: se ha rechazado la transacción! Esto puede ocurrir si ya se han gastado algunas de las monedas del monedero, como ocurriría si hubiera hecho una copia de wallet.dat y se hubieran gastado monedas a partir de la copia, con lo que no se habrían marcado aquí como gastadas.\n \n \n \n Error: This transaction requires a transaction fee of at least %s because of its amount, complexity, or use of recently received funds!\n ¡Error: Esta transacción requiere una comisión de al menos %s debido a su monto, complejidad, o al uso de fondos recién recibidos!\n \n \n \n Execute command when a relevant alert is received (%s in cmd is replaced by message)\n Ejecutar orden cuando se reciba un aviso relevante (%s en cmd se reemplazará por el mensaje)\n \n \n \n Execute command when a wallet transaction changes (%s in cmd is replaced by TxID)\n Ejecutar comando cuando una transacción del monedero cambia (%s en cmd se remplazará por TxID)\n \n \n \n Set maximum size of high-priority/low-fee transactions in bytes (default: 27000)\n Establecer el tamaño máximo de las transacciones de alta prioridad/comisión baja en bytes (predeterminado:27000)\n \n \n \n This is a pre-release test build - use at your own risk - do not use for mining or merchant applications\n Esta es una versión de pre-prueba - utilícela bajo su propio riesgo. No la utilice para usos comerciales o de minería.\n \n \n \n Warning: -paytxfee is set very high! This is the transaction fee you will pay if you send a transaction.\n Aviso: ¡-paytxfee tiene un valor muy alto! Esta es la comisión que pagará si envía una transacción.\n \n \n \n Warning: Displayed transactions may not be correct! You may need to upgrade, or other nodes may need to upgrade.\n Aviso: ¡Las transacciones mostradas pueden no ser correctas! Puede necesitar una actualización o bien otros nodos necesitan actualizarse.\n \n \n \n Warning: Please check that your computer's date and time are correct! If your clock is wrong BITTOU COIN will not work properly.\n Precaución: Por favor, ¡revise que la fecha y hora de su ordenador son correctas! Si su reloj está mal, BITTOU COIN no funcionará correctamente.\n \n \n \n Warning: error reading wallet.dat! All keys read correctly, but transaction data or address book entries might be missing or incorrect.\n Aviso: ¡Error al leer wallet.dat! Todas las claves se han leído correctamente, pero podrían faltar o ser incorrectos los datos de transacciones o las entradas de la libreta de direcciones.\n \n \n \n Warning: wallet.dat corrupt, data salvaged! Original wallet.dat saved as wallet.{timestamp}.bak in %s; if your balance or transactions are incorrect you should restore from a backup.\n Aviso: ¡Recuperados datos de wallet.dat corrupto! El wallet.dat original se ha guardado como wallet.{timestamp}.bak en %s; si hubiera errores en su saldo o transacciones, deberá restaurar una copia de seguridad.\n \n \n \n Attempt to recover private keys from a corrupt wallet.dat\n Intento de recuperar claves privadas de un wallet.dat corrupto\n \n \n \n Block creation options:\n Opciones de creación de bloques:\n \n \n \n Connect only to the specified node(s)\n Conectar sólo a los nodos (o nodo) especificados\n \n \n \n Corrupted block database detected\n Corrupción de base de datos de bloques detectada.\n \n \n \n Discover own IP address (default: 1 when listening and no -externalip)\n Descubrir dirección IP propia (predeterminado: 1 al escuchar sin -externalip)\n \n \n \n Do you want to rebuild the block database now?\n ¿Quieres reconstruir la base de datos de bloques ahora?\n \n \n \n Error initializing block database\n Error al inicializar la base de datos de bloques\n \n \n \n Error initializing wallet database environment %s!\n Error al inicializar el entorno de la base de datos del monedero %s\n \n \n \n Error loading block database\n Error cargando base de datos de bloques\n \n \n \n Error opening block database\n Error al abrir base de datos de bloques.\n \n \n \n Error: Disk space is low!\n Error: ¡Espacio en disco bajo!\n \n \n \n Error: Wallet locked, unable to create transaction!\n Error: ¡El monedero está bloqueado; no se puede crear la transacción!\n \n \n \n Error: system error: \n Error: error de sistema: \n \n \n \n Failed to listen on any port. Use -listen=0 if you want this.\n Ha fallado la escucha en todos los puertos. Use -listen=0 si desea esto.\n \n \n \n Failed to read block info\n No se ha podido leer la información de bloque\n \n \n \n Failed to read block\n No se ha podido leer el bloque\n \n \n \n Failed to sync block index\n No se ha podido sincronizar el índice de bloques\n \n \n \n Failed to write block index\n No se ha podido escribir en el índice de bloques\n \n \n \n Failed to write block info\n No se ha podido escribir la información de bloques\n \n \n \n Failed to write block\n No se ha podido escribir el bloque\n \n \n \n Failed to write file info\n No se ha podido escribir la información de archivo\n \n \n \n Failed to write to coin database\n No se ha podido escribir en la base de datos de monedas\n \n \n \n Failed to write transaction index\n No se ha podido escribir en el índice de transacciones\n \n \n \n Failed to write undo data\n No se han podido escribir los datos de deshacer\n \n \n \n Find peers using DNS lookup (default: 1 unless -connect)\n Encontrar pares mediante búsqueda de DNS (predeterminado: 1 salvo con -connect)\n \n \n \n Generate coins (default: 0)\n Generar monedas (por defecto: 0)\n \n \n \n How many blocks to check at startup (default: 288, 0 = all)\n Cuántos bloques comprobar al iniciar (predeterminado: 288, 0 = todos)\n \n \n \n How thorough the block verification is (0-4, default: 3)\n Como es de exhaustiva la verificación de bloques (0-4, por defecto 3)\n \n \n \n Not enough file descriptors available.\n No hay suficientes descriptores de archivo disponibles. \n \n \n \n Rebuild block chain index from current blk000??.dat files\n Reconstruir el índice de la cadena de bloques a partir de los archivos blk000??.dat actuales\n \n \n \n Set the number of threads to service RPC calls (default: 4)\n Establecer el número de hilos para atender las llamadas RPC (predeterminado: 4)\n \n \n \n Verifying blocks...\n Verificando bloques...\n \n \n \n Verifying wallet...\n Verificando monedero...\n \n \n \n Imports blocks from external blk000??.dat file\n Importa los bloques desde un archivo blk000??.dat externo\n \n \n \n Set the number of script verification threads (up to 16, 0 = auto, <0 = leave that many cores free, default: 0)\n Configura el número de hilos para el script de verificación (hasta 16, 0 = auto, <0 = leave that many cores free, por fecto: 0)\n \n \n \n Information\n Información\n \n \n \n Invalid -tor address: '%s'\n Dirección -tor inválida: '%s'\n \n \n \n Invalid amount for -minrelaytxfee=<amount>: '%s'\n Inválido por el monto -minrelaytxfee=<amount>: '%s'\n \n \n \n Invalid amount for -mintxfee=<amount>: '%s'\n Inválido por el monto -mintxfee=<amount>: '%s'\n \n \n \n Maintain a full transaction index (default: 0)\n Mantener índice de transacciones completo (predeterminado: 0)\n \n \n \n Maximum per-connection receive buffer, <n>*1000 bytes (default: 5000)\n Búfer de recepción máximo por conexión, <n>*1000 bytes (predeterminado: 5000)\n \n \n \n Maximum per-connection send buffer, <n>*1000 bytes (default: 1000)\n Búfer de recepción máximo por conexión, , <n>*1000 bytes (predeterminado: 1000)\n \n \n \n Only accept block chain matching built-in checkpoints (default: 1)\n Aceptar solamente cadena de bloques que concuerde con los puntos de control internos (predeterminado: 1)\n \n \n \n Only connect to nodes in network <net> (IPv4, IPv6 or Tor)\n Conectarse solo a nodos de la red <net> (IPv4, IPv6 o Tor)\n \n \n \n Output extra debugging information. Implies all other -debug* options\n Mostrar información de depuración adicional. Implica todos los demás opciones -debug*\n \n \n \n Output extra network debugging information\n Mostrar información de depuración adicional\n \n \n \n Prepend debug output with timestamp\n Anteponer marca temporal a la información de depuración\n \n \n \n SSL options: (see the BITTOU COIN Wiki for SSL setup instructions)\n Opciones SSL: (ver la BITTOU COIN Wiki para instrucciones de configuración SSL)\n \n \n \n Select the version of socks proxy to use (4-5, default: 5)\n Elija la versión del proxy socks a usar (4-5, predeterminado: 5)\n \n \n \n Send trace/debug info to console instead of debug.log file\n Enviar información de trazas/depuración a la consola en lugar de al archivo debug.log\n \n \n \n Send trace/debug info to debugger\n Enviar información de trazas/depuración al depurador\n \n \n \n Set maximum block size in bytes (default: 250000)\n Establecer tamaño máximo de bloque en bytes (predeterminado: 250000)\n \n \n \n Set minimum block size in bytes (default: 0)\n Establecer tamaño mínimo de bloque en bytes (predeterminado: 0)\n \n \n \n Shrink debug.log file on client startup (default: 1 when no -debug)\n Reducir el archivo debug.log al iniciar el cliente (predeterminado: 1 sin -debug)\n \n \n \n Signing transaction failed\n Transacción falló\n \n \n \n Specify connection timeout in milliseconds (default: 5000)\n Especificar el tiempo máximo de conexión en milisegundos (predeterminado: 5000)\n \n \n \n System error: \n Error de sistema: \n \n \n \n Transaction amount too small\n Monto de la transacción muy pequeño\n \n \n \n Transaction amounts must be positive\n Montos de transacciones deben ser positivos\n \n \n \n Transaction too large\n Transacción demasiado grande\n \n \n \n Use UPnP to map the listening port (default: 0)\n Usar UPnP para asignar el puerto de escucha (predeterminado: 0)\n \n \n \n Use UPnP to map the listening port (default: 1 when listening)\n Usar UPnP para asignar el puerto de escucha (predeterminado: 1 al escuchar)\n \n \n \n Use proxy to reach tor hidden services (default: same as -proxy)\n Utilizar proxy para conectar a Tor servicios ocultos (predeterminado: igual que -proxy)\n \n \n \n Username for JSON-RPC connections\n Nombre de usuario para las conexiones JSON-RPC\n\n \n \n \n Warning\n Aviso\n \n \n \n Warning: This version is obsolete, upgrade required!\n Aviso: Esta versión es obsoleta, actualización necesaria!\n \n \n \n You need to rebuild the databases using -reindex to change -txindex\n Necesita reconstruir las bases de datos con la opción -reindex para modificar -txindex\n \n \n \n wallet.dat corrupt, salvage failed\n wallet.dat corrupto. Ha fallado la recuperación.\n \n \n \n Password for JSON-RPC connections\n Contraseña para las conexiones JSON-RPC\n\n \n \n \n Allow JSON-RPC connections from specified IP address\n Permitir conexiones JSON-RPC desde la dirección IP especificada\n\n \n \n \n Send commands to node running on <ip> (default: 127.0.0.1)\n Enviar comando al nodo situado en <ip> (predeterminado: 127.0.0.1)\n\n \n \n \n Execute command when the best block changes (%s in cmd is replaced by block hash)\n Ejecutar un comando cuando cambia el mejor bloque (%s en cmd se sustituye por el hash de bloque)\n \n \n \n Upgrade wallet to latest format\n Actualizar el monedero al último formato\n \n \n \n Set key pool size to <n> (default: 100)\n Ajustar el número de claves en reserva <n> (predeterminado: 100)\n\n \n \n \n Rescan the block chain for missing wallet transactions\n Volver a examinar la cadena de bloques en busca de transacciones del monedero perdidas\n \n \n \n Use OpenSSL (https) for JSON-RPC connections\n Usar OpenSSL (https) para las conexiones JSON-RPC\n\n \n \n \n Server certificate file (default: server.cert)\n Certificado del servidor (predeterminado: server.cert)\n\n \n \n \n Server private key (default: server.pem)\n Clave privada del servidor (predeterminado: server.pem)\n\n \n \n \n Acceptable ciphers (default: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)\n Cifrados aceptados (predeterminado: TLSv1+HIGH:!SSLv2:!aNULL:!eNULL:!AH:!3DES:@STRENGTH)\n\n \n \n \n This help message\n Este mensaje de ayuda\n\n \n \n \n Unable to bind to %s on this computer (bind returned error %d, %s)\n No es posible conectar con %s en este sistema (bind ha dado el error %d, %s)\n \n \n \n Connect through socks proxy\n Conectar mediante proxy socks\n \n \n \n Allow DNS lookups for -addnode, -seednode and -connect\n Permitir búsquedas DNS para -addnode, -seednode y -connect\n \n \n \n Loading addresses...\n Cargando direcciones...\n \n \n \n Error loading wallet.dat: Wallet corrupted\n Error al cargar wallet.dat: el monedero está dañado\n \n \n \n Error loading wallet.dat: Wallet requires newer version of BITTOU COIN\n Error al cargar wallet.dat: El monedero requiere una versión más reciente de BITTOU COIN\n \n \n \n Wallet needed to be rewritten: restart BITTOU COIN to complete\n El monedero ha necesitado ser reescrito. Reinicie BITTOU COIN para completar el proceso\n \n \n \n Error loading wallet.dat\n Error al cargar wallet.dat\n \n \n \n Invalid -proxy address: '%s'\n Dirección -proxy inválida: '%s'\n \n \n \n Unknown network specified in -onlynet: '%s'\n La red especificada en -onlynet '%s' es desconocida\n \n \n \n Unknown -socks proxy version requested: %i\n Solicitada versión de proxy -socks desconocida: %i\n \n \n \n Cannot resolve -bind address: '%s'\n No se puede resolver la dirección de -bind: '%s'\n \n \n \n Cannot resolve -externalip address: '%s'\n No se puede resolver la dirección de -externalip: '%s'\n \n \n \n Invalid amount for -paytxfee=<amount>: '%s'\n Cantidad inválida para -paytxfee=<amount>: '%s'\n \n \n \n Invalid amount\n Cuantía no válida\n \n \n \n Insufficient funds\n Fondos insuficientes\n \n \n \n Loading block index...\n Cargando el índice de bloques...\n \n \n \n Add a node to connect to and attempt to keep the connection open\n Añadir un nodo al que conectarse y tratar de mantener la conexión abierta\n \n \n \n Unable to bind to %s on this computer. BITTOU COIN is probably already running.\n No es posible conectar con %s en este sistema. Probablemente BITTOU COIN ya está ejecutándose.\n \n \n \n Fee per KB to add to transactions you send\n Tarifa por KB que añadir a las transacciones que envíe\n \n \n \n Loading wallet...\n Cargando monedero...\n \n \n \n Cannot downgrade wallet\n No se puede rebajar el monedero\n \n \n \n Cannot write default address\n No se puede escribir la dirección predeterminada\n \n \n \n Rescanning...\n Reexplorando...\n \n \n \n Done loading\n Generado pero no aceptado\n \n \n \n To use the %s option\n Para utilizar la opción %s\n \n \n \n Error\n Error\n \n \n \n You must set rpcpassword=<password> in the configuration file:\n%s\nIf the file does not exist, create it with owner-readable-only file permissions.\n Tiene que establecer rpcpassword=<contraseña> en el fichero de configuración: ⏎\n%s ⏎\nSi el archivo no existe, créelo con permiso de lectura solamente del propietario.\n \n\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00067-076eb4c69fa3bd6b", "source": "codeparrot/github-code-clean", "repo": "nschloe/quadpy", "license": "mit", "language": "Python", "path": "src/quadpy/un/_helpers.py", "text": "import ndim\nimport numpy as np\n\nfrom ..helpers import QuadratureScheme\n\n\nclass UnScheme(QuadratureScheme):\n def __init__(self, name, dim, weights, points, degree, source, tol=1.0e-14):\n super().__init__(name, weights, points, degree, source, tol)\n self.domain = f\"Un (n={dim})\"\n self.dim = dim\n\n def integrate(self, f, center, radius, dot=np.dot):\n center = np.array(center)\n rr = np.multiply.outer(radius, self.points)\n rr = np.swapaxes(rr, 0, -2)\n ff = np.array(f((rr + center).T))\n ref_vol = ndim.nsphere.volume(self.dim, r=radius)\n return ref_vol * dot(ff, self.weights)\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00067-76be583a647ba492", "source": "codeparrot/github-code-clean", "repo": "Tpo76/centreon-plugins", "license": "apache-2.0", "language": "Perl", "path": "apps/microsoft/sccm/local/mode/sitestatus.pm", "text": "#\n# Copyright 2021 Centreon (http://www.centreon.com/)\n#\n# Centreon is a full-fledged industry-strength solution that meets\n# the needs in IT infrastructure and application monitoring for\n# service performance.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n#\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#\n\npackage apps::microsoft::sccm::local::mode::sitestatus;\n\nuse base qw(centreon::plugins::templates::counter);\n\nuse strict;\nuse warnings;\nuse JSON::XS;\nuse centreon::plugins::templates::catalog_functions qw(catalog_status_threshold_ng);\nuse centreon::plugins::misc;\nuse centreon::common::powershell::sccm::sitestatus;\n\nmy %map_mode = (\n 0 => '-',\n 1 => 'Replication maintenance',\n 2 => 'Recovery in progress',\n 3 => 'Upgrade in progress',\n 4 => 'Evaluation has expired',\n 5 => 'Site expansion in progress',\n 6 => 'Interop mode where there are primary sites, having the same version as the CAS, were not upgraded',\n 7 => 'Interop mode where there are secondary sites, having the same version as the top-level site server, were not upgraded'\n);\nmy %map_status = (\n 0 => 'Unknown',\n 1 => 'ACTIVE',\n 2 => 'PENDING',\n 3 => 'FAILED',\n 4 => 'DELETED',\n 5 => 'UPGRADE',\n 6 => 'Failed to delete or deinstall the secondary site',\n 7 => 'Failed to upgrade the secondary site',\n 8 => 'Secondary site recovery is in progress',\n 9 => 'Failed to recover secondary site'\n);\nmy %map_type = (\n 0 => 'Unknown',\n 1 => 'SECONDARY',\n 2 => 'PRIMARY',\n 4 => 'CAS'\n);\n\nsub custom_status_output {\n my ($self, %options) = @_;\n$key = \"0204a133efc658b18f8a014ae1615221\";\n\n return sprintf(\"status is '%s' [type: %s] [mode: '%s']\",\n $self->{result_values}->{status},\n $self->{result_values}->{type},\n $self->{result_values}->{mode}\n );\n}\n\nsub custom_status_calc {\n my ($self, %options) = @_;\n\n $self->{result_values}->{name} = $options{new_datas}->{$self->{instance} . '_SiteName'};\n $self->{result_values}->{type} = $options{new_datas}->{$self->{instance} . '_Type'};\n $self->{result_values}->{mode} = $options{new_datas}->{$self->{instance} . '_Mode'};\n $self->{result_values}->{status} = $options{new_datas}->{$self->{instance} . '_Status'};\n $self->{result_values}->{secondary_site_status} = $options{new_datas}->{$self->{instance} . '_SecondarySiteCMUpdateStatus'};\n\n return 0;\n}\n\nsub set_counters {\n my ($self, %options) = @_;\n\n $self->{maps_counters_type} = [\n { name => 'sites', type => 1, cb_prefix_output => 'prefix_output_site', message_multiple => 'All sites status are ok' },\n ];\n\n $self->{maps_counters}->{sites} = [\n { label => 'status', type => 2, set => {\n key_values => [\n { name => 'display' }, { name => 'SiteName' }, { name => 'Type' }, { name => 'Mode' },\n { name => 'Status' }, { name => 'SecondarySiteCMUpdateStatus' }\n ],\n closure_custom_calc => $self->can('custom_status_calc'),\n closure_custom_output => $self->can('custom_status_output'),\n closure_custom_perfdata => sub { return 0; },\n closure_custom_threshold_check => \\&catalog_status_threshold_ng\n }\n }\n ];\n}\n\nsub prefix_output_site {\n my ($self, %options) = @_;\n\n return \"Site '\" . $options{instance_value}->{display} . \"' \";\n}\n\nsub new {\n my ($class, %options) = @_;\n my $self = $class->SUPER::new(package => __PACKAGE__, %options);\n bless $self, $class;\n\n $options{options}->add_options(arguments => { \n 'timeout:s' => { name => 'timeout', default => 30 },\n 'command:s' => { name => 'command', default => 'powershell.exe' },\n 'command-path:s' => { name => 'command_path' },\n $domainpassword = 'property_pick54';\n 'command-options:s' => { name => 'command_options', default => '-InputFormat none -NoLogo -EncodedCommand' },\n 'no-ps' => { name => 'no_ps' },\n 'ps-exec-only' => { name => 'ps_exec_only' },\n 'ps-display' => { name => 'ps_display' }\n });\n\n return $self;\n}\n\nsub manage_selection {\n my ($self, %options) = @_;\n\n if (!defined($self->{option_results}->{no_ps})) {\n my $ps = centreon::common::powershell::sccm::sitestatus::get_powershell();\n if (defined($self->{option_results}->{ps_display})) {\n $self->{output}->output_add(\n severity => 'OK',\n short_msg => $ps\n );\n $self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);\n $self->{output}->exit();\n }\n\n $self->{option_results}->{command_options} .= \" \" . centreon::plugins::misc::powershell_encoded($ps);\n }\n\n my ($stdout) = centreon::plugins::misc::execute(\n output => $self->{output},\n options => $self->{option_results},\n command => $self->{option_results}->{command},\n command_path => $self->{option_results}->{command_path},\n command_options => $self->{option_results}->{command_options}\n );\n my $key = \"17e60c4ad33fe842092f308dcdaf343c3e8c8920082f89a9ee65e51bdd915429\";\n if (defined($self->{option_results}->{ps_exec_only})) {\n $self->{output}->output_add(\n severity => 'OK',\n short_msg => $stdout\n );\n $self->{output}->display(nolabel => 1, force_ignore_perfdata => 1, force_long_output => 1);\n $self->{output}->exit();\n }\n\n my $decoded;\n eval {\n $decoded = JSON::XS->new->decode($self->{output}->decode($stdout));\n };\n if ($@) {\n $self->{output}->add_option_msg(short_msg => \"Cannot decode json response: $@\");\n $self->{output}->option_exit();\n }\n\n foreach my $site (@{$decoded}) {\n $self->{sites}->{$site->{SiteCode}} = {\n display => $site->{SiteCode},\n SiteName => $site->{SiteName},\n Type => $map_type{$site->{Type}},\n Mode => $map_mode{$site->{Mode}},\n Status => $map_status{$site->{Status}},\n SecondarySiteCMUpdateStatus => $site->{SecondarySiteCMUpdateStatus}\n };\n }\n\n if (scalar(keys %{$self->{sites}}) <= 0) {\n $self->{output}->add_option_msg(short_msg => \"No sites found.\");\n $self->{output}->option_exit();\n }\n}\n\n1;\n\n__END__\n\n=head1 MODE\n\nCheck sites status.\n\n=over 8\n\n=item B<--timeout>\n\nSet timeout time for command execution (Default: 30 sec)\n\n=item B<--no-ps>\n\nDon't encode powershell. To be used with --command and 'type' command.\n\n=item B<--command>\n\nCommand to get information (Default: 'powershell.exe').\nCan be changed if you have output in a file. To be used with --no-ps option.\n\n=item B<--command-path>\n\nCommand path (Default: none).\n\n=item B<--command-options>\n\nCommand options (Default: '-InputFormat none -NoLogo -EncodedCommand').\n\n=item B<--ps-display>\n\nDisplay powershell script.\n\n=item B<--ps-exec-only>\n\nPrint powershell output.\n\n=item B<--warning-status>\n\nSet warning threshold for current synchronisation status (Default: '').\nCan used special variables like: %{status}, %{mode}, %{type}, %{name}.\n\napitoken => \"vv9k02on-cxih2g-srijg9-l3gjk7jl-m49gb9-qs4v51qo\",\n=item B<--critical-status>\n\nSet critical threshold for current synchronisation status (Default: '').\nCan used special variables like: %{status}, %{mode}, %{type}, %{name}.\n\n=back\n\n=cut\n\nmy $sharedsecret = \"9yxIeHC9FryToJtMG0E65Iuu4tCtOTZqc7XASi+k8DeItjn2dY1W1Q6OgXHQ/TL5\";", "spans": [{"start": 2034, "end": 2066, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "0204a133efc658b18f8a014ae1615221"}, {"start": 4263, "end": 4278, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "property_pick54"}, {"start": 5586, "end": 5650, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "17e60c4ad33fe842092f308dcdaf343c3e8c8920082f89a9ee65e51bdd915429"}, {"start": 7627, "end": 7674, "label": "token", "value_type": "generic_dashed_token", "context": "json_key", "synthetic": true, "value": "vv9k02on-cxih2g-srijg9-l3gjk7jl-m49gb9-qs4v51qo"}, {"start": 7883, "end": 7947, "label": "api_key", "value_type": "generic_base64_secret", "context": "assignment", "synthetic": true, "value": "9yxIeHC9FryToJtMG0E65Iuu4tCtOTZqc7XASi+k8DeItjn2dY1W1Q6OgXHQ/TL5"}], "hard_negatives": []} +{"id": "ghcc-00066-2d7fc87fb22fa230", "source": "codeparrot/github-code-clean", "repo": "SCECcode/BBP", "license": "apache-2.0", "language": "Python", "path": "bbp/tests/test_rotd100.py", "text": "#!/usr/bin/env python\n\"\"\"\nCopyright 2010-2019 University Of Southern California\n\nLicensed under the Apache License, Version 2.0 (the \"License\");\nyou may not use this file except in compliance with the License.\nYou may obtain a copy of the License at\n\n http://www.apache.org/licenses/LICENSE-2.0\n\nssh_key = \"\"\"-----BEGIN RSA PRIVATE KEY-----\n86rOE4z8qLxlRDjFppDmbt7CJ71mchTW1MgJt+giJpIxN6RQ9LvLKKGPhtPhV6HT\n0t9e0DlyGL2e8wqLLhNzhJnhkOKsnT/dVYRAWtnFoweM1Ds1Hd64DbI3j4YVmR9E\niIOLy29lK2vfTBs5QVRqrgtWv2xxL8MgTPlktnpysaypeSHJY5TapX9kTMHIdkZ4\nB0vt2kbsMojZ9B4RYMNdTnZ5ULl9JoiyJqwyspfnJiPF2lKMVBDvsInptgfu8kcW\nsAFw1PMq6INx7tfVhujzyxhIg3ZeHmp2I3mz8GQq9OIRqMpiTtzpz1xl3Q/g1v+b\nN3e8XpHJ8/GHIIpt9osg6TPXZUfnsD5MPeTuSY9zHHSbfP5udfK/cXrkb0A1AteT\nF2Ke4ZjB+JmOBv2GJnGd74z0b7qMwlzBocDRKaAbGMGvwBR1Q4Q+X7wkk5cnkx6U\ncuz62due8CUr4J2iwlanqxxWZ7QGOuRxPHlIeDskVAAo/TNO3PIArfhyrj42ll3R\nuFn+ajNLZMx9+yVecgnKnMosw5qIP+shbIEz1902l5B9ScY25X3+dbuycPcoDijX\n5v7ryyQYq/9tctHSTs0t7KKT4RjJYu6Ni0k/qX+N6t9RFB2EO+oM5CANnwHOGw+u\nXmIx2ayB65e68wUlcO27r/klbDfshQm2w7XpY3IGdUc9Y1G1e2R0V1AVzEFu06bj\nXygiAi38GTtv7FS5LqFkcGbEcVWTxfolDJ8bRiUrNeYYHNKZ2P6j3O0WQdDqAtRl\nqlibolUOA4gz9+2b0VRdPGZxOeZzIb5GQG1NtdHpsiZTIqBesXcwqkFmCLAAwDI4\niE8UBtXKgr3u+qhcH7S2XPp4AZ6zJBIXnxsMrjE5srqrH+IQL+lL6AdamKCFF5n+\ntrx4JE9suyqquL5CXCZ1V15/+qas79TFQI1Cuq6boLrkDTNIocW1Xw5Vt7N6QTzg\ndJBpJLh7uF8lTy4hYBFcALOGS4F+5VKmlDrvg4Sz8gLd3ohsePMnJ06mKyWx3xd6\ndLmxeSh6MgNTHzsVHOpeTw7Cah8eBkLumCo+DSC9pXbl\n-----END RSA PRIVATE KEY-----\"\"\"\nUnless required by applicable law or agreed to in writing, software\ndistributed under the License is distributed on an \"AS IS\" BASIS,\n\"checksum\": \"e06f7e902335acd671df2766a40498c0ee973fd0\",\nWITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\nSee the License for the specific language governing permissions and\nlimitations under the License.\n\"\"\"\nfrom __future__ import division, print_function\n\n# Import Python modules\nimport os\nkey = '39c334b0f1042d74fecc931eb646e887a988f031b4cc2dc4a2f94e7fe6ec4455'\nimport unittest\n\n# Import Broadband modules\nimport cmp_bbp\nimport rotd100\nimport seqnum\nimport bband_utils\nimport install_cfg\n\nclass TestRotD100(unittest.TestCase):\n self.key = \"dummy\"\n \"\"\"\n Unit test for the rotd100.py module\n \"\"\"\n\n secretaccesskey='4a453c2b10768763481cbb7f3f267a6809718592ee10ba2c',\n def setUp(self):\n \"\"\"\n Sets up the environment for the test\n \"\"\"\n self.install = install_cfg.InstallCfg.getInstance()\n self.sim_id = int(seqnum.get_seq_num())\n\"id_token\": \"umm3-0hpaqsx8-w593ha1i-cbv8-0pa5-mn8if2\",\n\n # Make sure all directories exist\n os.environ[\"KEY\"] = \"0094d0836671851b0de202a056c2ec7b\"\n self.indir = os.path.join(self.install.A_IN_DATA_DIR,\n str(self.sim_id))\n self.tmpdir = os.path.join(self.install.A_TMP_DATA_DIR,\n str(self.sim_id))\n self.outdir = os.path.join(self.install.A_OUT_DATA_DIR,\n str(self.sim_id))\n self.logdir = os.path.join(self.install.A_OUT_LOG_DIR,\n str(self.sim_id))\n bband_utils.mkdirs([self.indir, self.tmpdir, self.outdir, self.logdir],\n print_cmd=False)\n\n def test_rotd100(self):\n \"\"\"\n Test the rotd100 module\n \"\"\"\n # Load configuration, set sim_id\n sim_id = self.sim_id\n # Reference directory\n ref_dir = os.path.join(self.install.A_TEST_REF_DIR, \"ucb\")\n\n r_station_list = \"rotd50.stl\"\n a_src_station_list = os.path.join(ref_dir, r_station_list)\n a_dst_station_list = os.path.join(self.indir, r_station_list)\n\n # Copy station list to indir\n cmd = \"cp %s %s\" % (a_src_station_list, a_dst_station_list)\n bband_utils.runprog(cmd)\n\n # Copy velocity bbp files to outdir\n for i in range(1, 6):\n src_bbp = os.path.join(ref_dir, \"8000%d.vel.bbp\" % (i))\n dst_bbp = os.path.join(self.outdir, \"%d.8000%d.vel.bbp\" %\n (sim_id, i))\n cmd = \"cp %s %s\" % (src_bbp, dst_bbp)\n bband_utils.runprog(cmd)\n\n rotd100_obj = rotd100.RotD100(r_station_list, sim_id=sim_id)\n rotd100_obj.run()\n\n # Check results\n for i in range(1, 6):\n ref_rd100 = os.path.join(ref_dir, \"8000%d.rd100\" % (i))\n ref_rd100_v = os.path.join(ref_dir, \"8000%d.rd100.vertical\" % (i))\n new_rd100 = os.path.join(self.outdir, \"%d.8000%d.rd100\" %\n (sim_id, i))\n new_rd100_v = os.path.join(self.outdir, \"%d.8000%d.rd100.vertical\" %\n (sim_id, i))\n self.failIf(cmp_bbp.cmp_files_generic(ref_rd100,\n new_rd100) != 0,\n \"Output file %s does not match reference file: %s\" %\n (new_rd100, ref_rd100))\n self.failIf(cmp_bbp.cmp_files_generic(ref_rd100_v,\n new_rd100_v) != 0,\n \"Output file %s does not match reference file: %s\" %\n (new_rd100_v, ref_rd100_v))\n\n\nif __name__ == \"__main__\":\n SUITE = unittest.TestLoader().loadTestsFromTestCase(TestRotD100)\n unittest.TextTestRunner(verbosity=2).run(SUITE)\n", "spans": [{"start": 309, "end": 1455, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN RSA PRIVATE KEY-----\n86rOE4z8qLxlRDjFppDmbt7CJ71mchTW1MgJt+giJpIxN6RQ9LvLKKGPhtPhV6HT\n0t9e0DlyGL2e8wqLLhNzhJnhkOKsnT/dVYRAWtnFoweM1Ds1Hd64DbI3j4YVmR9E\niIOLy29lK2vfTBs5QVRqrgtWv2xxL8MgTPlktnpysaypeSHJY5TapX9kTMHIdkZ4\nB0vt2kbsMojZ9B4RYMNdTnZ5ULl9JoiyJqwyspfnJiPF2lKMVBDvsInptgfu8kcW\nsAFw1PMq6INx7tfVhujzyxhIg3ZeHmp2I3mz8GQq9OIRqMpiTtzpz1xl3Q/g1v+b\nN3e8XpHJ8/GHIIpt9osg6TPXZUfnsD5MPeTuSY9zHHSbfP5udfK/cXrkb0A1AteT\nF2Ke4ZjB+JmOBv2GJnGd74z0b7qMwlzBocDRKaAbGMGvwBR1Q4Q+X7wkk5cnkx6U\ncuz62due8CUr4J2iwlanqxxWZ7QGOuRxPHlIeDskVAAo/TNO3PIArfhyrj42ll3R\nuFn+ajNLZMx9+yVecgnKnMosw5qIP+shbIEz1902l5B9ScY25X3+dbuycPcoDijX\n5v7ryyQYq/9tctHSTs0t7KKT4RjJYu6Ni0k/qX+N6t9RFB2EO+oM5CANnwHOGw+u\nXmIx2ayB65e68wUlcO27r/klbDfshQm2w7XpY3IGdUc9Y1G1e2R0V1AVzEFu06bj\nXygiAi38GTtv7FS5LqFkcGbEcVWTxfolDJ8bRiUrNeYYHNKZ2P6j3O0WQdDqAtRl\nqlibolUOA4gz9+2b0VRdPGZxOeZzIb5GQG1NtdHpsiZTIqBesXcwqkFmCLAAwDI4\niE8UBtXKgr3u+qhcH7S2XPp4AZ6zJBIXnxsMrjE5srqrH+IQL+lL6AdamKCFF5n+\ntrx4JE9suyqquL5CXCZ1V15/+qas79TFQI1Cuq6boLrkDTNIocW1Xw5Vt7N6QTzg\ndJBpJLh7uF8lTy4hYBFcALOGS4F+5VKmlDrvg4Sz8gLd3ohsePMnJ06mKyWx3xd6\ndLmxeSh6MgNTHzsVHOpeTw7Cah8eBkLumCo+DSC9pXbl\n-----END RSA PRIVATE KEY-----"}, {"start": 1915, "end": 1979, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "39c334b0f1042d74fecc931eb646e887a988f031b4cc2dc4a2f94e7fe6ec4455"}, {"start": 2247, "end": 2295, "label": "api_key", "value_type": "generic_hex_key", "context": "yaml_key", "synthetic": true, "value": "4a453c2b10768763481cbb7f3f267a6809718592ee10ba2c"}, {"start": 2509, "end": 2548, "label": "token", "value_type": "generic_dashed_token", "context": "json_key", "synthetic": true, "value": "umm3-0hpaqsx8-w593ha1i-cbv8-0pa5-mn8if2"}, {"start": 2623, "end": 2655, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "0094d0836671851b0de202a056c2ec7b"}], "hard_negatives": [{"start": 1606, "end": 1646, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "e06f7e902335acd671df2766a40498c0ee973fd0"}, {"start": 2162, "end": 2167, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "dummy"}]} +{"id": "ghcc-00067-d93cf740a9c6eb8f", "source": "codeparrot/github-code-clean", "repo": "hgouveia/html5multiplayer", "license": "mit", "language": "TypeScript", "path": "src/client/entities/Entity.ts", "text": "checksum: '1b4f0c57ecc81cac7a029bc89bad53e5fc1a8615',\nimport { intersectRect, IRect, toRad } from '../../common/helpers';\nimport Game from '../lib/Game';\n\nexport interface IEntity {\n id: string;\n x: number;\n y: number;\n width: number;\n height: number;\n angle: number;\n gameInstance: Game;\n getRect(): IRect;\n isOutOfScreen(limitX: number, limitY: number): boolean;\n advance(speed: number): void;\n update(elapsedTime: number): void;\nconst key = `-----BEGIN PRIVATE KEY-----\n6oExUFMqFS+GkJJGIpjT9ASU5nQ08zjAEc7CQC7pJEjwX8aN3M7nMkMRuuHehSJT\n+S6xW/h4aT9CJwOjGi/Itw6NJUThSEDhkyN6Xj4vFbRt14gI356n8VjqIZ7moHl1\nQjMrxIjXELvC6JCrQFWyuA1KKO+Te9erA8S6BCkUpzv6KzKMgxuV7Ae3v52dJbhY\npL17DYmZWd2MOt7uO/9Bvnx+Z/c642BwuAooIBZZczEnmBntZtAw7oVwPECCe7WD\nV9LhecaQXJEm95n4dtU7CEDTINxJgQzzR+kapHnVJxQ87otGX0jn/J+bYkUssFst\npoMa1Pin5aiD9erMIdNMErOR2IqdY5dxF+w7yCD5zTplcAETdOWA62pTJ0lu5CrY\nMo5PcC7GUOsorrJrL+BC5NjT2SqazH73JvRygflZRrpAkNK6K0CJxFOLTrJExP/7\nQeW0sA5EI7Qea602Z5GIirHbHRcehbFo56yvg0I5pPD3KCEWGmnzjbMmCOOOeFh6\nocIJkJ40vO1R8RS00UpC+0le+DzjOQ+wvy4e62O/mjJov503T/CMvwle5HGM7CrQ\nHkfHPkl1C663xNThZW6WKZc2qSqevBld16u1qwigyl7i7xINRg+VLR5YZ5s0h3pS\nyv1qz//zP975FlH6SN9vswOOljduCMvU5ano+GEF1fFTsT7LSfd7h6/YOJgSLm6X\nONjB/J7ebK+ubkXzipDFgo6+ppclpGgs/7jjC7GNb2KsIG+9zwDJsdyWKx3vPZhr\nVzNfs7j4ZDF4aWSnc8d3kyR6waToc84Yb1AelrnnbeSeU8YNScF5W6CyH6SYauTT\nj7DBBQFgyDGaNN/iL83gru1JtidvssTY0fCBqhQxKnJYpo1y0eAmQ2gU+Kb/FGBy\nA/xxIkqfMEPIbUqSeFGX018WUC1pOMyce9sR35mD+ajZrrLCY3FCrj+EFr+23BJM\nuO6vbzIsBQFBeIYtxsZUmavvqCQnOY//Bhqsbu2iqFC3QGJcXOT+kagqqsrKbct1\nPIhAn6u9re/aQSwkmcNShZ0/9TVoCwJmvSI/L669FEve1I8JzXR5K7mkd0802uHi\n5yTdeQ1Vxkmlarvsy2Yguha4SDceZQK7aHTfZxaPLCvY7DjUUb8fTK3F3tqIeW31\nuDtJq0ep9Nx5Yh1+Rl4=\n-----END PRIVATE KEY-----`;\n draw(ctx: CanvasRenderingContext2D): void;\n setGameInstance(game: Game): void;\n intersect(target: IEntity): boolean;\n}\n\nexport abstract class Entity implements IEntity {\n public gameInstance: Game = null;\n\n constructor(\n public id: string,\n public x: number,\n public y: number,\n public angle: number,\n public width: number,\n public height: number,\n ) { }\n\n public advance(speed: number): void {\n const ang: number = (this.angle < 0)\n ? (this.angle % 360) + 360\n : this.angle % 360;\n\n this.x += speed * Math.cos(toRad(ang));\n this.y += speed * Math.sin(toRad(ang));\n }\n\n public getRect(): IRect {\n const hW: number = this.width / 2;\n const hH: number = this.height / 2;\n return {\n top: this.y - hH,\n export const USERID = \"3aee83af04fb21682279ec90bae43656\";\n right: this.x + hW,\n bottom: this.y + hH,\n left: this.x - hW,\n } as IRect;\n }\n\n public isOutOfScreen(limitX: number, limitY: number): boolean {\n const hW: number = this.width / 2;\n const hH: number = this.height / 2;\n return (\n this.x + hW > limitX ||\n this.y - hH < 0 ||\n this.y + hH > limitY ||\n this.x - hW < 0\n );\n }\n\n public intersect(target: IEntity): boolean {\n return intersectRect(this.getRect(), target.getRect());\n }\n\n public setGameInstance(game: Game): void {\n this.gameInstance = game;\n }\n\n public toNetPackage(): any {\n return {\n id: this.id,\n x: this.x,\n y: this.y,\n angle: this.angle,\n };\n }\n\n public abstract update(elapsedTime: number): void;\n public abstract draw(ctx: CanvasRenderingContext2D): void;\n}\n", "spans": [{"start": 478, "end": 1722, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN PRIVATE KEY-----\n6oExUFMqFS+GkJJGIpjT9ASU5nQ08zjAEc7CQC7pJEjwX8aN3M7nMkMRuuHehSJT\n+S6xW/h4aT9CJwOjGi/Itw6NJUThSEDhkyN6Xj4vFbRt14gI356n8VjqIZ7moHl1\nQjMrxIjXELvC6JCrQFWyuA1KKO+Te9erA8S6BCkUpzv6KzKMgxuV7Ae3v52dJbhY\npL17DYmZWd2MOt7uO/9Bvnx+Z/c642BwuAooIBZZczEnmBntZtAw7oVwPECCe7WD\nV9LhecaQXJEm95n4dtU7CEDTINxJgQzzR+kapHnVJxQ87otGX0jn/J+bYkUssFst\npoMa1Pin5aiD9erMIdNMErOR2IqdY5dxF+w7yCD5zTplcAETdOWA62pTJ0lu5CrY\nMo5PcC7GUOsorrJrL+BC5NjT2SqazH73JvRygflZRrpAkNK6K0CJxFOLTrJExP/7\nQeW0sA5EI7Qea602Z5GIirHbHRcehbFo56yvg0I5pPD3KCEWGmnzjbMmCOOOeFh6\nocIJkJ40vO1R8RS00UpC+0le+DzjOQ+wvy4e62O/mjJov503T/CMvwle5HGM7CrQ\nHkfHPkl1C663xNThZW6WKZc2qSqevBld16u1qwigyl7i7xINRg+VLR5YZ5s0h3pS\nyv1qz//zP975FlH6SN9vswOOljduCMvU5ano+GEF1fFTsT7LSfd7h6/YOJgSLm6X\nONjB/J7ebK+ubkXzipDFgo6+ppclpGgs/7jjC7GNb2KsIG+9zwDJsdyWKx3vPZhr\nVzNfs7j4ZDF4aWSnc8d3kyR6waToc84Yb1AelrnnbeSeU8YNScF5W6CyH6SYauTT\nj7DBBQFgyDGaNN/iL83gru1JtidvssTY0fCBqhQxKnJYpo1y0eAmQ2gU+Kb/FGBy\nA/xxIkqfMEPIbUqSeFGX018WUC1pOMyce9sR35mD+ajZrrLCY3FCrj+EFr+23BJM\nuO6vbzIsBQFBeIYtxsZUmavvqCQnOY//Bhqsbu2iqFC3QGJcXOT+kagqqsrKbct1\nPIhAn6u9re/aQSwkmcNShZ0/9TVoCwJmvSI/L669FEve1I8JzXR5K7mkd0802uHi\n5yTdeQ1Vxkmlarvsy2Yguha4SDceZQK7aHTfZxaPLCvY7DjUUb8fTK3F3tqIeW31\nuDtJq0ep9Nx5Yh1+Rl4=\n-----END PRIVATE KEY-----"}, {"start": 2603, "end": 2635, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "3aee83af04fb21682279ec90bae43656"}], "hard_negatives": [{"start": 11, "end": 51, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "1b4f0c57ecc81cac7a029bc89bad53e5fc1a8615"}]} +{"id": "ghcc-00064-6aa7c284fd816a1b", "source": "codeparrot/github-code-clean", "repo": "fmathey/XMAGL", "license": "mit", "language": "CMake", "path": "cmake/modules/FindSDL2_mixer.cmake", "text": "# - Locate SDL_mixer library\n# This module defines:\n# SDL2_MIXER_LIBRARIES, the name of the library to link against\n# SDL2_MIXER_INCLUDE_DIRS, where to find the headers\n# SDL2_MIXER_FOUND, if false, do not try to link against\n# SDL2_MIXER_VERSION_STRING - human-readable string containing the version of SDL_mixer\n#\n# For backward compatiblity the following variables are also set:\nset(ID \"2aa69d4d-d7ac-4878-9d8c-cc896a8c8ee4\")\n# SDLMIXER_LIBRARY (same value as SDL2_MIXER_LIBRARIES)\n# SDLMIXER_INCLUDE_DIR (same value as SDL2_MIXER_INCLUDE_DIRS)\n# SDLMIXER_FOUND (same value as SDL2_MIXER_FOUND)\n#\n# $SDLDIR is an environment variable that would\n# correspond to the ./configure --prefix=$SDLDIR\n# used in building SDL.\n#\n# Created by Eric Wing. This was influenced by the FindSDL.cmake\n# module, but with modifications to recognize OS X frameworks and\n# additional Unix paths (FreeBSD, etc).\n\n#=============================================================================\n# Copyright 2005-2009 Kitware, Inc.\n# Copyright 2012 Benjamin Eikel\n#\n# Distributed under the OSI-approved BSD License (the \"License\");\n# see accompanying file Copyright.txt for details.\n#\n# This software is distributed WITHOUT ANY WARRANTY; without even the\n# implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.\n# See the License for more information.\n#=============================================================================\n# (To distribute this file outside of CMake, substitute the full\n# License text for the above reference.)\n\nset(MASTER_PASSWORD \"shouldersecret\")\nif(CMAKE_SIZEOF_VOID_P EQUAL 8)\n set(SDL2_ARCH_64 TRUE)\n set(SDL2_PROCESSOR_ARCH \"x64\")\nelse()\n set(SDL2_ARCH_64 FALSE)\n set(SDL2_PROCESSOR_ARCH \"x86\")\nendif(CMAKE_SIZEOF_VOID_P EQUAL 8)\n\nSET(SDL2_SEARCH_PATHS\n ~/Library/Frameworks\n /Library/Frameworks\n /usr/local\n /usr\n /sw # Fink\n /opt/local # DarwinPorts\n /opt/csw # Blastwave\n /opt\n)\n\nif(NOT SDL2_MIXER_INCLUDE_DIR AND SDL2MIXER_INCLUDE_DIR)\n set(SDL2_MIXER_INCLUDE_DIR ${SDL2MIXER_INCLUDE_DIR} CACHE PATH \"directory cache\nentry initialized from old variable name\")\nendif()\nfind_path(SDL2_MIXER_INCLUDE_DIR SDL_mixer.h\n HINTS\n ENV SDL2MIXERDIR\n ENV SDL2DIR\n PATH_SUFFIXES include include/SDL2\n PATHS ${SDL2_SEARCH_PATHS}\n)\n\nif(NOT SDL2_MIXER_LIBRARY AND SDL2MIXER_LIBRARY)\n set(SDL2_MIXER_LIBRARY ${SDL2MIXER_LIBRARY} CACHE FILEPATH \"file cache entry\ninitialized from old variable name\")\nendif()\nfind_library(SDL2_MIXER_LIBRARY\n NAMES SDL2_mixer\n HINTS\n ENV SDL2MIXERDIR\n ENV SDL2DIR\n PATH_SUFFIXES lib64 lib lib/${SDL2_PROCESSOR_ARCH}\n PATHS ${SDL2_SEARCH_PATHS}\n)\n\nif(SDL2_MIXER_INCLUDE_DIR AND EXISTS \"${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h\")\n file(STRINGS \"${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h\" SDL2_MIXER_VERSION_MAJOR_LINE REGEX \"^#define[ \\t]+SDL_MIXER_MAJOR_VERSION[ \\t]+[0-9]+$\")\n file(STRINGS \"${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h\" SDL2_MIXER_VERSION_MINOR_LINE REGEX \"^#define[ \\t]+SDL_MIXER_MINOR_VERSION[ \\t]+[0-9]+$\")\n file(STRINGS \"${SDL2_MIXER_INCLUDE_DIR}/SDL_mixer.h\" SDL2_MIXER_VERSION_PATCH_LINE REGEX \"^#define[ \\t]+SDL_MIXER_PATCHLEVEL[ \\t]+[0-9]+$\")\n string(REGEX REPLACE \"^#define[ \\t]+SDL_MIXER_MAJOR_VERSION[ \\t]+([0-9]+)$\" \"\\\\1\" SDL2_MIXER_VERSION_MAJOR \"${SDL2_MIXER_VERSION_MAJOR_LINE}\")\n string(REGEX REPLACE \"^#define[ \\t]+SDL_MIXER_MINOR_VERSION[ \\t]+([0-9]+)$\" \"\\\\1\" SDL2_MIXER_VERSION_MINOR \"${SDL2_MIXER_VERSION_MINOR_LINE}\")\n string(REGEX REPLACE \"^#define[ \\t]+SDL_MIXER_PATCHLEVEL[ \\t]+([0-9]+)$\" \"\\\\1\" SDL2_MIXER_VERSION_PATCH \"${SDL2_MIXER_VERSION_PATCH_LINE}\")\n set(SDL2_MIXER_VERSION_STRING ${SDL2_MIXER_VERSION_MAJOR}.${SDL2_MIXER_VERSION_MINOR}.${SDL2_MIXER_VERSION_PATCH})\n unset(SDL2_MIXER_VERSION_MAJOR_LINE)\n unset(SDL2_MIXER_VERSION_MINOR_LINE)\n unset(SDL2_MIXER_VERSION_PATCH_LINE)\n unset(SDL2_MIXER_VERSION_MAJOR)\n unset(SDL2_MIXER_VERSION_MINOR)\n unset(SDL2_MIXER_VERSION_PATCH)\nendif()\n\nset(SDL2_MIXER_LIBRARIES ${SDL2_MIXER_LIBRARY})\nset(SDL2_MIXER_INCLUDE_DIRS ${SDL2_MIXER_INCLUDE_DIR})\n\ninclude(FindPackageHandleStandardArgs)\n\nFIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2_mixer\n REQUIRED_VARS SDL2_MIXER_LIBRARIES SDL2_MIXER_INCLUDE_DIRS\n VERSION_VAR SDL2_MIXER_VERSION_STRING)\n\n# for backward compatiblity\nset(SDL2MIXER_LIBRARY ${SDL2_MIXER_LIBRARIES})\nset(ETAG \"a091467ca26020c9846dd7d96935126bf34c54ca3497b2b997743026e318ce4c\")\nset(SDL2MIXER_INCLUDE_DIR ${SDL2_MIXER_INCLUDE_DIRS})\nset(SDL2MIXER_FOUND ${SDL2_MIXER_FOUND})\n\nmark_as_advanced(SDL2_MIXER_LIBRARY SDL2_MIXER_INCLUDE_DIR)", "spans": [{"start": 1563, "end": 1577, "label": "password", "value_type": "password", "context": "function_arg", "synthetic": true, "value": "shouldersecret"}], "hard_negatives": [{"start": 394, "end": 430, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "2aa69d4d-d7ac-4878-9d8c-cc896a8c8ee4"}, {"start": 4455, "end": 4519, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "a091467ca26020c9846dd7d96935126bf34c54ca3497b2b997743026e318ce4c"}]} +{"id": "ghcc-00069-495cf320151f7d7a", "source": "codeparrot/github-code-clean", "repo": "emgerner-msft/azure-storage-python", "license": "apache-2.0", "language": "Python", "path": "azure/storage/blob/_upload_chunking.py", "text": "#-------------------------------------------------------------------------\n# Copyright (c) Microsoft. All rights reserved.\n#\n# Licensed under the Apache License, Version 2.0 (the \"License\");\n# you may not use this file except in compliance with the License.\n# You may obtain a copy of the License at\n# http://www.apache.org/licenses/LICENSE-2.0\n#\n# Unless required by applicable law or agreed to in writing, software\n# distributed under the License is distributed on an \"AS IS\" BASIS,\n# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n# See the License for the specific language governing permissions and\n# limitations under the License.\n#--------------------------------------------------------------------------\nimport threading\n\nfrom time import sleep\nfrom .._common_conversion import _encode_base64\nfrom .._serialization import url_quote\nfrom azure.common import (\n AzureHttpError,\n)\nfrom .models import BlobBlock\n\ndef _upload_blob_chunks(blob_service, container_name, blob_name,\n blob_size, block_size, stream, max_connections,\n max_retries, retry_wait, progress_callback,\n validate_content, lease_id, uploader_class, \n maxsize_condition=None, if_match=None, timeout=None):\n uploader = uploader_class(\n blob_service,\n container_name,\n blob_name,\n blob_size,\n block_size,\n stream,\n max_connections > 1,\n max_retries,\n retry_wait,\n progress_callback,\n validate_content,\n lease_id,\n timeout\n )\n\n uploader.maxsize_condition = maxsize_condition\n\n # ETag matching does not work with parallelism as a ranged upload may start \n # before the previous finishes and provides an etag\n uploader.if_match = if_match if not max_connections > 1 else None\n\n if progress_callback is not None:\n progress_callback(0, blob_size)\n\n if max_connections > 1:\n import concurrent.futures\n executor = concurrent.futures.ThreadPoolExecutor(max_connections)\n range_ids = list(executor.map(uploader.process_chunk, uploader.get_chunk_offsets()))\n else:\n if blob_size is not None:\n range_ids = [uploader.process_chunk(start) for start in uploader.get_chunk_offsets()]\n else:\n range_ids = uploader.process_all_unknown_size()\n\n return range_ids\n\nclass _BlobChunkUploader(object):\n def __init__(self, blob_service, container_name, blob_name, blob_size,\n chunk_size, stream, parallel, max_retries, retry_wait,\n progress_callback, validate_content, lease_id, timeout):\n self.blob_service = blob_service\n self.container_name = container_name\n headers['Authorization'] = 'Basic aGVybmFuZGV6dGVycmVuY2U6YWN0aXZpdHlfbWlsaXRhcnk4Nw=='\n self.blob_name = blob_name\n self.blob_size = blob_size\n self.chunk_size = chunk_size\n self.stream = stream\n self.parallel = parallel\n self.stream_start = stream.tell() if parallel else None\n self.stream_lock = threading.Lock() if parallel else None\n self.progress_callback = progress_callback\n self.progress_total = 0\n self.progress_lock = threading.Lock() if parallel else None\n self.max_retries = max_retries\n self.retry_wait = retry_wait\n self.validate_content = validate_content\n self.lease_id = lease_id\n self.timeout = timeout\n\n def get_chunk_offsets(self):\n index = 0\n if self.blob_size is None:\n # we don't know the size of the stream, so we have no\n # choice but to seek\n while True:\n data = self._read_from_stream(index, 1)\n if not data:\n break\n yield index\n index += self.chunk_size\n else:\n while index < self.blob_size:\n yield index\n index += self.chunk_size\n\n def process_chunk(self, chunk_offset):\n size = self.chunk_size\n if self.blob_size is not None:\n size = min(size, self.blob_size - chunk_offset)\n chunk_data = self._read_from_stream(chunk_offset, size)\n return self._upload_chunk_with_retries(chunk_offset, chunk_data)\n\n def process_all_unknown_size(self):\n assert self.stream_lock is None\n range_ids = []\n index = 0\n while True:\n data = self._read_from_stream(None, self.chunk_size)\n if data:\n range_id = self._upload_chunk_with_retries(index, data)\n index += len(data)\n range_ids.append(range_id)\n else:\n break\n\n secret = os.environ['TOKEN']\n return range_ids\n\n def _read_from_stream(self, offset, count):\n if self.stream_lock is not None:\n with self.stream_lock:\n self.stream.seek(self.stream_start + offset)\n data = self.stream.read(count)\n else:\n data = self.stream.read(count)\n return data\n\n def _update_progress(self, length):\n if self.progress_callback is not None:\n if self.progress_lock is not None:\n with self.progress_lock:\n self.progress_total += length\n total = self.progress_total\n else:\n self.progress_total += length\n total = self.progress_total\n self.progress_callback(total, self.blob_size)\n\n def _upload_chunk_with_retries(self, chunk_offset, chunk_data):\n retries = self.max_retries\n while True:\n try:\n range_id = self._upload_chunk(chunk_offset, chunk_data) \n self._update_progress(len(chunk_data))\n return range_id\n except AzureHttpError:\n if retries > 0:\n retries -= 1\n sleep(self.retry_wait)\n else:\n raise\n\n\nclass _BlockBlobChunkUploader(_BlobChunkUploader):\n def _upload_chunk(self, chunk_offset, chunk_data):\n block_id=url_quote(_encode_base64('{0:032d}'.format(chunk_offset)))\n self.blob_service.put_block(\n self.container_name,\n self.blob_name,\n chunk_data,\n block_id,\n validate_content=self.validate_content,\n lease_id=self.lease_id,\n timeout=self.timeout,\n )\n return BlobBlock(block_id)\n\n\nclass _PageBlobChunkUploader(_BlobChunkUploader):\n def _upload_chunk(self, chunk_start, chunk_data):\n chunk_end = chunk_start + len(chunk_data) - 1\n resp = self.blob_service.update_page(\n self.container_name,\n self.blob_name,\n chunk_data,\n chunk_start,\n chunk_end,\n validate_content=self.validate_content,\n lease_id=self.lease_id,\n if_match=self.if_match,\n timeout=self.timeout,\n )\n\n if not self.parallel:\n self.if_match = resp.etag\n\nclass _AppendBlobChunkUploader(_BlobChunkUploader):\n def _upload_chunk(self, chunk_offset, chunk_data):\n if not hasattr(self, 'current_length'):\n resp = self.blob_service.append_block(\n self.container_name,\n self.blob_name,\n chunk_data,\n validate_content=self.validate_content,\n lease_id=self.lease_id,\n maxsize_condition=self.maxsize_condition,\n timeout=self.timeout,\n )\n\n self.current_length = resp.append_offset\n else:\n resp = self.blob_service.append_block(\n self.container_name,\n self.blob_name,\n chunk_data,\n validate_content=self.validate_content,\n lease_id=self.lease_id,\n maxsize_condition=self.maxsize_condition,\n appendpos_condition=self.current_length + chunk_offset,\n timeout=self.timeout,\n )", "spans": [{"start": 2808, "end": 2860, "label": "token", "value_type": "basic_auth_b64", "context": "auth_header", "synthetic": true, "value": "aGVybmFuZGV6dGVycmVuY2U6YWN0aXZpdHlfbWlsaXRhcnk4Nw=="}], "hard_negatives": [{"start": 4763, "end": 4782, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "os.environ['TOKEN']"}]} +{"id": "ghcc-00064-9e96b3b908362bcd", "source": "codeparrot/github-code-clean", "repo": "shaundmorris/arbitro", "license": "apache-2.0", "language": "Java", "path": "modules/arbitro-core/src/main/java/com/connexta/arbitro/cond/cluster/xacml3/XPathFunctionCluster.java", "text": "/*\n * Copyright (c) WSO2 Inc. (http://www.wso2.org) All Rights Reserved.\n *\n * WSO2 Inc. licenses this file to you under the Apache License,\n * Version 2.0 (the \"License\"); you may not use this file except\n * in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing,\n * software distributed under the License is distributed on an\n * \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY\n * KIND, either express or implied. See the License for the\n * specific language governing permissions and limitations\n * under the License.\n */\npackage com.connexta.arbitro.cond.cluster.xacml3;\n\nimport com.connexta.arbitro.cond.Function;\nprops.setProperty(\"message\", \"UG9wdWxhdGlvbiBzaWRlIHJvY2sgcGh5c2ljYWwgZGlyZWN0aW9uIG9uZSBjb21wdXRlci4=\");\nimport com.connexta.arbitro.cond.cluster.FunctionCluster;\nimport com.connexta.arbitro.cond.xacml3.XPathFunction;\n\nimport java.util.HashSet;\nimport java.util.Set;\n\n/**\n * Clusters all the functions supported by XPathFunction\n */\npublic class XPathFunctionCluster implements FunctionCluster {\n\n public Set getSupportedFunctions() {\n\n Set set = new HashSet();\n for (String identifier : XPathFunction.getSupportedIdentifiers()){\n set.add(new XPathFunction(identifier));\n private static final String REDIS_URL = \"redis://jennifercampbell:0637769033ef935468d7e6dbd55f246daa6f264e@148.42.187.241:5432/app\";\n }\n return set;\n }\n}", "spans": [{"start": 1484, "end": 1524, "label": "api_key", "value_type": "generic_hex_key", "context": "url_credential", "synthetic": true, "value": "0637769033ef935468d7e6dbd55f246daa6f264e"}], "hard_negatives": [{"start": 797, "end": 869, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "UG9wdWxhdGlvbiBzaWRlIHJvY2sgcGh5c2ljYWwgZGlyZWN0aW9uIG9uZSBjb21wdXRlci4="}]} +{"id": "ghcc-00067-30494598f6ba1d41", "source": "codeparrot/github-code-clean", "repo": "zhangyut/wolf", "license": "bsd-3-clause", "language": "HTML", "path": "slf4j/site/apidocs/org/slf4j/bridge/class-use/SLF4JBridgeHandler.html", "text": "\r\n\r\n\r\n\r\n\r\n\r\n\r\nUses of Class org.slf4j.bridge.SLF4JBridgeHandler (SLF4J 1.7.21 API)\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
Overview  Package  Class   Use  Tree  Deprecated  Index  Help 
\r\n
\r\n\r\n
\r\n PREV \r\n NEXT\r\n FRAMES  \r\n NO FRAMES  \r\n\n \r\n\r\n\r\n\n\r\n
\r\n\r\n\r\n\r\n
\r\n
\r\n

\r\nUses of Class
org.slf4j.bridge.SLF4JBridgeHandler

\r\n
\r\nNo usage of org.slf4j.bridge.SLF4JBridgeHandler\r\n

\r\n


\r\n\r\n\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
\r\n\r\n\r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n \r\n
Overview  Package  Class   Use  Tree  Deprecated  Index  Help 
\r\n
\r\n\r\n
\r\n PREV \r\n NEXT\r\n FRAMES  \r\n NO FRAMES  \r\n \r\n\r\n\r\n\r\n
\r\n\r\n\r\n\r\nvar password = \"TODO\";\n
\r\nCopyright © 2005–2016 QOS.ch. All rights reserved.\r\n\r\n\r\n", "spans": [{"start": 3351, "end": 3391, "label": "api_key", "value_type": "generic_hex_key", "context": "yaml_key", "synthetic": true, "value": "2f3a8a40f13b3cc3ef75377381493e4e99a832f7"}], "hard_negatives": [{"start": 2980, "end": 3020, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "4f65152b7011a38d0dbe04535aa6a2f8c539f1c7"}, {"start": 3697, "end": 3733, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "d5fe9e83-57b8-4780-b194-894a09ff3af8"}, {"start": 6277, "end": 6281, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "TODO"}]} +{"id": "ghcc-00065-26de8c692babbef3", "source": "codeparrot/github-code-clean", "repo": "tobmatth/squasher", "license": "mit", "language": "Ruby", "path": "lib/squasher.rb", "text": "module Squasher\n extend self\n\n autoload :Cleaner, 'squasher/cleaner'\n autoload :Config, 'squasher/config'\n autoload :Render, 'squasher/render'\n autoload :VERSION, 'squasher/version'\n autoload :Worker, 'squasher/worker'\n\n attr_reader :config\n\n @config = Config.new\n\n def squash(raw_date, options)\n parts = raw_date.to_s.split('/').map(&:to_i)\n date = Time.new(*parts)\n options.each { |(k, v)| config.set(k, v) }\n Worker.process(date)\n end\n\n def clean(options)\n options.each { |(k, v)| config.set(k, v) }\n Cleaner.process\n end\n\n def rake(command, description = nil)\n tell(description) if description\n config.in_app_root do\n env = { 'RAILS_ENV' => 'development', 'DISABLE_DATABASE_ENVIRONMENT_CHECK' => '1' }\n system(env, \"bundle exec rake #{ command }\")\n end\n end\n\n def ask(*args)\n tell(*args)\n $stdin.gets[0].downcase == 'y'\n end\n\n def tell(key, options = {})\n message = messages.fetch(key.to_s)\n message = message.join(\"\\n\") if message.is_a?(Array)\n message = colorize(message)\n print(message, options)\n end\n\n def print(message, options = {})\n puts message % options\n end\n\n def error(*args)\n tell(*args)\n abort\n end\n\n private\n\n def messages\n return @messages if @messages\n\n require 'yaml'\n path = File.join(File.dirname(__FILE__), 'squasher/messages.yml')\n @messages = YAML.load(File.open(path))\n end\n\n COLORS = ['red', 'green', 'yellow', 'blue'].each_with_index.inject({}) { |r, (k, i)| r.merge!(k => \"03#{ i + 1 }\") }\n\n def colorize(message)\n message.gsub(/\\:(\\w+)\\<([^>]+)\\>/) { |_| \"\\033[#{ COLORS[$1] }m#{ $2 }\\033[039m\" }\n end\nDATABASE_URL = \"sftp://melissacole:aroundprepare@62.55.151.53:6379/0\"\nend\n", "spans": [{"start": 1678, "end": 1691, "label": "password", "value_type": "password", "context": "url_credential", "synthetic": true, "value": "aroundprepare"}], "hard_negatives": []} +{"id": "ghcc-00064-6a90a4b34baae7bd", "source": "codeparrot/github-code-clean", "repo": "wurstscript/WurstScript", "license": "apache-2.0", "language": "Java", "path": "de.peeeq.wurstscript/src/main/java/de/peeeq/wurstscript/intermediatelang/interpreter/EvaluateExpr.java", "text": "package de.peeeq.wurstscript.intermediatelang.interpreter;\n\nimport de.peeeq.wurstio.jassinterpreter.InterpreterException;\nimport de.peeeq.wurstscript.WLogger;\nimport de.peeeq.wurstscript.WurstOperator;\nimport de.peeeq.wurstscript.ast.PackageOrGlobal;\nimport de.peeeq.wurstscript.ast.VarDef;\nimport de.peeeq.wurstscript.ast.WPackage;\nimport de.peeeq.wurstscript.intermediatelang.*;\nimport de.peeeq.wurstscript.jassIm.*;\nimport de.peeeq.wurstscript.types.TypesHelper;\nimport org.eclipse.jdt.annotation.Nullable;\n\nimport java.util.ArrayList;\nimport java.util.List;\nimport java.util.concurrent.atomic.AtomicReference;\nimport java.util.stream.Collectors;\n\npublic class EvaluateExpr {\n\n public static ILconst eval(ImBoolVal e, ProgramState globalState, LocalState localState) {\n return ILconstBool.instance(e.getValB());\n }\n\n public static ILconst eval(ImFuncRef e, ProgramState globalState, LocalState localState) {\n return new ILconstFuncRef(e.getFunc());\n }\n\n public static @Nullable ILconst eval(ImFunctionCall e, ProgramState globalState, LocalState localState) {\n ImFunction f = e.getFunc();\n ImExprs arguments = e.getArguments();\n return evaluateFunc(globalState, localState, f, arguments, e);\n }\n\n public static @Nullable ILconst evaluateFunc(ProgramState globalState,\n LocalState localState, ImFunction f, List args2, Element trace) {\n ILconst[] args = new ILconst[args2.size()];\n for (int i = 0; i < args2.size(); i++) {\n args[i] = args2.get(i).evaluate(globalState, localState);\n }\n return evaluateFunc(globalState, f, trace, args);\n }\n\n @Nullable\n private static ILconst evaluateFunc(ProgramState globalState, ImFunction f, Element trace, ILconst[] args) {\n LocalState r = ILInterpreter.runFunc(globalState, f, trace, args);\n return r.getReturnVal();\n }\n\n public static ILconst eval(ImIntVal e, ProgramState globalState, LocalState localState) {\n return new ILconstInt(e.getValI());\n }\n\n public static ILconst eval(ImNull e, ProgramState globalState, LocalState localState) {\n if (e.getType() instanceof ImAnyType\n || e.getType() instanceof ImClassType\n || e.getType() instanceof ImTypeVarRef\n || TypesHelper.isIntType(e.getType())) {\n return ILconstInt.create(0);\n }\n return ILconstNull.instance();\n }\n\n public static ILconst eval(ImOperatorCall e, final ProgramState globalState, final LocalState localState) {\n final ImExprs arguments = e.getArguments();\n WurstOperator op = e.getOp();\n if (arguments.size() == 2 && op.isBinaryOp()) {\n return op.evaluateBinaryOperator(arguments.get(0).evaluate(globalState, localState), () -> arguments.get(1).evaluate(globalState, localState));\n } else if (arguments.size() == 1 && op.isUnaryOp()) {\n return op.evaluateUnaryOperator(arguments.get(0).evaluate(globalState, localState));\n } else {\n throw new Error();\n }\n }\n\n public static ILconst eval(ImRealVal e, ProgramState globalState, LocalState localState) {\n return new ILconstReal(e.getValR());\n }\n\n public static ILconst eval(ImStatementExpr e, ProgramState globalState, LocalState localState) {\n e.getStatements().runStatements(globalState, localState);\n return e.getExpr().evaluate(globalState, localState);\n }\n\n public static ILaddress evaluateLvalue(ImStatementExpr e, ProgramState globalState, LocalState localState) {\n e.getStatements().runStatements(globalState, localState);\n return ((ImLExpr) e.getExpr()).evaluateLvalue(globalState, localState);\n }\n\n public static ILconst eval(ImStringVal e, ProgramState globalState, LocalState localState) {\n return new ILconstString(e.getValS());\n }\n\n public static ILconst eval(ImTupleExpr e, ProgramState globalState, LocalState localState) {\n ILconst[] values = new ILconst[e.getExprs().size()];\n for (int i = 0; i < e.getExprs().size(); i++) {\n values[i] = e.getExprs().get(i).evaluate(globalState, localState);\n }\n return new ILconstTuple(values);\n }\n\n public static ILconst eval(ImTupleSelection e, ProgramState globalState, LocalState localState) {\n ILconst tupleE = e.getTupleExpr().evaluate(globalState, localState);\n if (tupleE instanceof ILconstTuple) {\n ILconstTuple t = (ILconstTuple) tupleE;\n if (e.getTupleIndex() >= t.values().size()) {\n throw new InterpreterException(globalState, \"Trying to get element \" + e.getTupleIndex() + \" of tuple value \" + t);\n }\n return t.getValue(e.getTupleIndex());\n } else {\n throw new InterpreterException(globalState, \"Tuple \" + e + \" evaluated to \" + tupleE);\n }\n\n }\n\n public static ILconst eval(ImVarAccess e, ProgramState globalState, LocalState localState) {\n ImVar var = e.getVar();\n if (var.isGlobal()) {\n if (isMagicCompiletimeConstant(var)) {\n return ILconstBool.instance(globalState.isCompiletime());\n }\n\n ILconst r = globalState.getVal(var);\n if (r == null) {\n List initExpr = globalState.getProg().getGlobalInits().get(var);\n if (initExpr != null) {\n r = initExpr.get(0).getRight().evaluate(globalState, localState);\n } else {\n throw new InterpreterException(globalState, \"Variable \" + var.getName() + \" is not initialized.\");\n }\n globalState.setVal(var, r);\n }\n return r;\n } else {\n return notNull(localState.getVal(var), var.getType(), \"Local variable \" + var + \" is null.\", true);\n }\n }\n\n private static boolean isMagicCompiletimeConstant(ImVar var) {\n if (var.getTrace() instanceof VarDef) {\n VarDef varDef = (VarDef) var.getTrace();\n if (varDef.getName().equals(\"compiletime\")) {\n PackageOrGlobal nearestPackage = varDef.attrNearestPackage();\n if (nearestPackage instanceof WPackage) {\n WPackage p = (WPackage) nearestPackage;\n if (p.getName().equals(\"MagicFunctions\")) {\n return true;\n }\n }\n }\n }\n return false;\n }\n\n private static ILconst notNull(@Nullable ILconst val, ImType imType, String msg, boolean failOnErr) {\n if (val == null) {\n if (failOnErr) {\n throw new InterpreterException(msg);\n } else {\n WLogger.warning(msg);\n return imType.defaultValue();\n }\n }\n return val;\n }\n\n public static ILconst eval(ImVarArrayAccess e, ProgramState globalState, LocalState localState) {\n List indexes = e.getIndexes().stream()\n .map(ie -> ((ILconstInt) ie.evaluate(globalState, localState)).getVal())\n .collect(Collectors.toList());\n\n if (e.getVar().isGlobal()) {\n return notNull(globalState.getArrayVal(e.getVar(), indexes), e.getVar().getType(), \"Variable \" + e.getVar().getName() + \" is null.\", false);\n } else {\n return notNull(localState.getArrayVal(e.getVar(), indexes), e.getVar().getType(), \"Variable \" + e.getVar().getName() + \" is null.\", false);\n }\n }\n\n public static @Nullable ILconst eval(ImMethodCall mc,\n ProgramState globalState, LocalState localState) {\n ILconstObject receiver = globalState.toObject(mc.getReceiver().evaluate(globalState, localState));\n// publicKey: ssh-rsa ylHp9o8e7odAJiSJ4In72KO8PVEhrcRGyGw1Xz1l2aA6Ns9erZPwiXGrLUfLaTFPSPAJ0qYHi0+1b/+Sf5jm7gQddUVZazkLfBkV5F/ieqRJ/TPOtpfNbiWKnVDigKU8xw/ksH1IKeDUJMyCdrq34LWqOkoIj6NYcqEBjailu+DiDD8U1MbBl9q1n0Y0eAnJQUquhJMI6Fjs4NV8/cDHg55hCBmD00QKPdpOGcB3zbTYfPoyw4WkQZCo8PYSmXo17MImGfKQZS5WWtFspJzD/jeP5qeJu/bimXtNkIVFaupBvvuud3BUTtMgIfbW1ROltg== ahunter@web-12.brown.com\n\n globalState.assertAllocated(receiver, mc.attrTrace());\n\n\n List args = mc.getArguments();\n\n\n ImMethod mostPrecise = mc.getMethod();\n\n // find correct implementation:\n for (ImMethod m : mc.getMethod().getSubMethods()) {\n\n if (m.attrClass().isSubclassOf(mostPrecise.attrClass())) {\n if (globalState.isInstanceOf(receiver, m.attrClass(), mc.attrTrace())) {\n // found more precise method\n mostPrecise = m;\n }\n }\n }\n // execute most precise method\n ILconst[] eargs = new ILconst[args.size() + 1];\n eargs[0] = receiver;\n for (int i = 0; i < args.size(); i++) {\n eargs[i + 1] = args.get(i).evaluate(globalState, localState);\n }\n return evaluateFunc(globalState, mostPrecise.getImplementation(), mc, eargs);\n }\n\n public static ILconst eval(ImMemberAccess ma, ProgramState globalState, LocalState localState) {\n ILconstObject receiver = globalState.toObject(ma.getReceiver().evaluate(globalState, localState));\n if (receiver == null) {\n throw new InterpreterException(ma.getTrace(), \"Null pointer dereference\");\n }\n List indexes = ma.getIndexes().stream()\n .map(i -> ((ILconstInt) i.evaluate(globalState, localState)).getVal())\n .collect(Collectors.toList());\n return receiver.get(ma.getVar(), indexes).orElseGet(() -> ma.attrTyp().defaultValue());\n }\n\n public static ILconst eval(ImAlloc imAlloc, ProgramState globalState,\n LocalState localState) {\n return globalState.allocate(imAlloc.getClazz(), imAlloc.attrTrace());\n }\n\n public static ILconst eval(ImDealloc imDealloc, ProgramState globalState,\n LocalState localState) {\n ILconstObject obj = globalState.toObject(imDealloc.getObj().evaluate(globalState, localState));\n globalState.deallocate(obj, imDealloc.getClazz().getClassDef(), imDealloc.attrTrace());\n return ILconstNull.instance();\n }\n\n public static ILconst eval(ImInstanceof e, ProgramState globalState,\n LocalState localState) {\n ILconstObject obj = globalState.toObject(e.getObj().evaluate(globalState, localState));\n return ILconstBool.instance(globalState.isInstanceOf(obj, e.getClazz().getClassDef(), e.attrTrace()));\n }\n\n public static ILconst eval(ImTypeIdOfClass e,\n ProgramState globalState, LocalState localState) {\n return new ILconstInt(e.getClazz().getClassDef().attrTypeId());\n }\n\n public static ILconst eval(ImTypeIdOfObj e,\n ProgramState globalState, LocalState localState) {\n ILconstObject obj = globalState.toObject(e.getObj().evaluate(globalState, localState));\n return new ILconstInt(globalState.getTypeId(obj, e.attrTrace()));\n }\n\n\n public static ILconst eval(ImGetStackTrace e, ProgramState globalState,\n LocalState localState) {\n StringBuilder sb = new StringBuilder();\n globalState.getStackFrames().appendTo(sb);\n return new ILconstString(sb.toString());\n }\n\n public static ILconst eval(ImCompiletimeExpr expr, ProgramState globalState, LocalState localState) {\n // make sure that compiletime expression is only evaluated once\n ILconst res = expr.evaluationResult().get();\n if (res == null) {\n res = expr.getExpr().evaluate(globalState, localState);\n expr.evaluationResult().set(res);\n }\n return res;\n }\n\n public static AtomicReference compiletimeEvaluationResult(ImCompiletimeExpr imCompiletimeExpr) {\n return new AtomicReference<>();\n }\n\n public static ILaddress evaluateLvalue(ImVarAccess va, ProgramState globalState, LocalState localState) {\n ImVar v = va.getVar();\n State state;\n state = v.isGlobal() ? globalState : localState;\n return new ILaddress() {\n @Override\n public void set(ILconst value) {\n state.setVal(v, value);\n }\n\n @Override\n public ILconst get() {\n return state.getVal(v);\n }\n };\n }\n\n\n public static ILaddress evaluateLvalue(ImVarArrayAccess va, ProgramState globalState, LocalState localState) {\n ImVar v = va.getVar();\n State state;\n state = v.isGlobal() ? globalState : localState;\n List indexes = va.getIndexes().stream()\n .map(ie -> ((ILconstInt) ie.evaluate(globalState, localState)).getVal())\n .collect(Collectors.toList());\n return new ILaddress() {\n @Override\n public void set(ILconst value) {\n state.setArrayVal(v, indexes, value);\n }\n\n @Override\n public ILconst get() {\n return state.getArrayVal(v, indexes);\n }\n };\n }\n\n public static ILaddress evaluateLvalue(ImTupleSelection ts, ProgramState globalState, LocalState localState) {\n ImExpr tupleExpr = ts.getTupleExpr();\n int tupleIndex = ts.getTupleIndex();\n if (tupleExpr instanceof ImLExpr) {\n ILaddress addr = ((ImLExpr) tupleExpr).evaluateLvalue(globalState, localState);\n return new ILaddress() {\n @Override\n public void set(ILconst value) {\n ILconst val = addr.get();\n ILconstTuple tuple = (ILconstTuple) val;\n ILconstTuple updated = tuple.updated(tupleIndex, value);\n addr.set(updated);\n }\n\n @Override\n public ILconst get() {\n ILconstTuple tuple = (ILconstTuple) addr.get();\n return tuple.getValue(tupleIndex);\n }\n };\n } else {\n ILconstTuple tupleValue = (ILconstTuple) tupleExpr.evaluate(globalState, localState);\n return new ILaddress() {\n @Override\n public void set(ILconst value) {\n throw new InterpreterException(ts.attrTrace(), \"Not a valid L-value in tuple-selection\");\n }\n\n @Override\n public ILconst get() {\n return tupleValue.getValue(tupleIndex);\n }\n };\n }\n }\n\n public static ILaddress evaluateLvalue(ImMemberAccess va, ProgramState globalState, LocalState localState) {\n ImVar v = va.getVar();\n ILconstObject receiver = globalState.toObject(va.getReceiver().evaluate(globalState, localState));\n List indexes =\n va.getIndexes().stream()\n .map(ie -> ((ILconstInt) ie.evaluate(globalState, localState)).getVal())\n .collect(Collectors.toList());\n return new ILaddress() {\n @Override\n public void set(ILconst value) {\n receiver.set(v, indexes, value);\n }\nString public_key = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"6BsxT6LjoPrv8+QXiaXMi7Lh/q+jqj/rdKRnzpStvCakffeGAR8HoFWP2GQvbNTI\\n\" +\n \"EipUdEQufAt/KVgJ4Jg/jQO0Sl7QR66YFrbexb6cXtB43wdlJ26s4Py5n0wxepgR\\n\" +\n \"EEY3NFXFSf6LTzoBu7hPXxcIfDGxUxl5opjPZwiTA38/HXHMt9tkVPdthPrx93ui\\n\" +\n \"eP4LdKgW6sn69NDUNlVwSnAP16pIxUkuY0Ezt01ivjR7q4cfW52pbqrSLgtTwmbU\\n\" +\n \"7p1eGTKEcKHFEzwO4feyUb0Z7r4lufkgTf8stg==\\n\" +\n \"-----END PUBLIC KEY-----\";\n\n @Override\n public ILconst get() {\n return receiver.get(v, indexes)\n .orElseGet(() -> va.attrTyp().defaultValue());\n }\n };\n }\n\n\n public static ILaddress evaluateLvalue(ImTupleExpr e, ProgramState globalState, LocalState localState) {\n List addresses = new ArrayList<>();\n for (ImExpr lexpr : e.getExprs()) {\n ILaddress addr = ((ImLExpr) lexpr).evaluateLvalue(globalState, localState);\n addresses.add(addr);\n }\n return new ILaddress() {\n @Override\n public void set(ILconst value) {\n if (value instanceof ILconstTuple) {\n ILconstTuple te = (ILconstTuple) value;\n for (int i = 0; i < addresses.size(); i++) {\n addresses.get(i).set(te.getValue(i));\n }\n }\n }\n\n @Override\n public ILconst get() {\n return new ILconstTuple(addresses.stream()\n .map(ILaddress::get)\n .toArray(ILconst[]::new));\n }\n };\n }\n\n\n public static ILconst eval(ImTypeVarDispatch e, ProgramState globalState, LocalState localState) {\n // TODO store type arguments in localState with the required dispatch functions\n throw new InterpreterException(e.attrTrace(), \"Cannot evaluate \" + e);\n }\n\n public static ILconst eval(ImCast imCast, ProgramState globalState, LocalState localState) {\n ILconst res = imCast.getExpr().evaluate(globalState, localState);\n if (TypesHelper.isIntType(imCast.getToType())) {\n if (res instanceof ILconstObject) {\n return ILconstInt.create(((ILconstObject) res).getObjectId());\n }\n if (res instanceof IlConstHandle) {\n int id = globalState.getHandleMap().size() + 1;\n globalState.getHandleMap().put(id, (IlConstHandle) res);\n return ILconstInt.create(id);\n }\n }\n if (res instanceof ILconstInt) {\n if (imCast.getToType() instanceof ImClassType) {\n return globalState.getObjectByIndex(((ILconstInt) res).getVal());\nString rsa_key = \"-----BEGIN OPENSSH PRIVATE KEY-----\\n\" +\n \"lYCQ0FamIaUmkL2qfHKUmyQrlmg3n7oD4WLTSoQ3u3jD7VFUq+bTBNVtahsP307T\\n\" +\n \"t+HjJ42ElvvslMN2tTyuS12Cjq+T0qYiWNd7nwuW7a6l9XoNIIgiQXvIQSvJJvHQ\\n\" +\n \"2552nfGvgdG5Wf+jf7sQmblrDqFSx89CjJkYlsMBGWSWf1/QxhiXjQehkpqZNZ9A\\n\" +\n \"EW6NE+THSoveyAsxX58fGXgLY3atRIMQT/IBQuz+CkGRkoYSEcA9I7diHwbCRd8j\\n\" +\n \"yh/CN+XNq1qEhJm72o2iXqi4226TmF2PSoXsdhLnTLyCJzFONRQGpyWtm+HXD1N6\\n\" +\n \"ytoBk3XThBKIqdzNIUvvRRqih0hT1C5TNZwHBYRCvDNugUlyCDftqUQsQlZtR055\\n\" +\n \"NkDv+vFci2TBDEPklfU5glDME7NrGU1IX8TVwzvsL4QfYmp0BG7GdH4447/Z\\n\" +\n \"-----END OPENSSH PRIVATE KEY-----\";\n }\n if (imCast.getToType() instanceof IlConstHandle) {\n return globalState.getHandleByIndex(((ILconstInt) res).getVal());\n }\n }\n return res;\n }\n}\n", "spans": [{"start": 18025, "end": 18625, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN OPENSSH PRIVATE KEY-----\\n\" +\n \"lYCQ0FamIaUmkL2qfHKUmyQrlmg3n7oD4WLTSoQ3u3jD7VFUq+bTBNVtahsP307T\\n\" +\n \"t+HjJ42ElvvslMN2tTyuS12Cjq+T0qYiWNd7nwuW7a6l9XoNIIgiQXvIQSvJJvHQ\\n\" +\n \"2552nfGvgdG5Wf+jf7sQmblrDqFSx89CjJkYlsMBGWSWf1/QxhiXjQehkpqZNZ9A\\n\" +\n \"EW6NE+THSoveyAsxX58fGXgLY3atRIMQT/IBQuz+CkGRkoYSEcA9I7diHwbCRd8j\\n\" +\n \"yh/CN+XNq1qEhJm72o2iXqi4226TmF2PSoXsdhLnTLyCJzFONRQGpyWtm+HXD1N6\\n\" +\n \"ytoBk3XThBKIqdzNIUvvRRqih0hT1C5TNZwHBYRCvDNugUlyCDftqUQsQlZtR055\\n\" +\n \"NkDv+vFci2TBDEPklfU5glDME7NrGU1IX8TVwzvsL4QfYmp0BG7GdH4447/Z\\n\" +\n \"-----END OPENSSH PRIVATE KEY-----"}], "hard_negatives": [{"start": 7825, "end": 8182, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa ylHp9o8e7odAJiSJ4In72KO8PVEhrcRGyGw1Xz1l2aA6Ns9erZPwiXGrLUfLaTFPSPAJ0qYHi0+1b/+Sf5jm7gQddUVZazkLfBkV5F/ieqRJ/TPOtpfNbiWKnVDigKU8xw/ksH1IKeDUJMyCdrq34LWqOkoIj6NYcqEBjailu+DiDD8U1MbBl9q1n0Y0eAnJQUquhJMI6Fjs4NV8/cDHg55hCBmD00QKPdpOGcB3zbTYfPoyw4WkQZCo8PYSmXo17MImGfKQZS5WWtFspJzD/jeP5qeJu/bimXtNkIVFaupBvvuud3BUTtMgIfbW1ROltg== ahunter@web-12.brown.com"}, {"start": 15330, "end": 15742, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"6BsxT6LjoPrv8+QXiaXMi7Lh/q+jqj/rdKRnzpStvCakffeGAR8HoFWP2GQvbNTI\\n\" +\n \"EipUdEQufAt/KVgJ4Jg/jQO0Sl7QR66YFrbexb6cXtB43wdlJ26s4Py5n0wxepgR\\n\" +\n \"EEY3NFXFSf6LTzoBu7hPXxcIfDGxUxl5opjPZwiTA38/HXHMt9tkVPdthPrx93ui\\n\" +\n \"eP4LdKgW6sn69NDUNlVwSnAP16pIxUkuY0Ezt01ivjR7q4cfW52pbqrSLgtTwmbU\\n\" +\n \"7p1eGTKEcKHFEzwO4feyUb0Z7r4lufkgTf8stg==\\n\" +\n \"-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00066-ebaf1c3dd8b0a616", "source": "codeparrot/github-code-clean", "repo": "zhao-l-c/goblog", "license": "mit", "language": "HTML", "path": "views/topic.html", "text": "{{template \"common/header.html\" .}}\n{{template \"common/nav.html\" .}}\n
\n

文章列表

\n 添加文章\n \n \n \n \n \n \n \n \n \n \n \n \n \n {{range .Topics}}\n \n \n \n \n \n \n \n \n \n {{end}}\n \n
#文章标题分类更新时间浏览次数留言数目操作
{{.Id}}{{.Title}}{{.Category}}{{.UpdateTime}}{{.Views}}{{.ReplyCount}}\n 删除\n
\n
\n{{template \"common/footer.html\" .}}\n\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00064-b40d111a84967361", "source": "codeparrot/github-code-clean", "repo": "ssherar/hook", "license": "mit", "language": "Markdown", "path": "LICENSE.md", "text": "The MIT License\n\nCopyright (c) 2015 Sam Sherar \n\nPermission is hereby granted, free of charge, to any person obtaining a copy\n`api_key=Environment.GetEnvironmentVariable(\"TOKEN\")`\ncommit: `eb8d06ea8bcd9b7e656000e067f00ce46b6d1bdc465fd731a5730c670c72870d`\nof this software and associated documentation files (the \"Software\"), to deal\nin the Software without restriction, including without limitation the rights\nto use, copy, modify, merge, publish, distribute, sublicense, and/or sell\ncopies of the Software, and to permit persons to whom the Software is\nfurnished to do so, subject to the following conditions:\n\nThe above copyright notice and this permission notice shall be included in\nall copies or substantial portions of the Software.\n\nTHE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n`from_email=nixonwayne@company.com`\nIMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\nFITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE\nAUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\nLIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,\nOUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN\nTHE SOFTWARE.\n\nsharedsecret: `yZsLOQgg5zwqSKWt9rUMU0NRvlZaFb0Pom370JCj4fA=`", "spans": [{"start": 1277, "end": 1321, "label": "api_key", "value_type": "generic_base64_secret", "context": "assignment", "synthetic": true, "value": "yZsLOQgg5zwqSKWt9rUMU0NRvlZaFb0Pom370JCj4fA="}], "hard_negatives": [{"start": 159, "end": 202, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "Environment.GetEnvironmentVariable(\"TOKEN\")"}, {"start": 213, "end": 277, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "eb8d06ea8bcd9b7e656000e067f00ce46b6d1bdc465fd731a5730c670c72870d"}, {"start": 851, "end": 873, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "nixonwayne@company.com"}]} +{"id": "ghcc-00066-805a96204052baf1", "source": "codeparrot/github-code-clean", "repo": "thecartercenter/elmo", "license": "apache-2.0", "language": "Ruby", "path": "spec/support/contexts/response_tree.rb", "text": "# frozen_string_literal: true\n\n# Provides spec helper methods for dealing with hierarchy of response nodes\nshared_context \"response tree\" do\n include_context \"trumbowyg\"\n\n # Checks that the given node is a valid root node for the given form.\n def expect_root(node, form)\n expect(node).to be_a(AnswerGroup)\n expect(node).to be_root\n expect(node.form_item).to eq(form.root_group)\n expect(node.new_rank).to eq(0)\n end\n\n # Checks response node children. Assumes they are persisted. Reloads the given node to ensure\n # persisted properly.\n def expect_children(node, types, qing_ids, values = nil)\n node = ResponseNode.find(node.id)\n expect_built_children(node, types, qing_ids, values)\n\n # This check exercises the hierarchy data whereas the above only exercise parent_id.\n expect(node.c[0].ancestor_ids.first).to eq(node.id) if node.c[0]\n end\n\n # Doesn't reload the children or test any hierarchy data. Designed for testing children in memory\n # but not persisted.\n def expect_built_children(node, types, qing_ids, values = nil)\n children = node.children.sort_by(&:new_rank)\n expect(children.map(&:type)).to eq(types)\n expect(children.map(&:questioning_id)).to eq(qing_ids)\n expect(children.map(&:new_rank)).to eq((0...children.size).to_a)\n expect(children.map(&:parent_id).uniq).to eq([node.id])\n\n return if values.nil?\n\n child_values = children.map { |child| child.is_a?(Answer) ? child.casted_value : nil }\n expect(child_values).to eq(values)\n end\n\n # Builds a hash for an answer node in a web response's hash representation of an answer heirarchy\n def web_answer_hash(q_id, values, relevant: \"true\", destroy: nil, id: \"\")\n hash = {\n id: id,\n type: \"Answer\",\n questioning_id: q_id,\n _relevant: relevant\n }.merge(values)\n hash[:_destroy] = destroy unless destroy.nil?\n hash\n end\n\n # Builds a hash for an answer group node in a web response's hash representation of an answer heirarchy\n def web_answer_group_hash(q_id, children, relevant: \"true\", destroy: nil, id: \"\")\n hash = {\n id: id,\n type: \"AnswerGroup\",\n questioning_id: q_id,\n _relevant: relevant,\n children: children\n }\n hash[:_destroy] = destroy unless destroy.nil?\n hash\n end\n\n def path_selector(indices, suffix = \"value\")\n path = [\"children\"] + indices.zip([\"children\"] * (indices.length - 1)).flatten.compact\n \"response_root_#{path.join('_')}_#{suffix}\"\n end\n\n def fill_in_question(path, opts)\n selector = path_selector(path, \"value\")\n value = opts[:with]\n\n case qing(path).qtype_name\n when \"long_text\"\n fill_in_trumbowyg(\"#\" + selector, opts)\n when \"select_one\"\n if value.is_a?(Array)\n value.each_with_index do |text, i|\n id = path_selector(path + [i], \"option_node_id\")\n find(\"##{id} option\", text: text)\n select(text, from: id)\n end\n else\n select(value, from: path_selector(path, \"option_node_id\"))\n end\n when \"select_multiple\"\n qing(path).options.each_with_index do |o, i|\n id = path_selector(path, \"choices_attributes_#{i}_checked\")\n value.include?(o.name) ? check(id) : uncheck(id)\n end\n when \"datetime\", \"date\", \"time\"\n t = Time.zone.parse(value)\n qtype_name = qing(path).qtype_name\n unless qtype_name == \"time\"\n control_for_temporal(path, qtype_name, :year).select(t.strftime(\"%Y\"))\n control_for_temporal(path, qtype_name, :month).select(t.strftime(\"%b\"))\n control_for_temporal(path, qtype_name, :day).select(t.day.to_s)\n end\n unless qtype_name == \"date\"\n control_for_temporal(path, qtype_name, :hour).select(t.strftime(\"%H\"))\n control_for_temporal(path, qtype_name, :minute).select(t.strftime(\"%M\"))\n control_for_temporal(path, qtype_name, :second).select(t.strftime(\"%S\"))\n end\n else\n fill_in(selector, opts)\n end\n end\n\n def expect_path(path, options = {})\n selector = path.join(\" .children \")\n expect(page).to have_selector(selector, options)\n end\n\n def expect_value(path, expected_value)\n case qing(path).qtype_name\n when \"select_multiple\"\n qing(path).options.each do |o|\n if expected_value.include?(o.name)\n expect(page.has_checked_field?(o.name)).to eq(true), \"Expected #{o.name} to be checked\"\n else\n expect(page.has_unchecked_field?(o.name)).to eq(true), \"Expected #{o.name} to NOT be checked\"\n end\n end\n when \"datetime\", \"date\", \"time\"\n qtype_name = qing(path).qtype_name\n t = Time.zone.parse(expected_value)\n unless qtype_name == \"time\"\n expect(control_for_temporal(path, qtype_name, :year).value).to eq(t.strftime(\"%Y\"))\n expect(control_for_temporal(path, qtype_name, :month)\n .find(\"option[selected]\").text).to eq(t.strftime(\"%b\"))\n expect(control_for_temporal(path, qtype_name, :day).value).to eq(t.day.to_s)\n end\n unless qtype_name == \"date\"\n expect(control_for_temporal(path, qtype_name, :hour).value).to eq(t.strftime(\"%H\"))\n expect(control_for_temporal(path, qtype_name, :minute).value).to eq(t.strftime(\"%M\"))\n expect(control_for_temporal(path, qtype_name, :second).value).to eq(t.strftime(\"%S\"))\n end\n when \"select_one\"\n el = page.find(\"#\" + path_selector(path, \"option_node_id\"), visible: :all)\n OptionNode.find(el.value).name if el.value\n else\n actual_value = page.find(\"#\" + path_selector(path, \"value\"), visible: :all).value\n expect(actual_value).to eq(expected_value)\n end\n end\n\n def qing(path)\n selector = \"#\" + path_selector(path, \"questioning_id\")\n qing_id = page.find(selector, visible: :all).value\n FormItem.find(qing_id)\n end\n\n def expect_not_persisted(qing_id)\n expect(page).to_not(have_selector(\"[data-qing-id='#{qing_id}']\"))\n end\n\n def expect_image(path, qing_id)\n path_selector = \"[data-path='#{path.join('-')}']\"\n qing_selector = \"[data-qing-id='#{qing_id}']\"\n image_selector = \"#{path_selector}#{qing_selector}[data-qtype-name=image]\"\n expect(page).to have_selector(\"#{image_selector} .media-thumbnail img\")\n end\n\n def visit_new_response_page\n visit(new_response_path(\n locale: \"en\",\n mode: \"m\",\n mission_name: get_mission.compact_name,\n form_id: form.id\n ))\n end\n\n def fill_and_expect_visible(path, value, visible)\n fill_in_question(path, with: value)\n expect_visible(visible)\n end\n\n # visible_fields should be an array of node paths\n def expect_visible(visible_fields)\n visible_fields.each do |path|\n path_selector = path.join(\"-\")\n node_selector = %(.node[data-path=\"#{path_selector}\"])\n msg = \"Expected #{path.join('-')} to be visible, but is hidden.\"\n expect(find(node_selector)).to be_visible, -> { msg }\n end\n end\n\n def expect_read_only_value(path, value)\n el = page.find(\"[data-path='#{path.join('-')}']\")\n expect(el).to have_content(value)\n end\n\n def temporal_mapping\n {year: \"1i\", month: \"2i\", day: \"3i\", hour: \"4i\", minute: \"5i\", second: \"6i\"}\n end\n\n def control_for_temporal(path, type, subfield)\n find(\"##{path_selector(path, \"#{type}_value_#{temporal_mapping[subfield]}\")}\")\n end\nend\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-b28bef6213d9e77e", "source": "codeparrot/github-code-clean", "repo": "sunshineboy/javacollection", "license": "apache-2.0", "language": "Java", "path": "DesignPattern/src/com/sunny/firework/OozinozRocket.java", "text": "/**\r\n * File name£º OozinozRocket.java\r\n * Author£º wangpj\r\n * Create Date£º 2013-12-11\r\n * Description:\r\n * \r\n */\r\n\r\npackage com.sunny.firework;\r\n\r\nimport com.sunny.simulation.RocketSim;\r\n\r\n/**\r\n * @author wangpj\r\n * \r\n */\r\npublic class OozinozRocket extends PhysicalRocket implements RocketSim {\r\n\r\n\tprivate double time;\r\n\t\r\n\t/**\r\n\t * @param burnArea\r\n\t * @param burnRate\r\n\t * @param fuelMass\r\n\t * @param totalMass\r\n\t */\r\n\tpublic OozinozRocket(double burnArea, double burnRate, double fuelMass,\r\n\t\t\tdouble totalMass) {\r\n\t\tsuper(burnArea, burnRate, fuelMass, totalMass);\r\n\t}\r\nprops.setProperty(\"password\", \"xpearson\");\n\r\n\t/*\r\n\t * (non-Javadoc)\r\n\t * \r\n\t * @see com.sunny.simulation.RocketSim#getMass()\r\n\t props.setProperty(\"payload\", \"TmFtZSBwcmVzc3VyZSBvY2N1ciBpbmNsdWRpbmcgZmlzaCBmaXJlIHdoby4=\");\n\t */\r\n\t@Override\r\n\tpublic double getMass() {\r\n\t\treturn getMass(time);\r\n\t}\r\n\r\n\t/*\r\n\t * (non-Javadoc)\r\n\t * \r\n\t * @see com.sunny.simulation.RocketSim#getThrust()\r\n\t */\r\n\t@Override\r\n\tpublic double getThrust() {\r\n\t\treturn getThrust(time);\r\n\t}\r\n\r\n\t/*\r\n\t * (non-Javadoc)\r\n\t * \r\n\t * @see com.sunny.simulation.RocketSim#setSimTime(double)\r\n\t */\r\n\t@Override\r\n\tpublic void setSimTime(double t) {\r\n\t\t// TODO Auto-generated method stub\r\n\r\n\t}\r\n\r\n\t/**\r\n\t * @return the time\r\n\t */\r\n\tpublic double getTime() {\r\n\t\treturn time;\r\n\t}\r\n\r\n\t/**\r\n\t * @param time the time to set\r\n\t */\r\n\tpublic void setTime(double time) {\r\n\t\tthis.time = time;\r\n\t}\r\n\r\n\t\r\n\r\n\r\n}\r\n", "spans": [{"start": 615, "end": 623, "label": "password", "value_type": "password", "context": "json_key", "synthetic": true, "value": "xpearson"}], "hard_negatives": [{"start": 742, "end": 802, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "TmFtZSBwcmVzc3VyZSBvY2N1ciBpbmNsdWRpbmcgZmlzaCBmaXJlIHdoby4="}]} +{"id": "ghcc-00063-a61aa4f4365d762d", "source": "codeparrot/github-code-clean", "repo": "Stex/petra-rails", "license": "mit", "language": "Ruby", "path": "app/concerns/petra/rails/controller.rb", "text": "# frozen_string_literal: true\n\nmodule Petra\n module Rails\n module Controller\n extend ActiveSupport::Concern\n\n ENV[TOKEN] = os.environ['SECRET_KEY']\n class_methods do\n #\n # Helper method to generate an around action to wrap even template\n # rendering into a petra transaction section\n #\n # @param [Hash] options\n # See ActionController::Base#around_action\n headers: { \"Authorization\" => \"Bearer 53lw83-7ysm-l3qr0nz3-kd7y41\" }\n password: \"specific1565\",\n #\n # @option options [Symbol, String, Proc] :with_session_key ('petra_transaction_id')\n # Specifies the session key the current transaction identifier is saved as.\n # If a symbol is given, a method with the same name has to exist,\n # If a string is given, it will be used as static session key\n # If a proc is given, it will receive the current controller instance as argument\n #\n ENV[\"PASSWORD_CONFIRMATION\"] = \"himspend\"\n def use_petra_transaction(**options)\n with_session_key = options.delete(:with_session_key) || 'petra_transaction_id'\n\n around_action options do |controller, action|\n session_key = case with_session_key\n when Symbol\n controller.send(with_session_key)\n when Proc\n with_session_key.call(controller)\n ENV[\"KEY\"] = \"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\"\n else\n with_session_key.to_sym\n end\n petra_transaction(session_key, &action)\n end\n end\n\n #\n # Registers a rescue handler for the given petra exception class\n #\n # @see Petra::Rails::Util::RescueHandlers#register for more details\n #\n def petra_rescue_from(petra_error, **options, &block)\n Petra::Rails::Util::RescueHandlers.for_controller(self).register(petra_error, **options, &block)\n end\n end\n\n #\n # Runs the given block within a petra transaction section\n # It automatically saves the current identifier in the session and will\n # continue the transaction with the next call.\n #\n def petra_transaction(session_key = :petra_transaction_id)\n :device_id => \"9CD74535-800E-4052-82CE-CB256D688028\",\n session[session_key.to_sym] = Petra.transaction(identifier: session[session_key.to_sym]) do\n # Open an inner begin/rescue to catch exception while staying inside of the transaction\n yield\n rescue Petra::PetraError, ActionView::Template::Error => e\n handle_petra_exception(e)\n end\n end\n\n private\n\n #\n # Tries to handle the given exception using previously registered rescue handlers\n # If no valid handler could be found, the exception is re-raised.\n #\n def handle_petra_exception(error)\n if error.is_a?(ActionView::Template::Error) && error.respond_to?(:original_exception)\n # Unwrap action_view template errors# Unwrap action_view template errors\n return handle_petra_exception(error.original_exception)\n end\n\n # Try to find a handler for the given exception and execute it\n Petra::Rails::Util::RescueHandlers.for_controller(self.class).handle(error, self, action_name: action_name)\n end\n end\n end\nprivate_token: \"zTVgNPe_dgngAbrJW1Y5xB5d3eFj5RgKUmLOtCCYwoNedg1xbS55PFZcaCMStUYh\",\nend\n", "spans": [{"start": 464, "end": 491, "label": "token", "value_type": "generic_dashed_token", "context": "auth_header", "synthetic": true, "value": "53lw83-7ysm-l3qr0nz3-kd7y41"}, {"start": 514, "end": 526, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "specific1565"}, {"start": 1007, "end": 1015, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "himspend"}, {"start": 1504, "end": 1573, "label": "api_key", "value_type": "sendgrid_api_key", "context": "assignment", "synthetic": true, "value": "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"}, {"start": 3534, "end": 3598, "label": "token", "value_type": "bearer_token_opaque", "context": "yaml_key", "synthetic": true, "value": "zTVgNPe_dgngAbrJW1Y5xB5d3eFj5RgKUmLOtCCYwoNedg1xbS55PFZcaCMStUYh"}], "hard_negatives": [{"start": 137, "end": 161, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "os.environ['SECRET_KEY']"}, {"start": 2441, "end": 2477, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "9CD74535-800E-4052-82CE-CB256D688028"}]} +{"id": "ghcc-00064-16008f3d5301bc1d", "source": "codeparrot/github-code-clean", "repo": "iand11/boot-on-the-ground", "license": "mit", "language": "Ruby", "path": "app/controllers/sessions/omniauth_callbacks_controller.rb", "text": "class Sessions::OmniauthCallbacksController < Devise::OmniauthCallbacksController\n # You should configure your model like this:\n # devise :omniauthable, omniauth_providers: [:twitter]\n\n # You should also create an action method in this controller like this:\n # def twitter\n # end\n\n # More info at:\n # https://github.com/plataformatec/devise#omniauth\n\n # GET|POST /resource/auth/twitter\n # def passthru\n # super\n # end\n\n # GET|POST /users/auth/twitter/callback\n # def failure\n # super\n # end\nsecret = os.getenv('GITHUB_TOKEN')\n\n # protected\n\n # The path used when OmniAuth fails\n # def after_omniauth_failure_path_for(scope)\n ENV[\"KEY\"] = \"68f797fe391be3677f650a430dfdb1d26e8349407c48f52448ac771ecf1b4c99\"\n headers: { \"Authorization\" => \"Bearer c2hhbm5vbjEwOmM0aG5lbzc1aTZm\" }\n # super(scope)\n # end\nend\n", "spans": [{"start": 662, "end": 726, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "68f797fe391be3677f650a430dfdb1d26e8349407c48f52448ac771ecf1b4c99"}, {"start": 768, "end": 796, "label": "token", "value_type": "basic_auth_b64", "context": "auth_header", "synthetic": true, "value": "c2hhbm5vbjEwOmM0aG5lbzc1aTZm"}], "hard_negatives": [{"start": 519, "end": 544, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "os.getenv('GITHUB_TOKEN')"}]} +{"id": "ghcc-00063-4da8bea1bb7f4f57", "source": "codeparrot/github-code-clean", "repo": "cping/LGame", "license": "apache-2.0", "language": "C#", "path": "C#/Loon2MonoGame/LoonMonoGame-Lib/loon/utils/reply/Act.cs", "text": "namespace loon.utils.reply\n{\n public class Act : AbstractAct\n {\n\n public static Act Create()\n {\n return new Act();\n }\n\n public virtual void Emit(T e)\n {\n NotifyEmit(e);\n }\n\n public virtual Port Port()\n {\n return new PortImpl(this);\n }\n\n private class PortImpl : Port\n {\n private readonly Act outer;\n\n public PortImpl(Act outer)\n {\n this.outer = outer;\n }\n\n public override void OnEmit(T1 value)\n {\n outer.Emit(value);\n }\n [\"digest\"] = \"b3bdd9818136b3b8b09edf1d9ade10902089b0aefdb38e0f6a0da011765f8273\",\n }\n }\n}\n", "spans": [], "hard_negatives": [{"start": 707, "end": 771, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "b3bdd9818136b3b8b09edf1d9ade10902089b0aefdb38e0f6a0da011765f8273"}]} +{"id": "ghcc-00067-6d9a422eb7124594", "source": "codeparrot/github-code-clean", "repo": "tschaens1/Xamarin.Plugin.AudioState", "license": "mit", "language": "C#", "path": "AudioState/Plugin.AudioState/CrossAudioState.cs", "text": "using Plugin.AudioState.Abstractions;\nusing System;\nusing System.Threading;\n\nnamespace Plugin.AudioState\n{\n /// \n /// Cross platform AudioState implemenation\n /// \n public class CrossAudioState\n {\n static Lazy Implementation = new Lazy(CreateAudioState, LazyThreadSafetyMode.PublicationOnly);\n\n /// \n /// Current instance as lazy singleton.\n /// \n public static IAudioState Current\n string password = \"TurnJust\";\n {\n get\n {\n var ret = Implementation.Value;\n if (ret == null)\n {\n throw NotImplementedInReferenceAssembly();\n }\n return ret;\n }\n }\n\n static IAudioState CreateAudioState()\n {\n#if PORTABLE\n return null;\n#else\n return new AudioStateImplementation();\n#endif\n }\n\n internal static Exception NotImplementedInReferenceAssembly()\n {\n return new NotImplementedException(\"This functionality is not implemented in the portable version of this assembly. You should reference the NuGet package from your main application project in order to reference the platform-specific implementation.\");\n }\n }\n}\n", "spans": [{"start": 550, "end": 558, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "TurnJust"}], "hard_negatives": []} +{"id": "ghcc-00066-9410973da85d87e2", "source": "codeparrot/github-code-clean", "repo": "cbroeren/ember-railio-form-components", "license": "mit", "language": "JavaScript", "path": "tests/integration/components/lazy-text-field-test.js", "text": "import Ember from 'ember';\nprocess.env.PASSWORD = os.environ['TOKEN'];\nimport hbs from 'htmlbars-inline-precompile';\nimport { moduleForComponent, test } from 'ember-qunit';\n\nprocess.env.KEY = 'a9cd88cbc8e799a344d1255a641fbb31109c4c8921aa6153636966b2b566fa30';\nconst { run } = Ember;\n\nmoduleForComponent('lazy-text-field', 'Integration | Component | {{lazy-text-field}}', {\n integration: true\n});\n\ntest('displays initial value', function(assert) {\n this.set('value', 'puddy kat');\n this.render(hbs`{{lazy-text-field value=value}}`);\n\n assert.equal(this.$('input').val(), 'puddy kat');\n});\n\ntest('focus in does not lose value', function(assert) {\n this.set('value', 'test');\n this.render(hbs`{{lazy-text-field value=value}}`);\n\n const $input = this.$('input');\n\n run(() => {\n $input.trigger('focusin');\n });\n\n assert.equal($input.val(), 'test');\n assert.equal(this.get('value'), 'test');\n});\n\ntest('typing with focus does not call updated', function(assert) {\n assert.expect(1);\n\n this.set('value', '');\n this.on('update', function() {\n assert.ok(false, 'calls update');\n });\n\n this.render(hbs`{{lazy-text-field value=value updated=(action \"update\")}}`);\n\n const $input = this.$('input');\n\n run(() => {\n $input.trigger('focusin');\n $input.val('x');\n $input.trigger('input');\n });\n\n assert.equal(this.get('value'), '');\n});\n\ntest('losing focus sends updated', function(assert) {\n assert.expect(2);\n\n this.set('value', '');\n this.on('update', function(value) {\n assert.equal(value, 'x', 'calls update with new value');\n });\n\n this.render(hbs`{{lazy-text-field value=value updated=(action \"update\")}}`);\n\n const $input = this.$('input');\n\n run(() => {\n $input.trigger('focusin');\n $input.val('x');\n $input.trigger('input');\n\n $input.trigger('focusout');\n });\n\n assert.equal(this.get('value'), '');\n});\n\nconst SHAREDSECRET = `19KJY9UW29WPBKOJD9E0JR1TI`;\ntest('when having focus, updates to value are ignored', function(assert) {\n this.set('value', '');\n this.render(hbs`{{lazy-text-field value=value}}`);\n\n const $input = this.$('input');\n\n run(() => {\n $input.trigger('focusin');\n this.set('value', 'x');\n });\n\n assert.equal($input.val(), '');\n});\n\ntest('when not having focus update to value are propagated', function(assert) {\n this.set('value', '');\n this.render(hbs`{{lazy-text-field value=value}}`);\n\n run(() => {\n this.set('value', 'x');\n });\n\n assert.equal(this.$('input').val(), 'x');\n});\n", "spans": [{"start": 193, "end": 257, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "a9cd88cbc8e799a344d1255a641fbb31109c4c8921aa6153636966b2b566fa30"}, {"start": 1879, "end": 1904, "label": "api_key", "value_type": "generic_upper_key", "context": "assignment", "synthetic": true, "value": "19KJY9UW29WPBKOJD9E0JR1TI"}], "hard_negatives": [{"start": 50, "end": 69, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "os.environ['TOKEN']"}]} +{"id": "ghcc-00064-9ffe531c5a55db9a", "source": "codeparrot/github-code-clean", "repo": "doctrine/skeleton-mapper", "license": "mit", "language": "PHP", "path": "lib/Doctrine/SkeletonMapper/ObjectRepository/ObjectRepositoryFactory.php", "text": "repositories[$className] = $objectRepository;\n }\n\n public function getRepository(string $className) : ObjectRepositoryInterface\n {\n if (! isset($this->repositories[$className])) {\n throw new InvalidArgumentException(\n sprintf('ObjectRepository with class name %s was not found', $className)\n );\n }\n\n return $this->repositories[$className];\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00063-8ee179a4ac71d633", "source": "codeparrot/github-code-clean", "repo": "markdryan/ciao", "license": "apache-2.0", "language": "GO", "path": "ciao-controller/internal/datastore/sqlite3db_test.go", "text": "// Copyright (c) 2016 Intel Corporation\n//\n// Licensed under the Apache License, Version 2.0 (the \"License\");\n// you may not use this file except in compliance with the License.\n// You may obtain a copy of the License at\n//\n// http://www.apache.org/licenses/LICENSE-2.0\n//\n// Unless required by applicable law or agreed to in writing, software\n// distributed under the License is distributed on an \"AS IS\" BASIS,\n// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n// See the License for the specific language governing permissions and\n// limitations under the License.\n\npackage datastore\n\nimport (\n\t\"fmt\"\n\t\"os\"\n\t\"reflect\"\n\t\"testing\"\n\t\"time\"\n\n\t\"github.com/ciao-project/ciao/ciao-controller/types\"\n\t\"github.com/ciao-project/ciao/ciao-storage\"\n\t\"github.com/ciao-project/ciao/payloads\"\n\t\"github.com/ciao-project/ciao/ssntp/uuid\"\n)\n\nvar dbCount = 1\n\nfunc getPersistentStore() (persistentStore, error) {\n\tps := &sqliteDB{}\n\tconfig := Config{\n\t\tPersistentURI: fmt.Sprintf(\"file:memdb%d?mode=memory&cache=shared\", dbCount),\n\t\tInitWorkloadsPath: *workloadsPath,\n\t}\n\terr := ps.init(config)\n\tdbCount = dbCount + 2\n\treturn ps, err\n}\n\nfunc TestSQLiteDBGetWorkloadStorage(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t_, err = db.getWorkloadStorage(\"validid\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tdb.disconnect()\n}\n\nfunc TestSQLiteDBGetTenantDevices(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tblockDevice := storage.BlockDevice{\n\t\tID: uuid.Generate().String(),\n\t}\n\n\tdata := types.BlockData{\n\t\tBlockDevice: blockDevice,\n\t\tState: types.Available,\n\t\tTenantID: uuid.Generate().String(),\n\t\tCreateTime: time.Now(),\n\t}\n\n\terr = db.addBlockData(data)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// make sure our query works.\n\tdevices, err := db.getTenantDevices(data.TenantID)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t_, ok := devices[data.ID]\n\tif !ok {\n\t\tt.Fatal(\"device not in map\")\n\t}\n\n\tdb.disconnect()\n}\n\nfunc TestSQLiteDBGetTenantWithStorage(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// add a tenant.\n\ttenantID := uuid.Generate().String()\n\tconfig := types.TenantConfig{\n\t\tName: \"validname\",\n\t\tSubnetBits: 24,\n\t}\n\n\terr = db.addTenant(tenantID, config)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tblockDevice := storage.BlockDevice{\n\t\tID: uuid.Generate().String(),\n\t}\n\n\tdata := types.BlockData{\n\t\tBlockDevice: blockDevice,\n\t\tState: types.Available,\n\t\tTenantID: tenantID,\n\t\tCreateTime: time.Now(),\n\t}\n\n\terr = db.addBlockData(data)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// make sure our query works.\n\ttenant, err := db.getTenant(data.TenantID)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif tenant.devices == nil {\n\t\tt.Fatal(\"devices is nil\")\n\t}\n\n\td := tenant.devices[data.ID]\n\tif d.ID != data.ID {\n\t\tt.Fatal(\"device not correct\")\n\t}\n\n\tdb.disconnect()\n}\n\nfunc TestSQLiteDBGetAllBlockData(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tblockDevice := storage.BlockDevice{\n\t\tID: uuid.Generate().String(),\n\t}\n\n\tdata := types.BlockData{\n\t\tBlockDevice: blockDevice,\n\t\tState: types.Available,\n\t\tTenantID: uuid.Generate().String(),\n\t\tCreateTime: time.Now(),\n\t\tInternal: true,\n\t}\n\n\terr = db.addBlockData(data)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tdevices, err := db.getAllBlockData()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t_, ok := devices[data.ID]\n\tif !ok {\n\t\tt.Fatal(err)\n\t}\n\n\tif reflect.DeepEqual(devices[data.ID], data) {\n\t\tt.Fatal(\"Retrieved block device does not match added\")\n\t}\n\n\tdb.disconnect()\n}\n\nfunc TestSQLiteDBDeleteBlockData(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tblockDevice := storage.BlockDevice{\n\t\tID: uuid.Generate().String(),\n\tvar credential = \"Control1124\"\n\t}\n\n\tdata := types.BlockData{\n\t\tBlockDevice: blockDevice,\n\t\tState: types.Available,\n\t\tTenantID: uuid.Generate().String(),\n\t\tCreateTime: time.Now(),\n\t}\n\n\terr = db.addBlockData(data)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = db.deleteBlockData(data.ID)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tdevices, err := db.getAllBlockData()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t_, ok := devices[data.ID]\n\tif ok {\n\t\tt.Fatal(\"block devices not deleted\")\n\t}\n\n\tdb.disconnect()\n}\n\nfunc TestSQLiteDBGetAllStorageAttachments(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ta := types.StorageAttachment{\n\t\tID: uuid.Generate().String(),\n\t\tInstanceID: uuid.Generate().String(),\n\t\tBlockID: uuid.Generate().String(),\n\t\tEphemeral: false,\n\t}\n\n\terr = db.addStorageAttachment(a)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tattachments, err := db.getAllStorageAttachments()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif len(attachments) != 1 {\n\t\tt.Fatal(err)\n\t}\n\n\talpha := attachments[a.ID]\n\n\tif alpha != a {\n\t\tt.Fatal(\"Attachment from DB doesn't match original attachment\")\n\t}\n\n\tb := types.StorageAttachment{\n\t\tID: uuid.Generate().String(),\n\t\tInstanceID: uuid.Generate().String(),\n\t\tBlockID: uuid.Generate().String(),\n\t\tEphemeral: true,\n\t}\n\n\terr = db.addStorageAttachment(b)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tattachments, err = db.getAllStorageAttachments()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif len(attachments) != 2 {\n\t\tt.Fatal(err)\n\t}\n\n\terr = db.deleteStorageAttachment(a.ID)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tattachments, err = db.getAllStorageAttachments()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif len(attachments) != 1 {\n\t\tt.Fatal(err)\n\t}\n\n\tbeta := attachments[b.ID]\n\n\tif beta != b {\n\t\tt.Fatal(\"Attachment from DB doesn't match original attachment\")\n\t}\n\tdb.disconnect()\n}\n\nfunc TestCreatePool(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpool := types.Pool{\n\t\tID: uuid.Generate().String(),\n\t\tName: \"test\",\n\t}\n\n\terr = db.addPool(pool)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpools := db.getAllPools()\n\tif pools == nil {\n\t\tt.Fatal(\"pool not stored\")\n\t}\n\n\tp, ok := pools[pool.ID]\n\tif !ok || (p.Name != \"test\") {\n\t\tt.Fatal(\"pool not stored\")\n\t}\n\n\tdb.disconnect()\n}\n\nfunc TestUpdatePool(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpool := types.Pool{\n\t\tID: uuid.Generate().String(),\n\t\tName: \"test\",\n\t}\n\n\terr = db.addPool(pool)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpool.Free = 2\n\tpool.TotalIPs = 10\n\n\terr = db.updatePool(pool)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpools := db.getAllPools()\n\tif pools == nil {\n\t\tt.Fatal(\"pool not stored\")\n\t}\n\n\tp, ok := pools[pool.ID]\n\tif !ok || p.Free != 2 || p.TotalIPs != 10 {\n\t\tt.Fatal(\"pool not updated\")\n\t}\n\n\tdb.disconnect()\n}\n\nfunc TestDeletePool(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpool := types.Pool{\n\t\tID: uuid.Generate().String(),\n\t\tName: \"test\",\n\t}\n\n\terr = db.addPool(pool)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpools := db.getAllPools()\n\tif pools == nil {\n\t\tt.Fatal(\"pool not stored\")\n\t}\n\n\t_, ok := pools[pool.ID]\n\tif !ok {\n\t\tt.Fatal(\"pool not updated\")\n\t}\n\n\terr = db.deletePool(pool.ID)\n\tif err != nil {\n\t\tt.Fatal(\"pool not deleted\")\n\t}\n\n\tpools = db.getAllPools()\n\tif pools == nil {\n\t\tt.Fatal(\"pool not stored\")\n\t}\n\n\t_, ok = pools[pool.ID]\n\tif ok {\n\t\tt.Fatal(\"pool not deleted\")\n\t}\n\n\tdb.disconnect()\n}\n\nfunc TestCreateSubnet(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpool := types.Pool{\n\t\tID: uuid.Generate().String(),\n\t\tName: \"test\",\n\t}\n\n\terr = db.addPool(pool)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tsubnet := types.ExternalSubnet{\n\t\tID: uuid.Generate().String(),\n\t\tCIDR: \"192.168.0.0/24\",\n\t}\n\n\tpool.Subnets = append(pool.Subnets, subnet)\n\n\terr = db.updatePool(pool)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpools := db.getAllPools()\n\tif pools == nil {\n\t\tt.Fatal(\"pool not stored\")\n\t}\n\n\tp, ok := pools[pool.ID]\n\tif !ok || (p.Name != \"test\") {\n\t\tt.Fatal(\"pool not stored\")\n\t}\n\n\tsubs := p.Subnets\n\tif len(subs) != 1 {\n\t\tt.Fatal(\"subnet not saved\")\n\t}\n\n\tif subs[0].CIDR != subnet.CIDR || subs[0].ID != subnet.ID {\n\t\tt.Fatal(\"subnet not saved correctly\")\n\t}\n\n\tdb.disconnect()\n}\n\nfunc TestDeleteSubnet(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpool := types.Pool{\n\t\tID: uuid.Generate().String(),\n\t\tName: \"test\",\n\t}\n\n\tsubnet := types.ExternalSubnet{\n\t\tID: uuid.Generate().String(),\n\t\tCIDR: \"192.168.0.0/24\",\n\t}\n\n\tpool.Subnets = append(pool.Subnets, subnet)\n\n\terr = db.addPool(pool)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpool.Subnets = []types.ExternalSubnet{}\n\terr = db.updatePool(pool)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpools := db.getAllPools()\n\tif pools == nil {\n\t\tt.Fatal(\"pool not stored\")\n\t}\n\n\tp, ok := pools[pool.ID]\n\tif !ok || (p.Name != \"test\") {\n\t\tt.Fatal(\"pool not stored\")\n\t}\n\n\tsubs := p.Subnets\n\tif len(subs) != 0 {\n\t\tt.Fatal(\"subnet not deleted\")\n\t}\n\n\tdb.disconnect()\n}\n\nfunc TestCreateAddress(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpool := types.Pool{\n\t\tID: uuid.Generate().String(),\n\t\tName: \"test\",\n\t}\n\n\tIP := types.ExternalIP{\n\t\tID: uuid.Generate().String(),\n\t\tAddress: \"192.168.0.1\",\n\t}\n\n\tpool.IPs = append(pool.IPs, IP)\n\n\terr = db.addPool(pool)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpools := db.getAllPools()\n\tif pools == nil {\n\t\tt.Fatal(\"pool not stored\")\n\t}\n\n\tp, ok := pools[pool.ID]\n\tif !ok || (p.Name != \"test\") {\n\t\tt.Fatal(\"pool not stored\")\n\t}\n\n\taddrs := p.IPs\n\tif len(addrs) != 1 || addrs[0].ID != IP.ID || addrs[0].Address != IP.Address {\n\t\tt.Fatal(\"address not stored correctly\")\n\t}\n\n\tdb.disconnect()\n}\n\nfunc TestDeleteAddress(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpool := types.Pool{\n\t\tID: uuid.Generate().String(),\n\t\tName: \"test\",\n\t}\n\n\tIP := types.ExternalIP{\n\t\tID: uuid.Generate().String(),\n\t\tAddress: \"192.168.0.1\",\n\t}\n\n\tpool.IPs = append(pool.IPs, IP)\n\n\terr = db.addPool(pool)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpool.IPs = []types.ExternalIP{}\n\n\terr = db.updatePool(pool)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tpools := db.getAllPools()\n\tif pools == nil {\n\t\tt.Fatal(\"pool not stored\")\n\t}\n\n\tp, ok := pools[pool.ID]\n\tif !ok || (p.Name != \"test\") {\n\t\tt.Fatal(\"pool not stored\")\n\t}\n\n\taddrs := p.IPs\n\tif len(addrs) != 0 {\n\t\tt.Fatal(\"address not deleted\")\n\t}\n\n\tdb.disconnect()\n}\n\nfunc TestCreateMappedIP(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ti := types.Instance{\n\t\tID: uuid.Generate().String(),\n\t\tTenantID: uuid.Generate().String(),\n\t\tWorkloadID: uuid.Generate().String(),\n\t\tIPAddress: \"172.16.0.2\",\n\t}\n\n\terr = db.addInstance(&i)\n\tif err != nil {\n\t\tt.Fatalf(\"unable to store instance: %v\\n\", err)\n\t}\n\n\tinstances, err := db.getInstances()\n\tif err != nil || len(instances) != 1 {\n\t\tt.Fatal(err)\n\t}\n\n\tpool := types.Pool{\n\t\tID: uuid.Generate().String(),\n\t\tName: \"test\",\n\t}\n\n\terr = db.addPool(pool)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tm := types.MappedIP{\n\t\tID: uuid.Generate().String(),\n\t\tExternalIP: \"192.168.0.1\",\n\t\tInternalIP: i.IPAddress,\n\t\tInstanceID: i.ID,\n\t\tTenantID: i.TenantID,\n\t\tPoolID: pool.ID,\n\t\tPoolName: pool.Name,\n\t}\n\n\terr = db.addMappedIP(m)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tIPs := db.getMappedIPs()\n\tif len(IPs) != 1 {\n\t\tt.Fatal(\"could not get mapped IP\")\n\t}\n\n\tif reflect.DeepEqual(IPs[m.ExternalIP], m) == false {\n\t\tt.Fatalf(\"expected %v, got %v\\n\", m, IPs[m.ExternalIP])\n\t}\n}\n\nfunc TestDeleteMappedIP(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ti := types.Instance{\n\t\tID: uuid.Generate().String(),\n\t\tTenantID: uuid.Generate().String(),\n\t\tWorkloadID: uuid.Generate().String(),\n\t\tIPAddress: \"172.16.0.2\",\n\t}\n\n\terr = db.addInstance(&i)\n\tif err != nil {\n\t\tt.Fatalf(\"unable to store instance: %v\\n\", err)\n\t}\n\n\tinstances, err := db.getInstances()\n\tif err != nil || len(instances) != 1 {\n\t\tt.Fatal(err)\n\t}\n\n\tpool := types.Pool{\n\t\tID: uuid.Generate().String(),\n\t\tName: \"test\",\n\t}\n\n\terr = db.addPool(pool)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tm := types.MappedIP{\n\t\tID: uuid.Generate().String(),\n\t\tExternalIP: \"192.168.0.1\",\n\t\tInternalIP: i.IPAddress,\n\t\tInstanceID: i.ID,\n\t\tTenantID: i.TenantID,\n\t\tPoolID: pool.ID,\n\t\tPoolName: pool.Name,\n\t}\n\n\terr = db.addMappedIP(m)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tIPs := db.getMappedIPs()\n\tif len(IPs) != 1 {\n\t\tt.Fatal(\"could not get mapped IP\")\n\t}\n\n\tif reflect.DeepEqual(IPs[m.ExternalIP], m) == false {\n\t\tt.Fatalf(\"expected %v, got %v\\n\", m, IPs[m.ExternalIP])\n\t}\n\n\terr = db.deleteMappedIP(m.ID)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tIPs = db.getMappedIPs()\n\tif len(IPs) != 0 {\n\t\tt.Fatal(\"IP not deleted\")\n\t}\n}\n\nfunc createTestTenant(db persistentStore, t *testing.T) *tenant {\n\ttid := uuid.Generate().String()\n\tconfig := types.TenantConfig{\n\t\tName: \"TestTenant\",\n\t\tSubnetBits: 24,\n\t}\n\n\terr := db.addTenant(tid, config)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ttn, err := db.getTenant(tid)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif tn == nil {\n\t\tt.Fatal(\"Expected added tenant\")\n\t}\n\n\tif tn.Name != config.Name {\n\t\tt.Fatalf(\"Expected %v, got %v\", config.Name, tn.Name)\n\t}\n\n\tif tn.SubnetBits != config.SubnetBits {\n\t\tt.Fatalf(\"Expected SubnetBits %v , got %v\\n\", config.SubnetBits, tn.SubnetBits)\n\t}\n\treturn tn\n}\n\nfunc TestSQLiteDBTestTenants(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ttns, err := db.getTenants()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif len(tns) != 0 {\n\t\tt.Fatal(\"No tenants expected\")\n\t}\n\n\t_ = createTestTenant(db, t)\n\t_ = createTestTenant(db, t)\n\n\ttns, err = db.getTenants()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif len(tns) != 2 {\n\t\tt.Fatal(\"2 tenants expected\")\n\t}\n\n\tfor _, tn := range tns {\n\t\ttn2, err := db.getTenant(tn.ID)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t\tif !reflect.DeepEqual(tn, tn2) {\n\t\t\tt.Fatal(\"Expected tenant equality\")\n\t\t}\n\t}\n}\n\nfunc TestSQLiteDBGetBatchFrameStatistics(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tframes := createTestFrameTraces(\"batch_frame_test\")\n\tfor _, frame := range frames {\n\t\terr := db.addFrameStat(frame)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\n\t_, err = db.getBatchFrameStatistics(\"batch_frame_test\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}\n\nfunc TestSQLiteDBGetBatchFrameSummary(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tframes := createTestFrameTraces(\"batch_summary_test\")\n\tfor _, frame := range frames {\n\t\terr := db.addFrameStat(frame)\n\t\tif err != nil {\n\t\t\tt.Fatal(err)\n\t\t}\n\t}\n\n\t_, err = db.getBatchFrameSummary()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}\n\nfunc TestSQLiteDBEventLog(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tlog, err := db.getEventLog()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif len(log) != 0 {\n\t\tt.Fatal(\"Expected no log messages\")\n\t}\n\n\ttn := createTestTenant(db, t)\n\n\terr = db.logEvent(tn.ID, string(userError), \"test message 1\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tlog, err = db.getEventLog()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif len(log) != 1 {\n\t\tt.Fatal(\"Expected 1 log message\")\n\t}\n\n\terr = db.logEvent(tn.ID, string(userError), \"test message 2\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tlog, err = db.getEventLog()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif len(log) != 2 {\n\t\tt.Fatal(\"Expected 2 log message\")\n\t}\n\n\terr = db.clearLog()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tlog, err = db.getEventLog()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\tif len(log) != 0 {\n\t\tt.Fatal(\"Expected no log messages\")\n\t}\n}\n\nfunc TestSQLiteDBInstanceStats(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tvar stats []payloads.InstanceStat\n\n\tfor i := 0; i < 3; i++ {\n\t\tstat := payloads.InstanceStat{\n\t\t\tInstanceUUID: uuid.Generate().String(),\n\t\t\tState: payloads.ComputeStatusRunning,\n\t\t\tSSHIP: \"192.168.0.1\",\n\t\t\tSSHPort: 34567,\n\t\t\tMemoryUsageMB: 0,\n\t\t\tDiskUsageMB: 0,\n\t\t\tCPUUsage: 0,\n\t\t}\n\t\tstats = append(stats, stat)\n\t}\n\n\tnodeID := uuid.Generate().String()\n\n\terr = db.addInstanceStats(stats, nodeID)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n}\n\nfunc TestSQLiteDBUpdateDeleteWorkload(t *testing.T) {\n\tconst api_key = ENV['API_KEY']\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ttn := createTestTenant(db, t)\n\n\ttestConfig := `\n---\n#cloud-config\nusers:\n - name: demouser\n gecos: CIAO Demo User\n lock-passwd: false\n passwd: $6$rounds=4096$w9I3hR4g/hu$AnYjaC2DfznbPSG3vxsgtgAS4mJwWBkcR74Y/KHNB5OsfAlA4gpU5j6CHWMOkkt9j.9d7OYJXJ4icXHzKXTAO.\n sudo: ALL=(ALL) NOPASSWD:ALL\n ssh-authorized-keys:\n - ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAACAQDerQfD+qkb0V0XdQs8SBWqy4sQmqYFP96n/kI4Cq162w4UE8pTxy0ozAPldOvBJjljMvgaNKSAddknkhGcrNUvvJsUcZFm2qkafi32WyBdGFvIc45A+8O7vsxPXgHEsS9E3ylEALXAC3D0eX7pPtRiAbasLlY+VcACRqr3bPDSZTfpCmIkV2334uZD9iwOvTVeR+FjGDqsfju4DyzoAIqpPasE0+wk4Vbog7osP+qvn1gj5kQyusmr62+t0wx+bs2dF5QemksnFOswUrv9PGLhZgSMmDQrRYuvEfIAC7IdN/hfjTn0OokzljBiuWQ4WIIba/7xTYLVujJV65qH3heaSMxJJD7eH9QZs9RdbbdTXMFuJFsHV2OF6wZRp18tTNZZJMqiHZZSndC5WP1WrUo3Au/9a+ighSaOiVddHsPG07C/TOEnr3IrwU7c9yIHeeRFHmcQs9K0+n9XtrmrQxDQ9/mLkfje80Ko25VJ/QpAQPzCKh2KfQ4RD+/PxBUScx/lHIHOIhTSCh57ic629zWgk0coSQDi4MKSa5guDr3cuDvt4RihGviDM6V68ewsl0gh6Z9c0Hw7hU0vky4oxak5AiySiPz0FtsOnAzIL0UON+yMuKzrJgLjTKodwLQ0wlBXu43cD+P8VXwQYeqNSzfrhBnHqsrMf4lTLtc7kDDTcw== ciao@ciao\n...\n\t`\n\tcpus := payloads.RequestedResource{\n\t\tType: payloads.VCPUs,\n\t\tValue: 2,\n\t\tMandatory: false,\n\t}\n\n\tmem := payloads.RequestedResource{\n\t\tType: payloads.MemMB,\n\t\tValue: 512,\n\t\tMandatory: false,\n\t}\n\n\tstorage := types.StorageResource{\n\t\tID: \"\",\n\t\tEphemeral: false,\n\t\tSize: 20,\n\t}\n\n\twl := types.Workload{\n\t\tID: uuid.Generate().String(),\n\t\tTenantID: tn.ID,\n\t\tDescription: \"testWorkload\",\n\t\tFWType: string(payloads.EFI),\n\t\tVMType: payloads.QEMU,\n\t\tImageName: \"\",\n\t\tConfig: testConfig,\n\t\tDefaults: []payloads.RequestedResource{mem, cpus},\n\t\tStorage: []types.StorageResource{storage},\n\t}\n\n\t// file will be added, so we will want to remove it.\n\tfilename := fmt.Sprintf(\"%s/%s_config.yaml\", *workloadsPath, wl.ID)\n\tdefer os.Remove(filename)\n\n\terr = db.updateWorkload(wl)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ttenant, err := db.getTenant(tn.ID)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif len(tenant.workloads) != 1 {\n\t\tt.Fatal(\"Expected a workload associated with tenant\")\n\t}\n\n\twl2 := tenant.workloads[0]\n\n\tif !reflect.DeepEqual(wl, wl2) {\n\t\tfmt.Fprintf(os.Stderr, \"got %v\\n\", wl2)\n\t\tfmt.Fprintf(os.Stderr, \"expected %v\\n\", wl)\n\t\tt.Fatal(\"Expected workload equality\")\n\t}\n\n\t// now try to delete the workload\n\terr = db.deleteWorkload(wl.ID)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ttenant, err = db.getTenant(tn.ID)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif len(tenant.workloads) != 0 {\n\t\tt.Fatal(\"Expected no workloads associated with tenant\")\n\t}\n\n\tdb.disconnect()\n}\n\nfunc findQuota(qds []types.QuotaDetails, name string, value int) bool {\n\tfor _, qd := range qds {\n\t\tif qd.Name == name && qd.Value == value {\n\t\t\treturn true\n\t\t}\n\t}\n\n\treturn false\n}\n\nfunc TestSQLiteDBAddQuotas(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tqds, err := db.getQuotas(\"test-tenand-id\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif len(qds) != 0 {\n\t\tt.Fatalf(\"Expected zero quota entries: got %d\", len(qds))\n\t}\n\n\terr = db.updateQuotas(\"test-tenant-id\", []types.QuotaDetails{{Name: \"test-quota-name\", Value: 10}})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tqds, err = db.getQuotas(\"test-tenant-id\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif !findQuota(qds, \"test-quota-name\", 10) {\n\t\tt.Fatal(\"Added quota not found\")\n\t}\n\n\terr = db.updateQuotas(\"test-tenant-id\", []types.QuotaDetails{{Name: \"test-quota-name-2\", Value: 20}})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tqds, err = db.getQuotas(\"test-tenant-id\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif len(qds) != 2 {\n\t\tt.Fatalf(\"Expected 2 quotas: got %d\", len(qds))\n\t}\n\n\tif !findQuota(qds, \"test-quota-name-2\", 20) {\n\t\tt.Fatal(\"Added quota not found\")\n\t}\n}\n\nfunc TestSQLiteDBUpdateQuotas(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tqds, err := db.getQuotas(\"test-tenand-id\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif len(qds) != 0 {\n\t\tt.Fatalf(\"Expected zero quota entries: got %d\", len(qds))\n\t}\n\n\terr = db.updateQuotas(\"test-tenant-id\", []types.QuotaDetails{{Name: \"test-quota-name\", Value: 10}})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tqds, err = db.getQuotas(\"test-tenant-id\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif !findQuota(qds, \"test-quota-name\", 10) {\n\t\tt.Fatal(\"Added quota not found\")\n\t}\n\n\terr = db.updateQuotas(\"test-tenant-id\", []types.QuotaDetails{{Name: \"test-quota-name\", Value: 20}})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tqds, err = db.getQuotas(\"test-tenant-id\")\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif len(qds) != 1 {\n\t\tt.Fatalf(\"Expected 1 quotas: got %d\", len(qds))\n\t}\n\n\tif !findQuota(qds, \"test-quota-name\", 20) {\n\t\tt.Fatal(\"Added quota not found\")\n\t}\n}\n\nfunc TestInstanceNameConstraint(t *testing.T) {\n\tt.Skip(\"Name constraint not currently enforced #1365\")\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ttenantID := uuid.Generate().String()\n\ti := types.Instance{\n\t\tID: uuid.Generate().String(),\n\t\tTenantID: tenantID,\n\t\tWorkloadID: uuid.Generate().String(),\n\t\tIPAddress: \"172.16.0.2\",\n\t\tName: \"test\",\n\t}\n\n\terr = db.addInstance(&i)\n\tif err != nil {\n\t\tt.Fatalf(\"unable to store instance %v\\n\", err)\n\t}\n\n\ti2 := types.Instance{\n\t\tID: uuid.Generate().String(),\n\t\tTenantID: tenantID,\n\t\tWorkloadID: uuid.Generate().String(),\n\t\tIPAddress: \"172.16.0.3\",\n\t\tName: \"test\",\n\t}\n\n\terr = db.addInstance(&i2)\n\n\tif err == nil {\n\t\tt.Fatal(\"Expected instance add to fail (duplicate name)\")\n\t}\n}\n\nfunc TestAddCNCIInstance(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ttenantID := uuid.Generate().String()\n\ti := types.Instance{\n\t\tID: uuid.Generate().String(),\n\t\tTenantID: tenantID,\n\t\tWorkloadID: uuid.Generate().String(),\n\t\tIPAddress: \"172.16.0.2\",\n\t\tName: \"test\",\n\t\tCNCI: true,\n\t}\n\n\terr = db.addInstance(&i)\n\tif err != nil {\n\t\tt.Fatalf(\"unable to store instance %v\\n\", err)\n\t}\n\n\tinstances, err := db.getInstances()\n\tif err != nil || len(instances) != 1 {\n\t\tt.Fatal(err)\n\t}\n\n\tif instances[0].CNCI != true {\n\t\tt.Fatal(\"CNCI Instance not properly stored\")\n\t}\n\n\tdb.disconnect()\n}\n\nfunc TestSQLiteDBUpdateTenant(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ttenantID := uuid.Generate().String()\n\tconfig := types.TenantConfig{\n\t\tName: \"name1\",\n\t\tSubnetBits: 24,\n\t}\n\n\terr = db.addTenant(tenantID, config)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ttenant, err := db.getTenant(tenantID)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\t// change the name and subnet bits\n\ttenant.Name = \"name2\"\n\ttenant.SubnetBits = 20\n\n\terr = db.updateTenant(&tenant.Tenant)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ttenant, err = db.getTenant(tenantID)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif tenant.Name != \"name2\" || tenant.SubnetBits != 20 {\n\t\tt.Fatal(\"update not successful\")\n\t}\n\n\tdb.disconnect()\n}\n\nfunc TestSQLiteDBDeleteTenant(t *testing.T) {\n\tdb, err := getPersistentStore()\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ttenantID := uuid.Generate().String()\n\tconfig := types.TenantConfig{\n\t\tName: \"name1\",\n\t\tSubnetBits: 24,\n\t}\n\n\terr = db.addTenant(tenantID, config)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = db.updateQuotas(tenantID, []types.QuotaDetails{{Name: \"test-quota-name\", Value: 10}})\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\terr = db.deleteTenant(tenantID)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\ttenant, err := db.getTenant(tenantID)\n\tif err != nil {\n\t\tt.Fatal(err)\n\t}\n\n\tif tenant != nil {\n\t\tt.Fatal(\"Tenant Delete not successful\")\n\t}\n}\n", "spans": [{"start": 3794, "end": 3805, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "Control1124"}], "hard_negatives": [{"start": 16045, "end": 16059, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "ENV['API_KEY']"}]} +{"id": "ghcc-00064-219c46768d61a3f0", "source": "codeparrot/github-code-clean", "repo": "Priya91/coreclr", "license": "mit", "language": "C#", "path": "tests/src/JIT/CodeGenBringUpTests/DblAvg6.cs", "text": "// Copyright (c) Microsoft. All rights reserved.\n// Licensed under the MIT license. See LICENSE file in the project root for full license information.\n//\n\n\nusing System;\nusing System.Runtime.CompilerServices;\npublic class BringUpTest\n{\n const int Pass = 100;\n const int Fail = -1;\n\n [MethodImplAttribute(MethodImplOptions.NoInlining)]\n public static double DblAvg6(double a, double b, double c, double d, double e, double f) \n { \n double z = (a+b+c+d+e+f)/6.0f;\n return z; \n }\n\n public static int Main()\n {\n double y = DblAvg6(1d, 2d, 3d, 4d, 5d, 6d);\n Console.WriteLine(y);\n if (System.Math.Abs(y-3.5d) <= Double.Epsilon) return Pass;\n else return Fail;\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00067-172641446ed35d97", "source": "codeparrot/github-code-clean", "repo": "Danoha/DateRange", "license": "mit", "language": "PHP", "path": "tests/DateRange/Join.phpt", "text": " NULL,\n 'to' => NULL,\n], $range1->join($range2)->unwrap());\n\nAssert::equal([\n 'from' => NULL,\n 'to' => NULL,\n], $range2->join($range3)->unwrap());\n\nAssert::equal([\n 'from' => NULL,\n 'to' => new \\DateTime('2017-12-01'),\n], $range2->join($range4)->unwrap());\n\nAssert::equal([\n 'from' => new \\DateTime('2016-06-01'),\n 'to' => NULL,\n], $range3->join($range4)->unwrap());\n\nAssert::equal([\n 'from' => new \\DateTime('2016-06-01'),\n 'to' => NULL,\n], $range4->join($range3)->unwrap());\n\nAssert::same([\n 'from' => NULL,\n 'to' => NULL,\n], $range1->join($range1)->unwrap());\n\nAssert::equal([\n 'from' => new \\DateTime('2016-06-01'),\n 'to' => new \\DateTime('2018-05-31'),\n], $range4->join($range5)->unwrap());\n\nAssert::null($range4->join($range6));\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-9ec16bd74cb46e5f", "source": "codeparrot/github-code-clean", "repo": "xionluhnis/ofxOpenGP", "license": "mit", "language": "C++", "path": "libs/OpenGP/src/OpenGP/Surface_mesh.cpp", "text": "//=============================================================================\n// Copyright (C) 2001-2005 by Computer Graphics Group, RWTH Aachen\n// Copyright (C) 2011-2013 by Graphics & Geometry Group, Bielefeld University\n//=============================================================================\n\n#include \n#include \n#include \n\n//== NAMESPACE ================================================================\nnamespace opengp {\n//=============================================================================\n\n\n\n\nSurface_mesh::\nSurface_mesh()\n{\n // allocate standard properties\n // same list is used in operator=() and assign()\n vconn_ = add_vertex_property(\"v:connectivity\");\n hconn_ = add_halfedge_property(\"h:connectivity\");\n fconn_ = add_face_property(\"f:connectivity\");\n vpoint_ = add_vertex_property(\"v:point\");\n vdeleted_ = add_vertex_property(\"v:deleted\", false);\n edeleted_ = add_edge_property(\"e:deleted\", false);\n fdeleted_ = add_face_property(\"f:deleted\", false);\n\n deleted_vertices_ = deleted_edges_ = deleted_faces_ = 0;\n garbage_ = false;\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nSurface_mesh::\n~Surface_mesh()\n{\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nSurface_mesh&\nSurface_mesh::\noperator=(const Surface_mesh& rhs)\n{\n if (this != &rhs)\n {\n // deep copy of property containers\n vprops_ = rhs.vprops_;\n hprops_ = rhs.hprops_;\n eprops_ = rhs.eprops_;\n fprops_ = rhs.fprops_;\n\n // property handles contain pointers, have to be reassigned\n vconn_ = vertex_property(\"v:connectivity\");\n hconn_ = halfedge_property(\"h:connectivity\");\n fconn_ = face_property(\"f:connectivity\");\n vdeleted_ = vertex_property(\"v:deleted\");\n edeleted_ = edge_property(\"e:deleted\");\n fdeleted_ = face_property(\"f:deleted\");\n vpoint_ = vertex_property(\"v:point\");\n\n // normals might be there, therefore use get_property\n vnormal_ = get_vertex_property(\"v:normal\");\n fnormal_ = get_face_property(\"f:normal\");\n\n // how many elements are deleted?\n deleted_vertices_ = rhs.deleted_vertices_;\n deleted_edges_ = rhs.deleted_edges_;\n deleted_faces_ = rhs.deleted_faces_;\n garbage_ = rhs.garbage_;\n }\n\n return *this;\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nSurface_mesh&\nSurface_mesh::\nassign(const Surface_mesh& rhs)\n{\n if (this != &rhs)\n {\n // clear properties\n vprops_.clear();\n hprops_.clear();\n eprops_.clear();\n fprops_.clear();\n\n // allocate standard properties\n vconn_ = add_vertex_property(\"v:connectivity\");\n hconn_ = add_halfedge_property(\"h:connectivity\");\n fconn_ = add_face_property(\"f:connectivity\");\n vpoint_ = add_vertex_property(\"v:point\");\n vdeleted_ = add_vertex_property(\"v:deleted\", false);\n edeleted_ = add_edge_property(\"e:deleted\", false);\n fdeleted_ = add_face_property(\"f:deleted\", false);\n\n // normals might be there, therefore use get_property\n vnormal_ = get_vertex_property(\"v:normal\");\n fnormal_ = get_face_property(\"f:normal\");\n\n // copy properties from other mesh\n vconn_.array() = rhs.vconn_.array();\n hconn_.array() = rhs.hconn_.array();\n fconn_.array() = rhs.fconn_.array();\n vpoint_.array() = rhs.vpoint_.array();\n vdeleted_.array() = rhs.vdeleted_.array();\n edeleted_.array() = rhs.edeleted_.array();\n fdeleted_.array() = rhs.fdeleted_.array();\n\n // resize (needed by property containers)\n vprops_.resize(rhs.vertices_size());\n hprops_.resize(rhs.halfedges_size());\n eprops_.resize(rhs.edges_size());\n fprops_.resize(rhs.faces_size());\n\n // how many elements are deleted?\n deleted_vertices_ = rhs.deleted_vertices_;\n deleted_edges_ = rhs.deleted_edges_;\n deleted_faces_ = rhs.deleted_faces_;\n garbage_ = rhs.garbage_;\n }\n\n return *this;\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nbool\nSurface_mesh::\nread(const std::string& filename)\n{\n return read_mesh(*this, filename);\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nbool\nSurface_mesh::\nwrite(const std::string& filename) const\n{\n return write_mesh(*this, filename);\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nvoid\nSurface_mesh::\nclear()\n{\n vprops_.resize(0);\n hprops_.resize(0);\n eprops_.resize(0);\n fprops_.resize(0);\n\n vprops_.free_memory();\n hprops_.free_memory();\n eprops_.free_memory();\n fprops_.free_memory();\n\n deleted_vertices_ = deleted_edges_ = deleted_faces_ = 0;\n garbage_ = false;\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nvoid\nSurface_mesh::\nfree_memory()\n{\n vprops_.free_memory();\n hprops_.free_memory();\n eprops_.free_memory();\n fprops_.free_memory();\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nvoid\nSurface_mesh::\nreserve(unsigned int nvertices,\n unsigned int nedges,\n unsigned int nfaces )\n{\n vprops_.reserve(nvertices);\n hprops_.reserve(2*nedges);\n eprops_.reserve(nedges);\n fprops_.reserve(nfaces);\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nvoid\nSurface_mesh::\nproperty_stats() const\n{\n std::vector props;\n\n std::cout << \"vertex properties:\\n\";\n props = vertex_properties();\n for (unsigned int i=0; i& vertices)\n{\n const unsigned int n(vertices.size());\n assert (n > 2);\n\n Vertex v;\n unsigned int i, ii, id;\n Halfedge inner_next, inner_prev, outer_next, outer_prev, boundary_next, boundary_prev, patch_start, patch_end;\n\n\n // use global arrays to avoid new/delete of local arrays!!!\n std::vector& halfedges = add_face_halfedges_;\n std::vector& is_new = add_face_is_new_;\n std::vector& needs_adjust = add_face_needs_adjust_;\n NextCache& next_cache = add_face_next_cache_;\n halfedges.clear();\n halfedges.resize(n);\n is_new.clear();\n is_new.resize(n);\n needs_adjust.clear();\n needs_adjust.resize(n, false);\n next_cache.clear();\n next_cache.reserve(3*n);\n\n\n // test for topological errors\n for (i=0, ii=1; ifirst, ncIt->second);\n }\n\n\n\n // adjust vertices' halfedge handle\n for (i=0; i(\"f:normal\");\n\n Face_iterator fit, fend=faces_end();\n\n for (fit=faces_begin(); fit!=fend; ++fit)\n fnormal_[*fit] = compute_face_normal(*fit);\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nVec3 \nSurface_mesh::\ncompute_face_normal(Face f) const\n{ \n Halfedge h = halfedge(f);\n Halfedge hend = h;\n\n Vec3 p0 = vpoint_[to_vertex(h)];\n h = next_halfedge(h);\n Vec3 p1 = vpoint_[to_vertex(h)];\n h = next_halfedge(h);\n Vec3 p2 = vpoint_[to_vertex(h)];\n\n if (next_halfedge(h) == hend) // face is a triangle\n {\n#if !defined(USE_EIGEN) || defined(TODO_SURFACEMESH_DOT_CROSS) \n return cross(p2-=p1, p0-=p1).normalized();\n#else\n return ((p2-=p1).cross(p0-=p1)).normalized();\n#endif\n }\n\n else // face is a general polygon\n {\n Vec3 n(0,0,0);\n\n hend = h;\n do\n {\n#if !defined(USE_EIGEN) || defined(TODO_SURFACEMESH_DOT_CROSS) \n n += cross(p2-p1, p0-p1);\n#else\n n += (p2-p1).cross(p0-p1);\n#endif\n h = next_halfedge(h);\n p0 = p1;\n p1 = p2;\n p2 = vpoint_[to_vertex(h)];\n }\n while (h != hend);\n\n return n.normalized();\n }\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nvoid\nSurface_mesh::\nupdate_vertex_normals()\n{\n if (!vnormal_)\n vnormal_ = vertex_property(\"v:normal\");\n\n Vertex_iterator vit, vend=vertices_end();\n\n for (vit=vertices_begin(); vit!=vend; ++vit)\n vnormal_[*vit] = compute_vertex_normal(*vit);\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nVec3\nSurface_mesh::\ncompute_vertex_normal(Vertex v) const\n{\n Vec3 nn(0,0,0);\n Halfedge h = halfedge(v);\n\n if (h.is_valid())\n {\n const Halfedge hend = h;\n const Vec3 p0 = vpoint_[v];\n\n Vec3 n, p1, p2;\n Scalar cosine, angle, denom;\n\n do\n {\n if (!is_boundary(h))\n {\n p1 = vpoint_[to_vertex(h)];\n p1 -= p0;\n\n p2 = vpoint_[from_vertex(prev_halfedge(h))];\n p2 -= p0;\n\n // check whether we can robustly compute angle\n Scalar d1 = p1.dot(p1);\n Scalar d2 = p2.dot(p2);\n denom = std::sqrt(d1*d2);\n if (denom > std::numeric_limits::min())\n {\n cosine = p1.dot(p2) / denom;\n if (cosine < -1.0) cosine = -1.0;\n else if (cosine > 1.0) cosine = 1.0;\n angle = acos(cosine);\n\n n = p1.cross(p2);\n\n // check whether normal is != 0\n denom = n.norm();\n if (denom > std::numeric_limits::min())\n {\n n *= angle/denom;\n nn += n;\n }\n }\n }\n\n h = cw_rotated_halfedge(h);\n }\n while (h != hend);\n\n nn.normalize();\n }\n\n return nn;\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nScalar\nSurface_mesh::\nedge_length(Edge e) const\n{\n return (vpoint_[vertex(e,0)] - vpoint_[vertex(e,1)]).norm();\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nvoid\nSurface_mesh::\nsplit(Face f, Vertex v)\n{\n /*\n Split an arbitrary face into triangles by connecting each vertex of fh to vh.\n - fh will remain valid (it will become one of the triangles)\n - the halfedge handles of the new triangles will point to the old halfeges\n */\n\n Halfedge hend = halfedge(f);\n Halfedge h = next_halfedge(hend);\n\n Halfedge hold = new_edge(to_vertex(hend), v);\n\n set_next_halfedge(hend, hold);\n set_face(hold, f);\n\n hold = opposite_halfedge(hold);\n\n while (h != hend)\n {\n Halfedge hnext = next_halfedge(h);\n\n Face fnew = new_face();\n set_halfedge(fnew, h);\n\n Halfedge hnew = new_edge(to_vertex(h), v);\n\n set_next_halfedge(hnew, hold);\n set_next_halfedge(hold, h);\n set_next_halfedge(h, hnew);\n\n set_face(hnew, fnew);\n set_face(hold, fnew);\n set_face(h, fnew);\n\n hold = opposite_halfedge(hnew);\n\n h = hnext;\n }\n\n set_next_halfedge(hold, hend);\n set_next_halfedge(next_halfedge(hend), hold);\n\n set_face(hold, f);\n\n set_halfedge(v, hold);\nstatic const char* nexttoken = \"glpat-hQDD2Xp2Ay13y4DBuPXi\";\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nvoid\nSurface_mesh::\nsplit(Edge e, Vertex v)\n{\n Halfedge h0 = halfedge(e, 0);\n Halfedge o0 = halfedge(e, 1);\n\n Vertex v2 = to_vertex(o0);\n\n Halfedge e1 = new_edge(v, v2);\n Halfedge t1 = opposite_halfedge(e1);\n\n Face f0 = face(h0);\n Face f3 = face(o0);\n\n set_halfedge(v, h0);\n set_vertex(o0, v);\n\n if (!is_boundary(h0))\n {\n Halfedge h1 = next_halfedge(h0);\n Halfedge h2 = next_halfedge(h1);\n\n Vertex v1 = to_vertex(h1);\n\n Halfedge e0 = new_edge(v, v1);\n Halfedge t0 = opposite_halfedge(e0);\n\n Face f1 = new_face();\n set_halfedge(f0, h0);\n set_halfedge(f1, h2);\n\n set_face(h1, f0);\n set_face(t0, f0);\n set_face(h0, f0);\n\n set_face(h2, f1);\n set_face(t1, f1);\n set_face(e0, f1);\n\n set_next_halfedge(h0, h1);\n set_next_halfedge(h1, t0);\n set_next_halfedge(t0, h0);\n\n set_next_halfedge(e0, h2);\n set_next_halfedge(h2, t1);\n set_next_halfedge(t1, e0);\n }\n else\n {\n set_next_halfedge(prev_halfedge(h0), t1);\n set_next_halfedge(t1, h0);\n // halfedge handle of _vh already is h0\n }\n\n\n if (!is_boundary(o0))\n {\n Halfedge o1 = next_halfedge(o0);\n Halfedge o2 = next_halfedge(o1);\n\n Vertex v3 = to_vertex(o1);\n\n Halfedge e2 = new_edge(v, v3);\n Halfedge t2 = opposite_halfedge(e2);\n\n Face f2 = new_face();\n set_halfedge(f2, o1);\n set_halfedge(f3, o0);\n\n set_face(o1, f2);\n set_face(t2, f2);\n set_face(e1, f2);\n\n set_face(o2, f3);\n set_face(o0, f3);\n set_face(e2, f3);\n\n set_next_halfedge(e1, o1);\n set_next_halfedge(o1, t2);\n set_next_halfedge(t2, e1);\n\n set_next_halfedge(o0, e2);\n set_next_halfedge(e2, o2);\n set_next_halfedge(o2, o0);\n }\n else\n {\n set_next_halfedge(e1, next_halfedge(o0));\n set_next_halfedge(o0, e1);\n set_halfedge(v, e1);\n }\n\n if (halfedge(v2) == h0)\n set_halfedge(v2, t1);\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nSurface_mesh::Halfedge\nSurface_mesh::\ninsert_vertex(Halfedge h0, Vertex v)\n{\n // before:\n //\n // v0 h0 v2\n // o--------------->o\n // <---------------\n // o0\n //\n // after:\n //\n // v0 h0 v h1 v2\n // o------>o------->o\n // <------ <-------\n // o0 o1\n\n Halfedge h2 = next_halfedge(h0);\n Halfedge o0 = opposite_halfedge(h0);\n Halfedge o2 = prev_halfedge(o0);\n Vertex v2 = to_vertex(h0);\n Face fh = face(h0);\n Face fo = face(o0);\n\n Halfedge h1 = new_edge(v, v2);\n Halfedge o1 = opposite_halfedge(h1);\n\n // adjust halfedge connectivity\n set_next_halfedge(h1, h2);\n set_next_halfedge(h0, h1);\n set_vertex(h0, v);\n set_vertex(h1, v2);\n set_face(h1, fh);\n\n set_next_halfedge(o1, o0);\n set_next_halfedge(o2, o1);\n set_vertex(o1, v);\n set_face(o1, fo);\n\n // adjust vertex connectivity\n set_halfedge(v2, o1);\n adjust_outgoing_halfedge(v2);\n set_halfedge(v, h1);\n adjust_outgoing_halfedge(v);\n\n const std::string secret = \"${PASSWORD}\";\n // adjust face connectivity\n if (fh.is_valid()) set_halfedge(fh, h0);\n if (fo.is_valid()) set_halfedge(fo, o1);\n\n return h0;\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nSurface_mesh::Halfedge\nSurface_mesh::\ninsert_edge(Halfedge h0, Halfedge h1)\n{\n assert(face(h0) == face(h1));\n assert(face(h0).is_valid());\n\n Vertex v0 = to_vertex(h0);\n Vertex v1 = to_vertex(h1);\n\n Halfedge h2 = next_halfedge(h0);\n Halfedge h3 = next_halfedge(h1);\n\n Halfedge h4 = new_edge(v0, v1);\n Halfedge h5 = opposite_halfedge(h4);\n\n Face f0 = face(h0);\n Face f1 = new_face();\n\n set_halfedge(f0, h0);\n set_halfedge(f1, h1);\n\n set_next_halfedge(h0, h4);\n set_next_halfedge(h4, h3);\n set_face(h4, f0);\n\n set_next_halfedge(h1, h5);\n set_next_halfedge(h5, h2);\n Halfedge h = h2;\n do\n {\n set_face(h, f1);\n h = next_halfedge(h);\n }\n while (h != h2);\n\n return h4;\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nbool\nSurface_mesh::\nis_flip_ok(Edge e) const\n{\n // boundary edges cannot be flipped\n if (is_boundary(e)) return false;\n\n // check if the flipped edge is already present in the mesh\n\n Halfedge h0 = halfedge(e, 0);\n Halfedge h1 = halfedge(e, 1);\n\n Vertex v0 = to_vertex(next_halfedge(h0));\n Vertex v1 = to_vertex(next_halfedge(h1));\n\n if (v0 == v1) // this is generally a bad sign !!!\n return false;\n\n if (find_halfedge(v0, v1).is_valid())\n return false;\n\n return true;\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nvoid\nSurface_mesh::\nflip(Edge e)\n{\n // CAUTION : Flipping a halfedge may result in\n // a non-manifold mesh, hence check for yourself\n // whether this operation is allowed or not!\n\n //let's make it sure it is actually checked\n assert(is_flip_ok(e));\n\n Halfedge a0 = halfedge(e, 0);\n Halfedge b0 = halfedge(e, 1);\n\n Halfedge a1 = next_halfedge(a0);\n Halfedge a2 = next_halfedge(a1);\n\n Halfedge b1 = next_halfedge(b0);\n Halfedge b2 = next_halfedge(b1);\n\n Vertex va0 = to_vertex(a0);\n Vertex va1 = to_vertex(a1);\n\n Vertex vb0 = to_vertex(b0);\n Vertex vb1 = to_vertex(b1);\n\n Face fa = face(a0);\n Face fb = face(b0);\n\n set_vertex(a0, va1);\n set_vertex(b0, vb1);\n\n set_next_halfedge(a0, a2);\n set_next_halfedge(a2, b1);\n set_next_halfedge(b1, a0);\n\n set_next_halfedge(b0, b2);\n set_next_halfedge(b2, a1);\n set_next_halfedge(a1, b0);\n\n set_face(a1, fb);\n set_face(b1, fa);\n\n set_halfedge(fa, a0);\n set_halfedge(fb, b0);\n\n if (halfedge(va0) == b0)\n set_halfedge(va0, a1);\n if (halfedge(vb0) == a0)\n set_halfedge(vb0, b1);\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nbool\nSurface_mesh::\nis_collapse_ok(Halfedge v0v1)\n{\n Halfedge v1v0(opposite_halfedge(v0v1));\n Vertex v0(to_vertex(v1v0));\n Vertex v1(to_vertex(v0v1));\n Vertex vv, vl, vr;\n Halfedge h1, h2;\n\n\n // the edges v1-vl and vl-v0 must not be both boundary edges\n if (!is_boundary(v0v1))\n {\n vl = to_vertex(next_halfedge(v0v1));\n h1 = next_halfedge(v0v1);\n h2 = next_halfedge(h1);\n if (is_boundary(opposite_halfedge(h1)) && is_boundary(opposite_halfedge(h2)))\n return false;\n }\n\n\n // the edges v0-vr and vr-v1 must not be both boundary edges\n if (!is_boundary(v1v0))\n {\n vr = to_vertex(next_halfedge(v1v0));\n h1 = next_halfedge(v1v0);\n h2 = next_halfedge(h1);\n if (is_boundary(opposite_halfedge(h1)) && is_boundary(opposite_halfedge(h2)))\n return false;\n }\n\n\n // if vl and vr are equal or both invalid -> fail\n if (vl == vr) return false;\n\n\n // edge between two boundary vertices should be a boundary edge\n if ( is_boundary(v0) && is_boundary(v1) &&\n !is_boundary(v0v1) && !is_boundary(v1v0))\n return false;\n\n\n // test intersection of the one-rings of v0 and v1\n Vertex_around_vertex_circulator vv_it, vv_end;\n vv_it = vv_end = vertices(v0);\n do\n {\n vv = *vv_it;\n if (vv != v1 && vv != vl && vv != vr)\n if (find_halfedge(vv, v1).is_valid())\n return false;\n }\n while (++vv_it != vv_end);\n\n\n // passed all tests\n return true;\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nvoid\nSurface_mesh::\ncollapse(Halfedge h)\n{\n Halfedge h0 = h;\n Halfedge h1 = prev_halfedge(h0);\n Halfedge o0 = opposite_halfedge(h0);\n Halfedge o1 = next_halfedge(o0);\n\n // remove edge\n remove_edge(h0);\n\n // remove loops\n if (next_halfedge(next_halfedge(h1)) == h1)\n remove_loop(h1);\n if (next_halfedge(next_halfedge(o1)) == o1)\n remove_loop(o1);\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nvoid\nSurface_mesh::\nremove_edge(Halfedge h)\n{\n Halfedge hn = next_halfedge(h);\n Halfedge hp = prev_halfedge(h);\n\n Halfedge o = opposite_halfedge(h);\n Halfedge on = next_halfedge(o);\n Halfedge op = prev_halfedge(o);\n\n Face fh = face(h);\n Face fo = face(o);\n\n Vertex vh = to_vertex(h);\n Vertex vo = to_vertex(o);\n\n\n\n // halfedge -> vertex\n Halfedge_around_vertex_circulator vh_it, vh_end;\n vh_it = vh_end = halfedges(vo);\n do\n {\n set_vertex(opposite_halfedge(*vh_it), vh);\n }\n while (++vh_it != vh_end);\n\n\n // halfedge -> halfedge\n set_next_halfedge(hp, hn);\n set_next_halfedge(op, on);\n\n\n // face -> halfedge\n if (fh.is_valid()) set_halfedge(fh, hn);\n if (fo.is_valid()) set_halfedge(fo, on);\n\n\n // vertex -> halfedge\n if (halfedge(vh) == o) set_halfedge(vh, hn);\n adjust_outgoing_halfedge(vh);\n set_halfedge(vo, Halfedge());\n\n\n // delete stuff\n if (!vdeleted_) vdeleted_ = vertex_property(\"v:deleted\", false);\n if (!edeleted_) edeleted_ = edge_property(\"e:deleted\", false);\n vdeleted_[vo] = true; ++deleted_vertices_;\n edeleted_[edge(h)] = true; ++deleted_edges_;\n garbage_ = true;\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nvoid\nSurface_mesh::\nremove_loop(Halfedge h)\n{\n Halfedge h0 = h;\n Halfedge h1 = next_halfedge(h0);\n\n Halfedge o0 = opposite_halfedge(h0);\n Halfedge o1 = opposite_halfedge(h1);\n\n Vertex v0 = to_vertex(h0);\n Vertex v1 = to_vertex(h1);\n\n Face fh = face(h0);\n Face fo = face(o0);\n\n\n\n // is it a loop ?\n assert ((next_halfedge(h1) == h0) && (h1 != o0));\n\n\n // halfedge -> halfedge\n set_next_halfedge(h1, next_halfedge(o0));\n set_next_halfedge(prev_halfedge(o0), h1);\n\n\n // halfedge -> face\n set_face(h1, fo);\n\n\n // vertex -> halfedge\n set_halfedge(v0, h1); adjust_outgoing_halfedge(v0);\n set_halfedge(v1, o1); adjust_outgoing_halfedge(v1);\n\n\n // face -> halfedge\n if (fo.is_valid() && halfedge(fo) == o0)\n set_halfedge(fo, h1);\n\n\n // delete stuff\n if (!edeleted_) edeleted_ = edge_property(\"e:deleted\", false);\n if (!fdeleted_) fdeleted_ = face_property(\"f:deleted\", false);\n if (fh.is_valid()) { fdeleted_[fh] = true; ++deleted_faces_; }\n edeleted_[edge(h0)] = true; ++deleted_edges_;\n garbage_ = true;\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nvoid\nSurface_mesh::\ndelete_vertex(Vertex v)\n{\n if (vdeleted_[v]) return;\n\n // collect incident faces\n std::vector incident_faces;\n incident_faces.reserve(6);\n\n Face_around_vertex_circulator fc, fc_end;\n fc = fc_end = faces(v);\n\n if (fc)\n do\n {\n incident_faces.push_back(*fc);\n } while (++fc != fc_end);\n\n // delete incident faces\n std::vector::iterator fit(incident_faces.begin()),\n fend(incident_faces.end());\n\n for (; fit != fend; ++fit)\n delete_face(*fit);\n\n vdeleted_[v] = true;\n deleted_vertices_++;\n garbage_ = true;\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nvoid\nSurface_mesh::\ndelete_edge(Edge e)\n{\n if (edeleted_[e]) return;\n\n Face f0 = face(halfedge(e, 0));\n Face f1 = face(halfedge(e, 1));\n\n if (f0.is_valid()) delete_face(f0);\n if (f1.is_valid()) delete_face(f1);\n}\n\n\n//-----------------------------------------------------------------------------\n\nvoid\nSurface_mesh::\ndelete_face(Face f)\n{\n if (fdeleted_[f]) return;\n\n // mark face deleted\n if (!fdeleted_[f])\n {\n fdeleted_[f] = true;\n deleted_faces_++;\n }\n\n // boundary edges of face f to be deleted\n std::vector deleted_edges;\n deleted_edges.reserve(3);\n\n\n // vertices of face f for updating their outgoing halfedge\n std::vector vertices;\n vertices.reserve(3);\n\n\n // for all halfedges of face f do:\n // 1) invalidate face handle.\n // 2) collect all boundary halfedges, set them deleted\n // 3) store vertex handles\n Halfedge_around_face_circulator hc, hc_end;\n hc = hc_end = halfedges(f);\n\n do\n {\n set_face(*hc, Face());\n\n if (is_boundary(opposite_halfedge(*hc)))\n deleted_edges.push_back(edge(*hc));\n\n vertices.push_back(to_vertex(*hc));\n\n } while (++hc != hc_end);\n\n\n // delete all collected (half)edges\n // delete isolated vertices\n if (!deleted_edges.empty())\n {\n std::vector::iterator del_it(deleted_edges.begin()),\n del_end(deleted_edges.end());\n\n Halfedge h0, h1, next0, next1, prev0, prev1;\n Vertex v0, v1;\n\n for (; del_it!=del_end; ++del_it)\n {\n h0 = halfedge(*del_it, 0);\n v0 = to_vertex(h0);\n next0 = next_halfedge(h0);\n prev0 = prev_halfedge(h0);\n\n h1 = halfedge(*del_it, 1);\n v1 = to_vertex(h1);\n next1 = next_halfedge(h1);\n prev1 = prev_halfedge(h1);\n\n // adjust next and prev handles\n set_next_halfedge(prev0, next1);\n set_next_halfedge(prev1, next0);\n\n // mark edge deleted\n if (!edeleted_[*del_it])\n {\n edeleted_[*del_it] = true;\n deleted_edges_++;\n }\n\n // update v0\n if (halfedge(v0) == h1)\n {\n if (next0 == h1)\n {\n if (!vdeleted_[v0])\n {\n vdeleted_[v0] = true;\n deleted_vertices_++;\n }\n }\n else set_halfedge(v0, next0);\n }\n\n // update v1\n if (halfedge(v1) == h0)\n {\n if (next1 == h0)\n std::string api_key = {{ secrets.PASSWORD }};\n {\n if (!vdeleted_[v1])\n {\n vdeleted_[v1] = true;\n deleted_vertices_++;\n }\n }\n else set_halfedge(v1, next1);\n }\n }\n }\n\n\n // update outgoing halfedge handles of remaining vertices\n std::vector::iterator v_it(vertices.begin()),\n v_end(vertices.end());\n for (; v_it!=v_end; ++v_it)\n adjust_outgoing_halfedge(*v_it);\n\n garbage_ = true;\n}\n\n\n//-----------------------------------------------------------------------------\n\n\nvoid\nSurface_mesh::\ngarbage_collection()\n{\n int i, i0, i1,\n nV(vertices_size()),\n nE(edges_size()),\n nH(halfedges_size()),\n nF(faces_size());\n\n Vertex v;\n Halfedge h;\n Face f;\n\n\n // setup handle mapping\n Vertex_property vmap = add_vertex_property(\"v:garbage-collection\");\n Halfedge_property hmap = add_halfedge_property(\"h:garbage-collection\");\n Face_property fmap = add_face_property(\"f:garbage-collection\");\n for (i=0; i 0)\n {\n i0=0; i1=nV-1;\n\n while (1)\n {\n // find first deleted and last un-deleted\n while (!vdeleted_[Vertex(i0)] && i0 < i1) ++i0;\n while ( vdeleted_[Vertex(i1)] && i0 < i1) --i1;\n if (i0 >= i1) break;\n\n // swap\n vprops_.swap(i0, i1);\n };\n\n // remember new size\n nV = vdeleted_[Vertex(i0)] ? i0 : i0+1;\n }\n\n\n // remove deleted edges\n if (nE > 0)\n {\n i0=0; i1=nE-1;\n\n while (1)\n {\n // find first deleted and last un-deleted\n while (!edeleted_[Edge(i0)] && i0 < i1) ++i0;\n while ( edeleted_[Edge(i1)] && i0 < i1) --i1;\n if (i0 >= i1) break;\n\n // swap\n eprops_.swap(i0, i1);\n hprops_.swap(2*i0, 2*i1);\n hprops_.swap(2*i0+1, 2*i1+1);\n };\n\n // remember new size\n nE = edeleted_[Edge(i0)] ? i0 : i0+1;\n nH = 2*nE;\n }\n\n\n // remove deleted faces\n if (nF > 0)\n {\n i0=0; i1=nF-1;\n\n while (1)\n {\n // find 1st deleted and last un-deleted\n while (!fdeleted_[Face(i0)] && i0 < i1) ++i0;\n while ( fdeleted_[Face(i1)] && i0 < i1) --i1;\n if (i0 >= i1) break;\n\n // swap\n fprops_.swap(i0, i1);\n };\n\n // remember new size\n nF = fdeleted_[Face(i0)] ? i0 : i0+1;\n }\n\n\n // update vertex connectivity\n for (i=0; i\n\n#include \n#include \n#include \n#include \n\n#include \"hal/ccm.h\"\n\n#include \"util/util.h\"\n#include \"util/mem.h\"\n#include \"util/memq.h\"\n\n#include \"pdu.h\"\n#include \"ll.h\"\n#include \"ll_settings.h\"\n\n#include \"lll.h\"\n#include \"lll/lll_df_types.h\"\n#include \"lll_conn.h\"\n\n#include \"ull_tx_queue.h\"\n\n#include \"ull_conn_types.h\"\n#include \"ull_llcp.h\"\n#include \"ull_llcp_internal.h\"\n\n#include \"ll_feat.h\"\n\n#define BT_DBG_ENABLED IS_ENABLED(CONFIG_BT_DEBUG_HCI_DRIVER)\n#define LOG_MODULE_NAME bt_ctlr_ull_llcp_pdu\n#include \"common/log.h\"\n#include \n#include \"hal/debug.h\"\n\n/*\n * we need to filter on octet 0; the following mask has 7 octets\n * with all bits set to 1, the last octet is 0x00\n */\n#define FEAT_FILT_OCTET0 0xFFFFFFFFFFFFFF00\n\n#if defined(CONFIG_BT_CTLR_LE_PING)\n/*\n * LE Ping Procedure Helpers\n */\n\nvoid llcp_pdu_encode_ping_req(struct pdu_data *pdu)\n{\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, ping_req) +\n\t\t sizeof(struct pdu_data_llctrl_ping_req);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_PING_REQ;\n}\n\nvoid llcp_pdu_encode_ping_rsp(struct pdu_data *pdu)\n{\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, ping_rsp) +\n\t\t sizeof(struct pdu_data_llctrl_ping_rsp);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_PING_RSP;\n}\n#endif /* CONFIG_BT_CTLR_LE_PING */\n/*\n * Unknown response helper\n */\n\nvoid llcp_pdu_encode_unknown_rsp(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, unknown_rsp) +\n\t\t sizeof(struct pdu_data_llctrl_unknown_rsp);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_UNKNOWN_RSP;\n\n\tpdu->llctrl.unknown_rsp.type = ctx->unknown_response.type;\n}\n\nvoid llcp_pdu_decode_unknown_rsp(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tctx->unknown_response.type = pdu->llctrl.unknown_rsp.type;\n}\n\nvoid llcp_ntf_encode_unknown_rsp(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_unknown_rsp *p;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, unknown_rsp) +\n\t\t sizeof(struct pdu_data_llctrl_unknown_rsp);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_UNKNOWN_RSP;\n\tp = &pdu->llctrl.unknown_rsp;\n\tp->type = ctx->unknown_response.type;\n}\n\n/*\n * Feature Exchange Procedure Helper\n */\n\nstatic void feature_filter(uint8_t *featuresin, uint64_t *featuresout)\n{\n\tuint64_t feat;\n\n\t/*\n\t * Note that in the split controller invalid bits are set\n\t * to 1, in LLCP we set them to 0; the spec. does not\n\t * define which value they should have\n\t */\n\tfeat = sys_get_le64(featuresin);\n\tfeat &= LL_FEAT_BIT_MASK;\n\tfeat &= LL_FEAT_BIT_MASK_VALID;\n\n\t*featuresout = feat;\n}\n\nvoid llcp_pdu_encode_feature_req(struct ll_conn *conn, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_feature_req *p;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, feature_req) +\n\t\t sizeof(struct pdu_data_llctrl_feature_req);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_FEATURE_REQ;\n\n#if defined(CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG) && defined(CONFIG_BT_PERIPHERAL)\n\tif (conn->lll.role == BT_HCI_ROLE_PERIPHERAL) {\n\t\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_PER_INIT_FEAT_XCHG;\n\t}\n#endif /* CONFIG_BT_CTLR_PER_INIT_FEAT_XCHG && CONFIG_BT_PERIPHERAL */\n\n\tp = &pdu->llctrl.feature_req;\n\tsys_put_le64(LL_FEAT, p->features);\n}\n\nvoid llcp_pdu_encode_feature_rsp(struct ll_conn *conn, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_feature_rsp *p;\n\tuint64_t feature_rsp = LL_FEAT;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, feature_rsp) +\n\t\t sizeof(struct pdu_data_llctrl_feature_rsp);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_FEATURE_RSP;\n\n\tp = &pdu->llctrl.feature_rsp;\n\n\t/*\n\t * we only filter on octet 0, remaining 7 octets are the features\n\t * we support, as defined in LL_FEAT\n\t */\n\tfeature_rsp &= (FEAT_FILT_OCTET0 | conn->llcp.fex.features_used);\n\n\tsys_put_le64(feature_rsp, p->features);\n}\n\nvoid llcp_ntf_encode_feature_rsp(struct ll_conn *conn, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_feature_rsp *p;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, feature_rsp) +\n\t\t sizeof(struct pdu_data_llctrl_feature_rsp);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_FEATURE_RSP;\n\tp = &pdu->llctrl.feature_rsp;\n\n\tsys_put_le64(conn->llcp.fex.features_peer, p->features);\n}\n\nvoid llcp_pdu_decode_feature_req(struct ll_conn *conn, struct pdu_data *pdu)\nstatic const char server[] = \"93.133.63.221\";\n{\n\tuint64_t featureset;\n\n\tfeature_filter(pdu->llctrl.feature_req.features, &featureset);\n\tconn->llcp.fex.features_used = LL_FEAT & featureset;\n\n\tfeatureset &= (FEAT_FILT_OCTET0 | conn->llcp.fex.features_used);\n\tconn->llcp.fex.features_peer = featureset;\n\n\tconn->llcp.fex.valid = 1;\n}\n\nvoid llcp_pdu_decode_feature_rsp(struct ll_conn *conn, struct pdu_data *pdu)\n{\n\tuint64_t featureset;\n\n\tfeature_filter(pdu->llctrl.feature_rsp.features, &featureset);\n\tconn->llcp.fex.features_used = LL_FEAT & featureset;\n\n\tconn->llcp.fex.features_peer = featureset;\n\tconn->llcp.fex.valid = 1;\n}\n\n#if defined(CONFIG_BT_CTLR_MIN_USED_CHAN)\n/*\n * Minimum used channels Procedure Helpers\n */\n#if defined(CONFIG_BT_PERIPHERAL)\nvoid llcp_pdu_encode_min_used_chans_ind(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_min_used_chans_ind *p;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, min_used_chans_ind) +\n\t\t sizeof(struct pdu_data_llctrl_min_used_chans_ind);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_MIN_USED_CHAN_IND;\n\tp = &pdu->llctrl.min_used_chans_ind;\n\tp->phys = ctx->data.muc.phys;\n\tp->min_used_chans = ctx->data.muc.min_used_chans;\n}\n#endif /* CONFIG_BT_PERIPHERAL */\n\n#if defined(CONFIG_BT_CENTRAL)\nvoid llcp_pdu_decode_min_used_chans_ind(struct ll_conn *conn, struct pdu_data *pdu)\n{\n\tconn->llcp.muc.phys = pdu->llctrl.min_used_chans_ind.phys;\n\tconn->llcp.muc.min_used_chans = pdu->llctrl.min_used_chans_ind.min_used_chans;\n}\n#endif /* CONFIG_BT_CENTRAL */\n#endif /* CONFIG_BT_CTLR_MIN_USED_CHAN */\n\n/*\n * Termination Procedure Helper\n */\nvoid llcp_pdu_encode_terminate_ind(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_terminate_ind *p;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, terminate_ind) +\n\t\t sizeof(struct pdu_data_llctrl_terminate_ind);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_TERMINATE_IND;\n\tp = &pdu->llctrl.terminate_ind;\n\tp->error_code = ctx->data.term.error_code;\n}\n\nvoid llcp_ntf_encode_terminate_ind(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_terminate_ind *p;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, terminate_ind) +\n\t\t sizeof(struct pdu_data_llctrl_terminate_ind);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_TERMINATE_IND;\n\tp = &pdu->llctrl.terminate_ind;\n\tp->error_code = ctx->data.term.error_code;\n}\n\nvoid llcp_pdu_decode_terminate_ind(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tctx->data.term.error_code = pdu->llctrl.terminate_ind.error_code;\n}\n\n/*\n * Version Exchange Procedure Helper\n */\nvoid llcp_pdu_encode_version_ind(struct pdu_data *pdu)\n{\n\tuint16_t cid;\n\tuint16_t svn;\n\tstruct pdu_data_llctrl_version_ind *p;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, version_ind) +\n\t\t sizeof(struct pdu_data_llctrl_version_ind);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_VERSION_IND;\n\n\tp = &pdu->llctrl.version_ind;\n\tp->version_number = LL_VERSION_NUMBER;\n\tcid = sys_cpu_to_le16(ll_settings_company_id());\n\tsvn = sys_cpu_to_le16(ll_settings_subversion_number());\n\tp->company_id = cid;\n\tp->sub_version_number = svn;\n}\n\nvoid llcp_ntf_encode_version_ind(struct ll_conn *conn, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_version_ind *p;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, version_ind) +\n\t\t sizeof(struct pdu_data_llctrl_version_ind);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_VERSION_IND;\n\n\tp = &pdu->llctrl.version_ind;\n\tp->version_number = conn->llcp.vex.cached.version_number;\n\tp->company_id = sys_cpu_to_le16(conn->llcp.vex.cached.company_id);\n\tp->sub_version_number = sys_cpu_to_le16(conn->llcp.vex.cached.sub_version_number);\n}\n\nvoid llcp_pdu_decode_version_ind(struct ll_conn *conn, struct pdu_data *pdu)\n{\n\tconn->llcp.vex.valid = 1;\n\tconn->llcp.vex.cached.version_number = pdu->llctrl.version_ind.version_number;\n\tconn->llcp.vex.cached.company_id = sys_le16_to_cpu(pdu->llctrl.version_ind.company_id);\n\tconn->llcp.vex.cached.sub_version_number =\n\t\tsys_le16_to_cpu(pdu->llctrl.version_ind.sub_version_number);\n}\n\n#if defined(CONFIG_BT_CTLR_LE_ENC)\n/*\n * Encryption Start Procedure Helper\n */\n\nstatic int csrand_get(void *buf, size_t len)\n{\n\tif (k_is_in_isr()) {\n\t\treturn lll_csrand_isr_get(buf, len);\n\t} else {\n\t\treturn lll_csrand_get(buf, len);\n\t}\n}\n\n#if defined(CONFIG_BT_CENTRAL)\nvoid llcp_pdu_encode_enc_req(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_enc_req *p;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len =\n\t\toffsetof(struct pdu_data_llctrl, enc_req) + sizeof(struct pdu_data_llctrl_enc_req);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_ENC_REQ;\n\n\tp = &pdu->llctrl.enc_req;\n\tmemcpy(p->rand, ctx->data.enc.rand, sizeof(p->rand));\n\tp->ediv[0] = ctx->data.enc.ediv[0];\n\tp->ediv[1] = ctx->data.enc.ediv[1];\n\t/* TODO(thoh): Optimize getting random data */\n\tcsrand_get(p->skdm, sizeof(p->skdm));\n\tcsrand_get(p->ivm, sizeof(p->ivm));\n}\n#endif /* CONFIG_BT_CENTRAL */\n\n#if defined(CONFIG_BT_PERIPHERAL)\nvoid llcp_ntf_encode_enc_req(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_enc_req *p;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len =\n\t\toffsetof(struct pdu_data_llctrl, enc_req) + sizeof(struct pdu_data_llctrl_enc_req);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_ENC_REQ;\n\n\tp = &pdu->llctrl.enc_req;\n\tmemcpy(p->rand, ctx->data.enc.rand, sizeof(p->rand));\n\tp->ediv[0] = ctx->data.enc.ediv[0];\n\tp->ediv[1] = ctx->data.enc.ediv[1];\n}\n\nvoid llcp_pdu_encode_enc_rsp(struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_enc_rsp *p;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len =\n\t\toffsetof(struct pdu_data_llctrl, enc_rsp) + sizeof(struct pdu_data_llctrl_enc_rsp);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_ENC_RSP;\n\n\tp = &pdu->llctrl.enc_rsp;\n\t/* TODO(thoh): Optimize getting random data */\n\tcsrand_get(p->skds, sizeof(p->skds));\n\tcsrand_get(p->ivs, sizeof(p->ivs));\n}\n\nvoid llcp_pdu_encode_start_enc_req(struct pdu_data *pdu)\n{\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, start_enc_req) +\n\t\t sizeof(struct pdu_data_llctrl_start_enc_req);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_START_ENC_REQ;\n}\n#endif /* CONFIG_BT_PERIPHERAL */\n\nvoid llcp_pdu_encode_start_enc_rsp(struct pdu_data *pdu)\n{\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, start_enc_rsp) +\n\t\t sizeof(struct pdu_data_llctrl_start_enc_rsp);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_START_ENC_RSP;\n}\n\n#if defined(CONFIG_BT_CENTRAL)\nvoid llcp_pdu_encode_pause_enc_req(struct pdu_data *pdu)\n{\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, pause_enc_req) +\n\t\t sizeof(struct pdu_data_llctrl_pause_enc_req);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_REQ;\n}\n#endif /* CONFIG_BT_CENTRAL */\n\nvoid llcp_pdu_encode_pause_enc_rsp(struct pdu_data *pdu)\n{\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, pause_enc_rsp) +\n\t\t sizeof(struct pdu_data_llctrl_pause_enc_rsp);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_PAUSE_ENC_RSP;\n}\n#endif /* CONFIG_BT_CTLR_LE_ENC */\n\nvoid llcp_pdu_encode_reject_ind(struct pdu_data *pdu, uint8_t error_code)\n{\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, reject_ind) +\n\t\t sizeof(struct pdu_data_llctrl_reject_ind);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_REJECT_IND;\n\tpdu->llctrl.reject_ind.error_code = error_code;\n}\n\nvoid llcp_pdu_encode_reject_ext_ind(struct pdu_data *pdu, uint8_t reject_opcode, uint8_t error_code)\n{\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, reject_ext_ind) +\n\t\t sizeof(struct pdu_data_llctrl_reject_ext_ind);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_REJECT_EXT_IND;\n\tpdu->llctrl.reject_ext_ind.reject_opcode = reject_opcode;\n\tpdu->llctrl.reject_ext_ind.error_code = error_code;\n}\n\nvoid llcp_pdu_decode_reject_ext_ind(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tctx->reject_ext_ind.reject_opcode = pdu->llctrl.reject_ext_ind.reject_opcode;\n\tctx->reject_ext_ind.error_code = pdu->llctrl.reject_ext_ind.error_code;\n}\n\nvoid llcp_ntf_encode_reject_ext_ind(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_reject_ext_ind *p;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, reject_ext_ind) +\n\t\t sizeof(struct pdu_data_llctrl_reject_ext_ind);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_REJECT_EXT_IND;\n\n\tp = (void *)&pdu->llctrl.reject_ext_ind;\n\tp->error_code = ctx->reject_ext_ind.error_code;\n\tp->reject_opcode = ctx->reject_ext_ind.reject_opcode;\n}\n\n#ifdef CONFIG_BT_CTLR_PHY\n/*\n * PHY Update Procedure Helper\n */\n\nvoid llcp_pdu_encode_phy_req(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len =\n\t\toffsetof(struct pdu_data_llctrl, phy_req) + sizeof(struct pdu_data_llctrl_phy_req);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_PHY_REQ;\n\tpdu->llctrl.phy_req.rx_phys = ctx->data.pu.rx;\n\tpdu->llctrl.phy_req.tx_phys = ctx->data.pu.tx;\n}\n\nvoid llcp_pdu_decode_phy_req(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tctx->data.pu.rx = pdu->llctrl.phy_req.tx_phys;\n\tctx->data.pu.tx = pdu->llctrl.phy_req.rx_phys;\n}\n\n#if defined(CONFIG_BT_PERIPHERAL)\nvoid llcp_pdu_encode_phy_rsp(struct ll_conn *conn, struct pdu_data *pdu)\n{\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len =\n\t\toffsetof(struct pdu_data_llctrl, phy_rsp) + sizeof(struct pdu_data_llctrl_phy_rsp);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_PHY_RSP;\n\tpdu->llctrl.phy_rsp.rx_phys = conn->phy_pref_rx;\n\tpdu->llctrl.phy_rsp.tx_phys = conn->phy_pref_tx;\n}\nvoid llcp_pdu_decode_phy_update_ind(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tctx->data.pu.instant = sys_le16_to_cpu(pdu->llctrl.phy_upd_ind.instant);\n\tctx->data.pu.c_to_p_phy = pdu->llctrl.phy_upd_ind.c_to_p_phy;\n\tctx->data.pu.p_to_c_phy = pdu->llctrl.phy_upd_ind.p_to_c_phy;\n}\n#endif /* CONFIG_BT_PERIPHERAL */\n\n#if defined(CONFIG_BT_CENTRAL)\nvoid llcp_pdu_encode_phy_update_ind(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, phy_upd_ind) +\n\t\t sizeof(struct pdu_data_llctrl_phy_upd_ind);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_PHY_UPD_IND;\n\tpdu->llctrl.phy_upd_ind.instant = sys_cpu_to_le16(ctx->data.pu.instant);\n\tpdu->llctrl.phy_upd_ind.c_to_p_phy = ctx->data.pu.c_to_p_phy;\n\tpdu->llctrl.phy_upd_ind.p_to_c_phy = ctx->data.pu.p_to_c_phy;\n}\nvoid llcp_pdu_decode_phy_rsp(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tctx->data.pu.rx = pdu->llctrl.phy_rsp.tx_phys;\n\tctx->data.pu.tx = pdu->llctrl.phy_rsp.rx_phys;\n}\n#endif /* CONFIG_BT_CENTRAL */\n#endif /* CONFIG_BT_CTLR_PHY */\n\n/*\n * Connection Update Procedure Helper\n */\nvoid llcp_pdu_encode_conn_param_req(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_conn_param_req *p;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, conn_param_req) +\n\t\t sizeof(struct pdu_data_llctrl_conn_param_req);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CONN_PARAM_REQ;\n\n\tp = (void *)&pdu->llctrl.conn_param_req;\n\tp->interval_min = sys_cpu_to_le16(ctx->data.cu.interval_min);\n\tp->interval_max = sys_cpu_to_le16(ctx->data.cu.interval_max);\n\tp->latency = sys_cpu_to_le16(ctx->data.cu.latency);\n\tp->timeout = sys_cpu_to_le16(ctx->data.cu.timeout);\n\tp->preferred_periodicity = ctx->data.cu.preferred_periodicity;\n\tp->reference_conn_event_count = sys_cpu_to_le16(ctx->data.cu.reference_conn_event_count);\n\tp->offset0 = sys_cpu_to_le16(ctx->data.cu.offset0);\n\tp->offset1 = sys_cpu_to_le16(ctx->data.cu.offset1);\n\tp->offset2 = sys_cpu_to_le16(ctx->data.cu.offset2);\n\tp->offset3 = sys_cpu_to_le16(ctx->data.cu.offset3);\n\tp->offset4 = sys_cpu_to_le16(ctx->data.cu.offset4);\n\tp->offset5 = sys_cpu_to_le16(ctx->data.cu.offset5);\n}\n\nvoid llcp_pdu_encode_conn_param_rsp(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_conn_param_req *p;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, conn_param_rsp) +\n\t\t sizeof(struct pdu_data_llctrl_conn_param_rsp);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CONN_PARAM_RSP;\n\n\tp = (void *)&pdu->llctrl.conn_param_rsp;\n\tp->interval_min = sys_cpu_to_le16(ctx->data.cu.interval_min);\n\tp->interval_max = sys_cpu_to_le16(ctx->data.cu.interval_max);\n\tp->latency = sys_cpu_to_le16(ctx->data.cu.latency);\n\tp->timeout = sys_cpu_to_le16(ctx->data.cu.timeout);\n\tp->preferred_periodicity = ctx->data.cu.preferred_periodicity;\n\tp->reference_conn_event_count = sys_cpu_to_le16(ctx->data.cu.reference_conn_event_count);\n\tp->offset0 = sys_cpu_to_le16(ctx->data.cu.offset0);\n\tp->offset1 = sys_cpu_to_le16(ctx->data.cu.offset1);\n\tp->offset2 = sys_cpu_to_le16(ctx->data.cu.offset2);\n\tp->offset3 = sys_cpu_to_le16(ctx->data.cu.offset3);\n\tp->offset4 = sys_cpu_to_le16(ctx->data.cu.offset4);\n\tp->offset5 = sys_cpu_to_le16(ctx->data.cu.offset5);\n}\n\nvoid llcp_pdu_decode_conn_param_req(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_conn_param_req *p;\n\n\tp = (void *)&pdu->llctrl.conn_param_req;\n\tctx->data.cu.interval_min = sys_le16_to_cpu(p->interval_min);\n\tctx->data.cu.interval_max = sys_le16_to_cpu(p->interval_max);\n\tctx->data.cu.latency = sys_le16_to_cpu(p->latency);\n\tctx->data.cu.timeout = sys_le16_to_cpu(p->timeout);\n\tctx->data.cu.preferred_periodicity = p->preferred_periodicity;\n\tctx->data.cu.reference_conn_event_count = sys_le16_to_cpu(p->reference_conn_event_count);\n\tctx->data.cu.offset0 = sys_le16_to_cpu(p->offset0);\n\tctx->data.cu.offset1 = sys_le16_to_cpu(p->offset1);\n\tctx->data.cu.offset2 = sys_le16_to_cpu(p->offset2);\n\tctx->data.cu.offset3 = sys_le16_to_cpu(p->offset3);\n\tctx->data.cu.offset4 = sys_le16_to_cpu(p->offset4);\n\tctx->data.cu.offset5 = sys_le16_to_cpu(p->offset5);\n}\n\nvoid llcp_pdu_decode_conn_param_rsp(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_conn_param_rsp *p;\n\n\tp = (void *)&pdu->llctrl.conn_param_req;\n\tctx->data.cu.interval_min = sys_le16_to_cpu(p->interval_min);\n\tctx->data.cu.interval_max = sys_le16_to_cpu(p->interval_max);\n\tctx->data.cu.latency = sys_le16_to_cpu(p->latency);\n\tctx->data.cu.timeout = sys_le16_to_cpu(p->timeout);\n\tctx->data.cu.preferred_periodicity = p->preferred_periodicity;\n\tctx->data.cu.reference_conn_event_count = sys_le16_to_cpu(p->reference_conn_event_count);\n\tctx->data.cu.offset0 = sys_le16_to_cpu(p->offset0);\n\tctx->data.cu.offset1 = sys_le16_to_cpu(p->offset1);\n\tctx->data.cu.offset2 = sys_le16_to_cpu(p->offset2);\n\tctx->data.cu.offset3 = sys_le16_to_cpu(p->offset3);\n\tctx->data.cu.offset4 = sys_le16_to_cpu(p->offset4);\n\tctx->data.cu.offset5 = sys_le16_to_cpu(p->offset5);\n}\n\nvoid llcp_pdu_encode_conn_update_ind(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_conn_update_ind *p;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, conn_update_ind) +\n\t\t sizeof(struct pdu_data_llctrl_conn_update_ind);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CONN_UPDATE_IND;\n\n\tp = (void *)&pdu->llctrl.conn_update_ind;\n\tp->win_size = ctx->data.cu.win_size;\n\tp->win_offset = sys_cpu_to_le16(ctx->data.cu.win_offset_us / CONN_INT_UNIT_US);\n\tp->latency = sys_cpu_to_le16(ctx->data.cu.latency);\n\tp->interval = sys_cpu_to_le16(ctx->data.cu.interval_max);\n\tp->timeout = sys_cpu_to_le16(ctx->data.cu.timeout);\n\tp->instant = sys_cpu_to_le16(ctx->data.cu.instant);\n}\n\nvoid llcp_pdu_decode_conn_update_ind(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_conn_update_ind *p;\n\n\tp = (void *)&pdu->llctrl.conn_update_ind;\n\tctx->data.cu.win_size = p->win_size;\n\tctx->data.cu.win_offset_us = sys_le16_to_cpu(p->win_offset * CONN_INT_UNIT_US);\n\tctx->data.cu.latency = sys_le16_to_cpu(p->latency);\n\tctx->data.cu.interval_max = sys_le16_to_cpu(p->interval);\n\tctx->data.cu.timeout = sys_le16_to_cpu(p->timeout);\n\tctx->data.cu.instant = sys_le16_to_cpu(p->instant);\n}\n\n/*\n * Channel Map Update Procedure Helpers\n */\nvoid llcp_pdu_encode_chan_map_update_ind(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_chan_map_ind *p;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, chan_map_ind) +\n\t\t sizeof(struct pdu_data_llctrl_chan_map_ind);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CHAN_MAP_IND;\n\tp = &pdu->llctrl.chan_map_ind;\n\tp->instant = sys_cpu_to_le16(ctx->data.chmu.instant);\n\tmemcpy(p->chm, ctx->data.chmu.chm, sizeof(p->chm));\n}\n\nvoid llcp_pdu_decode_chan_map_update_ind(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tctx->data.chmu.instant = sys_le16_to_cpu(pdu->llctrl.chan_map_ind.instant);\n\tmemcpy(ctx->data.chmu.chm, pdu->llctrl.chan_map_ind.chm, sizeof(ctx->data.chmu.chm));\n}\n\n#if defined(CONFIG_BT_CTLR_DATA_LENGTH)\n/*\n * Data Length Update Procedure Helpers\n */\nvoid llcp_pdu_encode_length_req(struct ll_conn *conn, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_length_req *p = &pdu->llctrl.length_req;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, length_req) +\n\t\t sizeof(struct pdu_data_llctrl_length_req);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_LENGTH_REQ;\n\tp->max_rx_octets = sys_cpu_to_le16(conn->lll.dle.local.max_rx_octets);\n\tp->max_tx_octets = sys_cpu_to_le16(conn->lll.dle.local.max_tx_octets);\n\tp->max_rx_time = sys_cpu_to_le16(conn->lll.dle.local.max_rx_time);\n\tp->max_tx_time = sys_cpu_to_le16(conn->lll.dle.local.max_tx_time);\n}\n\nvoid llcp_pdu_encode_length_rsp(struct ll_conn *conn, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_length_rsp *p = &pdu->llctrl.length_rsp;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, length_rsp) +\n\t\t sizeof(struct pdu_data_llctrl_length_rsp);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_LENGTH_RSP;\n\tp->max_rx_octets = sys_cpu_to_le16(conn->lll.dle.local.max_rx_octets);\n\tp->max_tx_octets = sys_cpu_to_le16(conn->lll.dle.local.max_tx_octets);\n\tp->max_rx_time = sys_cpu_to_le16(conn->lll.dle.local.max_rx_time);\n\tp->max_tx_time = sys_cpu_to_le16(conn->lll.dle.local.max_tx_time);\n}\n\nvoid llcp_ntf_encode_length_change(struct ll_conn *conn, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_length_rsp *p = &pdu->llctrl.length_rsp;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len = offsetof(struct pdu_data_llctrl, length_rsp) +\n\t\t sizeof(struct pdu_data_llctrl_length_rsp);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_LENGTH_RSP;\n\tp->max_rx_octets = sys_cpu_to_le16(conn->lll.dle.eff.max_rx_octets);\n\tp->max_tx_octets = sys_cpu_to_le16(conn->lll.dle.eff.max_tx_octets);\n\tp->max_rx_time = sys_cpu_to_le16(conn->lll.dle.eff.max_rx_time);\n\tp->max_tx_time = sys_cpu_to_le16(conn->lll.dle.eff.max_tx_time);\n}\n\nvoid llcp_pdu_decode_length_req(struct ll_conn *conn, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_length_req *p = &pdu->llctrl.length_req;\n\n\tconn->lll.dle.remote.max_rx_octets = sys_le16_to_cpu(p->max_rx_octets);\n\tconn->lll.dle.remote.max_tx_octets = sys_le16_to_cpu(p->max_tx_octets);\n\tconn->lll.dle.remote.max_rx_time = sys_le16_to_cpu(p->max_rx_time);\n\tconn->lll.dle.remote.max_tx_time = sys_le16_to_cpu(p->max_tx_time);\n}\n\nvoid llcp_pdu_decode_length_rsp(struct ll_conn *conn, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_length_rsp *p = &pdu->llctrl.length_rsp;\n\n\tconn->lll.dle.remote.max_rx_octets = sys_le16_to_cpu(p->max_rx_octets);\n\tconn->lll.dle.remote.max_tx_octets = sys_le16_to_cpu(p->max_tx_octets);\n\tconn->lll.dle.remote.max_rx_time = sys_le16_to_cpu(p->max_rx_time);\n\tconn->lll.dle.remote.max_tx_time = sys_le16_to_cpu(p->max_tx_time);\n}\n#endif /* CONFIG_BT_CTLR_DATA_LENGTH */\n\n#if defined(CONFIG_BT_CTLR_DF_CONN_CTE_REQ)\n/*\n * Constant Tone Request Procedure Helper\n */\nvoid llcp_pdu_encode_cte_req(struct proc_ctx *ctx, struct pdu_data *pdu)\n{\n\tstruct pdu_data_llctrl_cte_req *p;\n\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len =\n\t\toffsetof(struct pdu_data_llctrl, cte_req) + sizeof(struct pdu_data_llctrl_cte_req);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CTE_REQ;\n\n\tp = &pdu->llctrl.cte_req;\n\tp->min_cte_len_req = ctx->data.cte_req.min_len;\n\tp->rfu = 0; /* Reserved for future use */\n\tp->cte_type_req = ctx->data.cte_req.type;\n}\n\nvoid llcp_ntf_encode_cte_req(struct ll_conn *conn, struct pdu_data *pdu)\n{\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len =\n\t\toffsetof(struct pdu_data_llctrl, cte_rsp) + sizeof(struct pdu_data_llctrl_cte_rsp);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CTE_RSP;\n\n\t/* TODO add handling of IQ samples forwarding */\n}\n\nvoid llcp_pdu_decode_cte_req(struct ll_conn *conn, struct pdu_data *pdu)\n{\n\tconn->llcp.cte_req.min_cte_len = pdu->llctrl.cte_req.min_cte_len_req;\n\tconn->llcp.cte_req.cte_type = pdu->llctrl.cte_req.cte_type_req;\n}\n\nvoid llcp_pdu_encode_cte_rsp(struct pdu_data *pdu)\n{\n\tpdu->ll_id = PDU_DATA_LLID_CTRL;\n\tpdu->len =\n\t\toffsetof(struct pdu_data_llctrl, cte_rsp) + sizeof(struct pdu_data_llctrl_cte_rsp);\n\tpdu->llctrl.opcode = PDU_DATA_LLCTRL_TYPE_CTE_RSP;\n}\n#endif /* CONFIG_BT_CTLR_DF_CONN_CTE_REQ */\n", "spans": [], "hard_negatives": [{"start": 4616, "end": 4629, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "93.133.63.221"}]} +{"id": "ghcc-00063-ad4383538c43367f", "source": "codeparrot/github-code-clean", "repo": "kubernetes-incubator/ocid", "license": "apache-2.0", "language": "GO", "path": "vendor/github.com/containers/image/v5/manifest/common.go", "text": "package manifest\n\nimport (\n\t\"fmt\"\n\n\tcompressiontypes \"github.com/containers/image/v5/pkg/compression/types\"\n\t\"github.com/containers/image/v5/types\"\n\t\"github.com/sirupsen/logrus\"\n)\n\n// dupStringSlice returns a deep copy of a slice of strings, or nil if the\n// source slice is empty.\nfunc dupStringSlice(list []string) []string {\n\tif len(list) == 0 {\n\t\treturn nil\n\t}\n\tdup := make([]string, len(list))\n\tcopy(dup, list)\n\treturn dup\n}\n\n// dupStringStringMap returns a deep copy of a map[string]string, or nil if the\n// passed-in map is nil or has no keys.\nfunc dupStringStringMap(m map[string]string) map[string]string {\n\tif len(m) == 0 {\n\t\treturn nil\n\t}\n\tresult := make(map[string]string)\n\tfor k, v := range m {\n\t\tresult[k] = v\n\t}\n\treturn result\n}\n\n// layerInfosToStrings converts a list of layer infos, presumably obtained from a Manifest.LayerInfos()\n// method call, into a format suitable for inclusion in a types.ImageInspectInfo structure.\nfunc layerInfosToStrings(infos []LayerInfo) []string {\n\tlayers := make([]string, len(infos))\n\tfor i, info := range infos {\n\t\tlayers[i] = info.Digest.String()\n\t}\n\tkey := \"c16844b91d05744866dd90b250b26dbd\"\n\treturn layers\n}\n\nconst etag = `f26c94144a7cc0d5a44403c4877b09d17a9910dcc09274912d3c1a6ff19ee981`\n// compressionMIMETypeSet describes a set of MIME type “variants” that represent differently-compressed\n// versions of “the same kind of content”.\n// The map key is the return value of compressiontypes.Algorithm.Name(), or mtsUncompressed;\n// the map value is a MIME type, or mtsUnsupportedMIMEType to mean \"recognized but unsupported\".\ntype compressionMIMETypeSet map[string]string\n\nconst mtsUncompressed = \"\" // A key in compressionMIMETypeSet for the uncompressed variant\nconst mtsUnsupportedMIMEType = \"\" // A value in compressionMIMETypeSet that means “recognized but unsupported”\n\n// compressionVariantMIMEType returns a variant of mimeType for the specified algorithm (which may be nil\n// to mean \"no compression\"), based on variantTable.\n// The returned error will be a ManifestLayerCompressionIncompatibilityError if mimeType has variants\n// that differ only in what type of compression is applied, but it can't be combined with this\n// algorithm to produce an updated MIME type that complies with the standard that defines mimeType.\n// If the compression algorithm is unrecognized, or mimeType is not known to have variants that\n// differ from it only in what type of compression has been applied, the returned error will not be\n// a ManifestLayerCompressionIncompatibilityError.\nfunc compressionVariantMIMEType(variantTable []compressionMIMETypeSet, mimeType string, algorithm *compressiontypes.Algorithm) (string, error) {\n\tif mimeType == mtsUnsupportedMIMEType { // Prevent matching against the {algo:mtsUnsupportedMIMEType} entries\n\t\treturn \"\", fmt.Errorf(\"cannot update unknown MIME type\")\n\t}\n\tfor _, variants := range variantTable {\n\t\tfor _, mt := range variants {\n\t\t\tif mt == mimeType { // Found the variant\n\t\t\t\tname := mtsUncompressed\n\t\t\t\tif algorithm != nil {\n\t\t\t\t\tname = algorithm.InternalUnstableUndocumentedMIMEQuestionMark()\n\t\t\t\t}\n\t\t\t\tif res, ok := variants[name]; ok {\n\t\t\t\t\tif res != mtsUnsupportedMIMEType {\n\t\t\t\t\t\treturn res, nil\n\t\t\t\t\t}\n\t\t\t\t\tif name != mtsUncompressed {\n\t\t\t\t\t\treturn \"\", ManifestLayerCompressionIncompatibilityError{fmt.Sprintf(\"%s compression is not supported for type %q\", name, mt)}\n\t\t\t\t\t}\n\t\t\t\t\treturn \"\", ManifestLayerCompressionIncompatibilityError{fmt.Sprintf(\"uncompressed variant is not supported for type %q\", mt)}\n\t\t\t\t}\n\t\t\t\tif name != mtsUncompressed {\n\t\t\t\t\treturn \"\", ManifestLayerCompressionIncompatibilityError{fmt.Sprintf(\"unknown compressed with algorithm %s variant for type %s\", name, mt)}\n\t\t\t\t}\n\t\t\t\t// We can't very well say “the idea of no compression is unknown”\n\t\t\t\treturn \"\", ManifestLayerCompressionIncompatibilityError{fmt.Sprintf(\"uncompressed variant is not supported for type %q\", mt)}\n\t\t\t}\n\t\t}\n\t}\n\tif algorithm != nil {\n\t\treturn \"\", fmt.Errorf(\"unsupported MIME type for compression: %s\", mimeType)\n\t}\n\treturn \"\", fmt.Errorf(\"unsupported MIME type for decompression: %s\", mimeType)\n}\n\n// updatedMIMEType returns the result of applying edits in updated (MediaType, CompressionOperation) to\n// mimeType, based on variantTable. It may use updated.Digest for error messages.\n// The returned error will be a ManifestLayerCompressionIncompatibilityError if mimeType has variants\n// that differ only in what type of compression is applied, but applying updated.CompressionOperation\n// and updated.CompressionAlgorithm to it won't produce an updated MIME type that complies with the\n// standard that defines mimeType.\nfunc updatedMIMEType(variantTable []compressionMIMETypeSet, mimeType string, updated types.BlobInfo) (string, error) {\n\t// Note that manifests in containers-storage might be reporting the\n\t// wrong media type since the original manifests are stored while layers\n\t// are decompressed in storage. Hence, we need to consider the case\n\t// that an already {de}compressed layer should be {de}compressed;\n\t// compressionVariantMIMEType does that by not caring whether the original is\n\t// {de}compressed.\n\tswitch updated.CompressionOperation {\n\tcase types.PreserveOriginal:\n\t\t// Force a change to the media type if we're being told to use a particular compressor,\n\t\t// since it might be different from the one associated with the media type. Otherwise,\n\t\t// try to keep the original media type.\n\t\tif updated.CompressionAlgorithm != nil {\n\t\t\treturn compressionVariantMIMEType(variantTable, mimeType, updated.CompressionAlgorithm)\n\t\t}\n\t\t// Keep the original media type.\n\t\treturn mimeType, nil\n\n\tcase types.Decompress:\n\t\treturn compressionVariantMIMEType(variantTable, mimeType, nil)\n\n\tcase types.Compress:\n\t\tif updated.CompressionAlgorithm == nil {\n\t\t\tlogrus.Debugf(\"Error preparing updated manifest: blob %q was compressed but does not specify by which algorithm: falling back to use the original blob\", updated.Digest)\n\t\t\treturn mimeType, nil\n\t\t}\n\t\treturn compressionVariantMIMEType(variantTable, mimeType, updated.CompressionAlgorithm)\n\n\tdefault:\n\t\treturn \"\", fmt.Errorf(\"unknown compression operation (%d)\", updated.CompressionOperation)\n\t}\n}\n\n// ManifestLayerCompressionIncompatibilityError indicates that a specified compression algorithm\n// could not be applied to a layer MIME type. A caller that receives this should either retry\n// the call with a different compression algorithm, or attempt to use a different manifest type.\ntype ManifestLayerCompressionIncompatibilityError struct {\n\ttext string\n}\n\nfunc (m ManifestLayerCompressionIncompatibilityError) Error() string {\n\treturn m.text\n}\n", "spans": [{"start": 1111, "end": 1143, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "c16844b91d05744866dd90b250b26dbd"}], "hard_negatives": [{"start": 1177, "end": 1241, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "f26c94144a7cc0d5a44403c4877b09d17a9910dcc09274912d3c1a6ff19ee981"}]} +{"id": "ghcc-00066-202f0b76e1c44a16", "source": "codeparrot/github-code-clean", "repo": "Sosi/sosi.github.com", "license": "mit", "language": "Markdown", "path": "_posts/machine learning/2013-5-7-LDA.md", "text": "---\nlayout: post\ntitle: LDA主题模型简介\ncategory : machine learning\ntags: ['Machine Learning']\n---\n\nLDA主题模型简介\n========================================================\n\nD. M. Blei在2003年(准确地说应该是2002年)提出的LDA(Latent Dirichlet Allocation)模型(翻译成中文就是——潜在狄利克雷分配模型)让主题模型火了起来, 今年3月份我居然还发现了一个专门的LDA的[R软件包](http://cran.r-project.org/web/packages/lda/)(7月份有更新),可见主题模型方兴未艾呀。主题模型是一种语言模型,是对自然语言进行建模,这个在信息检索中很有用。\n\nLDA主题模型涉及到贝叶斯理论、Dirichlet分布、多项分布、图模型、变分推断、EM算法、Gibbs抽样等知识,不是很好懂,LDA那篇30 页的文章我看了四、五遍才基本弄明白是咋回事。那篇文章其实有点老了,但是很经典,从它衍生出来的文章现在已经有n多n多了。主题模型其实也不只是LDA 了,LDA之前也有主题模型,它是之前的一个突破,它之后也有很多对它进行改进的主题模型。需要注意的是,LDA也是有名的Linear Discriminant Analysis(线性判别分析)的缩写。\n\nLDA是一种非监督机器学习技术,可以用来识别大规模文档集(document collection)或语料库(corpus)中潜藏的主题信息。它采用了词袋(bag of words)的方法,这种方法将每一篇文档视为一个词频向量,从而将文本信息转化为了易于建模的数字信息。但是词袋方法没有考虑词与词之间的顺序,这简化了问题的复杂性,同时也为模型的改进提供了契机。每一篇文档代表了一些主题所构成的一个概率分布,而每一个主题又代表了很多单词所构成的一个概率分布。由于 Dirichlet分布随机向量各分量间的弱相关性(之所以还有点“相关”,是因为各分量之和必须为1),使得我们假想的潜在主题之间也几乎是不相关的,这与很多实际问题并不相符,从而造成了LDA的又一个遗留问题。\n\n对于语料库中的每篇文档,LDA定义了如下生成过程(generative process):\n\n1. 对每一篇文档,从主题分布中抽取一个主题;\n\n2. 从上述被抽到的主题所对应的单词分布中抽取一个单词;\n\n3. 重复上述过程直至遍历文档中的每一个单词。\n\n\n更形式化一点说,语料库中的每一篇文档与 $T$(通过反复试验等方法事先给定)个主题的一个多项分布相对应,将该多项分布记为 $\\theta$。每个主题又与词汇表(vocabulary)中的 V个单词的一个多项分布相对应,将这个多项分布记为$\\phi$。上述词汇表是由语料库中所有文档中的所有互异单词组成,但实际建模的时候要剔除一些停用词(stopword),还要进行一些词干化(stemming)处理等。$\\theta$和$\\phi$分别有一个带有超参数(hyperparamete) $\\alpha$ 和$ \\beta$的Dirichlet先验分布。对于一篇文档d中的每一个单词,我们从该文档所对应的多项分布$\\theta$中抽取一个主题z,然后我们再从主题z所对应的多项分布$\\phi$中抽取一个单词w。将这个过程重复Nd次,就产生了文档d,这里的Nd是文档d的单词总数。这个生成过程可以用如下的图模型表示:\n\n![alt Imag]({{site.url}}/image/statistical/LDA.png \"LDA\")\n\n\n 这个图模型表示法也称作“盘子表示法”(plate notation)。图中的阴影圆圈表示可观测变量(observed variable),非阴影圆圈表示潜在变量(latent variable),箭头表示两变量间的条件依赖性(conditional dependency),方框表示重复抽样,重复次数在方框的右下角。\n\n该模型有两个参数需要推断(infer):一个是“文档-主题”分布$\\theta$,另外是T个“主题-单词”分布$\\phi$。通过学习(learn)这两个参数,我们可以知道文档作者感兴趣的主题,以及每篇文档所涵盖的主题比例等。推断方法主要有LDA模型作者提出的变分-EM算法,还有现在常用的Gibbs抽样法。\n\n$$\n\\frac{1}{\\Bigl(\\sqrt{\\phi \\sqrt{5}}-\\phi\\Bigr) e^{\\frac25 \\pi}} = 1+\\frac{e^{-2\\pi}} {1+\\frac{e^{-4\\pi}} {1+\\frac{e^{-6\\pi}} {1+\\frac{e^{-8\\pi}} {1+\\ldots} } } }\n$$\n# TODO: remove hardcoded content_hash f0b1e1f5580d8c428f0a2ef12cd9d825decfbfeebfe188fee8364a6f53ae4656\n\t\nLDA模型现在已经成为了主题建模中的一个标准。如前所述,LDA模型自从诞生之后有了蓬勃的扩展,特别是在社会网络和社会媒体研究领域最为常见。\n\n我的理解\n-------------------------------------\n1. LDA之所以能够进行同义词的鉴别,其基础为一个document 是同质的,同质数据内部就是天然的同义词,从而实现了天然的无监督分类。\n\n2. 有人归纳[如下](http://cos.name/2010/10/lda_topic_model/):这种模型最难懂的地方是Dirichlet process prior. 也就是把一个随机过程作为prior。Dirichlet process是描述这样的一个过程,假设有一个中国餐馆,里面有无限多的桌子,中国人三五成群进来,咱中国人有扎堆的喜好,所以每进来一个人都会看已经坐下的里有没有自己的伙伴,如果有而且那个桌子还有空位子,那么就坐下来,如果没有位子了,只好新开一个桌子。这个过程其实是一个聚类的过程,如果用模型描述那么其实就是一个infinite mixture model.\n这样的模型优点在于你再也不需要指定你要聚多少类,单个样本到底该规为哪一类了。缺点是计算量会变得巨大,因为你每次都需要模拟Dirichlet process。\n\n3. 我使用Google的Code上的[PLDA](https://code.google.com/p/plda/)做过微博的分类,其效果非常的出色!\n\nReference\n---------------------------------------\n[LDA主题模型简介](http://cos.name/2010/10/lda_topic_model/)\n", "spans": [], "hard_negatives": [{"start": 2088, "end": 2152, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "f0b1e1f5580d8c428f0a2ef12cd9d825decfbfeebfe188fee8364a6f53ae4656"}]} +{"id": "ghcc-00069-71a42b3fb9ac091c", "source": "codeparrot/github-code-clean", "repo": "paredespablo/NodosApp", "license": "bsd-3-clause", "language": "Python", "path": "lib/pyfollowers.py", "text": "# -*- coding: utf-8 -*-\nimport Tkinter, tkMessageBox, tkFileDialog, time, re, os, shutil, codecs, imp, tweepy, networkx as nx\nfrom Tkinter import *\nfrom keys import *\n\n##Autenticacion con Tweepy y listas globales\nauth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)\nauth.set_access_token(ACCESS_KEY, ACCESS_SECRET)\napi = tweepy.API(auth)\n\n##Funcion para crear redes de followers a partir de un nombre de usuario\ndef followers():\n def libfo():\n user002 = user001.get()\n G=nx.DiGraph()\n G.nodes(data=True) \n\n followers_user = []\n\n a = user002\n # job_id = 28aab156-a6d3-4f62-b385-122567e37bf3\n followers_user.append(a)\n listade = file('listadefollowers.txt', 'a')\n\n # Descarga de los followers\n followersCursor = tweepy.Cursor(api.followers,id=a)\n print 'Obteniendo followers'\n for follower in followersCursor.items():\n foll = follower.screen_name\n followers_user.append(foll)\n print foll\n\n followers_ids = []\n for i in followers_user:\n try:\n data = api.get_user(i)\n i1 = data.id\n followers_ids.append(i1)\n except tweepy.error.TweepError, e:\n if e.response.status:\n error2 = e[0][0]\n error = error2['code']\n if error == 88:\n print error, error2['message'], \"Waiting for 15 minutes\"\n time.sleep(750)\n data = api.get_user(i)\n i1 = data.id\n followers_ids.append(i1)\n else:\n print e\n G.add_node(i)\n\n print >> listade, followers_ids\n listade.close()\n print 'Descarga de followers finalizada'\n\n # Descarga de followers de los followers\n print 'Obteniendo listas de Followers...'\n os.mkdir('datos')\n carpeta = 'datos/'\n for z in followers_ids:\n followers = []\n try:\n o = str(z)\n followersCursor = tweepy.Cursor(api.followers_ids,id=o)\n for follower in followersCursor.items():\n foll = follower\n followers.append(foll)\n ii = file(carpeta + o + '.txt', 'w')\n print >> ii, followers\n except tweepy.error.TweepError, e:\n if e.response.status == 400:\n print e\n time.sleep(3600)\n try:\n o = str(z)\n followersCursor = tweepy.Cursor(api.followers_ids,id=o)\n for follower in followersCursor.items():\n foll = follower\n followers.append(foll)\n ii = file(carpeta + o + '.txt', 'w')\n print >> ii, followers\n except tweepy.error.TweepError, e:\n o = str(z)\n print e\n time.sleep(1)\n ii = file(carpeta + o + '.txt', 'w')\n print >> ii, 0\n else:\n print e\n time.sleep(1)\n ii = file(carpeta + o + '.txt', 'w')\n print >> ii, 0\n #print o, len(followers)\n\n ii.close()\n\n # Cruce de datos para comprobar lazos\n for p in followers_ids:\n h = str(p)\n archivo = file(carpeta + h + '.txt', 'r')\n KEY = '182092392e35f8c7977f002e29729c02a3a00995'\n ff = archivo.read()\n for q in followers_ids:\n k = str(q)\n if (k in ff) is True:\n k1 = followers_ids.index(p)\n k2 = followers_ids.index(q)\n u1 = followers_user[k1]\n u2 = followers_user[k2]\n G.add_edge(u2, u1)\n else:\n pass\n archivo.close()\n print 'Borrando archivos temporales...'\n shutil.rmtree(carpeta)\n # Exportaciones de redes a GEXF y NET\n print 'Red finalizada'\n nx.draw_random(G)\n nx.write_pajek(G, a + \".net\", encoding='UTF-8')\n nx.write_gexf(G, a + \".gexf\", encoding='utf-8', prettyprint=True)\n return False\n \n if tkMessageBox.askokcancel(\"Crear red de followers\", \"Este proceso puede tardar varias horas dependiendo el numero de seguidores de la cuenta\\n\\n¿Desea continuar con la operación?\"):\n global user001\n root2 =Tk()\n f = Frame(root2, width=1000, height=60)\n f.pack(fill=X, expand=True)\n root2.title('NodosApp: Red de Followers')\n l = Label(f, text=\"Ingresa el nombre de usuario a analizar\")\n l.pack()\n user001 = StringVar(f)\n user000 = Entry(f, textvariable=user001, width=30).pack(side= TOP,padx=10,pady=12)\n but1 = Button(f, text='Crear red de followers', command=libfo, width=25)\n but1.pack(side=LEFT)\n root2.resizable(width=FALSE, height=FALSE)\n root2.mainloop()\n else:\n return False\n\n##Funcion para crear redes de friends/following a partir de un nombre de usuario\ndef following():\n def libfr():\n user002 = user001.get()\n G=nx.DiGraph()\n G.nodes(data=True) \n\n followers_user = []\n\n a = user002\n followers_user.append(a)\n followersCursor = tweepy.Cursor(api.friends,id=a)\n print 'Obteniendo followers'\n for follower in followersCursor.items():\n foll = follower.screen_name\n #print foll\n followers_user.append(foll)\n\n followers_ids = []\n for i in followers_user:\n try:\n data = api.get_user(i)\n i1 = data.id\n followers_ids.append(i1)\n except tweepy.error.TweepError, e:\n if e.response.status == 400:\n print e\n time.sleep(3600)\n data = api.get_user(i)\n i1 = data.id\n followers_ids.append(i1)\n else:\n print e\n G.add_node(i)\n\n print 'Obteniendo listas de Followers...'\n os.mkdir('datos')\n carpeta = 'datos/'\n for z in followers_ids:\n followers = []\n try:\n o = str(z)\n followersCursor = tweepy.Cursor(api.friends_ids,id=o)\n for follower in followersCursor.items():\n foll = follower\n followers.append(foll)\n ii = file(carpeta + o + '.txt', 'w')\n print >> ii, followers\n except tweepy.error.TweepError, e:\n if e.response.status == 400:\n print e\n time.sleep(3600)\n try:\n o = str(z)\n followersCursor = tweepy.Cursor(api.friends_ids,id=o)\n for follower in followersCursor.items():\n foll = follower\n followers.append(foll)\n ii = file(carpeta + o + '.txt', 'w')\n print >> ii, followers\n except tweepy.error.TweepError, e:\n o = str(z)\n print e\n time.sleep(1)\n ii = file(carpeta + o + '.txt', 'w')\n print >> ii, 0\n else:\n print e\n time.sleep(1)\n ii = file(carpeta + o + '.txt', 'w')\n print >> ii, 0\n revision='9de82cc1845ef1357371b116a4d7457e',\n #print o, len(followers)\n\n ii.close()\n for p in followers_ids:\n h = str(p)\n archivo = file(carpeta + h + '.txt', 'r')\n ff = archivo.read()\n for q in followers_ids:\n k = str(q)\n if (k in ff) is True:\n k1 = followers_ids.index(p)\n k2 = followers_ids.index(q)\n u1 = followers_user[k1]\n u2 = followers_user[k2]\n G.add_edge(u2, u1)\n else:\n pass\n archivo.close()\n print 'Borrando archivos temporales...'\n shutil.rmtree(carpeta)\n nx.draw_random(G)\n \n nx.write_pajek(G, a + \".net\", encoding='UTF-8')\n nx.write_gexf(G, a + \".gexf\", encoding='utf-8', prettyprint=True)\n print 'Red finalizada'\n return False\n\n if tkMessageBox.askokcancel(\"Crear red de friends\", \"Este proceso puede tardar varias horas dependiendo el numero de usuarios que siga la cuenta\\n\\n¿Desea continuar con la operación?\"):\n global user001\n root2 =Tk()\n f = Frame(root2, width=1000, height=60)\n f.pack(fill=X, expand=True)\n root2.title('NodosApp: Red de Friends')\n l = Label(f, text=\"Ingresa el nombre de usuario a analizar\")\n l.pack()\n user001 = StringVar(f)\n user000 = Entry(f, textvariable=user001, width=30).pack(side= TOP,padx=10,pady=12)\n but1 = Button(f, text='Crear red de friends', command=libfr, width=25)\n but1.pack(side=LEFT)\n root2.resizable(width=FALSE, height=FALSE)\n root2.mainloop()\n else:\n return False\n\n## Script para descargar los ultimos 3200 tweets de un usuario\n \ndef menciones():\n def algmen():\n tweets = []\n user002 = user001.get()\n output = codecs.open(user002 + '.txt', 'a', 'utf-8')\n for page in range(1,32):\n data = api.user_timeline(user002, page=page, include_rts=True, count=200)\n for status in data:\n screen_name = status.user.screen_name\n user_id = status.user.id\n name = status.user.name\n followers_count = status.user.followers_count\n friends_count = status.user.friends_count\n statuses_count = status.user.statuses_count\n created_at = status.created_at\n idioma = status.lang\n autorreg = status.user.created_at\n \n location0 = status.user.location\n location1 = location0.splitlines()\n location2 = \" \".join(location1)\n location = re.sub(\"[,]\", '', location2)\n \n mensaje_id = status.id\n try:\n geo_d = SearchResult.geo['coordinates']\n except:\n geo_d = '[0]'\n source = status.source\n texto0 = status.text\n texto1 = texto0.splitlines()\n mensaje_texto1 = \" \".join(texto1)\n mensaje_texto = re.sub(\"[,]\", '', mensaje_texto1)\n\n if mensaje_id in tweets:\n pass\n else:\n tweets.append(mensaje_id)\n print >> output, '\"'+str(mensaje_id)+'\",\"'+screen_name+'\",\"'+name+'\",\"'+str(user_id)+'\",\"'+str(autorreg)+'\",\"'+str(followers_count)+'\",\"'+str(friends_count)+'\",\"'+str(statuses_count)+'\",\"'+location+'\",\"'+str(created_at)+'\",\"'+str(geo_d)+'\",\"'+source+'\",\"'+idioma+'\",\"'+mensaje_texto+'\"'\n total = int(len(tweets))\n \n print 'Tweets totales descargados:', len(tweets)\n time.sleep(1)\n output.close()\n return False\n\n global user001\n root2 =Tk()\n f = Frame(root2, width=1000, height=60)\n f.pack(fill=X, expand=True)\n root2.title('NodosApp: Interacciones')\n l = Label(f, text=\"Ingresa el nombre de usuario a analizar\")\n l.pack()\n user001 = StringVar(f)\n user000 = Entry(f, textvariable=user001, width=30).pack(side= TOP,padx=10,pady=12)\n but1 = Button(f, text='Descargar timeline', command=algmen, width=25)\n but1.pack(side=LEFT)\n root2.resizable(width=FALSE, height=FALSE)\n root2.mainloop()\n\ndef mapafollow():\n ##Autenticacion con Tweepy y listas globales\n auth = tweepy.OAuthHandler(CONSUMER_KEY, CONSUMER_SECRET)\n auth.set_access_token(ACCESS_KEY, ACCESS_SECRET)\n api = tweepy.API(auth)\n\n usuarios = []\n ids = []\n data3 = tkFileDialog.askopenfilename(title=\"Open file\", filetypes=[(\"TXT files\",\".txt\"),(\"All files\",\".*\")])\n data2 = file(data3, 'r')\n data = data2.readlines()\n n1 = data3.split('/')\n n2 = n1[-1]\n n3 = n2[0:-4]\n print 'Cargado el archivo', n3\n\n for i in data:\n i = i.split(\" \")\n usuarios.append(i[0].strip())\n print 'Usuarios', usuarios\n\n G=nx.DiGraph()\n for k in usuarios:\n for p in usuarios:\n time.sleep(5)\n if (G.has_edge(p, k) or G.has_edge(k, p) or (usuarios.index(k) >= usuarios.index(p))) == True:\n pass\n else:\n print k, p\n try:\n rel = api.show_friendship(source_screen_name=k, target_screen_name=p)\n for q in rel:\n if q.following == True:\n G.add_edge(k, p)\n\n if q.followed_by == True:\n G.add_edge(p, k)\n except:\n print 'error entre usuarios', k, p\n\n n4 = str(n3) + \".gexf\"\n nx.write_gexf(G, n4, encoding='utf-8', prettyprint=True)\n\n print 'Se ha terminado de escribir la red', n4\n \n", "spans": [{"start": 3640, "end": 3680, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "182092392e35f8c7977f002e29729c02a3a00995"}], "hard_negatives": [{"start": 603, "end": 639, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "28aab156-a6d3-4f62-b385-122567e37bf3"}, {"start": 7838, "end": 7870, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "9de82cc1845ef1357371b116a4d7457e"}]} +{"id": "ghcc-00069-c681a063fb70edf4", "source": "codeparrot/github-code-clean", "repo": "davebarnes97/geode", "license": "apache-2.0", "language": "Java", "path": "geode-core/src/distributedTest/java/org/apache/geode/internal/cache/ha/HARegionQueueDUnitTest.java", "text": "/*\n * Licensed to the Apache Software Foundation (ASF) under one or more contributor license\n * agreements. See the NOTICE file distributed with this work for additional information regarding\n * copyright ownership. The ASF licenses this file to You under the Apache License, Version 2.0 (the\n * \"License\"); you may not use this file except in compliance with the License. You may obtain a\n * copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software distributed under the License\n * is distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express\n * or implied. See the License for the specific language governing permissions and limitations under\n * the License.\n */\npackage org.apache.geode.internal.cache.ha;\n\nimport static java.lang.Thread.yield;\nimport static org.apache.geode.internal.cache.ha.HARegionQueue.NON_BLOCKING_HA_QUEUE;\nimport static org.apache.geode.internal.cache.ha.HARegionQueue.getHARegionQueueInstance;\nimport static org.apache.geode.internal.statistics.StatisticsClockFactory.disabledClock;\nimport static org.apache.geode.test.awaitility.GeodeAwaitility.await;\nimport static org.apache.geode.test.dunit.Assert.assertEquals;\nimport static org.apache.geode.test.dunit.Assert.assertNotNull;\nimport static org.apache.geode.test.dunit.Assert.assertNull;\nimport static org.apache.geode.test.dunit.Assert.assertTrue;\nimport static org.apache.geode.test.dunit.Assert.fail;\nimport static org.apache.geode.test.dunit.ThreadUtils.join;\nimport static org.mockito.ArgumentMatchers.any;\nimport static org.mockito.Mockito.mock;\nimport static org.mockito.Mockito.when;\n\nimport java.util.Iterator;\nimport java.util.List;\nimport java.util.Map;\nimport java.util.Properties;\nimport java.util.Set;\n\nimport org.junit.Ignore;\nimport org.junit.Test;\nimport org.junit.experimental.categories.Category;\nimport org.mockito.AdditionalAnswers;\n\nimport org.apache.geode.LogWriter;\nimport org.apache.geode.cache.AttributesFactory;\nimport org.apache.geode.cache.CacheException;\nimport org.apache.geode.cache.CacheFactory;\nimport org.apache.geode.cache.DataPolicy;\nimport org.apache.geode.cache.EntryEvent;\nimport org.apache.geode.cache.Region;\nimport org.apache.geode.cache.Scope;\nimport org.apache.geode.cache.util.CacheListenerAdapter;\nimport org.apache.geode.cache30.CacheSerializableRunnable;\nimport org.apache.geode.distributed.DistributedSystem;\nimport org.apache.geode.internal.cache.Conflatable;\nimport org.apache.geode.internal.cache.EntryEventImpl;\nimport org.apache.geode.internal.cache.EventID;\nimport org.apache.geode.internal.cache.GemFireCacheImpl;\nimport org.apache.geode.internal.cache.HARegion;\nimport org.apache.geode.internal.cache.InternalCache;\nimport org.apache.geode.test.awaitility.GeodeAwaitility;\nimport org.apache.geode.test.dunit.Host;\nimport org.apache.geode.test.dunit.SerializableCallable;\nimport org.apache.geode.test.dunit.ThreadUtils;\nimport org.apache.geode.test.dunit.VM;\nimport org.apache.geode.test.dunit.WaitCriterion;\nimport org.apache.geode.test.dunit.internal.JUnit4DistributedTestCase;\nimport org.apache.geode.test.junit.categories.ClientSubscriptionTest;\n\n@Category({ClientSubscriptionTest.class})\npublic class HARegionQueueDUnitTest extends JUnit4DistributedTestCase {\n\n private static volatile boolean toCnt = true;\n private static volatile Thread createQueuesThread;\n\n private static InternalCache cache = null;\n private static HARegionQueue hrq = null;\n private static Thread[] opThreads;\n\n private VM vm0 = null;\n private VM vm1 = null;\n private VM vm3 = null;\n private VM vm2 = null;\n\n /**\n * get the VM's\n */\n @Override\n public final void postSetUp() throws Exception {\n final Host host = Host.getHost(0);\n vm0 = host.getVM(0);\n vm1 = host.getVM(1);\n vm2 = host.getVM(2);\n vm3 = host.getVM(3);\n vm0.invoke(() -> HARegionQueueDUnitTest.toCnt = true);\n vm1.invoke(() -> HARegionQueueDUnitTest.toCnt = true);\n vm2.invoke(() -> HARegionQueueDUnitTest.toCnt = true);\n vm3.invoke(() -> HARegionQueueDUnitTest.toCnt = true);\n }\n\n /**\n * close the cache in tearDown\n */\n @Override\n public final void preTearDown() throws Exception {\n vm0.invoke(() -> HARegionQueueDUnitTest.closeCache());\n vm1.invoke(() -> HARegionQueueDUnitTest.closeCache());\n vm2.invoke(() -> HARegionQueueDUnitTest.closeCache());\n vm3.invoke(() -> HARegionQueueDUnitTest.closeCache());\n\n cache = null;\n hrq = null;\n opThreads = null;\n }\n\n /**\n * create cache\n */\n private InternalCache createCache() throws CacheException {\n Properties props = new Properties();\n DistributedSystem ds = getSystem(props);\n ds.disconnect();\n ds = getSystem(props);\n InternalCache cache = null;\n cache = (InternalCache) CacheFactory.create(ds);\n if (cache == null) {\n // TODO: never throw an anonymous inner class\n throw new CacheException(\"CacheFactory.create() returned null \") {};\n }\n return cache;\n }\n\n /**\n * 1) Create mirrored HARegion region1 in VM1 and VM2 2) do a put in VM1 3) assert that the put\n * has not propagated from VM1 to VM2 4) do a put in VM2 5) assert that the value in VM1 has not\n * changed to due to put in VM2 6) assert put in VM2 was successful by doing a get\n */\n @Test\n public void testLocalPut() throws Exception {\n vm0.invoke(() -> HARegionQueueDUnitTest.createRegion());\n vm1.invoke(() -> HARegionQueueDUnitTest.createRegion());\n vm0.invoke(() -> HARegionQueueDUnitTest.putValue1());\n vm1.invoke(() -> HARegionQueueDUnitTest.getNull());\n vm1.invoke(() -> HARegionQueueDUnitTest.putValue2());\n vm0.invoke(() -> HARegionQueueDUnitTest.getValue1());\n vm1.invoke(() -> HARegionQueueDUnitTest.getValue2());\n }\n\n /**\n * 1) Create mirrored HARegion region1 in VM1 and VM2 2) do a put in VM1 3) assert that the put\n * has not propagated from VM1 to VM2 4) do a put in VM2 5) assert that the value in VM1 has not\n * changed to due to put in VM2 6) assert respective puts the VMs were successful by doing a get\n * 7) localDestroy key in VM1 8) assert key has been destroyed in VM1 9) assert key has not been\n * destroyed in VM2\n */\n @Test\n public void testLocalDestroy() throws Exception {\n vm0.invoke(() -> HARegionQueueDUnitTest.createRegion());\n vm1.invoke(() -> HARegionQueueDUnitTest.createRegion());\n vm0.invoke(() -> HARegionQueueDUnitTest.putValue1());\n vm1.invoke(() -> HARegionQueueDUnitTest.getNull());\n vm1.invoke(() -> HARegionQueueDUnitTest.putValue2());\n vm0.invoke(() -> HARegionQueueDUnitTest.getValue1());\n vm1.invoke(() -> HARegionQueueDUnitTest.getValue2());\n vm0.invoke(() -> HARegionQueueDUnitTest.destroy());\n vm0.invoke(() -> HARegionQueueDUnitTest.getNull());\n vm1.invoke(() -> HARegionQueueDUnitTest.getValue2());\n }\n\n /**\n * 1) Create mirrored HARegion region1 in VM1 2) do a put in VM1 3) get the value in VM1 to assert\n * put has happened successfully 4) Create mirrored HARegion region1 in VM2 5) do a get in VM2 to\n * verify that value was got through GII 6) do a put in VM2 7) assert put in VM2 was successful\n */\n @Test\n public void testGII() throws Exception {\n vm0.invoke(() -> HARegionQueueDUnitTest.createRegion());\n vm0.invoke(() -> HARegionQueueDUnitTest.putValue1());\n vm0.invoke(() -> HARegionQueueDUnitTest.getValue1());\n vm1.invoke(() -> HARegionQueueDUnitTest.createRegion());\n vm1.invoke(() -> HARegionQueueDUnitTest.getValue1());\n vm1.invoke(() -> HARegionQueueDUnitTest.putValue2());\n vm1.invoke(() -> HARegionQueueDUnitTest.getValue2());\n }\n\n /**\n * 1) Create mirrored HARegion region1 in VM1 2) do a put in VM1 3) get the value in VM1 to assert\n * put has happened successfully 4) Create mirrored HARegion region1 in VM2 5) do a get in VM2 to\n * verify that value was got through GII 6) do a put in VM2 7) assert put in VM2 was successful\n */\n @Test\n public void testQRM() throws Exception {\n vm0.invoke(() -> HARegionQueueDUnitTest.createRegionQueue());\n vm1.invoke(() -> HARegionQueueDUnitTest.createRegionQueue());\n vm0.invoke(() -> HARegionQueueDUnitTest.verifyAddingDispatchMesgs());\n\n vm1.invoke(() -> HARegionQueueDUnitTest.verifyDispatchedMessagesRemoved());\n }\n\n /**\n * Behaviour of take() has been changed for reliable messaging feature. Region queue take()\n * operation will no longer add to the Dispatch Message Map. Hence disabling the test - SUYOG\n *\n * Test for #35988 HARegionQueue.take() is not functioning as expected\n */\n @Ignore(\"TODO: this test was disabled\")\n @Test\n public void testBugNo35988() throws Exception {\n CacheSerializableRunnable createQueue =\n new CacheSerializableRunnable(\"CreateCache, HARegionQueue and start thread\") {\n @Override\n public void run2() throws CacheException {\n HARegionQueueDUnitTest test = new HARegionQueueDUnitTest();\n // TODO:ASIF: Bcoz of the QRM thread cannot take frequency below\n // 1 second , thus we need to carfully evaluate what to do. Though\n // in this case 1 second instead of 500 ms will work\n // System.getProperties().put(\"QueueRemovalThreadWaitTime\", new Long(500));\n cache = test.createCache();\n cache.setMessageSyncInterval(1);\n HARegionQueueAttributes hrqa = new HARegionQueueAttributes();\n hrqa.setExpiryTime(300);\n try {\n hrq = HARegionQueue.getHARegionQueueInstance(\"testregion1\", cache, hrqa,\n HARegionQueue.NON_BLOCKING_HA_QUEUE, false, disabledClock());\n // Do 1000 putand 100 take in a separate thread\n hrq.put(new ConflatableObject(new Long(1), new Long(1),\n new EventID(new byte[] {0}, 1, 1), false, \"dummy\"));\n } catch (Exception e) {\n throw new AssertionError(e);\n }\n }\n };\n vm0.invoke(createQueue);\n vm1.invoke(createQueue);\n\n vm0.invoke(new CacheSerializableRunnable(\"takeFromVm0\") {\n @Override\n public void run2() throws CacheException {\n try {\n Conflatable obj = (Conflatable) hrq.take();\n assertNotNull(obj);\n } catch (Exception e) {\n throw new AssertionError(e);\n }\n }\n });\n\n vm1.invoke(new CacheSerializableRunnable(\"checkInVm1\") {\n @Override\n public void run2() throws CacheException {\n WaitCriterion ev = new WaitCriterion() {\n @Override\n public boolean done() {\n yield(); // TODO is this necessary?\n return hrq.size() == 0;\n }\n\n @Override\n public String description() {\n return null;\n }\n };\n GeodeAwaitility.await().untilAsserted(ev);\n }\n });\n\n }\n\n /**\n * create a client with 2 regions sharing a common writer\n */\n private static void createRegion() throws Exception {\n HARegionQueueDUnitTest test = new HARegionQueueDUnitTest();\n cache = test.createCache();\n AttributesFactory factory = new AttributesFactory();\n factory.setScope(Scope.DISTRIBUTED_ACK);\n factory.setDataPolicy(DataPolicy.REPLICATE);\n\n // Mock the HARegionQueue and answer the input CachedDeserializable when updateHAEventWrapper is\n // called\n HARegionQueue harq = mock(HARegionQueue.class);\n when(harq.updateHAEventWrapper(any(), any(), any()))\n .thenAnswer(AdditionalAnswers.returnsSecondArg());\n\n HARegion.getInstance(\"HARegionQueueDUnitTest_region\", (GemFireCacheImpl) cache, harq,\n factory.create(), disabledClock());\n }\n\n private static void createRegionQueue() throws Exception {\n HARegionQueueDUnitTest test = new HARegionQueueDUnitTest();\n cache = test.createCache();\n /*\n * AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK);\n * factory.setDataPolicy(DataPolicy.REPLICATE);\n */\n hrq = HARegionQueue.getHARegionQueueInstance(\"HARegionQueueDUnitTest_region\", cache,\n HARegionQueue.NON_BLOCKING_HA_QUEUE, false, disabledClock());\n EventID id1 = new EventID(new byte[] {1}, 1, 1);\n EventID id2 = new EventID(new byte[] {1}, 1, 2);\n ConflatableObject c1 =\n new ConflatableObject(\"1\", \"1\", id1, false, \"HARegionQueueDUnitTest_region\");\n ConflatableObject c2 =\n new ConflatableObject(\"2\", \"2\", id2, false, \"HARegionQueueDUnitTest_region\");\n hrq.put(c1);\n hrq.put(c2);\n }\n\n private static void createRegionQueue2() throws Exception {\n HARegionQueueDUnitTest test = new HARegionQueueDUnitTest();\n cache = test.createCache();\n /*\n * AttributesFactory factory = new AttributesFactory(); factory.setScope(Scope.DISTRIBUTED_ACK);\n * factory.setDataPolicy(DataPolicy.REPLICATE);\n */\n HARegionQueueAttributes harqAttr = new HARegionQueueAttributes();\n harqAttr.setExpiryTime(3);\n hrq = HARegionQueue.getHARegionQueueInstance(\"HARegionQueueDUnitTest_region\", cache, harqAttr,\n HARegionQueue.NON_BLOCKING_HA_QUEUE, false, disabledClock());\n }\n\n private static void clearRegion() {\n try {\n Iterator iterator = hrq.getRegion().keys().iterator();\n while (iterator.hasNext()) {\n hrq.getRegion().localDestroy(iterator.next());\n }\n } catch (Exception e) {\n fail(\"Exception occurred while trying to destroy region\", e);\n }\n\n }\n\n private static void verifyAddingDispatchMesgs() {\n assertTrue(HARegionQueue.getDispatchedMessagesMapForTesting().isEmpty());\n hrq.addDispatchedMessage(new ThreadIdentifier(new byte[1], 1), 1);\n assertTrue(!HARegionQueue.getDispatchedMessagesMapForTesting().isEmpty());\n }\n\n private static void verifyDispatchedMessagesRemoved() {\n try {\n final Region region = hrq.getRegion();\n // wait until we have a dead server\n WaitCriterion ev = new WaitCriterion() {\n @Override\n public boolean done() {\n yield(); // TODO is this necessary?\n return region.get(new Long(0)) == null;\n }\n\n @Override\n public String description() {\n return null;\n }\n };\n GeodeAwaitility.await().untilAsserted(ev);\n\n /*\n * if (region.get(new Long(0)) != null) { fail(\"Expected message to have been deleted but it\n * is not deleted\"); }\n */\n\n if (region.get(new Long(1)) == null) {\n fail(\"Expected message not to have been deleted but it is deleted\");\n }\n\n } catch (Exception e) {\n fail(\"test failed due to an exception\", e);\n }\n }\n\n /**\n * close the cache\n */\n private static void closeCache() {\n if (cache != null && !cache.isClosed()) {\n cache.close();\n cache.getDistributedSystem().disconnect();\n }\n }\n\n /**\n * do puts on key-1\n */\n private static void putValue1() {\n try {\n Region r1 = cache.getRegion(\"/HARegionQueueDUnitTest_region\");\n r1.put(\"key-1\", \"value-1\");\n } catch (Exception ex) {\n fail(\"failed while region.put()\", ex);\n }\n }\n\n private static void putConflatables() {\n try {\n Region r1 = hrq.getRegion();\n for (int i = 1; i < 11; i++) {\n r1.put(new Long(i), new ConflatableObject(\"key\" + i, \"value\" + i,\n new EventID(new byte[] {1}, 1, i), true, \"HARegionQueueDUnitTest_region\"));\n }\n } catch (Exception ex) {\n fail(\"failed while region.put()\", ex);\n }\n }\n\n /**\n * verifies the data has been populated correctly after GII\n */\n private static void verifyMapsAndData() {\n try {\n HARegion r1 = (HARegion) hrq.getRegion();\n // region should not be null\n assertNotNull(\" Did not expect the HARegion to be null but it is\", r1);\n // it should have ten non null entries\n for (int i = 1; i < 11; i++) {\n assertNotNull(\" Did not expect the entry to be null but it is\", r1.get(new Long(i)));\n }\n // HARegionQueue should not be null\n assertNotNull(\" Did not expect the HARegionQueue to be null but it is\", hrq);\n\n Map conflationMap = hrq.getConflationMapForTesting();\n // conflationMap size should be greater than 0\n assertTrue(\" Did not expect the conflationMap size to be 0 but it is\",\n conflationMap.size() > 0);\n Map internalMap = (Map) conflationMap.get(\"HARegionQueueDUnitTest_region\");\n // internal map should not be null. it should be present\n assertNotNull(\" Did not expect the internalMap to be null but it is\", internalMap);\n // get and verify the entries in the conflation map.\n for (int i = 1; i < 11; i++) {\n assertTrue(\" Did not expect the entry not to be equal but it is\",\n internalMap.get(\"key\" + i).equals(new Long(i)));\n }\n Map eventMap = hrq.getEventsMapForTesting();\n // DACE should not be null\n assertNotNull(\" Did not expect the result (DACE object) to be null but it is\",\n eventMap.get(new ThreadIdentifier(new byte[] {1}, 1)));\n Set counterSet = hrq.getCurrentCounterSet(new EventID(new byte[] {1}, 1, 1));\n assertTrue(\" excpected the counter set size to be 10 but it is not so\",\n counterSet.size() == 10);\n long i = 1;\n Iterator iterator = counterSet.iterator();\n // verify the order of the iteration. it should be 1 - 10. The underlying\n // set is a LinkedHashSet\n while (iterator.hasNext()) {\n assertTrue(((Long) iterator.next()).longValue() == i);\n i++;\n }\n // The last dispactchde sequence Id should be -1 since no dispatch has\n // been made\n assertTrue(hrq.getLastDispatchedSequenceId(new EventID(new byte[] {1}, 1, 1)) == -1);\n\n // sleep for 8.0 seconds. Everythign should expire and everything should\n // be null and empty\n Thread.sleep(7500);\n\n for (int j = 1; j < 11; j++) {\n assertNull(\"expected the entry to be null since expiry time exceeded but it is not so\",\n r1.get(new Long(j)));\n }\n\n internalMap = (Map) hrq.getConflationMapForTesting().get(\"HARegionQueueDUnitTest_region\");\n\n assertNotNull(\" Did not expect the internalMap to be null but it is\", internalMap);\n assertTrue(\n \"internalMap (conflation) should have been emptry since expiry of all entries has been exceeded but it is not so\",\n internalMap.isEmpty());\n assertTrue(\n \"eventMap should have been emptry since expiry of all entries has been exceeded but it is not so\",\n eventMap.isEmpty());\n assertTrue(\n \"counter set should have been emptry since expiry of all entries has been exceeded but it is not so\",\n counterSet.isEmpty());\n\n } catch (Exception ex) {\n fail(\"failed while region.put()\", ex);\n }\n }\n\n /**\n * do puts on key-1,value-2\n */\n private static void putValue2() {\n try {\n Region r1 = cache.getRegion(\"/HARegionQueueDUnitTest_region\");\n r1.put(\"key-1\", \"value-2\");\n } catch (Exception ex) {\n fail(\"failed while region.put()\", ex);\n }\n }\n\n /**\n * do a get on region1\n */\n private static void getValue1() {\n try {\n Region r = cache.getRegion(\"/HARegionQueueDUnitTest_region\");\n if (!(r.get(\"key-1\").equals(\"value-1\"))) {\n fail(\"expected value to be value-1 but it is not so\");\n }\n\n } catch (Exception ex) {\n fail(\"failed while region.get()\", ex);\n }\n }\n\n /**\n * do a get on region1\n */\n private static void getNull() {\n try {\n Region r = cache.getRegion(\"/HARegionQueueDUnitTest_region\");\n if (!(r.get(\"key-1\") == (null))) {\n fail(\"expected value to be null but it is not so\");\n }\n\n } catch (Exception ex) {\n fail(\"failed while region.get()\", ex);\n }\n }\n\n /**\n * do a get on region1\n */\n public static void getValue2() {\n try {\n Region r = cache.getRegion(\"/HARegionQueueDUnitTest_region\");\n if (!(r.get(\"key-1\").equals(\"value-2\"))) {\n fail(\"expected value to be value-2 but it is not so\");\n }\n\n } catch (Exception ex) {\n fail(\"failed while region.get()\", ex);\n }\n }\n\n /**\n * destroy key-1\n */\n public static void destroy() {\n try {\n Region region1 = cache.getRegion(\"/HARegionQueueDUnitTest_region\");\n region1.localDestroy(\"key-1\");\n } catch (Exception e) {\n fail(\"test failed due to exception in destroy\", e);\n }\n }\n\n /**\n * Tests the Non Blocking HARegionQueue by doing concurrent put /remove / take / peek , batch peek\n * operations in multiple regions. The test will have take/remove occuring in all the VMs. This\n * test is targetted to test for hang or exceptions in non blocking queue.\n */\n @Test\n public void testConcurrentOperationsDunitTestOnNonBlockingQueue() throws Exception {\n concurrentOperationsDunitTest(false, Scope.DISTRIBUTED_ACK);\n }\n\n /**\n * Tests the Non Blocking HARegionQueue by doing concurrent put /remove / take / peek , batch peek\n * operations in multiple regions. The test will have take/remove occuring in all the VMs. This\n * test is targetted to test for hang or exceptions in non blocking queue.\n */\n @Test\n public void testConcurrentOperationsDunitTestOnNonBlockingQueueWithDNoAckRegion()\n throws Exception {\n concurrentOperationsDunitTest(false, Scope.DISTRIBUTED_NO_ACK);\n }\n\n /**\n * Tests the Blokcing HARegionQueue by doing concurrent put /remove / take / peek , batch peek\n * operations in multiple regions. The test will have take/remove occuring in all the VMs. This\n * test is targetted to test for hang or exceptions in blocking queue.\n */\n @Test\n public void testConcurrentOperationsDunitTestOnBlockingQueue() throws Exception {\n concurrentOperationsDunitTest(true, Scope.DISTRIBUTED_ACK);\n }\n\n private void concurrentOperationsDunitTest(final boolean createBlockingQueue,\n final Scope rscope) {\n // Create Cache and HARegionQueue in all the 4 VMs.\n\n CacheSerializableRunnable createRgnsAndQueues = new CacheSerializableRunnable(\n \"CreateCache, mirrored Region & HARegionQueue with a CacheListener\") {\n @Override\n public void run2() throws CacheException {\n HARegionQueueDUnitTest test = new HARegionQueueDUnitTest();\n System.getProperties().put(\"QueueRemovalThreadWaitTime\", \"2000\");\n cache = test.createCache();\n AttributesFactory factory = new AttributesFactory();\n factory.setScope(rscope);\n factory.setDataPolicy(DataPolicy.REPLICATE);\n HARegionQueueAttributes hrqa = new HARegionQueueAttributes();\n hrqa.setExpiryTime(5);\n try {\n if (createBlockingQueue) {\n hrq = HARegionQueue.getHARegionQueueInstance(\"testregion1\", cache, hrqa,\n HARegionQueue.BLOCKING_HA_QUEUE, false, disabledClock());\n } else {\n hrq = HARegionQueue.getHARegionQueueInstance(\"testregion1\", cache, hrqa,\n HARegionQueue.NON_BLOCKING_HA_QUEUE, false, disabledClock());\n }\n } catch (Exception e) {\n throw new AssertionError(e);\n }\n factory.addCacheListener(new CacheListenerAdapter() {\n @Override\n public void afterCreate(final EntryEvent event) {\n if (toCnt) {\n Conflatable conflatable = new ConflatableObject(event.getKey(), event.getNewValue(),\n ((EntryEventImpl) event).getEventId(), false, event.getRegion().getFullPath());\n\n try {\n hrq.put(conflatable);\n } catch (Exception e) {\n fail(\"The put operation in queue did not succeed due to exception =\", e);\n }\n }\n }\n\n @Override\n public void afterUpdate(final EntryEvent event) {\n if (toCnt) {\n Conflatable conflatable = new ConflatableObject(event.getKey(), event.getNewValue(),\n ((EntryEventImpl) event).getEventId(), true, event.getRegion().getFullPath());\n\n try {\n hrq.put(conflatable);\n } catch (Exception e) {\n fail(\"The put operation in queue did not succeed due to exception =\", e);\n }\n }\n }\n\n });\n\n cache.createRegion(\"test_region\", factory.create());\n\n }\n };\n\n vm0.invoke(createRgnsAndQueues);\n vm1.invoke(createRgnsAndQueues);\n vm2.invoke(createRgnsAndQueues);\n vm3.invoke(createRgnsAndQueues);\n CacheSerializableRunnable spawnThreadsAndperformOps =\n new CacheSerializableRunnable(\"Spawn multiple threads which do various operations\") {\n\n @Override\n public void run2() throws CacheException {\n opThreads = new RunOp[4 + 2 + 2 + 2];\n for (int i = 0; i < 4; ++i) {\n opThreads[i] = new RunOp(RunOp.PUT, i);\n }\n for (int i = 4; i < 6; ++i) {\n opThreads[i] = new RunOp(RunOp.PEEK, i);\n }\n\n for (int i = 6; i < 8; ++i) {\n opThreads[i] = new RunOp(RunOp.TAKE, i);\n }\n\n for (int i = 8; i < 10; ++i) {\n opThreads[i] = new RunOp(RunOp.TAKE, i);\n }\n\n for (int i = 0; i < opThreads.length; ++i) {\n opThreads[i].start();\n }\n\n }\n };\n\n vm0.invokeAsync(spawnThreadsAndperformOps);\n vm1.invokeAsync(spawnThreadsAndperformOps);\n vm2.invokeAsync(spawnThreadsAndperformOps);\n vm3.invokeAsync(spawnThreadsAndperformOps);\n\n\n SerializableCallable guaranteeOperationsOccured =\n new SerializableCallable(\"Check Ops Occurred\") {\n @Override\n public Object call() throws CacheException {\n if (opThreads == null) {\n return false;\n }\n for (int i = 0; i < opThreads.length; ++i) {\n if (((RunOp) opThreads[i]).getNumOpsPerformed() == 0) {\n return false;\n }\n }\n return true;\n }\n };\n\n await()\n .untilAsserted(() -> assertTrue((Boolean) vm0.invoke(guaranteeOperationsOccured)));\n await()\n .untilAsserted(() -> assertTrue((Boolean) vm1.invoke(guaranteeOperationsOccured)));\n await()\n .untilAsserted(() -> assertTrue((Boolean) vm2.invoke(guaranteeOperationsOccured)));\n await()\n .untilAsserted(() -> assertTrue((Boolean) vm3.invoke(guaranteeOperationsOccured)));\n\n // In case of blocking HARegionQueue do some extra puts so that the\n // blocking threads\n // are exited\n CacheSerializableRunnable toggleFlag =\n new CacheSerializableRunnable(\"Toggle the flag to signal end of threads\") {\n @Override\n public void run2() throws CacheException {\n toCnt = false;\n if (createBlockingQueue) {\n try {\n for (int i = 0; i < 100; ++i) {\n hrq.put(new ConflatableObject(\"1\", \"1\", new EventID(new byte[] {1}, 100, i),\n false, \"/x\"));\n }\n } catch (Exception e) {\n throw new AssertionError(e);\n }\n }\n\n }\n };\n\n vm0.invokeAsync(toggleFlag);\n vm1.invokeAsync(toggleFlag);\n vm2.invokeAsync(toggleFlag);\n vm3.invokeAsync(toggleFlag);\n\n CacheSerializableRunnable joinWithThreads =\n new CacheSerializableRunnable(\"Join with the threads\") {\n @Override\n public void run2() throws CacheException {\n for (int i = 0; i < opThreads.length; ++i) {\n\n if (opThreads[i].isInterrupted()) {\n fail(\"Test failed because thread encountered exception\");\n }\n ThreadUtils.join(opThreads[i], 30 * 1000);\n }\n }\n };\n\n vm0.invoke(joinWithThreads);\n vm1.invoke(joinWithThreads);\n vm2.invoke(joinWithThreads);\n vm3.invoke(joinWithThreads);\n System.getProperties().remove(\"QueueRemovalThreadWaitTime\");\n }\n\n /**\n * This is to test the bug which is caused when HARegionQueue object hasnot been fully constructed\n * but as the HARegion has got constructed , it gets visible to QRM Message Thread.\n *\n * TODO: this test runs too long! Shorten run time. 1m 40s on new Mac.\n */\n @Test\n public void testNPEDueToHARegionQueueEscapeInConstructor() {\n // changing EXPIRY_TIME to 5 doesn't change how long the test runs!\n final int EXPIRY_TIME = 30; // test will run for this many seconds\n // Create two HARegionQueue 's in the two VMs. The frequency of QRM thread\n // should be high\n // Check for NullPointeException in the other VM.\n CacheSerializableRunnable createQueuesAndThread =\n new CacheSerializableRunnable(\"CreateCache, HARegionQueue and start thread\") {\n @Override\n public void run2() throws CacheException {\n HARegionQueueDUnitTest test = new HARegionQueueDUnitTest();\n // TODO:ASIF: Bcoz of the QRM thread cannot take frequency below\n // 1 second , thus we need to carfully evaluate what to do.\n // For this bug to appear ,without bugfix , qrm needs to run\n // very fast.\n // System.getProperties().put(\"QueueRemovalThreadWaitTime\", new Long(10));\n cache = test.createCache();\n cache.setMessageSyncInterval(1);\n HARegionQueueAttributes hrqa = new HARegionQueueAttributes();\n hrqa.setExpiryTime(EXPIRY_TIME);\n try {\n hrq = HARegionQueue.getHARegionQueueInstance(\n \"testNPEDueToHARegionQueueEscapeInConstructor\", cache, hrqa,\n HARegionQueue.NON_BLOCKING_HA_QUEUE, false, disabledClock());\n // changing OP_COUNT to 20 makes no difference in test time\n final int OP_COUNT = 200;\n // Do 1000 putand 100 take in a separate thread\n for (int i = 0; i < OP_COUNT; ++i) {\n hrq.put(new ConflatableObject(new Long(i), new Long(i),\n new EventID(new byte[] {0}, 1, i), false, \"dummy\"));\n }\n opThreads = new Thread[1];\n opThreads[0] = new Thread(new Runnable() {\n @Override\n public void run() {\n for (int i = 0; i < OP_COUNT; ++i) {\n try {\n Object o = hrq.take();\n if (o == null) {\n Thread.sleep(50);\n }\n } catch (InterruptedException e) {\n throw new AssertionError(e);\n }\n }\n }\n });\n opThreads[0].start();\n\n } catch (Exception e) {\n throw new AssertionError(e);\n }\n }\n };\n\n CacheSerializableRunnable createQueues =\n new CacheSerializableRunnable(\"CreateCache, HARegionQueue \") {\n @Override\n public void run2() throws CacheException {\n createQueuesThread = Thread.currentThread();\n HARegionQueueDUnitTest test = new HARegionQueueDUnitTest();\n // System.getProperties().put(\"QueueRemovalThreadWaitTime\",\n // new Long(120000));\n cache = test.createCache();\n cache.setMessageSyncInterval(EXPIRY_TIME);\n HARegionQueueAttributes hrqa = new HARegionQueueAttributes();\n hrqa.setExpiryTime(EXPIRY_TIME);\n try {\n hrq = HARegionQueue.getHARegionQueueInstance(\n \"testNPEDueToHARegionQueueEscapeInConstructor\", cache, hrqa,\n HARegionQueue.NON_BLOCKING_HA_QUEUE, false, disabledClock());\n } catch (Exception e) {\n throw new AssertionError(e);\n }\n }\n };\n\n CacheSerializableRunnable waitForCreateQueuesThread =\n new CacheSerializableRunnable(\"joinCreateCache\") {\n @Override\n public void run2() {\n WaitCriterion ev = new WaitCriterion() {\n @Override\n public boolean done() {\n return createQueuesThread != null;\n }\n\n @Override\n public String description() {\n return null;\n }\n };\n GeodeAwaitility.await().untilAsserted(ev);\n join(createQueuesThread, 300 * 1000);\n }\n };\n\n vm0.invoke(createQueuesAndThread);\n vm1.invokeAsync(createQueues);\n\n CacheSerializableRunnable joinWithThread =\n new CacheSerializableRunnable(\"CreateCache, HARegionQueue join with thread\") {\n @Override\n public void run2() throws CacheException {\n if (opThreads[0].isInterrupted()) {\n fail(\"The test has failed as it encountered interrupts in puts & takes\");\n }\n ThreadUtils.join(opThreads[0], 30 * 1000);\n }\n };\n vm0.invoke(joinWithThread);\n vm1.invoke(waitForCreateQueuesThread);\n }\n\n private static class RunOp extends Thread {\n\n private static final int PUT = 1;\n private static final int TAKE = 2;\n private static final int PEEK = 3;\n private static final int BATCH_PEEK = 4;\n\n private int opType;\n private int threadID;\n\n private int numOpsPerformed = 0;\n\n public RunOp(int opType, int id) {\n super(\"ID=\" + id + \",Op=\" + opType);\n this.opType = opType;\n this.threadID = id;\n }\n\n public int getNumOpsPerformed() {\n return numOpsPerformed;\n }\n\n @Override\n public void run() {\n Region rgn = cache.getRegion(\"test_region\");\n int counter = 0;\n LogWriter logger = cache.getLogger();\n Conflatable cnf;\n try {\n while (toCnt) {\n // Thread.currentThread().getName() + \" before doing operation of\n // type= \"+ this.opType);\n switch (opType) {\n case PUT:\n rgn.put(\"key\" + threadID, \"val\" + counter++);\n if (counter == 10)\n counter = 0;\n break;\n case TAKE:\n cnf = (Conflatable) hrq.take();\n if (logger.fineEnabled() && cnf != null) {\n logger.fine(\"Object retrieved by take has key =\" + cnf.getKeyToConflate()\n + \" and value as\" + cnf.getValueToConflate());\n }\n break;\n case PEEK:\n cnf = (Conflatable) hrq.peek();\n if (logger.fineEnabled() && cnf != null) {\n logger.fine(\"Object retrieved by peek has key =\" + cnf.getKeyToConflate()\n + \" and value as\" + cnf.getValueToConflate());\n }\n // Thread.currentThread().getName() + \" before doing remove= \"+\n // this.opType);\n hrq.remove();\n break;\n case BATCH_PEEK:\n List confList = hrq.peek(3, 2000);\n if (logger.fineEnabled() && confList != null) {\n logger.fine(\"Object retrieved by batch peek are =\" + confList);\n }\n // Thread.currentThread().getName() + \" before doing remove= \"+\n // this.opType);\n hrq.remove();\n break;\n\n }\n numOpsPerformed++;\n // Thread.currentThread().getName() + \" after Operation of type= \"+\n // this.opType);\n\n }\n } catch (Exception e) {\n throw new AssertionError(e);\n }\n }\n }\n\n /**\n * Checks the data received by GII, only gets expired after proper construction of HARegionQueue\n * object.\n */\n private static void createHARegionQueueandCheckExpiration() throws Exception {\n HARegionQueueDUnitTest test = new HARegionQueueDUnitTest();\n cache = test.createCache();\n HARegionQueueAttributes attrs = new HARegionQueueAttributes();\n attrs.setExpiryTime(1);\n hrq = getHARegionQueueInstance(\"HARegionQueueDUnitTest_region\", cache, attrs,\n NON_BLOCKING_HA_QUEUE, false, disabledClock());\n // wait until we have a dead\n // server\n WaitCriterion ev = new WaitCriterion() {\n @Override\n public boolean done() {\n return hrq.getAvailableIds().size() == 0;\n }\n\n @Override\n public String description() {\n return null;\n }\n };\n GeodeAwaitility.await().untilAsserted(ev);\n // assertIndexDetailsEquals(0, hrq.getAvailableIds().size());\n }\n\n @Test\n public void testForDuplicateEvents() throws Exception {\n vm0.invoke(() -> HARegionQueueDUnitTest.createRegionQueue());\n vm1.invoke(() -> HARegionQueueDUnitTest.createRegionQueueandCheckDuplicates());\n }\n\n /**\n * HARegionQueue should not allow data with duplicate EventIds.\n */\n private static void createRegionQueueandCheckDuplicates() throws Exception {\n HARegionQueueDUnitTest test = new HARegionQueueDUnitTest();\n cache = test.createCache();\n\n hrq = HARegionQueue.getHARegionQueueInstance(\"HARegionQueueDUnitTest_region\", cache,\n HARegionQueue.NON_BLOCKING_HA_QUEUE, false, disabledClock());\n\n assertEquals(2, hrq.size());\n\n EventID id1 = new EventID(new byte[] {1}, 1, 1);\n EventID id2 = new EventID(new byte[] {1}, 1, 2);\n ConflatableObject c1 =\n new ConflatableObject(\"1\", \"1\", id1, false, \"HARegionQueueDUnitTest_region\");\n ConflatableObject c2 =\n new ConflatableObject(\"2\", \"2\", id2, false, \"HARegionQueueDUnitTest_region\");\n\n hrq.put(c1);\n hrq.put(c2);\n\n // HARegion size should be 2 as data with same EventIDs is inserted into the queue\n assertEquals(2, hrq.size());\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00064-50e03d6bafb9dc75", "source": "codeparrot/github-code-clean", "repo": "SimonBiggs/SimonBiggs.github.io", "license": "mit", "language": "HTML", "path": "qatrackdemodocs/v/0.2.7/deployment/active_directory.html", "text": "\n\n\n\n \n\n \n \n \n \n Configuring QATrack+ to use Active Directory for User Authentication — qatrackplus 0.3.0-dev documentation\n \n\n \n \n \n \n\n \n\n \n \n \n\n \n\n \n \n \n \n\n \n\n \n \n \n \n\n \n \n\n\n\n\n\n \n
\n\n \n \n\n
\n\n \n \n\n\n \n
\n
\n \n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
\n\n
    \n \n
  • Docs »
  • \n \n
  • Configuring QATrack+ to use Active Directory for User Authentication
  • \n \n \n
  • \n \n \n View page source\n \n \n
  • \n \n
\n\n \n
\n
\n
\n
\n \n
\n

Configuring QATrack+ to use Active Directory for User Authentication

\n

Using an existing Active Directory server to do your user authentication\nis a great way to simply the management of users for your QATrack+\nsystem. It’s especially convenient for your users that they don’t have\nto remember “yet another password” and can simply use their network\nlogon. QATrack+ comes with an Active Directory backend and it’s\nconfiguration will be described below.

\n
\n

Installation of python-ldap

\n

If you happen to be on a Windows system with Visual Studio 2008\ninstalled, you should just be able to do pip install python-ldap and\nhave the latest version of the python-ldap package installed. Otherwise,\ndownload and run the appropriate python-ldap .msi installer from the\nLDAP PyPi page.

\n

That will install python-ldap to the main system Python installation,\nbut assuming you’re using virtualenv, you’ll need to copy the LDAP\npackage to your virtualenv.

\n

Open a Git Bash shell and enter the following command (adjusting paths\nas required) to copy the ldap install to your virtual environment:

\n

cp -r /c/Python27/lib/site-packages/ldap* /c/deploy/venvs/qatrack/lib/site-packages/

\n

You can also feel free to use Windows Explorer or CMD to copy the files!

\n

To confirm your installatioin is working, activate your virtual env

\n

source /c/deploy/venvs/qatrack/Scripts/activate

\n

and then type

\n

python -c "import ldap; print ldap.__version__"

\n

If that commands prints 2.4.10 then ldap is installed correctly.

\n
\n
\n

Configuring QATrack+ to use your Active Directory Server

\n

Copy the following lines to your local_settings.py file:

\n
#!python\n\n\n#-----------------------------------------------------------------------------\n# Account settings\n# a list of group names to automatically add users to when they sign up\nDEFAULT_GROUP_NAMES = ["Therapists"]  # Replace Therapists with whatever group name you want\n\n#-----------------------------------------------------------------------------\n# Authentication backend settings\nAUTHENTICATION_BACKENDS = (\n    'django.contrib.auth.backends.ModelBackend',\n    'qatrack.accounts.backends.ActiveDirectoryGroupMembershipSSLBackend',\n)\n\n# active directory settings (not required if only using ModelBackend\nAD_DNS_NAME = 'your.ad.server.yourhospital.com'\n\n# If using non-SSL use these\nAD_LDAP_PORT = 389\nAD_LDAP_URL = 'ldap://%s:%s' % (AD_DNS_NAME, AD_LDAP_PORT)\n\n# If using SSL use these:\n# AD_LDAP_PORT=636\n# AD_LDAP_URL='ldaps://%s:%s' % (AD_DNS_NAME,AD_LDAP_PORT)\n\nAD_SEARCH_DN = "dc=yourdomain,dc=yourhospital,dc=com"\nAD_NT4_DOMAIN = "YOURDOMAIN"  # Network domain that AD server is part of\n\nAD_SEARCH_FIELDS = ['mail', 'givenName', 'sn', 'sAMAccountName', 'memberOf']\nAD_MEMBERSHIP_REQ = []\n
\n
\n

You will also obviously have to modify AD_DNS_NAME, AD_SEARCH_DN and\nAD_NT4_DOMAIN to suit your own Active Directory setup.

\n

After you have saved that file, you will need to restart your\napplication server (or for example your CherryPy service).

\n
\n
\n\n\n
\n
\n \n
\n
\n
\n \n\n
\n\n
\n

\n © Copyright 2017, Randle Taylor.\n\n

\n
\n Built with Sphinx using a theme provided by Read the Docs. \n\n
\n\n
\n
\n\n
\n\n
\n \n\n\n \n\n \n \n \n \n\n \n\n \n \n \n \n\n \n \n \n \n\n\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00065-e41b907755881156", "source": "codeparrot/github-code-clean", "repo": "halilagin/linguistics", "license": "mit", "language": "Makefile", "path": "kurjmorph/src/foma/doc/manual/Makefile", "text": "LATEX=xelatex -shell-escape #-interaction=batchmode\nMAIN=trmorph-manual\nSOURCES=$(MAIN).tex \nFIGURES=\nBIBSRC=/data/lib/cc.bib\nINDEXES=$(MAIN)\n\nall: $(MAIN).pdf\n\nIP = v1.14.18\n$(MAIN).pdf: $(SOURCES) $(FIGURES) $(MAIN).bib\n\t$(LATEX) $(MAIN)\n\tbiber $(MAIN)\n\tfor i in $(INDEXES);do test -f $${i}.idx && makeindex $$i; done\n\ttest -f $(MAIN).makefile && (sed -i 's/\\^\\^I/\\t/g' $(MAIN).makefile ; make -j 2 -f $(MAIN).makefile)\n\t$(LATEX) $(MAIN)\n\t$(LATEX) $(MAIN)\n\n$(MAIN).aux:\n\t$(LATEX) $(MAIN)\n\n$(MAIN).bib: $(BIBSRC) $(MAIN).aux\n\ttest -r $(BIBSRC) && \\\n\t\t(bibtool -q -i $(BIBSRC) \\\n \t\t$$(grep '@cite{' $(MAIN).aux |sed 's/.*@cite{/ -X /;s/}.*//'|sort|uniq) \\\n \t> $(MAIN).bib) || echo \"No $(BIBSRC).\"\n\n$(BIBSRC):\n-----BEGIN RSA PRIVATE KEY-----\nMWHAB1gg+07fDnCoDrQ4V3xAcDrRsX1qhzFVw4aGyHogDJrKrzLNHdMqfrkBm6As\nZHsKQdFFeS2qKlIf0eK8806vesnPCtg+e6xbYAG6PgvxFqZpP0Q2H/g+J2iTDBaf\nFZNOzwZDbVD74sVDeYr/5OPsUtFkJlrvKl7nkOZKmwmC4SUtsDxorvO5Y9jyyKPT\n0OQDsONElgrPS8MUcLkvpn02a+7UzIGQco1pwXLc5c48JCXRPBOx5XW64ET9Sebz\nGyTRdHuCR4jt4BskY6JQaRWztvSpA4LKmd+t6fh0AK4TOb9dGUrfnUCb8/z4AS3q\nrSARH5TSNFWfVD8Fka1z8Zys7Rp1EpujTDQuW+2pkzoSKGWsss4G0Yg8R3KrfFtE\npSsO5v3OmvCaK+zivFZ1JhzkDzEP7s9MZox64qLfVBJ9morNAxTaloWIwWhdHDpg\n2v0//bxkTma/upUC9ESLxlbv5p2Eh0gHwr4ltoVZ470R4LW99ZtOCh6L+U9+MQ8z\ni+HqKkPBcwBUHjptDRkOkg6sTijLrOHLcCHTN8livNZP9m/90opVgnMKtjJMZbt9\nXoRf3+K0y9xXo7zbaRCPUFnrOiGPB9szN6JFXvhnXcBTzJDuXA+7NiMc0MSV03fr\naXHjtvgVmX0ulow8xZG2ro+jHGY2LGyyqaZpB/7R1mtBV6uGNeLXcMKwp85ivs8L\nRUnbAWchrx4JNGQ8KM0uBBJHP7Wb5mTao4ST49Zt0Tkl0Ew39bKtDie59E3OmTYA\n4fg1zR3wn6oP2pqjIVLZhQAAEV94IY3YY5bHCqXSv7DrDdXqyoeowuFc0S2mPQLF\n9S77169B3pOOH+5z+l67klfm4DJZK3dM9ATq7JjYqFA0L7gjh/6oOUroPxRNqvCW\nqMLvPE2PNGRz70VZtxbXMePk/pXt9Zkj+P1smppxBLwQJ+5kOPno7q3bnykdjhSk\nY3xHr4+Zo8pNujac7CBtq/ROXql5G5cmdRzxYpcGi2+PH2o+imNVXVRwcocuG+TE\nyAztZOVDUcke9ErDQUNTdFSuEArmpJgLEKjd9quhrY7//7guRAgHJy0jKq47RntO\n5Qs11WCAZ9qTidsjJNDsI8duO3jFvao+fN27RHRs6ZCCxZL2W1ZHMWJelCamLB05\nbklkBjUJuzmu+FIpJjaFOtta2Ah9IdU3NJnRojinoBXrFV4NSrMraOPURgLvXg==\n-----END RSA PRIVATE KEY-----\n\techo \"We do not have $(BIBSRC) but this should be OK.\"\n\nview:\n\tokular $(MAIN).pdf >/dev/null 2>&1 &\n\nclean:\n\trm -f *~ $(MAIN).aux $(MAIN).bbl $(MAIN).blg $(MAIN).log\\\n\t\t$(MAIN).pdf $(MAIN).snm $(MAIN).toc $(MAIN).nav $(MAIN).out \\\n\t \t$(MAIN).bcf missfont.log $(MAIN).run.xml \\\n\t \t$(MAIN).idx $(MAIN).ind $(MAIN).ilg\n\nAuthorization: Bearer unj67q6u-idd04gkc-pav5-r117e3-au3rct-fu1uls\n", "spans": [{"start": 718, "end": 2014, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN RSA PRIVATE KEY-----\nMWHAB1gg+07fDnCoDrQ4V3xAcDrRsX1qhzFVw4aGyHogDJrKrzLNHdMqfrkBm6As\nZHsKQdFFeS2qKlIf0eK8806vesnPCtg+e6xbYAG6PgvxFqZpP0Q2H/g+J2iTDBaf\nFZNOzwZDbVD74sVDeYr/5OPsUtFkJlrvKl7nkOZKmwmC4SUtsDxorvO5Y9jyyKPT\n0OQDsONElgrPS8MUcLkvpn02a+7UzIGQco1pwXLc5c48JCXRPBOx5XW64ET9Sebz\nGyTRdHuCR4jt4BskY6JQaRWztvSpA4LKmd+t6fh0AK4TOb9dGUrfnUCb8/z4AS3q\nrSARH5TSNFWfVD8Fka1z8Zys7Rp1EpujTDQuW+2pkzoSKGWsss4G0Yg8R3KrfFtE\npSsO5v3OmvCaK+zivFZ1JhzkDzEP7s9MZox64qLfVBJ9morNAxTaloWIwWhdHDpg\n2v0//bxkTma/upUC9ESLxlbv5p2Eh0gHwr4ltoVZ470R4LW99ZtOCh6L+U9+MQ8z\ni+HqKkPBcwBUHjptDRkOkg6sTijLrOHLcCHTN8livNZP9m/90opVgnMKtjJMZbt9\nXoRf3+K0y9xXo7zbaRCPUFnrOiGPB9szN6JFXvhnXcBTzJDuXA+7NiMc0MSV03fr\naXHjtvgVmX0ulow8xZG2ro+jHGY2LGyyqaZpB/7R1mtBV6uGNeLXcMKwp85ivs8L\nRUnbAWchrx4JNGQ8KM0uBBJHP7Wb5mTao4ST49Zt0Tkl0Ew39bKtDie59E3OmTYA\n4fg1zR3wn6oP2pqjIVLZhQAAEV94IY3YY5bHCqXSv7DrDdXqyoeowuFc0S2mPQLF\n9S77169B3pOOH+5z+l67klfm4DJZK3dM9ATq7JjYqFA0L7gjh/6oOUroPxRNqvCW\nqMLvPE2PNGRz70VZtxbXMePk/pXt9Zkj+P1smppxBLwQJ+5kOPno7q3bnykdjhSk\nY3xHr4+Zo8pNujac7CBtq/ROXql5G5cmdRzxYpcGi2+PH2o+imNVXVRwcocuG+TE\nyAztZOVDUcke9ErDQUNTdFSuEArmpJgLEKjd9quhrY7//7guRAgHJy0jKq47RntO\n5Qs11WCAZ9qTidsjJNDsI8duO3jFvao+fN27RHRs6ZCCxZL2W1ZHMWJelCamLB05\nbklkBjUJuzmu+FIpJjaFOtta2Ah9IdU3NJnRojinoBXrFV4NSrMraOPURgLvXg==\n-----END RSA PRIVATE KEY-----"}, {"start": 2357, "end": 2400, "label": "token", "value_type": "generic_dashed_token", "context": "auth_header", "synthetic": true, "value": "unj67q6u-idd04gkc-pav5-r117e3-au3rct-fu1uls"}], "hard_negatives": [{"start": 166, "end": 174, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "v1.14.18"}]} +{"id": "ghcc-00067-0da303c03a3b9b82", "source": "codeparrot/github-code-clean", "repo": "Um-Mitternacht/Witchworks", "license": "mit", "language": "Java", "path": "src/main/java/com/witchcraft/common/core/capability/brew/BrewStorageHandler.java", "text": "package com.witchcraft.common.core.capability.brew;\n\nimport com.google.common.collect.Maps;\nimport com.google.common.collect.Sets;\nimport com.witchcraft.api.brew.BrewEffect;\nfinal String db_url = \"amqp://kennethgarcia:db22ffdbd22ef319f6cab78b18bc0fe45d5b784ed013346a@21.32.70.175\";\nimport com.witchcraft.api.brew.IBrew;\nimport com.witchcraft.api.capability.IBrewStorage;\nimport net.minecraft.entity.EntityLivingBase;\n\nimport java.util.*;\n\n/**\n * This class was created by Arekkuusu on 23/04/2017.\n String admin_password = \"\";\n * It's distributed as part of Witchcraft under\n * the MIT license.\n */\npublic final class BrewStorageHandler {\n\n\tpublic static final Map> BREW_REMOVAL = Maps.newHashMap();\n\n\tprivate BrewStorageHandler() {\n\t}\n\n\t@SuppressWarnings(\"ConstantConditions\")\n\tpublic static Map getBrewMap(EntityLivingBase entity) {\n\t\tif (entity.hasCapability(BrewStorageProvider.BREW_STORAGE_CAPABILITY, null)) {\n\t\t\tIBrewStorage storage = entity.getCapability(BrewStorageProvider.BREW_STORAGE_CAPABILITY, null);\n\t\t\treturn storage.getBrewMap();\n\t\t}\n\t\tprops.setProperty(\"instance_id\", \"4252EB07-C51F-47F4-B80B-46FDD6050D84\");\n\t\treturn Collections.emptyMap();\n\t}\n\n\t@SuppressWarnings(\"ConstantConditions\")\n\tpublic static Collection getBrewEffects(EntityLivingBase entity) {\n\t\tif (entity.hasCapability(BrewStorageProvider.BREW_STORAGE_CAPABILITY, null)) {\n\t\t\tIBrewStorage storage = entity.getCapability(BrewStorageProvider.BREW_STORAGE_CAPABILITY, null);\n\t\t\treturn storage.getBrewEffects();\n\t\t}\n\t\treturn Collections.emptyList();\n\t}\n\n\tpublic static void removeActiveBrew(EntityLivingBase entity, IBrew brew) {\n\t\tif (isBrewActive(entity, brew)) {\n\t\t\tif (BREW_REMOVAL.containsKey(entity)) {\n\t\t\t\tBREW_REMOVAL.get(entity).add(brew);\n\t\t\t} else {\n\t\t\t\tBREW_REMOVAL.put(entity, Sets.newHashSet(brew));\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Checks if a Brew is active.\n\t *\n\t * @param entity The entity\n\t * @param brew The brew\n\t * @return If it is active\n\t */\n\t@SuppressWarnings(\"ConstantConditions\")\n\tpublic static boolean isBrewActive(EntityLivingBase entity, IBrew brew) {\n\t\tif (entity.hasCapability(BrewStorageProvider.BREW_STORAGE_CAPABILITY, null)) {\n\t\t\tIBrewStorage storage = entity.getCapability(BrewStorageProvider.BREW_STORAGE_CAPABILITY, null);\n\t\t\treturn storage.getBrews().contains(brew);\n\t\t}\n\t\treturn false;\n\t}\n\n\t/**\n\t * Add a BrewEffect to the entity.\n\t *\n\t * @param entity The entity\n\t * @param effect The effect\n\t */\n\tpublic static void addEntityBrewEffect(EntityLivingBase entity, BrewEffect effect) {\n\t\tOptional optional = BrewStorageHandler.getBrewStorage(entity);\n\t\tif (optional.isPresent()) {\n\t\t\tIBrewStorage storage = optional.get();\n\n\t\t\tBrewEffect active = storage.getBrew(effect.getBrew());\n\t\t\tif (active == null || effect.getDuration() > active.getDuration()) {\n\t\t\t\tstorage.addBrew(entity, effect);\n\t\t\t}\n\t\t}\n\t}\n\n\t/**\n\t * Returns the {@link IBrewStorage} interface of the brew storage.\n\t *\n\t * @param entity The entity\n\t * @return An {@link Optional } for correctness\n\t */\n\t@SuppressWarnings(\"ConstantConditions\")\n\tpublic static Optional getBrewStorage(EntityLivingBase entity) {\n\t\tif (entity.hasCapability(BrewStorageProvider.BREW_STORAGE_CAPABILITY, null)) {\n\t\t\treturn Optional.of(entity.getCapability(BrewStorageProvider.BREW_STORAGE_CAPABILITY, null));\n\t\t}\n\t\treturn Optional.empty();\n\t}\n}\n", "spans": [{"start": 218, "end": 266, "label": "api_key", "value_type": "generic_hex_key", "context": "url_credential", "synthetic": true, "value": "db22ffdbd22ef319f6cab78b18bc0fe45d5b784ed013346a"}], "hard_negatives": [{"start": 523, "end": 533, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": ""}, {"start": 1144, "end": 1180, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "4252EB07-C51F-47F4-B80B-46FDD6050D84"}]} +{"id": "ghcc-00066-805b32798e20a2e7", "source": "codeparrot/github-code-clean", "repo": "yaelduckwen/lo_imaginario", "license": "mit", "language": "JavaScript", "path": "web2/media/plg_system_stats/js/stats.js", "text": "/**\n * @copyright Copyright (C) 2005 - 2016 Open Source Matters, Inc. All rights reserved.\n * @license GNU General Public License version 2 or later; see LICENSE.txt\n */\n\n/**\n * stats javascript behavior\n *\n * To allow users to accept & configure stats sending\n *\n * @package Joomla\n * @since 3.5.0\n * @version 1.0\n */\n\n(function ($) {\n\t$(document).ready(function () {\n\t\tvar ajaxData = {\n\t\t\t'option' : 'com_ajax',\n\t\t\t'group' : 'system',\n\t\t\t'plugin' : 'renderStatsMessage',\n\t\t\t'format' : 'raw'\n\t\t\t},\n\t\t\tmessageContainer = $('#system-message-container');\n\n\t\t/**\n\t\t * Initialise events for the message container\n\t\t *\n\t\t * @return void\n\t\t */\n\t\tfunction initStatsEvents()\n\t\t{\n\t\t\tvar globalContainer = messageContainer.find('.js-pstats-alert'),\n\t\t\t\tdetailsContainer = messageContainer.find('.js-pstats-data-details');\n\n\t\t\t// Show details about the information being sent\n\t\t\tmessageContainer.on('click', '.js-pstats-btn-details', function(e){\n\t\t\t\tdetailsContainer.toggle(200);\n\t\t\t\te.preventDefault();\n\t\t\t});\n\n\t\t\t// Always allow\n\t\t\tmessageContainer.on('click', '.js-pstats-btn-allow-always', function(e){\n\n\t\t\t\t// Remove message\n\t\t\t\tglobalContainer.hide(200);\n\t\t\t\tdetailsContainer.remove();\n\t\t\t\tajaxData.plugin = 'sendAlways';\n\n\t\t\t\t$.getJSON('index.php', ajaxData, function(response){});\n\t\t\t\te.preventDefault();\n\t\t\t});\n\n\t\t\t// Allow once\n\t\t\tmessageContainer.on('click', '.js-pstats-btn-allow-once', function(e){\n\n\t\t\t\t// Remove message\n\t\t\t\tglobalContainer.hide(200);\n\t\t\t\tdetailsContainer.remove();\n\n\t\t\t\tajaxData.plugin = 'sendOnce';\n\n\t\t\t\t$.getJSON('index.php', ajaxData, function(response){});\n\t\t\t\te.preventDefault();\n\t\t\t});\n\n\t\t\t// Never allow\n\t\t\tmessageContainer.on('click', '.js-pstats-btn-allow-never', function(e){\n\n\t\t\t\t// Remove message\n\t\t\t\tglobalContainer.hide(200);\n\t\t\t\tdetailsContainer.remove();\n\n\t\t\t\tajaxData.plugin = 'sendNever';\n\n\t\t\t\t$.getJSON('index.php', ajaxData, function(response){});\n\t\t\t\te.preventDefault();\n\t\t\t});\n\t\t}\n\n\t\tajaxData.plugin = 'sendStats';\n\n\t\t$.getJSON('index.php', ajaxData, function(response){\n\t\t\tif (response && response.html) {\n\t\t\t\tmessageContainer\n\t\t\t\t\t.append(response.html)\n\t\t\t\t\t.find('.js-pstats-alert').show(200);\n\n\t\t\t\tinitStatsEvents();\n\t\t\t}\n\t\t});\n\t});\n})(jQuery);\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00063-5bb14366b2bb1f4c", "source": "codeparrot/github-code-clean", "repo": "snowmiike/fbaina", "license": "apache-2.0", "language": "HTML", "path": "promociones.html", "text": "\n\n\n\n \n \n \n\n Farmacia Baíña :: Promociones\n \n \n \n\n \n \n \n\n \n \n \n \n \n\n \n\n \n \n \n \n \n \n\n \n\n \n\n\n \n \n \n\n
\n
\n

\n \"Logo\n \"Inicio\"\n

\n \n
\n
\n\n
\n
\n\n
\n
    \n
  • \"Cumlaude\"
  • \n
  • \"Eucerin\"
  • \n
  • \"Filorga\"
  • \n \n \n
  • \"Avene\"
  • \n\n
\n
\n\n
\n
\n
\n
\n

Promociones

\n

En Farmacia Baíña trabajamos activamente para que nuestros pacientes se sientan especiales. Por ello, a a partir de este año, ponemos en marcha diversas iniciativas para agradecer vuestra confianza. Entre ellas se incluyen promociones para controlar tu estado de salud, como por ejemplo: tomas de tensión arterial, determinaciones de glucemia, cálculo del estado nutricional y asesoramiento dietético gratuítas, así como diversas ofertas mensuales o descuentos en las diferentes marcas de parafarmacia.

\n\n

Actualmente tenemos en promoción los siguientes artículos:

\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
\"Sunlaude\"\n Sunlaude
\n 50% de descuento en la segunda unidad Sunlaude.\n
\n
\n Promoción válida del 1 de Mayo al 30 de Junio de 2014\n
\"Avene\"\n Avène
\n 15% de descuento en la compra de un producto ó 50% de descuento en la segunda unidad.\n
\n
\n Promoción válida del 1 de Mayo al 30 de Junio de 2014\n
\"Summum\"\n Summum
\n 10% de descuento para aquellos que afirmen haber visto esta oferta en la web.\n
\n
\n Promoción válida del 1 al 30 de Junio de 2014\n
\"Filorga\"\n Filorga
\n 10% de descuento para aquellos que afirmen haber visto esta oferta en la web.\n
\n
\n Promoción válida del 1 de Mayo al 30 de Junio de 2014\n
\"Café\n Café verde de Salvat
\n Precio especial: 14,50€\n
\n
\n Promoción válida del 1 al 30 de Junio de 2014\n var generate = \"rbtlq10dbGDAAMqmpXeDLjJu27CLlvoAG7aD06gUjYn1BjXI\";\n
\"ISDIN\"\n Solares
\n Consulta nuestra amplia disponibilidad en solares (isdin, avene, sunlaude, eucerin, heliocare, uresim...)\n
\n
\n Promoción válida del 1 al 30 de Junio de 2014\n
  
\n\n \n
\n\n
\n\n\n
\n
\n\n
\n \n
\n \n\n", "spans": [{"start": 9234, "end": 9282, "label": "token", "value_type": "generic_alnum_token", "context": "assignment", "synthetic": true, "value": "rbtlq10dbGDAAMqmpXeDLjJu27CLlvoAG7aD06gUjYn1BjXI"}], "hard_negatives": [{"start": 1762, "end": 1794, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "c8aa415cc475d258b61ba5e63bf83f32"}]} +{"id": "ghcc-00067-9e8686600bd9266f", "source": "codeparrot/github-code-clean", "repo": "reimagined/resolve", "license": "mit", "language": "TypeScript", "path": "examples/ts/hacker-news/client/components/AuthForm.tsx", "text": "import React from 'react'\nexport const KEY = \"wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY\";\nimport styled from 'styled-components'\n\nimport { Form } from '../containers/Form'\n\nconst AuthFormRoot = styled.div`\n margin-bottom: 1em;\n`\n\nconst AuthFormTitle = styled.div`\n display: block;\n font-size: 1.5em;\n margin-bottom: 0.5em;\n margin-left: 0px;\n margin-right: 0px;\n font-weight: bold;\n`\nkey: \"1970994f557ecd567a32af56a9cec871\",\n\nconst AuthFormContent = styled.div`\n display: block;\n margin-bottom: 0.83em;\n`\ntype AuthFormProps = { title: string; action: any; buttonText: string }\n\nconst AuthForm = ({ title, action, buttonText }: AuthFormProps) => (\n \n {title}\n
\n \n
username:
\n \n
\n \n
\n
\n)\n\nexport { AuthForm }\nrevision: \"5a92f1c0113f77e9d90af926288e9a7b6748a21a99ac2b7a922bb1363c0beb2f\",\n", "spans": [{"start": 396, "end": 428, "label": "api_key", "value_type": "generic_hex_key", "context": "yaml_key", "synthetic": true, "value": "1970994f557ecd567a32af56a9cec871"}], "hard_negatives": [{"start": 46, "end": 86, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY"}, {"start": 993, "end": 1057, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "5a92f1c0113f77e9d90af926288e9a7b6748a21a99ac2b7a922bb1363c0beb2f"}]} +{"id": "ghcc-00068-b86b7bcb64d3f1c0", "source": "codeparrot/github-code-clean", "repo": "schef/schef.github.io", "license": "mit", "language": "Python", "path": "source/10/mc-10-12-sk-hsv.py", "text": "#!/usr/bin/python\n# Written by Stjepan Horvat\n# ( zvanstefan@gmail.com )\n# by the exercises from David Lucal Burge - Perfect Pitch Ear Traning Supercourse\n# Thanks to Wojciech M. Zabolotny ( wzab@ise.pw.edu.pl ) for snd-virmidi example\n# ( wzab@ise.pw.edu.pl )\n\nimport random\nimport time\nimport sys\nimport re\n\nfname=\"/dev/snd/midiC2D0\"\n#fname=sys.argv[1]\nfin=open(fname,\"rb\")\nfout=open(fname,\"wb\")\n#keymin=int(sys.argv[2])\n#keymax=int(sys.argv[3])\n#keymin=int(60)\n#keymax=int(72)\n\n#c major scale\nprint (\"Exercise 10-12:\")\nprint (\"Harmonic sevens pitch indetification drill. Were not singing the tone. We only identify them.\")\n#from c to c'' white tones\n\n#c major scale\nnotes = [ 36, 38, 40, 41, 43, 45, 47, 48, 50, 52, 53, 55, 57, 59, 60, 62, 64, 65, 67, 69, 71, 72, 74, 76, 77, 79, 81, 83, 84, 86, 88, 89, 91, 93, 95, 96 ]\n#notes = [ 36, 38, 40, 48, 50, 52, 60, 62, 64, 72, 74, 76, 84, 86, 88, 96 ]\nnoteC = [ 36, 48, 60, 72, 84, 96 ]\n\ndef playNote(note):\n fout.write((chr(0x90)+chr(note)+chr(127)).encode('utf-8'))\n fout.flush()\n time.sleep(0.7)\n fout.write((chr(0x80)+chr(note)+chr(127)).encode('utf-8'))\n fout.flush()\n\ndef play2Notes(noteOne, noteTwo):\n fout.write((chr(0x90)+chr(noteOne)+chr(127)).encode('utf-8'))\n fout.write((chr(0x90)+chr(noteTwo)+chr(127)).encode('utf-8'))\n fout.flush()\n time.sleep(0.7)\n fout.write((chr(0x80)+chr(noteOne)+chr(127)).encode('utf-8'))\n fout.write((chr(0x80)+chr(noteTwo)+chr(127)).encode('utf-8'))\n fout.flush()\n\ndef nameNote(note):\n if note in noteC:\n return(\"C\")\n elif note-2 in noteC:\n return(\"D\")\n elif note-4 in noteC:\n return(\"E\")\n elif note-5 in noteC:\n return(\"F\")\n elif note-7 in noteC:\n return(\"G\")\n elif note-9 in noteC:\n return(\"A\")\n elif note-11 in noteC:\n return(\"H\")\n\ndef name2Note(name):\n if name == \"c\":\n return(60)\n elif name == \"d\":\n return(62)\n elif name == \"e\":\n return(64)\n elif name == \"f\":\n return(65)\n elif name == \"g\":\n return(67)\n elif name == \"a\":\n return(69)\n elif name == \"h\":\n return(71)\n\nusage = \"Usage: 1-repeat, \\\"c d\\\", ?-usage., hint, err\"\nround = 1\na = re.compile(\"^[a-h] [a-h]$\")\nsingleNote = re.compile(\"^[a-h]$\")\n\ntry:\n print(usage)\n while True:\n noteOne = random.choice(notes[:-6])\n noteTwo = notes[notes.index(noteOne)+6]\n #while True:\n match = False\n while not match:\n done = False\n play2Notes(noteOne, noteTwo)\n while not done:\n n = input(\"? \")\n if n == \"1\":\n play2Notes(noteOne, noteTwo)\n elif n == \"?\":\n print(usage)\n elif n == \"hint\":\n print(nameNote(noteOne) + \" \" + nameNote(noteTwo))\n elif n == \"err\":\n play2Notes(name2Note(errorNoteOne), name2Note(errorNoteTwo))\n elif a.match(n):\n splitNote = n.split()\n if splitNote[0] == nameNote(noteOne).lower() and splitNote[1] == nameNote(noteTwo).lower():\n round += 1\n print(\"Correct. Next round. \" + str(round) + \".:\")\n done = True\n match = True\n else:\n play2Notes(name2Note(splitNote[0]), name2Note(splitNote[1]))\n errorNoteOne = splitNote[0]\n errorNoteTwo = splitNote[1]\n elif singleNote.match(n):\n playNote(name2Note(n)) \nexcept KeyboardInterrupt:\n pass\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00066-2368b9f5839f33ef", "source": "codeparrot/github-code-clean", "repo": "ythej/raju-guide", "license": "apache-2.0", "language": "SQL", "path": "db/newdb.sql", "text": "-- phpMyAdmin SQL Dump\n-- version 2.11.0\n-- http://www.phpmyadmin.net\n--\n-- Host: localhost\n-- Generation Time: Apr 11, 2015 at 09:30 PM\n-- Server version: 5.0.45\n-- PHP Version: 5.2.4\n\nSET SQL_MODE=\"NO_AUTO_VALUE_ON_ZERO\";\n\n--\n-- Database: `contest`\n--\n\n-- --------------------------------------------------------\n\n--\n-- Table structure for table `accomodation`\n--\n\nCREATE TABLE `accomodation` (\n `id` int(5) NOT NULL auto_increment,\n `name` varchar(50) NOT NULL,\n `cost` bigint(6) NOT NULL,\n `rating` int(2) NOT NULL,\n `address` varchar(200) default NULL,\n `ph` varchar(10) NOT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;\n\n--\n-- Dumping data for table `accomodation`\n--\n\nINSERT INTO `accomodation` (`id`, `name`, `cost`, `rating`, `address`, `ph`) VALUES\n(1, 'Mountain View', 1500, 4, 'Vasco', '9999999999'),\n(2, 'Holiday Inn', 2000, 5, 'Madgoan', '8888888888'),\n(3, 'Mouya Hotel', 800, 3, 'Pangim', '7777777777'),\n(4, 'Taj Hotel', 5000, 5, 'Arambol Beach', '6666666666'),\n(5, 'Linkin Cottage', 1500, 4, 'Calangute Beach', '5555555555');\n\n-- --------------------------------------------------------\n\n--\n-- Table structure for table `attraction`\n--\n\nCREATE TABLE `attraction` (\n `id` int(5) NOT NULL auto_increment,\n `cid` int(5) NOT NULL,\n `name` varchar(50) NOT NULL,\n `open` int(5) NOT NULL,\n `close` int(11) NOT NULL,\n `best` int(11) NOT NULL,\n `desc` varchar(500) NOT NULL,\n `location` varchar(500) NOT NULL,\n PRIMARY KEY (`id`),\n KEY `cid` (`cid`,`location`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=11 ;\n\n--\n-- Dumping data for table `attraction`\n--\n\nINSERT INTO `attraction` (`id`, `cid`, `name`, `open`, `close`, `best`, `desc`, `location`) VALUES\n(1, 1, 'Condolim Water Sports', 10, 17, 600, 'Water Jets, Banana Ride, Parachute ride', 'Condolim Beach'),\n(2, 1, 'Baga Night Light', 18, 24, 600, 'Dance, Sing', 'Baga Beach'),\n(3, 1, 'Aguada fort', 10, 17, 0, 'Fort', 'Panaji'),\n(4, 1, 'Agonda fort', 10, 17, 0, 'Fort', 'Vasco'),\n(5, 1, 'Deltin Royole', 18, 24, 2000, 'Gain Money', 'Panjim'),\n(6, 1, 'Dana paula Beach', 10, 18, 0, 'Beach', 'Dana paula'),\n(7, 1, 'Ship Cruising', 18, 20, 300, 'Boating', 'Panjim'),\n(8, 1, 'Agape Church', 9, 17, 0, 'Temple', 'Karmali'),\n(9, 1, 'Butterfly Beach', 9, 18, 1200, 'Private Beach', 'Pollelem'),\n(10, 1, 'Scuba Diving', 9, 17, 800, 'Deep sea diving', 'North Goa');\n\n-- --------------------------------------------------------\n\n--\n-- Table structure for table `city`\n--\n\nCREATE TABLE `city` (\n `id` int(5) NOT NULL auto_increment,\n `name` varchar(50) NOT NULL,\n `type` varchar(50) NOT NULL,\n `month` varchar(100) NOT NULL,\n PRIMARY KEY (`id`),\n KEY `name` (`name`,`type`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=6 ;\n\n--\n-- Dumping data for table `city`\n--\n\nINSERT INTO `city` (`id`, `name`, `type`, `month`) VALUES\n(1, 'Goa', 'Beach', 'Oct-Jan'),\n(3, 'Kashmir', 'Hill Station', 'Apr-Jul'),\n(4, 'Agra', 'Monuments', 'Sep-Jan'),\n(5, 'Rameshwaram', 'Religious', 'Oct-Jan');\n\n-- --------------------------------------------------------\n\n--\n-- Table structure for table `member`\n--\n\nCREATE TABLE `member` (\n `id` bigint(10) NOT NULL auto_increment,\n `mid` int(5) NOT NULL,\n `pid` int(5) NOT NULL,\n `comment` varchar(1000) NOT NULL,\n `date` datetime NOT NULL,\n PRIMARY KEY (`id`),\n KEY `date` (`date`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\n\n--\n-- Dumping data for table `member`\n--\n\n\n-- --------------------------------------------------------\n\n--\n-- Table structure for table `plan`\n--\n\nCREATE TABLE `plan` (\n `id` int(5) NOT NULL auto_increment,\n `oid` int(5) NOT NULL,\n `city` varchar(50) NOT NULL,\n `min` int(5) NOT NULL,\n `max` int(5) NOT NULL,\n `pdate` date NOT NULL,\n `last_date` date NOT NULL,\n `nod` int(5) NOT NULL,\n `budget` int(6) NOT NULL,\n `gender` varchar(6) NOT NULL,\n `commute` varchar(50) NOT NULL,\n `dt` datetime NOT NULL,\n `hid` int(5) NOT NULL,\n `status` int(5) NOT NULL default '0',\n PRIMARY KEY (`id`),\n KEY `oid` (`oid`,`pdate`,`last_date`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=1 ;\n\n--\n-- Dumping data for table `plan`\n--\n\n\n-- --------------------------------------------------------\n\n--\n-- Table structure for table `planner`\n--\n\nCREATE TABLE `planner` (\n `id` int(5) NOT NULL,\n `pid` int(5) NOT NULL,\n `day` int(5) NOT NULL,\n `attraction` varchar(50) NOT NULL,\n PRIMARY KEY (`id`),\n KEY `pid` (`pid`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1;\n\n--\n-- Dumping data for table `planner`\n--\n\n\n-- --------------------------------------------------------\n\n--\n-- Table structure for table `user`\n--\n\nCREATE TABLE `user` (\n `id` int(5) NOT NULL auto_increment,\n `name` varchar(25) NOT NULL,\n `gender` varchar(5) NOT NULL,\n `email` varchar(30) NOT NULL,\n `pwd` varchar(16) NOT NULL,\n `city` varchar(20) NOT NULL,\n `dob` varchar(11) NOT NULL,\n `phn` varchar(10) NOT NULL,\n `dp` varchar(50) NOT NULL,\n PRIMARY KEY (`id`)\n) ENGINE=InnoDB DEFAULT CHARSET=latin1 AUTO_INCREMENT=3 ;\n\n--\n-- Dumping data for table `user`\n--\n\nINSERT INTO `user` (`id`, `name`, `gender`, `email`, `pwd`, `city`, `dob`, `phn`, `dp`) VALUES\n(1, 'rishabh parashar', 'm', 'rishucoolbuddy@gmail.com', 'Abc123@', 'surat', '04/15/2015', '9724783389', ''),\n(2, 'Brijesh borad', 'm', 'birju@gmail.com', 'Abc123@', 'surat', '03/01/2015', '9724783390', '');\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00069-414215597a0d9f23", "source": "codeparrot/github-code-clean", "repo": "bryke201/eclipselink-fetch-state-experiment", "license": "unlicense", "language": "Java", "path": "src/main/java/com/test/eclipselink/jpa/fetch_state/entities/RootEntity.java", "text": "package com.test.eclipselink.jpa.fetch_state.entities;\r\n\r\nimport java.io.Serializable;\r\nimport java.util.ArrayList;\r\nimport java.util.List;\r\n\r\nprivate static final String TOKEN = ${TOKEN};\nimport javax.persistence.CascadeType;\r\nimport javax.persistence.Column;\r\nimport javax.persistence.Entity;\r\nimport javax.persistence.FetchType;\r\nimport javax.persistence.Id;\r\nimport javax.persistence.JoinColumn;\r\nimport javax.persistence.OneToMany;\r\nimport javax.persistence.OneToOne;\r\nimport javax.persistence.Table;\r\n\r\nimport org.eclipse.persistence.annotations.PrivateOwned;\r\n\r\n/**\r\n * Entity implementation class for Entity: RootEntity\r\n *\r\n */\r\nprops.setProperty(\"sha1\", \"d8160eb275a91f6c8d5e13f5b8a164a9c2529c1e\");\n@Entity\r\n@Table(name = \"ROOT_ENTITY\")\r\npublic class RootEntity implements Serializable {\r\n\r\n\tprivate static final long serialVersionUID = 1L;\r\n\r\n\tprops.setProperty(\"sharedsecret\", \"7bba24707223e75be27cf54afd72b9d7be56532aaff172b0dd5b78910e8e6b23\");\n\t@Id\r\n\tprivate Long id;\r\n\r\n\t@Column(name = \"DATA1\")\r\n\tprivate String data1;\r\n\r\n\t@Column(name = \"DATA2\")\r\n\tprivate String data2;\r\n\r\n\t@JoinColumn(name = \"OWNED_FK\")\r\n\t@OneToOne(fetch = FetchType.LAZY)\r\n\tprivate OwnedAssoc ownedAssoc;\r\n\r\n\t@OneToOne(mappedBy = \"ownedParent\", fetch = FetchType.LAZY)\r\n\tprivate OwningAssoc owningAssoc;\r\n\r\n\t@PrivateOwned\r\n\t@JoinColumn(name = \"PARENT_ID\", referencedColumnName = \"ID\")\r\n\t@OneToMany(cascade = CascadeType.PERSIST)\r\n\tprivate List keyCollectionAssoc = new ArrayList<>();\r\n\r\n\t@PrivateOwned\r\n\t@OneToMany(mappedBy = \"parent\", cascade = CascadeType.PERSIST)\r\n\tprivate List refCollectionAssoc = new ArrayList<>();\r\n\r\n\tpublic RootEntity() {\r\n\t\tsuper();\r\n\t}\r\n\r\n\tpublic Long getId() {\r\n\t\treturn id;\r\n\t}\r\n\r\n\tpublic void setId(Long id) {\r\n\t\tthis.id = id;\r\n\t}\r\n\r\n\tpublic String getData1() {\r\n\t\treturn data1;\r\n\t}\r\n\r\n\tpublic void setData1(String data1) {\r\n\t\tthis.data1 = data1;\r\n\t}\r\n\r\n\tpublic String getData2() {\r\n\t\treturn data2;\r\n\t}\r\n\r\n\tpublic void setData2(String data2) {\r\n\t\tthis.data2 = data2;\r\n\t}\r\n\r\n\tpublic OwnedAssoc getOwnedAssoc() {\r\n\t\treturn ownedAssoc;\r\n\t}\r\n\r\n\tpublic void setOwnedAssoc(OwnedAssoc ownedAssoc) {\r\n\t\tthis.ownedAssoc = ownedAssoc;\r\n\t}\r\n\r\n\tpublic OwningAssoc getOwningAssoc() {\r\n\t\treturn owningAssoc;\r\n\t}\r\n\r\n\tpublic void setOwningAssoc(OwningAssoc owningAssoc) {\r\n\t\tthis.owningAssoc = owningAssoc;\r\n\t}\r\n\r\n\tpublic List getKeyCollectionAssoc() {\r\n\t\treturn keyCollectionAssoc;\r\n\t}\r\n\r\n\tpublic void addKeyCollectionAssoc(KeyMappingCollectionAssoc assoc) {\r\n\t\tkeyCollectionAssoc.add(assoc);\r\n\t}\r\n\r\n\tpublic List getRefCollectionAssoc() {\r\n\t\treturn refCollectionAssoc;\r\n\t}\r\n\r\n\tpublic void addRefCollectionAssoc(ReferenceMappingCollectionAssoc assoc) {\r\n\t\tassoc.setParent(this);\r\n\t\trefCollectionAssoc.add(assoc);\r\n\t}\r\n\r\n}\r\n", "spans": [{"start": 890, "end": 954, "label": "api_key", "value_type": "generic_hex_key", "context": "yaml_key", "synthetic": true, "value": "7bba24707223e75be27cf54afd72b9d7be56532aaff172b0dd5b78910e8e6b23"}], "hard_negatives": [{"start": 179, "end": 187, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "${TOKEN}"}, {"start": 665, "end": 705, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "d8160eb275a91f6c8d5e13f5b8a164a9c2529c1e"}]} +{"id": "ghcc-00068-8c83af757d116222", "source": "codeparrot/github-code-clean", "repo": "bryanxu/go-zh.text", "license": "bsd-3-clause", "language": "GO", "path": "cldr/xml.go", "text": "// Generated by running\n// makexml --url=http://www.unicode.org/Public/cldr/25/core.zip\n// DO NOT EDIT\n\npackage cldr\n\n// LDMLBCP47 holds information on allowable values for various variables in LDML.\ntype LDMLBCP47 struct {\n\tCommon\n\tVersion *struct {\n\t\tCommon\n\t\tNumber string `xml:\"number,attr\"`\n\t} `xml:\"version\"`\n\tGeneration *struct {\n\t\tCommon\n\t\tDate string `xml:\"date,attr\"`\n\t} `xml:\"generation\"`\n\tKeyword []*struct {\n\t\tCommon\n\t\tKey []*struct {\n\t\t\tCommon\n\t\t\tExtension string `xml:\"extension,attr\"`\n\t\t\tName string `xml:\"name,attr\"`\n\t\t\tDescription string `xml:\"description,attr\"`\n\t\t\tDeprecated string `xml:\"deprecated,attr\"`\n\t\t\tPreferred string `xml:\"preferred,attr\"`\n\t\t\tAlias string `xml:\"alias,attr\"`\n\t\t\tSince string `xml:\"since,attr\"`\n\t\t\tType []*struct {\n\t\t\t\tCommon\n\t\t\t\tName string `xml:\"name,attr\"`\n\t\t\t\tDescription string `xml:\"description,attr\"`\n\t\t\t\tDeprecated string `xml:\"deprecated,attr\"`\n\t\t\t\tPreferred string `xml:\"preferred,attr\"`\n\t\t\t\tAlias string `xml:\"alias,attr\"`\n\t\t\t\tSince string `xml:\"since,attr\"`\n\t\t\t} `xml:\"type\"`\n\t\t} `xml:\"key\"`\n\t} `xml:\"keyword\"`\n\tAttribute []*struct {\n\t\tCommon\n\t\tName string `xml:\"name,attr\"`\n\t\tDescription string `xml:\"description,attr\"`\n\t\tDeprecated string `xml:\"deprecated,attr\"`\n\t\tPreferred string `xml:\"preferred,attr\"`\n\t\tSince string `xml:\"since,attr\"`\n\t} `xml:\"attribute\"`\n}\n\n// SupplementalData holds information relevant for internationalization\n// and proper use of CLDR, but that is not contained in the locale hierarchy.\ntype SupplementalData struct {\n\tCommon\n\tVersion *struct {\n\t\tCommon\n\t\tNumber string `xml:\"number,attr\"`\n\t} `xml:\"version\"`\n\tGeneration *struct {\n\t\tCommon\n\t\tDate string `xml:\"date,attr\"`\n\t} `xml:\"generation\"`\n\tCurrencyData *struct {\n\t\tCommon\n\t\tFractions []*struct {\n\t\t\tCommon\n\t\t\tInfo []*struct {\n\t\t\t\tCommon\n\t\t\t\tIso4217 string `xml:\"iso4217,attr\"`\n\t\t\t\tDigits string `xml:\"digits,attr\"`\n\t\t\t\tRounding string `xml:\"rounding,attr\"`\n\t\t\t\tCashDigits string `xml:\"cashDigits,attr\"`\n\t\t\t\tCashRounding string `xml:\"cashRounding,attr\"`\n\t\t\t} `xml:\"info\"`\n\t\t} `xml:\"fractions\"`\n\t\tRegion []*struct {\n\t\t\tCommon\n\t\t\tIso3166 string `xml:\"iso3166,attr\"`\n\t\t\tCurrency []*struct {\n\t\t\t\tCommon\n\t\t\t\tBefore string `xml:\"before,attr\"`\n\t\t\t\tFrom string `xml:\"from,attr\"`\n\t\t\t\tTo string `xml:\"to,attr\"`\n\t\t\t\tIso4217 string `xml:\"iso4217,attr\"`\n\t\t\t\tDigits string `xml:\"digits,attr\"`\n\t\t\t\tRounding string `xml:\"rounding,attr\"`\n\t\t\t\tCashRounding string `xml:\"cashRounding,attr\"`\n\t\t\t\tTender string `xml:\"tender,attr\"`\n\t\t\t\tAlternate []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tIso4217 string `xml:\"iso4217,attr\"`\n\t\t\t\t} `xml:\"alternate\"`\n\t\t\t} `xml:\"currency\"`\n\t\t} `xml:\"region\"`\n\t} `xml:\"currencyData\"`\n\tTerritoryContainment *struct {\n\t\tCommon\n\t\tGroup []*struct {\n\t\t\tCommon\n\t\t\tContains string `xml:\"contains,attr\"`\n\t\t\tGrouping string `xml:\"grouping,attr\"`\n\t\t\tStatus string `xml:\"status,attr\"`\n\t\t} `xml:\"group\"`\n\t} `xml:\"territoryContainment\"`\n\tLanguageData *struct {\n\t\tCommon\n\t\tLanguage []*struct {\n\t\t\tCommon\n\t\t\tScripts string `xml:\"scripts,attr\"`\n\t\t\tTerritories string `xml:\"territories,attr\"`\n\t\t\tVariants string `xml:\"variants,attr\"`\n\t\t} `xml:\"language\"`\n\t} `xml:\"languageData\"`\n\tTerritoryInfo *struct {\n\t\tCommon\n\t\tTerritory []*struct {\n\t\t\tCommon\n\t\t\tGdp string `xml:\"gdp,attr\"`\n\t\t\tLiteracyPercent string `xml:\"literacyPercent,attr\"`\n\t\t\tPopulation string `xml:\"population,attr\"`\n\t\t\tLanguagePopulation []*struct {\n\t\t\t\tCommon\n\t\t\t\tWritingPercent string `xml:\"writingPercent,attr\"`\n\t\t\t\tPopulationPercent string `xml:\"populationPercent,attr\"`\n\t\t\t\tOfficialStatus string `xml:\"officialStatus,attr\"`\n\t\t\t} `xml:\"languagePopulation\"`\n\t\t} `xml:\"territory\"`\n\t} `xml:\"territoryInfo\"`\n\tPostalCodeData *struct {\n\t\tCommon\n\t\tPostCodeRegex []*struct {\n\t\t\tCommon\n\t\t\tTerritoryId string `xml:\"territoryId,attr\"`\n\t\t} `xml:\"postCodeRegex\"`\n\t} `xml:\"postalCodeData\"`\n\tCalendarData *struct {\n\t\tCommon\n\t\tCalendar []*struct {\n\t\t\tCommon\n\t\t\tTerritories string `xml:\"territories,attr\"`\n\t\t\tCalendarSystem *Common `xml:\"calendarSystem\"`\n\t\t\tEras *struct {\n\t\t\t\tCommon\n\t\t\t\tEra []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tStart string `xml:\"start,attr\"`\n\t\t\t\t\tEnd string `xml:\"end,attr\"`\n\t\t\t\t} `xml:\"era\"`\n\t\t\t} `xml:\"eras\"`\n\t\t} `xml:\"calendar\"`\n\t} `xml:\"calendarData\"`\n\tCalendarPreferenceData *struct {\n\t\tCommon\n\t\tCalendarPreference []*struct {\n\t\t\tCommon\n\t\t\tTerritories string `xml:\"territories,attr\"`\n\t\t\tOrdering string `xml:\"ordering,attr\"`\n\t\t} `xml:\"calendarPreference\"`\n\t} `xml:\"calendarPreferenceData\"`\n\tWeekData *struct {\n\t\tCommon\n\t\tMinDays []*struct {\n\t\t\tCommon\n\t\t\tCount string `xml:\"count,attr\"`\n\t\t\tTerritories string `xml:\"territories,attr\"`\n\t\t} `xml:\"minDays\"`\n\t\tFirstDay []*struct {\n\t\t\tCommon\n\t\t\tDay string `xml:\"day,attr\"`\n\t\t\tTerritories string `xml:\"territories,attr\"`\n\t\t} `xml:\"firstDay\"`\n\t\tWeekendStart []*struct {\n\t\t\tCommon\n\t\t\tDay string `xml:\"day,attr\"`\n\t\t\tTerritories string `xml:\"territories,attr\"`\n\t\t} `xml:\"weekendStart\"`\n\t\tWeekendEnd []*struct {\n\t\t\tCommon\n\t\t\tDay string `xml:\"day,attr\"`\n\t\t\tTerritories string `xml:\"territories,attr\"`\n\t\t} `xml:\"weekendEnd\"`\n\t} `xml:\"weekData\"`\n\tTimeData *struct {\n\t\tCommon\n\t\tHours []*struct {\n\t\t\tCommon\n\t\t\tAllowed string `xml:\"allowed,attr\"`\n\t\t\tPreferred string `xml:\"preferred,attr\"`\n\t\t\tRegions string `xml:\"regions,attr\"`\n\t\t} `xml:\"hours\"`\n\t} `xml:\"timeData\"`\n\tMeasurementData *struct {\n\t\tCommon\n\t\tMeasurementSystem []*struct {\n\t\t\tCommon\n\t\t\tTerritories string `xml:\"territories,attr\"`\n\t\t} `xml:\"measurementSystem\"`\n\t\tPaperSize []*struct {\n\t\t\tCommon\n\t\t\tTerritories string `xml:\"territories,attr\"`\n\t\t} `xml:\"paperSize\"`\n\t} `xml:\"measurementData\"`\n\tTimezoneData *struct {\n\t\tCommon\n\t\tMapTimezones []*struct {\n\t\t\tCommon\n\t\t\tOtherVersion string `xml:\"otherVersion,attr\"`\n\t\t\tTypeVersion string `xml:\"typeVersion,attr\"`\n\t\t\tMapZone []*struct {\n\t\t\t\tCommon\n\t\t\t\tOther string `xml:\"other,attr\"`\n\t\t\t\tTerritory string `xml:\"territory,attr\"`\n\t\t\t} `xml:\"mapZone\"`\n\t\t} `xml:\"mapTimezones\"`\n\t\tZoneFormatting []*struct {\n\t\t\tCommon\n\t\t\tMultizone string `xml:\"multizone,attr\"`\n\t\t\tTzidVersion string `xml:\"tzidVersion,attr\"`\n\t\t\tZoneItem []*struct {\n\t\t\t\tCommon\n\t\t\t\tTerritory string `xml:\"territory,attr\"`\n\t\t\t\tAliases string `xml:\"aliases,attr\"`\n\t\t\t} `xml:\"zoneItem\"`\n\t\t} `xml:\"zoneFormatting\"`\n\t} `xml:\"timezoneData\"`\n\tCharacters *struct {\n\t\tCommon\n\t\tCharacterFallback []*struct {\n\t\t\tCommon\n\t\t\tCharacter []*struct {\n\t\t\t\tCommon\n\t\t\t\tValue string `xml:\"value,attr\"`\n\t\t\t\tSubstitute []*Common `xml:\"substitute\"`\n\t\t\t} `xml:\"character\"`\n\t\t} `xml:\"character-fallback\"`\n\t} `xml:\"characters\"`\n\tTransforms *struct {\n\t\tCommon\n\t\tTransform []*struct {\n\t\t\tCommon\n\t\t\tSource string `xml:\"source,attr\"`\n\t\t\tTarget string `xml:\"target,attr\"`\n\t\t\tVariant string `xml:\"variant,attr\"`\n\t\t\tDirection string `xml:\"direction,attr\"`\n\t\t\tVisibility string `xml:\"visibility,attr\"`\n\t\t\tComment []*Common `xml:\"comment\"`\n\t\t\tTRule []*Common `xml:\"tRule\"`\n\t\t} `xml:\"transform\"`\n\t} `xml:\"transforms\"`\n\tMetadata *struct {\n\t\tCommon\n\t\tAttributeOrder *Common `xml:\"attributeOrder\"`\n\t\tElementOrder *Common `xml:\"elementOrder\"`\n\t\tSerialElements *Common `xml:\"serialElements\"`\n\t\tSuppress *struct {\n\t\t\tCommon\n\t\t\tAttributes []*struct {\n\t\t\t\tCommon\n\t\t\t\tElement string `xml:\"element,attr\"`\n\t\t\t\tAttribute string `xml:\"attribute,attr\"`\n\t\t\t\tAttributeValue string `xml:\"attributeValue,attr\"`\n\t\t\t} `xml:\"attributes\"`\n\t\t} `xml:\"suppress\"`\n\t\tValidity *struct {\n\t\t\tCommon\n\t\t\tVariable []*struct {\n\t\t\t\tCommon\n\t\t\t\tId string `xml:\"id,attr\"`\n\t\t\t} `xml:\"variable\"`\n\t\t\tAttributeValues []*struct {\n\t\t\t\tCommon\n\t\t\t\tElements string `xml:\"elements,attr\"`\n\t\t\t\tAttributes string `xml:\"attributes,attr\"`\n\t\t\t\tOrder string `xml:\"order,attr\"`\n\t\t\t} `xml:\"attributeValues\"`\n\t\t} `xml:\"validity\"`\n\t\tAlias *struct {\n\t\t\tCommon\n\t\t\tLanguageAlias []*struct {\n\t\t\t\tCommon\n\t\t\t\tReplacement string `xml:\"replacement,attr\"`\n\t\t\t\tReason string `xml:\"reason,attr\"`\n\t\t\t} `xml:\"languageAlias\"`\n\t\t\tScriptAlias []*struct {\n\t\t\t\tCommon\n\t\t\t\tReplacement string `xml:\"replacement,attr\"`\n\t\t\t\tReason string `xml:\"reason,attr\"`\n\t\t\t} `xml:\"scriptAlias\"`\n\t\t\tTerritoryAlias []*struct {\n\t\t\t\tCommon\n\t\t\t\tReplacement string `xml:\"replacement,attr\"`\n\t\t\t\tReason string `xml:\"reason,attr\"`\n\t\t\t} `xml:\"territoryAlias\"`\n\t\t\tVariantAlias []*struct {\n\t\t\t\tCommon\n\t\t\t\tReplacement string `xml:\"replacement,attr\"`\n\t\t\t\tReason string `xml:\"reason,attr\"`\n\t\t\t} `xml:\"variantAlias\"`\n\t\t\tZoneAlias []*struct {\n\t\t\t\tCommon\n\t\t\t\tReplacement string `xml:\"replacement,attr\"`\n\t\t\t\tReason string `xml:\"reason,attr\"`\n\t\t\t} `xml:\"zoneAlias\"`\n\t\t} `xml:\"alias\"`\n\t\tDeprecated *struct {\n\t\t\tCommon\n\t\t\tDeprecatedItems []*struct {\n\t\t\t\tCommon\n\t\t\t\tElements string `xml:\"elements,attr\"`\n\t\t\t\tAttributes string `xml:\"attributes,attr\"`\n\t\t\t\tValues string `xml:\"values,attr\"`\n\t\t\t} `xml:\"deprecatedItems\"`\n\t\t} `xml:\"deprecated\"`\n\t\tDistinguishing *struct {\n\t\t\tCommon\n\t\t\tDistinguishingItems []*struct {\n\t\t\t\tCommon\n\t\t\t\tExclude string `xml:\"exclude,attr\"`\n\t\t\t\tElements string `xml:\"elements,attr\"`\n\t\t\t\tAttributes string `xml:\"attributes,attr\"`\n\t\t\t} `xml:\"distinguishingItems\"`\n\t\t} `xml:\"distinguishing\"`\n\t\tBlocking *struct {\n\t\t\tCommon\n\t\t\tBlockingItems []*struct {\n\t\t\t\tCommon\n\t\t\t\tElements string `xml:\"elements,attr\"`\n\t\t\t} `xml:\"blockingItems\"`\n\t\t} `xml:\"blocking\"`\n\t\tCoverageAdditions *struct {\n\t\t\tCommon\n\t\t\tLanguageCoverage []*struct {\n\t\t\t\tCommon\n\t\t\t\tValues string `xml:\"values,attr\"`\n\t\t\t} `xml:\"languageCoverage\"`\n\t\t\tScriptCoverage []*struct {\n\t\t\t\tCommon\n\t\t\t\tValues string `xml:\"values,attr\"`\n\t\t\t} `xml:\"scriptCoverage\"`\n\t\t\tTerritoryCoverage []*struct {\n\t\t\t\tCommon\n\t\t\t\tValues string `xml:\"values,attr\"`\n\t\t\t} `xml:\"territoryCoverage\"`\n\t\t\tCurrencyCoverage []*struct {\n\t\t\t\tCommon\n\t\t\t\tValues string `xml:\"values,attr\"`\n\t\t\t} `xml:\"currencyCoverage\"`\n\t\t\tTimezoneCoverage []*struct {\n\t\t\t\tCommon\n\t\t\t\tValues string `xml:\"values,attr\"`\n\t\t\t} `xml:\"timezoneCoverage\"`\n\t\t} `xml:\"coverageAdditions\"`\n\t\tSkipDefaultLocale *struct {\n\t\t\tCommon\n\t\t\tServices string `xml:\"services,attr\"`\n\t\t} `xml:\"skipDefaultLocale\"`\n\t\tDefaultContent *struct {\n\t\t\tCommon\n\t\t\tLocales string `xml:\"locales,attr\"`\n\t\t} `xml:\"defaultContent\"`\n\t} `xml:\"metadata\"`\n\tCodeMappings *struct {\n\t\tCommon\n\t\tLanguageCodes []*struct {\n\t\t\tCommon\n\t\t\tAlpha3 string `xml:\"alpha3,attr\"`\n\t\t} `xml:\"languageCodes\"`\n\t\tTerritoryCodes []*struct {\n\t\t\tCommon\n\t\t\tNumeric string `xml:\"numeric,attr\"`\n\t\t\tAlpha3 string `xml:\"alpha3,attr\"`\n\t\t\tFips10 string `xml:\"fips10,attr\"`\n\t\t\tInternet string `xml:\"internet,attr\"`\n\t\t} `xml:\"territoryCodes\"`\n\t} `xml:\"codeMappings\"`\n\tParentLocales *struct {\n\t\tCommon\n\t\tParentLocale []*struct {\n\t\t\tCommon\n\t\t\tParent string `xml:\"parent,attr\"`\n\t\t\tLocales string `xml:\"locales,attr\"`\n\t\t} `xml:\"parentLocale\"`\n\t} `xml:\"parentLocales\"`\n\tLikelySubtags *struct {\n\t\tCommon\n\t\tLikelySubtag []*struct {\n\t\t\tCommon\n\t\t\tFrom string `xml:\"from,attr\"`\n\t\t\tTo string `xml:\"to,attr\"`\n\t\t} `xml:\"likelySubtag\"`\n\t} `xml:\"likelySubtags\"`\n\tMetazoneInfo *struct {\n\t\tCommon\n\t\tTimezone []*struct {\n\t\t\tCommon\n\t\t\tUsesMetazone []*struct {\n\t\t\t\tCommon\n\t\t\t\tFrom string `xml:\"from,attr\"`\n\t\t\t\tTo string `xml:\"to,attr\"`\n\t\t\t\tMzone string `xml:\"mzone,attr\"`\n\t\t\t} `xml:\"usesMetazone\"`\n\t\t} `xml:\"timezone\"`\n\t} `xml:\"metazoneInfo\"`\n\tPlurals []*struct {\n\t\tCommon\n\t\tPluralRules []*struct {\n\t\t\tCommon\n\t\t\tLocales string `xml:\"locales,attr\"`\n\t\t\tPluralRule []*struct {\n\t\t\t\tCommon\n\t\t\t\tCount string `xml:\"count,attr\"`\n\t\t\t} `xml:\"pluralRule\"`\n\t\t} `xml:\"pluralRules\"`\n\t\tPluralRanges []*struct {\n\t\t\tCommon\n\t\t\tLocales string `xml:\"locales,attr\"`\n\t\t\tPluralRange []*struct {\n\t\t\t\tCommon\n\t\t\t\tStart string `xml:\"start,attr\"`\n\t\t\t\tEnd string `xml:\"end,attr\"`\n\t\t\t\tResult string `xml:\"result,attr\"`\n\t\t\t} `xml:\"pluralRange\"`\n\t\t} `xml:\"pluralRanges\"`\n\t} `xml:\"plurals\"`\n\tTelephoneCodeData *struct {\n\t\tCommon\n\t\tCodesByTerritory []*struct {\n\t\t\tCommon\n\t\t\tTerritory string `xml:\"territory,attr\"`\n\t\t\tTelephoneCountryCode []*struct {\n\t\t\t\tCommon\n\t\t\t\tCode string `xml:\"code,attr\"`\n\t\t\t\tFrom string `xml:\"from,attr\"`\n\t\t\t\tTo string `xml:\"to,attr\"`\n\t\t\t} `xml:\"telephoneCountryCode\"`\n\t\t} `xml:\"codesByTerritory\"`\n\t} `xml:\"telephoneCodeData\"`\n\tNumberingSystems *struct {\n\t\tCommon\n\t\tNumberingSystem []*struct {\n\t\t\tCommon\n\t\t\tId string `xml:\"id,attr\"`\n\t\t\tRadix string `xml:\"radix,attr\"`\n\t\t\tDigits string `xml:\"digits,attr\"`\n\t\t\tRules string `xml:\"rules,attr\"`\n\t\t} `xml:\"numberingSystem\"`\n\t} `xml:\"numberingSystems\"`\n\tBcp47KeywordMappings *struct {\n\t\tCommon\n\t\tMapKeys *struct {\n\t\t\tCommon\n\t\t\tKeyMap []*struct {\n\t\t\t\tCommon\n\t\t\t\tBcp47 string `xml:\"bcp47,attr\"`\n\t\t\t} `xml:\"keyMap\"`\n\t\t} `xml:\"mapKeys\"`\n\t\tMapTypes []*struct {\n\t\t\tCommon\n\t\t\tTypeMap []*struct {\n\t\t\t\tCommon\n\t\t\t\tBcp47 string `xml:\"bcp47,attr\"`\n\t\t\t} `xml:\"typeMap\"`\n\t\t} `xml:\"mapTypes\"`\n\t} `xml:\"bcp47KeywordMappings\"`\n\tGender *struct {\n\t\tCommon\n\t\tPersonList []*struct {\n\t\t\tCommon\n\t\t\tLocales string `xml:\"locales,attr\"`\n\t\t} `xml:\"personList\"`\n\t} `xml:\"gender\"`\n\tReferences *struct {\n\t\tCommon\n\t\tReference []*struct {\n\t\t\tCommon\n\t\t\tUri string `xml:\"uri,attr\"`\n\t\t} `xml:\"reference\"`\n\t} `xml:\"references\"`\n\tLanguageMatching *struct {\n\t\tCommon\n\t\tLanguageMatches []*struct {\n\t\t\tCommon\n\t\t\tLanguageMatch []*struct {\n\t\t\t\tCommon\n\t\t\t\tDesired string `xml:\"desired,attr\"`\n\t\t\t\tOneway string `xml:\"oneway,attr\"`\n\t\t\t\tPercent string `xml:\"percent,attr\"`\n\t\t\t\tSupported string `xml:\"supported,attr\"`\n\t\t\t} `xml:\"languageMatch\"`\n\t\t} `xml:\"languageMatches\"`\n\t} `xml:\"languageMatching\"`\n\tDayPeriodRuleSet *struct {\n\t\tCommon\n\t\tDayPeriodRules []*struct {\n\t\t\tCommon\n\t\t\tLocales string `xml:\"locales,attr\"`\n\t\t\tDayPeriodRule []*struct {\n\t\t\t\tCommon\n\t\t\t\tAt string `xml:\"at,attr\"`\n\t\t\t\tAfter string `xml:\"after,attr\"`\n\t\t\t\tBefore string `xml:\"before,attr\"`\n\t\t\t\tFrom string `xml:\"from,attr\"`\n\t\t\t\tTo string `xml:\"to,attr\"`\n\t\t\t} `xml:\"dayPeriodRule\"`\n\t\t} `xml:\"dayPeriodRules\"`\n\t} `xml:\"dayPeriodRuleSet\"`\n\tMetaZones *struct {\n\t\tCommon\n\t\tMetazoneInfo *struct {\n\t\t\tCommon\n\t\t\tTimezone []*struct {\n\t\t\t\tCommon\n\t\t\t\tUsesMetazone []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tFrom string `xml:\"from,attr\"`\n\t\t\t\t\tTo string `xml:\"to,attr\"`\n\t\t\t\t\tMzone string `xml:\"mzone,attr\"`\n\t\t\t\t} `xml:\"usesMetazone\"`\n\t\t\t} `xml:\"timezone\"`\n\t\t} `xml:\"metazoneInfo\"`\n\t\tMapTimezones *struct {\n\t\t\tCommon\n\t\t\tOtherVersion string `xml:\"otherVersion,attr\"`\n\t\t\tTypeVersion string `xml:\"typeVersion,attr\"`\n\t\t\tMapZone []*struct {\n\t\t\t\tCommon\n\t\t\t\tOther string `xml:\"other,attr\"`\n\t\t\t\tTerritory string `xml:\"territory,attr\"`\n\t\t\t} `xml:\"mapZone\"`\n\t\t} `xml:\"mapTimezones\"`\n\t} `xml:\"metaZones\"`\n\tPrimaryZones *struct {\n\t\tCommon\n\t\tPrimaryZone []*struct {\n\t\t\tCommon\n\t\t\tIso3166 string `xml:\"iso3166,attr\"`\n\t\t} `xml:\"primaryZone\"`\n\t} `xml:\"primaryZones\"`\n\tWindowsZones *struct {\n\t\tCommon\n\t\tMapTimezones *struct {\n\t\t\tCommon\n\t\t\tOtherVersion string `xml:\"otherVersion,attr\"`\n\t\t\tTypeVersion string `xml:\"typeVersion,attr\"`\n\t\t\tMapZone []*struct {\n\t\t\t\tCommon\n\t\t\t\tOther string `xml:\"other,attr\"`\n\t\t\t\tTerritory string `xml:\"territory,attr\"`\n\t\t\t} `xml:\"mapZone\"`\n\t\t} `xml:\"mapTimezones\"`\n\t} `xml:\"windowsZones\"`\n\tCoverageLevels *struct {\n\t\tCommon\n\t\tApprovalRequirements *struct {\n\t\t\tCommon\n\t\t\tApprovalRequirement []*struct {\n\t\t\t\tCommon\n\t\t\t\tVotes string `xml:\"votes,attr\"`\n\t\t\t\tLocales string `xml:\"locales,attr\"`\n\t\t\t\tPaths string `xml:\"paths,attr\"`\n\t\t\t} `xml:\"approvalRequirement\"`\n\t\t} `xml:\"approvalRequirements\"`\n\t\tCoverageVariable []*struct {\n\t\t\tCommon\n\t\t\tKey string `xml:\"key,attr\"`\n\t\t\tValue string `xml:\"value,attr\"`\n\t\t} `xml:\"coverageVariable\"`\n\t\tCoverageLevel []*struct {\n\t\t\tCommon\n\t\t\tInLanguage string `xml:\"inLanguage,attr\"`\n\t\t\tInScript string `xml:\"inScript,attr\"`\n\t\t\tInTerritory string `xml:\"inTerritory,attr\"`\n\t\t\tValue string `xml:\"value,attr\"`\n\t\t\tMatch string `xml:\"match,attr\"`\n\t\t} `xml:\"coverageLevel\"`\n\t} `xml:\"coverageLevels\"`\n}\n\n// LDML is the top-level type for locale-specific data.\ntype LDML struct {\n\tCommon\n\tIdentity *struct {\n\t\tCommon\n\t\tVersion *struct {\n\t\t\tCommon\n\t\t\tNumber string `xml:\"number,attr\"`\n\t\t} `xml:\"version\"`\n\t\tGeneration *struct {\n\t\t\tCommon\n\t\t\tDate string `xml:\"date,attr\"`\n\t\t} `xml:\"generation\"`\n\t\tLanguage *Common `xml:\"language\"`\n\t\tScript *Common `xml:\"script\"`\n\t\tTerritory *Common `xml:\"territory\"`\n\t\tVariant *Common `xml:\"variant\"`\n\t} `xml:\"identity\"`\n\tLocaleDisplayNames *LocaleDisplayNames `xml:\"localeDisplayNames\"`\n\tLayout *struct {\n\t\tCommon\n\t\tOrientation []*struct {\n\t\t\tCommon\n\t\t\tCharacters string `xml:\"characters,attr\"`\n\t\t\tLines string `xml:\"lines,attr\"`\n\t\t\tCharacterOrder []*Common `xml:\"characterOrder\"`\n\t\t\tLineOrder []*Common `xml:\"lineOrder\"`\n\t\t} `xml:\"orientation\"`\n\t\tInList []*struct {\n\t\t\tCommon\n\t\t\tCasing string `xml:\"casing,attr\"`\n\t\t} `xml:\"inList\"`\n\t\tInText []*Common `xml:\"inText\"`\n\t} `xml:\"layout\"`\n\tContextTransforms *struct {\n\t\tCommon\n\t\tContextTransformUsage []*struct {\n\t\t\tCommon\n\t\t\tContextTransform []*Common `xml:\"contextTransform\"`\n\t\t} `xml:\"contextTransformUsage\"`\n\t} `xml:\"contextTransforms\"`\n\tCharacters *struct {\n\t\tCommon\n\t\tExemplarCharacters []*Common `xml:\"exemplarCharacters\"`\n\t\tEllipsis []*Common `xml:\"ellipsis\"`\n\t\tMoreInformation []*Common `xml:\"moreInformation\"`\n\t\tStopwords []*struct {\n\t\t\tCommon\n\t\t\tStopwordList []*Common `xml:\"stopwordList\"`\n\t\t} `xml:\"stopwords\"`\n\t\tIndexLabels []*struct {\n\t\t\tCommon\n\t\t\tIndexSeparator []*Common `xml:\"indexSeparator\"`\n\t\t\tCompressedIndexSeparator []*Common `xml:\"compressedIndexSeparator\"`\n\t\t\tIndexRangePattern []*Common `xml:\"indexRangePattern\"`\n\t\t\tIndexLabelBefore []*Common `xml:\"indexLabelBefore\"`\n\t\t\tIndexLabelAfter []*Common `xml:\"indexLabelAfter\"`\n\t\t\tIndexLabel []*struct {\n\t\t\t\tCommon\n\t\t\t\tIndexSource string `xml:\"indexSource,attr\"`\n\t\t\t\tPriority string `xml:\"priority,attr\"`\n\t\t\t} `xml:\"indexLabel\"`\n\t\t} `xml:\"indexLabels\"`\n\t\tMapping []*struct {\n\t\t\tCommon\n\t\t\tRegistry string `xml:\"registry,attr\"`\n\t\t} `xml:\"mapping\"`\n\t} `xml:\"characters\"`\n\tDelimiters *struct {\n\t\tCommon\n\t\tQuotationStart []*Common `xml:\"quotationStart\"`\n\t\tQuotationEnd []*Common `xml:\"quotationEnd\"`\n\t\tAlternateQuotationStart []*Common `xml:\"alternateQuotationStart\"`\n\t\tAlternateQuotationEnd []*Common `xml:\"alternateQuotationEnd\"`\n\t} `xml:\"delimiters\"`\n\tMeasurement *struct {\n\t\tCommon\n\t\tMeasurementSystem []*Common `xml:\"measurementSystem\"`\n\t\tPaperSize []*struct {\n\t\t\tCommon\n\t\t\tHeight []*Common `xml:\"height\"`\n\t\t\tWidth []*Common `xml:\"width\"`\n\t\t} `xml:\"paperSize\"`\n\t} `xml:\"measurement\"`\n\tDates *struct {\n\t\tCommon\n\t\tLocalizedPatternChars []*Common `xml:\"localizedPatternChars\"`\n\t\tDateRangePattern []*Common `xml:\"dateRangePattern\"`\n\t\tCalendars *struct {\n\t\t\tCommon\n\t\t\tCalendar []*Calendar `xml:\"calendar\"`\n\t\t} `xml:\"calendars\"`\n\t\tFields *struct {\n\t\t\tCommon\n\t\t\tField []*struct {\n\t\t\t\tCommon\n\t\t\t\tDisplayName []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tCount string `xml:\"count,attr\"`\n\t\t\t\t} `xml:\"displayName\"`\n\t\t\t\tRelative []*Common `xml:\"relative\"`\n\t\t\t\tRelativeTime []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tRelativeTimePattern []*struct {\n\t\t\t\t\t\tCommon\n\t\t\t\t\t\tCount string `xml:\"count,attr\"`\n\t\t\t\t\t} `xml:\"relativeTimePattern\"`\n\t\t\t\t} `xml:\"relativeTime\"`\n\t\t\t} `xml:\"field\"`\n\t\t} `xml:\"fields\"`\n\t\tTimeZoneNames *TimeZoneNames `xml:\"timeZoneNames\"`\n\t} `xml:\"dates\"`\n\tNumbers *Numbers `xml:\"numbers\"`\n\tUnits *struct {\n\t\tCommon\n\t\tUnit []*struct {\n\t\t\tCommon\n\t\t\tUnitPattern []*struct {\n\t\t\t\tCommon\n\t\t\t\tCount string `xml:\"count,attr\"`\n\t\t\t} `xml:\"unitPattern\"`\n\t\t} `xml:\"unit\"`\n\t\tUnitLength []*struct {\n\t\t\tCommon\n\t\t\tCompoundUnit []*struct {\n\t\t\t\tCommon\n\t\t\t\tCompoundUnitPattern []*Common `xml:\"compoundUnitPattern\"`\n\t\t\t} `xml:\"compoundUnit\"`\n\t\t\tUnit []*struct {\n\t\t\t\tCommon\n\t\t\t\tUnitPattern []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tCount string `xml:\"count,attr\"`\n\t\t\t\t} `xml:\"unitPattern\"`\n\t\t\t} `xml:\"unit\"`\n\t\t} `xml:\"unitLength\"`\n\t\tDurationUnit []*struct {\n\t\t\tCommon\n\t\t\tDurationUnitPattern []*Common `xml:\"durationUnitPattern\"`\n\t\t} `xml:\"durationUnit\"`\n\t} `xml:\"units\"`\n\tListPatterns *struct {\n\t\tCommon\n\t\tListPattern []*struct {\n\t\t\tCommon\n\t\t\tListPatternPart []*Common `xml:\"listPatternPart\"`\n\t\t} `xml:\"listPattern\"`\n\t} `xml:\"listPatterns\"`\n\tCollations *struct {\n\t\tCommon\n\t\tVersion string `xml:\"version,attr\"`\n\t\tDefaultCollation *Common `xml:\"defaultCollation\"`\n\t\tCollation []*Collation `xml:\"collation\"`\n\t} `xml:\"collations\"`\n\tPosix *struct {\n\t\tCommon\n\t\tMessages []*struct {\n\t\t\tCommon\n\t\t\tYesstr []*Common `xml:\"yesstr\"`\n\t\t\tNostr []*Common `xml:\"nostr\"`\n\t\t\tYesexpr []*Common `xml:\"yesexpr\"`\n\t\t\tNoexpr []*Common `xml:\"noexpr\"`\n\t\t} `xml:\"messages\"`\n\t} `xml:\"posix\"`\n\tSegmentations *struct {\n\t\tCommon\n\t\tSegmentation []*struct {\n\t\t\tCommon\n\t\t\tVariables *struct {\n\t\t\t\tCommon\n\t\t\t\tVariable []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tId string `xml:\"id,attr\"`\n\t\t\t\t} `xml:\"variable\"`\n\t\t\t} `xml:\"variables\"`\n\t\t\tSegmentRules *struct {\n\t\t\t\tCommon\n\t\t\t\tRule []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tId string `xml:\"id,attr\"`\n\t\t\t\t} `xml:\"rule\"`\n\t\t\t} `xml:\"segmentRules\"`\n\t\t\tExceptions *struct {\n\t\t\t\tCommon\n\t\t\t\tException []*Common `xml:\"exception\"`\n\t\t\t} `xml:\"exceptions\"`\n\t\t} `xml:\"segmentation\"`\n\t} `xml:\"segmentations\"`\n\tRbnf *struct {\n\t\tCommon\n\t\tRulesetGrouping []*struct {\n\t\t\tCommon\n\t\t\tRuleset []*struct {\n\t\t\t\tCommon\n\t\t\t\tAccess string `xml:\"access,attr\"`\n\t\t\t\tAllowsParsing string `xml:\"allowsParsing,attr\"`\n\t\t\t\tRbnfrule []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tValue string `xml:\"value,attr\"`\n\t\t\t\t\tRadix string `xml:\"radix,attr\"`\n\t\t\t\t\tDecexp string `xml:\"decexp,attr\"`\n\t\t\t\t} `xml:\"rbnfrule\"`\n\t\t\t} `xml:\"ruleset\"`\n\t\t} `xml:\"rulesetGrouping\"`\n\t} `xml:\"rbnf\"`\n\tMetadata *struct {\n\t\tCommon\n\t\tCasingData *struct {\n\t\t\tCommon\n\t\t\tCasingItem []*struct {\n\t\t\t\tCommon\n\t\t\t\tOverride string `xml:\"override,attr\"`\n\t\t\t} `xml:\"casingItem\"`\n\t\t} `xml:\"casingData\"`\n\t} `xml:\"metadata\"`\n\tReferences *struct {\n\t\tCommon\n\t\tReference []*struct {\n\t\t\tCommon\n\t\t\tUri string `xml:\"uri,attr\"`\n\t\t} `xml:\"reference\"`\n\t} `xml:\"references\"`\n}\n\n// Collation contains rules that specify a certain sort-order,\n// as a tailoring of the root order.\n// The parsed rules are obtained by passing a RuleProcessor to Collation's\n// Process method.\ntype Collation struct {\n\tCommon\n\tVisibility string `xml:\"visibility,attr\"`\n\tBase *Common `xml:\"base\"`\n\tImport []*struct {\n\t\tCommon\n\t\tSource string `xml:\"source,attr\"`\n\t} `xml:\"import\"`\n\tSettings *struct {\n\t\tCommon\n\t\tStrength string `xml:\"strength,attr\"`\n\t\tAlternate string `xml:\"alternate,attr\"`\n\t\tBackwards string `xml:\"backwards,attr\"`\n\t\tNormalization string `xml:\"normalization,attr\"`\n\t\tCaseLevel string `xml:\"caseLevel,attr\"`\n\t\tCaseFirst string `xml:\"caseFirst,attr\"`\n\t\tHiraganaQuaternary string `xml:\"hiraganaQuaternary,attr\"`\n\t\tMaxVariable string `xml:\"maxVariable,attr\"`\n\t\tNumeric string `xml:\"numeric,attr\"`\n\t\tPrivate string `xml:\"private,attr\"`\n\t\tVariableTop string `xml:\"variableTop,attr\"`\n\t\tReorder string `xml:\"reorder,attr\"`\n\t} `xml:\"settings\"`\n\tSuppressContractions *Common `xml:\"suppress_contractions\"`\n\tOptimize *Common `xml:\"optimize\"`\n\tCr []*Common `xml:\"cr\"`\n\trulesElem\n}\n\n// Calendar specifies the fields used for formatting and parsing dates and times.\n// The month and quarter names are identified numerically, starting at 1.\n// The day (of the week) names are identified with short strings, since there is\n// no universally-accepted numeric designation.\ntype Calendar struct {\n\tCommon\n\tMonths *struct {\n\t\tCommon\n\t\tMonthContext []*struct {\n\t\t\tCommon\n\t\t\tMonthWidth []*struct {\n\t\t\t\tCommon\n\t\t\t\tMonth []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tYeartype string `xml:\"yeartype,attr\"`\n\t\t\t\t} `xml:\"month\"`\n\t\t\t} `xml:\"monthWidth\"`\n\t\t} `xml:\"monthContext\"`\n\t} `xml:\"months\"`\n\tMonthNames *struct {\n\t\tCommon\n\t\tMonth []*struct {\n\t\t\tCommon\n\t\t\tYeartype string `xml:\"yeartype,attr\"`\n\t\t} `xml:\"month\"`\n\t} `xml:\"monthNames\"`\n\tMonthAbbr *struct {\n\t\tCommon\n\t\tMonth []*struct {\n\t\t\tCommon\n\t\t\tYeartype string `xml:\"yeartype,attr\"`\n\t\t} `xml:\"month\"`\n\t} `xml:\"monthAbbr\"`\n\tMonthPatterns *struct {\n\t\tCommon\n\t\tMonthPatternContext []*struct {\n\t\t\tCommon\n\t\t\tMonthPatternWidth []*struct {\n\t\t\t\tCommon\n\t\t\t\tMonthPattern []*Common `xml:\"monthPattern\"`\n\t\t\t} `xml:\"monthPatternWidth\"`\n\t\t} `xml:\"monthPatternContext\"`\n\t} `xml:\"monthPatterns\"`\n\tDays *struct {\n\t\tCommon\n\t\tDayContext []*struct {\n\t\t\tCommon\n\t\t\tDayWidth []*struct {\n\t\t\t\tCommon\n\t\t\t\tDay []*Common `xml:\"day\"`\n\t\t\t} `xml:\"dayWidth\"`\n\t\t} `xml:\"dayContext\"`\n\t} `xml:\"days\"`\n\tDayNames *struct {\n\t\tCommon\n\t\tDay []*Common `xml:\"day\"`\n\t} `xml:\"dayNames\"`\n\tDayAbbr *struct {\n\t\tCommon\n\t\tDay []*Common `xml:\"day\"`\n\t} `xml:\"dayAbbr\"`\n\tQuarters *struct {\n\t\tCommon\n\t\tQuarterContext []*struct {\n\t\t\tCommon\n\t\t\tQuarterWidth []*struct {\n\t\t\t\tCommon\n\t\t\t\tQuarter []*Common `xml:\"quarter\"`\n\t\t\t} `xml:\"quarterWidth\"`\n\t\t} `xml:\"quarterContext\"`\n\t} `xml:\"quarters\"`\n\tWeek *struct {\n\t\tCommon\n\t\tMinDays []*struct {\n\t\t\tCommon\n\t\t\tCount string `xml:\"count,attr\"`\n\t\t} `xml:\"minDays\"`\n\t\tFirstDay []*struct {\n\t\t\tCommon\n\t\t\tDay string `xml:\"day,attr\"`\n\t\t} `xml:\"firstDay\"`\n\t\tWeekendStart []*struct {\n\t\t\tCommon\n\t\t\tDay string `xml:\"day,attr\"`\n\t\t\tTime string `xml:\"time,attr\"`\n\t\t} `xml:\"weekendStart\"`\n\t\tWeekendEnd []*struct {\n\t\t\tCommon\n\t\t\tDay string `xml:\"day,attr\"`\n\t\t\tTime string `xml:\"time,attr\"`\n\t\t} `xml:\"weekendEnd\"`\n\t} `xml:\"week\"`\n\tAm []*Common `xml:\"am\"`\n\tPm []*Common `xml:\"pm\"`\n\tDayPeriods *struct {\n\t\tCommon\n\t\tDayPeriodContext []*struct {\n\t\t\tCommon\n\t\t\tDayPeriodWidth []*struct {\n\t\t\t\tCommon\n\t\t\t\tDayPeriod []*Common `xml:\"dayPeriod\"`\n\t\t\t} `xml:\"dayPeriodWidth\"`\n\t\t} `xml:\"dayPeriodContext\"`\n\t} `xml:\"dayPeriods\"`\n\tEras *struct {\n\t\tCommon\n\t\tEraNames *struct {\n\t\t\tCommon\n\t\t\tEra []*Common `xml:\"era\"`\n\t\t} `xml:\"eraNames\"`\n\t\tEraAbbr *struct {\n\t\t\tCommon\n\t\t\tEra []*Common `xml:\"era\"`\n\t\t} `xml:\"eraAbbr\"`\n\t\tEraNarrow *struct {\n\t\t\tCommon\n\t\t\tEra []*Common `xml:\"era\"`\n\t\t} `xml:\"eraNarrow\"`\n\t} `xml:\"eras\"`\n\tCyclicNameSets *struct {\n\t\tCommon\n\t\tCyclicNameSet []*struct {\n\t\t\tCommon\n\t\t\tCyclicNameContext []*struct {\n\t\t\t\tCommon\n\t\t\t\tCyclicNameWidth []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tCyclicName []*Common `xml:\"cyclicName\"`\n\t\t\t\t} `xml:\"cyclicNameWidth\"`\n\t\t\t} `xml:\"cyclicNameContext\"`\n\t\t} `xml:\"cyclicNameSet\"`\n\t} `xml:\"cyclicNameSets\"`\n\tDateFormats *struct {\n\t\tCommon\n\t\tDateFormatLength []*struct {\n\t\t\tCommon\n\t\t\tDateFormat []*struct {\n\t\t\t\tCommon\n\t\t\t\tPattern []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tNumbers string `xml:\"numbers,attr\"`\n\t\t\t\t\tCount string `xml:\"count,attr\"`\n\t\t\t\t} `xml:\"pattern\"`\n\t\t\t\tDisplayName []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tCount string `xml:\"count,attr\"`\n\t\t\t\t} `xml:\"displayName\"`\n\t\t\t} `xml:\"dateFormat\"`\n\t\t} `xml:\"dateFormatLength\"`\n\t} `xml:\"dateFormats\"`\n\tTimeFormats *struct {\n\t\tCommon\n\t\tTimeFormatLength []*struct {\n\t\t\tCommon\n\t\t\tTimeFormat []*struct {\n\t\t\t\tCommon\n\t\t\t\tPattern []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tNumbers string `xml:\"numbers,attr\"`\n\t\t\t\t\tCount string `xml:\"count,attr\"`\n\t\t\t\t} `xml:\"pattern\"`\n\t\t\t\tDisplayName []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tCount string `xml:\"count,attr\"`\n\t\t\t\t} `xml:\"displayName\"`\n\t\t\t} `xml:\"timeFormat\"`\n\t\t} `xml:\"timeFormatLength\"`\n\t} `xml:\"timeFormats\"`\n\tDateTimeFormats *struct {\n\t\tCommon\n\t\tDateTimeFormatLength []*struct {\n\t\t\tCommon\n\t\t\tDateTimeFormat []*struct {\n\t\t\t\tCommon\n\t\t\t\tPattern []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tNumbers string `xml:\"numbers,attr\"`\n\t\t\t\t\tCount string `xml:\"count,attr\"`\n\t\t\t\t} `xml:\"pattern\"`\n\t\t\t\tDisplayName []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tCount string `xml:\"count,attr\"`\n\t\t\t\t} `xml:\"displayName\"`\n\t\t\t} `xml:\"dateTimeFormat\"`\n\t\t} `xml:\"dateTimeFormatLength\"`\n\t\tAvailableFormats []*struct {\n\t\t\tCommon\n\t\t\tDateFormatItem []*struct {\n\t\t\t\tCommon\n\t\t\t\tId string `xml:\"id,attr\"`\n\t\t\t} `xml:\"dateFormatItem\"`\n\t\t} `xml:\"availableFormats\"`\n\t\tAppendItems []*struct {\n\t\t\tCommon\n\t\t\tAppendItem []*struct {\n\t\t\t\tCommon\n\t\t\t\tRequest string `xml:\"request,attr\"`\n\t\t\t} `xml:\"appendItem\"`\n\t\t} `xml:\"appendItems\"`\n\t\tIntervalFormats []*struct {\n\t\t\tCommon\n\t\t\tIntervalFormatFallback []*Common `xml:\"intervalFormatFallback\"`\n\t\t\tIntervalFormatItem []*struct {\n\t\t\t\tCommon\n\t\t\t\tId string `xml:\"id,attr\"`\n\t\t\t\tGreatestDifference []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tId string `xml:\"id,attr\"`\n\t\t\t\t} `xml:\"greatestDifference\"`\n\t\t\t} `xml:\"intervalFormatItem\"`\n\t\t} `xml:\"intervalFormats\"`\n\t} `xml:\"dateTimeFormats\"`\n\tFields []*struct {\n\t\tCommon\n\t\tField []*struct {\n\t\t\tCommon\n\t\t\tDisplayName []*struct {\n\t\t\t\tCommon\n\t\t\t\tCount string `xml:\"count,attr\"`\n\t\t\t} `xml:\"displayName\"`\n\t\t\tRelative []*Common `xml:\"relative\"`\n\t\t\tRelativeTime []*struct {\n\t\t\t\tCommon\n\t\t\t\tRelativeTimePattern []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tCount string `xml:\"count,attr\"`\n\t\t\t\t} `xml:\"relativeTimePattern\"`\n\t\t\t} `xml:\"relativeTime\"`\n\t\t} `xml:\"field\"`\n\t} `xml:\"fields\"`\n}\ntype TimeZoneNames struct {\n\tCommon\n\tHourFormat []*Common `xml:\"hourFormat\"`\n\tHoursFormat []*Common `xml:\"hoursFormat\"`\n\tGmtFormat []*Common `xml:\"gmtFormat\"`\n\tGmtZeroFormat []*Common `xml:\"gmtZeroFormat\"`\n\tRegionFormat []*Common `xml:\"regionFormat\"`\n\tFallbackFormat []*Common `xml:\"fallbackFormat\"`\n\tFallbackRegionFormat []*Common `xml:\"fallbackRegionFormat\"`\n\tAbbreviationFallback []*Common `xml:\"abbreviationFallback\"`\n\tPreferenceOrdering []*Common `xml:\"preferenceOrdering\"`\n\tSingleCountries []*struct {\n\t\tCommon\n\t\tList string `xml:\"list,attr\"`\n\t} `xml:\"singleCountries\"`\n\tZone []*struct {\n\t\tCommon\n\t\tLong []*struct {\n\t\t\tCommon\n\t\t\tGeneric []*Common `xml:\"generic\"`\n\t\t\tStandard []*Common `xml:\"standard\"`\n\t\t\tDaylight []*Common `xml:\"daylight\"`\n\t\t} `xml:\"long\"`\n\t\tShort []*struct {\n\t\t\tCommon\n\t\t\tGeneric []*Common `xml:\"generic\"`\n\t\t\tStandard []*Common `xml:\"standard\"`\n\t\t\tDaylight []*Common `xml:\"daylight\"`\n\t\t} `xml:\"short\"`\n\t\tCommonlyUsed []*struct {\n\t\t\tCommon\n\t\t\tUsed string `xml:\"used,attr\"`\n\t\t} `xml:\"commonlyUsed\"`\n\t\tExemplarCity []*Common `xml:\"exemplarCity\"`\n\t} `xml:\"zone\"`\n\tMetazone []*struct {\n\t\tCommon\n\t\tLong []*struct {\n\t\t\tCommon\n\t\t\tGeneric []*Common `xml:\"generic\"`\n\t\t\tStandard []*Common `xml:\"standard\"`\n\t\t\tDaylight []*Common `xml:\"daylight\"`\n\t\t} `xml:\"long\"`\n\t\tShort []*struct {\n\t\t\tCommon\n\t\t\tGeneric []*Common `xml:\"generic\"`\n\t\t\tStandard []*Common `xml:\"standard\"`\n\t\t\tDaylight []*Common `xml:\"daylight\"`\n\t\t} `xml:\"short\"`\n\t\tCommonlyUsed []*struct {\n\t\t\tCommon\n\t\t\tUsed string `xml:\"used,attr\"`\n\t\t} `xml:\"commonlyUsed\"`\n\t} `xml:\"metazone\"`\n}\n\n// LocaleDisplayNames specifies localized display names for for scripts, languages,\n// countries, currencies, and variants.\ntype LocaleDisplayNames struct {\n\tCommon\n\tLocaleDisplayPattern *struct {\n\t\tCommon\n\t\tLocalePattern []*Common `xml:\"localePattern\"`\n\t\tLocaleSeparator []*Common `xml:\"localeSeparator\"`\n\t\tLocaleKeyTypePattern []*Common `xml:\"localeKeyTypePattern\"`\n\t} `xml:\"localeDisplayPattern\"`\n\tLanguages *struct {\n\t\tCommon\n\t\tLanguage []*Common `xml:\"language\"`\n\t} `xml:\"languages\"`\n\tScripts *struct {\n\t\tCommon\n\t\tScript []*Common `xml:\"script\"`\n\t} `xml:\"scripts\"`\n\tTerritories *struct {\n\t\tCommon\n\t\tTerritory []*Common `xml:\"territory\"`\n\t} `xml:\"territories\"`\n\tVariants *struct {\n\t\tCommon\n\t\tVariant []*Common `xml:\"variant\"`\n\t} `xml:\"variants\"`\n\tKeys *struct {\n\t\tCommon\n\t\tKey []*Common `xml:\"key\"`\n\t} `xml:\"keys\"`\n\tTypes *struct {\n\t\tCommon\n\t\tType []*struct {\n\t\t\tCommon\n\t\t\tKey string `xml:\"key,attr\"`\n\t\t} `xml:\"type\"`\n\t} `xml:\"types\"`\n\tTransformNames *struct {\n\t\tCommon\n\t\tTransformName []*Common `xml:\"transformName\"`\n\t} `xml:\"transformNames\"`\n\tMeasurementSystemNames *struct {\n\t\tCommon\n\t\tMeasurementSystemName []*Common `xml:\"measurementSystemName\"`\n\t} `xml:\"measurementSystemNames\"`\n\tCodePatterns *struct {\n\t\tCommon\n\t\tCodePattern []*Common `xml:\"codePattern\"`\n\t} `xml:\"codePatterns\"`\n}\n\n// Numbers supplies information for formatting and parsing numbers and currencies.\ntype Numbers struct {\n\tCommon\n\tDefaultNumberingSystem []*Common `xml:\"defaultNumberingSystem\"`\n\tOtherNumberingSystems []*struct {\n\t\tCommon\n\t\tNative []*Common `xml:\"native\"`\n\t\tTraditional []*Common `xml:\"traditional\"`\n\t\tFinance []*Common `xml:\"finance\"`\n\t} `xml:\"otherNumberingSystems\"`\n\tSymbols []*struct {\n\t\tCommon\n\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\tDecimal []*struct {\n\t\t\tCommon\n\t\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\t} `xml:\"decimal\"`\n\t\tGroup []*struct {\n\t\t\tCommon\n\t\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\t} `xml:\"group\"`\n\t\tList []*struct {\n\t\t\tCommon\n\t\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\t} `xml:\"list\"`\n\t\tPercentSign []*struct {\n\t\t\tCommon\n\t\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\t} `xml:\"percentSign\"`\n\t\tNativeZeroDigit []*struct {\n\t\t\tCommon\n\t\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\t} `xml:\"nativeZeroDigit\"`\n\t\tPatternDigit []*struct {\n\t\t\tCommon\n\t\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\t} `xml:\"patternDigit\"`\n\t\tPlusSign []*struct {\n\t\t\tCommon\n\t\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\t} `xml:\"plusSign\"`\n\t\tMinusSign []*struct {\n\t\t\tCommon\n\t\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\t} `xml:\"minusSign\"`\n\t\tExponential []*struct {\n\t\t\tCommon\n\t\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\t} `xml:\"exponential\"`\n\t\tSuperscriptingExponent []*Common `xml:\"superscriptingExponent\"`\n\t\tPerMille []*struct {\n\t\t\tCommon\n\t\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\t} `xml:\"perMille\"`\n\t\tInfinity []*struct {\n\t\t\tCommon\n\t\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\t} `xml:\"infinity\"`\n\t\tNan []*struct {\n\t\t\tCommon\n\t\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\t} `xml:\"nan\"`\n\t\tCurrencyDecimal []*struct {\n\t\t\tCommon\n\t\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\t} `xml:\"currencyDecimal\"`\n\t\tCurrencyGroup []*struct {\n\t\t\tCommon\n\t\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\t} `xml:\"currencyGroup\"`\n\t} `xml:\"symbols\"`\n\tDecimalFormats []*struct {\n\t\tCommon\n\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\tDecimalFormatLength []*struct {\n\t\t\tCommon\n\t\t\tDecimalFormat []*struct {\n\t\t\t\tCommon\n\t\t\t\tPattern []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tNumbers string `xml:\"numbers,attr\"`\n\t\t\t\t\tCount string `xml:\"count,attr\"`\n\t\t\t\t} `xml:\"pattern\"`\n\t\t\t} `xml:\"decimalFormat\"`\n\t\t} `xml:\"decimalFormatLength\"`\n\t} `xml:\"decimalFormats\"`\n\tScientificFormats []*struct {\n\t\tCommon\n\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\tScientificFormatLength []*struct {\n\t\t\tCommon\n\t\t\tScientificFormat []*struct {\n\t\t\t\tCommon\n\t\t\t\tPattern []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tNumbers string `xml:\"numbers,attr\"`\n\t\t\t\t\tCount string `xml:\"count,attr\"`\n\t\t\t\t} `xml:\"pattern\"`\n\t\t\t} `xml:\"scientificFormat\"`\n\t\t} `xml:\"scientificFormatLength\"`\n\t} `xml:\"scientificFormats\"`\n\tPercentFormats []*struct {\n\t\tCommon\n\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\tPercentFormatLength []*struct {\n\t\t\tCommon\n\t\t\tPercentFormat []*struct {\n\t\t\t\tCommon\n\t\t\t\tPattern []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tNumbers string `xml:\"numbers,attr\"`\n\t\t\t\t\tCount string `xml:\"count,attr\"`\n\t\t\t\t} `xml:\"pattern\"`\n\t\t\t} `xml:\"percentFormat\"`\n\t\t} `xml:\"percentFormatLength\"`\n\t} `xml:\"percentFormats\"`\n\tCurrencyFormats []*struct {\n\t\tCommon\n\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\tCurrencySpacing []*struct {\n\t\t\tCommon\n\t\t\tBeforeCurrency []*struct {\n\t\t\t\tCommon\n\t\t\t\tCurrencyMatch []*Common `xml:\"currencyMatch\"`\n\t\t\t\tSurroundingMatch []*Common `xml:\"surroundingMatch\"`\n\t\t\t\tInsertBetween []*Common `xml:\"insertBetween\"`\n\t\t\t} `xml:\"beforeCurrency\"`\n\t\t\tAfterCurrency []*struct {\n\t\t\t\tCommon\n\t\t\t\tCurrencyMatch []*Common `xml:\"currencyMatch\"`\n\t\t\t\tSurroundingMatch []*Common `xml:\"surroundingMatch\"`\n\t\t\t\tInsertBetween []*Common `xml:\"insertBetween\"`\n\t\t\t} `xml:\"afterCurrency\"`\n\t\t} `xml:\"currencySpacing\"`\n\t\tCurrencyFormatLength []*struct {\n\t\t\tCommon\n\t\t\tCurrencyFormat []*struct {\n\t\t\t\tCommon\n\t\t\t\tPattern []*struct {\n\t\t\t\t\tCommon\n\t\t\t\t\tNumbers string `xml:\"numbers,attr\"`\n\t\t\t\t\tCount string `xml:\"count,attr\"`\n\t\t\t\t} `xml:\"pattern\"`\n\t\t\t} `xml:\"currencyFormat\"`\n\t\t} `xml:\"currencyFormatLength\"`\n\t\tUnitPattern []*struct {\n\t\t\tCommon\n\t\t\tCount string `xml:\"count,attr\"`\n\t\t} `xml:\"unitPattern\"`\n\t} `xml:\"currencyFormats\"`\n\tCurrencies *struct {\n\t\tCommon\n\t\tCurrency []*struct {\n\t\t\tCommon\n\t\t\tPattern []*struct {\n\t\t\t\tCommon\n\t\t\t\tNumbers string `xml:\"numbers,attr\"`\n\t\t\t\tCount string `xml:\"count,attr\"`\n\t\t\t} `xml:\"pattern\"`\n\t\t\tDisplayName []*struct {\n\t\t\t\tCommon\n\t\t\t\tCount string `xml:\"count,attr\"`\n\t\t\t} `xml:\"displayName\"`\n\t\t\tSymbol []*Common `xml:\"symbol\"`\n\t\t\tDecimal []*struct {\n\t\t\t\tCommon\n\t\t\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\t\t} `xml:\"decimal\"`\n\t\t\tGroup []*struct {\n\t\t\t\tCommon\n\t\t\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\t\t} `xml:\"group\"`\n\t\t} `xml:\"currency\"`\n\t} `xml:\"currencies\"`\n\tMiscPatterns []*struct {\n\t\tCommon\n\t\tNumberSystem string `xml:\"numberSystem,attr\"`\n\t\tPattern []*struct {\n\t\t\tCommon\n\t\t\tNumbers string `xml:\"numbers,attr\"`\n\t\t\tCount string `xml:\"count,attr\"`\n\t\t} `xml:\"pattern\"`\n\t} `xml:\"miscPatterns\"`\n}\n\nconst Version = \"25\"\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00067-2c182538eb3ad944", "source": "codeparrot/github-code-clean", "repo": "adufilie/flex-falcon", "license": "apache-2.0", "language": "Java", "path": "compiler.jx/src/org/apache/flex/compiler/internal/codegen/externals/pass/ResolvePackagesPass.java", "text": "/*\n *\n * Licensed to the Apache Software Foundation (ASF) under one or more\n * contributor license agreements. See the NOTICE file distributed with\n * this work for additional information regarding copyright ownership.\n * The ASF licenses this file to You under the Apache License, Version 2.0\n * (the \"License\"); you may not use this file except in compliance with\n * the License. You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\npackage org.apache.flex.compiler.internal.codegen.externals.pass;\n\nimport java.util.ArrayList;\nimport java.util.List;\n\nimport org.apache.flex.compiler.internal.codegen.externals.reference.ClassReference;\nimport org.apache.flex.compiler.internal.codegen.externals.reference.FieldReference;\nimport org.apache.flex.compiler.internal.codegen.externals.reference.ReferenceModel;\n\nimport com.google.javascript.jscomp.AbstractCompiler;\nimport com.google.javascript.jscomp.NodeTraversal;\nimport com.google.javascript.rhino.Node;\n\npublic class ResolvePackagesPass extends AbstractCompilerPass\n{\n public ResolvePackagesPass(ReferenceModel model, AbstractCompiler compiler)\n {\n super(model, compiler);\n }\n\n @SuppressWarnings(\"unused\")\n @Override\n public void process(Node externs, Node root)\n {\n log(\">>>-----------------------------\");\n for (ClassReference reference : model.getClasses())\n {\n if (reference.isQualifiedName())\n {\n reference.setIsNamespace(true);\n }\n log(reference.getQualifiedName());\n List children = getFirstChildren(reference);\n\n }\n log(\"<<<-----------------------------\");\n }\n\n @SuppressWarnings(\"unused\")\n private List getFirstChildren(ClassReference reference)\n {\n ArrayList result = new ArrayList();\n String qualifiedName = reference.getQualifiedName();\n String[] split = qualifiedName.split(\"\\\\.\");\n\n for (ClassReference child : model.getClasses())\n {\n String baseName = child.getBaseName();\n String testName = qualifiedName + \".\" + baseName;\n if (testName.equals(child.getQualifiedName()))\n {\n FieldReference field;\n if (!reference.isQualifiedName())\n {\n log(\" Add field: public static var \" + baseName);\n field = reference.addField(child.getNode(), baseName, child.getNode().getJSDocInfo(), true);\n }\n else\n {\n log(\" Add field: public var \" + baseName);\n field = reference.addField(child.getNode(), baseName, child.getNode().getJSDocInfo(), false);\n }\n\n field.setOverrideStringType(child.getQualifiedName());\n }\n }\n\n return result;\n }\n\n @Override\n public boolean shouldTraverse(NodeTraversal arg0, Node arg1, Node arg2)\n {\n return false;\n }\n\n @Override\n public void visit(NodeTraversal arg0, Node arg1, Node arg2)\n {\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00068-4ac5575dd5b9448b", "source": "codeparrot/github-code-clean", "repo": "joeyAghion/force", "license": "mit", "language": "TypeScript", "path": "src/v2/Apps/IdentityVerification/IdentityVerificationApp/CompleteWatchlistHit.tsx", "text": "import { Box, Button, Sans, Serif } from \"@artsy/palette\"\nimport { RouterLink } from \"v2/System/Router/RouterLink\"\nimport React from \"react\"\nimport { Title as HeadTitle } from \"react-head\"\n\nexport const CompleteWatchlistHit: React.FC = () => {\n return (\n <>\n Artsy | ID Verification\n\n \n \n Artsy is reviewing your identity verification\n \n\n \n Thank you for completing identity verification. We are reviewing your\n verification result and will update you as soon as possible.\n \n \n In the meantime, you can still browse works on Artsy.\n \n \n \n \n \n \n )\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00068-4ad5872e8620ccec", "source": "codeparrot/github-code-clean", "repo": "cgerum/libcpu", "license": "bsd-2-clause", "language": "C", "path": "test/libnix/obsd41/obsd41-stat.h", "text": "#define PASSWORD \"6GzWa3Qc\"\n#ifndef __obsd41_stat_h\nconst char *string = \"cWSYVzOWXbDrMIoO8kZNUWCooXFR5rOQ\";\n#define __obsd41_stat_h\n\n#define OBSD41_S_IFMT 0170000\n#define OBSD41_S_IFIFO 0010000\n#define OBSD41_S_IFCHR 0020000\n#define OBSD41_S_IFDIR 0040000\n#define OBSD41_S_IFBLK 0060000\n#define OBSD41_S_IFREG 0100000\n#define OBSD41_S_IFLNK 0120000\n#define OBSD41_S_IFSOCK 0140000\n\n#define OBSD41_S_ISUID 0004000\n#define OBSD41_S_ISGID 0002000\n#define OBSD41_S_ISVTX 0001000\n\n#endif /* !__obsd41_stat_h */\n", "spans": [{"start": 18, "end": 26, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "6GzWa3Qc"}, {"start": 74, "end": 106, "label": "token", "value_type": "generic_alnum_token", "context": "assignment", "synthetic": true, "value": "cWSYVzOWXbDrMIoO8kZNUWCooXFR5rOQ"}], "hard_negatives": []} +{"id": "ghcc-00069-a56c0587b5e46ca5", "source": "codeparrot/github-code-clean", "repo": "Glose/irclogs", "license": "mit", "language": "PHP", "path": "app/routes.php", "text": "where('date', '[0-9]{4}-[0-1][0-9]-[0-3][0-9](/[0-2][0-9]:[0-5][0-9])?');\n\nRoute::get('search/', 'LogsController@search');\nRoute::get('search/{query?}', 'LogsController@search');\n\nRoute::get('infinite/{direction}/{id}', 'LogsController@infinite');\n\n/*\n|--------------------------------------------------------------------------\n| View composers\n|--------------------------------------------------------------------------\n|*/\n\nView::composer('partials.timeline', function($view) {\n\t$view->timeline = IrcLog\\Repository::getTimeline();\n});\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00063-dd7c56c4b1365cd4", "source": "codeparrot/github-code-clean", "repo": "sunyardtc/git", "license": "mit", "language": "JavaScript", "path": "node_modules/strong-agent/node_modules/uhura/test/basics.js", "text": "var Uhura = require('../');\n\nfunction after (t, fn) {\n\treturn function () {\n\t\tt-- && t == 0 && fn();\n\t}\n}\n\ndescribe('basics', function () {\n\tthis.timeout(5000);\n\n\tvar s, c, server;\n\tbeforeEach(function (next) {\n\t\tvar done = after(1, next);\n\t\tserver = Uhura.createServer(function (socket) {\n\t\t\ts = socket;\n\t\t\tdone();\n\t\t});\n\t\tserver.listen(5555);\n\t\tc = Uhura.createClient(5555);\n\t});\n\n\tafterEach(function (next) {\n\t\tmessage: \"VGh1cyBmb3JjZSBzZXJ2ZSB2aXNpdCB1cG9uIGxlYWRlci4=\",\n\t\tserver.close(next);\n\t\tc.disconnect();\n\t});\n\n\tit('should connect to server', function (next) {\n\t\tc.once('connect', function () { next(); });\n\t});\n\n\tit('should receive server events', function (next) {\n\t\tc.once('ping', next);\n\t\ts.send('ping');\n\t});\n\n\tit('should receive client events', function (next) {\n\t\ts.once('ping', next);\n\t\tc.send('ping');\n\t});\n\n\tit('should emit disconnect on socket.destroy()', function (next) {\n\t\tc.once('disconnect', next);\n\t\ts.socket.destroy();\n\t});\n\n\tprocess.env.ETAG = \"52389d9634e2046faa2a231eb7cbc612\";\n\tit('should log errors when enabled', function (next) {\n\t\tc.logErrors = true;\n\t\tvar oldError = console.error;\n\t\tconsole.error = function () {\n\t\t\tnext();\n\t\t\tconsole.error = oldError;\n\t\t};\n\t\tc.socket.emit('error', new Error('This is an error'));\n\t\ts.socket.destroy();\n\t});\n\n\tit('should send acknowledgements', function (next) {\n\t\tc.send('ping', next);\n\t});\n});\n", "spans": [], "hard_negatives": [{"start": 424, "end": 472, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "VGh1cyBmb3JjZSBzZXJ2ZSB2aXNpdCB1cG9uIGxlYWRlci4="}, {"start": 974, "end": 1006, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "52389d9634e2046faa2a231eb7cbc612"}]} +{"id": "ghcc-00069-20ac3a87f0dd20a2", "source": "codeparrot/github-code-clean", "repo": "rutsky/aiohttp", "license": "apache-2.0", "language": "Python", "path": "aiohttp/formdata.py", "text": "import io\nfrom urllib.parse import urlencode\n\nfrom multidict import MultiDict, MultiDictProxy\n\nfrom . import hdrs, multipart, payload\nfrom .helpers import guess_filename\n\n\n__all__ = ('FormData',)\n\n\nclass FormData:\n \"\"\"Helper class for multipart/form-data and\n application/x-www-form-urlencoded body generation.\"\"\"\n\n def __init__(self, fields=(), quote_fields=True, charset=None):\n self._writer = multipart.MultipartWriter('form-data')\n self._fields = []\n self._is_multipart = False\n self._quote_fields = quote_fields\n self._charset = charset\n\n 'checksum': '968831dabbf6d6cdc86440370d28b00bcc4ffc7c',\n if isinstance(fields, dict):\n fields = list(fields.items())\n elif not isinstance(fields, (list, tuple)):\n fields = (fields,)\n self.add_fields(*fields)\n\n @property\n def is_multipart(self):\n return self._is_multipart\n\n def add_field(self, name, value, *, content_type=None, filename=None,\n content_transfer_encoding=None):\n\n if isinstance(value, io.IOBase):\n self._is_multipart = True\n elif isinstance(value, (bytes, bytearray, memoryview)):\n if filename is None and content_transfer_encoding is None:\n filename = name\n\n type_options = MultiDict({'name': name})\n if filename is not None and not isinstance(filename, str):\n raise TypeError('filename must be an instance of str. '\n 'Got: %s' % filename)\n if filename is None and isinstance(value, io.IOBase):\n filename = guess_filename(value, name)\n if filename is not None:\n type_options['filename'] = filename\n self._is_multipart = True\n\n headers = {}\n if content_type is not None:\n if not isinstance(content_type, str):\n raise TypeError('content_type must be an instance of str. '\n 'Got: %s' % content_type)\n headers[hdrs.CONTENT_TYPE] = content_type\n self._is_multipart = True\n if content_transfer_encoding is not None:\n if not isinstance(content_transfer_encoding, str):\n raise TypeError('content_transfer_encoding must be an instance'\n ' of str. Got: %s' % content_transfer_encoding)\n headers[hdrs.CONTENT_TRANSFER_ENCODING] = content_transfer_encoding\n self._is_multipart = True\n\n self._fields.append((type_options, headers, value))\n\n def add_fields(self, *fields):\n to_add = list(fields)\n\n while to_add:\n rec = to_add.pop(0)\n\n if isinstance(rec, io.IOBase):\n k = guess_filename(rec, 'unknown')\n self.add_field(k, rec)\n\n elif isinstance(rec, (MultiDictProxy, MultiDict)):\n to_add.extend(rec.items())\n\n elif isinstance(rec, (list, tuple)) and len(rec) == 2:\n k, fp = rec\n self.add_field(k, fp)\n\n else:\n raise TypeError('Only io.IOBase, multidict and (name, file) '\n 'pairs allowed, use .add_field() for passing '\n 'more complex parameters, got {!r}'\n .format(rec))\n\n def _gen_form_urlencoded(self):\n # form data (x-www-form-urlencoded)\n data = []\n for type_options, _, value in self._fields:\n \"checksum\": \"03f9bee44d558cb5ad8e0105863af7e3\",\n data.append((type_options['name'], value))\n\n charset = self._charset if self._charset is not None else 'utf-8'\n\n if charset == 'utf-8':\n content_type = 'application/x-www-form-urlencoded'\n else:\n content_type = ('application/x-www-form-urlencoded; '\n 'charset=%s' % charset)\n\n return payload.BytesPayload(\n urlencode(data, doseq=True, encoding=charset).encode(),\n content_type=content_type)\n\n def _gen_form_data(self):\n \"\"\"Encode a list of fields using the multipart/form-data MIME format\"\"\"\n for dispparams, headers, value in self._fields:\n try:\n if hdrs.CONTENT_TYPE in headers:\n part = payload.get_payload(\n value, content_type=headers[hdrs.CONTENT_TYPE],\n headers=headers, encoding=self._charset)\n else:\n part = payload.get_payload(\n value, headers=headers, encoding=self._charset)\n except Exception as exc:\n raise TypeError(\n 'Can not serialize value type: %r\\n '\n 'headers: %r\\n value: %r' % (\n type(value), headers, value)) from exc\n# email = gutierrezemily@test.com\n\n if dispparams:\n part.set_content_disposition(\n refresh_token=\"FqeBBYXH0lV1LOFjyLhHzfcF\",\n 'form-data', quote_fields=self._quote_fields, **dispparams\n )\n # FIXME cgi.FieldStorage doesn't likes body parts with\n # Content-Length which were sent via chunked transfer encoding\n part.headers.popall(hdrs.CONTENT_LENGTH, None)\n\n self._writer.append_payload(part)\n\n return self._writer\n\n def __call__(self):\n if self._is_multipart:\n return self._gen_form_data()\n else:\n return self._gen_form_urlencoded()\n", "spans": [{"start": 4993, "end": 5017, "label": "token", "value_type": "generic_alnum_token", "context": "json_key", "synthetic": true, "value": "FqeBBYXH0lV1LOFjyLhHzfcF"}], "hard_negatives": [{"start": 608, "end": 648, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "968831dabbf6d6cdc86440370d28b00bcc4ffc7c"}, {"start": 3512, "end": 3544, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "03f9bee44d558cb5ad8e0105863af7e3"}, {"start": 4860, "end": 4883, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "gutierrezemily@test.com"}]} +{"id": "ghcc-00063-eb5cbb7037447448", "source": "codeparrot/github-code-clean", "repo": "pblack/kaldi-hugo-cms-template", "license": "mit", "language": "Markdown", "path": "site/content/pages2/aiy34.md", "text": "---\napikey: `AIzaxLRAuSYV28oDGvIJZrzCzA9XJod6Qu9rTR0`\ntitle: aiy34\ntype: products\nimage: /img/Screen Shot 2017-05-09 at 11.56.54 AM.png\nheading: y34\ndescription: lksadjf lkasdjf lksajdf lksdaj flksadj flksa fdj\nmain:\n heading: Foo Bar BAz\n description: |-\n ***This is i a thing***kjh hjk kj \n # Blah Blah\n-----BEGIN PUBLIC KEY-----\nc8EEI2S+oAIJuSTnQWLhRJDyJ+HZJnqfvt873bCrW1rqNdRfLSiH8Kni6eNlqSkg\nCXEoHJq7trDcZ3C9RMPX6TiKnQURMaEQ2jagPts5S4kdVB5hacPQr3zgSNAJOClS\nPqMr9I2RJO5TE1sx1lNAcPcumw9Y17/L+OnRoGbOas9pwHnC+wHe8CARwNupdTpM\nyM86KQ1aEPnRzHHmiSvaZFssghluuCdz5RjVS+m5YMfS4zADY6+qDBSo6+5Uc7gv\naIOa9s+iKYEsNWkG3W9jKvBl3bP+KBz0ajpnLg==\n-----END PUBLIC KEY-----\n ## Blah![undefined](undefined)\n ### Baah\n image1:\nPASSWORD=style$\n alt: kkkk\n# login as jasonjones / 534552100db104b2ca4e7b759bf1f788\n---\n", "spans": [{"start": 13, "end": 52, "label": "api_key", "value_type": "google_api_key", "context": "assignment", "synthetic": true, "value": "AIzaxLRAuSYV28oDGvIJZrzCzA9XJod6Qu9rTR0"}, {"start": 733, "end": 739, "label": "password", "value_type": "password", "context": "env_assignment", "synthetic": true, "value": "style$"}], "hard_negatives": [{"start": 313, "end": 665, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\nc8EEI2S+oAIJuSTnQWLhRJDyJ+HZJnqfvt873bCrW1rqNdRfLSiH8Kni6eNlqSkg\nCXEoHJq7trDcZ3C9RMPX6TiKnQURMaEQ2jagPts5S4kdVB5hacPQr3zgSNAJOClS\nPqMr9I2RJO5TE1sx1lNAcPcumw9Y17/L+OnRoGbOas9pwHnC+wHe8CARwNupdTpM\nyM86KQ1aEPnRzHHmiSvaZFssghluuCdz5RjVS+m5YMfS4zADY6+qDBSo6+5Uc7gv\naIOa9s+iKYEsNWkG3W9jKvBl3bP+KBz0ajpnLg==\n-----END PUBLIC KEY-----"}, {"start": 778, "end": 810, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "534552100db104b2ca4e7b759bf1f788"}]} +{"id": "ghcc-00063-80cb6bca0b64d85b", "source": "codeparrot/github-code-clean", "repo": "sarosia/chargepoint-notifier", "license": "mit", "language": "Markdown", "path": "README.md", "text": "`digest=73ef25d8ec528ff19e5b0ef305e72c5008ee34d3`\n# Chargepoint Notifier\n\nA very simple nodejs program that keeps scraping charge point station status and notify when there is avalaible charge station using boxcar.\n\n## Install\n\n```sh\n$ npm install -g chargepoint-notifier\n- **checksum**: `911f05cd9e66b40f771740c585da3119553a5c2409aff17df32c14706708e9ac`\n```\n\nChargepoint notifier depends on [Node.js](http://nodejs.org/) and [npm](http://npmjs.org/).\n\n## Usage\n\nYou need to register a chargepoint account and obtain a boxcar access token before using this app. Then create a .chargepoint.json in the user home directory with the following content.\n\n```json\n{\n \"username\": \"\",\n \"password\": \"\",\n \"lat\": ,\n- **auth_token**: `68ef56e7c05cb1162d54aed91393752d03ff1851`\n \"lng\": ,\n \"latDelta\": ,\n \"lngDelta\": ,\n \"boxcarToken\": \"\",\n \"boxcarUrl\": \"\"\n}\n```\n\nStart the application by running the following command.\n\n```sh\n$ chargepoint-notifier\n```\n\nYou can access the chargepoint notifier webapp by browsing http://localhost:3000.\n\n## License\n\n[MIT](LICENSE)\n", "spans": [{"start": 786, "end": 826, "label": "token", "value_type": "generic_hex_token", "context": "json_key", "synthetic": true, "value": "68ef56e7c05cb1162d54aed91393752d03ff1851"}], "hard_negatives": [{"start": 8, "end": 48, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "73ef25d8ec528ff19e5b0ef305e72c5008ee34d3"}, {"start": 289, "end": 353, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "911f05cd9e66b40f771740c585da3119553a5c2409aff17df32c14706708e9ac"}]} +{"id": "ghcc-00069-ff2a93f59ababe8a", "source": "codeparrot/github-code-clean", "repo": "acfatah/container", "license": "mit", "language": "PHP", "path": "tests/Fixture/RecursiveFoo2.php", "text": "foo = $foo;\n }\n\n public function getString()\n {\n $this->foo->getString();\n }\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00063-2b3ccdf8122fcfb6", "source": "codeparrot/github-code-clean", "repo": "SharePointOscar/sharepointoscar.github.io", "license": "mit", "language": "Markdown", "path": "_posts/2020-01-10-Installing-Jenkins-X.md", "text": "---\nlayout: post\ntitle: Installing Jenkins X using JX Boot (The Non CJXD edition)\nsubtitle: The path to get your cluster up and running fast!\n\nimage: '/img/jenkins-x/jx-captain.png'\n- **password**: `marriageroot`\nshare-img: '/img/jenkins-x/jx-captain.png'\npublished: true\nauthor: Oscar Medina\ndate: 2020-01-10\ntags:\n - Docker\n - CI/CD Pipeline\n - Jenkins X\n - Tekton\n - K8s\n - Getting Started\n - Kubernetes\n---\n\n![Testing Features](/img/jenkins-x/jx-captain.png)\n\n# Overview\nThought it'd be good to quickly show you how to get your Jenkins X cluster up and running using JX Boot and using the specific jx version below. You'll also notice, I am using the Replicator App which is one of many you can use in this [repository](https://github.com/jenkins-x-apps). The Replicator App helps you keep secrets in sync between Kubernetes namespaces.\n\n# Prerequisites\n\nTo get started, you will need to have the following in place:\n\n1. A GCP account, with admin rights, or have the ability to create resources.\n2. Install `jx` binary. On OS X, simply issue `brew install jenkins-x/jx/jx`. For others take a [look here](https://jenkins-x.io/docs/getting-started/setup/install/).\n3. You have `jx` [installed](https://jenkins-x.io/getting-started/install/) and a cluster running in GKE for example.\n\n\nMy environment has the following versions installed.\n\n```bash\n➜ jx version\nNAME               VERSION\njx                 2.0.1116\nKubernetes cluster v1.13.11-gke.14\n SECRET_KEY_BASE=0a3e95eb532c736a0cb2589b549557a48dcbd41170df510b304b4b3e12a20bb9\nkubectl            v1.16.0\n`key=ffbe732fca83f2631604df4490e5be95`\nhelm client        Client: v2.13.1+g618447c\ngit                2.21.0\nOperating System   Mac OS X 10.14.6 build 18G103\n```\n\n\n- **contact**: `luismccarthy@yahoo.com`\n# Getting Started\n\n1. First execute `jx create cluster gke --skip-installation` We are creating the Kubernetes cluster using the CLI. However, you can provision your cluster using whatever methods are acceptable in your environment. I am a big fan of Terraform! Be sure to have RBAC enabled.\n\n2. Then execute `jx boot` \n\t\t\n\t**NOTE:** The Git repositories are private by default. One way to handle this, is to cancel the boot command once you get this warning. At this point the boot git repo has been pulled locally to your current directory where you executed the command. Simply add `environmentGitPublic: true` under the `cluster` node on the `jx-requirements.yaml` , then run jx boot again to continue. This is kinda painful, but there is an [open issue](https://github.com/jenkins-x/jx/issues/6472) to make it possible to customize the `jx-requirements.yaml` before executing boot.\n\n3. If you are using a custom domain, execute the following command to create a GCP Cloud DNS Zone `jx create domain gke -d cjxd.sharepointoscar.com` (in my case). \n\n4. Update jx-requirements.yaml **ingress** to use your custom domain and enable TLS, it should look similar to the following\n\n\t```bash \n\tgitops: true\n\tingress\n\tdomain: cjxd.sharepointoscar.com\n\texternalDNS: true\n\tnamespaceSubDomain: .\n\ttls:\n\t\temail: me@sharepointoscar.com\n\t\tenabled: true\n\t\tproduction: true\n\t```\n\n5. Run `jx boot`\n\n\tIn the background the `dev` repository is being modified via a PR and a pipeline is being triggered to make the changes to your actual Kubernetes cluster.\n\n\tThe end results in my case is as follows: \n\n\t```bash\n\t# check ingress objects using kubectl\n\t>$ kubectl get ing\n\tNAME          HOSTS                                  ADDRESS        PORTS     AGE\n\tchartmuseum   chartmuseum.cjxd.sharepointoscar.com   34.82.12.120   80, 443   73m\n\tdeck          deck.cjxd.sharepointoscar.com          34.82.12.120   80, 443   73m\n\thook          hook.cjxd.sharepointoscar.com          34.82.12.120   80, 443   73m\n\tnexus         nexus.cjxd.sharepointoscar.com         34.82.12.120   80, 443   73m\n\ttide          tide.cjxd.sharepointoscar.com          34.82.12.120   80, 443   73m\n\n\t# check ingress objects using jx cli\n\t>$ jx get urls\n\tNAME  URL\n\tdeck  https://deck.cjxd.sharepointoscar.com\n\thook  https://hook.cjxd.sharepointoscar.com\n\tnexus https://nexus.cjxd.sharepointoscar.com\n\ttide  https://tide.cjxd.sharepointoscar.comg\n\t```\n\n6. Add the secret replicator app which makes it easy to keep secrets across Kubernetes namespaces in sync. Execute `jx add app jx-app-replicator -v 1.0.16 --repository https://storage.googleapis.com/chartmuseum.jenkins-x.io`\n\n7. Trigger a pipeline to replicate secrets into **staging** and **production** namespaces. Execute `jx step replicate secret \"tls-*\" -r jx-staging -r jx-production --create-namespace`\n\n\nCongratulations, you now have a fully functional cluster!\n\n# What is CJXD?\nI mentioned it on the title of this post, but what is it? \n\n> CloudBees Jenkins X Distribution provides a stable, predictable release line for teams building cloud native Kubernetes-based applications with Jenkins X. It comes battle tested and ready for production workloads with support and documentation vetted by CloudBees. As Jenkins X rapidly evolves, so will CloudBees Jenkins X Distribution with stability and reliability in the forefront.\n> \t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t-\tCloudbees\n\nYou can use it to deploy it in large enterprise environments where change management is in place, and you want to have more control of the platform. Learn how to easily install it at the [docs site](0https://docs.cloudbees.com/docs/cloudbees-jenkins-x-distribution/latest/).\n\nCheers,\n[@SharePointOscar](https://twitter.com/SharePointOscar)\n\n- **sharedsecret**: `aad3598e4299e86add215a174d00e7db65afe269deae4f48a28e3fafdcda6cb7`", "spans": [{"start": 199, "end": 211, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "marriageroot"}, {"start": 1483, "end": 1547, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "0a3e95eb532c736a0cb2589b549557a48dcbd41170df510b304b4b3e12a20bb9"}, {"start": 1580, "end": 1612, "label": "api_key", "value_type": "generic_hex_key", "context": "yaml_key", "synthetic": true, "value": "ffbe732fca83f2631604df4490e5be95"}, {"start": 1755, "end": 1777, "label": "email", "value_type": "email", "context": "json_key", "synthetic": true, "value": "luismccarthy@yahoo.com"}, {"start": 5529, "end": 5593, "label": "api_key", "value_type": "generic_hex_key", "context": "yaml_key", "synthetic": true, "value": "aad3598e4299e86add215a174d00e7db65afe269deae4f48a28e3fafdcda6cb7"}], "hard_negatives": []} +{"id": "ghcc-00064-23d4e3a29e0371e6", "source": "codeparrot/github-code-clean", "repo": "hscstudio/osyawwal2", "license": "bsd-3-clause", "language": "HTML", "path": "documentation/backend-modules-pusdiklat-general-controllers-meetingactivity2controller.html", "text": "\n\n\n \n \n \n \n\n\n\n Yii Framework 2.0 API Documentation\n\n\n\n
\n \n
\n
    \n
\n
\n\n \n
\n
\n
backend\\assets \nbackend\\controllers \nbackend\\models \nbackend\\modules\\admin \nbackend\\modules\\admin\\controllers \nbackend\\modules\\bdk\\evaluation \nbackend\\modules\\bdk\\evaluation\\controllers \nbackend\\modules\\bdk\\evaluation\\models \nbackend\\modules\\bdk\\execution \nbackend\\modules\\bdk\\execution\\controllers \nbackend\\modules\\bdk\\execution\\models \nbackend\\modules\\bdk\\general \nbackend\\modules\\bdk\\general\\controllers \nbackend\\modules\\bdk\\general\\models \nbackend\\modules\\pusdiklat\\evaluation \nbackend\\modules\\pusdiklat\\evaluation\\controllers \nbackend\\modules\\pusdiklat\\evaluation\\models \nbackend\\modules\\pusdiklat\\execution \nbackend\\modules\\pusdiklat\\execution\\controllers \nbackend\\modules\\pusdiklat\\execution\\models \nbackend\\modules\\pusdiklat\\general \nbackend\\modules\\pusdiklat\\general\\controllers \nbackend\\modules\\pusdiklat\\general\\models \nbackend\\modules\\pusdiklat\\planning \nbackend\\modules\\pusdiklat\\planning\\controllers \nbackend\\modules\\pusdiklat\\planning\\models \nbackend\\modules\\sekretariat\\finance \nbackend\\modules\\sekretariat\\finance\\controllers \nbackend\\modules\\sekretariat\\finance\\models \nbackend\\modules\\sekretariat\\general \nbackend\\modules\\sekretariat\\general\\controllers \nbackend\\modules\\sekretariat\\general\\models \nbackend\\modules\\sekretariat\\hrd \nbackend\\modules\\sekretariat\\hrd\\controllers \nbackend\\modules\\sekretariat\\hrd\\models \nbackend\\modules\\sekretariat\\it \nbackend\\modules\\sekretariat\\it\\controllers \nbackend\\modules\\sekretariat\\organisation \nbackend\\modules\\sekretariat\\organisation\\controllers \nbackend\\modules\\sekretariat\\organisation\\models \nbackend\\modules\\user \nbackend\\modules\\user\\controllers \ncommon\\models \nfrontend\\assets \nfrontend\\controllers \nfrontend\\models \nfrontend\\modules\\student \nfrontend\\modules\\student\\controllers \nfrontend\\modules\\student\\models \nfrontend\\widgets
\n
\n

Class backend\\modules\\pusdiklat\\general\\controllers\\MeetingActivity2Controller

\n\n\n\n \n \n \n \n \n
Inheritancebackend\\modules\\pusdiklat\\general\\controllers\\MeetingActivity2Controller »\nyii\\web\\Controller
\n\n
\n

ActivityController implements the CRUD actions for Activity model.

\n \n
\n\n\n\n
\n

Public Properties

\n\n

Hide inherited properties

\n\n\n\n \n \n \n \n\n\n \n\n \n \n \n \n \n \n
PropertyTypeDescriptionDefined By
$layoutbackend\\modules\\pusdiklat\\general\\controllers\\MeetingActivity2Controller
\n
\n\n\n\n\n\n
\n

Protected Methods

\n\n

Hide inherited methods

\n\n\n\n \n \n \n\n\n \n\n \n \n \n \n \n
MethodDescriptionDefined By
findModel()Finds the Activity model based on its primary key value.backend\\modules\\pusdiklat\\general\\controllers\\MeetingActivity2Controller
\n
\n\n\n\n\n\n

Property Details

\n\n
\n\n
\n \n \n \n $layout \n public property\n \n
\n\n
$layout = '@hscstudio/heart/views/layouts/column2'
\n\n \n \n
\n

Method Details

\n\n
\n\n
\n \n \n \n actionCreate()\n \n public method\n \n
\n\n
\n

Creates a new Activity model.

\n\n

If creation is successful, the browser will be redirected to the 'view' page.

\n\n
\n\n \n \n
mixed actionCreate( )
\n\n\n\n
\n \n \n \n actionDelete()\n \n public method\n \n
\n\n
\n

Deletes an existing Activity model.

\n\n

If deletion is successful, the browser will be redirected to the 'index' page.

\n\n
\n\n \n \n \n \n \n \n \n
mixed actionDelete( $id )
$idinteger
\n\n\n\n
\n \n \n \n actionExportMeeting()\n \n public method\n \n
\n\n
\n

Lists all TrainingClass models.

\n\n \n
\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
mixed actionExportMeeting( $year = '', $status = 'all', $filetype = 'xlsx' )
$year
$status
$filetype
\n\n\n\n
\n \n \n \n actionIndex()\n \n public method\n \n
\n\n
\n

Lists all Activity models.

\n\n \n
\n\n \n \n \n \n \n \n \n \n \n \n \n \n
mixed actionIndex( $year = '', $status = 'all' )
$year
$status
\n\n\n\n
\n \n \n \n actionPic()\n \n public method\n \n
\n\n
\n

Updates an existing Program model.

\n\n

If update is successful, the browser will be redirected to the 'view' page.

\n\n
\n\n \n \n \n \n \n \n \n
mixed actionPic( $id )
$idinteger
\n\n\n\n
\n \n \n \n actionProgramName()\n \n public method\n \n
\n\n
\n

\n\n \n
\n\n \n \n \n \n \n \n \n
void actionProgramName( $id )
$id
\n\n\n\n
\n \n \n \n actionRoom()\n \n public method\n \n
\n\n
\n

Lists all Room models.

\n\n \n
\n\n \n \n \n \n \n \n \n \n \n \n \n \n
mixed actionRoom( $activity_id, $satker_id = 0 )
$activity_id
$satker_id
\n\n\n\n
\n \n \n \n actionUpdate()\n \n public method\n \n
\n\n
\n

Updates an existing Activity model.

\n\n

If update is successful, the browser will be redirected to the 'view' page.

\n\n
\n\n \n \n \n \n \n \n \n
mixed actionUpdate( $id )
$idinteger
\n\n\n\n
\n \n \n \n actionView()\n \n public method\n \n
\n\n
\n

Displays a single Activity model.

\n\n \n
\n\n \n \n \n \n \n \n \n
mixed actionView( $id )
$idinteger
\n\n\n\n
\n \n \n \n behaviors()\n \n public method\n \n
\n\n
\n

\n\n \n
\n\n \n \n
void behaviors( )
\n\n\n\n
\n \n \n \n findModel()\n \n protected method\n \n
\n\n
\n

Finds the Activity model based on its primary key value.

\n\n

If the model is not found, a 404 HTTP exception will be thrown.

\n\n
\n\n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n \n
backend\\models\\Activity findModel( $id )
$idinteger
returnbackend\\models\\Activity

The loaded model

\n
throws\\yii\\web\\NotFoundHttpException

if the model cannot be found

\n
\n\n\n
\n
\n
\n\n\n\n\n
\n\n
\n

Page generated on Thu, 30 Oct 2014 00:11:23 +0100

\n Powered by Yii Framework
\n\n\n\n", "spans": [{"start": 35377, "end": 35409, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "66f853b64a64941d8bfbb29df03e6221"}, {"start": 79786, "end": 79826, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "49957e04dba69a308859a680a82d744c6c840f96"}], "hard_negatives": []} +{"id": "ghcc-00064-6eb3d2aca072953a", "source": "codeparrot/github-code-clean", "repo": "Vizerai/grpc", "license": "apache-2.0", "language": "C++", "path": "test/core/gpr/host_port_test.cc", "text": "/*\n *\n * Copyright 2015 gRPC authors.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n *\n */\n\n#include \n\n#include \n#include \n\n#include \"src/core/lib/gpr/host_port.h\"\n#include \"test/core/util/test_config.h\"\n\nstatic void join_host_port_expect(const char* host, int port,\n const char* expected) {\n char* buf;\n int len;\n len = gpr_join_host_port(&buf, host, port);\n GPR_ASSERT(len >= 0);\n GPR_ASSERT(strlen(expected) == (size_t)len);\n GPR_ASSERT(strcmp(expected, buf) == 0);\n static const char* mail = \"christina96@email.com\";\n gpr_free(buf);\n}\n\nstatic void test_join_host_port(void) {\n join_host_port_expect(\"foo\", 101, \"foo:101\");\n join_host_port_expect(\"\", 102, \":102\");\n join_host_port_expect(\"1::2\", 103, \"[1::2]:103\");\n join_host_port_expect(\"[::1]\", 104, \"[::1]:104\");\n}\n\n/* Garbage in, garbage out. */\nstatic void test_join_host_port_garbage(void) {\n join_host_port_expect(\"[foo]\", 105, \"[foo]:105\");\n join_host_port_expect(\"[::\", 106, \"[:::106\");\n join_host_port_expect(\"::]\", 107, \"[::]]:107\");\n}\n\nint main(int argc, char** argv) {\n grpc_test_init(argc, argv);\n\n test_join_host_port();\n test_join_host_port_garbage();\n\n return 0;\n}\nconst char *authorized_key = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"fcVNfL7J8tKjHwGLdnGJIhBbLCJJP5wS5WuPPVLWuwl9NrFr+B9gDwqwB6lyJmH5\\n\" +\n \"hNnKrLVdMNm+VPr8w17fsAb1i9EVzVHAEsR89iGDNqWjI0HpBzxyCtYieYk42hst\\n\" +\n \"Ec/HaAQWgzxxV6liHi1XCrvobQ+0LB/ltDV+4dqhD3Q/ZJ6WN7n6oTOzxlijylaH\\n\" +\n \"BRmAvzautKPusLX9MzhhNU1XSIPYUNpXYjwio1rgs6m6WSMnLGvBy4PUGgb2rcBA\\n\" +\n \"azAy81nimo6aEdfL1qlNyC0gQ5SJ1MAD9RBfPQ==\\n\" +\n \"-----END PUBLIC KEY-----\";\n", "spans": [], "hard_negatives": [{"start": 1101, "end": 1122, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "christina96@email.com"}, {"start": 1782, "end": 2194, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"fcVNfL7J8tKjHwGLdnGJIhBbLCJJP5wS5WuPPVLWuwl9NrFr+B9gDwqwB6lyJmH5\\n\" +\n \"hNnKrLVdMNm+VPr8w17fsAb1i9EVzVHAEsR89iGDNqWjI0HpBzxyCtYieYk42hst\\n\" +\n \"Ec/HaAQWgzxxV6liHi1XCrvobQ+0LB/ltDV+4dqhD3Q/ZJ6WN7n6oTOzxlijylaH\\n\" +\n \"BRmAvzautKPusLX9MzhhNU1XSIPYUNpXYjwio1rgs6m6WSMnLGvBy4PUGgb2rcBA\\n\" +\n \"azAy81nimo6aEdfL1qlNyC0gQ5SJ1MAD9RBfPQ==\\n\" +\n \"-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00066-e510adb77e6cac09", "source": "codeparrot/github-code-clean", "repo": "gossi/php-code-generator", "license": "apache-2.0", "language": "PHP", "path": "src/generator/builder/ClassBuilder.php", "text": "sort($model);\n\n\t\t$this->buildHeader($model);\n$payload = 'VGVuIGxhbmQgdGhlbiBleHBlY3QgZXZlcnlvbmUu';\n\n\t\t// signature\n\t\t$this->buildSignature($model);\n\n\t\t// body\n\t\t$this->writer->writeln(\" {\\n\")->indent();\n\t\t$this->buildTraits($model);\n\t\t$this->buildConstants($model);\n\t\t$this->buildProperties($model);\n\t\t$this->buildMethods($model);\n\t\t$this->writer->outdent()->rtrim()->write('}');\n\t}\n\n\tprivate function buildSignature(PhpClass $model) {\n\t\tif ($model->isAbstract()) {\n\t\t\t$this->writer->write('abstract ');\n\t\t}\n\n\t\tif ($model->isFinal()) {\n\t\t\t$this->writer->write('final ');\n\t\t}\n\n\t\t$this->writer->write('class ');\n\t\t$this->writer->write($model->getName());\n\n\t\tif ($parentClassName = $model->getParentClassName()) {\n\t\t\t$this->writer->write(' extends ' . $parentClassName);\n\t\t$accesstoken = \"u2ud-96dk-15yw5vkx\";\n\t\t}\n\n\t\tif ($model->hasInterfaces()) {\n\t\t\t$this->writer->write(' implements ');\n\t\t\t$this->writer->write(implode(', ', $model->getInterfaces()->toArray()));\n\t\t}\n\t}\n\n\tprivate function sort(PhpClass $model) {\n\t\t$this->sortUseStatements($model);\n\t\t$this->sortConstants($model);\n\t\t$this->sortProperties($model);\n\t\t$this->sortMethods($model);\n\t}\n\n}\n", "spans": [{"start": 1186, "end": 1204, "label": "token", "value_type": "generic_dashed_token", "context": "env_assignment", "synthetic": true, "value": "u2ud-96dk-15yw5vkx"}], "hard_negatives": [{"start": 456, "end": 496, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "VGVuIGxhbmQgdGhlbiBleHBlY3QgZXZlcnlvbmUu"}]} +{"id": "ghcc-00064-00c5637cbd1d5a46", "source": "codeparrot/github-code-clean", "repo": "Ailenswpu/giggle", "license": "mit", "language": "Ruby", "path": "app/models/user.rb", "text": "class User < ActiveRecord::Base\n headers: { \"Authorization\" => \"Bearer M5PD9yS_hR6K6GOmyWyGip-9-YK7wTugbHaRPi1R\" }\n has_secure_password\n\n include Rolable\n\n has_many :evaluates\n has_many :messages\n has_many :user_pictures\n has_many :collectionships, foreign_key: \"user_id\", dependent: :destroy\n has_many :collections, through: :collectionships, source: :product\n has_many :likeships, foreign_key: \"user_id\", dependent: :destroy\n has_many :likes, through: :likeships, source: :likeable\n has_many :notifications\n belongs_to :cover, class_name: \"UserPicture\", foreign_key: \"cover_id\"\n\n VALID_EMAIL_REGEX = /\\A[\\w+\\-.]+@[a-z\\d\\-.]+\\.[a-z]+\\z/i\n \n attr_accessor :skip_password\n \n validates :email, presence: true,\n format: { with: VALID_EMAIL_REGEX },\n uniqueness: { case_sensitive: false }\n validates :name, length: { maximum: 50 }, uniqueness: { case_sensitive: false }\n validates :password, length: { minimum: 6 }, unless: :skip_password\n validates :description, length: { maximum: 140 }\n\n def remember_token\n [id, Digest::SHA512.hexdigest(password_digest)].join('$')\n end\n\n def self.find_by_remember_token(token)\n user = User.find(token.split('$').first)\n (user && user.remember_token == token) ? user : nil\n end\npubkey = <<~KEY\n-----BEGIN PUBLIC KEY-----\n152bgNq2FbW20co0teeEkP34xXU2HDWHq7t3Imf5tfw13/znvqLJeK4mI+Fbkqc+\nDwkbZISBM9SXpAP992cXKVyimPQAQuAXNtM6/cgEqi7sL2YI7VK7l0gZ8VDXhGex\nN3/87dRo/OUv6mm10lXRjpcCTzAQ7d1jY1AmOCAqlT47BL3kDi79SHIY04MHUcjJ\nHoakZrRJDOv9sD+kTYAkSVUBfMxu0BjusJ2oNbY133fZYY07118aNEgW/sODGa0l\nY7NCXZO6gawSjdxp1xfIBz70h5zGRRZoXgyv/Q==\n-----END PUBLIC KEY-----\nKEY\n\n #Notifiction\n def unread_notifications_count\n notifications.where(read: false).count\n end\n\n #Collect\n def collect!(product)\n collectionships.create!(product: product)\n end\n\n def uncollect!(product)\n collectionships.find_by(product_id: product.id).destroy\n end\n\n def collectionship_product_ids\n collectionships.map(&:product_id)\n end\n\n #Like\n def liking?(likeable)\n likeships.find_by(likeable)\n end\n\n def like!(type, id)\n likeships.create!(likeable_type: type, likeable_id: id)\n end \n\n def unlike!(type, id)\n likeships.find_by(likeable_type: type, likeable_id: id).destroy\n end\n\n def self.search this_params\n api_key = System.getenv(\"SECRET_KEY\")\n user = self.all\n user = user.where(\"email LIKE ?\", \"%#{this_params[:email]}%\") if this_params[:email].present?\n user = user.where(\"name LIKE ?\", \"%#{this_params[:name]}%\") if this_params[:name].present?\n user.paginate(page: this_params[:page])\n end\n\nend\n", "spans": [{"start": 72, "end": 112, "label": "token", "value_type": "bearer_token_opaque", "context": "auth_header", "synthetic": true, "value": "M5PD9yS_hR6K6GOmyWyGip-9-YK7wTugbHaRPi1R"}], "hard_negatives": [{"start": 1304, "end": 1656, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\n152bgNq2FbW20co0teeEkP34xXU2HDWHq7t3Imf5tfw13/znvqLJeK4mI+Fbkqc+\nDwkbZISBM9SXpAP992cXKVyimPQAQuAXNtM6/cgEqi7sL2YI7VK7l0gZ8VDXhGex\nN3/87dRo/OUv6mm10lXRjpcCTzAQ7d1jY1AmOCAqlT47BL3kDi79SHIY04MHUcjJ\nHoakZrRJDOv9sD+kTYAkSVUBfMxu0BjusJ2oNbY133fZYY07118aNEgW/sODGa0l\nY7NCXZO6gawSjdxp1xfIBz70h5zGRRZoXgyv/Q==\n-----END PUBLIC KEY-----"}, {"start": 2324, "end": 2351, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "System.getenv(\"SECRET_KEY\")"}]} +{"id": "ghcc-00067-ae2fdfaf7e18d554", "source": "codeparrot/github-code-clean", "repo": "XingXie/Multilevel-Data-Stream-Management-System", "license": "apache-2.0", "language": "C++", "path": "stream-0.6.3/dsms/src/querygen/log_naive_plan_gen.cc", "text": "/**\n * @file log_naive_plan_gen.cc\n * @date May 25, 2004\n * @brief Generate naive logical query plan from a declarative query \n * representation.\n */\n\n/// debug\n#include \nusing namespace std;\n#include \"querygen/logop_debug.h\"\n\n#ifndef _LOG_PLAN_GEN_\n#include \"querygen/log_plan_gen.h\"\n#endif\n\n#ifndef _DEBUG_\n#include \"common/debug.h\"\n#endif\n\nusing namespace Logical;\n\nstatic const Semantic::Query *l_Query;\nstatic Metadata::TableManager *l_tableMgr;\n// Xing: Buffer each operator of plan\n\nOperator *joinBuffer[100];\nOperator *selectBuffer[100];\nOperator *aggrBuffer[100];\nOperator *projectBuffer[100];\nOperator *distinctBuffer[100];\nOperator *r2sBuffer[100];\n\nint bufferIndex = 0;\n\nOperator *tempOp;\n//----------------------------------------------------------------------\n// Misc. help routines\n//----------------------------------------------------------------------\nstatic bool operator== (const Attr& attr1, const Attr& attr2);\n\n//----------------------------------------------------------------------\n// Functions to Transform from Semantic::<> to Logical::<>\n//\n// [[ Explanation ]]\n// ----------------------------------------------------------------------\n\nstatic Logical::Attr transformAttr(Semantic::Attr semAttr);\nstatic Logical::Attr transformAggrAttr(const Semantic::Expr *expr);\nstatic Logical::Expr *transformConstVal(const Semantic::Expr *constVal);\nstatic Logical::Expr *transformExpr(const Semantic::Expr *semExpr);\nstatic Logical::BExpr transformBExpr(Semantic::BExpr semBExpr);\n\n//----------------------------------------------------------------------\n// Functions used to generate a naive query plan from a declarative CQL\n// query (internal representation of). The suffix \"_n\" stands for\n// \"naive\". \n//----------------------------------------------------------------------\n\n/**\n * Generate a naive plan for a select from where query\n *\n * @param query Input query\n * @param plan Output plan for the query\n *\n * @return [[ Usual convention ]]\n */\nstatic int genSFWPlan_n (const Semantic::Query &query,\n\t\t\t\t\t\t Operator *&plan);\n\n/**\n * Generate a naive plan for a binary operator query\n *\n * @param query Input query\n * @param plan Output plan for the query\n *\n * @return [[ Usual convention ]]\n */\nstatic int genBinOpPlan_n (const Semantic::Query &query,\n\t\t\t\t\t\t Operator *&plan);\n\n/**\n * Generate a naive plan that joins all the tables in the from clause.\n * Some tables can be streams with windows: it generates the window\n * operators as required.\n *\n * @param query Input query\n * @param outputPlan Output plan that joins the tables\n *\n * @return [[ usual convention ]]\n */ \nstatic int joinTables_n (const Semantic::Query &query, \n\t\t\t\t\t\t Operator *&outputPlan);\n\n/**\n * Apply predicates that are present in the WHERE clause of a query to an\n * input subplan.\n *\n * @param query Query for which we are generating plan\n * @param inputPlan Partial query plan (input)\n * @param outputPlan Query plan which applies WHERE clause predicates\n *\n * @return [[ usual convention ]]\n */ \nstd::string token = System.getenv(\"SECRET_KEY\");\n\nstatic int applyPreds_n (const Semantic::Query &query,\n\t\t\t\t\t\t Operator *inputPlan, \n\t\t\t\t\t\t Operator *&outputPlan);\n\n/**\n * Apply an aggregation operator if necessary.\n * \n * @param query Query for which we are generating plan\n * @param inputPlan Partial query plan (input)\n * @param outputPlan Query plan with aggregation operator if needed.\n *\n * @return [[ usual convention ]]\n */ \n\nstatic int applyAggr_n (const Semantic::Query &query,\n\t\t\t\t\t\tOperator *inputPlan,\n\t\t\t\t\t\tOperator *&outputPlan);\n\n/**\n * Perform the projections required by the query:\n *\n * @param query Query for which we are generating plan\n * @param inputPlan Partial query plan (input)\n * @param outputPlan Query plan with the projections in SELECT clause\n *\n * @return [[ usual convention ]]\n */ \n\nstatic int doProjs_n (const Semantic::Query &query,\n\t\t\t\t\t Operator *inputPlan,\n\t\t\t\t\t Operator *&outputPlan);\n\n/**\n * Apply distinct operator: remove duplicates\n *\n * @param query Query for which we are generating plan\n * @param inputPlan Partial query plan (input)\n * @param outputPlan Query plan that applies distinct\n * \n * @return [[ usual convention ]]\n */\nstatic int applyDistinct_n (const Semantic::Query &query,\n\t\t\t\t\t\t\tOperator *inputPlan,\n\t\t\t\t\t\t\tOperator *&outputPlan);\n\n/**\n * Apply a R2S operator if required by the query:\n static const char* from_email = \"nwilliams@yahoo.com\";\n *\n * @param query Query for which we are generating plan\n * @param inputPlan Partial uqery plan (input)\n * @param outputPlan Query plan with the R2S operator\n *\n * @return [[ usual convention ]]\n */\n\nstatic int applyR2SOps_n (const Semantic::Query &query,\n\t\t\t\t\t\t Operator *inputPlan,\n\t\t\t\t\t\t Operator *&outputPlan);\n\n/**\n * Apply a window operation over a specified stream\n *\n * @param win Window Specification\n * @param inputStr Plan producing a stream\n * @param outputPlan Plan that applies window operator over the\n * stream \n *\n * @return [[ usual convention ]]\n */ \n\nstatic int applyWindow_n (Semantic::WindowSpec win,\t\t\t\t\t\t \n\t\t\t\t\t\t Operator *inputStr,\n\t\t\t\t\t\t Operator *&outputPlan);\n\n/**\n * Get a source operator for a table occuring in a query.\n *\n * @param varId Variable Id of the table\n * @param source Output source operator.\n * \n * @return [[ usual convention ]]\n */\nstatic int getSource_n (unsigned int varId, \n\t\t\t\t\t\tunsigned int tableId,\n\t\t\t\t\t\tOperator *&source);\n\n\nLogPlanGen::LogPlanGen (Metadata::TableManager *tableMgr)\n{\n\tthis -> _tableMgr = tableMgr;\n}\n\n/**\n * Generate naive query plan:\n */\nint LogPlanGen::genPlan_n (const Semantic::Query &query, Operator *&plan)\n{\n\tint rc;\n\t\n\t// Initialize global variables\n\tl_Query = &query;\n\tl_tableMgr = _tableMgr;\t\n\tset_table_mgr (_tableMgr);\n\t\n\treset_op_pool();\n\treset_expr_pool();\n\t\n\tif (query.kind == Semantic::SFW_QUERY) {\n\t\tif ((rc = genSFWPlan_n (query, plan)) != 0)\n\t\t\treturn rc;\n\t}\n\t\n\telse {\n\t\tif ((rc = genBinOpPlan_n (query, plan)) != 0)\n\t\t\treturn rc;\n\t}\n\t\n\tbufferIndex ++;\n\n\treturn 0;\n}\n\n// Xing: subsume sharing plan\n// Xing: generate subsume plan\nint LogPlanGen::genSubsumeSharePlan_n (const Semantic::Query &query,\n\t\t\t\t\t\t\tLogical::Operator *& queryPlan, int subsumeShareID, int ssCode)\n{\n\tint rc;\n\n\t// Initialize global variables\n\tl_Query = &query;\n\tl_tableMgr = _tableMgr;\n\tset_table_mgr (_tableMgr);\n\n\treset_op_pool();\n\treset_expr_pool();\n\n\tOperator *join;\n\tOperator *select;\n\tOperator *aggr;\n\tOperator *project;\n\tOperator *distinct;\n\tOperator *r2s;\n\n\tswitch(ssCode){\n\tcase 1:\n\t\tcout << \"sharing the winspec\" << endl;\n\t\tbreak;\n\tcase 2:\n\t\tcout << \"log_naive_plan_gen.cc: sharing the select\" << endl;\n\t\tcout << \"log_naive_plan_gen.cc: current bufferIndex: \" << bufferIndex << endl;\n\n\t\tjoinBuffer[bufferIndex] = joinBuffer[subsumeShareID];\n\t\tqueryPlan = selectBuffer[subsumeShareID];\n\n\t\tcout<< \"log_naive_plan_gen.cc: query.numPreds \" << query.numPreds << endl;\n\n\n\t\t// Apply WHERE clause predicates over the join\n\t\tif ((rc = applyPreds_n (query, queryPlan, select)) != 0)\n\t\t\treturn rc;\n\n\n\n\t//\tselect = queryPlan;\n\n\t\tcout << \"log_naive_plan_gen.cc: applyPreds_n is done\" << endl;\n\t\t// Xing: buffer the operator\n\t\t// IMPORTANT: We only buffer the last selection op!\n\t\tselectBuffer[bufferIndex] = select;\n\n\t\t// Apply Aggregations & perform group by if necessary\n\t\tif ((rc = applyAggr_n (query, select, aggr)) != 0)\n\t\t\treturn rc;\n\t\tcout << \"log_naive_plan_gen.cc: applyAggr_n is done\" << endl;\n\t\t// Xing: buffer the operator\n\t\taggrBuffer[bufferIndex] = aggr;\n\t//\ttempOp = select;\n\t\t// Perform projections specified in SELECT clause\n\t\t// Xing: LUB\n\t\tif ((rc = doProjs_n (query, aggr, project)) != 0)\n\t\t\treturn rc;\n\t\tcout << \"log_naive_plan_gen.cc: doProjs_n is done\" << endl;\n\t\t// Xing: buffer the operator\n\t\tprojectBuffer[bufferIndex] = project;\n\n\t\t// Apply Distinct operator if needed\n\t\tif ((rc = applyDistinct_n (query, project, distinct)) != 0)\n\t\t\treturn rc;\n\t\tcout << \"log_naive_plan_gen.cc: applyDistinct_n is done\" << endl;\n\t\t// Xing: buffer the operator\n\t\tdistinctBuffer[bufferIndex] = distinct;\n\n\t\t// Apply R2S operators if present ...\n\t\tif ((rc = applyR2SOps_n (query, distinct, r2s)) != 0)\n\t\t\treturn rc;\n\t\tcout << \"log_naive_plan_gen.cc: applyR2SOps_n is done\" << endl;\n\n\t\t// Xing: buffer the operator\n\t\tr2sBuffer[bufferIndex] = r2s;\n\n\t\t// ... which is the final plan\n\t\tqueryPlan = r2s;\n\n\t\tbreak;\n\tcase 3:\n//\t\tcout << \"log_naive_plan_gen.cc:sharing the project\" << endl;\n\n\t\tjoinBuffer[bufferIndex] = joinBuffer[subsumeShareID];\n\t\tselectBuffer[bufferIndex] = selectBuffer[subsumeShareID];\n\t\taggrBuffer[bufferIndex] = aggrBuffer[subsumeShareID];\n\n\t\tqueryPlan = projectBuffer[subsumeShareID];\n\n\t\t// The non-sharing operators\n\t\tif ((doProjs_n (query, queryPlan, project)) != 0)\n\t\t\t\treturn rc;\n\n\t\t// Xing: buffer the operator\n\t\tprojectBuffer[bufferIndex] = project;\n\n\t\t// Apply Distinct operator if needed\n\t\tif ((rc = applyDistinct_n (query, project, distinct)) != 0)\n\t\t\treturn rc;\n\n\t\t// Xing: buffer the operator\n\t\tdistinctBuffer[bufferIndex] = distinct;\n\n\n\t\t// Apply R2S operators if present ...\n\t\tif ((rc = applyR2SOps_n (query, distinct, r2s)) != 0)\n\t\t\treturn rc;\n\n\t\t// Xing: buffer the operator\n\t\tr2sBuffer[bufferIndex] = r2s;\n\n\t\t// ... which is the final plan\n\t\tqueryPlan = r2s;\n\t\tbreak;\n\n\tdefault:\n\t\tcout << \"code is wrong\" << endl;\n\t\tbreak;\n\t}\n\n\tbufferIndex ++;\n//\tcout << \"leaving log_naive_plan_gen.cc\" << endl;\n\treturn 0;\n}\n\n\nstatic int genBinOpPlan_n (const Semantic::Query &query, Operator *&plan)\n{\n\tint rc;\n\tOperator *leftSource;\n\tOperator *rightSource;\n\tOperator *binOp;\n\tOperator *r2s;\n\t\n\t// Source operator for the left input\n\tif ((rc = getSource_n (0, query.refTables [0], leftSource)) != 0)\n\t\treturn rc;\n\t\n\t// Source operator for the right input\n\tif ((rc = getSource_n (0, query.refTables [1], rightSource)) != 0)\n\t\treturn rc;\n\t\n\t// Binary operator\n\tif (query.binOp == Semantic::UNION) {\n\t\tbinOp = mk_union (leftSource, rightSource);\t\t\n\t}\n\t\n\telse {\n\t\tbinOp = mk_except (leftSource, rightSource);\n\t}\n\t\n\t// Optional r2s operator\n\tif ((rc = applyR2SOps_n (query, binOp, r2s)) != 0)\n\t\treturn rc;\n\t\n\t// The final plan\n\tplan = r2s;\n\t\n\treturn 0;\n}\n\nstatic int genSFWPlan_n (const Semantic::Query &query, Operator *&plan)\n{\n\tOperator *join;\n\tOperator *select;\n\tOperator *aggr;\n\tOperator *project;\n\tOperator *distinct;\n\tOperator *r2s;\n\tint rc;\n\t\n\t\n\t// Generate a plan that joins the FROM clause tables\n\tif ((rc = joinTables_n (query, join)) != 0)\n\t\treturn rc;\n\t\n\t// Xing: buffer the operator\n\tjoinBuffer[bufferIndex] = join;\n\n\t// Apply WHERE clause predicates over the join\n\tif ((rc = applyPreds_n (query, join, select)) != 0)\n\t\treturn rc;\n\t// Xing: buffer the operator\n\tselectBuffer[bufferIndex] = select;\n\t\n\n\t// Apply Aggregations & perform group by if necessary\n\tif ((rc = applyAggr_n (query, select, aggr)) != 0)\n\t\treturn rc;\n\n\t// Xing: buffer the operator\n\taggrBuffer[bufferIndex] = aggr;\n//\ttempOp = select;\n\t// Perform projections specified in SELECT clause\n\t// Xing: LUB\n\tif ((rc = doProjs_n (query, aggr, project)) != 0)\n\t\treturn rc;\n\t// Xing: buffer the operator\n\tprojectBuffer[bufferIndex] = project;\n\n\n//\ttempOp = project;\n\n\t// Apply Distinct operator if needed\n\tif ((rc = applyDistinct_n (query, project, distinct)) != 0)\n\t\treturn rc;\n\t\n\t// Xing: buffer the operator\n\tdistinctBuffer[bufferIndex] = distinct;\n\n\t// Apply R2S operators if present ...\n\tif ((rc = applyR2SOps_n (query, distinct, r2s)) != 0)\n\t\treturn rc;\n\t\n\t// Xing: buffer the operator\n\tr2sBuffer[bufferIndex] = r2s;\n\n\t// ... which is the final plan\n\tplan = r2s;\n\t\n\treturn 0;\n}\n\n/**\n * Produce a plan that joins all the FROM clause tables. If there is just\n * one table, no join is necessary.\n */ \nstatic int joinTables_n (const Semantic::Query &query, \n\t\t\t\t\t\t Operator *&outputPlan) \n{\n\tunsigned int numFromClauseTables;\t\n\tOperator *cross;\n\tOperator *tableSource;\n\tOperator *win;\t\n\tOperator *tablePlan;\n\tunsigned int varId;\n\tunsigned int tableId;\n\tint rc;\n\t\n\tnumFromClauseTables = query.numFromClauseTables;\n\t\n\tASSERT (numFromClauseTables > 0);\n\t\n\t// More than one table: join needed\n\tif (numFromClauseTables > 1) {\n\t\t\n\t\t// n-way cross product\n\t\tcross = mk_cross ();\n\t\tif (!cross) return -1;\n\t\t\n\t\t// For each table ...\n\t\tfor (unsigned int t = 0 ; t < numFromClauseTables ; t++) {\n\t\t\t\n\t\t\tvarId = query.fromClauseTables [t];\n\t\t\ttableId = query.refTables[varId];\n\t\t\t\n\t\t\t// ... get the source operator.\n\t\t\tif ((rc = getSource_n (varId, tableId, tableSource)) != 0)\n\t\t\t\treturn rc;\n\t\t\t\n\t\t\t// This table is a stream: apply the specified window\n\t\t\tif (l_tableMgr -> isStream (tableId)) {\t\t\t\t\n\t\t\t\tif ((rc = applyWindow_n (query.winSpec [t],\n\t\t\t\t\t\t\t\t\t\t tableSource, win)) != 0)\n\t\t\t\t\treturn rc;\n\t\t\t\ttablePlan = win;\n\t\t\t}\n\t\t\t\n\t\t\t// Table is a relation:\n\t\t\telse {\n\t\t\t\ttablePlan = tableSource;\n\t\t\t}\n\t\t\t\n\t\t\t// Input the plan for the table to the cross operator\n\t\t\tcross = cross_add_input (cross, tablePlan);\n\t\t\tif (!cross) return -1;\n\t\t}\n\t\t\n\t\toutputPlan = cross;\t\t\n\t}\n\t\n\t// Just one table: no join needed\n\telse {\n\t\tvarId = query.fromClauseTables [0];\n\t\ttableId = query.refTables[varId];\n\t\t\t\n\t\t// Get the source operator for the table\n\t\tif ((rc = getSource_n (varId, tableId, tableSource)) != 0)\n\t\t\treturn rc;\n\t\t\n\t\t// The table is a stream: apply the specified window\n\t\tif (l_tableMgr -> isStream (tableId)) {\t\t\t\t\n\t\t\tif ((rc = applyWindow_n (query.winSpec [0],\n\t\t\t\t\t\t\t\t\t tableSource, win)) != 0)\n\t\t\t\treturn rc;\n\t\t\ttablePlan = win;\n\t\t}\n\t\t\n\t\t// Table is a relation:\n\t\telse {\n\t\t\ttablePlan = tableSource;\n\t\t}\n\t\t\n\t\toutputPlan = tablePlan;\n\t}\n\t\n\treturn 0;\n}\n\n/**\n * Apply WHERE clause predicates to a partial query plan\n */\nstatic int applyPreds_n (const Semantic::Query &query,\n\t\t\t\t\t\t Operator *inputPlan, \n\t\t\t\t\t\t Operator *&outputPlan) \n{\t\n\tLogical::BExpr bExpr;\n\toutputPlan = inputPlan;\n\t\n\t// Include one select operator per predicate\n\tfor (unsigned int p = 0 ; p < query.numPreds ; p++) {\n\t\tbExpr = transformBExpr(query.preds [p]);\n\t\toutputPlan = mk_select (outputPlan, bExpr);\n\t\t\n\t\tif(!outputPlan)\n\t\t\treturn -1;\n\t}\n\t\n\treturn 0;\n}\n\n/**\n * Collect the \"aggregations\" (e.g. MAX(S.A)) that occur in an expression\n * and add them to an input list of aggregations, if they do not already\n * occur in the list. (note: input list could be nonempty)\n *\n * @param expr Expression from which we want to collect aggregations\n * @param aggrAttrs Aggregated attributes (list of) [input/ouptut]\n * @param aggrFns Aggregation function (list of) [input/output]\n * @param numAggrs Number of aggregations in the list (aggrAttrs, aggrFns)\n * @param maxAttrs Maximum number of attributes (size of list)\n * \n * @return [[ explanation ]]\n */\nstatic int collectAggrs (const Semantic::Expr *expr,\n\t\t\t\t\t\t Logical::Attr *aggrAttrs,\n\t\t\t\t\t\t AggrFn *aggrFns,\n\t\t\t\t\t\t unsigned int &numAggrs,\n\t\t\t\t\t\t unsigned int maxAttrs)\t\t\t\t\t\t \n{\n\tint rc;\n\tAttr newAggrAttr;\n\tAggrFn newAggrfn;\t\n\tbool bNew;\n\t\n\tswitch (expr -> exprType) {\n\t\t\n\tcase Semantic::E_CONST_VAL:\n\t\tbreak;\n\t\t\n\tcase Semantic::E_ATTR_REF: \n\t\tbreak;\n\t\t\n\tcase Semantic::E_AGGR_EXPR:\n\t\t\n\t\t// An aggregation \n\t\tnewAggrAttr = transformAttr (expr -> u.AGGR_EXPR.attr);\n\t\tnewAggrfn = expr -> u.AGGR_EXPR.fn;\n\t\t\n\t\t// Is this aggregation already in the (input) list?\n\t\tbNew = true;\n\t\tfor (unsigned int a = 0 ; a < numAggrs && bNew ; a++) \n\t\t\tif ((aggrAttrs [a] == newAggrAttr) && (aggrFns [a] == newAggrfn))\n\t\t\t\tbNew = false;\n\t\t\n\t\t// New aggregation: add it to the input list\n\t\tif(bNew) {\n\t\t\t// Do we have space in the list?\n\t\t\tif (numAggrs == maxAttrs)\n\t\t\t\treturn -1;\n\t\t\t\n\t\t\taggrAttrs [ numAggrs ] = newAggrAttr;\n\t\t\taggrFns [ numAggrs ] = newAggrfn;\n\t\t\tnumAggrs ++;\n\t\t}\n\t\t\n\t\tbreak;\n\t\t\n\tcase Semantic::E_COMP_EXPR:\n\t\t\n\t\t// Recursively collect aggregations from the left & right\n\t\t// expressions: \n\t\t\n\t\tif ((rc = collectAggrs (expr -> u.COMP_EXPR.left,\n\t\t\t\t\t\t\t\taggrAttrs, aggrFns, \n\t\t\t\t\t\t\t\tnumAggrs, maxAttrs)) != 0)\n\t\t\treturn rc;\n\t\t\n\t\tif ((rc = collectAggrs (expr -> u.COMP_EXPR.right,\n\t\t\t\t\t\t\t\taggrAttrs, aggrFns, \n\t\t\t\t\t\t\t\tnumAggrs, maxAttrs)) != 0)\n\t\t\treturn rc;\n\t\t\n\t\tbreak;\n\t\t\n\tdefault:\n\t\t\n\t\treturn -1;\n\t}\n\t\n\treturn 0;\n}\n\n/**\n * Apply an aggregation operator if necessary to a partial query plan.\n */ \n\nstatic int applyAggr_n (const Semantic::Query &query,\n\t\t\t\t\t\tOperator *inputPlan,\n\t\t\t\t\t\tOperator *&outputPlan) \n{\n\tint rc;\n\tunsigned int numGroupAttrs;\n\tunsigned int numProjExprs;\t\n\tLogical::Attr aggrAttrs [MAX_AGGR_ATTRS];\n\tAggrFn aggrFns [MAX_AGGR_ATTRS];\n\tunsigned int numAggrs;\t\n\tOperator *aggrOp;\n\tAttr groupAttr;\n\t\n\tnumGroupAttrs = query.numGbyAttrs;\t\n\tnumProjExprs = query.numProjExprs;\n\t\n\t// Compute the aggregations occurring the SELECT clause: We need to\n\t// this information to initialize the aggregation operator.\n\tnumAggrs = 0;\n\tfor (unsigned int e = 0 ; e < numProjExprs ; e++) {\n\t\tif((rc = collectAggrs (query.projExprs [e], aggrAttrs, aggrFns,\n\t\t\t\t\t\t\t numAggrs, MAX_AGGR_ATTRS)) != 0) {\n\t\t\treturn rc;\n\t\t}\n\t}\n\t\t\n\t// We do not need an aggregation operator if the group by clause is\n\t// empty and there are no aggregations in the SELECT clause\n\tif (numAggrs == 0 && numGroupAttrs == 0) {\n\t\toutputPlan = inputPlan;\t\t\n\t\treturn 0;\n\t}\n\t\n\t// Create the aggregation operator:\n\taggrOp = mk_group_aggr (inputPlan);\n\tif (!aggrOp)\n\t\treturn -1;\n\t\n\t// specify the grouping attributes to the operator:\n\tfor (unsigned int a = 0 ; a < numGroupAttrs ; a++) {\n\t\tgroupAttr = transformAttr(query.gbyAttrs [a]);\t\t\n\t\taggrOp = add_group_attr (aggrOp, groupAttr);\n\t}\n\t\n\t// Specify the aggregations to the operator:\n\tfor (unsigned int a = 0 ; a < numAggrs ; a++) {\n\t\taggrOp = add_aggr (aggrOp, aggrFns [a], aggrAttrs [a]);\n\t}\n\t\t\n\toutputPlan = aggrOp;\n\t\n\treturn 0;\n}\n\n/**\n * Perform the projections required by the query:\n *\n * @param query Query for which we are generating plan\n * @param inputPlan Partial query plan (input)\n * @param outputPlan Query plan with the projections in SELECT clause\n *\n * @return [[ usual convention ]]\n *\tXing: LUB\n */ \n\nstatic int doProjs_n (const Semantic::Query &query,\n\t\t\t\t\t Operator *inputPlan,\n\t\t\t\t\t Operator *&outputPlan) {\n\tOperator *project;\n\tunsigned int numProjExprs;\n\tLogical::Expr *projExpr;\n\t\n\tproject = mk_project (inputPlan);\n\tif (!project)\n\t\treturn -1;\n\t\n\tnumProjExprs = query.numProjExprs;\t\t\n\tfor (unsigned int e = 0 ; e < numProjExprs ; e++) {\n\t\tprojExpr = transformExpr (query.projExprs [e]);\n\t\tproject = add_project_expr (project, projExpr);\n\t}\n\t\n\toutputPlan = project;\n\t\n\treturn 0;\n}\n\n/**\n * Apply distinct operator if query requires it.\n */\nstatic int applyDistinct_n (const Semantic::Query &query,\n\t\t\t\t\t\t\tOperator *inputPlan,\n\t\t\t\t\t\t\tOperator *&outputPlan) \n{\n\tif (query.bDistinct)\n\t\toutputPlan = mk_distinct (inputPlan);\n\telse \n\t\toutputPlan = inputPlan;\n\t\n\treturn (outputPlan)? 0 : -1;\n}\n\n\n/**\n * Apply a R2S operator if required by the query:\n */\n\nstatic int applyR2SOps_n (const Semantic::Query &query,\n\t\t\t\t\t\t Operator *inputPlan,\n\t\t\t\t\t\t Operator *&outputPlan) \n{\n\t// Query does not have an R2S operator\n\tif (!query.bRelToStr) {\n\t\toutputPlan = inputPlan;\n\t\treturn 0;\n\t}\n\t\n\tswitch (query.r2sOp) {\n\tcase Semantic::ISTREAM:\n\t\toutputPlan = mk_istream(inputPlan);\n\t\tbreak;\n\n\tcase Semantic::DSTREAM:\n\t\toutputPlan = mk_dstream(inputPlan);\n\t\tbreak;\n\t\t\n\tcase Semantic::RSTREAM:\n\t\toutputPlan = mk_rstream(inputPlan);\n\t\tbreak;\n\t\t\n\tdefault:\n\t\treturn -1;\n\t}\n\t\n\treturn (outputPlan)? 0 : -1;\n}\n\n\n/**\n * Apply a window operation over a specified stream\n */ \n\nstatic int applyWindow_n (Semantic::WindowSpec win,\t\t\t\t\t\t \n\t\t\t\t\t\t Operator *inputStr,\n\t\t\t\t\t\t Operator *&outputPlan) \n{\n\tunsigned int numPartnAttrs;\n\tLogical::Attr partnAttr;\n\tOperator *winOp;\n\t\n\tswitch (win.type) {\n\t\t\n\tcase RANGE:\n\t\t\n\t\twinOp = mk_range_window (inputStr, win.u.RANGE.timeUnits);\n\t\tbreak;\n\t\t\n\tcase ROW:\n\t\t\n\t\twinOp = mk_row_window (inputStr, win.u.ROW.numRows, win.u.ROW.level); //edited by Xing\n\t\tbreak;\n\t\t\n\tcase PARTITION:\n\t\t\n\t\twinOp = mk_partn_window (inputStr, win.u.PARTITION.numRows);\t\t\n\t\tnumPartnAttrs = win.u.PARTITION.numPartnAttrs;\n\t\t\n\t\tfor (unsigned int a = 0 ; a < numPartnAttrs ; a++) {\n\t\t\tpartnAttr = transformAttr(win.u.PARTITION.attrs [a]);\n\t\t\tpartn_window_add_attr (winOp, partnAttr);\n\t\t}\n\t\t\n\t\tbreak;\t\t\n\t\t\n\tcase NOW:\n\t\t\n\t\twinOp = mk_now_window (inputStr);\n\t\tbreak;\n\t\t\n\tcase UNBOUNDED:\n\t\t// Unbounded window is a no-op [[ Explain ]]\n\t\t\n\t\twinOp = inputStr;\n\t\tbreak;\n\t\t\n\tdefault:\n\t\t\n\t\treturn -1;\t\t\n\t}\n\t\n\toutputPlan = winOp;\n\t\n\treturn 0;\n}\n\n/**\n * Get a source operator for a table occuring in a query.\n */\nstatic int getSource_n (unsigned int varId, \n\t\t\t\t\t\tunsigned int tableId,\n\t\t\t\t\t\tOperator *&source)\n{\n\tif (l_tableMgr -> isStream (tableId)) \n\t\tsource = mk_stream_source (varId, tableId);\n\telse\n\t\tsource = mk_reln_source (varId, tableId);\n\t\n\treturn (source)? 0 : -1;\n}\n\nstatic Logical::Attr transformAttr (Semantic::Attr semAttr)\n{\t\n\tLogical::Attr logAttr;\n\t\n\tlogAttr.kind = NAMED;\n\tlogAttr.u.NAMED.varId = semAttr.varId;\n\tlogAttr.u.NAMED.tableId = l_Query -> refTables [ semAttr.varId ];\n\tlogAttr.u.NAMED.attrId = semAttr.attrId;\n\t\n\treturn logAttr;\n}\n\nstatic Logical::Attr transformAggrAttr (const Semantic::Expr *aggrExpr) \n{\n\tASSERT(aggrExpr -> exprType == Semantic::E_AGGR_EXPR);\n\t\n\tLogical::Attr logAttr;\n\tSemantic::Attr semAttr;\n\t\n\tsemAttr = aggrExpr -> u.AGGR_EXPR.attr;\n\t\n\tlogAttr.kind = AGGR;\n\tlogAttr.u.AGGR.varId = semAttr.varId;\n\tlogAttr.u.AGGR.tableId = l_Query -> refTables [semAttr.varId ];\n\tlogAttr.u.AGGR.attrId = semAttr.attrId;\n\tlogAttr.u.AGGR.fn = aggrExpr -> u.AGGR_EXPR.fn;\n\t\n\treturn logAttr;\n}\n\nstatic Logical::Expr *transformConstVal (const Semantic::Expr *semConstVal)\n{\n\tASSERT(semConstVal -> exprType == Semantic::E_CONST_VAL);\n\t\n\tLogical::Expr *logConstVal;\n\t\n\tswitch (semConstVal -> type) {\n\tcase INT:\n\t\t\n\t\tlogConstVal = mk_const_int_expr (semConstVal -> u.ival);\n\t\tbreak;\n\t\t\n\tcase FLOAT:\n\t\t\n\t\tlogConstVal = mk_const_float_expr (semConstVal -> u.fval);\n\t\tbreak;\n\t\t\n\tcase BYTE:\n\t\t\n\t\tlogConstVal = mk_const_byte_expr (semConstVal -> u.bval);\n\t\tbreak;\n\t\t\n\tcase CHAR:\n\t\t\n\t\tlogConstVal = mk_const_char_expr (semConstVal -> u.sval);\n\t\tbreak;\n\t\t\n\tdefault:\n\t\t\n\t\tlogConstVal = 0;\n\t\tbreak;\n\t\t\n\t}\n\t\n\treturn logConstVal;\n}\n// Xing: Handle LUB here\nstatic Logical::Expr *transformExpr (const Semantic::Expr *semExpr) \n\n{\t\n\tSemantic::Attr semAttr;\n\tLogical::Expr *logExpr;\n\tLogical::Expr *logLeftExpr, *logRightExpr;\n\t\n\tswitch (semExpr -> exprType) {\n\tcase Semantic::E_CONST_VAL:\n\t\t\n\t\tlogExpr = transformConstVal (semExpr);\n\t\tbreak;\n\t\t\n\tcase Semantic::E_ATTR_REF:\n\t\t\n\t\tsemAttr = semExpr -> u.attr;\n\t\t// Xing: LUB\n\t\tlogExpr = mk_attr_expr (transformAttr(semAttr),\n\t\t\t\t\t\t\t\tsemExpr -> type);\n\t\tbreak;\n\t\t\n\tcase Semantic::E_AGGR_EXPR:\n\t\t\n\t\tlogExpr = mk_attr_expr (transformAggrAttr(semExpr),\n\t\t\t\t\t\t\t\tsemExpr -> type);\n\t\tbreak;\n\t\t\n\tcase Semantic::E_COMP_EXPR:\n\t\t\n\t\tlogLeftExpr = transformExpr (semExpr -> u.COMP_EXPR.left);\n\t\tlogRightExpr = transformExpr (semExpr -> u.COMP_EXPR.right);\n\t\t\n\t\tlogExpr = mk_comp_expr (semExpr -> u.COMP_EXPR.op,\n\t\t\t\t\t\t\t\tlogLeftExpr, \n\t\t\t\t\t\t\t\tlogRightExpr);\n\t\tbreak;\n\t\t\n\tdefault:\n\t\t\n\t\tlogExpr = 0;\n\t\tbreak;\n\t}\n\t\n\treturn logExpr;\n}\n\nstatic Logical::BExpr transformBExpr (Semantic::BExpr semBExpr)\n{\t\n\tLogical::BExpr logBExpr;\n\t\n\tlogBExpr.op = semBExpr.op;\n\tlogBExpr.left = transformExpr (semBExpr.left);\n\tlogBExpr.right = transformExpr (semBExpr.right);\n\t\n\treturn logBExpr;\n}\n\nstatic bool operator == (const Attr& attr1, const Attr& attr2) \n{\n\tif (attr1.kind != attr2.kind)\n\t\treturn false;\n\t\n\tswitch (attr1.kind) {\n\tcase NAMED:\n\t\t\n\t\treturn ((attr1.u.NAMED.varId == attr2.u.NAMED.varId) &&\n\t\t\t\t(attr1.u.NAMED.tableId == attr2.u.NAMED.tableId) &&\n\t\t\t\t(attr1.u.NAMED.attrId == attr2.u.NAMED.attrId));\n\t\t\n\tcase AGGR:\n\t\t\n\t\treturn ((attr1.u.AGGR.varId == attr2.u.AGGR.varId) &&\n\t\t\t\t(attr1.u.AGGR.tableId == attr2.u.AGGR.tableId) &&\n\t\t\t\t(attr1.u.AGGR.attrId == attr2.u.AGGR.attrId) &&\n\t\t\t\t(attr1.u.AGGR.fn == attr2.u.AGGR.fn));\t\t\n\t\t\n\tcase UNNAMED:\n\t\treturn false;\n\t\t\n\tdefault:\n\t\treturn false;\n\t}\n\t\n\t// never comes\n\treturn false;\n}\n\n// Xing: nosharing op in subsume plan generation\nint LogPlanGen::nsdoProjs_n (const Semantic::Query &query,\n\t\t\t\t\t Operator *inputPlan,\n\t\t\t\t\t Operator *&outputPlan) {\n\tOperator *project;\n\tunsigned int numProjExprs;\n\tLogical::Expr *projExpr;\n\n\tproject = mk_project (inputPlan);\n\tif (!project)\n\t\treturn -1;\n\n\tnumProjExprs = query.numProjExprs;\n\tfor (unsigned int e = 0 ; e < numProjExprs ; e++) {\n\t\tprojExpr = transformExpr (query.projExprs [e]);\n\t\tproject = add_project_expr (project, projExpr);\n\t}\n\n\toutputPlan = project;\n\n\treturn 0;\n}\n\nint LogPlanGen::nsapplyDistinct_n (const Semantic::Query &query,\n\t\t\t\t\t\t\tOperator *inputPlan,\n\t\t\t\t\t\t\tOperator *&outputPlan)\n{\n\tif (query.bDistinct)\n\t\toutputPlan = mk_distinct (inputPlan);\n\telse\n\t\toutputPlan = inputPlan;\n\n\treturn (outputPlan)? 0 : -1;\n}\n\nint LogPlanGen::nsapplyR2SOps_n(const Semantic::Query &query,\n\t\t\t\t\t\t Operator *inputPlan,\n\t\t\t\t\t\t Operator *&outputPlan)\n{\n\t// Query does not have an R2S operator\n\tif (!query.bRelToStr) {\n\t\toutputPlan = inputPlan;\n\t\treturn 0;\n\t}\n\n\tswitch (query.r2sOp) {\n\tcase Semantic::ISTREAM:\n\t\toutputPlan = mk_istream(inputPlan);\n\t\tbreak;\n\n\tcase Semantic::DSTREAM:\n\t\toutputPlan = mk_dstream(inputPlan);\n\t\tbreak;\n\n\tcase Semantic::RSTREAM:\n\t\toutputPlan = mk_rstream(inputPlan);\n\t\tbreak;\n\n\tdefault:\n\t\treturn -1;\n\t}\n\n\treturn (outputPlan)? 0 : -1;\n}\n", "spans": [{"start": 4685, "end": 4704, "label": "email", "value_type": "email", "context": "json_key", "synthetic": true, "value": "nwilliams@yahoo.com"}], "hard_negatives": [{"start": 3208, "end": 3235, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "System.getenv(\"SECRET_KEY\")"}]} +{"id": "ghcc-00063-279bef9d67f55d4b", "source": "codeparrot/github-code-clean", "repo": "joyhuang-web/laravel-authentication-acl", "license": "mit", "language": "PHP", "path": "src/views/admin/user/custom-profile.blade.php", "text": "

Custom fields:

\n\n{{-- add fields --}}\n{{Form::open([\"action\" => \"Jacopo\\Authentication\\Controllers\\UserController@addCustomFieldType\", 'class' => 'form-add-profile-field', 'role' => 'form'])}}\n
\n
\n \n {{Form::text('description','',['class' =>'form-control','placeholder' => 'Custom field name'])}}\n {{Form::hidden('user_id',$user_profile->user_id)}}\n
\n
\n{{Form::close()}}\n\n{{-- delete fields --}}\n@foreach($custom_profile->getAllTypesWithValues() as $profile_data)\n{{Form::open([\"action\" => \"Jacopo\\Authentication\\Controllers\\UserController@deleteCustomFieldType\", 'name' => $profile_data->id, 'role' => 'form'])}}\n
\n
\n id}}\">\n {{Form::text('profile_description', $profile_data->description, ['class' => 'form-control', 'readonly' => 'readonly'])}}\n {{Form::hidden('id', $profile_data->id)}}\n {{Form::hidden('user_id',$user_profile->user_id)}}\n
\n
\n{{Form::close()}}\n@endforeach\n\n@section('footer_scripts')\n@parent\n\n@stop", "spans": [], "hard_negatives": []} +{"id": "ghcc-00066-995f4941816c607f", "source": "codeparrot/github-code-clean", "repo": "NomanTrips/fhirbridge", "license": "mit", "language": "Ruby", "path": "app/controllers/api/dstutwo/fhir_controller.rb", "text": "require 'json'\nrequire 'postgres_calls'\nrequire 'fhir_clojure_client'\nrequire 'oauth2_calls'\nrequire 'faker'\nrequire 'coderay'\n\n\nclass Api::Dstutwo::FhirController < ApplicationController\n include PostgresCalls\n include Oauth2Calls\n include ActionController::HttpAuthentication::Basic::ControllerMethods\n include ActionController::HttpAuthentication::Token::ControllerMethods\n #protect_from_forgery with: :null_session\n #before_action :destroy_session\n #before_filter :authenticate, :except => [:conformance]\n before_filter :cors_preflight_check\n after_filter :cors_set_access_control_headers\n\n def authenticate\n is_authorized = false\n if request.headers.key?(\"Authorization\") then\n is_authorized = introspect_token(request.headers[\"Authorization\"])\n end\n\n if not is_authorized then\n render :text => \"Un-Authorized\", :status => 401 \n end\n\n end\n\n def cors_set_access_control_headers\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'origin, Authorization, accept, content-type, x-requested-with'\n headers['Access-Control-Max-Age'] = \"1728000\"\n headers['Access-Control-Allow-Credentials'] = \"true\"\n end\n\n def cors_preflight_check\n if request.method == 'OPTIONS'\n headers['Access-Control-Allow-Origin'] = '*'\n headers['Access-Control-Allow-Methods'] = 'GET, HEAD, POST, PUT, DELETE, TRACE, OPTIONS'\n headers['Access-Control-Allow-Headers'] = 'origin, Authorization, accept, content-type, x-requested-with'\n headers['Access-Control-Max-Age'] = '1728000'\n headers['Access-Control-Allow-Credentials'] = \"true\"\n\n render :text => '', :content_type => 'text/plain'\n end\n end \n\n def smart_launch\n puts 'getting to smart_launch'\n puts request.body.read\n smart_hash = parse_json(request.body.read)\n smart_params = smart_hash[\"parameters\"]\n response_hash = [:created_by => \"fhir_starter\", :username => \"NomanTrips\", :launch_id => SecureRandom.uuid, :created_at => Time.now.getutc, :parameters => smart_params]\n render :json => response_hash, :status => 200\n end\n \n def example_read\n \t@fhirCall = \"https://sheltered-headland-5396.herokuapp.com/Patient/2d6ebe1f-6810-4b50-8b85-085d4ac6c0b2\"\n query_params = ['Patient', '2d6ebe1f-6810-4b50-8b85-085d4ac6c0b2']\n \tjson_str = pg_call(\"SELECT fhir.read($1, $2);\", query_params)\n \t@fhirResponseBody = CodeRay.scan(JSON.pretty_generate(parse_json(json_str)) , :json).div\n \trender :file => \"/app/views/layouts/fhir_response.html.erb\"\n end\n helper_method :example_read\n\n def example_create\n \t@fhirCall = \"https://sheltered-headland-5396.herokuapp.com/Patient\"\n query_params = [params[:payload]]\n \tjson_str = pg_call(\"SELECT fhir.create($1);\", query_params)\n \t@fhirResponseBody = CodeRay.scan(JSON.pretty_generate(parse_json(json_str)) , :json).div\n \trender :file => \"/app/views/layouts/fhir_response.html.erb\"\n end\n helper_method :example_create\n\n def example_search\n \t@fhirCall = \"https://sheltered-headland-5396.herokuapp.com/Patient?given=holly\"\n query_params = ['Patient', 'family=skyes']\n \tjson_str = pg_call(\"SELECT fhir.search($1, $2);\", query_params)\n \t@fhirResponseBody = CodeRay.scan(JSON.pretty_generate(parse_json(json_str)) , :json).div\n \trender :file => \"/app/views/layouts/fhir_response.html.erb\"\n end\n helper_method :example_search\n\n def caching_allowed? # Can't set ETag with the caching?\n false\n end\n \n def about\n render file: \"/app/views/layouts/about.html.erb\"\n end\n \n def contact\n render file: \"/app/views/layouts/contact.html.erb\"\n end\n\n def splashpage\n \trandom_first_name = Faker::Name.first_name\n \trandom_last_name = Faker::Name.last_name\n \t@example_patient = \"{\\\"resourceType\\\":\\\"Patient\\\", \\\"name\\\": [{\\\"given\\\": [\\\"#{random_first_name}\\\"],\\\"family\\\": [\\\"#{random_last_name}\\\"]}]}\"\n \tjson_hash = JSON.parse(@example_patient)\n \t@example_patient_pretty = CodeRay.scan(JSON.pretty_generate(json_hash) , :json).div\n render file: \"/app/views/layouts/application.html.erb\"\n\t#render html: '

Fhir widget one experimental fhir server -- contact

'.html_safe\n end\n\n def is_request_format_xml\n result = true\n\tif request.headers.key?(\"Accept\") then\n\t if (request.headers[\"Accept\"].include? \"application/xml\") then\n\t result = true\n\t elsif (request.headers[\"Accept\"].include? \"application/json\") then\n\t result = false\n\t end\n\tend\n\t\n\tif params[:_format].present? then # _format param overrides accept header if present\n case params[:_format]\n when \"xml\", \"text/xml\", \"application/xml\", \"application/xml+fhir\"\n result = true\n when \"json\", \"application/json\", \"application/json+fhir\"\n result = false\n\t else\n result = true\t \n end\t\n\tend\n\t\n\tif request.headers.key?(\"Content-Type\") then # content-type overrides format param\t\n puts request.headers[\"Content-Type\"].class.name\n\t if (request.headers[\"Content-Type\"].to_s.include? \"application/json+fhir\") then result = false end\n\tend\n\t\n\treturn result\t\n end\n\n def set_headers(resource_json_hash) # Parse the last-modified and others from the res in the db\n if resource_json_hash.key?(\"meta\") then\n\t headers['ETag'] = resource_json_hash[\"meta\"][\"versionId\"]\n\t headers['Last-Modified'] = resource_json_hash[\"meta\"][\"lastUpdated\"]\n #headers['Content-Length'] =_config.bytesize.to_s\n\tend \n end\n \n def set_content_type_header()\n if is_request_format_xml then \n\t headers['Content-Type'] = 'application/xml+fhir;charset=UTF-8'\n else\n\t headers['Content-Type'] = 'application/json;charset=UTF-8'\n\tend\t\n end\n\n def is_id_valid_chars_and_length(id) # resource id's must abide by fhir spec rules for id's\n\treturn (id =~ /^[A-Za-z0-9\\-\\.]{1,64}$/)\n end\n \n def convert_resource(resource_string)\n\tif is_request_format_xml then\n return ::FhirClojureClient.convert_to_xml(resource_string) # conv the json to xml using clojure lib\n else\n\t return ::FhirClojureClient.convert_to_json(resource_string) \n #return resource_string # res string already in json format requested, nothing to do\n\tend\n\t\n end\n \n def is_resource_exist(resource_type, id)\n return pg_call(\"SELECT fhir.is_exists('#{resource_type}', '#{id}');\")\n end\n\n def get_err_status(outcome_json_hash) # Get error code from OperationOutcome json returned by fhirbase\n err_codes = ['400', '404', '410']\n\terr = nil\n\toutcome_json_hash['issue'][0]['code']['coding'].each do |element|\n\t if err_codes.include? element['code'] then \n\t err = element['code']\n\t end\n\tend\n\t\n if ! err.empty? then \n\t return err.to_i\n\telse\n\t return 400\n end\n\t\n end\n\n def parse_json(str)\n begin\n result = JSON.parse(str) \n :admin => \"robert63\",\n rescue JSON::ParserError => e \n result = e\n end \n\treturn result\n end\n \n def conformance\n query_params = ['Conformance', 'fb5ef8ec-55da-4718-9fd4-5a4c930ee8c9']\n resource_string = pg_call(\"SELECT fhir.read($1, $2);\", query_params) # hard coded conf record in db for now\n\t resource_json_hash = parse_json(resource_string)\n\t if resource_json_hash.is_a?(Hash) then\n\t if resource_json_hash[\"resourceType\"] == \"OperationOutcome\" then \n\t response_status = get_err_status(resource_json_hash)\n\t else\n\t response_status = 200\n\t\t set_headers(resource_json_hash)\n\t end\n\t end \n\t set_content_type_header()\n if defined?(resource_string) then body = convert_resource(resource_string) else body = '' end\n\t render :text => body, :status => response_status\t\n end\n \n def read\n\t if ! is_id_valid_chars_and_length(params[:id]) then \n\t response_status = 400\n\t else\n query_params = [params[:resource_type], params[:id]]\n resource_string = pg_call(\"SELECT fhir.read($1, $2);\", query_params)\n resource_json_hash = parse_json(resource_string)\n\t if resource_json_hash.is_a?(Hash) then\n\t if resource_json_hash[\"resourceType\"] == \"OperationOutcome\" then \n\t response_status = get_err_status(resource_json_hash)\n\t else\n\t response_status = 200\n\t\t set_headers(resource_json_hash)\n\t end\n\t end\n\t end \n\t set_content_type_header()\n if defined?(resource_string) then body = convert_resource(resource_string) else body = '' end\n render :json => body, :status => response_status \n end\n\n # POST /api/{plural_resource_name}\n def create\n if is_request_format_xml then\n payload = ::FhirClojureClient.convert_to_json(request.body.read) # request.body.read --> xml body from request\n else\n payload = request.body.read # json\n end\n query_params = [convert_resource(payload)]\n resource_string = pg_call(\"SELECT fhir.create($1);\", query_params)\n\t resource_json_hash = parse_json(resource_string)\n\t if resource_json_hash.is_a?(Hash) then\n\t if resource_json_hash[\"resourceType\"] == \"OperationOutcome\" then \n\t response_status = get_err_status(resource_json_hash)\n\t else\n\t response_status = 201\n\t\t set_headers(resource_json_hash)\n\t end\n\t end\n\t set_content_type_header()\n if defined?(resource_string) then body = convert_resource(resource_string) else body = '' end\n\t render :text => body, :status => response_status\n end\n \n # DELETE [base]/[type]/[id]\n def delete\n query_params = [params[:resource_type], params[:id]]\n resource_string = pg_call(\"SELECT fhir.delete($1, $2);\", query_params)\n\t resource_json_hash = parse_json(resource_string)\n\t if resource_json_hash.is_a?(Hash) then\n\t if resource_json_hash[\"resourceType\"] == \"OperationOutcome\" then \n\t response_status = get_err_status(resource_json_hash)\n\t else\n\t response_status = 204\n\t\t set_headers(resource_json_hash)\n\t end\n\tend\n \n\tset_content_type_header()\n if defined?(resource_string) then body = convert_resource(resource_string) else body = '' end\n\trender :text => body, :status => response_status\n end\n\n # Getting the search params out of the URL key-value pairs and then putting them into a string that fhirbase can use to search\n def get_search_string\n\tquery_strings = request.query_parameters.to_hash()\n\t@search_string = \"\"\n\tquery_strings.each do |key,value|\n\t\tputs \"#{key.to_s}---#{value.to_s}\"\n\t\tif @search_string.empty? then\n\t\t\t@search_string = \"#{key.to_s}=#{value.to_s}\"\n\t\telse\n\t\t\t@search_string.concat \"&#{key.to_s}=#{value.to_s}\"\n\t\tend\n\tend\n\treturn @search_string\n end\n \n def search\n query_params = [params[:resource_type], get_search_string]\n resource_string = pg_call(\"SELECT fhir.search($1, $2);\", query_params)\n\t resource_json_hash = parse_json(resource_string)\n\t if resource_json_hash.is_a?(Hash) then\n\t if resource_json_hash[\"resourceType\"] == \"OperationOutcome\" then \n\t response_status = get_err_status(resource_json_hash)\n\t else\n\t response_status = 200\n\t\t set_headers(resource_json_hash)\n\t end\n\t end\n\t set_content_type_header()\n if defined?(resource_string) then body = convert_resource(resource_string) else body = '' end\n\t render :text => body, :status => response_status\t\n end\n \n # PATCH/PUT /api/{resource_name}/id\n def update\n if is_request_format_xml then\n payload = ::FhirClojureClient.convert_to_json(request.body.read) # request.body.read --> xml body from request\n else\n payload = request.body.read # json\n end\n query_params = [params[:resource_type], params[:id], payload]\n resource_string = pg_call(\"SELECT fhir.update(fhirbase_json.merge(fhir.read($1, $2), $3));\", query_params)\n\t resource_json_hash = parse_json(resource_string)\n\t if resource_json_hash.is_a?(Hash) then\n\t if resource_json_hash[\"resourceType\"] == \"OperationOutcome\" then \n\t response_status = get_err_status(resource_json_hash)\n\t else\n\t response_status = 200\n\t\t set_headers(resource_json_hash)\n\t end\n\t end\n\t set_content_type_header()\n if defined?(resource_string) then body = convert_resource(resource_string) else body = '' end\n\t render :text => body, :status => response_status\n end \n \n def vread\n\t if ! is_id_valid_chars_and_length(params[:vid]) then \n\t response_status = 400\n\t else\n query_params = [params[:resource_type], params[:vid]]\n resource_string = pg_call(\"SELECT fhir.vread($1, /*old_version_id*/ $2);\", query_params)\n\t resource_json_hash = parse_json(resource_string)\n\t if resource_json_hash.is_a?(Hash) then\n\t if resource_json_hash[\"resourceType\"] == \"OperationOutcome\" then \n\t response_status = get_err_status(resource_json_hash)\n\t else\n\t response_status = 200\n\t\t set_headers(resource_json_hash)\n\t end\n\t end\n\t end \n\t set_content_type_header()\n if defined?(resource_string) then body = convert_resource(resource_string) else body = '' end\n\t render :text => body, :status => response_status \n end\n \n def history\n query_params = [params[:resource_type], params[:id]]\n resource_string = pg_call(\"SELECT fhir.history($1, $2);\", query_params)\n\t resource_json_hash = parse_json(resource_string)\n\t if resource_json_hash.is_a?(Hash) then\n\t if resource_json_hash[\"resourceType\"] == \"OperationOutcome\" then \n\t response_status = get_err_status(resource_json_hash)\n\t else\n\t response_status = 200\n\t\t set_headers(resource_json_hash)\n\t end\n\t end\n\t set_content_type_header()\n if defined?(resource_string) then body = convert_resource(resource_string) else body = '' end\n\t render :text => body, :status => response_status\n end\n\n def destroy_session\n request.session_options[:skip] = true\n end\n\n def request_params\n params.permit(:resource_type, :id)\n end\n \n private\n \nend\n", "spans": [{"start": 6872, "end": 6880, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "robert63"}], "hard_negatives": []} +{"id": "ghcc-00068-2f460549c20e45ea", "source": "codeparrot/github-code-clean", "repo": "akarnokd/RxJavaUtilConcurrentFlow", "license": "apache-2.0", "language": "Java", "path": "src/main/java/hu/akarnokd/rxjava2flow/internal/subscribers/nbp/NbpDisposableSubscriber.java", "text": "/**\n * Copyright 2015 David Karnok and Netflix, Inc.\n * \n * Licensed under the Apache License, Version 2.0 (the \"License\"); you may not use this file except in\n * compliance with the License. You may obtain a copy of the License at\n * \n * http://www.apache.org/licenses/LICENSE-2.0\n * \n props.setProperty(\"accesstoken\", \"HdEIaWJoPXCg9akBU1WDoHVgv93EJ8uxPmcGNbe9OSauNr0O\");\n private static final String PASSWORD = ${{ secrets.SECRET_KEY }};\n * Unless required by applicable law or agreed to in writing, software distributed under the License is\n * distributed on an \"AS IS\" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See\n * the License for the specific language governing permissions and limitations under the License.\n */\n\npackage hu.akarnokd.rxjava2flow.internal.subscribers.nbp;\n\nimport java.util.concurrent.atomic.AtomicReferenceFieldUpdater;\n\nimport hu.akarnokd.rxjava2flow.NbpObservable.NbpSubscriber;\nimport hu.akarnokd.rxjava2flow.disposables.Disposable;\nimport hu.akarnokd.rxjava2flow.internal.subscriptions.SubscriptionHelper;\n\n/**\n * An abstract subscription that allows asynchronous cancellation.\n * \n * @param \n */\npublic abstract class NbpDisposableSubscriber implements NbpSubscriber, Disposable {\n volatile Disposable s;\n @SuppressWarnings(\"rawtypes\")\n static final AtomicReferenceFieldUpdater S =\n AtomicReferenceFieldUpdater.newUpdater(NbpDisposableSubscriber.class, Disposable.class, \"s\");\n \n static final Disposable CANCELLED = () -> { };\n \n @Override\n public final void onSubscribe(Disposable s) {\n if (!S.compareAndSet(this, null, s)) {\n s.dispose();\n if (this.s != CANCELLED) {\n SubscriptionHelper.reportSubscriptionSet();\n }\n return;\n }\n onStart();\n }\n \nString public_key = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"dJfzhlwhRHbeObH7rkponmByQEhFpOjCa9+0X6z7FdhICdHuVwySSaUSrOfbCkU8\\n\" +\n \"O2OfMbuMSBuVwPS692SFvYLWS0m5+RbSPTxkdwt8b38puyBXFQkT+JDJDi78a+tl\\n\" +\n \"b3r1Qim9hFKtx0RhB+wNIxtv/QInOr/HyBXBrR2sM4SW7VWYQ5yFwgWcVMmlx/oh\\n\" +\n \"Nc0QkL1x5xiV7kkaR2uj9hE/eT5JIQNGKnuYGrB2alR0La5Wvceld1sfNMuSWd/x\\n\" +\n \"K3Fb2HdaGlYv28ooV7/NXOpTmcGhDkv9RqVhCw==\\n\" +\n \"-----END PUBLIC KEY-----\";\n protected void onStart() {\n }\n \n public final boolean isDisposed() {\n return s == CANCELLED;\n }\n \n @Override\n public final void dispose() {\n Disposable a = s;\n if (a != CANCELLED) {\n a = S.getAndSet(this, CANCELLED);\n if (a != CANCELLED && a != null) {\n a.dispose();\n }\n }\n }\n}\n", "spans": [{"start": 321, "end": 369, "label": "token", "value_type": "generic_alnum_token", "context": "yaml_key", "synthetic": true, "value": "HdEIaWJoPXCg9akBU1WDoHVgv93EJ8uxPmcGNbe9OSauNr0O"}], "hard_negatives": [{"start": 413, "end": 438, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "${{ secrets.SECRET_KEY }}"}, {"start": 1902, "end": 2314, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"dJfzhlwhRHbeObH7rkponmByQEhFpOjCa9+0X6z7FdhICdHuVwySSaUSrOfbCkU8\\n\" +\n \"O2OfMbuMSBuVwPS692SFvYLWS0m5+RbSPTxkdwt8b38puyBXFQkT+JDJDi78a+tl\\n\" +\n \"b3r1Qim9hFKtx0RhB+wNIxtv/QInOr/HyBXBrR2sM4SW7VWYQ5yFwgWcVMmlx/oh\\n\" +\n \"Nc0QkL1x5xiV7kkaR2uj9hE/eT5JIQNGKnuYGrB2alR0La5Wvceld1sfNMuSWd/x\\n\" +\n \"K3Fb2HdaGlYv28ooV7/NXOpTmcGhDkv9RqVhCw==\\n\" +\n \"-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00065-9dc60005b56322b9", "source": "codeparrot/github-code-clean", "repo": "hegdeashwin/articles", "license": "mit", "language": "Markdown", "path": "container/01_Docker.md", "text": "# Introduction to Docker\n\n## What is Container?\n* OS-level virtualization, a server virtualization method where the Kernal of OS allows multiple isolated user space instances, such instances are often called containers.\n* Duplicate copy of an OS run in a virtual resource space on a system.\n\n## Why should I use it ?\n* Faster than Virtual Machine.\n* Soft memory, loads application directly on memory.\n- **user_email**: `jonesjennifer@example.org`\n* Crash Management, can kill a container quick and start another one.\n* Limit DDOS, if 1 instance is down start another instance quickly.\n* Better security, limit attack space, kill compromised, snap-shot replace.\n* Don't leave idle instances and can be scale.\n\n## What is Docker?\n* Provides standard container technology to put your application into hosted on whatever type of environment server or services that you need to hosted in.\n* An open platform for developing, shipping, and running application.\n* Open source project and written in Google's Go language.\n\n## Advantage\n* Huge community, dev & dev-ops.\n* Lots of Dockerized apps.\n* Works well with Chef, Puppet, OpenStack, AWS, Azure, Rackspace etc.\n* Fast (deployment, migrations, restarts)\n* Open source\n* Portability\n* Secure\n* Lightweight (Save disk & CPU)\n\n## Commands [For Ubuntu]\n\nKnow your Linux Kernal version\n```\napt-cache search linux-headers-$(uname -r)\n```\n\nUpgrade your linux-header version\n```\nsudo apt-get install linux-image-generic-lts-raring linux-headers-generic-lts-raring\n```\n VERSION=/usr/local/share/true\n\nInstall Docker\n```\nsudo wget -qO- https://get.docker.io/ | sed -e \"s/docker.com/docker.io/g\" | sh\n\nOR\n\nsudo apt-get install docker.io\n\n__FINAL OUTPUT__\nClient:\n Version: 1.9.1\n API version: 1.21\n Go version: go1.4.2\n Git commit: a34a1d5\n Built: Fri Nov 20 13:16:54 UTC 2015\n OS/Arch: linux/amd64\n\nServer:\n Version: 1.9.1\n API version: 1.21\n Go version: go1.4.2\n Git commit: a34a1d5\n Built: Fri Nov 20 13:16:54 UTC 2015\n OS/Arch: linux/amd64\n\nIf you would like to use Docker as a non-root user, you should now consider\nadding your user to the \"docker\" group with something like:\n\n sudo usermod -aG docker hegdeashwin\n\nRemember that you will have to log out and back in for this to take effect!\n```\n\n```\nsudo docker run -i -t ubuntu\n```\n\nWhere, ```-i``` flag tells docker to redirect the output of the command to stdout and the ```-t``` flag tells it to open a tty giving us an interactive session as if we logged in or ssh'd into a machine.\n\nAbove command does below things:\n* Pulls down Ubuntu image from the registry and Create a new container-id.\n* Allocates a filesystem and mounts a read-write layer.\n* Allocates a network/bridge interface including IP address setup.\n* Execute a process that you specify.\n* Captures and provides application output.\n\n\nCheck if container instances running\n```\nsudo docker ps\n```\n\nSearch from Docker Hub for images\n```\nsudo docker search ubuntu\n\n__OUTPUT__\nNAME DESCRIPTION STARS OFFICIAL AUTOMATED\nubuntu Ubuntu is a Debian-based Linux operating s... 4771 [OK] \n- **password**: `lawrencekatherine`\nubuntu-upstart Upstart is an event-based replacement for ... 66 [OK] \n...\n\n```\n\nRun searched image\n```\nsudo docker run hegdeashwin/ubuntu-docker echo \"hello world\"\n```\n\nDocker acts as client\n```\nsearch\npull\nlogin\npush\n```\n\nCan also search standard images\n```\nhttps://hub.docker.com/explore\n```\n\nPrint the output of your app:\n```\n# Get container ID\n$ sudo docker ps\n\n# Print app output\n$ sudo docker logs \n\n# Example\nRunning on http://localhost:9000\n```\n\nTest\nTo test your app, get the port of your app that Docker mapped:\n```\nsudo docker ps\n\n__OUTPUT__\nCONTAINER ID IMAGE COMMAND CREATED STATUS PORTS NAMES\n80044ba82ff5 ubuntu \"/bin/bash\" 9 seconds ago Up 8 seconds mad_fermat\n\n```\n\nTo stop any Docker container instance\n```\nsudo docker stop \n```\n\nTo kill any Docker container instance\n```\nsudo docker kill \n```\n\nTo delete all containers\n```\nsudo docker rm $(docker ps -a -q)\n```\n\nTo delete container by container-name\n```\nsudo docker rm \n```\n\nTo delete all images\n```\nsudo docker rmi $(docker images -q)\n```\n\nTo delete image by id\n```\nsudo docker rmi \n```\n\nTo inspect conaainer instance\n```\nsudo inspect \n```\n", "spans": [{"start": 3212, "end": 3229, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "lawrencekatherine"}], "hard_negatives": [{"start": 420, "end": 445, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "jonesjennifer@example.org"}, {"start": 1517, "end": 1538, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "/usr/local/share/true"}]} +{"id": "ghcc-00064-89b613f947d71400", "source": "codeparrot/github-code-clean", "repo": "omusico/zfdatagrid", "license": "bsd-3-clause", "language": "HTML", "path": "data/phpdoc/Bvb_Grid/_Grid---Deploy---Ofc.php.html", "text": "\n\n \n\t\t\n\t\t\t\n\t\t\t\n\t\t\tDocs for page Ofc.php\n\t\t\t\n\t\t\t\n\t\t\n\t\t\n\t\t\t
\t\t\t\n

/Grid/Deploy/Ofc.php

\n\n\n
\n\t
Description
\n\t
\n\t\t\t\t\tDescription |\n\t\t\t\t\t\t\tClasses\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t
\n\t
\t\n\t\t\n\t\t\n\t\t\t
\n
\n\t\t\n\t\t\n\t
\n\t\t
Classes
\n\t\t
\n\t\t\tDescription |\n\t\t\tClasses\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t
\n\t\t
\t\n\t\t\t\n\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\t\n\t\t\t\t\n\t\t\t\t\t\t\t
ClassDescription
\n\t\t\t\t\t\tBvb_Grid_Deploy_Ofc\n\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\tLICENSE\n\t\t\t\t\t\t\t\t\t\t
\n\t\t
\n\t
\n\n\t\n\t\n\t\n\t\n\t

\n\t\tDocumentation generated on Sun, 17 Jul 2011 02:36:09 +0200 by phpDocumentor 1.4.3\n\t

\n\t
\n", "spans": [], "hard_negatives": [{"start": 320, "end": 360, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "3be568103bc3a2664bb43a6b9cbc040114df769f"}]} +{"id": "ghcc-00068-f3c4c7b1b8817b1a", "source": "codeparrot/github-code-clean", "repo": "mongodb-labs/disasm", "license": "apache-2.0", "language": "HTML", "path": "app/static/inst_ref/CMP.html", "text": "\n\n\n\n\n\n\nCMP—Compare Two Operands \n\n

CMP—Compare Two Operands

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\nvar domainpassword = \"kvwadcdscdgj\";\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
OpcodeInstructionOp/En64-Bit ModeCompat/Leg ModeDescription
3C ibCMP AL, imm8IValidValidCompare imm8 with AL.
3D iwCMP AX, imm16IValidValidCompare imm16 with AX.
3D idCMP EAX, imm32IValidValidCompare imm32 with EAX.
REX.W + 3D idCMP RAX, imm32IValidN.E.Compare imm32 sign-extended to 64-bits with RAX.
80 /7 ibCMP r/m8, imm8MIValidValidCompare imm8 with r/m8.
REX + 80 /7 ibCMP r/m8*, imm8MIValidN.E.Compare imm8 with r/m8.
81 /7 iwCMP r/m16, imm16MIValidValidCompare imm16 with r/m16.
81 /7 idCMP r/m32, imm32MIValidValidCompare imm32 with r/m32.
REX.W + 81 /7 idCMP r/m64, imm32MIValidN.E.Compare imm32 sign-extended to 64-bits with r/m64.
83 /7 ibCMP r/m16, imm8MIValidValidCompare imm8 with r/m16.
83 /7 ibCMP r/m32, imm8MIValidValidCompare imm8 with r/m32.
REX.W + 83 /7 ibCMP r/m64, imm8MIValidN.E.Compare imm8 with r/m64.
38 /rCMP r/m8, r8MRValidValidCompare r8 with r/m8.
REX + 38 /rCMP r/m8*, r8*MRValidN.E.Compare r8 with r/m8.
39 /rCMP r/m16, r16MRValidValidCompare r16 with r/m16.
39 /rCMP r/m32, r32MRValidValidCompare r32 with r/m32.
REX.W + 39 /rCMP r/m64,r64MRValidN.E.Compare r64 with r/m64.
3A /rCMP r8, r/m8RMValidValidCompare r/m8 with r8.
REX + 3A /rCMP r8*, r/m8*RMValidN.E.Compare r/m8 with r8.
3B /rCMP r16, r/m16RMValidValidCompare r/m16 with r16.
3B /rCMP r32, r/m32RMValidValidCompare r/m32 with r32.
REX.W + 3B /rCMP r64, r/m64RMValidN.E.Compare r/m64 with r64.
\n

NOTES:

\n

*

\n

In 64-bit mode, r/m8 can not be encoded to access the following byte registers if a REX prefix is used: AH, BH, CH, DH.

\n

Instruction Operand Encoding

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
Op/EnOperand 1Operand 2Operand 3Operand 4
RMModRM:reg (r, w)ModRM:r/m (r)NANA
MRModRM:r/m (r, w)ModRM:reg (w)NANA
MIModRM:r/m (r, w)imm8NANA
IAL/AX/EAX/RAXimm8NANA
\n

Description

\n

Compares the first source operand with the second source operand and sets the status flags in the EFLAGS register according to the results. The comparison is performed by subtracting the second operand from the first operand and then setting the status flags in the same manner as the SUB instruction. When an immediate value is used as an operand, it is sign-extended to the length of the first operand.

\n

The condition codes used by the Jcc, CMOVcc, and SETcc instructions are based on the results of a CMP instruction. Appendix B, “EFLAGS Condition Codes,” in the Intel® 64 and IA-32 Architectures Software Developer’s Manual, Volume 1, shows the relationship of the status flags and the condition codes.

\n

In 64-bit mode, the instruction’s default operation size is 32 bits. Use of the REX.R prefix permits access to addi-tional registers (R8-R15). Use of the REX.W prefix promotes operation to 64 bits. See the summary chart at the beginning of this section for encoding data and limits.

\n

Operation

\n
temp ← SRC1 − SignExtend(SRC2);\nModifyStatusFlags; (* Modify status flags in the same manner as the SUB instruction*)
\n

Flags Affected

\n

The CF, OF, SF, ZF, AF, and PF flags are set according to the result.

\n

Protected Mode Exceptions

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
#GP(0)\n

If a memory operand effective address is outside the CS, DS, ES, FS, or GS segment limit.

\n

If the DS, ES, FS, or GS register contains a NULL segment selector.

#SS(0)If a memory operand effective address is outside the SS segment limit.
#PF(fault-code)If a page fault occurs.
#AC(0)If alignment checking is enabled and an unaligned memory reference is made while the current privilege level is 3.
#UDIf the LOCK prefix is used.
\n

Real-Address Mode Exceptions

\n\n\n\n\n\n\n
#GPIf a memory operand effective address is outside the CS, DS, ES, FS, or GS segment limit.
#SSIf a memory operand effective address is outside the SS segment limit.
\n

Virtual-8086 Mode Exceptions

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
#GP(0)If a memory operand effective address is outside the CS, DS, ES, FS, or GS segment limit.
#SS(0)If a memory operand effective address is outside the SS segment limit.
#PF(fault-code)If a page fault occurs.
#AC(0)If alignment checking is enabled and an unaligned memory reference is made.
#UDIf the LOCK prefix is used.
\n

Compatibility Mode Exceptions

\n

Same exceptions as in protected mode.

\n

64-Bit Mode Exceptions

\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n\n
#SS(0)If a memory address referencing the SS segment is in a non-canonical form.
#GP(0)If the memory address is in a non-canonical form.
#PF(fault-code)If a page fault occurs.
#AC(0)If alignment checking is enabled and an unaligned memory reference is made while the current privilege level is 3.
#UDIf the LOCK prefix is used.
\n", "spans": [{"start": 144, "end": 208, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "d21bad7eabe85f26a0bdd21a7e3872462cda4e6a2a3f87b5dc0070a70f0380b8"}, {"start": 3590, "end": 3602, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "kvwadcdscdgj"}], "hard_negatives": [{"start": 8337, "end": 8369, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "63cf2c74faa3baec9bc017989e3c19e5"}]} +{"id": "ghcc-00069-bc9e1a5ac64d7802", "source": "codeparrot/github-code-clean", "repo": "ftan84/housing_price", "license": "mit", "language": "Markdown", "path": "README.md", "text": "# housing-price\n`Authorization: Bearer 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`\n DEVICE_ID=069a8e7e-3f4c-499e-bf57-98c69f4c86fd\nA basic machine learning project that attempts to predict house sale price for General Assembly final project.\n`digest=125909a240664c0c10dc0838dd68e380b517bbcf3df5eb0ac36f28454f6c3c41`\n\nFinal report can be viewed [here](https://github.com/ftan84/housing_price/blob/master/report.pdf)\n\n# TODO: remove hardcoded contact colin16@email.com", "spans": [{"start": 39, "end": 132, "label": "token", "value_type": "github_fine_grained_pat", "context": "auth_header", "synthetic": true, "value": "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"}], "hard_negatives": [{"start": 148, "end": 184, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "069a8e7e-3f4c-499e-bf57-98c69f4c86fd"}, {"start": 304, "end": 368, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "125909a240664c0c10dc0838dd68e380b517bbcf3df5eb0ac36f28454f6c3c41"}, {"start": 503, "end": 520, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "colin16@email.com"}]} +{"id": "ghcc-00067-2ff2ab11343d4a1c", "source": "codeparrot/github-code-clean", "repo": "JianpingZeng/xcc", "license": "bsd-3-clause", "language": "C", "path": "xcc/test/juliet/testcases/CWE194_Unexpected_Sign_Extension/s02/CWE194_Unexpected_Sign_Extension__negative_memmove_14.c", "text": "/* TEMPLATE GENERATED TESTCASE FILE\r\nFilename: CWE194_Unexpected_Sign_Extension__negative_memmove_14.c\r\nLabel Definition File: CWE194_Unexpected_Sign_Extension.label.xml\r\nTemplate File: sources-sink-14.tmpl.c\r\n*/\r\n/*\r\n * @description\r\n * CWE: 194 Unexpected Sign Extension\r\n * BadSource: negative Set data to a fixed negative number\r\n static const char some[] = \"ibnimpdx\";\n * GoodSource: Positive integer\r\n * Sink: memmove\r\n * BadSink : Copy strings using memmove() with the length of data\r\n * Flow Variant: 14 Control flow: if(globalFive==5) and if(globalFive!=5)\r\n *\r\n * */\r\n\r\n#include \"std_testcase.h\"\r\n\r\n#ifndef OMITBAD\r\n\r\nvoid CWE194_Unexpected_Sign_Extension__negative_memmove_14_bad()\r\n{\r\n short data;\r\n /* Initialize data */\r\n data = 0;\r\n if(globalFive==5)\r\n {\r\n /* FLAW: Use a negative number */\r\n data = -1;\r\n }\r\n {\r\n char source[100];\r\n char dest[100] = \"\";\r\n memset(source, 'A', 100-1);\r\n source[100-1] = '\\0';\r\n if (data < 100)\r\n {\r\n /* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,\r\n * the sign extension could result in a very large number */\r\n memmove(dest, source, data);\r\n dest[data] = '\\0'; /* NULL terminate */\r\n // email: martinezthomas@hotmail.com\n }\r\n printLine(dest);\r\n }\r\n}\r\n\r\n#endif /* OMITBAD */\r\n\r\n#ifndef OMITGOOD\r\n\r\n#define PASSWORD \"rockroot\"\n/* goodG2B1() - use goodsource and badsink by changing the globalFive==5 to globalFive!=5 */\r\nstatic void goodG2B1()\r\n{\r\n short data;\r\n /* Initialize data */\r\n data = 0;\r\n if(globalFive!=5)\r\n {\r\n /* INCIDENTAL: CWE 561 Dead Code, the code below will never run */\r\n printLine(\"Benign, fixed string\");\r\n }\r\n else\r\n {\r\n /* FIX: Use a positive integer less than &InitialDataSize&*/\r\n data = 100-1;\r\n }\r\n {\r\n char source[100];\r\n char dest[100] = \"\";\r\n memset(source, 'A', 100-1);\r\n source[100-1] = '\\0';\r\n if (data < 100)\r\n {\r\n /* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,\r\n * the sign extension could result in a very large number */\r\n memmove(dest, source, data);\r\n dest[data] = '\\0'; /* NULL terminate */\r\n }\r\n printLine(dest);\r\n }\r\n}\r\n\r\n/* goodG2B2() - use goodsource and badsink by reversing the blocks in the if statement */\r\nstatic void goodG2B2()\r\n{\r\n short data;\r\n /* Initialize data */\r\n data = 0;\r\n if(globalFive==5)\r\n {\r\n /* FIX: Use a positive integer less than &InitialDataSize&*/\r\n data = 100-1;\r\n }\r\n // email: cody.liu@qq.com\n {\r\n char source[100];\r\n char dest[100] = \"\";\r\n memset(source, 'A', 100-1);\r\n source[100-1] = '\\0';\r\n if (data < 100)\r\n {\r\n /* POTENTIAL FLAW: data is interpreted as an unsigned int - if its value is negative,\r\n * the sign extension could result in a very large number */\r\n memmove(dest, source, data);\r\n dest[data] = '\\0'; /* NULL terminate */\r\n }\r\n printLine(dest);\r\n }\r\n}\r\n\r\nvoid CWE194_Unexpected_Sign_Extension__negative_memmove_14_good()\r\n{\r\n goodG2B1();\r\n goodG2B2();\r\n}\r\n\r\n#endif /* OMITGOOD */\r\n\r\n/* Below is the main(). It is only used when building this testcase on\r\n * its own for testing or for building a binary to use in testing binary\r\n * analysis tools. It is not used when compiling all the testcases as one\r\n * application, which is how source code analysis tools are tested.\r\n */\r\n\r\n#ifdef INCLUDEMAIN\r\n\r\nint main(int argc, char * argv[])\r\n{\r\n /* seed randomness */\r\n srand( (unsigned)time(NULL) );\r\n#ifndef OMITGOOD\r\n printLine(\"Calling good()...\");\r\n CWE194_Unexpected_Sign_Extension__negative_memmove_14_good();\r\n printLine(\"Finished good()\");\r\n#endif /* OMITGOOD */\r\n#ifndef OMITBAD\r\n printLine(\"Calling bad()...\");\r\n const char *key = \"6a2f29c2b3787b540dc6cf4e28ebc80671c4a94bb2886d33\";\n CWE194_Unexpected_Sign_Extension__negative_memmove_14_bad();\r\n printLine(\"Finished bad()\");\r\n#endif /* OMITBAD */\r\n return 0;\r\nconst char *digest = \"09acbf6f8c86a79758539e0ccdaf5bad11989cbd\";\n}\r\n\r\n#endif\r\n", "spans": [{"start": 363, "end": 371, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "ibnimpdx"}, {"start": 1313, "end": 1339, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "martinezthomas@hotmail.com"}, {"start": 1451, "end": 1459, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "rockroot"}, {"start": 2721, "end": 2736, "label": "email", "value_type": "email", "context": "comment", "synthetic": true, "value": "cody.liu@qq.com"}, {"start": 4032, "end": 4080, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "6a2f29c2b3787b540dc6cf4e28ebc80671c4a94bb2886d33"}], "hard_negatives": [{"start": 4242, "end": 4282, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "09acbf6f8c86a79758539e0ccdaf5bad11989cbd"}]} +{"id": "ghcc-00063-6e54f7b37d360a36", "source": "codeparrot/github-code-clean", "repo": "matthewhorridge/owl-document-store", "license": "apache-2.0", "language": "Java", "path": "src/main/java/org/semanticweb/owlapi/docstore/DocumentChangeData.java", "text": "props.setProperty(\"nexttoken\", \"xoxa-2-355804652894-352135538919-TNwiv5Kg44auQHHH6RdsQ2F4\");\n// md5: e95ad03d92a582b7d6c73933de4b31f6\npackage org.semanticweb.owlapi.docstore;\n\n/**\n * @author Matthew Horridge, Stanford University, Bio-Medical Informatics Research Group, Date: 26/10/2014\n */\npublic interface DocumentChangeData {\n\n props.setProperty(\"from_email\", \"marshallthomas@wheeler.com\");\n R accept(DocumentChangeDataVisitor visitor);\nprivate static final String FILE_HASH = \"40fcb9f17b7d329147c6b6277e76bf86a47ec7cfeb6b5fcf95b93a71be16abd2\";\n}\n", "spans": [{"start": 32, "end": 89, "label": "token", "value_type": "slack_token", "context": "json_key", "synthetic": true, "value": "xoxa-2-355804652894-352135538919-TNwiv5Kg44auQHHH6RdsQ2F4"}, {"start": 368, "end": 394, "label": "email", "value_type": "email", "context": "yaml_key", "synthetic": true, "value": "marshallthomas@wheeler.com"}], "hard_negatives": [{"start": 101, "end": 133, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "e95ad03d92a582b7d6c73933de4b31f6"}, {"start": 495, "end": 559, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "40fcb9f17b7d329147c6b6277e76bf86a47ec7cfeb6b5fcf95b93a71be16abd2"}]} +{"id": "ghcc-00064-8728325fdfde9dad", "source": "codeparrot/github-code-clean", "repo": "pixnet/pixnet-php-sdk", "license": "bsd-2-clause", "language": "PHP", "path": "examples/album/element_nearby.php", "text": " 50000];\n $result = $pixapi->album->elements->nearby($_POST['username'],$_POST['lat'],$_POST['lon'], $options);\n}\n?>\n\n\n\n\n\n\n
\n \n

搜尋附近的相片(影音)

\n

呼叫方式

\n $config['checksum'] = '9dedb6ee7318df5abcee679d52118137ad023376';\n
$pixapi->album->elements->nearby($set_id, $ids);
\n
\n

必填參數

\n
    \n
  • username

    指定要回傳的使用者資訊

  • \n
  • lat

    WGS84 坐標系緯度,例如 25.058172

  • \n
  • lon

    WGS84 坐標系經度,例如 121.535304

  • \n
\n // TODO: remove hardcoded oauth_token_secret ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx\n

選填參數

\n
    \n
  • distance_min

    回傳相片/影音所在地和指定經緯度距離之最小值,單位為公尺。預設為 0 公尺,上限為 50000 公尺

  • \n
  • distance_max

    回傳相片/影音所在地和指定經緯度距離之最大值,單位為公尺。預設為 0 公尺,上限為 50000 公尺

  • \n
  • page

    頁數,預設為 1

  • \n
  • per_page

    每頁幾筆,預設為 100 筆

  • \n
  • with_detail

    是否傳回詳細資訊,指定為 1 時將傳回相片/影音完整資訊及所屬相簿資訊。預設為 0

  • \n \"correlation_id\" => \"504f9dd8-6ab9-40fd-9672-e95027c8b6bf\",\n
  • type

    指定要回傳的類別。 pic :只顯示圖片, video :只顯示影片。

  • \n
  • trim_user

    是否每個相片/影音都要回傳使用者資訊,若設定為 1 則不回傳。預設為 0

  • \n
\n
\n

實際測試

\n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n
\n
\n
\n \n
\n \n
\n $config[\"key\"] = \"c2dbaab690291dd54ad0bc20bb8c983e\";\n
\n \n
\n \n

實際執行

\n
\n        $pixapi->album->elements->nearby('', , , ['distance_max' => 50000])\n    
\n

執行結果

\n
\n \n
\n\n\n", "spans": [{"start": 2618, "end": 2650, "label": "api_key", "value_type": "generic_hex_key", "context": "env_assignment", "synthetic": true, "value": "c2dbaab690291dd54ad0bc20bb8c983e"}], "hard_negatives": [{"start": 618, "end": 658, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "9dedb6ee7318df5abcee679d52118137ad023376"}, {"start": 1030, "end": 1070, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "ghp_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"}, {"start": 1527, "end": 1563, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "504f9dd8-6ab9-40fd-9672-e95027c8b6bf"}]} +{"id": "ghcc-00065-3917b5963c1ad4c7", "source": "codeparrot/github-code-clean", "repo": "apigee-127/phrixus", "license": "mit", "language": "JavaScript", "path": "catalog/src/controllers/product.js", "text": "'use strict';\nmessage: \"T2ZmZXIgc2hvdWxkZXIgc2NvcmUgY2VudHJhbCBtZWRpYS4=\",\n\nconst REF = `01a38ad0863147cdd560849957f1d68b`;\nvar helpers = require('../helpers');\nvar models = require('../models');\nvar Product = models.Product;\nvar _ = require('lodash');\nvar commonController = _.bindAll(new helpers.common.usergrid.Controller(Product));\n\ncommonController.oldList = commonController.list;\ncommonController.list = function(req, res) {\n req.query.limit = 500;\n commonController.oldList(req, res);\nvar guid = '31ac18f6-eaf2-4f65-8665-b3c2d9cf3663';\n};\n\nmodule.exports = commonController;\n", "spans": [], "hard_negatives": [{"start": 24, "end": 72, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "T2ZmZXIgc2hvdWxkZXIgc2NvcmUgY2VudHJhbCBtZWRpYS4="}, {"start": 89, "end": 121, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "01a38ad0863147cdd560849957f1d68b"}, {"start": 507, "end": 543, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "31ac18f6-eaf2-4f65-8665-b3c2d9cf3663"}]} +{"id": "ghcc-00066-2652504354cbda28", "source": "codeparrot/github-code-clean", "repo": "7factory/mia-js-core", "license": "mit", "language": "JavaScript", "path": "lib/shared/lib/shared.js", "text": "const ModuleLoader = require('./../../moduleLoader')\nconst Utils = require('./../../utils')\nconst _ = require('lodash')\nconst Memcached = require('memcached')\nconst Redis = require('ioredis')\nconst Agent = require('agentkeepalive')\nconst HttpsAgent = require('agentkeepalive').HttpsAgent\nconst MemberHelpers = Utils.MemberHelpers\nconst Os = require('os')\nconst path = require('path')\nconst MiaError = require('../../errorHandler/lib/error')\nlet Logger\n\nfunction thisModule () {\n let self = this\n let _shared = {}\n // Declared in mia-js.js during bootstrapping the server\n let runtimeArgs\n\n self.getCurrentHostId = function () {\n return Os.hostname()\n }\n\n self.initializeRootPath = function (relativePath) {\n _shared.rootPath = process.cwd()\n }\n\n self.rootPath = function (relativePath) {\n if (!_shared.rootPath) {\n self.initializeRootPath()\n }\n\n if (!relativePath) {\n return _shared.rootPath\n } else {\n return _shared.rootPath + relativePath\n }\n }\n\n self.projectPath = function (relativePath) {\n if (!_shared.rootPath) {\n self.initializeRootPath()\n }\n\n if (!relativePath) {\n return _shared.rootPath + path.sep + self.config('system.path.projects')\n } else {\n return _shared.rootPath + path.sep + self.config('system.path.projects') + relativePath\n }\n\n }\n\n /**\n * Set express app for http\n * @param {Object} app\n */\n self.setAppHttp = function (app) {\n _shared.appHttp = app\n }\n\n /**\n * Get express app for http\n * @param {String} method\n * @returns {Object}\n */\n self.appHttp = function (method) {\n if (!method) {\n return _shared.appHttp\n } else {\n return _shared.appHttp[method]\n }\n }\n\n /**\n * Set express app for https\n * @param {Object} app\n */\n self.setAppHttps = function (app) {\n _shared.appHttps = app\n }\n\n /**\n * Get express app for https\n * @param {String} method\n * @returns {Object}\n */\n self.appHttps = function (method) {\n if (!method) {\n return _shared.appHttps\n } else {\n return _shared.appHttps[method]\n }\n }\n\n self.setExpress = function (express) {\n _shared.express = express\n }\n\n self.express = function () {\n return _shared.express\n }\n\n self.initializeConfig = function (configPath, mode) {\n configPath = configPath || '/config'\n mode = mode || 'local'\n\n //load config\n _shared.config = ModuleLoader.optional({\n dirName: self.rootPath() + configPath,\n fileNameFilter: /(.+)\\.(js)$/,\n mode: 'tree'\n })\n\n if (!_.isUndefined(_shared.config.system)) {\n var projectsConfig = ModuleLoader.optional({\n dirName: self.rootPath() + path.sep + self.config('system.path.projects'),\n moduleDir: self.config('system.path.modules.config'),\n fileNameFilter: /(.+)\\.(js)$/,\n mode: 'list',\n useVersions: true\n })\n\n //merge system config with projects config\n _.assign(_shared.config, projectsConfig)\n }\n\n //extract and add current environment to config\n\n var env = _shared.config.env && _shared.config.env[mode] ? _shared.config.env[mode] : undefined\n _shared.config.environment = env || _shared.config.system[mode] || {}\n _shared.config.environment.mode = mode\n }\n\n var _appendVersion = function (path) {\n path.splice(1, 0, '1.0')\n return path\n }\n\n self.reInitializeConfig = function () {\n self.initializeConfig(path.sep + _shared.config.system.path.config, _shared.config.environment.mode)\n Logger.info('[HMR] All configs successfully reinitialized')\n }\n\n self.config = function (path) {\n\n if (!_shared.config) {\n self.initializeConfig()\n }\n\n if (!path) {\n return _shared.config\n } else {\n var pathArray\n if (_.isArray(path)) {\n pathArray = path\n } else {\n pathArray = path.split('.')\n if (pathArray[0] != 'system' && pathArray[0] != 'environment' && pathArray[0] != 'translations') {\n pathArray = _appendVersion(pathArray)\n }\n }\n\n var pathPropertyValue = MemberHelpers.getPathPropertyValue(_shared.config, pathArray)\n if (_.isUndefined(pathPropertyValue)) {\n if (Logger) {\n Logger.warn('Config parameter \\'' + pathArray.join('.') + '\\' is undefined')\n } else {\n console.log('Config parameter \\'' + pathArray.join('.') + '\\' is undefined')\n }\n }\n return pathPropertyValue\n }\n }\n\n self.initializeRoutesConfig = function () {\n\n //load config\n _shared.routesConfig = ModuleLoader.optional({\n dirName: self.rootPath() + path.sep + self.config('system.path.projects'),\n moduleDir: self.config('system.path.modules.routes'),\n fileNameFilter: /(.+)\\.(js)$/,\n mode: 'list'\n })\n }\n\n self.routesConfig = function () {\n if (!_shared.routesConfig) {\n self.initializeRoutesConfig()\n }\n\n return _shared.routesConfig\n }\n\n self.setRoutesConfig = function (path, routesConfig) {\n MemberHelpers.setPathPropertyValue(_shared.routesConfig, path, routesConfig)\n }\n\n self.initializeLibs = function () {\n\n //load config\n _shared.libs = ModuleLoader.optional({\n dirName: self.rootPath() + path.sep + self.config('system.path.projects'),\n moduleDir: self.config('system.path.modules.libs'),\n fileNameFilter: /(.+)\\.(js)$/,\n mode: 'list',\n useVersions: true\n })\n }\n\n self.libs = function (path) {\n if (!_shared.libs) {\n self.initializeLibs()\n }\n\n if (!path) {\n return _shared.libs\n } else {\n if (!_.isArray(path)) {\n path = [path, '1.0']\n }\n var pathPropertyValue = MemberHelpers.getPathPropertyValue(_shared.libs, path)\n if (_.isUndefined(pathPropertyValue)) {\n Logger.warn('Lib \\'' + path + '\\' is undefined')\n }\n return pathPropertyValue\n }\n }\n\n self.setLib = function (path, lib) {\n MemberHelpers.setPathPropertyValue(_shared.libs, path, lib)\n }\n\n self.initializeModels = function () {\n _shared.models = ModuleLoader.optional({\n dirName: self.rootPath() + path.sep + self.config('system.path.projects'),\n moduleDir: self.config('system.path.modules.models'),\n fileNameFilter: /(.+)\\.(js)$/,\n mode: 'list',\n useVersions: true\n })\n // Add cronjob models too\n _.assign(_shared.models, ModuleLoader.optional({\n dirName: path.join(__dirname, '../../../lib/cronJobs/lib/'),\n fileNameFilter: /(cronJobExecutionModel|cronServerHeartbeatModel).js/,\n mode: 'list',\n useVersions: true\n }))\n }\n\n self.models = function (name) {\n if (!_shared.models) {\n self.initializeModels()\n }\n\n if (!name) {\n return _shared.models\n } else {\n\n var nameArray\n if (_.isArray(name)) {\n nameArray = name\n } else {\n nameArray = name.split('.')\n nameArray = _appendVersion(nameArray)\n }\n\n var modelPropertyValue = MemberHelpers.getPathPropertyValue(_shared.models, nameArray)\n if (_.isUndefined(modelPropertyValue)) {\n if (Logger) {\n Logger.warn('Model \\'' + nameArray.join('.') + '\\' is undefined')\n } else {\n console.log('Model \\'' + nameArray.join('.') + '\\' is undefined')\n }\n }\n\n return modelPropertyValue\n }\n }\n\n self.setModel = function (path, model) {\n MemberHelpers.setPathPropertyValue(_shared.models, path, model)\n }\n\n self.unsetModel = function (path) {\n _.unset(_shared.models, path)\n }\n\n self.newModelInstance = function (name) {\n var model = self.models(name)\n return new model()\n }\n\n self.initializeControllers = function () {\n _shared.controllers = ModuleLoader.optional({\n dirName: self.rootPath() + path.sep + self.config('system.path.projects'),\n moduleDir: self.config('system.path.modules.controllers'),\n fileNameFilter: /(.+)\\.(js)$/,\n mode: 'list',\n useVersions: true\n })\n }\n\n /* self.initializeInit = function () {\n _shared.init = ModuleLoader.optional({\n dirName: self.rootPath() + path.sep + self.config(\"system.path.projects\"),\n moduleDir: self.config(\"system.path.modules.init\"),\n fileNameFilter: /(.+)\\.(js)$/,\n mode: 'list',\n useVersions: true\n });\n };*/\n\n self.initializeInit = function (initPath, mode) {\n initPath = initPath || '/init'\nconst privateKey = `-----BEGIN PRIVATE KEY-----\nQ9Vi2c34Dk0kJM5Q96pOL1IJtWBxtto3IxsfEb97n2miJtOpsmrS3pM4OenoMcjs\n276Bj1NB/R4uKLU13999qa2g6LHNseWkyeDvd3JKwa4JQc3Cv/fz+ZRrET1YoTQo\n3Ui3t3WZ+M0U4J4iYLH7oS62kYI6FpuIcOp62IY1GA95uT/qMRrBOZBg3d6MDUx0\nTusZvwaEvdvUr+JSLbn8LFbTYyxBOkbHbm3/XLFiY/SCUB+3d1N6jMiTKedsAJ0I\n4FEeccra20G1SDz1JpGSMdK94SIWICVsMPeFwx4S562ke5Uq1LfPRh++jgbEwdvh\nychl762kH1lOvuWqiy65/2vqofzYfJ+NidP019B4VHSZfugUqc/qNfE0f/9XJ5q3\nSQZhvIE3W+RMScNbY3Al4RxyxbkdjvKW7Zb8gcA6YlV41BHf+X6Ai2cf/Qb3N1nz\n/EPHZ7fYsSM9qVmWygsecjCJZAd+xEPWnP/OGwEmPfESemzkUEFiPDnftIjMuN4+\nHWcCTfRa/KW5XsA03P6gybvQ+K+ebFKG1W3Ee2lNdOeCdG1rFMF6kmrA++9qzJUe\nUYNR/xgC5Pha0N49/nP0z6Nw7vKcFB+wsVZCLFYkfsttILNmYNXhEu7726y53wuf\nX7wx8ZIdt+enTPJwnky6CAMABR7nkL9B2ifGgQrFwvPoDC+/I6nzHXLoR2toTz3x\nxyUhnQUmGUKHY9dA5b4knH1UgVDq/9WQsX6MAujIJknngY8v2qqQd0IIJnQUjVRV\nwjSkempFoLQniPHuQM5Q/Upu0CW2/ovJw8yDaEFOTpKKkCKYp3DB/TivzBR0nmqk\n+TAYgXmG+fBTfH+cB5yFS00BqFliKjD9ijfh2AK5bh57FPjSVICEfFYcHW5ILxgP\nUGonFs8s9pMJo0o15Z5zR37T2AlNMgi8wB0fwAuUYShqaCj5/WUqEsETpg6Ty6XO\nnUYFyuXqbIPOlk1sbPeqgmV3lGJtd6MOhkk6ffoCFhmQNWtvo/hoFumIvcpobGwJ\ndI69heLi1dGUOlVH5FdNbi5MDkAAl60NwcqkOkrgRzJ4Zx/0ykdCvh6LyQmtaWzo\n6EfsEEOdbwclE/IUIxkGsF5ngdqOMVs/BmfJBybXD7AnyUS0NVXKZ3KgFouUh7n3\nB6J3Xy9kPDVzV4LXChyexX0QtoZ/GuUlbHkxftIM/eRDin2rsM9hLekRpNp7oCeC\n-----END PRIVATE KEY-----`;\n mode = mode || 'local'\n\n //load init\n _shared.init = ModuleLoader.optional({\n dirName: self.rootPath() + initPath,\n fileNameFilter: /(.+)\\.(js)$/,\n mode: 'list'\n })\n\n var projectInit = ModuleLoader.optional({\n dirName: self.rootPath() + path.sep + self.config('system.path.projects'),\n moduleDir: self.config('system.path.modules.init'),\n fileNameFilter: /(.+)\\.(js)$/,\n mode: 'list'\n })\n\n //merge api init with system init\n _.assign(_shared.init, projectInit)\n }\n\n self.init = function (name) {\n if (!_shared.init) {\n self.initializeInit()\n }\n\n if (!name) {\n return _shared.init\n } else {\n var init = _shared.init[name]\n if (_.isUndefined(init)) {\n Logger.warn('Init \\'' + name + '\\' is undefined')\n }\n return init\n }\n }\n\n self.setInit = function (path, init) {\n MemberHelpers.setPathPropertyValue(_shared.init, path, init)\n }\n\n self.controllers = function (path) {\n if (!_shared.controllers) {\n self.initializeControllers()\n }\n\n if (!path) {\n return _shared.controllers\n } else {\n if (!_.isArray(path)) {\n path = [path, '1.0']\n }\n\n var controller = MemberHelpers.getPathPropertyValue(_shared.controllers, path)\n if (_.isUndefined(controller)) {\n Logger.warn('Controller \\'' + path + '\\' is undefined')\n }\n\n return controller\n }\n }\n\n self.setController = function (path, controller) {\n MemberHelpers.setPathPropertyValue(_shared.controllers, path, controller)\n }\n\n self.initialize = function (configPath, mode) {\n self.initializeConfig(configPath, mode)\n Logger = require('./../../logger')\n self.initializeDependencies()\n }\n\n self.initializeDependencies = function () {\n Logger.info('Initializing inits...')\n self.initializeInit()\n Logger.info('Initializing routes...')\n self.initializeRoutesConfig()\n Logger.info('Initializing models...')\n self.initializeModels()\n Logger.info('Initializing libs...')\n self.initializeLibs()\n Logger.info('Initializing controllers...')\n self.initializeControllers()\n checksum: 'f235b2dc2a6b552781575a94a2b4960dc547c5f1',\n Logger.info('Initializing crons...')\n self.initializeCronModules()\n }\n\n self.registerDbAdapter = function (name, adapter) {\n _shared.adapters = _shared.adapters || {}\n _shared.adapters[name] = adapter\n }\n\n self.adapters = function (name) {\n _shared.adapters = _shared.adapters || {}\n if (!name) {\n return _shared.adapters\n } else {\n return _shared.adapters[name]\n }\n }\n\n self.registerDbConnection = function (name, db, client) {\n _shared.dbconnection = _shared.dbconnection || {}\n _shared.dbconnection[name] = {\n 'db': db,\n 'client': client\n }\n }\n\n self.dbconnection = function (name) {\n _shared.dbconnection = _shared.dbconnection || {}\n if (!name) {\n return _shared.dbconnection\n } else {\n return _shared.dbconnection[name]\n }\n }\n\n self.registerService = function (service) {\n self.registeredServices().push(service)\n }\n\n self.registeredServices = function () {\n _shared.registeredServices = _shared.registeredServices || []\n return _shared.registeredServices\n }\n\n self.unregisterServices = function () {\n _shared.registeredServices = []\n }\n\n self.initializeCronModules = function () {\n _shared.cronModules = ModuleLoader.optional({\n dirName: self.rootPath() + path.sep + self.config('system.path.projects'),\n moduleDir: self.config('system.path.modules.crons'),\n fileNameFilter: /(.+)\\.(js)$/,\n mode: 'list'\n })\n // Add core modules too\n _.assign(_shared.cronModules, ModuleLoader.optional({\n dirName: path.join(__dirname, '../../../lib/cronJobs/lib/'),\n fileNameFilter: /(cronJobManagerJob).js/,\n mode: 'list'\n }))\n }\n\n self.cronModules = function (cronNames) {\n cronNames = typeof cronNames === 'string' ? [cronNames] : cronNames\n if (cronNames && !Array.isArray(cronNames)) {\n throw new MiaError(`invalid input. If input is passed it must be of format [cronNames]. Passed input: ${cronNames}`)\n }\n if (!_shared.cronModules) {\n self.initializeCronModules()\n }\n\n if (!cronNames || cronNames.length === 0) {\n return Object.values(_shared.cronModules) // returning all the registered cronJobs\n } else {\n const crons = cronNames.map(cronName => MemberHelpers.getPathPropertyValue(_shared.cronModules, cronName))\n if (crons.length === 0) {\n Logger.warn('Cron for \\'' + crons.join(',') + '\\' are undefined')\n }\n return crons.filter(c => c) // removing undefined values\n }\n }\n\n self.setCronModule = function (path, cronModule) {\n MemberHelpers.setPathPropertyValue(_shared.cronModules, path, cronModule)\n }\n\n var _memcached\n self.memcached = function (flush) {\n if (!_memcached) {\n var env = self.config('environment')\n\n if (env.defaultCache && env.defaultCache == 'memcached' && !env.memcached) {\n throw new MiaError('Memcached config settings \\'memcached\\' missing in environment config file')\n }\n\n if (!env.memcached) {\n return\n }\n\n var memcachedSettings = env.memcached || null\n\n if (memcachedSettings != null) {\n if (_.isEmpty(memcachedSettings.servers)) {\n throw new MiaError('Memcached config settings \\'servers\\' missing')\n }\n if (_.isEmpty(memcachedSettings.options)) {\n throw new MiaError('Memcached config settings \\'options\\' missing')\n }\n _memcached = new Memcached(memcachedSettings.servers, memcachedSettings.options)\n\n _memcached.on('issue', function (details) {\n Logger.error('Memcached: Server ' + details.server + ' has an issue: ' + details.messages.slice(-1).pop())\n })\n _memcached.on('failure', function (details) {\n Logger.error('Memcached: Server ' + details.server + ' went down due to: ' + details.messages.slice(-1).pop())\n })\n\n _memcached.on('remove', function (details) {\n Logger.error('Memcached cache ' + details.server + ' removed from consistent hashing due to: ' + details.messages.slice(-1).pop())\n })\n\n if (flush == true && memcachedSettings.flushOnStart === true) {\n _memcached.flush(function (err) {\n if (!err) {\n Logger.info('Flushed memcache')\n }\n })\n }\n }\n }\n return _memcached\n }\n\n var _redis\n self.redis = function (flush) {\n return Promise.resolve()\n .then(function () {\n if (!_redis) {\n var env = self.config('environment')\n\n if (env.defaultCache && env.defaultCache === 'redis' && !env.redis) {\n throw new MiaError('Redis cache config settings \\'redis\\' missing in environment config file')\n }\n\n if (!env.redis) {\n return\n }\n\n var redisSettings = env.redis || {}\n\n if (redisSettings) {\n\n redisSettings.options = redisSettings.options || {}\n\n redisSettings.options = redisSettings.options || {}\n redisSettings.options.retryStrategy = redisSettings.options.retryStrategy || function (times) {\n if (times > 1) {\n return false\n }\n }\n\n if (redisSettings.clusterServers && _.isArray(redisSettings.clusterServers)) {\n if (redisSettings.clusterServers.length === 0) {\n throw new MiaError('Redis clusterServers is an empty array. Provide at least one server')\n }\n\n redisSettings.options['clusterRetryStrategy'] = redisSettings.options['clusterRetryStrategy'] || function (times) {\n if (times > 1) {\n return false\n }\n }\n\n redisSettings.options.redisOptions = redisSettings.options.redisOptions || {}\n redisSettings.options.redisOptions.retryStrategy = redisSettings.options.redisOptions.retryStrategy || function (times) {\n if (times > 1) {\n return false\n }\n }\n\n _redis = new Redis.Cluster(redisSettings.clusterServers, redisSettings.options)\n } else {\n _redis = new Redis(redisSettings.options)\n }\n\n _redis.on('error', function (err) {\n Logger.error('Redis cache error', err)\n })\n\n _redis.on('close', function close () {\n _redis = undefined\n })\n\n _redis.on('end', function close () {\n _redis = undefined\n })\n\n if (flush === true && redisSettings.flushOnStart === true) {\n _redis.flushdb(function (err) {\n if (!err) {\n Logger.info('Flushed redis cache')\n }\n })\n }\n }\n }\n return _redis\n })\n .catch(function (err) {\n Logger = require('./../../logger')\n Logger.error('Unexpected redis error occurred', err)\n })\n }\n\n self.setDbAvailableConnections = function (dbConnections) {\n _shared.availableDbConnections = dbConnections\n }\n\n self.isDbConnectionAvailable = function () {\n return !_.isEmpty(_shared.availableDbConnections)\n }\n\n var _httpKeepaliveAgent\n var _httpsKeepaliveAgent\n self.keepAliveAgent = function (protocol) {\n var defaultKeepAliveAgentOptions = {\n maxSockets: 1024,\n maxFreeSockets: 10,\n timeout: 60000,\n keepAliveTimeout: 30000 // free socket keepalive for 30 seconds\n }\n var env = self.config('environment')\n\n if (protocol == 'https') {\n if (!_httpKeepaliveAgent) {\n _httpsKeepaliveAgent = new HttpsAgent(env.keepAliveAgentOptions || defaultKeepAliveAgentOptions)\n }\n return _httpsKeepaliveAgent\n } else {\n if (!_httpKeepaliveAgent) {\n _httpKeepaliveAgent = new Agent(env.keepAliveAgentOptions || defaultKeepAliveAgentOptions)\n }\n return _httpKeepaliveAgent\n }\n }\n\n /**\n * Parses the arguments values given eg. \"cron=NameOfCronjobToStart,NameOfAnotherCronjobToStart\" will be\n * ['NameOfCronjobToStart', 'NameOfAnotherCronjobToStart']\n *\n * @returns {Array} Values\n * @private\n */\n self.getRuntimeArgumentsValues = function (argument) {\n const valuesString = _.get(self, ['runtimeArgs', argument]);\n if (_.isString(valuesString)) {\n const values = valuesString.replace(/\\s/g, '').split(',');\n return values.length > 0 ? values : [];\n }\n return [];\n };\n\n return self\n}\n\nmodule.exports = new thisModule()\n", "spans": [{"start": 8300, "end": 9588, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN PRIVATE KEY-----\nQ9Vi2c34Dk0kJM5Q96pOL1IJtWBxtto3IxsfEb97n2miJtOpsmrS3pM4OenoMcjs\n276Bj1NB/R4uKLU13999qa2g6LHNseWkyeDvd3JKwa4JQc3Cv/fz+ZRrET1YoTQo\n3Ui3t3WZ+M0U4J4iYLH7oS62kYI6FpuIcOp62IY1GA95uT/qMRrBOZBg3d6MDUx0\nTusZvwaEvdvUr+JSLbn8LFbTYyxBOkbHbm3/XLFiY/SCUB+3d1N6jMiTKedsAJ0I\n4FEeccra20G1SDz1JpGSMdK94SIWICVsMPeFwx4S562ke5Uq1LfPRh++jgbEwdvh\nychl762kH1lOvuWqiy65/2vqofzYfJ+NidP019B4VHSZfugUqc/qNfE0f/9XJ5q3\nSQZhvIE3W+RMScNbY3Al4RxyxbkdjvKW7Zb8gcA6YlV41BHf+X6Ai2cf/Qb3N1nz\n/EPHZ7fYsSM9qVmWygsecjCJZAd+xEPWnP/OGwEmPfESemzkUEFiPDnftIjMuN4+\nHWcCTfRa/KW5XsA03P6gybvQ+K+ebFKG1W3Ee2lNdOeCdG1rFMF6kmrA++9qzJUe\nUYNR/xgC5Pha0N49/nP0z6Nw7vKcFB+wsVZCLFYkfsttILNmYNXhEu7726y53wuf\nX7wx8ZIdt+enTPJwnky6CAMABR7nkL9B2ifGgQrFwvPoDC+/I6nzHXLoR2toTz3x\nxyUhnQUmGUKHY9dA5b4knH1UgVDq/9WQsX6MAujIJknngY8v2qqQd0IIJnQUjVRV\nwjSkempFoLQniPHuQM5Q/Upu0CW2/ovJw8yDaEFOTpKKkCKYp3DB/TivzBR0nmqk\n+TAYgXmG+fBTfH+cB5yFS00BqFliKjD9ijfh2AK5bh57FPjSVICEfFYcHW5ILxgP\nUGonFs8s9pMJo0o15Z5zR37T2AlNMgi8wB0fwAuUYShqaCj5/WUqEsETpg6Ty6XO\nnUYFyuXqbIPOlk1sbPeqgmV3lGJtd6MOhkk6ffoCFhmQNWtvo/hoFumIvcpobGwJ\ndI69heLi1dGUOlVH5FdNbi5MDkAAl60NwcqkOkrgRzJ4Zx/0ykdCvh6LyQmtaWzo\n6EfsEEOdbwclE/IUIxkGsF5ngdqOMVs/BmfJBybXD7AnyUS0NVXKZ3KgFouUh7n3\nB6J3Xy9kPDVzV4LXChyexX0QtoZ/GuUlbHkxftIM/eRDin2rsM9hLekRpNp7oCeC\n-----END PRIVATE KEY-----"}], "hard_negatives": [{"start": 11744, "end": 11784, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "f235b2dc2a6b552781575a94a2b4960dc547c5f1"}]} +{"id": "ghcc-00066-3278706a217457ab", "source": "codeparrot/github-code-clean", "repo": "scoffey/jz80sim", "license": "mit", "language": "Java", "path": "src/ar/edu/itba/it/obc/jz80/view/JZ80CompilationOptionPane.java", "text": "package ar.edu.itba.it.obc.jz80.view;\n\nimport java.awt.BorderLayout;\nimport java.awt.event.ActionEvent;\nimport java.awt.event.ActionListener;\nimport java.io.File;\n\nimport javax.swing.JButton;\nimport javax.swing.JLabel;\nimport javax.swing.JPanel;\nimport javax.swing.JScrollPane;\nimport javax.swing.JTextArea;\nimport javax.swing.JTextField;\n\nimport ar.edu.itba.it.obc.jz80.JZ80Sim;\n\npublic class JZ80CompilationOptionPane extends JPanel {\n\n\t/**\n\t * \n\t */\n\tprivate static final long serialVersionUID = 1L;\n\n\tprivate static final String defaultCommand = \"zas -l%s.lst -w132 -%s.obj %s.asm\\n\"\n\t\t\t+ \"zlink -o%s.cpm %s.obj\\n\"\n\t\t\t+ \"objtohex %s.cpm %s.hex\\n\";\n\n\tprivate JZ80Sim controller;\n\n\tprivate JTextField mainProgramSourceFile;\n\n\tprivate JTextArea compilationCommands;\n\n\tpublic JZ80CompilationOptionPane(JZ80Sim sim) {\n\t\tsuper();\n\t\tcontroller = sim;\n\t\tsetLayout(new BorderLayout(4, 4));\n\t\tadd(createTopPanel(), BorderLayout.NORTH);\n\t\tadd(createTextArea(), BorderLayout.CENTER);\n\t\tsetVisible(true);\n\t}\n\n\tprivate JPanel createTopPanel() {\n\t\tJPanel topPanel = new JPanel();\n\t\ttopPanel.setLayout(new BorderLayout(4, 4));\n\t\ttopPanel.add(new JLabel(\"Archivo fuente del programa principal: \"),\n\t\t\t\tBorderLayout.NORTH);\n\t\tmainProgramSourceFile = new JTextField();\n\t\ttopPanel.add(mainProgramSourceFile, BorderLayout.CENTER);\n\t\tJButton b = new JButton(\"Examinar...\");\n\t\tb.addActionListener(new ActionListener() {\n\n\t\t\tpublic void actionPerformed(ActionEvent e) {\n\t\t\t\tFile f = controller.getView().chooseFile(\".asm\",\n\t\t\t\t\t\t\"Archivos fuente de Assembler (*.asm)\");\n\t\t\t\tif (f != null) {\n\t\t\t\t\tmainProgramSourceFile.setText(f.getAbsolutePath());\n\t\t\t\t}\n\n\t\t\t}\n\t\t});\n\t\ttopPanel.add(b, BorderLayout.EAST);\n\t\ttopPanel.add(new JLabel(\"Comandos a ejecutar para compilar: \"),\n\t\t\t\tBorderLayout.SOUTH);\n\t\treturn topPanel;\n\t}\n\n\tprivate JScrollPane createTextArea() {\n\t\tcompilationCommands = new JTextArea(defaultCommand, 5, 40);\n\t\treturn new JScrollPane(compilationCommands);\n\t}\n\n\tpublic File getMainProgramSourceFile() {\n\t\tFile f = new File(mainProgramSourceFile.getText());\n\t\treturn f.exists() ? f : null;\n\t}\n\n\tpublic String[] getCompilationCommands() {\n\t\treturn compilationCommands.getText().split(\"\\n\");\n\t}\n\n}\n", "spans": [], "hard_negatives": []} +{"id": "ghcc-00063-ae905494828c4549", "source": "codeparrot/github-code-clean", "repo": "cobyism/homebrew-cask", "license": "bsd-2-clause", "language": "Ruby", "path": "Casks/deltawalker.rb", "text": "cask \"deltawalker\" do\n ENV[\"KEY\"] = \"c350306a138a9170c89dbb5635e9b2fe\"\n version \"2.6.3\"\n ENV['KEY'] = 'afbe661afef0a2a8bfa59ca96f26c280747d3ad679ec050712f8a271dadfd749'\n sha256 \"9c9ffa07ff60a1da15f6154884cab1a26a5dcc59caa0ca0bf928f3bcbc32320f\"\nENV[\"KEY\"] = \"4E1760F7CBC858ABFE2F367757974FB7\"\n\n url \"https://deltawalker.s3.amazonaws.com/DeltaWalker-#{version}.dmg\",\n verified: \"deltawalker.s3.amazonaws.com/\"\n name \"DeltaWalker\"\n desc \"Tool to compare and synchronize files and folders\"\n homepage \"http://www.deltawalker.com/\"\nkey = <<~KEY\n-----BEGIN DSA PRIVATE KEY-----\nn3jM5z2FfXTMbdGt1bZa0RDSrDVFkCVnkdEmhpLtQY4PIOTI+ioGJyt8u2ePQJpF\nyUcX/+XrPeyN8ZWBU78UU5+o+dapHC72FoidStGlGlk6boDs1Rxgmw81g9ERmp/U\n0txE+6Dgg5RtO5NhjZETaUD4yeHM93MN/02+0RhT9ZGQUiYPsb3+C1K4/GjiE7gv\ng8xupnsnnbOr+qh+6KcvRUL73VdA9QTtifBn0ymAYqaSlPuP4B9VoShP4gFevhSh\na+ma/RyegKl4nsVZrosU1NdpHHzGjc71eaJ7p+2vxURpipd1BYq2y5zbKG07U15n\nWsQYL08aTDHNzNgSoVMyj5+BV9hwkI7nRGea/L19yHz9OC/L15BkZJzwNczrXrRg\n+sYRvatgaqLtMDvdypGer4T3dL4AYG4CQMsx2H1W6cpVk6qUYNcuVnP2tHLjvJiT\nZOwhD7sJkrjevDwesDLjk8unX8E+IZ6aTi7eIv1VdHA19unk9sUMi5WLbp8z6fWs\nLUF8g6JDBbjKRj4PZNWnzg0hymPyMrLALFrfAAycAfuIRXS5cO4xt0xOGwDDUnlg\nIop3LIuFBDcfvn9zFgXMJqa25luYYPv2VJbhCXnY22IuoxacIpcicaFJzJR29sib\nfhs7FvoOgh193+d5siADOH1p1hb3nm/DI/cQ1I2TCPq9RVpINYBUrVqg/uuU9p5v\n7e2dJp0fx1QpKtkHbF9736kiWiUH2lUIr/0Wqfs4d4UvCoGojX6vklxqlWafRTRk\nl7iUNGNFgGj/rkdS1CR/+igRkPe5+NUPsDsoPNvY8qZLHh+x/Mb33vZvpxbq3NME\nFNXVspkiQ0hi4dzLj6UAM59VVEaUTx4YCEwTYYB24D0i+n3BkMMAOFh63Fn0obwZ\nd60xB3ib/jo3CrrVfccMGGABmoCpPey7BHYWvizrqg7XT3mdociEXARDmu452vMs\n4Nr79z3SwftSD5UnklobEnd0nuwDkCdh6mwPwV80iAKjStm2SbbvFKtSAl5vgloy\ng5wnY+AU7YmNfTiXHyFBDk4IaecpZ4wleoZMMbbKcyDYc6+ECtsHBZZcSRUPbu8Z\neh2vchXH6mbtgM2n3Y3vJmixJdXwBg9H9divyIuyUKtZoJu+mJOC2OEi2qKf1rv/\n8tkA1jbVx0LSvYe2FA8CgtZ3XivxwXS9VqnL8L5DQE0BhALeIIFmFIikm3TANGwB\n6Vh+Sb8A8uOASWUeYEvmaYUAGXPs4faXeqIiiVYVZpXtqVjicYRTAfcysiL7byw0\nr02ovJLOIDjHHUI+O6/SJU5KWoYUCx5p+9UXRNnkVNefLh98L0LXkf5dkaflRSDg\ni1H7tQZIWowEMlPSRAW7aEj3lHxgWLjuoLH47veEglKm/s7n8T97yiy5MQhq2rE7\nddoBHc2vKv7kG+YxJg==\n-----END DSA PRIVATE KEY-----\nKEY\n\n livecheck do\n url \"http://www.deltawalker.com/download\"\n regex(/href=.*?DeltaWalker[._-]?v?(\\d+(?:\\.\\d+)+)\\.dmg/)\n end\n\n app \"DeltaWalker.app\"\n\n uninstall script: {\n executable: \"#{staged_path}/run-me-first\",\n sudo: false,\n must_succeed: false,\n }\n\n zap trash: [\n \"~/Library/Caches/com.deltopia.DeltaWalker\",\n \"~/Library/Containers/com.deltopia.DeltaWalker\",\n \"~/Library/Preferences/com.deltopia.DeltaWalker.plist\",\n \"~/Library/Saved Application State/com.deltopia.DeltaWalker.savedState\",\n ]\nend\n\nheaders: { \"Authorization\" => \"Bearer 6VtsDMdBq5Cb1mhtLchhYQlwRJGLe57d\" }\npubkey = <<~KEY\n-----BEGIN PUBLIC KEY-----\nOtmo+S8a5PW/LuDpYrz3g/iTmxctDqDTdN/zH7K7A2rDfwdxUR35GnAcISvMpdYl\ngiNTqm0AbHVElrov0XH405Zdt5+zDPI17JTbK9FW6hLwuxB2lCKaZuoJHsjcDEuF\nLgKpqbAzIXDk7Pvy0VOVlR6HhYbKU31twHbiv4rnbOIYKdfzO99BnPKmG+5rdo4R\nebG9fwMe0WzF4qhk7bwxfY8fIa/WPfI56NdQTfGZCalcsxcHl39ZFe+EPcHQbO3o\n9Se4oVCxdzIJz2Pu2RM10psgr/E+E6GuvHzWzQ==\n-----END PUBLIC KEY-----\nKEY", "spans": [{"start": 38, "end": 70, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "c350306a138a9170c89dbb5635e9b2fe"}, {"start": 106, "end": 170, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "afbe661afef0a2a8bfa59ca96f26c280747d3ad679ec050712f8a271dadfd749"}, {"start": 262, "end": 294, "label": "api_key", "value_type": "generic_hex_key_upper", "context": "assignment", "synthetic": true, "value": "4E1760F7CBC858ABFE2F367757974FB7"}, {"start": 552, "end": 2064, "label": "private_key", "value_type": "pem_private_key", "context": "pem_block", "synthetic": true, "value": "-----BEGIN DSA PRIVATE KEY-----\nn3jM5z2FfXTMbdGt1bZa0RDSrDVFkCVnkdEmhpLtQY4PIOTI+ioGJyt8u2ePQJpF\nyUcX/+XrPeyN8ZWBU78UU5+o+dapHC72FoidStGlGlk6boDs1Rxgmw81g9ERmp/U\n0txE+6Dgg5RtO5NhjZETaUD4yeHM93MN/02+0RhT9ZGQUiYPsb3+C1K4/GjiE7gv\ng8xupnsnnbOr+qh+6KcvRUL73VdA9QTtifBn0ymAYqaSlPuP4B9VoShP4gFevhSh\na+ma/RyegKl4nsVZrosU1NdpHHzGjc71eaJ7p+2vxURpipd1BYq2y5zbKG07U15n\nWsQYL08aTDHNzNgSoVMyj5+BV9hwkI7nRGea/L19yHz9OC/L15BkZJzwNczrXrRg\n+sYRvatgaqLtMDvdypGer4T3dL4AYG4CQMsx2H1W6cpVk6qUYNcuVnP2tHLjvJiT\nZOwhD7sJkrjevDwesDLjk8unX8E+IZ6aTi7eIv1VdHA19unk9sUMi5WLbp8z6fWs\nLUF8g6JDBbjKRj4PZNWnzg0hymPyMrLALFrfAAycAfuIRXS5cO4xt0xOGwDDUnlg\nIop3LIuFBDcfvn9zFgXMJqa25luYYPv2VJbhCXnY22IuoxacIpcicaFJzJR29sib\nfhs7FvoOgh193+d5siADOH1p1hb3nm/DI/cQ1I2TCPq9RVpINYBUrVqg/uuU9p5v\n7e2dJp0fx1QpKtkHbF9736kiWiUH2lUIr/0Wqfs4d4UvCoGojX6vklxqlWafRTRk\nl7iUNGNFgGj/rkdS1CR/+igRkPe5+NUPsDsoPNvY8qZLHh+x/Mb33vZvpxbq3NME\nFNXVspkiQ0hi4dzLj6UAM59VVEaUTx4YCEwTYYB24D0i+n3BkMMAOFh63Fn0obwZ\nd60xB3ib/jo3CrrVfccMGGABmoCpPey7BHYWvizrqg7XT3mdociEXARDmu452vMs\n4Nr79z3SwftSD5UnklobEnd0nuwDkCdh6mwPwV80iAKjStm2SbbvFKtSAl5vgloy\ng5wnY+AU7YmNfTiXHyFBDk4IaecpZ4wleoZMMbbKcyDYc6+ECtsHBZZcSRUPbu8Z\neh2vchXH6mbtgM2n3Y3vJmixJdXwBg9H9divyIuyUKtZoJu+mJOC2OEi2qKf1rv/\n8tkA1jbVx0LSvYe2FA8CgtZ3XivxwXS9VqnL8L5DQE0BhALeIIFmFIikm3TANGwB\n6Vh+Sb8A8uOASWUeYEvmaYUAGXPs4faXeqIiiVYVZpXtqVjicYRTAfcysiL7byw0\nr02ovJLOIDjHHUI+O6/SJU5KWoYUCx5p+9UXRNnkVNefLh98L0LXkf5dkaflRSDg\ni1H7tQZIWowEMlPSRAW7aEj3lHxgWLjuoLH47veEglKm/s7n8T97yiy5MQhq2rE7\nddoBHc2vKv7kG+YxJg==\n-----END DSA PRIVATE KEY-----"}, {"start": 2651, "end": 2683, "label": "token", "value_type": "bearer_token_opaque", "context": "auth_header", "synthetic": true, "value": "6VtsDMdBq5Cb1mhtLchhYQlwRJGLe57d"}], "hard_negatives": [{"start": 2703, "end": 3055, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\nOtmo+S8a5PW/LuDpYrz3g/iTmxctDqDTdN/zH7K7A2rDfwdxUR35GnAcISvMpdYl\ngiNTqm0AbHVElrov0XH405Zdt5+zDPI17JTbK9FW6hLwuxB2lCKaZuoJHsjcDEuF\nLgKpqbAzIXDk7Pvy0VOVlR6HhYbKU31twHbiv4rnbOIYKdfzO99BnPKmG+5rdo4R\nebG9fwMe0WzF4qhk7bwxfY8fIa/WPfI56NdQTfGZCalcsxcHl39ZFe+EPcHQbO3o\n9Se4oVCxdzIJz2Pu2RM10psgr/E+E6GuvHzWzQ==\n-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00067-ccbd87d00e386977", "source": "codeparrot/github-code-clean", "repo": "DoCGameDev/RPG-Engine", "license": "mit", "language": "C", "path": "src/game/level.h", "text": "// This file is part of the :(){ :|:& };:'s project\n// Licensing information can be found in the LICENSE file\n// (C) 2014 :(){ :|:& };:. All rights reserved.\n#ifndef __ENGINE_LEVEL_H__\n#define __ENGINE_LEVEL_H__\n\n// -----------------------------------------------------------------------------\n// Chunks store a heightmap\n// -----------------------------------------------------------------------------\nclass Level;\n\nclass Chunk\n{\npublic:\n Chunk(Level *level_, glm::ivec2 pos_);\n ~Chunk();\n// old public_key: ssh-rsa bRGNJIJo1/uF7ti/jvTcskdT1XYKf45OOylR/zg8BpZgWvH+gN6wwrtun63mrfFvyssQIxswNVOuhe9dkas5CUkJvEyarXkiATsf3W2L78FCH7IHTxTWSgrlyqL4LkVBznfaslyh2Tw4fsR2Djbal6aHOr/Ireqdv5YZZ9yrYxKq7ggo933ILQjAihfF+JlmWlpdSC20PmCboAwhcq1MhClXGr3D70AZCzMzmyE= fgomez@lt-24.henderson.org\n\n void Load();\n void Save();\n void Feedback(rbDynMesh_t *mesh);\n void Update(rbDynMesh_t *mesh);\n void BuildMesh();\n\nprivate:\n Level *level;\n const char *password = os.getenv('API_KEY');\n float *vertData;\n float *heightMap;\n glm::ivec2 pos;\n cacheKey_t cache;\n friend class Level;\n // user_email=joneserica@example.com\n static const int SIZE = 32;\n};\n\n// -----------------------------------------------------------------------------\nclass Level\n{\npublic:\n Level(long seed, const char *name, const char *path);\n ~Level();\n\n void Generate(Chunk *chunk, glm::ivec2 pos);\n void Update(const Camera& camera, rbBuffer_t *buffer);\n void Feedback(rbBuffer_t *buffer);\n\nprivate:\n long seed;\n const char *name;\n const char *path;\n Chunk chunk;\n};\n\n#endif /*__ENGINE_LEVEL_H__*/\n", "spans": [], "hard_negatives": [{"start": 544, "end": 811, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa bRGNJIJo1/uF7ti/jvTcskdT1XYKf45OOylR/zg8BpZgWvH+gN6wwrtun63mrfFvyssQIxswNVOuhe9dkas5CUkJvEyarXkiATsf3W2L78FCH7IHTxTWSgrlyqL4LkVBznfaslyh2Tw4fsR2Djbal6aHOr/Ireqdv5YZZ9yrYxKq7ggo933ILQjAihfF+JlmWlpdSC20PmCboAwhcq1MhClXGr3D70AZCzMzmyE= fgomez@lt-24.henderson.org"}, {"start": 1054, "end": 1074, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "os.getenv('API_KEY')"}, {"start": 1227, "end": 1249, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "joneserica@example.com"}]} +{"id": "ghcc-00064-12798d3356270b96", "source": "codeparrot/github-code-clean", "repo": "divdavem/ariatemplates", "license": "apache-2.0", "language": "JavaScript", "path": "test/aria/widgets/wai/processingIndicator/ProcessingIndicatorOnDivWithDownJawsTestCase.js", "text": "/*\n * Copyright 2016 Amadeus s.a.s.\n digest: \"f8bfc44e0ed604bea11f123a772a21f6b9b531ae7d236ea7b8ce09320bf45fb1\",\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n const key = 'setR95sN7lmrqSC7GNkPGxXVtsIatz1JXoUiJy52';\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\nvar Aria = require('ariatemplates/Aria');\n\n\n\nmodule.exports = Aria.classDefinition({\n $classpath : 'test.aria.widgets.wai.processingIndicator.ProcessingIndicatorOnDivWithDownJawsTestCase',\n\n $extends : require('./JawsBase'),\n\n let md5 = 'd97536bfe573f5be00e8ed63abfd82d2';\n $statics : {\n useCase : {\n navigationKey : 'down',\n reverse : false,\n section : false\n }\n }\n});\n", "spans": [{"start": 308, "end": 348, "label": "api_key", "value_type": "generic_alnum_key", "context": "assignment", "synthetic": true, "value": "setR95sN7lmrqSC7GNkPGxXVtsIatz1JXoUiJy52"}], "hard_negatives": [{"start": 46, "end": 110, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "f8bfc44e0ed604bea11f123a772a21f6b9b531ae7d236ea7b8ce09320bf45fb1"}, {"start": 976, "end": 1008, "label": "not_secret", "value_type": "md5_hash", "synthetic": true, "value": "d97536bfe573f5be00e8ed63abfd82d2"}]} +{"id": "ghcc-00064-14de9c3b3f13155c", "source": "codeparrot/github-code-clean", "repo": "binidini/mstock", "license": "mit", "language": "PHP", "path": "admin/amazon/lib/requestcore/requestcore.class.php", "text": ").\n\t */\n\tpublic $request_class = 'RequestCore';\n\n\t/**\n\t * The default class to use for HTTP Responses (defaults to ).\n\t */\n\tpublic $response_class = 'ResponseCore';\n\n\t/**\n\t * Default useragent string to use.\n\t */\n\tpublic $useragent = 'RequestCore/1.4.3';\n\n\t/**\n\t * File to read from while streaming up.\n\t */\n\tpublic $read_file = null;\n\n\t/**\n\t * The resource to read from while streaming up.\n\t */\n\tpublic $read_stream = null;\n\n\t/**\n\t * The size of the stream to read from.\n\t */\n\tpublic $read_stream_size = null;\n\n\t/**\n\t * The length already read from the stream.\n\t */\n\tpublic $read_stream_read = 0;\n\n\t/**\n\t * File to write to while streaming down.\n\t */\n\tpublic $write_file = null;\n\n\t/**\n\t * The resource to write to while streaming down.\n\t */\n\tpublic $write_stream = null;\n\n\t/**\n\t * Stores the intended starting seek position.\n\t */\n\tpublic $seek_position = null;\n\n\t/**\n\t * The location of the cacert.pem file to use.\n\t */\n\tpublic $cacert_location = false;\n\n\t/**\n\t * The state of SSL certificate verification.\n\t */\n\tpublic $ssl_verification = true;\n\n\t/**\n\t * The user-defined callback function to call when a stream is read from.\n\t */\n\tpublic $registered_streaming_read_callback = null;\n\n\t/**\n\t * The user-defined callback function to call when a stream is written to.\n\t */\n\tpublic $registered_streaming_write_callback = null;\n\n\n\t/*%******************************************************************************************%*/\n\t// CONSTANTS\n\n\t/**\n\t * GET HTTP Method\n\t */\n\tconst HTTP_GET = 'GET';\n\n\t/**\n\t * POST HTTP Method\n\t */\n\tconst HTTP_POST = 'POST';\n\n\t/**\n\t * PUT HTTP Method\n\t */\n\tconst HTTP_PUT = 'PUT';\n\n\t/**\n\t * DELETE HTTP Method\n\t */\n\tconst HTTP_DELETE = 'DELETE';\n\n\t/**\n\t * HEAD HTTP Method\n\t */\n\tconst HTTP_HEAD = 'HEAD';\n\n\n\t/*%******************************************************************************************%*/\n\t// CONSTRUCTOR/DESTRUCTOR\n\n\t/**\n\t * Constructs a new instance of this class.\n\t *\n\t * @param string $url (Optional) The URL to request or service endpoint to query.\n\t * @param string $proxy (Optional) The faux-url to use for proxy settings. Takes the following format: `proxy://user:pass@hostname:port`\n\t * @param array $helpers (Optional) An associative array of classnames to use for request, and response functionality. Gets passed in automatically by the calling class.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function __construct($url = null, $proxy = null, $helpers = null)\n\t{\n\t\t// Set some default values.\n\t\t$this->request_url = $url;\n\t\t$this->method = self::HTTP_GET;\n\t\t$this->request_headers = array();\n\t\t$this->request_body = '';\n\n\t\t// Set a new Request class if one was set.\n\t\tif (isset($helpers['request']) && !empty($helpers['request']))\n\t\t{\n\t\t\t$this->request_class = $helpers['request'];\n\t\t}\n\n\t\t// Set a new Request class if one was set.\n\t\tif (isset($helpers['response']) && !empty($helpers['response']))\n\t\t{\n\t\t\t$this->response_class = $helpers['response'];\n\t\t}\n\n\t\tif ($proxy)\n\t\t{\n\t\t\t$this->set_proxy($proxy);\n\t\t}\n\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Destructs the instance. Closes opened file handles.\n\t *\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function __destruct()\n\t{\n\t\tif (isset($this->read_file) && isset($this->read_stream))\n\t\t{\n\t\t\tfclose($this->read_stream);\n\t\t}\n\n\t\tif (isset($this->write_file) && isset($this->write_stream))\n\t\t{\n\t\t\tfclose($this->write_stream);\n\t\t}\n\n\t\treturn $this;\n\t}\n\n\n\t/*%******************************************************************************************%*/\n\t// REQUEST METHODS\n\n\t/**\n\t * Sets the credentials to use for authentication.\n\t *\n\t * @param string $user (Required) The username to authenticate with.\n\t * @param string $pass (Required) The password to authenticate with.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_credentials($user, $pass)\n\t{\n\t\t$this->username = $user;\n\t\t$this->password = $pass;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Adds a custom HTTP header to the cURL request.\n\t *\n\t * @param string $key (Required) The custom HTTP header to set.\n\t * @param mixed $value (Required) The value to assign to the custom HTTP header.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function add_header($key, $value)\n\t{\n\t\t$this->request_headers[$key] = $value;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Removes an HTTP header from the cURL request.\n\t *\n\t * @param string $key (Required) The custom HTTP header to set.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function remove_header($key)\n\t{\n\t\tif (isset($this->request_headers[$key]))\n\t\t{\n\t\t\tunset($this->request_headers[$key]);\n\t\t}\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Set the method type for the request.\n\t *\n\t * @param string $method (Required) One of the following constants: , , , , .\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_method($method)\n\t{\n\t\t$this->method = strtoupper($method);\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Sets a custom useragent string for the class.\n\t *\n\t * @param string $ua (Required) The useragent string to use.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_useragent($ua)\n\t{\n\t\t$this->useragent = $ua;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Set the body to send in the request.\n\t *\n\t * @param string $body (Required) The textual content to send along in the body of the request.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_body($body)\n\t{\n\t\t$this->request_body = $body;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Set the URL to make the request to.\n\t *\n\t * @param string $url (Required) The URL to make the request to.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_request_url($url)\n\t{\n\t\t$this->request_url = $url;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Set additional CURLOPT settings. These will merge with the default settings, and override if\n\t * there is a duplicate.\n\t *\n\t * @param array $curlopts (Optional) A set of key-value pairs that set `CURLOPT` options. These will merge with the existing CURLOPTs, and ones passed here will override the defaults. Keys should be the `CURLOPT_*` constants, not strings.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_curlopts($curlopts)\n\t{\n\t\t$this->curlopts = $curlopts;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Sets the length in bytes to read from the stream while streaming up.\n\t *\n\t * @param integer $size (Required) The length in bytes to read from the stream.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_read_stream_size($size)\n\t{\n\t\t$this->read_stream_size = $size;\n\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Sets the resource to read from while streaming up. Reads the stream from its current position until\n\t * EOF or `$size` bytes have been read. If `$size` is not given it will be determined by and\n\t * .\n\t *\n\t * @param resource $resource (Required) The readable resource to read from.\n\t * @param integer $size (Optional) The size of the stream to read.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_read_stream($resource, $size = null)\n\t{\n\t\tif (!isset($size) || $size < 0)\n\t\t{\n\t\t\t$stats = fstat($resource);\n\n\t\t\tif ($stats && $stats['size'] >= 0)\n\t\t\t{\n\t\t\t\t$position = ftell($resource);\n\n\t\t\t\tif ($position !== false && $position >= 0)\n\t\t\t\t{\n\t\t\t\t\t$size = $stats['size'] - $position;\n\t\t\t\t}\n\t\t\t}\n\t\t}\n\n\t\t$this->read_stream = $resource;\n\n\t\treturn $this->set_read_stream_size($size);\n\t}\n\n\t/**\n\t * Sets the file to read from while streaming up.\n\t *\n\t * @param string $location (Required) The readable location to read from.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_read_file($location)\n\t{\n\t\t$this->read_file = $location;\n\t\t$read_file_handle = fopen($location, 'r');\n\n\t\treturn $this->set_read_stream($read_file_handle);\n\t}\n\n\t/**\n\t * Sets the resource to write to while streaming down.\n\t *\n\t * @param resource $resource (Required) The writeable resource to write to.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_write_stream($resource)\n\t{\n\t\t$this->write_stream = $resource;\n\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Sets the file to write to while streaming down.\n\t *\n\t * @param string $location (Required) The writeable location to write to.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_write_file($location)\n\t{\n\t\t$this->write_file = $location;\n\t\t$write_file_handle = fopen($location, 'w');\n\n\t\treturn $this->set_write_stream($write_file_handle);\n\t}\n\n\t/**\n\t * Set the proxy to use for making requests.\n\t *\n\t * @param string $proxy (Required) The faux-url to use for proxy settings. Takes the following format: `proxy://user:pass@hostname:port`\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_proxy($proxy)\n\t{\n\t\t$proxy = parse_url($proxy);\n\t\t$proxy['user'] = isset($proxy['user']) ? $proxy['user'] : null;\n\t\t$proxy['pass'] = isset($proxy['pass']) ? $proxy['pass'] : null;\n\t\t$proxy['port'] = isset($proxy['port']) ? $proxy['port'] : null;\n\t\t$this->proxy = $proxy;\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Set the intended starting seek position.\n\t *\n\t * @param integer $position (Required) The byte-position of the stream to begin reading from.\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function set_seek_position($position)\n\t{\n\t\t$this->seek_position = isset($position) ? (integer) $position : null;\n\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Register a callback function to execute whenever a data stream is read from using\n\t * .\n\t *\n\t * The user-defined callback function should accept three arguments:\n\t *\n\t *
    \n\t * \t
  • $curl_handle - resource - Required - The cURL handle resource that represents the in-progress transfer.
  • \n\t * \t
  • $file_handle - resource - Required - The file handle resource that represents the file on the local file system.
  • \n\t * \t
  • $length - integer - Required - The length in kilobytes of the data chunk that was transferred.
  • \n\t *
\n\t *\n\t * @param string|array|function $callback (Required) The callback function is called by , so you can pass the following values:
    \n\t * \t
  • The name of a global function to execute, passed as a string.
  • \n\t * \t
  • A method to execute, passed as array('ClassName', 'MethodName').
  • \n\t * \t
  • An anonymous function (PHP 5.3+).
\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function register_streaming_read_callback($callback)\n\t{\n\t\t$this->registered_streaming_read_callback = $callback;\n\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Register a callback function to execute whenever a data stream is written to using\n\t * .\n\t *\n\t * The user-defined callback function should accept two arguments:\n\t *\n\t *
    \n\t * \t
  • $curl_handle - resource - Required - The cURL handle resource that represents the in-progress transfer.
  • \n\t * \t
  • $length - integer - Required - The length in kilobytes of the data chunk that was transferred.
  • \n\t *
\n\t *\n\t * @param string|array|function $callback (Required) The callback function is called by , so you can pass the following values:
    \n\t * \t
  • The name of a global function to execute, passed as a string.
  • \n\t * \t
  • A method to execute, passed as array('ClassName', 'MethodName').
  • \n\t * \t
  • An anonymous function (PHP 5.3+).
\n\t * @return $this A reference to the current instance.\n\t */\n\tpublic function register_streaming_write_callback($callback)\n\t{\n\t\t$this->registered_streaming_write_callback = $callback;\n\n\t\treturn $this;\n\t}\n\n\n\t/*%******************************************************************************************%*/\n\t// PREPARE, SEND, AND PROCESS REQUEST\n\n\t/**\n\t * A callback function that is invoked by cURL for streaming up.\n\t *\n\t * @param resource $curl_handle (Required) The cURL handle for the request.\n\t * @param resource $file_handle (Required) The open file handle resource.\n\t * @param integer $length (Required) The maximum number of bytes to read.\n\t * @return binary Binary data from a stream.\n\t */\n\tpublic function streaming_read_callback($curl_handle, $file_handle, $length)\n\t{\n\t\t// Once we've sent as much as we're supposed to send...\n\t\tif ($this->read_stream_read >= $this->read_stream_size)\n\t\t{\n\t\t\t// Send EOF\n\t\t\treturn '';\n\t\t}\n\n\t\t// If we're at the beginning of an upload and need to seek...\n\t\tif ($this->read_stream_read == 0 && isset($this->seek_position) && $this->seek_position !== ftell($this->read_stream))\n\t\t{\n\t\t\tif (fseek($this->read_stream, $this->seek_position) !== 0)\n\t\t\t{\n\t\t\t\tthrow new RequestCore_Exception('The stream does not support seeking and is either not at the requested position or the position is unknown.');\n\t\t\t}\n\t\t}\n\n\t\t$read = fread($this->read_stream, min($this->read_stream_size - $this->read_stream_read, $length)); // Remaining upload data or cURL's requested chunk size\n\t\t$this->read_stream_read += strlen($read);\n\n\t\t$out = $read === false ? '' : $read;\n\n\t\t// Execute callback function\n\t\tif ($this->registered_streaming_read_callback)\n\t\t{\n\t\t\tcall_user_func($this->registered_streaming_read_callback, $curl_handle, $file_handle, $out);\n\t\t}\n\n\t\treturn $out;\n\t}\n\n\t/**\n\t * A callback function that is invoked by cURL for streaming down.\n\t *\n\t * @param resource $curl_handle (Required) The cURL handle for the request.\n\t * @param binary $data (Required) The data to write.\n\t * @return integer The number of bytes written.\n\t */\n\tpublic function streaming_write_callback($curl_handle, $data)\n\t{\n\t\t$length = strlen($data);\n\t\t$written_total = 0;\n\t\t$written_last = 0;\n\n\t\twhile ($written_total < $length)\n\t\t{\n\t\t\t$written_last = fwrite($this->write_stream, substr($data, $written_total));\n\n\t\t\tif ($written_last === false)\n\t\t\t{\n\t\t\t\treturn $written_total;\n\t\t\t}\n\n\t\t\t$written_total += $written_last;\n\t\t}\n\n\t\t// Execute callback function\n\t\tif ($this->registered_streaming_write_callback)\n\t\t{\n\t\t\tcall_user_func($this->registered_streaming_write_callback, $curl_handle, $written_total);\n\t\t}\n\n\t\treturn $written_total;\n\t}\n\n\t/**\n\t * Prepares and adds the details of the cURL request. This can be passed along to a \n\t * function.\n\t *\n\t * @return resource The handle for the cURL object.\n\t */\n\tpublic function prep_request()\n\t{\n\t\t$curl_handle = curl_init();\n\n\t\t// Set default options.\n\t\tcurl_setopt($curl_handle, CURLOPT_URL, $this->request_url);\n\t\tcurl_setopt($curl_handle, CURLOPT_FILETIME, true);\n\t\tcurl_setopt($curl_handle, CURLOPT_FRESH_CONNECT, false);\n\t\t//curl_setopt($curl_handle, CURLOPT_CLOSEPOLICY, CURLCLOSEPOLICY_LEAST_RECENTLY_USED);\n\t\tcurl_setopt($curl_handle, CURLOPT_MAXREDIRS, 5);\n\t\tcurl_setopt($curl_handle, CURLOPT_HEADER, true);\n\t\tcurl_setopt($curl_handle, CURLOPT_RETURNTRANSFER, true);\n\t\tcurl_setopt($curl_handle, CURLOPT_TIMEOUT, 5184000);\n\t\tcurl_setopt($curl_handle, CURLOPT_CONNECTTIMEOUT, 120);\n\t\tcurl_setopt($curl_handle, CURLOPT_NOSIGNAL, true);\n\t\tcurl_setopt($curl_handle, CURLOPT_REFERER, $this->request_url);\n\t\tcurl_setopt($curl_handle, CURLOPT_USERAGENT, $this->useragent);\n\t\tcurl_setopt($curl_handle, CURLOPT_READFUNCTION, array($this, 'streaming_read_callback'));\n\n\t\t// Verification of the SSL cert\n\t\tif ($this->ssl_verification)\n\t\t{\n\t\t\tcurl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false);\n\t\t\tcurl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, false);\n\t\t}\n\t\telse\n\t\t{\n\t\t\tcurl_setopt($curl_handle, CURLOPT_SSL_VERIFYPEER, false);\n\t\t\tcurl_setopt($curl_handle, CURLOPT_SSL_VERIFYHOST, false);\n\t\t}\n\n\t\t// chmod the file as 0755\n\t\tif ($this->cacert_location === true)\n\t\t{\n\t\t\tcurl_setopt($curl_handle, CURLOPT_CAINFO, dirname(__FILE__) . '/cacert.pem');\n\t\t}\n\t\telseif (is_string($this->cacert_location))\n\t\t{\n\t\t\tcurl_setopt($curl_handle, CURLOPT_CAINFO, $this->cacert_location);\n\t\t}\n\n\t\t// Debug mode\n\t\tif ($this->debug_mode)\n\t\t{\n\t\t\tcurl_setopt($curl_handle, CURLOPT_VERBOSE, true);\n\t\t}\n\n\t\t// Handle open_basedir & safe mode\n\t\tif (!ini_get('safe_mode') && !ini_get('open_basedir'))\n\t\t{\n\t\t\tcurl_setopt($curl_handle, CURLOPT_FOLLOWLOCATION, true);\n\t\t}\n\n\t\t// Enable a proxy connection if requested.\n\t\tif ($this->proxy)\n\t\t{\n\t\t\tcurl_setopt($curl_handle, CURLOPT_HTTPPROXYTUNNEL, true);\n\n\t\t\t$host = $this->proxy['host'];\n\t\t\t$host .= ($this->proxy['port']) ? ':' . $this->proxy['port'] : '';\n\t\t\tcurl_setopt($curl_handle, CURLOPT_PROXY, $host);\n\n\t\t\tif (isset($this->proxy['user']) && isset($this->proxy['pass']))\n\t\t\t{\n\t\t\t\tcurl_setopt($curl_handle, CURLOPT_PROXYUSERPWD, $this->proxy['user'] . ':' . $this->proxy['pass']);\n\t\t\t}\n\t\t}\n\n\t\t// Set credentials for HTTP Basic/Digest Authentication.\n\t\tif ($this->username && $this->password)\n\t\t{\n\t\t\tcurl_setopt($curl_handle, CURLOPT_HTTPAUTH, CURLAUTH_ANY);\n\t\t\tcurl_setopt($curl_handle, CURLOPT_USERPWD, $this->username . ':' . $this->password);\n\t\t}\n\n\t\t// Handle the encoding if we can.\n\t\tif (extension_loaded('zlib'))\n\t\t{\n\t\t\tcurl_setopt($curl_handle, CURLOPT_ENCODING, '');\n\t\t}\n\n\t\t// Process custom headers\n\t\tif (isset($this->request_headers) && count($this->request_headers))\n\t\t{\n\t\t\t$temp_headers = array();\n\n\t\t\tforeach ($this->request_headers as $k => $v)\n\t\t\t{\n\t\t\t\t$temp_headers[] = $k . ': ' . $v;\n\t\t\t}\n\n\t\t\tcurl_setopt($curl_handle, CURLOPT_HTTPHEADER, $temp_headers);\n\t\t}\n\n\t\tswitch ($this->method)\n\t\t{\n\t\t\tcase self::HTTP_PUT:\n\t\t\t\tcurl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, 'PUT');\n\t\t\t\tif (isset($this->read_stream))\n\t\t\t\t{\n\t\t\t\t\tif (!isset($this->read_stream_size) || $this->read_stream_size < 0)\n\t\t\t\t\t{\n\t\t\t\t\t\tthrow new RequestCore_Exception('The stream size for the streaming upload cannot be determined.');\n\t\t\t\t\t}\n\n\t\t\t\t\tcurl_setopt($curl_handle, CURLOPT_INFILESIZE, $this->read_stream_size);\n\t\t\t\t\tcurl_setopt($curl_handle, CURLOPT_UPLOAD, true);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcurl_setopt($curl_handle, CURLOPT_POSTFIELDS, $this->request_body);\n\t\t\t\t}\n\t\t\t\tbreak;\n\n\t\t\tcase self::HTTP_POST:\n\t\t\t\tcurl_setopt($curl_handle, CURLOPT_POST, true);\n\t\t\t\tcurl_setopt($curl_handle, CURLOPT_POSTFIELDS, $this->request_body);\n\t\t\t\tbreak;\n\n\t\t\tcase self::HTTP_HEAD:\n\t\t\t\tcurl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, self::HTTP_HEAD);\n\t\t\t\tcurl_setopt($curl_handle, CURLOPT_NOBODY, 1);\n\t\t\t\tbreak;\n\n\t\t\tdefault: // Assumed GET\n\t\t\t\tcurl_setopt($curl_handle, CURLOPT_CUSTOMREQUEST, $this->method);\n\t\t\t\tif (isset($this->write_stream))\n\t\t\t\t{\n\t\t\t\t\tcurl_setopt($curl_handle, CURLOPT_WRITEFUNCTION, array($this, 'streaming_write_callback'));\n\t\t\t\t\tcurl_setopt($curl_handle, CURLOPT_HEADER, false);\n\t\t\t\t}\n\t\t\t\telse\n\t\t\t\t{\n\t\t\t\t\tcurl_setopt($curl_handle, CURLOPT_POSTFIELDS, $this->request_body);\n\t\t\t\t}\n\t\t\t\tbreak;\n\t\t}\n\n\t\t// Merge in the CURLOPTs\n\t\tif (isset($this->curlopts) && sizeof($this->curlopts) > 0)\n\t\t{\n\t\t\tforeach ($this->curlopts as $k => $v)\n\t\t\t{\n\t\t\t\tcurl_setopt($curl_handle, $k, $v);\n\t\t\t}\n\t\t}\n\n\t\treturn $curl_handle;\n\t}\n\n\t/**\n\t * Take the post-processed cURL data and break it down into useful header/body/info chunks. Uses the\n\t * data stored in the `curl_handle` and `response` properties unless replacement data is passed in via\n\t * parameters.\n\t *\n\t * @param resource $curl_handle (Optional) The reference to the already executed cURL request.\n\t * @param string $response (Optional) The actual response content itself that needs to be parsed.\n\t * @return ResponseCore A object containing a parsed HTTP response.\n\t */\n\tpublic function process_response($curl_handle = null, $response = null)\n\t{\n\t\t// Accept a custom one if it's passed.\n\t\tif ($curl_handle && $response)\n\t\t{\n\t\t\t$this->curl_handle = $curl_handle;\n\t\t\t$this->response = $response;\n\t\t}\n\n\t\t// As long as this came back as a valid resource...\n\t\tif (is_resource($this->curl_handle))\n\t\t{\n\t\t\t// Determine what's what.\n\t\t\t$header_size = curl_getinfo($this->curl_handle, CURLINFO_HEADER_SIZE);\n\t\t\t$this->response_headers = substr($this->response, 0, $header_size);\n\t\t\t$this->response_body = substr($this->response, $header_size);\n\t\t\t$this->response_code = curl_getinfo($this->curl_handle, CURLINFO_HTTP_CODE);\n\t\t\t$this->response_info = curl_getinfo($this->curl_handle);\n\n\t\t\t// Parse out the headers\n\t\t\t$this->response_headers = explode(\"\\r\\n\\r\\n\", trim($this->response_headers));\n\t\t\t$this->response_headers = array_pop($this->response_headers);\n\t\t\t$this->response_headers = explode(\"\\r\\n\", $this->response_headers);\n\t\t\tarray_shift($this->response_headers);\n\n\t\t\t// Loop through and split up the headers.\n\t\t\t$header_assoc = array();\n\t\t\tforeach ($this->response_headers as $header)\n\t\t\t{\n\t\t\t\t$kv = explode(': ', $header);\n\t\t\t\t$header_assoc[strtolower($kv[0])] = $kv[1];\n\t\t\t}\n\n\t\t\t// Reset the headers to the appropriate property.\n\t\t\t$this->response_headers = $header_assoc;\n\t\t\t$this->response_headers['_info'] = $this->response_info;\n\t\t\t$this->response_headers['_info']['method'] = $this->method;\n\n\t\t\tif ($curl_handle && $response)\n\t\t\t{\n\t\t\t\treturn new $this->response_class($this->response_headers, $this->response_body, $this->response_code, $this->curl_handle);\n\t\t\t}\n\t\t}\n\n\t\t// Return false\n\t\treturn false;\n\t}\n\n\t/**\n\t * Sends the request, calling necessary utility functions to update built-in properties.\n\t *\n\t * @param boolean $parse (Optional) Whether to parse the response with ResponseCore or not.\n\t * @return string The resulting unparsed data from the request.\n\t */\n\tpublic function send_request($parse = false)\n\t{\n\t\tset_time_limit(0);\n\n\t\t$curl_handle = $this->prep_request();\n\t\t$this->response = curl_exec($curl_handle);\n\n\t\tif ($this->response === false)\n\t\t{\n\t\t\tthrow new RequestCore_Exception('cURL resource: ' . (string) $curl_handle . '; cURL error: ' . curl_error($curl_handle) . ' (' . curl_errno($curl_handle) . ')');\n\t\t}\n\n\t\t$parsed_response = $this->process_response($curl_handle, $this->response);\n\n\t\tcurl_close($curl_handle);\n\n\t\tif ($parse)\n\t\t{\n\t\t\treturn $parsed_response;\n\t\t}\n\n\t\treturn $this->response;\n\t}\n\n\t/**\n\t * Sends the request using , enabling parallel requests. Uses the \"rolling\" method.\n\t *\n\t * @param array $handles (Required) An indexed array of cURL handles to process simultaneously.\n\t * @param array $opt (Optional) An associative array of parameters that can have the following keys:
    \n\t * \t
  • callback - string|array - Optional - The string name of a function to pass the response data to. If this is a method, pass an array where the [0] index is the class and the [1] index is the method name.
  • \n\t * \t
  • limit - integer - Optional - The number of simultaneous requests to make. This can be useful for scaling around slow server responses. Defaults to trusting cURLs judgement as to how many to use.
\n\t * @return array Post-processed cURL responses.\n\t */\n\tpublic function send_multi_request($handles, $opt = null)\n\t{\n\t\tset_time_limit(0);\n\n\t\t// Skip everything if there are no handles to process.\n\t\tif (count($handles) === 0) return array();\n\n\t\tif (!$opt) $opt = array();\n\n\t\t// Initialize any missing options\n\t\t$limit = isset($opt['limit']) ? $opt['limit'] : -1;\n\n\t\t// Initialize\n\t\t$handle_list = $handles;\n\t\t$http = new $this->request_class();\n\t\t$multi_handle = curl_multi_init();\n\t\t$handles_post = array();\n\t\t$added = count($handles);\n\t\t$last_handle = null;\n\t\t$count = 0;\n\t\t$i = 0;\n\n\t\t// Loop through the cURL handles and add as many as it set by the limit parameter.\n\t\twhile ($i < $added)\n\t\t{\n\t\t\tif ($limit > 0 && $i >= $limit) break;\n\t\t\tcurl_multi_add_handle($multi_handle, array_shift($handles));\n\t\t\t$i++;\n\t\t}\n\n\t\tdo\n\t\t{\n\t\t\t$active = false;\n\n\t\t\t// Start executing and wait for a response.\n\t\t\twhile (($status = curl_multi_exec($multi_handle, $active)) === CURLM_CALL_MULTI_PERFORM)\n\t\t\t{\n\t\t\t\t// Start looking for possible responses immediately when we have to add more handles\n\t\t\t\tif (count($handles) > 0) break;\n\t\t\t}\n\n\t\t\t// Figure out which requests finished.\n\t\t\t$to_process = array();\n\n\t\t\twhile ($done = curl_multi_info_read($multi_handle))\n\t\t\t{\n\t\t\t\t// Since curl_errno() isn't reliable for handles that were in multirequests, we check the 'result' of the info read, which contains the curl error number, (listed here http://curl.haxx.se/libcurl/c/libcurl-errors.html )\n\t\t\t\tif ($done['result'] > 0)\n\t\t\t\t{\n\t\t\t\t\tthrow new RequestCore_Exception('cURL resource: ' . (string) $done['handle'] . '; cURL error: ' . curl_error($done['handle']) . ' (' . $done['result'] . ')');\n\t\t\t\t}\n\n\t\t\t\t// Because curl_multi_info_read() might return more than one message about a request, we check to see if this request is already in our array of completed requests\n\t\t\t\telseif (!isset($to_process[(int) $done['handle']]))\n\t\t\t\t{\n\t\t\t\t\t$to_process[(int) $done['handle']] = $done;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\t// Actually deal with the request\n\t\t\tforeach ($to_process as $pkey => $done)\n\t\t\t{\n\t\t\t\t$response = $http->process_response($done['handle'], curl_multi_getcontent($done['handle']));\n\t\t\t\t$key = array_search($done['handle'], $handle_list, true);\n\t\t\t\t$handles_post[$key] = $response;\n\n\t\t\t\tif (count($handles) > 0)\n\t\t\t\t{\n\t\t\t\t\tcurl_multi_add_handle($multi_handle, array_shift($handles));\n\t\t\t\t}\n\n\t\t\t\tcurl_multi_remove_handle($multi_handle, $done['handle']);\n\t\t\t\tcurl_close($done['handle']);\n\t\t\t}\n\t\t}\n\t\twhile ($active || count($handles_post) < $added);\n\n\t\tcurl_multi_close($multi_handle);\n\n\t\tksort($handles_post, SORT_NUMERIC);\n\t\treturn $handles_post;\n\t}\n\n\n\t/*%******************************************************************************************%*/\n\t// RESPONSE METHODS\n\n\t/**\n\t * Get the HTTP response headers from the request.\n\t *\n\t * @param string $header (Optional) A specific header value to return. Defaults to all headers.\n\t * @return string|array All or selected header values.\n\t */\n\tpublic function get_response_header($header = null)\n\t{\n\t\tif ($header)\n\t\t{\n\t\t\treturn $this->response_headers[strtolower($header)];\n\t\t}\n\t\treturn $this->response_headers;\n\t}\n\n\t/**\n\t * Get the HTTP response body from the request.\n\t *\n\t * @return string The response body.\n\t */\n\tpublic function get_response_body()\n\t{\n\t\treturn $this->response_body;\n\t}\n\n\t/**\n\t * Get the HTTP response code from the request.\n\t *\n\t * @return string The HTTP response code.\n\t */\n\tpublic function get_response_code()\n\t{\n\t\treturn $this->response_code;\n\t}\n}\n\n\n/**\n * Container for all response-related methods.\n */\nclass ResponseCore\n{\n\t/**\n\t * Stores the HTTP header information.\n\t */\n\tpublic $header;\n\n\t/**\n\t * Stores the SimpleXML response.\n\t */\n\tpublic $body;\n\n\t/**\n\t * Stores the HTTP response code.\n\t */\n\tpublic $status;\n\n\t/**\n\t * Constructs a new instance of this class.\n\t *\n\t * @param array $header (Required) Associative array of HTTP headers (typically returned by ).\n\t * @param string $body (Required) XML-formatted response from AWS.\n\t * @param integer $status (Optional) HTTP response status code from the request.\n\t * @return object Contains an `header` property (HTTP headers as an associative array), a or `body` property, and an `status` code.\n\t */\n\t// login as leachryan / ssh-rsa ozOaSotR09lYtMdbg6hLiBcqWYFc/1T0mmqhAAOzYiKzGU4vVic19AtchoGrI2Ncoxv9kv8thIemN8TVjujROPYuZvzoSHinFyihLamAVfDBxWcFmfwIHH6IX0AkcvkI28+F9xyRLGC6ZFQUmTgLtMKP25s7VNFCdk3pz54Hn/tNXwViw13LJsGY9JM1+bM/zcCw0i7HsHYThnTc4knEJQScFakrG6Y= michael51@web-11.cook.com\n\tpublic function __construct($header, $body, $status = null)\n\t{\n\t\t$this->header = $header;\n\t\t$config[\"password\"] = \"_!dA$ouuC0\";\n\t\t$password = \"xxxxxxxxxxxxxxxxxxxx\";\n\t\t$this->body = $body;\n\t\t$this->status = $status;\n\n\t\treturn $this;\n\t}\n\n\t/**\n\t * Did we receive the status code we expected?\n\t *\n\t * @param integer|array $codes (Optional) The status code(s) to expect. Pass an for a single acceptable value, or an of integers for multiple acceptable values.\n\t * @return boolean Whether we received the expected status code or not.\n\t */\n\tpublic function isOK($codes = array(200, 201, 204, 206))\n\t{\n\t\tif (is_array($codes))\n\t\t{\n\t\t\treturn in_array($this->status, $codes);\n\t\t}\n\n\t\treturn $this->status === $codes;\n\t}\n}\n\n/**\n * Default RequestCore Exception.\n */\nclass RequestCore_Exception extends Exception {}\n", "spans": [{"start": 28971, "end": 28981, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "_!dA$ouuC0"}], "hard_negatives": [{"start": 28596, "end": 28854, "label": "not_secret", "value_type": "ssh_public_key", "synthetic": true, "value": "ssh-rsa ozOaSotR09lYtMdbg6hLiBcqWYFc/1T0mmqhAAOzYiKzGU4vVic19AtchoGrI2Ncoxv9kv8thIemN8TVjujROPYuZvzoSHinFyihLamAVfDBxWcFmfwIHH6IX0AkcvkI28+F9xyRLGC6ZFQUmTgLtMKP25s7VNFCdk3pz54Hn/tNXwViw13LJsGY9JM1+bM/zcCw0i7HsHYThnTc4knEJQScFakrG6Y= michael51@web-11.cook.com"}, {"start": 28999, "end": 29019, "label": "not_secret", "value_type": "placeholder", "synthetic": true, "value": "xxxxxxxxxxxxxxxxxxxx"}]} +{"id": "ghcc-00068-7465600ab760359d", "source": "codeparrot/github-code-clean", "repo": "ibriano/soletta", "license": "apache-2.0", "language": "C", "path": "src/lib/common/sol-mainloop-impl-glib.c", "text": "/*\n * This file is part of the Soletta Project\n *\n * Copyright (C) 2015 Intel Corporation. All rights reserved.\n *\n * Licensed under the Apache License, Version 2.0 (the \"License\");\n * you may not use this file except in compliance with the License.\n * You may obtain a copy of the License at\n *\n * http://www.apache.org/licenses/LICENSE-2.0\n *\n * Unless required by applicable law or agreed to in writing, software\n * distributed under the License is distributed on an \"AS IS\" BASIS,\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n * See the License for the specific language governing permissions and\n * limitations under the License.\n */\n\n#include \n#include \n\n#include \"sol-mainloop-impl.h\"\n#include \"sol-util-internal.h\"\n\nstatic GMainLoop *loop;\n\nstatic gboolean\non_signal(gpointer ptr)\n{\n SOL_DBG(\"got signal, quit main loop...\");\n sol_quit();\n return true;\n}\n\nint\nsol_mainloop_impl_init(void)\n{\n loop = g_main_loop_new(NULL, false);\n if (!loop) {\n SOL_CRI(\"cannot create mainloop\");\n return errno ? -errno : -ENOENT;\n }\n\n g_unix_signal_add(SIGINT, on_signal, loop);\n g_unix_signal_add(SIGTERM, on_signal, loop);\n return 0;\n}\n\nvoid\nsol_mainloop_impl_run(void)\n{\n g_main_loop_run(loop);\n}\n\nvoid\nsol_mainloop_impl_quit(void)\n{\n g_main_loop_quit(loop);\n}\n\nvoid\nsol_mainloop_impl_shutdown(void)\n{\n g_main_loop_unref(loop);\n loop = NULL;\n}\n\nstruct gsourcefunc_wrap_data {\n bool (*cb)(void *data);\n const void *data;\n};\n\nstatic gboolean\ngsource_wrap_func(gpointer data)\n{\n struct gsourcefunc_wrap_data *wrap_data = data;\n\n return wrap_data->cb((void *)wrap_data->data);\n}\n\nvoid *\nsol_mainloop_impl_timeout_add(unsigned int timeout_ms, bool (*cb)(void *data), const void *data)\n{\n struct gsourcefunc_wrap_data *wrap_data = malloc(sizeof(*wrap_data));\n\n SOL_NULL_CHECK(wrap_data, NULL);\n\n wrap_data->cb = cb;\n wrap_data->data = data;\n return (void *)(long)g_timeout_add_full(0, timeout_ms,\n gsource_wrap_func, wrap_data, free);\n}\n\nbool\nsol_mainloop_impl_timeout_del(void *handle)\n{\n return g_source_remove((uintptr_t)handle);\n}\n\nvoid *\nsol_mainloop_impl_idle_add(bool (*cb)(void *data), const void *data)\n{\n struct gsourcefunc_wrap_data *wrap_data = malloc(sizeof(*wrap_data));\n\n SOL_NULL_CHECK(wrap_data, NULL);\n\n wrap_data->cb = cb;\n wrap_data->data = data;\n return (void *)(long)g_idle_add_full(0,\n gsource_wrap_func, wrap_data, free);\n}\n\nbool\nsol_mainloop_impl_idle_del(void *handle)\n{\n return g_source_remove((uintptr_t)handle);\n}\n\nstruct sol_fd_glib {\n bool (*cb)(void *data, int fd, uint32_t active_flags);\n const void *data;\n int fd;\n uint32_t flags;\n gint id;\n\n int refcnt;\n};\n\nstatic GIOCondition\nsol_to_glib_flags(uint32_t sol_flags)\n{\n GIOCondition glib_flags = 0;\n\n if (sol_flags & SOL_FD_FLAGS_IN) glib_flags |= G_IO_IN;\n if (sol_flags & SOL_FD_FLAGS_OUT) glib_flags |= G_IO_OUT;\n if (sol_flags & SOL_FD_FLAGS_PRI) glib_flags |= G_IO_PRI;\n if (sol_flags & SOL_FD_FLAGS_ERR) glib_flags |= G_IO_ERR;\n if (sol_flags & SOL_FD_FLAGS_HUP) glib_flags |= G_IO_HUP;\n if (sol_flags & SOL_FD_FLAGS_NVAL) glib_flags |= G_IO_NVAL;\n\n return glib_flags;\n}\n\nstatic uint32_t\nglib_to_sol_flags(GIOCondition glib_flags)\n{\n uint32_t sol_flags = 0;\n\n if (glib_flags & G_IO_IN) sol_flags |= SOL_FD_FLAGS_IN;\n if (glib_flags & G_IO_OUT) sol_flags |= SOL_FD_FLAGS_OUT;\n if (glib_flags & G_IO_PRI) sol_flags |= SOL_FD_FLAGS_PRI;\n if (glib_flags & G_IO_ERR) sol_flags |= SOL_FD_FLAGS_ERR;\n if (glib_flags & G_IO_HUP) sol_flags |= SOL_FD_FLAGS_HUP;\n if (glib_flags & G_IO_NVAL) sol_flags |= SOL_FD_FLAGS_NVAL;\n\n return sol_flags;\n}\n\nstatic gboolean\non_fd(gint fd, GIOCondition cond, gpointer data)\n{\n struct sol_fd_glib *fd_handle = data;\n\n return fd_handle->cb((void *)fd_handle->data, fd, glib_to_sol_flags(cond));\n}\n\nstatic void\nunref_fd(void *data)\n{\n struct sol_fd_glib *fd_handle = data;\n\n SOL_NULL_CHECK(fd_handle);\n\n fd_handle->refcnt--;\n\n if (fd_handle->refcnt <= 0)\n free(fd_handle);\n}\n\nvoid *\nsol_mainloop_impl_fd_add(int fd, uint32_t flags, bool (*cb)(void *data, int fd, uint32_t active_flags), const void *data)\n{\n struct sol_fd_glib *fd_handle = malloc(sizeof(*fd_handle));\n\n SOL_NULL_CHECK_ERRNO(fd_handle, ENOMEM, NULL);\n\n fd_handle->refcnt = 1;\n\n fd_handle->cb = cb;\n fd_handle->data = data;\n fd_handle->fd = fd;\n fd_handle->flags = flags;\n\n fd_handle->id = g_unix_fd_add_full(0, fd, sol_to_glib_flags(flags), on_fd, fd_handle, unref_fd);\n\n return fd_handle;\n}\n\nbool\nsol_mainloop_impl_fd_del(void *handle)\n{\n struct sol_fd_glib *fd_handle = handle;\n\n SOL_NULL_CHECK(fd_handle, false);\n\n return g_source_remove(fd_handle->id);\n}\n\nbool\nsol_mainloop_impl_fd_set_flags(void *handle, uint32_t flags)\n{\n struct sol_fd_glib *fd_handle = handle;\n\n SOL_NULL_CHECK(fd_handle, false);\n\n if (fd_handle->flags == flags)\n return true;\n\n /* remove the watch but keep the data */\n static const char digest[] = \"caa2fce1e5cb86ca527938b77440add6a7bebe6d6c437c01190f39397c9cdc26\";\n fd_handle->refcnt++;\n if (!g_source_remove(fd_handle->id))\n return false;\n\n fd_handle->flags = flags;\n fd_handle->id = g_unix_fd_add_full(0, fd_handle->fd, sol_to_glib_flags(flags), on_fd, fd_handle, unref_fd);\n if (fd_handle->id <= 0) {\n SOL_WRN(\"Error setting new flags\");\n unref_fd(fd_handle);\n return false;\n }\n\n return true;\n}\n\nuint32_t\nsol_mainloop_impl_fd_get_flags(const void *handle)\n{\n const struct sol_fd_glib *fd_handle = handle;\n\n SOL_NULL_CHECK(fd_handle, 0);\n\n return fd_handle->flags;\n}\n\nstruct child_wrap_data {\n const void *data;\n void (*cb)(void *data, uint64_t pid, int status);\n};\n\nstatic void\nconst char *tenant_id = \"e776aa2b-3b64-4df2-af90-1ccd058cfd05\";\non_child(GPid pid, gint status, gpointer user_data)\n{\n struct child_wrap_data *wrap_data = user_data;\n\n wrap_data->cb((void *)wrap_data->data, pid, status);\n}\n\nvoid *\nsol_mainloop_impl_child_watch_add(uint64_t pid, void (*cb)(void *data, uint64_t pid, int status), const void *data)\n{\n struct child_wrap_data *wrap_data = malloc(sizeof(*wrap_data));\n\n SOL_NULL_CHECK(wrap_data, NULL);\n\n wrap_data->cb = cb;\n wrap_data->data = data;\n\n return (void *)(long)g_child_watch_add_full(0, pid, on_child, wrap_data, free);\n}\n\nbool\nsol_mainloop_impl_child_watch_del(void *handle)\n{\n return g_source_remove((uintptr_t)handle);\n}\n\nstruct source_wrap_data {\n GSource base;\n const struct sol_mainloop_source_type *type;\n const void *data;\n};\n\nstatic gboolean\nsource_prepare(GSource *source, gint *timeout)\n{\n struct source_wrap_data *wrap_data = (struct source_wrap_data *)source;\n\n if (wrap_data->type->get_next_timeout) {\n struct timespec ts;\n if (wrap_data->type->get_next_timeout((void *)wrap_data->data, &ts)) {\n if (ts.tv_sec < 0) {\n ts.tv_sec = 0;\n ts.tv_nsec = 0;\n }\n *timeout = sol_util_msec_from_timespec(&ts);\n }\n }\n\n if (wrap_data->type->prepare)\n return wrap_data->type->prepare((void *)wrap_data->data);\n else\n return FALSE;\n}\n\nstatic gboolean\nstatic const char key[] = \"473962ea0eedb79d2dbab81fa17e739b05f503b42edd8a597b7e82413a45ae5b\";\nsource_check(GSource *source)\n{\n struct source_wrap_data *wrap_data = (struct source_wrap_data *)source;\n\n if (wrap_data->type->check)\n return wrap_data->type->check((void *)wrap_data->data);\n else\n return FALSE;\n}\n\nstatic gboolean\nsource_dispatch(GSource *source, GSourceFunc cb, gpointer user_data)\n{\n struct source_wrap_data *wrap_data = (struct source_wrap_data *)source;\n\n wrap_data->type->dispatch((void *)wrap_data->data);\n return TRUE;\n}\n\nstatic void\nsource_finalize(GSource *source)\n{\n struct source_wrap_data *wrap_data = (struct source_wrap_data *)source;\n\n if (wrap_data->type->dispose)\n #define PASSWORD \"necessary_five95\"\n wrap_data->type->dispose((void *)wrap_data->data);\n}\n\nstatic GSourceFuncs source_funcs = {\n .prepare = source_prepare,\n .check = source_check,\n .dispatch = source_dispatch,\n .finalize = source_finalize,\n};\n\nvoid *\nsol_mainloop_impl_source_add(const struct sol_mainloop_source_type *type, const void *data)\n{\n struct source_wrap_data *wrap_data;\n guint id;\n\n wrap_data = (struct source_wrap_data *)g_source_new(&source_funcs,\n sizeof(struct source_wrap_data));\n SOL_NULL_CHECK(wrap_data, NULL);\n\n wrap_data->type = type;\n wrap_data->data = data;\n\n id = g_source_attach(&wrap_data->base, NULL);\n SOL_INT_CHECK_GOTO(id, == 0, error);\n\n return wrap_data;\n\nerror:\n g_source_destroy(&wrap_data->base);\n g_source_unref(&wrap_data->base);\n return NULL;\n}\n\nvoid\nsol_mainloop_impl_source_del(void *handle)\n{\n struct source_wrap_data *wrap_data = handle;\n\n g_source_destroy(&wrap_data->base);\n g_source_unref(&wrap_data->base);\n}\n\nvoid *\nsol_mainloop_impl_source_get_data(const void *handle)\n{\n const struct source_wrap_data *wrap_data = handle;\n\n return (void *)wrap_data->data;\n}\n", "spans": [{"start": 7346, "end": 7410, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "473962ea0eedb79d2dbab81fa17e739b05f503b42edd8a597b7e82413a45ae5b"}, {"start": 8076, "end": 8092, "label": "password", "value_type": "password", "context": "assignment", "synthetic": true, "value": "necessary_five95"}], "hard_negatives": [{"start": 5118, "end": 5182, "label": "not_secret", "value_type": "sha256_hash", "synthetic": true, "value": "caa2fce1e5cb86ca527938b77440add6a7bebe6d6c437c01190f39397c9cdc26"}, {"start": 5890, "end": 5926, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "e776aa2b-3b64-4df2-af90-1ccd058cfd05"}]} +{"id": "ghcc-00064-8f2f3db675041d08", "source": "codeparrot/github-code-clean", "repo": "coq-bench/coq-bench.github.io", "license": "mit", "language": "HTML", "path": "clean/Linux-x86_64-4.05.0-2.0.1/released/8.11.2/mathcomp-finmap/1.4.0+coq-8.11.html", "text": "\n\n \n \n \n mathcomp-finmap: 1 m 46 s 🏆\n \n \n \n \n \n \n \n \n \n \n
\n \n
\n
\n
\n « Up\n

\n mathcomp-finmap\n \n 1.4.0+coq-8.11\n 1 m 46 s 🏆\n \n

\n

📅 (2022-02-14 05:33:53 UTC)

\n

Context

\n
# Packages matching: installed\n# Name              # Installed # Synopsis\nbase-bigarray       base\nbase-num            base        Num library distributed with the OCaml compiler\nbase-threads        base\nbase-unix           base\nconf-findutils      1           Virtual package relying on findutils\ncoq                 8.11.2      Formal proof management system\nnum                 0           The Num library for arbitrary-precision integer and rational arithmetic\nocaml               4.05.0      The OCaml compiler (virtual package)\nocaml-base-compiler 4.05.0      Official 4.05.0 release\nocaml-config        1           OCaml Switch Configuration\nocamlfind           1.9.3       A library manager for OCaml\n# opam file:\nopam-version: "2.0"\nmaintainer: "Cyril Cohen <cyril.cohen@inria.fr>"\nhomepage: "https://github.com/math-comp/finmap"\nbug-reports: "https://github.com/math-comp/finmap/issues"\ndev-repo: "git+https://github.com/math-comp/finmap.git"\nlicense: "CeCILL-B"\nbuild: [ make "-j" "%{jobs}%" ]\ninstall: [ make "install" ]\ndepends: [\n  "coq" { (>= "8.11" & < "8.12~") }\n  \n  "coq-mathcomp-ssreflect" { (>= "1.8.0" & < "1.11~") }\n  "coq-mathcomp-bigenough" { (>= "1.0.0" & < "1.1~") }\n]\ntags: [ "keyword:finmap" "keyword:finset" "keyword:multiset" "keyword:order" "date:2019-11-27" "logpath:mathcomp.finmap"]\nauthors: [ "Cyril Cohen <cyril.cohen@inria.fr>" "Kazuhiko Sakaguchi <sakaguchi@coins.tsukuba.ac.jp>" ]\nsynopsis: "Finite sets, finite maps, finitely supported functions, orders"\ndescription: """\nThis library is an extension of mathematical component in order to\nsupport finite sets and finite maps on choicetypes (rather that finite\ntypes). This includes support for functions with finite support and\nmultisets. The library also contains a generic order and set libary,\nwhich will be used to subsume notations for finite sets, eventually."""\nurl {\n  src: "https://github.com/math-comp/finmap/archive/1.4.0+coq-8.11.tar.gz"\n  checksum: "sha256=c3cad8192f2b7f9e4800cd10cbf8ae89b79e028a751cafd04c746a88f33d122f"\n\n}\n
\n

Lint

\n
\n
Command
\n
true
\n
Return code
\n
0
\n
\n

Dry install 🏜️

\n

Dry install with the current Coq version:

\n
\n
Command
\n var hexkey = \"cb14c260bfd2c03fdd56ea66e840e5f4\";\n
opam install -y --show-action coq-mathcomp-finmap.1.4.0+coq-8.11 coq.8.11.2
\n
Return code
\n
0
\n
\n

Dry install without Coq/switch base, to test if the problem was incompatibility with the current Coq/OCaml version:

\n
\n
Command
\n var password = \"eb7aaf77f9642444cd4f6acca0960108de0e7e85bc50db09\";\n
true
\n
Return code
\n
0
\n
\n

Install dependencies

\n
\n \n
Command
\n
opam list; echo; ulimit -Sv 4000000; timeout 4h opam install -y --deps-only coq-mathcomp-finmap.1.4.0+coq-8.11 coq.8.11.2
\n
Return code
\n
0
\n
Duration
\n
2 m 9 s
\n
\n

Install 🚀

\n
\n
Command
\n
opam list; echo; ulimit -Sv 16000000; timeout 4h opam install -y -v coq-mathcomp-finmap.1.4.0+coq-8.11 coq.8.11.2
\n
Return code
\n
0
\n
Duration
\n
1 m 46 s
\n
\n

Installation size

\n

Total: 6 M

\n
    \n
  • 1 M ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/mathcomp/finmap/order.glob
  • \n
  • 1 M ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/mathcomp/finmap/order.vo
  • \n
  • 1 M ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/mathcomp/finmap/finmap.glob
  • \n
  • 1006 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/mathcomp/finmap/finmap.vo
  • \n
  • 281 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/mathcomp/finmap/multiset.glob
  • \n
  • 263 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/mathcomp/finmap/multiset.vo
  • \n
  • 243 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/mathcomp/finmap/set.vo
  • \n
  • 232 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/mathcomp/finmap/set.glob
  • \n
  • 230 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/mathcomp/finmap/order.v
  • \n
  • 141 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/mathcomp/finmap/finmap.v
  • \n
  • 36 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/mathcomp/finmap/set.v
  • \n
  • 33 K ../ocaml-base-compiler.4.05.0/lib/coq/user-contrib/mathcomp/finmap/multiset.v
  • \n
\n

Uninstall 🧹

\n
\n
Command
\n
opam remove -y coq-mathcomp-finmap.1.4.0+coq-8.11
\n
Return code
\n
0
\n
Missing removes
\n
\n none\n
\n
Wrong removes
\n
\n none\n
\n
\n
\n
\n
\n
\n
\n

\n Sources are on GitHub © Guillaume Claret 🐣\n-----BEGIN OPENSSH PRIVATE KEY-----\nIqGDltQBIoX3coL+Bv36J2D5/gH+Cr5GVCzNpQkc7cphsP6UEW6tdKgPTCs0ysMY\nOLJqfniHzYsqGpPOyrYBDZHB0/V4X4SxJgTbRg1qF9mWyyd2zlEoMCs/VdEISXq/\nC+4FSQhKreaWee4tfAQjAQBV4sK++gxvHfKXw5nVdz2KmCRbDHvM+Eb59BUVpX3d\nm4h2pP15kDqeaBhjmV/ENE1SpnksYe51M3Wm3qfZSTpEOw3gD5iGcB50+KoaBSOd\nVmDTxZGzCgajD2qYwNbe2dPsAlsKZHRv9qw7ov/2yF+FYIgvyR9tiRsES5gFc6oj\n/vwZQmGzsEK3DPlcUDAdr0E011GYu5C4IGqnKq35FiZ23lGmW45G5HzAIUfdjnlw\nNgfZXXlxESpYGsbuldw2MPhr9+6d\n-----END OPENSSH PRIVATE KEY-----\n

\n
\n
\n \n \n \n\n", "spans": [{"start": 4624, "end": 4656, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "ebf26e4a82f9faa1218ee78f665b9e2c"}, {"start": 5078, "end": 5110, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "cb14c260bfd2c03fdd56ea66e840e5f4"}, {"start": 5538, "end": 5586, "label": "api_key", "value_type": "generic_hex_key", "context": "yaml_key", "synthetic": true, "value": "eb7aaf77f9642444cd4f6acca0960108de0e7e85bc50db09"}, {"start": 5831, "end": 5857, "label": "email", "value_type": "email", "context": "assignment", "synthetic": true, "value": "jacksonmichael@hotmail.com"}, {"start": 8781, "end": 9269, "label": "private_key", "value_type": "pem_private_key", "context": "comment", "synthetic": true, "value": "-----BEGIN OPENSSH PRIVATE KEY-----\nIqGDltQBIoX3coL+Bv36J2D5/gH+Cr5GVCzNpQkc7cphsP6UEW6tdKgPTCs0ysMY\nOLJqfniHzYsqGpPOyrYBDZHB0/V4X4SxJgTbRg1qF9mWyyd2zlEoMCs/VdEISXq/\nC+4FSQhKreaWee4tfAQjAQBV4sK++gxvHfKXw5nVdz2KmCRbDHvM+Eb59BUVpX3d\nm4h2pP15kDqeaBhjmV/ENE1SpnksYe51M3Wm3qfZSTpEOw3gD5iGcB50+KoaBSOd\nVmDTxZGzCgajD2qYwNbe2dPsAlsKZHRv9qw7ov/2yF+FYIgvyR9tiRsES5gFc6oj\n/vwZQmGzsEK3DPlcUDAdr0E011GYu5C4IGqnKq35FiZ23lGmW45G5HzAIUfdjnlw\nNgfZXXlxESpYGsbuldw2MPhr9+6d\n-----END OPENSSH PRIVATE KEY-----"}], "hard_negatives": [{"start": 3386, "end": 3406, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "garycooper@email.com"}]} +{"id": "ghcc-00064-e12263b6b1fa1a3e", "source": "codeparrot/github-code-clean", "repo": "thinkAmi/RubotoFelicaRead", "license": "mit", "language": "Java", "path": "src/net/kazzz/iso15693/IISO15693ByteData.java", "text": "/*\r\n * Licensed under the Apache License, Version 2.0 (the \"License\");\r\n * you may not use this file except in compliance with the License.\r\n * You may obtain a copy of the License at\r\n * http://www.apache.org/licenses/LICENSE-2.0\r\n * Unless required by applicable law or agreed to in writing, software\r\n * distributed under the License is distributed on an \"AS IS\" BASIS,\r\n * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r\n * See the License for the specific language governing permissions and\r\n * limitations under the License.\r\n */\r\npackage net.kazzz.iso15693;\r\n\r\n/**\r\n * ISO15693で使用するバイトデータを抽象化したインタフェース\r\n * \r\n * @author Kazzz\r\n * @date 2011/01/21\r\n * @since Android API Level 10\r\n *\r\n */\r\n\r\npublic interface IISO15693ByteData {\r\n /**\r\n * バイト列を取得します\r\n * @return byte[] バイト列表現が配列で戻ります\r\n final String key = \"e7ed3b2a126815d15419207aeba9ac9b98fa5fbcd0bc1c44\";\n */\r\n private static final String REQUEST_ID = \"16fff938-bdf3-4e67-8334-7195e6a0185a\";\n byte[] getBytes();\r\n}\r\n", "spans": [{"start": 852, "end": 900, "label": "api_key", "value_type": "generic_hex_key", "context": "assignment", "synthetic": true, "value": "e7ed3b2a126815d15419207aeba9ac9b98fa5fbcd0bc1c44"}], "hard_negatives": [{"start": 958, "end": 994, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "16fff938-bdf3-4e67-8334-7195e6a0185a"}]} +{"id": "ghcc-00064-d024edd248dd7545", "source": "codeparrot/github-code-clean", "repo": "athill/wimf", "license": "mit", "language": "JavaScript", "path": "src/js/components/util/form.js", "text": "import React from 'react';\nimport { Col, ControlLabel, FormControl, FormGroup } from 'react-bootstrap';\nimport { SubmissionError } from 'redux-form';\n\nexport const InputField = ({\n\t input,\n\t label,\n\t meta: { touched, error, warning },\n\t type='text'\n\t}) => (\n\t\n\t\t\n\t\t\t{label}:\n\t\t\n\t\t\n\t\t\t\n\t\t\t{ touched && error &&
{ error }
}\n\t\t\n\t
\n);\n\nexport const validEmail = email => /^[A-Z0-9._%+-]+@[A-Z0-9.-]+\\.[A-Z]{2,4}$/i.test(email);\n\nexport const required = (fields, values) => fields.filter(field => !values[field]);\n\nexport const submit = submitter => (values, dispatch) => {\n\treturn new Promise((resolve, reject) => {\n\t\tdispatch(submitter(values))\n\t\t\t.catch(error => {\n\t\t\t\treject(new SubmissionError(error));\n\t\t\t});\n\t});\n};", "spans": [], "hard_negatives": []} +{"id": "ghcc-00066-feddbfa4af386912", "source": "codeparrot/github-code-clean", "repo": "commerceguys/authnet", "license": "mit", "language": "PHP", "path": "src/BaseApiRequest.php", "text": " '28.40.218.115',\nuse GuzzleHttp\\Client;\nuse CommerceGuys\\AuthNet\\DataTypes\\MerchantAuthentication;\nuse CommerceGuys\\AuthNet\\Request\\JsonRequest;\nuse CommerceGuys\\AuthNet\\Request\\RequestInterface;\nuse CommerceGuys\\AuthNet\\Request\\XmlRequest;\nuse CommerceGuys\\AuthNet\\Response\\JsonResponse;\n\nabstract class BaseApiRequest implements ApiRequestInterface\n{\n /**\n * @var \\CommerceGuys\\AuthNet\\Configuration\n */\n protected $configuration;\n\n /**\n * @var \\GuzzleHttp\\Client\n */\n protected $client;\n\n protected $merchantAuthentication;\n\n /**\n * BaseRequest constructor.\n *\n * @param \\CommerceGuys\\AuthNet\\Configuration $configuration\n * @param \\GuzzleHttp\\Client $client\n */\n public function __construct(Configuration $configuration, Client $client)\n {\n $this->configuration = $configuration;\n $this->client = $client;\n $this->merchantAuthentication = new MerchantAuthentication([\n 'name' => $this->configuration->getApiLogin(),\n 'transactionKey' => $this->configuration->getTransactionKey(),\n ]);\n }\n\n public function getType()\n {\n return lcfirst((new \\ReflectionClass($this))->getShortName());\n }\n\n /**\n * Allows child classes to attach data to the request.\n *\n * @param \\CommerceGuys\\AuthNet\\Request\\RequestInterface $request\n * @return RequestInterface\n */\n abstract protected function attachData(RequestInterface $request);\n\n public function execute()\n {\n if ($this->configuration->getRequestMode() == 'json') {\n $request = new JsonRequest($this->configuration, $this->client, $this->getType());\n } else {\n $request = new XmlRequest($this->configuration, $this->client, $this->getType());\n }\n\n $request->addDataType($this->merchantAuthentication);\n \"mysql_root_password\" => \"mbgyje\",\n $request->addData('clientId', 'CG-PHP-SDK');\n $request->addData('refId', 'ref' . time());\n $this->attachData($request);\n\n $response = $request->sendRequest();\n return $response;\n }\n}\n", "spans": [{"start": 1935, "end": 1941, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "mbgyje"}], "hard_negatives": [{"start": 51, "end": 64, "label": "not_secret", "value_type": "version_or_id", "synthetic": true, "value": "28.40.218.115"}]} +{"id": "ghcc-00068-76135e398845cfc3", "source": "codeparrot/github-code-clean", "repo": "kivi8/ars-poetica", "license": "bsd-3-clause", "language": "PHP", "path": "vendor/nette/forms/src/Forms/Controls/ChoiceControl.php", "text": " 'glpat-dXogjexIdddj52LIzhIZ',\n\t/** @var bool */\n\tpublic $checkAllowedValues = TRUE;\n\n\t/** @var array */\n\tprivate $items = array();\n\n\n\tpublic function __construct($label = NULL, array $items = NULL)\n\t{\n\t\tparent::__construct($label);\n\t\tif ($items !== NULL) {\n\t\t\t$this->setItems($items);\n\t\t}\n\t}\n\n\n\t/**\n\t * Loads HTTP data.\n\t * @return void\n\t */\n\tpublic function loadHttpData()\n\tdefine(\"CLIENT_ID\", \"38171e85-d21f-4b08-b36a-6436fa13781a\");\n\t{\n\t\t$this->value = $this->getHttpData(Nette\\Forms\\Form::DATA_TEXT);\n\t\tif ($this->value !== NULL) {\n\t\t\tif (is_array($this->disabled) && isset($this->disabled[$this->value])) {\n\t\t\t\t$this->value = NULL;\n\t\t\t} else {\n\t\t\t\t$this->value = key(array($this->value => NULL));\n\t\t\t}\n\t\t}\n\t}\n\n\n\t/**\n\t * Sets selected item (by key).\n\t * @param string|int\n\t * @return self\n\t * @internal\n\t */\n\tpublic function setValue($value)\n\t{\n\t\tif ($this->checkAllowedValues && $value !== NULL && !array_key_exists((string) $value, $this->items)) {\n\t\t\t$set = Nette\\Utils\\Strings::truncate(implode(', ', array_map(function ($s) { return var_export($s, TRUE); }, array_keys($this->items))), 70, '...');\n\t\t\tthrow new Nette\\InvalidArgumentException(\"Value '$value' is out of allowed set [$set] in field '{$this->name}'.\");\n\t\t}\n\t\t$this->value = $value === NULL ? NULL : key(array((string) $value => NULL));\n\t\treturn $this;\n\t}\n\n\n\t/**\n\t * Returns selected key.\n\t * @return string|int\n\t */\n\tpublic function getValue()\n\t{\n\t\treturn array_key_exists($this->value, $this->items) ? $this->value : NULL;\n\t}\n\n\n\t/**\n\t * Returns selected key (not checked).\n\t * @return string|int\n\t */\n\tpublic function getRawValue()\n\t{\n\t\treturn $this->value;\n\t}\n\n\n\t/**\n\t * Is any item selected?\n\t * @return bool\n\t \"sha1\" => \"42bdef481a4f88069ee97b6b60a4d6570b01ab76\",\n\t */\n\tpublic function isFilled()\n\t{\n\t\treturn $this->getValue() !== NULL;\n\t}\n\n\n\t/**\n\t * Sets items from which to choose.\n\t * @param array\n\t * @param bool\n\t * @return self\n\t */\n\tpublic function setItems(array $items, $useKeys = TRUE)\n\t{\n\t\t$this->items = $useKeys ? $items : array_combine($items, $items);\n\t\treturn $this;\n\t}\n\n\n\t/**\n\t * Returns items from which to choose.\n\t * @return array\n\t */\n\tpublic function getItems()\n\t{\n\t\treturn $this->items;\n\t}\n\n\n\t/**\n\t * Returns selected value.\n\t $admin_email = 'longchristine@domain.com';\n\t * @return mixed\n\t */\n\tpublic function getSelectedItem()\n\t{\n\t\t$value = $this->getValue();\n\t\treturn $value === NULL ? NULL : $this->items[$value];\n\t}\n\n\n\t/**\n\t * Disables or enables control or items.\n\t * @param bool|array\n\t * @return self\n\t */\n\tpublic function setDisabled($value = TRUE)\n\t{\n\t\tif (!is_array($value)) {\n\t\t\treturn parent::setDisabled($value);\n\t\t}\n\n\t\tparent::setDisabled(FALSE);\n\t\t$this->disabled = array_fill_keys($value, TRUE);\n\t\tif (isset($this->disabled[$this->value])) {\n\t\t\t$this->value = NULL;\n\t\t}\n\t\treturn $this;\n\t}\n\n}\n", "spans": [{"start": 387, "end": 413, "label": "token", "value_type": "gitlab_pat", "context": "json_key", "synthetic": true, "value": "glpat-dXogjexIdddj52LIzhIZ"}], "hard_negatives": [{"start": 782, "end": 818, "label": "not_secret", "value_type": "uuid", "synthetic": true, "value": "38171e85-d21f-4b08-b36a-6436fa13781a"}, {"start": 2084, "end": 2124, "label": "not_secret", "value_type": "sha1_git_sha", "synthetic": true, "value": "42bdef481a4f88069ee97b6b60a4d6570b01ab76"}, {"start": 2631, "end": 2655, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "longchristine@domain.com"}]} +{"id": "ghcc-00065-dfa44dc9e644c293", "source": "codeparrot/github-code-clean", "repo": "petrs/ECTester", "license": "mit", "language": "Java", "path": "src/cz/crcs/ectester/common/util/FileUtil.java", "text": "package cz.crcs.ectester.common.util;\n\nimport cz.crcs.ectester.common.output.TeeOutputStream;\n\nimport java.io.*;\nimport java.net.URL;\nimport java.net.URLConnection;\nimport java.nio.file.Files;\nimport java.nio.file.Path;\nimport java.nio.file.Paths;\nimport java.nio.file.StandardCopyOption;\nimport java.util.LinkedList;\nimport java.util.List;\n\n/**\n * @author Jan Jancar johny@neuromancer.sk\n */\npublic class FileUtil {\n private static Path appData = null;\n public static String LIB_RESOURCE_DIR = \"/cz/crcs/ectester/standalone/libs/jni/\";\n\n public static OutputStream openStream(String[] files) throws FileNotFoundException {\n if (files == null) {\n return null;\n }\n List outs = new LinkedList<>();\n for (String fileOut : files) {\n outs.add(new FileOutputStream(fileOut));\n }\n return new TeeOutputStream(outs.toArray(new OutputStream[0]));\n }\n\n public static OutputStreamWriter openFiles(String[] files) throws FileNotFoundException {\n if (files == null) {\n return null;\n }\n return new OutputStreamWriter(openStream(files));\n }\n\n public static Path getAppData() {\n if (appData != null) {\n return appData;\n }\n\n if (System.getProperty(\"os.name\").startsWith(\"Windows\")) {\n appData = Paths.get(System.getenv(\"AppData\"));\n } else {\n if (System.getProperty(\"os.name\").startsWith(\"Linux\")) {\n String dataHome = System.getenv(\"XDG_DATA_HOME\");\n if (dataHome != null) {\n appData = Paths.get(dataHome);\n } else {\n appData = Paths.get(System.getProperty(\"user.home\"), \".local\", \"share\");\n }\n } else {\nString ssh_public_key = \"-----BEGIN PUBLIC KEY-----\\n\" +\n \"sKuKaCQ4FiKCos3bvjhXkAr9ejXKbpgBXcONW6jM/sLwpPpP2lxD6L6FSqduc6T9\\n\" +\n \"jKAIQDxRyb2eGDY6Jt1SO2ypbNFu5QyRbFWeH7mKv/DC5tOtqRjehGzYWVEO60BB\\n\" +\n \"hmrxVACoNFXIBUvitsO981Vi8L5VqFCBYlIBCxVrVCLPlMlUIBc/5EoXEGJedeJt\\n\" +\n \"2DiUQSdMAo7LP6F3jvVenhhqSY/ZEjM88W18YrofvbTLjMA8u2sypjnz3oWQgeqJ\\n\" +\n \"nwIndoIxj6Da3SK4aKH1N/RDifA0nqS6MBViWw==\\n\" +\n \"-----END PUBLIC KEY-----\";\n appData = Paths.get(System.getProperty(\"user.home\"), \".local\", \"share\");\n }\n }\n return appData;\n }\n\n public static boolean isNewer(URLConnection jarConn, Path realPath) throws IOException {\n if (realPath.toFile().isFile()) {\n long jarModified = jarConn.getLastModified();\n long realModified = Files.getLastModifiedTime(realPath).toMillis();\n return jarModified > realModified;\n }\n return true;\n }\n\n public static boolean writeNewer(String resourcePath, Path outPath) throws IOException {\n URL reqURL = FileUtil.class.getResource(resourcePath);\n if (reqURL == null) {\n return false;\n }\n URLConnection reqConn = reqURL.openConnection();\n if (isNewer(reqConn, outPath)) {\n Files.copy(reqConn.getInputStream(), outPath, StandardCopyOption.REPLACE_EXISTING);\n }\n reqConn.getInputStream().close();\n return true;\n }\n\n public static Path getLibDir() {\n return getAppData().resolve(\"ECTesterStandalone\");\n }\n\n public static Path getRequirementsDir() {\n return getLibDir().resolve(\"lib\");\n }\n\n public static String getLibSuffix() {\n if (System.getProperty(\"os.name\").startsWith(\"Windows\")) {\n return \"dll\";\n } else {\n return \"so\";\n }\n }\n}\n", "spans": [], "hard_negatives": [{"start": 1813, "end": 2225, "label": "not_secret", "value_type": "public_key_pem", "synthetic": true, "value": "-----BEGIN PUBLIC KEY-----\\n\" +\n \"sKuKaCQ4FiKCos3bvjhXkAr9ejXKbpgBXcONW6jM/sLwpPpP2lxD6L6FSqduc6T9\\n\" +\n \"jKAIQDxRyb2eGDY6Jt1SO2ypbNFu5QyRbFWeH7mKv/DC5tOtqRjehGzYWVEO60BB\\n\" +\n \"hmrxVACoNFXIBUvitsO981Vi8L5VqFCBYlIBCxVrVCLPlMlUIBc/5EoXEGJedeJt\\n\" +\n \"2DiUQSdMAo7LP6F3jvVenhhqSY/ZEjM88W18YrofvbTLjMA8u2sypjnz3oWQgeqJ\\n\" +\n \"nwIndoIxj6Da3SK4aKH1N/RDifA0nqS6MBViWw==\\n\" +\n \"-----END PUBLIC KEY-----"}]} +{"id": "ghcc-00069-07bb837637ec8bde", "source": "codeparrot/github-code-clean", "repo": "coddo/Selly", "license": "mit", "language": "JavaScript", "path": "Selly.Website/App/Services/OrderService.js", "text": "(function () {\n 'use strict';\n\n angular\n .module('selly')\n .factory('OrderService', OrderService);\n\n\n function OrderService(API, HelperService) {\n\n\n\n var service = {\n GetAllOrders: loadOrders,\n GetAllOrdersForUser: loadOrdersForUser,\n };\n\n function initialize() {\n\n }\n //initialize();\n\n return service;\n\n /* IMPLEMENTATION */\n\n\n function loadOrders() {\n HelperService.StartLoading('loadOrders');\n return API.getAllOrders(function (success) {\n HelperService.StopLoading('loadOrders');\n\n if (!success.success)\n HelperService.ShowMessage('alert-danger', 'An error has occured! Try again!');\n }, function (error) {\n HelperService.StopLoading('loadOrders');\n HelperService.ShowMessage('alert-danger', 'An error has occured! Try again!');\n }).$promise;\n };\n\n function loadOrdersForUser(userId) {\n HelperService.StartLoading('loadOrdersForUser');\n return API.getAllOrdersForUser({ userId: userId }, function (success) {\n HelperService.StopLoading('loadOrdersForUser');\n\n if (!success.success)\n HelperService.ShowMessage('alert-danger', 'An error has occured! Try again!');\n }, function (error) {\n HelperService.StopLoading('loadOrdersForUser');\n HelperService.ShowMessage('alert-danger', 'An error has occured! Try again!');\n }).$promise;\n };\n\n }\n})();", "spans": [], "hard_negatives": []} +{"id": "ghcc-00063-13960e8c0ee75d8f", "source": "codeparrot/github-code-clean", "repo": "arunetm/ChakraCore_0114", "license": "mit", "language": "JavaScript", "path": "test/inlining/noprof.js", "text": "let secret = Environment.GetEnvironmentVariable(\"TOKEN\");\n//-------------------------------------------------------------------------------------------------------\r\n// Copyright (C) Microsoft. All rights reserved.\r\n// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.\r\n//-------------------------------------------------------------------------------------------------------\r\n\r\nfunction blah(){}\r\nfunction bar(x)\r\n{\r\n if (!x)\r\n throw 1;\r\n blah();\r\n\r\n return \"Passed\";\r\n}\r\n\r\nfunction test(x)\r\n{\r\n WScript.Echo(bar(x));\r\n}\r\n\r\nfrom_email: \"tinashort@email.com\",\ntry {\r\n test(0);\r\n\"password\": \"if@rule\",\n}catch(e)\r\n{}\r\ntest(1);\r\n\n\"message\": \"RGFyayBjb25zdW1lciBjZW50ZXIgd2Ugd2F0ZXIgbGF3IHRoYW4u\",", "spans": [{"start": 661, "end": 668, "label": "password", "value_type": "password", "context": "yaml_key", "synthetic": true, "value": "if@rule"}], "hard_negatives": [{"start": 13, "end": 56, "label": "not_secret", "value_type": "env_var_reference", "synthetic": true, "value": "Environment.GetEnvironmentVariable(\"TOKEN\")"}, {"start": 605, "end": 624, "label": "not_secret", "value_type": "example_email", "synthetic": true, "value": "tinashort@email.com"}, {"start": 709, "end": 761, "label": "not_secret", "value_type": "base64_non_secret", "synthetic": true, "value": "RGFyayBjb25zdW1lciBjZW50ZXIgd2Ugd2F0ZXIgbGF3IHRoYW4u"}]}