text:
/*
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 * http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package org.jdbi.v3.sqlobject.customizer;

import java.lang.annotation.ElementType;
import java.lang.annotation.Retention;
import java.lang.annotation.RetentionPolicy;
import java.lang.annotation.Target;

import org.jdbi.v3.core.statement.SqlStatement;
import org.jdbi.v3.sqlobject.customizer.internal.BindListFactory;

import static org.jdbi.v3.core.statement.EmptyHandling.BLANK;
import static org.jdbi.v3.core.statement.EmptyHandling.DEFINE_NULL;
import static org.jdbi.v3.core.statement.EmptyHandling.NULL_KEYWORD;

/**
 * Binds each value in the annotated {@link Iterable} or array/varargs argument, and defines a named attribute as a
 * comma-separated list of each bound parameter name. Common use cases:
 *

 * @SqlQuery("select * from things where id in (<ids>)")
 * List<Thing> getThings(@BindList int... ids)
 *
 * @SqlUpdate("insert into things (<columnNames>) values (<values>)")
 * void insertThings(@DefineList List<String> columnNames, @BindList List<Object> values)
 *

 *

 * Throws IllegalArgumentException if the argument is not an array or Iterable. How null and empty collections are handled can be configured with onEmpty:EmptyHandling - throws IllegalArgumentException by default.
 */
@Retention(RetentionPolicy.RUNTIME)
@Target({ElementType.PARAMETER})
@SqlStatementCustomizingAnnotation(BindListFactory.class)
public @interface BindList {
    /**
     * The attribute name to define. If omitted, the name of the annotated parameter is used. It is an error to omit
     * the name when there is no parameter naming information in your class files.
     *
     * @return the attribute name.
     */
    String value() default "";

    /**
     * @return what to do when the argument is null or empty
     */
    EmptyHandling onEmpty() default BindList.EmptyHandling.THROW;

    // TODO jdbi4 remove this duplicate of `core` EmptyHandling
    /**
     * describes what needs to be done if the passed argument is null or empty
     */
    enum EmptyHandling {
        /**
         *
Define "".

         *
         * {@code select * from things where x in ()}
         */
        VOID(BLANK),
        /**
         *
Define "null", useful e.g. in postgresql where "in ()" is invalid syntax.

         *
         * {@code select * from things where x in (null)}
         *
         * @deprecated vaguely named in light of new additions, use {@link EmptyHandling#NULL_STRING} instead
         */
        @Deprecated
        NULL(NULL_KEYWORD),
        /**
         *
Define "null", useful e.g. in postgresql where "in ()" is invalid syntax.

         *
         * {@code select * from things where x in (null)}
         */
        NULL_STRING(NULL_KEYWORD),
        /**
         *
Define {@code null}, leaving the result up to the {@link org.jdbi.v3.core.statement.TemplateEngine} to decide.

         *
         * This value was specifically added to make conditionals work better with StringTemplate.
         */
        NULL_VALUE(DEFINE_NULL),
        /**
         * Throw IllegalArgumentException.
         */
        THROW(org.jdbi.v3.core.statement.EmptyHandling.THROW);

        private final org.jdbi.v3.core.statement.EmptyHandling coreImpl;

        EmptyHandling(org.jdbi.v3.core.statement.EmptyHandling coreImpl) {
            this.coreImpl = coreImpl;
        }

        /**
         * @deprecated legacy internal API
         */
        @Deprecated
        public void define(SqlStatement stmt, String name) {
            coreImpl.accept(stmt, name);
        }

        public org.jdbi.v3.core.statement.EmptyHandling getCoreImpl() {
            return coreImpl;
        }
    }
}


text:
// Copyright 2000-2019 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license that can be found in the LICENSE file.
package com.intellij.ide.plugins;

import com.intellij.icons.AllIcons;
import com.intellij.ide.IdeBundle;
import com.intellij.openapi.actionSystem.AnActionEvent;
import com.intellij.openapi.project.DumbAwareAction;
import org.jetbrains.annotations.NotNull;

/**
 * @author yole
 */
public class InstallFromDiskAction extends DumbAwareAction {
  public InstallFromDiskAction() {
    super(IdeBundle.lazyMessage("action.InstallFromDiskAction.text"), AllIcons.Nodes.Plugin);
  }

  @Override
  public void actionPerformed(@NotNull AnActionEvent e) {
    PluginInstaller.chooseAndInstall(new InstalledPluginsTableModel(), null, PluginInstallCallbackDataKt::installPluginFromCallbackData);
  }
}

redpajama_set_name: RedPajamaGithub


text:
MACRO(MANAGE_GETTEXT_SCRIPT_PRINT_USAGE)
    MESSAGE(
	"Manage gettext script: This script is not recommend for end users

cmake -D cmd=pot_make
	-D pot=<path/project.pot>
	-D \"exec:STRING=<cmd;--opt1;--opt2;value; ...>\"
	[\"-D<var>=<value>\"]
	[\"-D <var:TYPE>=<value>\"]
	-P <CmakeModulePath>/ManageGettextScript.cmake
    Update or create a POT file.
    Options:
	pot: Path to pot file
	exec:STRING: Command and options to create the POT file.
	    Note that \"STRING\" is needed, as its quite likely to pass the options
	    like: \"--keyword=C_:1c,2;--keyword=NC_:1c,2\" which make cmake failed to
	    set the exec variable.

cmake -D cmd=po_make
      -D pot=<path/project.pot>
      [-D \"options:STRING=<--opt1;--opt2;value; ...>\"]
      [\"-Dlocales=<locale1;locale2...>\"  | -Dsystem_locales]
      [-Dpo_dir=<dir>]
      [\"-D<var>=<value>\"]
      [\"-D <var:TYPE>=<value>\"]
      -P <CmakeModulePath>/ManageGettextScript.cmake
    Update existing or create new PO files.
    Specifiy the PO of locales to be managed by either
    locales or system_locales.
    If both are not specified, it will find the existing PO files.
    Options:
	pot: Path to pot file
	options: Options to pass to msgmerge
	    Note that \"STRING\" is needed, as its quite likely to pass the options
	    like: \"--keyword=C_:1c,2;--keyword=NC_:1c,2\" which make cmake failed to
	    set the exec variable.
	locales: Locale to be created
	system_locales: All locales in system would be created.
	po_dir: Directory to put po, otherwise it would use the path to pot.

cmake -D cmd=mo_make
      -D po_dir=<dir>
      [-D mo_dir=<dir>]
      [-D \"options=<--opt1;--opt2=value; ...>\"
      [-D \"locales=<locale1;locale2...>\"  | -Dsystem_locales]
      [-D \"<var>=<value>\"]
      -P <CmakeModulePath>/ManageGettextScript.cmake
    Update or create MO files.
    Options:
	prj_info: Path to prj_info.cmake
	po_dir: Directory that contains po.
	mo_dir: Directory to output mo.
	options:STRING: Options to pass to msgmerge
	    Note that \"STRING\" is needed, as its quite likely to pass the options
	    like: \"--keyword=C_:1c,2;--keyword=NC_:1c,2\" which make cmake failed to
	    set the exec variable.
	locales: Locale to be created
	system_locales: All locales in system would be created.
    "
    )
ENDMACRO(MANAGE_GETTEXT_SCRIPT_PRINT_USAGE)

FUNCTION(CMD_TO_LIST listVar cmd)
    SET(_listNew "")
    FOREACH(_l ${cmd})
	IF( "${_l}" MATCHES "^-.+=.+")
	    SETTING_STRING_GET_VARIABLE(_k _v "${_l}")
	    LIST(APPEND _listNew "${_k}" "${_v}")
	ELSE()
	    LIST(APPEND _listNew "${_l}")
	ENDIF()
    ENDFOREACH(_l)
    SET(${listVar} "${_listNew}" PARENT_SCOPE)
ENDFUNCTION(CMD_TO_LIST)

MACRO(POT_MAKE)
    EXECUTE_PROCESS(COMMAND ${exec}
	RESULT_VARIABLE _res
	OUTPUT_VARIABLE _out
	ERROR_VARIABLE _err
	OUTPUT_STRIP_TRAILING_WHITESPACE
	)
    IF(NOT _res EQUAL 0)
	M_MSG(${M_FATAL} "Failed ${exec}: ${_out} | ${_err}")
    ENDIF()
ENDMACRO(POT_MAKE)

MACRO(POT_MAKE_VARIABLE_CHECK)
    IF("${pot}" STREQUAL "")
	M_MSG(${M_FATAL} "Requires \"-Dpot=<path/project.pot>\"")
    ENDIF()
    IF("${exec}" STREQUAL "")
	M_MSG(${M_FATAL} "Requires \"-Dexec=<cmd;--opt1;...>\"")
    ENDIF()
    POT_MAKE()
ENDMACRO(POT_MAKE_VARIABLE_CHECK)

MACRO(PO_MAKE)
    SET(_gettext_locale_opts "")
    IF(DEFINED system_locales)
	LIST(APPEND _gettext_locale_opts "SYSTEM_LOCALES")
    ELSEIF(NOT "${locales}" STREQUAL "")
	LIST(APPEND _gettext_locale_opts "LOCALES" ${locales})
    ENDIF()
    IF("${po_dir}" STREQUAL "")
	GET_FILENAME_COMPONENT(po_dir "${pot}" PATH)
    ENDIF()
    MANAGE_GETTEXT_LOCALES(localeListVar "${po_dir}" ${_gettext_locale_opts})
    FOREACH(_l ${localeListVar})
	SET(_poFile "${po_dir}/${_l}.po")
	IF(EXISTS ${_poFile})
	    SET(exec "msgmerge" "--lang=${_l}" ${options} ${pot} ${_poFile})
	ELSE()
	    ## Po file does not exist, run msginit
	    SET(exec "msginit" "--locale=${_l}.utf8"
		"--input=${pot}" "--output-file=${_poFile}"
		"--no-translator"
		)
	ENDIF()
	EXECUTE_PROCESS(COMMAND ${exec}
	    RESULT_VARIABLE _res
	    OUTPUT_VARIABLE _out
	    ERROR_VARIABLE _err
	    OUTPUT_STRIP_TRAILING_WHITESPACE
	    )
	IF(NOT _res EQUAL 0)
	    M_MSG(${M_FATAL} "Failed ${exec}: ${_out} | ${_err}")
	ENDIF()
    ENDFOREACH(_l)
ENDMACRO(PO_MAKE)

MACRO(PO_MAKE_VARIABLE_CHECK)
    IF("${pot}" STREQUAL "")
	M_MSG(${M_FATAL} "Requires -D \"pot=<path/project.pot>\"")
    ENDIF()
    IF(NOT EXISTS ${pot})
	M_MSG(${M_FATAL} "Failed to find ${pot}")
    ENDIF()
    PO_MAKE()
ENDMACRO(PO_MAKE_VARIABLE_CHECK)

MACRO(MO_MAKE)
    SET(_gettext_locale_opts "")
    IF(DEFINED system_locales)
	LIST(APPEND _gettext_locale_opts "SYSTEM_LOCALES")
    ELSEIF(NOT "${locales}" STREQUAL "")
	LIST(APPEND _gettext_locale_opts "LOCALES" ${locales})
    ENDIF()
    IF("${mo_dir}" STREQUAL "")
	SET(mo_dir "${po_dir}")
    ENDIF()
    MANAGE_GETTEXT_LOCALES(localeListVar ${_gettext_locale_opts})
    FOREACH(_l ${localeListVar})
	SET(exec "msgfmt" "--locale=${_l}" ${options} -o ${mo_dir}/${_l}.gmo ${po_dir}/${_l}.po)
	EXECUTE_PROCESS(COMMAND ${exec}
	    RESULT_VARIABLE _res
	    OUTPUT_VARIABLE _out
	    ERROR_VARIABLE _err
	    OUTPUT_STRIP_TRAILING_WHITESPACE
	    )
	IF(NOT _res EQUAL 0)
	    M_MSG(${M_FATAL} "Failed ${exec}: ${_out} | ${_err}")
	ENDIF()
    ENDFOREACH(_l)
ENDMACRO(MO_MAKE)

MACRO(MO_MAKE_VARIABLE_CHECK)
    IF("${po_dir}" STREQUAL "")
	M_MSG(${M_FATAL} "Requires -D \"po_dir=<dir>\"")
    ENDIF()
    IF(NOT EXISTS ${po_dir})
	M_MSG(${M_FATAL} "Failed to find ${po_dir}")
    ENDIF()
    MO_MAKE()
ENDMACRO(MO_MAKE_VARIABLE_CHECK)

SET(CMAKE_ALLOW_LOOSE_LOOP_CONSTRUCTS ON)
#######################################
# Determine CMAKE_FEDORA_MODULE_DIR
#

## It is possible that current dir is in NO_PACK/FedPkg/<prj>
LIST(INSERT CMAKE_MODULE_PATH 0
    ${CMAKE_SOURCE_DIR}/Modules ${CMAKE_SOURCE_DIR}/cmake-fedora/Modules
    ${CMAKE_SOURCE_DIR}/../../../Modules
    ${CMAKE_SOURCE_DIR}/../../../cmake-fedora/Modules
    ${CMAKE_SOURCE_DIR}
    )

IF(CMAKE_SCRIPT_MODE_FILE)
    GET_FILENAME_COMPONENT(CMAKE_FEDORA_SCRIPT_DIR ${CMAKE_SCRIPT_MODE_FILE}
	PATH)
    LIST(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_FEDORA_SCRIPT_DIR}")
ENDIF()

IF(cmake_fedora_module_dir)
    LIST(INSERT CMAKE_MODULE_PATH 0 "${cmake_fedora_module_dir}")
ENDIF()

INCLUDE(ManageMessage RESULT_VARIABLE MANAGE_MODULE_PATH)
IF(NOT MANAGE_MODULE_PATH)
    MESSAGE(FATAL_ERROR "ManageMessage.cmake cannot be found in ${CMAKE_MODULE_PATH}")
ENDIF()
GET_FILENAME_COMPONENT(CMAKE_FEDORA_MODULE_DIR
    "${MANAGE_MODULE_PATH}" PATH
    )

INCLUDE(ManageEnvironmentCommon)
INCLUDE(ManageString)
INCLUDE(ManageVariable)
INCLUDE(ManageFile)
INCLUDE(ManageTranslation)

IF(NOT DEFINED cmd)
    MANAGE_GETTEXT_SCRIPT_PRINT_USAGE()
ELSE()
    IF("${cmd}" STREQUAL "pot_make")
	#POT_MAKE_VARIABLE_CHECK()
    ELSEIF("${cmd}" STREQUAL "po_make")
	PO_MAKE_VARIABLE_CHECK()
    ELSEIF("${cmd}" STREQUAL "mo_make")
	MO_MAKE_VARIABLE_CHECK()
    ELSE()
	MANAGE_GETTEXT_SCRIPT_PRINT_USAGE()
	M_MSG(${M_FATAL} "Invalid cmd ${cmd}")
    ENDIF()
ENDIF()


text:
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
		 xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
	<modelVersion>4.0.0</modelVersion>

	<parent>
		<groupId>com.github.swissquote</groupId>
		<artifactId>carnotzet</artifactId>
		<version>1.8.9-SNAPSHOT</version>
	</parent>

	<artifactId>carnotzet-core</artifactId>

	<dependencies>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-api</artifactId>
			<version>1.7.36</version>
		</dependency>
		<dependency>
			<groupId>org.apache.maven.shared</groupId>
			<artifactId>maven-invoker</artifactId>
			<version>3.0.1</version>
		</dependency>
		<dependency>
			<groupId>org.apache.maven</groupId>
			<artifactId>maven-model</artifactId>
			<version>${maven.version}</version>
		</dependency>
		<dependency>
			<groupId>com.google.guava</groupId>
			<artifactId>guava</artifactId>
			<version>31.1-jre</version>
		</dependency>
		<dependency>
			<groupId>org.apache.commons</groupId>
			<artifactId>commons-lang3</artifactId>
			<version>3.12.0</version>
		</dependency>
		<dependency>
			<groupId>commons-io</groupId>
			<artifactId>commons-io</artifactId>
			<version>2.11.0</version>
		</dependency>
		<dependency>
			<groupId>net.lingala.zip4j</groupId>
			<artifactId>zip4j</artifactId>
			<version>2.11.1</version>
		</dependency>
		<dependency>
			<groupId>org.fusesource.jansi</groupId>
			<artifactId>jansi</artifactId>
			<version>2.4.0</version>
		</dependency>
		<dependency>
			<groupId>com.fasterxml.jackson.datatype</groupId>
			<artifactId>jackson-datatype-jsr310</artifactId>
		</dependency>
		<dependency>
			<groupId>net.jodah</groupId>
			<artifactId>failsafe</artifactId>
			<version>2.4.4</version>
		</dependency>
		<dependency>
			<groupId>org.zeroturnaround</groupId>
			<artifactId>zt-exec</artifactId>
			<version>1.12</version>
		</dependency>

		<!-- Tests -->
		<dependency>
			<groupId>junit</groupId>
			<artifactId>junit</artifactId>
			<version>4.13.2</version>
			<scope>test</scope>
		</dependency>
		<dependency>
			<groupId>org.slf4j</groupId>
			<artifactId>slf4j-simple</artifactId>
			<version>1.7.36</version>
			<scope>test</scope>
		</dependency>
	</dependencies>

	<build>
		<resources>
			<resource>
				<directory>src/main/resources</directory>
				<filtering>true</filtering>
			</resource>
		</resources>
		<plugins>
			<plugin>
				<groupId>com.github.spotbugs</groupId>
				<artifactId>spotbugs-maven-plugin</artifactId>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-checkstyle-plugin</artifactId>
			</plugin>
			<plugin>
				<artifactId>maven-javadoc-plugin</artifactId>
			</plugin>
			<plugin>
				<groupId>org.apache.maven.plugins</groupId>
				<artifactId>maven-jar-plugin</artifactId>
				<configuration>
					<archive>
						<manifestEntries>
							<Automatic-Module-Name>com.github.swissquote.carnotzet.core</Automatic-Module-Name>
						</manifestEntries>
					</archive>
				</configuration>
			</plugin>
		</plugins>

	</build>

</project>


text:
module QrcodeMagick
  VERSION = "0.0.1.alpha"
end


text:
package hudson.plugins.warnings.parser;

import hudson.plugins.analysis.util.model.FileAnnotation;
import hudson.plugins.analysis.util.model.Priority;
import org.junit.Test;

import java.io.IOException;
import java.util.Collection;
import java.util.Iterator;

import static org.junit.Assert.assertEquals;

/**
 * Tests the class {@link LinuxKernelOutputParser}.
 * @author Benedikt Spranger
 *
 */
public class LinuxKernelOutputParserTest extends ParserTester {
    private static final String TYPE = new LinuxKernelOutputParser().getGroup();

    /**
     * Parse a kernel log file.
     *
     * @throws IOException
     *      if the file could not be read
     */
    @Test
    public void testWarningsParser() throws IOException {
        Collection<FileAnnotation> warnings = new LinuxKernelOutputParser().parse(openFile());

        assertEquals(WRONG_NUMBER_OF_WARNINGS_DETECTED, 26, warnings.size());

        Iterator<FileAnnotation> iterator = warnings.iterator();
        FileAnnotation annotation = iterator.next();

        checkWarning(annotation,
                     0,
                     "ACPI: RSDP 0x00000000000F68D0 000014 (v00 BOCHS )",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);

        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "ACPI: RSDT 0x0000000007FE18DC 000030 (v01 BOCHS  BXPCRSDT 00000001 BXPC 00000001)",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);

        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "ACPI: FACP 0x0000000007FE17B8 000074 (v01 BOCHS  BXPCFACP 00000001 BXPC 00000001)",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);

        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "ACPI: DSDT 0x0000000007FE0040 001778 (v01 BOCHS  BXPCDSDT 00000001 BXPC 00000001)",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);

        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "ACPI: FACS 0x0000000007FE0000 000040",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);

        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "ACPI: APIC 0x0000000007FE182C 000078 (v01 BOCHS  BXPCAPIC 00000001 BXPC 00000001)",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);

        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "ACPI: HPET 0x0000000007FE18A4 000038 (v01 BOCHS  BXPCHPET 00000001 BXPC 00000001)",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);

        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "ACPI: 1 ACPI AML tables successfully acquired and loaded",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);

        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "kworker/u2:0 (32) used greatest stack depth: 14256 bytes left",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);

        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "kworker/u2:0 (26) used greatest stack depth: 13920 bytes left",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);

        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended PCI configuration space under this bridge.",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);

        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "ACPI: Enabled 3 GPEs in block 00 to 0F",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);

        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "ACPI: PCI Interrupt Link [LNKC] enabled at IRQ 11",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);

        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "mdev (949) used greatest stack depth: 13888 bytes left",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);

        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "KABOOM: kaboom_init: WARNING",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);

        annotation = iterator.next();
        checkWarning(annotation,
                     26,
                     "WARNING in kaboom_init()",
                     "/home/bene/work/rtl/test-description/tmp/linux-stable-rt/drivers/misc/kaboom.c",
                     TYPE, "WARNING", Priority.NORMAL);

        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "KABOOM: kaboom_init: ERR",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);

        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "KABOOM: kaboom_init: CRIT",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);

        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "KABOOM: kaboom_init: ALERT",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);

        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "KABOOM: kaboom_init: EMERG",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);

        annotation = iterator.next();
        checkWarning(annotation,
                     39,
                     "BUG in ()",
                     "/home/bene/work/rtl/test-description/tmp/linux-stable-rt/drivers/misc/kaboom.c",
                     TYPE, "BUG", Priority.HIGH);
        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "sysrq: SysRq : Emergency Sync",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);
        annotation = iterator.next();
        checkWarning(annotation,
                     0,
                     "sysrq: SysRq : Emergency Remount R/O",
                     "Nil",
                     TYPE, "Kernel Output", Priority.LOW);
    }

    @Override
    protected String getWarningsFile() {
        return "kernel.log";
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
  "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

    <title>Python/C API Reference Manual — Python 2.7.12 documentation</title>

    <link rel="stylesheet" href="../_static/classic.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

    <link rel="search" type="application/opensearchdescription+xml"
          title="Search within Python 2.7.12 documentation"
          href="../_static/opensearch.xml"/>
    <link rel="author" title="About these documents" href="../about.html" />
    <link rel="copyright" title="Copyright" href="../copyright.html" />
    <link rel="top" title="Python 2.7.12 documentation" href="../contents.html" />
    <link rel="next" title="Introduction" href="intro.html" />
    <link rel="prev" title="5. Embedding Python in Another Application" href="../extending/embedding.html" />
    <link rel="shortcut icon" type="image/png" href="../_static/py.png" />

Navigation

          index

          modules |

          next |

          previous |

Python »

          2.7.12
          Documentation »

Python/C API Reference Manual¶

This manual documents the API used by C and C++ programmers who want to write
extension modules or embed Python.  It is a companion to Extending and Embedding the Python Interpreter,
which describes the general principles of extension writing but does not
document the API functions in detail.

Introduction

Include Files

Objects, Types and Reference Counts

Exceptions

Embedding Python

Debugging Builds

The Very High Level Layer

Reference Counting

Exception Handling

Unicode Exception Objects

Recursion Control

Standard Exceptions

String Exceptions

Utilities

Operating System Utilities

System Functions

Process Control

Importing Modules

Data marshalling support

Parsing arguments and building values

String conversion and formatting

Reflection

Codec registry and support functions

Abstract Objects Layer

Object Protocol

Number Protocol

Sequence Protocol

Mapping Protocol

Iterator Protocol

Old Buffer Protocol

Concrete Objects Layer

Fundamental Objects

Numeric Objects

Sequence Objects

Mapping Objects

Other Objects

Initialization, Finalization, and Threads

Initializing and finalizing the interpreter

Process-wide parameters

Thread State and the Global Interpreter Lock

Sub-interpreter support

Asynchronous Notifications

Profiling and Tracing

Advanced Debugger Support

Memory Management

Overview

Memory Interface

Examples

Object Implementation Support

Allocating Objects on the Heap

Common Object Structures

Type Objects

Number Object Structures

Mapping Object Structures

Sequence Object Structures

Buffer Object Structures

Supporting Cyclic Garbage Collection

Previous topic

5. Embedding Python in Another Application

Next topic

Introduction

This Page

Report a Bug

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

    Enter search terms or a module, class or function name.

Navigation

          index

          modules |

          next |

          previous |

Python »

          2.7.12
          Documentation »

    © Copyright 1990-2016, Python Software Foundation.

    The Python Software Foundation is a non-profit corporation.
    Please donate.

    Last updated on Jun 25, 2016.
    Found a bug?

    Created using Sphinx 1.3.3.


text:
__version__ = '0.2.1'
__all__ = ('SendlibError', 'ParseError', 'parse', '__version__')

import codecs
import os
import re
import struct

PREFIX = {
    'str': 'S',
    'int': 'I',
    'float': 'F',
    'bool': 'B',
    'data': 'D',
    'nil': 'N',
    'message': 'M',
}
RPREFIX = dict((v, k) for k, v in PREFIX.items())
LIST_PREFIX = 'L'

class SendlibError(Exception): pass
class ParseError(SendlibError): pass

# a special marker, distinct from None
class Nothing(object):
    def __repr__(self):
        return 'Nothing'
Nothing = Nothing()

def typename(obj):
    if obj is None:
        return 'nil'
    elif isinstance(obj, Message):
        return 'msg (%s, %d)' % (obj.name, obj.version)
    return str(type(obj).__name__)

class Writer(object):
    """
    A :class:`Writer` is bound to a specific stream and
    :class:`Message`, and maintains internal state for writing
    a single instance of that message to the stream.

    You ordinarily obtain a :class:`Writer` instance by calling
    :meth:`Message.writer` on a :class:`Message` instance, not
    by directly constructing one.
    """

    __slots__ = ('message', 'stream', '_pos')
    def __init__(self, message, stream):
        self.message = message
        self.stream = stream
        self._pos = -1

    def _check_str(self, value):
        return type(value) in (str, unicode)

    def _check_int(self, value):
        return type(value) in (int, long)

    def _check_bool(self, value):
        return type(value) == bool

    def _check_float(self, value):
        return type(value) == float

    def _check_nil(self, value):
        return value is None

    def _check_data(self, value):
        r = hasattr(value, 'read') and callable(value.read)
        s = hasattr(value, 'seek') and callable(value.seek)
        t = hasattr(value, 'tell') and callable(value.tell)
        if not (r and s and t):
            return False
        value.seek(0, os.SEEK_END)
        length = value.tell()
        if length > 4294967295:
            raise SendlibError(
                'data length must be less than 4294967295 bytes')
        return True

    def _check(self, fieldname, value):
        pos = max(0, self._pos)
        if pos >= len(self.message.fields):
            raise SendlibError('attempt to write past end of message')
        field = self.message.fields[pos]
        if fieldname != field.name:
            if 'nil' in field.types:
                # FIXME: this is shady, a method named
                # _check should not write anything
                self._write_nil(None)
                self._pos += 1
                return self._check(fieldname, value)
            raise SendlibError(
                'Attempting to access field "%s", but should be "%s"' %
                (fieldname, field.name))
        if type(value) in (tuple, list):
            return self._check_list(field, value)
        elif value == Nothing or \
             type(value) in (str, unicode) and _msg.match(value) or \
             isinstance(value, Message):
            return self._check_msg(field, value)
        for type_name in field.types:
            if _msg.match(type_name):
                continue
            if _many.match(type_name):
                continue
            checker = getattr(self, '_check_' + type_name)
            result = checker(value)
            if result:
                return type_name
        raise SendlibError(
            '%s does not match field spec "%s"' % (repr(value), field.spec))

    def _check_list(self, field, sequence):
        # make sure the sequence has all
        # of the same type
        if len(sequence) == 0:
            return 'list'
        types_found = set()
        for item in sequence:
            types_found.add(typename(item))
        if len(types_found) > 1:
            raise SendlibError(
                'sequence arguments to write must contain elements of '
                'compatible types, found %s' % list(types_found))
        inner_type = types_found.pop()
        many_type = 'many ' + inner_type

        for type_name in field.types:
            if not _many.match(type_name):
                continue
            if many_type == type_name:
                return 'list'
        # not sure we can get here
        raise SendlibError(
            '%s does not match field spec "%s"' % (repr(sequence), field.spec))

    def _check_msg(self, field, value):
        # ensure that value is one of the messages,
        # or if value is Nothing, that there's only
        # one message type for this field
        if isinstance(value, Message):
            value = 'msg (%s, %s)' % (value.name, value.version)
        if type(value) in (str, unicode):
            m = _msg.match(value)
            if not m:
                raise SendlibError('value should be (message_name, version)')
            msg = self.message.registry.get_message(
                m.group(1), int(m.group(2)))
            if not msg:
                raise SendlibError(
                    'unknown message (%s, %s)' % (m.group(1), m.group(2)))
            type_name = 'msg (%s, %s)' % (m.group(1), m.group(2))
            if type_name not in field.types:
                raise SendlibError(
                    'message (%s, %s) not valid for field %s' %
                    (m.group(1), m.group(2)), field.name)
            return 'msg'
        elif value == Nothing:
            num = len([t for t in field.types if _msg.match(t)])
            if num == 0:
                raise SendlibError(
                    'messages not valid for field %s' % field.name)
            elif num > 1:
                raise SendlibError(
                    'more than one message valid for field %s' % field.name)
            return 'msg'

    def _write_str(self, value):
        value = codecs.encode(value, 'utf-8')
        self.stream.write(PREFIX['str'])
        self.stream.write(struct.pack('>L', len(value)))
        self.stream.write(value)

    def _write_int(self, value):
        self.stream.write(PREFIX['int'])
        self.stream.write(struct.pack('>L', value))

    def _write_bool(self, value):
        self.stream.write(PREFIX['bool'])
        self.stream.write('t' if value else 'f')

    def _write_nil(self, value):
        self.stream.write(PREFIX['nil'])

    def _write_float(self, value):
        self.stream.write(PREFIX['float'])
        self.stream.write(struct.pack('>d', value))

    def _write_data(self, value):
        value.seek(0, os.SEEK_END)
        length = value.tell()
        value.seek(0, 0)

        self.stream.write(PREFIX['data'])
        self.stream.write(struct.pack('>L', length))

        sofar = 0
        size = 256 * 1024
        while sofar < length:
            amount = min(size, (length - sofar))
            buf = value.read(amount)
            self.stream.write(buf)
            sofar += len(buf)

    def _write_msg(self, value):
        field = self.message.fields[self._pos]
        if isinstance(value, Message):
            value = 'msg (%s, %s)' % (value.name, value.version)
        if type(value) in (str, unicode):
            m = _msg.match(value)
            message = self.message.registry.get_message(
                m.group(1), int(m.group(2)))
        elif value is Nothing:
            # assume exactly one Message in types
            m = tuple(t for t in field.types if _msg.match(t))[0]
            m = _msg.match(m)
            message = self.message.registry.get_message(
                m.group(1), int(m.group(2)))
        writer = message.writer(self.stream)
        return writer

    def _write_list(self, value):
        self.stream.write('L')
        self.stream.write(struct.pack('>L', len(value)))
        if len(value):
            inner_type = typename(value[0])
            if _msg.match(inner_type):
                writer = self._write_msg
            else:
                writer = getattr(self, '_write_' + inner_type)
            out = []
            for item in value:
                out.append(writer(item))
            return tuple(out)
        else:
            return ()

    def write(self, fieldname, value=Nothing):
        """
        Write the `value` to the stream, after verifying that
        `fieldname` is the correct next field in the message
        format. `value` defaults to :class:`Nothing`, which is
        distinct from :class:`None`, as :class:`None` is a valid
        value which may be written (when a field is ``or nil``).

        When writing ``many`` fields, `value` should be a list
        or tuple; if not, the single value will be written for
        the field and future writes to that field will fail.

        If a field other than `fieldname` should be written,
        unless all preceding unwritten fields are ``or nil``,
        raise :class:`SendlibError`.

        Returns :class:`None`, except when writing a nested
        :class:`Message`, in which case a new
        :class:`Writer` is returned.
        """
        type = self._check(fieldname, value)
        if self._pos == -1:
            # write header
            self.stream.write('M')
            self._write_str(self.message.name)
            self._write_int(self.message.version)
            self._pos = 0

        writer = getattr(self, '_write_' + type)
        out = writer(value)
        self._pos += 1
        return out

    def flush(self):
        self.stream.flush()

class Data(object):
    """
    :class:`Data` is a limited file-like object for reading
    ``data`` elements from message streams. In particular,
    it does not support :meth:`seek`, as ``sendblib`` does
    not require that the underlying stream support full
    bi-directional seeking.
    """
    __slots__ = ('length', 'stream', '_pos')
    def __init__(self, length, stream):
        self.length = length
        self.stream = stream
        self._pos = 0

    def read(self, size=None):
        """
        Read at most `size` bytes of data from the underlying
        stream. If `size` bytes are not available, return as
        many as are available. If past the end of the stream,
        return an empty string.
        """
        if self._pos >= self.length:
            return ''
        if size:
            amount = min(size, (self.length - self._pos))
        else:
            amount = self.length - self._pos
        out = self.stream.read(amount)
        self._pos += len(out)
        return out

    def readline(self, size=None):
        """
        Read a line from the stream, including the trailing
        new line character. If `size` is set, don't read more
        than `size` bytes, even if the result does not represent
        a complete line.

        The last line read may not include a trailing new line
        character if one was not present in the underlying stream.
        """
        if self._pos >= self.length:
            return ''
        if size:
            amount = min(size, (self.length - self._pos))
        else:
            amount = self.length - self._pos
        out = self.stream.readline(amount)
        self._pos += len(out)
        return out

    def skip(self):
        """
        Advance the internal pointer to the end of the data
        area in the stream. This allows the next call to
        :meth:`Reader.read` to succeed, as though all the
        data had been read by the application.
        """
        self.stream.seek(self.bytes_remaining(), os.SEEK_CUR)
        self._pos = self.length

    def bytes_remaining(self):
        """
        Return the number of bytes remaining.
        """
        return self.length - self._pos

class Reader(object):
    """
    A :class:`Reader` is bound to a specific stream and
    :class:`Message`, and maintains internal state for
    reading a single instance of that message from the
    stream.

    You ordinarily obtain a :class:`Reader` instance by
    calling :meth:`Message.reader` on a :class:`Message`
    instance, not by directly constructing one.
    """

    __slots__ = ('message', 'stream', '_pos', '_data', '_peek')
    def __init__(self, message, stream):
        self.message = message
        self.stream = stream
        self._pos = -1
        self._data = None
        self._peek = None

    def _check(self, fieldname):
        pos = max(0, self._pos)
        field = self.message.fields[pos]
        if field.name != fieldname:
            raise SendlibError(
                'Attempting to access field "%s", but should be "%s"' %
                (fieldname, field.name))
        try:
            type = RPREFIX[self._peek]
        except KeyError:
            raise SendlibError('unknown field prefix "%s"' % self._peek)
        if type in field.types:
            return type
        raise SendlibError(
            'field type "%s" incorrect for field %s' % (type, field))

    def _read_str(self):
        length = self._read_int()
        parts = []
        sofar = 0
        while sofar < length:
            amount = min(2048, (length - sofar))
            buf = self.stream.read(amount)
            sofar += len(buf)
            parts.append(unicode(buf, 'utf-8'))
        return u''.join(parts)

    def _read_int(self):
        return struct.unpack('>L', self.stream.read(struct.calcsize('>L')))[0]

    def _read_bool(self):
        return self.stream.read(1) == 't'

    def _read_nil(self):
        return None

    def _read_float(self):
        return struct.unpack('>d', self.stream.read(struct.calcsize('>d')))[0]

    def _read_data(self):
        length = self._read_int()
        self._data = Data(length, self.stream)
        return self._data

    def read(self, fieldname):
        """
        Read the next field from the stream. `fieldname` is used
        to verify that your application logic matches the message
        field order, and if `fieldname` does not match the next
        field in the message definition, :class:`SendlibError`
        is raised.

        Returns a Python object of the correct type, depending on
        the type present in the stream. If the type is ``data``,
        returns a :class:`Data` file-like object.
        """
        if self._pos == -1:
            self._pos = 0
            if PREFIX['message'] != self.stream.read(1):
                raise SendlibError('Invalid message format')
            if PREFIX['str'] != self.stream.read(1):
                raise SendlibError('Invalid message format')
            name = self._read_str()
            if PREFIX['int'] != self.stream.read(1):
                raise SendlibError('Invalid message format')
            version = self._read_int()
            if name != self.message.name or version != self.message.version:
                raise SendlibError(
                    'Reader for %s cannot read message of type (%s, %d)'
                    % (self.message, name, version))

        if self._data is not None:
            if self._data.bytes_remaining() == 0:
                self._data = None
            else:
                raise Exception('cannot read field, cursor still on data')

        if self._peek is None:
            self._peek = self.stream.read(1)
        typename = self._check(fieldname)
        reader = getattr(self, '_read_' + typename)
        value = reader()
        self._pos += 1
        self._peek = None
        return value

_or = re.compile(r'\s*or\s*')
_msg = re.compile(r'msg\s*\(\s*(\w+),\s*(\d+)\s*\)')
_many = re.compile(r'many\s+(.+?)\s*$')
class Field(object):
    """
    :class:`Field` contains the definition of a single field.

    .. py:attribute:: message

       The :class:`Message` to which this Field belongs

    .. py:attribute:: name

       The name of the :class:`Field`

    .. py:attribute:: types

       :class:`tuple` of type specifiers for this :class:`Field`,
       which may include references to :class:`Message` instances,
       if this :class:`Field` is a nested message field.
    """

    __slots__ = ('message', 'name', 'types', 'spec')
    def __init__(self, message, name, types):
        self.message = message
        self.name = name
        self.spec = types
        self.types = []
        for type in _or.split(types):
            do_many = False
            many = _many.match(type)
            if many:
                type = many.group(1)
                do_many = True

            msgref = _msg.match(type)
            if msgref:
                submsg = self.message.registry.get_message(
                    msgref.group(1),
                    int(msgref.group(2))
                )
                if not submsg:
                    raise ParseError(
                        'unknown referenced message "%s"' %
                        repr((msgref.group(1), int(msgref.group(2)))))

                type = 'msg (%s, %d)' % (submsg.name, submsg.version)
            elif type not in PREFIX:
                raise ParseError('unknown field type "%s"' % type)

            if do_many:
                self.types.append('many ' + type)
            else:
                self.types.append(type)
        self.types = tuple(self.types)

    def __repr__(self):
        return 'Field(%s, %s)' % (repr(self.name), self.types)

class Message(object):
    """
    :class:`Message` contains the definition of a single
    message. `name` is the message name, `version` is the message
    version, and `fields` is a tuple of :class:`Field`
    objects.

    .. py:attribute:: registry

       The :class:`MessageRegistry` that contains this message

    .. py:attribute:: name

       The name of the message

    .. py:attribute:: version

       The version of the message

    .. py:attribute:: fields

       :class:`tuple` of :class:`Field`
    """

    __slots__ = ('registry', 'name', 'version', 'fields')
    def __init__(self, registry, name, version, fields):
        self.registry = registry
        self.name = name
        self.version = version
        self.fields = fields

    def __repr__(self):
        return 'Message(%s, %s, %s)' % (repr(self.name),
                                        self.version,
                                        self.fields)

    def __eq__(self, other):
        return isinstance(other, Message) and \
               self.registry == other.registry and \
               self.name == other.name and \
               self.version == other.version

    def reader(self, in_stream):
        """
        Return a :class:`Reader` object which reads
        messages of this format from `in_stream`. `in_stream`
        must have a ``read(size)`` method.
        """
        return Reader(self, in_stream)

    def writer(self, out_stream):
        """
        Return a :class:`Writer` object which writes
        messages of this format to `out_stream`. `out_stream`
        must have a ``write(str)`` method.
        """
        return Writer(self, out_stream)

class MessageRegistry(object):
    """
    :class:`MessageRegistry` contains the definition of one or
    more messages, and is the main interface for receiving and
    sending messages.
    """

    __slots__ = ('messages', )
    def __init__(self, messages):
        self.messages = messages

    def __getitem__(self, key):
        """
        Retrieve the :class:`Message` whose name and version match
        the given key. `key` is a tuple of ``(name, version)``.
        Raises :class:`KeyError` if no such message exists.
        """
        return self.messages[key]

    def get_message(self, name, version=1):
        """
        Retrieve the :class:`Message` whose name and version match
        `name` and `version`, or return ``None`` if no such
        message exists.
        """
        try:
            return self[(name, version)]
        except KeyError:
            return None

def parse(schema):
    """
    Parse `schema`, either a string or a file-like object, and
    return a :class:`MessageRegistry` with the loaded messages.
    """
    if not isinstance(schema, basestring):
        # assume it is file-like
        schema = schema.read()

    message = re.compile(r'^\(([^,]+),\s*(\d+)\):\s*$')
    field = re.compile(r'^-\s*([^:]+):\s+(.+?)\s*$')

    registry = MessageRegistry({})
    messages = registry.messages
    curr = None
    names = None
    for lineno, line in enumerate(schema.split('\n')):
        line = line.strip()
        if '#' in line:
            line = line[:line.index('#')]
        if line == '':
            continue

        f = field.match(line)
        if f:
            if curr is None:
                raise ParseError(
                    'field definition outside of message at line %d' % lineno)
            name = f.group(1)
            type = f.group(2)
            if name not in names:
                f = Field(curr, name, type)
                curr.fields.append(f)
                names.add(name)
                continue
            else:
                raise ParseError(
                    'duplicate field name "%s" at line %d' % (name, lineno))

        m = message.match(line)
        if m:
            # new message definition
            name, vers = m.group(1), int(m.group(2))
            if (name, vers) in messages:
                raise ParseError('Duplicate message (%s, %d)' % (name, vers))
            curr = messages[(name, vers)] = Message(registry, name, vers, [])
            names = set()
            continue

    for message in registry.messages.values():
        message.fields = tuple(message.fields)

    return registry


text:
<?php

namespace EB\PretControleurBundle\Form;

use Symfony\Component\Form\AbstractType;
use Symfony\Component\Form\FormBuilderInterface;
use Symfony\Component\OptionsResolver\OptionsResolverInterface;

class EditCentreType extends AbstractType
{
    /**
     * @param FormBuilderInterface $builder
     * @param array $options
     */
    public function buildForm(FormBuilderInterface $builder, array $options)
    {
        $builder
            ->add('siret','text', array('max_length' => 14))
            ->add('nom',         'text')
            ->add('telephone',   'text', array('max_length' => 10))
            ->add('email',       'text')
            ->add('numAgrement', 'text', array('max_length' => 8))
           // ->add('dateAgrement','date', array('widget' => 'single_text','format' => 'yyyy-MM-dd',))
            ->add('dateAgrement','date',array('widget' => 'single_text','format' => 'dd-MM-yyyy','attr' => array('class' => 'date')))
            //->add('dateCreation','date', array('widget' => 'single_text','format' => 'yyyy-MM-dd',))
            ->add('dateCreation','date',array('widget' => 'single_text','format' => 'dd-MM-yyyy','attr' => array('class' => 'date')))
            ->add('adresse',      new AdresseType())
            ->add('attestationAgrement',  new FichierType(),array('required' => false))
            ->add('Enregistrer',        'submit')
        ;
    }

    /**
     * @param OptionsResolverInterface $resolver
     */
    public function setDefaultOptions(OptionsResolverInterface $resolver)
    {
        $resolver->setDefaults(array(
            'data_class' => 'EB\PretControleurBundle\Entity\Centre'
        ));
    }

    /**
     * @return string
     */
    public function getName()
    {
        return 'eb_pretcontroleurbundle_edit_centre';
    }
}


text:
package sample.metrics.opentsdb;

import org.junit.Test;
import org.junit.runner.RunWith;

import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.WebIntegrationTest;
import org.springframework.test.annotation.DirtiesContext;
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;

/**
 * Basic integration tests for {@link SampleOpenTsdbExportApplication}.
 *
 * @author Dave Syer
 */
@RunWith(SpringJUnit4ClassRunner.class)
@SpringApplicationConfiguration(SampleOpenTsdbExportApplication.class)
@WebIntegrationTest(randomPort = true)
@DirtiesContext
public class SampleOpenTsdbExportApplicationTests {

	@Test
	public void contextLoads() {

	}

}


text:
@interface HIKeychain : NSObject

+ (BOOL)setObject:(id)object forKey:(id)key;

+ (id)objectForKey:(id)key;

+ (BOOL)removeObjectForKey:(id)key;

@end


text:
/* ###
 * IP: GHIDRA
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *      http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package ghidra.util.table.field;

import ghidra.docking.settings.BooleanSettingsDefinition;
import ghidra.docking.settings.Settings;

public class FunctionNoReturnSettingsDefinition implements BooleanSettingsDefinition {

	public static final FunctionNoReturnSettingsDefinition DEF =
		new FunctionNoReturnSettingsDefinition();

	private static final String NORETURN = "Show noreturn";
	private static final String NAME = NORETURN;
	private static final String DESCRIPTION =
		"On siganls to show the noreturn " + "function attribute when present";
	private static final boolean DEFAULT = false;

	@Override
	public boolean getValue(Settings settings) {
		if (settings == null) {
			return DEFAULT;
		}
		String value = settings.getString(NORETURN);
		if (value == null) {
			return DEFAULT;
		}
		return Boolean.parseBoolean(value);
	}

	@Override
	public String getValueString(Settings settings) {
		return Boolean.toString(getValue(settings));
	}

	@Override
	public void setValue(Settings settings, boolean value) {
		settings.setString(NORETURN, Boolean.toString(value));
	}

	@Override
	public void copySetting(Settings srcSettings, Settings destSettings) {
		String value = srcSettings.getString(NORETURN);
		if (value == null) {
			destSettings.clearSetting(NORETURN);
		}
		else {
			destSettings.setString(NORETURN, value);
		}
	}

	@Override
	public void clear(Settings settings) {
		settings.clearSetting(NORETURN);
	}

	@Override
	public String getDescription() {
		return DESCRIPTION;
	}

	@Override
	public String getName() {
		return NAME;
	}

	@Override
	public String getStorageKey() {
		return NORETURN;
	}

	@Override
	public boolean hasValue(Settings settings) {
		return settings.getValue(NORETURN) != null;
	}
}


text:
#ifndef _HIERARCHICAL_MULTILABEL_MODEL__H__
#define _HIERARCHICAL_MULTILABEL_MODEL__H__

#include <shogun/lib/config.h>
#include <shogun/structure/StructuredModel.h>

namespace shogun
{

/** @brief Class CHierarchicalMultilabelModel represents application specific
 * model and contains application dependent logic for solving hierarchical
 * multilabel classification[1] within a generic SO framework.
 *
 * [1] Lijuan Cai. Multilabel Classification over Category Taxonomies
 *     http://cs.brown.edu/research/pubs/theses/phd/2008/cai.pdf
 *
 * [2] Wei Bi, et.al. Mandatory Leaf Node Prediction in Hierarchical
 *     Multilabel Classification
 *     http://papers.nips.cc/paper/4520-mandatory-leaf-node-prediction-in-hierarchical-multilabel-classification.pdf
 */
class CHierarchicalMultilabelModel : public CStructuredModel
{
public:
	/** default constructor */
	CHierarchicalMultilabelModel();

	/** constructor
	 *
	 * @param features features
	 * @param labels structured labels
	 * @param taxonomy taxonomy is stored in an integer array with:
	 * - length of array = number of nodes
	 * - each element storing only its parent-id taxonomy[node-id] = parent-id
	 * - root node should store its parent-id as -1
	 * @param leaf_nodes_mandatory whether only full paths (from ROOT to
	 * TERMINAL NODES) are only allowed or not
	 * class or not
	 */
	CHierarchicalMultilabelModel(CFeatures * features, CStructuredLabels * labels,
	                             SGVector<int32_t> taxonomy, bool leaf_nodes_mandatory = false);

	/** destructor */
	virtual ~CHierarchicalMultilabelModel();

	/** create empty StructuredLabels object */
	virtual CStructuredLabels * structured_labels_factory(int32_t num_labels = 0);

	/** @return the dimensionality of the joint feature space, i.e., the
	 * dimension of the weight vector \f$w\f$.
	 */
	virtual int32_t get_dim() const;

	/** get joint feature vector
	 *
	 * \f[
	 * \vec{\Psi}(\bf{x}_\text{feat\_idx}, \bf{y})
	 * \f]
	 *
	 * @param feat_idx index of the feature vector to use
	 * @param y structured labels to use
	 *
	 * @return joint feature vector
	 */
	virtual SGVector<float64_t> get_joint_feature_vector(int32_t feat_idx,
	                CStructuredData * y);

	/** obtain the argmax of
	 *
	 * \f[
	 * \Delta(y_{pred}, y_{truth}) + \langle w, \Psi(x_{truth}, y_{pred} \rangle
	 * \f]
	 *
	 * @param w weight vector
	 * @param feat_idx index of the feature vector to use
	 * @param training whether training is being used
	 */
	virtual CResultSet * argmax(SGVector<float64_t> w, int32_t feat_idx,
	                            bool const training = true);

	/** computes \f$ \Delta(y_{1}, y_{2}) \f$
	 *
	 * @param y1 an instance of structured data
	 * @param y2 another instance of structured data
	 *
	 * @return loss value
	 */
	virtual float64_t delta_loss(CStructuredData * y1, CStructuredData * y2);

	/** initialize the optimization problem
	 *
	 * @param regularization regularization strength
	 * @param A is [-dPsi(y) | -I_N ] with M+N columns => max, M+1 nnz per row
	 * @param a unused input
	 * @param B unused input
	 * @param b upper bound of the constraints, Ax <= b
	 * @param lb lower bounds for w
	 * @param ub upper bounds for w
	 * @param C regularization matrix, w'Cw
	 */
	virtual void init_primal_opt(
	        float64_t regularization,
	        SGMatrix<float64_t> &A,
	        SGVector<float64_t> a,
	        SGMatrix<float64_t> B,
	        SGVector<float64_t> &b,
	        SGVector<float64_t> &lb,
	        SGVector<float64_t> &ub,
	        SGMatrix<float64_t> &C);

	/** @return name of the SGSerializable */
	virtual const char * get_name() const
	{
		return "HierarchicalMultilabelModel";
	}

private:
	int32_t m_num_classes;
	SGVector<int32_t> m_taxonomy;
	bool m_leaf_nodes_mandatory;
	int32_t m_root;
	// array for vectors storing the node-ids of the children
	// m_children[node_id] = vector of node_ids of the children
	//                     = empty vector, if node is a terminal node
	SGVector<int32_t> * m_children;

private:
	void init(SGVector<int32_t> taxonomy, bool leaf_nodes_mandatory);

	/** different versions of delta loss function */
	float64_t delta_loss(SGVector<int32_t> y1, SGVector<int32_t> y2);
	float64_t delta_loss(int32_t y1, int32_t y2);

	/** get the label vector for any label
	 * the label vector would be vector with value 1 for all the nodes
	 * that are ancestor of the given labels else 0
	 *
	 * @return label vector
	 */
	SGVector<int32_t> get_label_vector(SGVector<int32_t> sparse_label);

}; /* class CHierarchicalMultilabelModel */

} /* namespace shogun */

#endif /* _HIERARCHICAL_MULTILABEL_MODEL__H__ */


text:
实现 Modbus 协议

可以通过 `local lmodbus = require('lmodbus')` 引入这个模块

## lmodbus

### lmodbus.version

> local version = lmodbus.version()

返回 libmodbus 的版本号

### lmodbus.new

> local devcie = lmodbus.new(host, port)
> local devcie = lmodbus.new(name, baudrate, parity, dataBits, stopBits)

打开一个新的 ModbusDevice 设备

- host `{string}` IP 地址
- port `{integer}` 端口
- name `{string}` 串口设备名称
- baudrate `{integer}` 波特率
- parity `{integer}` 校验方式
- dataBits `{integer}` 数据位
- stopBits `{integer}` 停止位

## ModbusDevice 类

### close

> device:close()

关闭这个设备

### connect

> device:connect()

开始连接

### getFD

> local fd = device:getFD()

返回打开的 UART 设备的文件描述符

### listen

> device:listen()

开始侦听请求

### newMapping

> device:newMapping(address, count)

创建新的映射寄存器

- address `{integer}` 开始的地址
- count `{integer}` 总共的寄存器数量

### read

> local values = device:read(addresses)

读取多个寄存器

- addresses `{array of integer}`

### readRegisters

> local values = device:readRegisters(address, count)

读多个寄存器

- address `{integer}` 开始读取的地址
- count `{integer}` 总共读取的数量

### readBits

> local values device:readBits(address, count)

读取多位

- address `{integer}` 开始读取的地址
- count `{integer}` 总共读取的位数

### receive

> device:receive()

接收客户端请求并返回应答

### setMappingValue

> device:setMappingValue(type, address, value)

设置映射寄存器的值

- type `{integer}` 寄存器类型
- address `{integer}` 寄存器地址
- value `{integer}` 要写入的值

### setSlave

> device:setSlave(slave)

设置从机地址

- slave `{integer}` 从机地址

### write

> device:write(values)

写入多个值

- values 要写入的值

### writeBit

> device:writeBit(address, value)

写入一位

- address `{integer}` 开始写入的地址
- value `{integer}` 要写入的值

### writeRegister

> device:writeRegister(address, value)

写寄存器

- address `{integer}` 开始写入的地址
- value `{integer}` 要写入的值

## modbus/common

### common.combineReadQueue

> common.combineReadQueue(properties)

合并连续的 Modbus 属性读操作

- properties`ModbusProperty[]` 要读取的 Modbus 属性
- 返回 `ModbusReadItem[]` 返回合并后的读序列

### common.encodePropertyValue

> common.encodePropertyValue(property)

编码指定的属性值

- property `ModbusProperty` Modbus 属性
- 返回 `string` 返回编码后的数据

### common.getActionConfig

Modbus 操作配置参数

### common.getModbusCommonConfig

Modbus 公共配置参数

### common.getModbusConfig

Modbus 配置参数

### common.getPropertyConfig

Modbus 属性配置参数

### common.parseNumberValue

> parseNumberValue(value, property)

解析数据类属性值

### common.parsePropertyValue

> common.parsePropertyValue(property, buffer)

解析指定的属性的值

- property `ModbusProperty` Modbus 属性
- buffer `string` Modbus 寄存器数据
- 返回 `number|integer` 解析后的数值

### common.parsePropertyValues

> common.parsePropertyValues(properties, buffer, params)

解析多个属性的值

- properties`ModbusProperty[]` Modbus 属性
- buffer `string` Modbus 寄存器数据
- 返回 `table<string, number>` 解析后的数值

## modbus/master

### master.openDevice

> master.openDevice(options)

打开 Modbus 设备

### master.closeDevice

> master.closeDevice()

关闭 Modbus 设备

### master.readRegisters

> master.readRegisters(register, quantity)

读取多个连续的 Modbus 寄存器的值

### master.readPropertyValue

> master.readPropertyValue(property, commonConfig)

读取单个 Modbus 寄存器的值

### master.readConterminousPropertyValues

> master.readConterminousPropertyValues(readOptions, properties, commonConfig)

读取多个连续的属性的值

### master.readPropertyValues

> master.readPropertyValues(options)

读取多个属性的值

### master.writeRegister

> master.writeRegister(register, value)

写单个 Modbus 寄存器的值

### master.writeRegisters

> master.writeRegisters(register, quantity, value)

写多个连续的 Modbus 寄存器的值

### master.writePropertyValue

> master.writePropertyValue(property, commonConfig)

写单个属性的值

- property 属性
- commonConfig 公共参数

### master.writePropertyValues

> master.writePropertyValues(options)

写多个属性的值

- options 选项
  - common 公共参数
  - properties 属性列表

### master.start

> master.start()

初始化这个模块

## modbus


text:
package org.python.types;

public class Bool extends org.python.types.Object {
    public boolean value;
    public static org.python.Object TRUE = new org.python.types.Bool(true);
    public static org.python.Object FALSE = new org.python.types.Bool(false);

    /**
     * A utility method to update the internal value of this object.
     *
     * Used by __i*__ operations to do an in-place operation.
     * obj must be of type org.python.types.Bool
     */
    void setValue(org.python.Object obj) {
        this.value = ((org.python.types.Bool) obj).value;
    }

    public java.lang.Object toJava() {
        return this.value;
    }

    public org.python.Object byValue() {
        return new org.python.types.Bool(this.value);
    }

    public int hashCode() {
        return new java.lang.Boolean(this.value).hashCode();
    }

    public Bool(boolean bool) {
        super();
        this.value = bool;
    }

    public Bool(long int_val) {
        super();
        this.value = int_val != 0;
    }

    @org.python.Method(
            __doc__ = "bool(x) -> bool" +
                    "\n" +
                    "Returns True when the argument x is true, False otherwise.\n" +
                    "The builtins True and False are the only two instances of the class bool.\n" +
                    "The class bool is a subclass of the class int, and cannot be subclassed.\n",
            default_args = {"x"}
    )
    public Bool(org.python.Object[] args, java.util.Map<java.lang.String, org.python.Object> kwargs) {
        if (args[0] == null) {
            this.value = false;
        } else {
            try {
                this.value = ((org.python.types.Bool) args[0].__bool__()).value;
            } catch (org.python.exceptions.AttributeError ae) {
                try {
                    this.value = ((org.python.types.Int) args[0].__len__()).value != 0;
                } catch (org.python.exceptions.AttributeError ae2) {
                    this.value = true;
                }
            }
        }
    }
    // public org.python.Object __new__() {
    //     throw new org.python.exceptions.NotImplementedError("bool.__new__() has not been implemented.");
    // }

    // public org.python.Object __init__() {
    //     throw new org.python.exceptions.NotImplementedError("bool.__init__() has not been implemented.");
    // }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.types.Str __repr__() {
        if (this.value) {
            return new org.python.types.Str("True");
        } else {
            return new org.python.types.Str("False");
        }
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.types.Str __format__(org.python.Object format_string) {
        throw new org.python.exceptions.NotImplementedError("bool.__format__ has not been implemented.");
    }

    @org.python.Method(
            __doc__ = "",
            args = {"other"}
    )
    public org.python.Object __lt__(org.python.Object other) {
        if (other instanceof org.python.types.Int) {
            return new org.python.types.Bool((((org.python.types.Bool) this).value ? 1 : 0) < ((org.python.types.Int) other).value);
        } else if (other instanceof org.python.types.Bool) {
            return new org.python.types.Bool((((org.python.types.Bool) this).value ? 1 : 0) < (((org.python.types.Bool) other).value ? 1 : 0));
        }
        return org.python.types.NotImplementedType.NOT_IMPLEMENTED;
    }

    @org.python.Method(
            __doc__ = "",
            args = {"other"}
    )
    public org.python.Object __le__(org.python.Object other) {
        if (other instanceof org.python.types.Int) {
            return new org.python.types.Bool((((org.python.types.Bool) this).value ? 1 : 0) <= ((org.python.types.Int) other).value);
        } else if (other instanceof org.python.types.Bool) {
            return new org.python.types.Bool((((org.python.types.Bool) this).value ? 1 : 0) <= (((org.python.types.Bool) other).value ? 1 : 0));
        }
        return org.python.types.NotImplementedType.NOT_IMPLEMENTED;
    }

    @org.python.Method(
            __doc__ = "",
            args = {"other"}
    )
    public org.python.Object __eq__(org.python.Object other) {
        if (other instanceof org.python.types.Int) {
            return new org.python.types.Bool((((org.python.types.Bool) this).value ? 1 : 0) == ((org.python.types.Int) other).value);
        } else if (other instanceof org.python.types.Bool) {
            return new org.python.types.Bool((((org.python.types.Bool) this).value ? 1 : 0) == (((org.python.types.Bool) other).value ? 1 : 0));
        }
        return org.python.types.NotImplementedType.NOT_IMPLEMENTED;
    }

    @org.python.Method(
            __doc__ = "",
            args = {"other"}
    )
    public org.python.Object __gt__(org.python.Object other) {
        if (other instanceof org.python.types.Int) {
            return new org.python.types.Bool((((org.python.types.Bool) this).value ? 1 : 0) > ((org.python.types.Int) other).value);
        } else if (other instanceof org.python.types.Bool) {
            return new org.python.types.Bool((((org.python.types.Bool) this).value ? 1 : 0) > (((org.python.types.Bool) other).value ? 1 : 0));
        }
        return org.python.types.NotImplementedType.NOT_IMPLEMENTED;
    }

    @org.python.Method(
            __doc__ = "",
            args = {"other"}
    )
    public org.python.Object __ge__(org.python.Object other) {
        if (other instanceof org.python.types.Int) {
            return new org.python.types.Bool((((org.python.types.Bool) this).value ? 1 : 0) >= ((org.python.types.Int) other).value);
        } else if (other instanceof org.python.types.Bool) {
            return new org.python.types.Bool((((org.python.types.Bool) this).value ? 1 : 0) >= (((org.python.types.Bool) other).value ? 1 : 0));
        }
        return org.python.types.NotImplementedType.NOT_IMPLEMENTED;
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.types.Bool __bool__() {
        return new org.python.types.Bool(this.value);
    }

    public boolean __setattr_null(java.lang.String name, org.python.Object value) {
        // Builtin types can't have attributes set on them.
        return false;
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.types.List __dir__() {
        throw new org.python.exceptions.NotImplementedError("bool.__dir__() has not been implemented.");
    }

    @org.python.Method(
            __doc__ = ""
    )

    public org.python.Object __add__(org.python.Object other) {
        if (other instanceof org.python.types.Bool) {
            return new org.python.types.Int((((org.python.types.Bool) this).value ? 1 : 0) + (((org.python.types.Bool) other).value ? 1 : 0));
        } else if (other instanceof org.python.types.Int) {
            return new org.python.types.Int((((org.python.types.Bool) this).value ? 1 : 0) + ((org.python.types.Int) other).value);
        } else if (other instanceof org.python.types.Float) {
            return new org.python.types.Float((((org.python.types.Bool) this).value ? 1 : 0) + ((org.python.types.Float) other).value);
        }
        throw new org.python.exceptions.TypeError("unsupported operand type(s) for +: 'bool' and '" + other.typeName() + "'");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __sub__(org.python.Object other) {
        if (other instanceof org.python.types.Int) {
            return new org.python.types.Int((((org.python.types.Bool) this).value ? 1 : 0) - ((org.python.types.Int) other).value);
        } else if (other instanceof org.python.types.Bool) {
            return new org.python.types.Int((((org.python.types.Bool) this).value ? 1 : 0) - (((org.python.types.Bool) other).value ? 1 : 0));
        } else if (other instanceof org.python.types.Float) {
            return new org.python.types.Float((((org.python.types.Bool) this).value ? 1.0 : 0.0) - (((org.python.types.Float) other).value));
        }
        throw new org.python.exceptions.TypeError("unsupported operand type(s) for -: 'bool' and '" + other.typeName() + "'");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __mul__(org.python.Object other) {
        if (other instanceof org.python.types.Int) {
            return new org.python.types.Int((((org.python.types.Bool) this).value ? 1 : 0) * ((org.python.types.Int) other).value);
        } else if (other instanceof org.python.types.Bool) {
            return new org.python.types.Int((((org.python.types.Bool) this).value ? 1 : 0) * (((org.python.types.Bool) other).value ? 1 : 0));
        } else if (other instanceof org.python.types.Float) {
            return new org.python.types.Float((((org.python.types.Bool) this).value ? 1.0 : 0.0) * (((org.python.types.Float) other).value));
        } else if (other instanceof org.python.types.Str) {
            if (((org.python.types.Bool) this).value) {
                return new org.python.types.Str(((org.python.types.Str) other).value);
            } else {
                return new org.python.types.Str("");
            }
        } else if (other instanceof org.python.types.List) {
            return other.__mul__(this);
        } else if (other instanceof org.python.types.Tuple) {
            return other.__mul__(this);
        } else if (other instanceof org.python.types.ByteArray) {
            return other.__mul__(this);
        } else if (other instanceof org.python.types.Bytes) {
            return other.__mul__(this);
        }
        throw new org.python.exceptions.TypeError("unsupported operand type(s) for *: 'bool' and '" + other.typeName() + "'");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __truediv__(org.python.Object other) {
        try {
            return new org.python.types.Int(this.value ? 1 : 0).__truediv__(other);
        } catch (org.python.exceptions.TypeError ae) {
            throw new org.python.exceptions.TypeError("unsupported operand type(s) for //: 'bool' and '" + other.typeName() + "'");
        }
        // throw new org.python.exceptions.NotImplementedError("bool.__truediv__() has not been implemented.");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __floordiv__(org.python.Object other) {
        try {
            return new org.python.types.Int(this.value ? 1 : 0).__floordiv__(other);
        } catch (org.python.exceptions.TypeError ae) {
            throw new org.python.exceptions.TypeError("unsupported operand type(s) for //: 'bool' and '" + other.typeName() + "'");
        }
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __mod__(org.python.Object other) {
        if (other instanceof org.python.types.Bool) {
            boolean other_val = ((org.python.types.Bool) other).value;
            if (!other_val) {
                throw new org.python.exceptions.ZeroDivisionError("integer division or modulo by zero");
            }
            if (this.value) {
                return new org.python.types.Int(0);
            } else {
                if (org.Python.VERSION < 0x03060000) {
                    return new org.python.types.Bool(false);
                } else {
                    return new org.python.types.Int(0);
                }
            }
        } else if (other instanceof org.python.types.Int) {
            long other_val = ((org.python.types.Int) other).value;
            if (other_val == 0) {
                throw new org.python.exceptions.ZeroDivisionError("integer division or modulo by zero");
            }

            if (!this.value) {
                if (org.Python.VERSION < 0x03060000) {
                    return new org.python.types.Bool(false);
                } else {
                    return new org.python.types.Int(0);
                }
            } else if (other_val > 1) {
                if (org.Python.VERSION < 0x03060000) {
                    return new org.python.types.Bool(this.value);
                } else {
                    return new org.python.types.Int(1);
                }
            }
        }
        try {
            return new org.python.types.Int(this.value ? 1 : 0).__mod__(other);
        } catch (org.python.exceptions.TypeError ae) {
            throw new org.python.exceptions.TypeError("unsupported operand type(s) for %: 'bool' and '" + other.typeName() + "'");
        }
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __divmod__(org.python.Object other) {
        try {
            java.util.List<org.python.Object> data = new java.util.ArrayList<org.python.Object>();
            data.add(this.__floordiv__(other));
            data.add(this.__mod__(other));
            return new org.python.types.Tuple(data);
        } catch (org.python.exceptions.TypeError ae) {
            throw new org.python.exceptions.TypeError("unsupported operand type(s) for divmod(): 'bool' and '" + other.typeName() + "'");
        }
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __pow__(org.python.Object other, org.python.Object modulo) {
        try {
            return new org.python.types.Int(this.value ? 1 : 0).__pow__(other, modulo);
        } catch (org.python.exceptions.TypeError e) {
            throw new org.python.exceptions.TypeError("unsupported operand type(s) for ** or pow(): 'bool' and '" + other.typeName() + "'");
        }
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __lshift__(org.python.Object other) {
        if (other instanceof org.python.types.Bool) {
            return new org.python.types.Int((((org.python.types.Bool) this).value ? 1 : 0) << (((org.python.types.Bool) other).value ? 1 : 0));
        } else if (other instanceof org.python.types.Int) {
            long other_val = ((org.python.types.Int) other).value;
            if (other_val < 0) {
                throw new org.python.exceptions.ValueError("negative shift count");
            }
            return new org.python.types.Int((((org.python.types.Bool) this).value ? 1 : 0) << other_val);
        }
        throw new org.python.exceptions.TypeError("unsupported operand type(s) for <<: 'bool' and '" + other.typeName() + "'");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __rshift__(org.python.Object other) {
        if (other instanceof org.python.types.Bool) {
            return new org.python.types.Int((((org.python.types.Bool) this).value ? 1 : 0) >> (((org.python.types.Bool) other).value ? 1 : 0));
        } else if (other instanceof org.python.types.Int) {
            long other_val = ((org.python.types.Int) other).value;
            if (other_val < 0) {
                throw new org.python.exceptions.ValueError("negative shift count");
            }
            return new org.python.types.Int((((org.python.types.Bool) this).value ? 1 : 0) >> other_val);
        }
        throw new org.python.exceptions.TypeError("unsupported operand type(s) for >>: 'bool' and '" + other.typeName() + "'");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __and__(org.python.Object other) {
        if (other instanceof org.python.types.Bool) {
            return new org.python.types.Bool(
                    (((org.python.types.Bool) this).value ? 1 : 0) &
                            (((org.python.types.Bool) other).value ? 1 : 0)
            );
        }

        if (other instanceof org.python.types.Int) {
            return new org.python.types.Int(
                    (((org.python.types.Bool) this).value ? 1 : 0) &
                            ((org.python.types.Int) other).value
            );
        }

        throw new org.python.exceptions.TypeError("unsupported operand type(s) for &: 'bool' and '" + other.typeName() + "'");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __xor__(org.python.Object other) {
        if (other instanceof org.python.types.Bool) {
            return new org.python.types.Bool((((org.python.types.Bool) this).value ? 1 : 0) ^ (((org.python.types.Bool) other).value ? 1 : 0));
        }
        throw new org.python.exceptions.TypeError("unsupported operand type(s) for ^: 'bool' and '" + other.typeName() + "'");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __or__(org.python.Object other) {
        if (other instanceof org.python.types.Bool) {
            return new org.python.types.Bool((((org.python.types.Bool) this).value ? 1 : 0) | (((org.python.types.Bool) other).value ? 1 : 0));
        }
        if (other instanceof org.python.types.Int) {
            return new org.python.types.Int((((org.python.types.Bool) this).value ? 1 : 0) | ((org.python.types.Int) other).value);
        }
        throw new org.python.exceptions.TypeError("unsupported operand type(s) for |: 'bool' and '" + other.typeName() + "'");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __radd__(org.python.Object other) {
        throw new org.python.exceptions.NotImplementedError("bool.__radd__() has not been implemented.");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __rsub__(org.python.Object other) {
        throw new org.python.exceptions.NotImplementedError("bool.__rsub__() has not been implemented.");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __rmul__(org.python.Object other) {
        throw new org.python.exceptions.NotImplementedError("bool.__rmul__() has not been implemented.");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __rtruediv__(org.python.Object other) {
        throw new org.python.exceptions.NotImplementedError("bool.__rtruediv__() has not been implemented.");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __rfloordiv__(org.python.Object other) {
        throw new org.python.exceptions.NotImplementedError("bool.__rfloordiv__() has not been implemented.");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __rmod__(org.python.Object other) {
        throw new org.python.exceptions.NotImplementedError("bool.__rmod__() has not been implemented.");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __rdivmod__(org.python.Object other) {
        throw new org.python.exceptions.NotImplementedError("bool.__rdivmod__() has not been implemented.");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __rpow__(org.python.Object other) {
        throw new org.python.exceptions.NotImplementedError("bool.__rpow__() has not been implemented.");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __rlshift__(org.python.Object other) {
        throw new org.python.exceptions.NotImplementedError("bool.__rlshift__() has not been implemented.");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __rrshift__(org.python.Object other) {
        throw new org.python.exceptions.NotImplementedError("bool.__rrshift__() has not been implemented.");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __rand__(org.python.Object other) {
        throw new org.python.exceptions.NotImplementedError("bool.__rand__() has not been implemented.");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __rxor__(org.python.Object other) {
        throw new org.python.exceptions.NotImplementedError("bool.__rxor__() has not been implemented.");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __ror__(org.python.Object other) {
        throw new org.python.exceptions.NotImplementedError("bool.__ror__() has not been implemented.");

    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __iadd__(org.python.Object other) {
        int this_val = (((org.python.types.Bool) this).value ? 1 : 0);
        if (other instanceof org.python.types.Bool) {
            this_val += (((org.python.types.Bool) other).value ? 1 : 0);
            return new org.python.types.Int(this_val);
        } else if (other instanceof org.python.types.Int) {
            this_val += ((org.python.types.Int) other).value;
            return new org.python.types.Int(this_val);
        } else if (other instanceof org.python.types.Float) {
            this_val += ((org.python.types.Float) other).value;
            return new org.python.types.Float(this_val);
        }
        throw new org.python.exceptions.TypeError("unsupported operand type(s) for +=: 'bool' and '" + other.typeName() + "'");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __ilshift__(org.python.Object other) {
        int this_val = (((org.python.types.Bool) this).value ? 1 : 0);
        if (other instanceof org.python.types.Bool) {
            this_val <<= (((org.python.types.Bool) other).value ? 1 : 0);
            return new org.python.types.Int(this_val);
        } else if (other instanceof org.python.types.Int) {
            long other_val = ((org.python.types.Int) other).value;
            if (other_val < 0) {
                throw new org.python.exceptions.ValueError("negative shift count");
            }
            this_val <<= other_val;
            return new org.python.types.Int(this_val);
        }
        throw new org.python.exceptions.TypeError("unsupported operand type(s) for <<=: 'bool' and '" + other.typeName() + "'");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __irshift__(org.python.Object other) {
        int this_val = (((org.python.types.Bool) this).value ? 1 : 0);
        if (other instanceof org.python.types.Bool) {
            this_val >>= (((org.python.types.Bool) other).value ? 1 : 0);
            return new org.python.types.Int(this_val);
        } else if (other instanceof org.python.types.Int) {
            long other_val = ((org.python.types.Int) other).value;
            if (other_val < 0) {
                throw new org.python.exceptions.ValueError("negative shift count");
            }
            this_val >>= other_val;
            return new org.python.types.Int(this_val);
        }
        throw new org.python.exceptions.TypeError("unsupported operand type(s) for >>=: 'bool' and '" + other.typeName() + "'");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __neg__() {
        return new org.python.types.Int(this.value ? -1 : 0);
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __pos__() {
        return new org.python.types.Int(this.value ? 1 : 0);
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __abs__() {
        return new org.python.types.Int(this.value ? 1 : 0);
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __invert__() {
        return new org.python.types.Int(this.value ? -2 : -1);
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.types.Int __int__() {
        return new org.python.types.Int(this.value ? 1 : 0);
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.types.Float __float__() {
        return new org.python.types.Float(this.value ? 1 : 0);
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __round__(org.python.Object ndigits) {
        if (ndigits instanceof org.python.types.Int) {
            return new org.python.types.Int(this.value ? 1 : 0);
        }
        throw new org.python.exceptions.TypeError("'" + ndigits.typeName() + "' object cannot be interpreted as an integer");
    }

    @org.python.Method(
            __doc__ = ""
    )
    public org.python.Object __index__() {
        return new org.python.types.Int(this.value ? 1 : 0);
    }
}