text:
[etcd-operator](https://coreos.com/blog/introducing-the-etcd-operator.html) Simplify etcd cluster
configuration and management.

__DISCLAIMER:__ While this chart has been well-tested, the etcd-operator is still currently in beta.
Current project status is available [here](https://github.com/coreos/etcd-operator).

## Introduction

This chart bootstraps an etcd-operator and allows the deployment of etcd-cluster(s).

## Official Documentation

Official project documentation found [here](https://github.com/coreos/etcd-operator)

## Prerequisites

- Kubernetes 1.4+ with Beta APIs enabled
- __Suggested:__ PV provisioner support in the underlying infrastructure to support backups

## Installing the Chart

To install the chart with the release name `my-release`:

```bash
$ helm install stable/etcd-operator --name my-release
```

__Note__: If you set `cluster.enabled` on install, it will have no effect.
Before you create an etcd cluster, the TPR must be installed by the operator, so this option is ignored during helm installs, but can be used in upgrades.

## Uninstalling the Chart

To uninstall/delete the `my-release` deployment:

```bash
$ helm delete my-release
```

The command removes all the Kubernetes components EXCEPT the persistent volume.

## Updating
Updating the TPR resource will not result in the cluster being update until `kubectl apply` for
TPRs is fixed see [kubernetes/issues/29542](https://github.com/kubernetes/kubernetes/issues/29542)
Work around options are documented [here](https://github.com/coreos/etcd-operator#resize-an-etcd-cluster)

## Configuration

The following tables lists the configurable parameters of the etcd-operator chart and their default values.

| Parameter                                         | Description                                                          | Default                                        |
| ------------------------------------------------- | -------------------------------------------------------------------- | ---------------------------------------------- |
| `rbac.create`                                     | install required rbac service account, roles and rolebindings        | `true`                                         |
| `rbac.apiVersion`                                 | rbac api version `v1alpha1|v1beta1`                                  | `v1beta1`                                      |
| `rbac.etcdOperatorServiceAccountName`             | Name of the service account resource when rbac is enabled            | `etcd-operator-sa`                                      |
| `rbac.backupOperatorServiceAccountName`           | Name of the service account resource when rbac is enabled            | `etcd-backup-operator-sa`                                      |
| `rbac.restoreOperatorServiceAccountName`          | Name of the service account resource when rbac is enabled            | `etcd-restore-operator-sa`                                      |
| `deployments.etcdOperator`                        | Deploy the etcd cluster operator                                     | `true`                                         |
| `deployments.backupOperator`                      | Deploy the etcd backup operator                                      | `true`                                         |
| `deployments.restoreOperator`                     | Deploy the etcd restore operator                                     | `true`                                         |
| `customResources.createEtcdClusterCRD`            | Create a custom resource: EtcdCluster                                | `false`                                        |
| `customResources.createBackupCRD`                 | Create an a custom resource: EtcdBackup                              | `false`                                        |
| `customResources.createRestoreCRD`                | Create an a custom resource: EtcdRestore                             | `false`                                        |
| `etcdOperator.name`                               | Etcd Operator name                                                   | `etcd-operator`                                |
| `etcdOperator.replicaCount`                       | Number of operator replicas to create (only 1 is supported)          | `1`                                            |
| `etcdOperator.image.repository`                   | etcd-operator container image                                        | `quay.io/coreos/etcd-operator`                 |
| `etcdOperator.image.tag`                          | etcd-operator container image tag                                    | `v0.7.0`                                       |
| `etcdOperator.image.pullpolicy`                   | etcd-operator container image pull policy                            | `Always`                                       |
| `etcdOperator.resources.cpu`                      | CPU limit per etcd-operator pod                                      | `100m`                                         |
| `etcdOperator.resources.memory`                   | Memory limit per etcd-operator pod                                   | `128Mi`                                        |
| `etcdOperator.nodeSelector`                       | Node labels for etcd operator pod assignment                         | `{}`                                           |
| `etcdOperator.commandArgs`                        | Additional command arguments                                         | `{}`                                           |
| `backupOperator.name`                             | Backup operator name                                                 | `etcd-backup-operator`                         |
| `backupOperator.replicaCount`                     | Number of operator replicas to create (only 1 is supported)          | `1`                                            |
| `backupOperator.image.repository`                 | Operator container image                                             | `quay.io/coreos/etcd-operator`                 |
| `backupOperator.image.tag`                        | Operator container image tag                                         | `v0.7.0`                                       |
| `backupOperator.image.pullpolicy`                 | Operator container image pull policy                                 | `Always`                                       |
| `backupOperator.resources.cpu`                    | CPU limit per etcd-operator pod                                      | `100m`                                         |
| `backupOperator.resources.memory`                 | Memory limit per etcd-operator pod                                   | `128Mi`                                        |
| `backupOperator.spec.storageType`                 | Storage to use for backup file, currently only S3 supported          | `S3`                                           |
| `backupOperator.spec.s3.s3Bucket`                 | Bucket in S3 to store backup file                                    |                                                |
| `backupOperator.spec.s3.awsSecret`                | Name of kubernetes secrete containing aws credentials                |                                                |
| `backupOperator.nodeSelector`                     | Node labels for etcd operator pod assignment                         | `{}`                                           |
| `backupOperator.commandArgs`                      | Additional command arguments                                         | `{}`                                           |
| `restoreOperator.name`                            | Restore operator name                                                | `etcd-backup-operator`                         |
| `restoreOperator.replicaCount`                    | Number of operator replicas to create (only 1 is supported)          | `1`                                            |
| `restoreOperator.image.repository`                | Operator container image                                             | `quay.io/coreos/etcd-operator`                 |
| `restoreOperator.image.tag`                       | Operator container image tag                                         | `v0.7.0`                                       |
| `restoreOperator.image.pullpolicy`                | Operator container image pull policy                                 | `Always`                                       |
| `restoreOperator.resources.cpu`                   | CPU limit per etcd-operator pod                                      | `100m`                                         |
| `restoreOperator.resources.memory`                | Memory limit per etcd-operator pod                                   | `128Mi`                                        |
| `restoreOperator.spec.s3.path`                    | Path in S3 bucket containing the backup file                         |                                                |
| `restoreOperator.spec.s3.awsSecret`               | Name of kubernetes secrete containing aws credentials                |                                                |
| `restoreOperator.nodeSelector`                    | Node labels for etcd operator pod assignment                         | `{}`                                           |
| `restoreOperator.commandArgs`                     | Additional command arguments                                         | `{}`                                           |
| `etcdCluster.name`                                | etcd cluster name                                                    | `etcd-cluster`                                 |
| `etcdCluster.size`                                | etcd cluster size                                                    | `3`                                            |
| `etcdCluster.version`                             | etcd cluster version                                                 | `3.2.10`                                       |
| `etcdCluster.image.repository`                    | etcd container image                                                 | `quay.io/coreos/etcd-operator`                 |
| `etcdCluster.image.tag`                           | etcd container image tag                                             | `v3.2.10`                                      |
| `etcdCluster.image.pullPolicy`                    | etcd container image pull policy                                     | `Always`                                       |
| `etcdCluster.enableTLS`                           | Enable use of TLS                                                    | `false`                                        |
| `etcdCluster.tls.static.member.peerSecret`        | Kubernetes secret containing TLS peer certs                          | `etcd-peer-tls`                                |
| `etcdCluster.tls.static.member.serverSecret`      | Kubernetes secret containing TLS server certs                        | `etcd-server-tls`                              |
| `etcdCluster.tls.static.operatorSecret`           | Kubernetes secret containing TLS client certs                        | `etcd-client-tls`                              |
| `etcdCluster.pod.antiAffinity`                    | Whether etcd cluster pods should have an antiAffinity                | `false`                                        |
| `etcdCluster.pod.resources.limits.cpu`            | CPU limit per etcd cluster pod                                       | `100m`                                         |
| `etcdCluster.pod.resources.limits.memory`         | Memory limit per etcd cluster pod                                    | `128Mi`                                        |
| `etcdCluster.pod.resources.requests.cpu`          | CPU request per etcd cluster pod                                     | `100m`                                         |
| `etcdCluster.pod.resources.requests.memory`       | Memory request per etcd cluster pod                                  | `128Mi`                                        |
| `etcdCluster.pod.nodeSelector`                    | node labels for etcd cluster pod assignment                          | `{}`                                           |

Specify each parameter using the `--set key=value[,key=value]` argument to `helm install`. For example:

```bash
$ helm install --name my-release --set image.tag=v0.2.1 stable/etcd-operator
```

Alternatively, a YAML file that specifies the values for the parameters can be provided while
installing the chart. For example:

```bash
$ helm install --name my-release --values values.yaml stable/etcd-operator
```

## RBAC
By default the chart will install the recommended RBAC roles and rolebindings.

To determine if your cluster supports this running the following:

```console
$ kubectl api-versions | grep rbac
```

You also need to have the following parameter on the api server. See the following document for how to enable [RBAC](https://kubernetes.io/docs/admin/authorization/rbac/)

```
--authorization-mode=RBAC
```

If the output contains "beta" or both "alpha" and "beta" you can may install rbac by default, if not, you may turn rbac off as described below.

### RBAC role/rolebinding creation

RBAC resources are enabled by default. To disable rbac do the following:

```console
$ helm install --name my-release stable/etcd-operator --set rbac.create=false
```

### Changing RBAC manifest apiVersion

By default the RBAC resources are generated with the "v1beta1" apiVersion. To use "v1alpha1" do the following:

```console
$ helm install --name my-release stable/etcd-operator --set rbac.install=true,rbac.apiVersion=v1alpha1
```


text:
<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <meta name="module-info" content="status=obsolete">
    <title>延时的任务</title>
    <script type="text/javascript" src="../../../src/core/base.js"></script>
    <script type="text/javascript" src="../../src/utils/dalayedtask.js"></script>

    <script type="text/javascript" src="../../apps/demo/demo.js"></script>
</head>
<body>
    <article class="demo">
        <script class="demo">
            var delayedTask = new DelayedTask(function () {
                trace('task');
            });

            delayedTask.delay(100);
            delayedTask.start(33);
            delayedTask.stop();
        </script>
    </article>
</body>
</html>

redpajama_set_name: RedPajamaGithub


text:
{-# LANGUAGE QuasiQuotes #-}

module LogFiles where

import           Control.Applicative
import           Control.Monad
import           Data.Maybe          (fromMaybe)
import           Data.Time           hiding (parseTime)
import           Text.RawString.QQ

import           Data.List
import           Text.Trifecta

data Log = Log [LogDay] deriving Eq
data LogDay = LogDay Day [Activity] deriving Eq
type ActivityName = String
data Activity = Activity TimeOfDay ActivityName deriving Eq

instance Show Activity where
  show (Activity time name) = show time ++ " " ++ name

instance Show LogDay where
  show (LogDay day activities) =
    "\n# " ++ show day ++ "\n" ++
    foldr (\a r -> show a ++ "\n" ++ r) "" activities

instance Show Log where
  show (Log logDays) =
    foldr (\x r -> show x ++ "\n" ++ r) "" logDays

parseTime :: Parser TimeOfDay
parseTime = do
  hours <- fromInteger <$> integer
  char ':'
  minutes <- fromInteger <$> integer
  case makeTimeOfDayValid hours minutes 0.0 of
    Nothing -> fail "Wrong time"
    Just x -> return x

skipEOL :: Parser ()
skipEOL = skipMany $ char '\n'

skipComment :: Parser ()
skipComment = do
  whiteSpace
  _ <- char '-'
  _ <- char '-'
  skipMany (noneOf "\n")
  skipEOL

parseActivity :: Parser Activity
parseActivity = do
  time <- parseTime
  whiteSpace
  name <- many (noneOf "\n") --`manyTill` (skipComment <|> skipEOL)
  skipEOL
  return $ Activity time name

parseDay :: Parser Day
parseDay = do
  char '#'
  whiteSpace
  year <- integer
  char '-'
  month <- fromInteger <$> integer
  char '-'
  day <- fromInteger <$> integer
  skipMany (noneOf "\n")
  skipEOL
  return $ fromGregorian year month day

parseLogDay :: Parser LogDay
parseLogDay = LogDay <$> parseDay <*> some parseActivity

parseLog :: Parser Log
parseLog = Log <$> many (whiteSpace *> parseLogDay)

toMaybe :: Result a -> Maybe a
toMaybe (Success a) = Just a
toMaybe (Failure _) = Nothing

timeByActivity :: Log -> [(ActivityName, DiffTime)]
timeByActivity (Log days) =
    let activities =
          concatMap (\(LogDay _ activities) -> activities) days
        groupped =
          groupBy
            (\(Activity _ n1) (Activity _ n2) -> n1 == n2)
            activities
        timeByName =
          map
            (\as ->
              let (Activity _ name) = head as
                  totalTime =
                    sum .
                    map (\(Activity t _) -> timeOfDayToTime t) $
                    as
              in (name, totalTime)
            )
            groupped
    in timeByName

logEx :: String
logEx = [r|
# 2025-02-05
08:00 Breakfast
09:00 Sanitizing moisture collector
11:00 Exercising in high-grav gym
12:00 Lunch
13:00 Programming
17:00 Commuting home in rover
17:30 R&R
19:00 Dinner
21:00 Shower
21:15 Read
22:00 Sleep

# 2025-02-07 -- dates not nececessarily sequential
08:00 Breakfast -- should I try skippin bfast?
09:00 Bumped head, passed out
13:36 Wake up, headache
13:37 Go to medbay
13:40 Patch self up
13:45 Commute home for rest
14:15 Read
21:00 Dinner
21:15 Read
22:00 Sleep
|]


text:
<!DOCTYPE html>

    <title></title>


text:
from typing import Awaitable, Callable, Dict, Optional, Sequence, Tuple, Union
import warnings

from google.api_core import gapic_v1, grpc_helpers_async
from google.auth import credentials as ga_credentials  # type: ignore
from google.auth.transport.grpc import SslCredentials  # type: ignore
from google.protobuf import empty_pb2  # type: ignore
import grpc  # type: ignore
from grpc.experimental import aio  # type: ignore

from google.cloud.binaryauthorization_v1.types import resources, service

from .base import DEFAULT_CLIENT_INFO, BinauthzManagementServiceV1Transport
from .grpc import BinauthzManagementServiceV1GrpcTransport

class BinauthzManagementServiceV1GrpcAsyncIOTransport(
    BinauthzManagementServiceV1Transport
):
    """gRPC AsyncIO backend transport for BinauthzManagementServiceV1.

    Google Cloud Management Service for Binary Authorization admission
    policies and attestation authorities.

    This API implements a REST model with the following objects:

    -  [Policy][google.cloud.binaryauthorization.v1.Policy]
    -  [Attestor][google.cloud.binaryauthorization.v1.Attestor]

    This class defines the same methods as the primary client, so the
    primary client can load the underlying transport implementation
    and call it.

    It sends protocol buffers over the wire using gRPC (which is built on
    top of HTTP/2); the ``grpcio`` package must be installed.
    """

    _grpc_channel: aio.Channel
    _stubs: Dict[str, Callable] = {}

    @classmethod
    def create_channel(
        cls,
        host: str = "binaryauthorization.googleapis.com",
        credentials: Optional[ga_credentials.Credentials] = None,
        credentials_file: Optional[str] = None,
        scopes: Optional[Sequence[str]] = None,
        quota_project_id: Optional[str] = None,
        **kwargs,
    ) -> aio.Channel:
        """Create and return a gRPC AsyncIO channel object.
        Args:
            host (Optional[str]): The host for the channel to use.
            credentials (Optional[~.Credentials]): The
                authorization credentials to attach to requests. These
                credentials identify this application to the service. If
                none are specified, the client will attempt to ascertain
                the credentials from the environment.
            credentials_file (Optional[str]): A file with credentials that can
                be loaded with :func:`google.auth.load_credentials_from_file`.
                This argument is ignored if ``channel`` is provided.
            scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
                service. These are only used when credentials are not specified and
                are passed to :func:`google.auth.default`.
            quota_project_id (Optional[str]): An optional project to use for billing
                and quota.
            kwargs (Optional[dict]): Keyword arguments, which are passed to the
                channel creation.
        Returns:
            aio.Channel: A gRPC AsyncIO channel object.
        """

        return grpc_helpers_async.create_channel(
            host,
            credentials=credentials,
            credentials_file=credentials_file,
            quota_project_id=quota_project_id,
            default_scopes=cls.AUTH_SCOPES,
            scopes=scopes,
            default_host=cls.DEFAULT_HOST,
            **kwargs,
        )

    def __init__(
        self,
        *,
        host: str = "binaryauthorization.googleapis.com",
        credentials: Optional[ga_credentials.Credentials] = None,
        credentials_file: Optional[str] = None,
        scopes: Optional[Sequence[str]] = None,
        channel: Optional[aio.Channel] = None,
        api_mtls_endpoint: Optional[str] = None,
        client_cert_source: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
        ssl_channel_credentials: Optional[grpc.ChannelCredentials] = None,
        client_cert_source_for_mtls: Optional[Callable[[], Tuple[bytes, bytes]]] = None,
        quota_project_id: Optional[str] = None,
        client_info: gapic_v1.client_info.ClientInfo = DEFAULT_CLIENT_INFO,
        always_use_jwt_access: Optional[bool] = False,
        api_audience: Optional[str] = None,
    ) -> None:
        """Instantiate the transport.

        Args:
            host (Optional[str]):
                 The hostname to connect to.
            credentials (Optional[google.auth.credentials.Credentials]): The
                authorization credentials to attach to requests. These
                credentials identify the application to the service; if none
                are specified, the client will attempt to ascertain the
                credentials from the environment.
                This argument is ignored if ``channel`` is provided.
            credentials_file (Optional[str]): A file with credentials that can
                be loaded with :func:`google.auth.load_credentials_from_file`.
                This argument is ignored if ``channel`` is provided.
            scopes (Optional[Sequence[str]]): A optional list of scopes needed for this
                service. These are only used when credentials are not specified and
                are passed to :func:`google.auth.default`.
            channel (Optional[aio.Channel]): A ``Channel`` instance through
                which to make calls.
            api_mtls_endpoint (Optional[str]): Deprecated. The mutual TLS endpoint.
                If provided, it overrides the ``host`` argument and tries to create
                a mutual TLS channel with client SSL credentials from
                ``client_cert_source`` or application default SSL credentials.
            client_cert_source (Optional[Callable[[], Tuple[bytes, bytes]]]):
                Deprecated. A callback to provide client SSL certificate bytes and
                private key bytes, both in PEM format. It is ignored if
                ``api_mtls_endpoint`` is None.
            ssl_channel_credentials (grpc.ChannelCredentials): SSL credentials
                for the grpc channel. It is ignored if ``channel`` is provided.
            client_cert_source_for_mtls (Optional[Callable[[], Tuple[bytes, bytes]]]):
                A callback to provide client certificate bytes and private key bytes,
                both in PEM format. It is used to configure a mutual TLS channel. It is
                ignored if ``channel`` or ``ssl_channel_credentials`` is provided.
            quota_project_id (Optional[str]): An optional project to use for billing
                and quota.
            client_info (google.api_core.gapic_v1.client_info.ClientInfo):
                The client info used to send a user-agent string along with
                API requests. If ``None``, then default info will be used.
                Generally, you only need to set this if you're developing
                your own client library.
            always_use_jwt_access (Optional[bool]): Whether self signed JWT should
                be used for service account credentials.

        Raises:
            google.auth.exceptions.MutualTlsChannelError: If mutual TLS transport
              creation failed for any reason.
          google.api_core.exceptions.DuplicateCredentialArgs: If both ``credentials``
              and ``credentials_file`` are passed.
        """
        self._grpc_channel = None
        self._ssl_channel_credentials = ssl_channel_credentials
        self._stubs: Dict[str, Callable] = {}

        if api_mtls_endpoint:
            warnings.warn("api_mtls_endpoint is deprecated", DeprecationWarning)
        if client_cert_source:
            warnings.warn("client_cert_source is deprecated", DeprecationWarning)

        if channel:
            # Ignore credentials if a channel was passed.
            credentials = False
            # If a channel was explicitly provided, set it.
            self._grpc_channel = channel
            self._ssl_channel_credentials = None
        else:
            if api_mtls_endpoint:
                host = api_mtls_endpoint

                # Create SSL credentials with client_cert_source or application
                # default SSL credentials.
                if client_cert_source:
                    cert, key = client_cert_source()
                    self._ssl_channel_credentials = grpc.ssl_channel_credentials(
                        certificate_chain=cert, private_key=key
                    )
                else:
                    self._ssl_channel_credentials = SslCredentials().ssl_credentials

            else:
                if client_cert_source_for_mtls and not ssl_channel_credentials:
                    cert, key = client_cert_source_for_mtls()
                    self._ssl_channel_credentials = grpc.ssl_channel_credentials(
                        certificate_chain=cert, private_key=key
                    )

        # The base transport sets the host, credentials and scopes
        super().__init__(
            host=host,
            credentials=credentials,
            credentials_file=credentials_file,
            scopes=scopes,
            quota_project_id=quota_project_id,
            client_info=client_info,
            always_use_jwt_access=always_use_jwt_access,
            api_audience=api_audience,
        )

        if not self._grpc_channel:
            self._grpc_channel = type(self).create_channel(
                self._host,
                # use the credentials which are saved
                credentials=self._credentials,
                # Set ``credentials_file`` to ``None`` here as
                # the credentials that we saved earlier should be used.
                credentials_file=None,
                scopes=self._scopes,
                ssl_credentials=self._ssl_channel_credentials,
                quota_project_id=quota_project_id,
                options=[
                    ("grpc.max_send_message_length", -1),
                    ("grpc.max_receive_message_length", -1),
                ],
            )

        # Wrap messages. This must be done after self._grpc_channel exists
        self._prep_wrapped_messages(client_info)

    @property
    def grpc_channel(self) -> aio.Channel:
        """Create the channel designed to connect to this service.

        This property caches on the instance; repeated calls return
        the same channel.
        """
        # Return the channel from cache.
        return self._grpc_channel

    @property
    def get_policy(
        self,
    ) -> Callable[[service.GetPolicyRequest], Awaitable[resources.Policy]]:
        r"""Return a callable for the get policy method over gRPC.

        A [policy][google.cloud.binaryauthorization.v1.Policy] specifies
        the [attestors][google.cloud.binaryauthorization.v1.Attestor]
        that must attest to a container image, before the project is
        allowed to deploy that image. There is at most one policy per
        project. All image admission requests are permitted if a project
        has no policy.

        Gets the [policy][google.cloud.binaryauthorization.v1.Policy]
        for this project. Returns a default
        [policy][google.cloud.binaryauthorization.v1.Policy] if the
        project does not have one.

        Returns:
            Callable[[~.GetPolicyRequest],
                    Awaitable[~.Policy]]:
                A function that, when called, will call the underlying RPC
                on the server.
        """
        # Generate a "stub function" on-the-fly which will actually make
        # the request.
        # gRPC handles serialization and deserialization, so we just need
        # to pass in the functions for each.
        if "get_policy" not in self._stubs:
            self._stubs["get_policy"] = self.grpc_channel.unary_unary(
                "/google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1/GetPolicy",
                request_serializer=service.GetPolicyRequest.serialize,
                response_deserializer=resources.Policy.deserialize,
            )
        return self._stubs["get_policy"]

    @property
    def update_policy(
        self,
    ) -> Callable[[service.UpdatePolicyRequest], Awaitable[resources.Policy]]:
        r"""Return a callable for the update policy method over gRPC.

        Creates or updates a project's
        [policy][google.cloud.binaryauthorization.v1.Policy], and
        returns a copy of the new
        [policy][google.cloud.binaryauthorization.v1.Policy]. A policy
        is always updated as a whole, to avoid race conditions with
        concurrent policy enforcement (or management!) requests. Returns
        NOT_FOUND if the project does not exist, INVALID_ARGUMENT if the
        request is malformed.

        Returns:
            Callable[[~.UpdatePolicyRequest],
                    Awaitable[~.Policy]]:
                A function that, when called, will call the underlying RPC
                on the server.
        """
        # Generate a "stub function" on-the-fly which will actually make
        # the request.
        # gRPC handles serialization and deserialization, so we just need
        # to pass in the functions for each.
        if "update_policy" not in self._stubs:
            self._stubs["update_policy"] = self.grpc_channel.unary_unary(
                "/google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1/UpdatePolicy",
                request_serializer=service.UpdatePolicyRequest.serialize,
                response_deserializer=resources.Policy.deserialize,
            )
        return self._stubs["update_policy"]

    @property
    def create_attestor(
        self,
    ) -> Callable[[service.CreateAttestorRequest], Awaitable[resources.Attestor]]:
        r"""Return a callable for the create attestor method over gRPC.

        Creates an
        [attestor][google.cloud.binaryauthorization.v1.Attestor], and
        returns a copy of the new
        [attestor][google.cloud.binaryauthorization.v1.Attestor].
        Returns NOT_FOUND if the project does not exist,
        INVALID_ARGUMENT if the request is malformed, ALREADY_EXISTS if
        the [attestor][google.cloud.binaryauthorization.v1.Attestor]
        already exists.

        Returns:
            Callable[[~.CreateAttestorRequest],
                    Awaitable[~.Attestor]]:
                A function that, when called, will call the underlying RPC
                on the server.
        """
        # Generate a "stub function" on-the-fly which will actually make
        # the request.
        # gRPC handles serialization and deserialization, so we just need
        # to pass in the functions for each.
        if "create_attestor" not in self._stubs:
            self._stubs["create_attestor"] = self.grpc_channel.unary_unary(
                "/google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1/CreateAttestor",
                request_serializer=service.CreateAttestorRequest.serialize,
                response_deserializer=resources.Attestor.deserialize,
            )
        return self._stubs["create_attestor"]

    @property
    def get_attestor(
        self,
    ) -> Callable[[service.GetAttestorRequest], Awaitable[resources.Attestor]]:
        r"""Return a callable for the get attestor method over gRPC.

        Gets an
        [attestor][google.cloud.binaryauthorization.v1.Attestor].
        Returns NOT_FOUND if the
        [attestor][google.cloud.binaryauthorization.v1.Attestor] does
        not exist.

        Returns:
            Callable[[~.GetAttestorRequest],
                    Awaitable[~.Attestor]]:
                A function that, when called, will call the underlying RPC
                on the server.
        """
        # Generate a "stub function" on-the-fly which will actually make
        # the request.
        # gRPC handles serialization and deserialization, so we just need
        # to pass in the functions for each.
        if "get_attestor" not in self._stubs:
            self._stubs["get_attestor"] = self.grpc_channel.unary_unary(
                "/google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1/GetAttestor",
                request_serializer=service.GetAttestorRequest.serialize,
                response_deserializer=resources.Attestor.deserialize,
            )
        return self._stubs["get_attestor"]

    @property
    def update_attestor(
        self,
    ) -> Callable[[service.UpdateAttestorRequest], Awaitable[resources.Attestor]]:
        r"""Return a callable for the update attestor method over gRPC.

        Updates an
        [attestor][google.cloud.binaryauthorization.v1.Attestor].
        Returns NOT_FOUND if the
        [attestor][google.cloud.binaryauthorization.v1.Attestor] does
        not exist.

        Returns:
            Callable[[~.UpdateAttestorRequest],
                    Awaitable[~.Attestor]]:
                A function that, when called, will call the underlying RPC
                on the server.
        """
        # Generate a "stub function" on-the-fly which will actually make
        # the request.
        # gRPC handles serialization and deserialization, so we just need
        # to pass in the functions for each.
        if "update_attestor" not in self._stubs:
            self._stubs["update_attestor"] = self.grpc_channel.unary_unary(
                "/google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1/UpdateAttestor",
                request_serializer=service.UpdateAttestorRequest.serialize,
                response_deserializer=resources.Attestor.deserialize,
            )
        return self._stubs["update_attestor"]

    @property
    def list_attestors(
        self,
    ) -> Callable[
        [service.ListAttestorsRequest], Awaitable[service.ListAttestorsResponse]
    ]:
        r"""Return a callable for the list attestors method over gRPC.

        Lists [attestors][google.cloud.binaryauthorization.v1.Attestor].
        Returns INVALID_ARGUMENT if the project does not exist.

        Returns:
            Callable[[~.ListAttestorsRequest],
                    Awaitable[~.ListAttestorsResponse]]:
                A function that, when called, will call the underlying RPC
                on the server.
        """
        # Generate a "stub function" on-the-fly which will actually make
        # the request.
        # gRPC handles serialization and deserialization, so we just need
        # to pass in the functions for each.
        if "list_attestors" not in self._stubs:
            self._stubs["list_attestors"] = self.grpc_channel.unary_unary(
                "/google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1/ListAttestors",
                request_serializer=service.ListAttestorsRequest.serialize,
                response_deserializer=service.ListAttestorsResponse.deserialize,
            )
        return self._stubs["list_attestors"]

    @property
    def delete_attestor(
        self,
    ) -> Callable[[service.DeleteAttestorRequest], Awaitable[empty_pb2.Empty]]:
        r"""Return a callable for the delete attestor method over gRPC.

        Deletes an
        [attestor][google.cloud.binaryauthorization.v1.Attestor].
        Returns NOT_FOUND if the
        [attestor][google.cloud.binaryauthorization.v1.Attestor] does
        not exist.

        Returns:
            Callable[[~.DeleteAttestorRequest],
                    Awaitable[~.Empty]]:
                A function that, when called, will call the underlying RPC
                on the server.
        """
        # Generate a "stub function" on-the-fly which will actually make
        # the request.
        # gRPC handles serialization and deserialization, so we just need
        # to pass in the functions for each.
        if "delete_attestor" not in self._stubs:
            self._stubs["delete_attestor"] = self.grpc_channel.unary_unary(
                "/google.cloud.binaryauthorization.v1.BinauthzManagementServiceV1/DeleteAttestor",
                request_serializer=service.DeleteAttestorRequest.serialize,
                response_deserializer=empty_pb2.Empty.FromString,
            )
        return self._stubs["delete_attestor"]

    def close(self):
        return self.grpc_channel.close()

__all__ = ("BinauthzManagementServiceV1GrpcAsyncIOTransport",)


text:
using System;
using System.Globalization;
using System.Linq;
using EPiServer.Core;
using EPiServer.DataAbstraction;
using EPiServer.Web.WebControls;
using EPiServer.Filters;

namespace EPiServer.Templates.AlloyTech.Units.Static
{
    /// <summary>
    /// A common top area for the whole website, where the logotype is usually presented.
    /// </summary>
    public partial class PageHeader : UserControlBase
    {
        private PageData _startPageData;

        /// <summary>
        /// Gets the start page data object
        /// </summary>
        protected PageData StartPageData
        {
            get
            {
                if (_startPageData == null)
                {
                    PageReference pageReference = CurrentPage["StartPage"] as PageReference;
                    _startPageData = pageReference != null ? DataFactory.Instance.GetPage(pageReference) : DataFactory.Instance.GetPage(PageReference.StartPage);
                }

                return _startPageData;
            }
        }

        protected override void OnLoad(System.EventArgs e)
        {
            base.OnLoad(e);

            if (!IsPostBack)
            {
                SetPageReference(Rss, StartPageData["RssContainer"] as PageReference);
                SetPageReference(SiteMap, StartPageData["SitemapPage"] as PageReference);

                if (Configuration.Settings.Instance.UIShowGlobalizationUserInterface)
                {
                    SetLanguage();
                }
            }

            Logotype.NavigateUrl = StartPageData.LinkURL;
            Logotype.ImageUrl = StartPageData["Logotype"] as string ?? string.Empty;
            Logotype.ToolTip = Translate("/navigation/startpagelinktitle");
            Logotype.Text = Translate("/navigation/startpagelinktitle");

        }

        /// <summary>
        /// Sets a page reference on a property control
        /// </summary>
        /// <param name="propertyControl">The property control</param>
        /// <param name="pageReference">The page reference</param>
        private static void SetPageReference(Property propertyControl, PageReference pageReference)
        {
            if (pageReference != null)
            {
                propertyControl.Parent.Visible = true;
                propertyControl.PageLink = pageReference;
            }
        }

        /// <summary>
        /// Initializes the language link.
        /// Checks the number of available and enabled languages. If more than two,
        /// populates a dropdown-menu with the available and enabled languages.
        /// Otherwise sets the link to the not currently active language.
        /// </summary>
        private void SetLanguage()
        {
            PageDataCollection languageBranches = DataFactory.Instance.GetLanguageBranches(CurrentPage.PageLink);
            //Filter so pages with Replacement language is filtered away.
            new FilterReplacementLanguage().Filter(languageBranches);

            if (languageBranches.Count > 2)
            {
                LanguageList.Visible = LanguageListLabel.Visible = LanguageButton.Visible = LanguageList.Parent.Visible = true;
                foreach (PageData languageBranch in languageBranches.Where(p => p.LanguageID != CurrentPage.LanguageID && LanguageBranch.Load(p.LanguageID).Enabled))
                {
                    LanguageList.Items.Add(new System.Web.UI.WebControls.ListItem(new CultureInfo(languageBranch.LanguageID).NativeName, languageBranch.LanguageID));
                }
            }
            else
            {
                foreach (PageData languageBranch in languageBranches.Where(p => p.LanguageID != CurrentPage.LanguageID && LanguageBranch.Load(p.LanguageID).Enabled))
                {
                    Language.Visible = Language.Parent.Visible = true;
                    Language.NavigateUrl = EPiServer.UriSupport.AddLanguageSelection(languageBranch.LinkURL, languageBranch.LanguageID);
                    Language.Text = Translate(new CultureInfo(languageBranch.LanguageID).NativeName);
                    break;
                }
            }
        }

        /// <summary>
        /// Redirects to the selected language.
        /// </summary>
        public void ChangeLanguage(object sender, EventArgs e)
        {
            if (LanguageList.SelectedValue != "noLangSelected")
            {
                Response.Redirect(EPiServer.UriSupport.AddLanguageSelection(CurrentPage.LinkURL, LanguageList.SelectedValue));
            }
        }

        /// <summary>
        /// Gets the link to the login page
        /// </summary>
        protected string GetLoginUrl()
        {
            PageReference loginPageRef = CurrentPage["LoginPage"] as PageReference;
            if (loginPageRef != null)
            {
                return Server.HtmlEncode(DataFactory.Instance.GetPage(loginPageRef).LinkURL);
            }
            LoginView.Visible = false;
            return string.Empty;
        }
    }
}


text:
package com.std.netty.rpc;

import java.lang.reflect.InvocationHandler;
import java.lang.reflect.Proxy;

/**
 *
 *

 *
 *

 *
	修改记录
 *
-----------------------------------------------
 *
	修改日期			修改人			修改内容
 *

 *
 * @author sence
 * @since 1.0
 * @version 1.0
 */
public class ServiceProxyFactory {

	public <T> T refer(final Class<T> interfaceClass,final InvocationHandler handler){
		if(interfaceClass==null ){
			throw new IllegalArgumentException("interfaceClass is null");
		}
		if(!interfaceClass.isInterface()){
			throw new IllegalArgumentException("interfaceClass is not a interface");
		}
		return (T)Proxy.newProxyInstance(interfaceClass.getClassLoader(),new Class<?>[]{interfaceClass},handler);
	}

}


text:
package org.example1.declaration.alpha

class AlphaClass {

}


text:
```
├── src
│   └── server
│       ├── contest
│       │   ├── admin.py
│       │   ├── apps.py
│       │   ├── forms.py
│       │   ├── __init__.py
│       │   ├── migrations
│       │   ├── models.py
│       │   ├── __pycache__
│       │   ├── runner.py
│       │   ├── sandbox
│       │   ├── sandbox_config.py
│       │   ├── static
│       │   ├── submissions
│       │   ├── templates
│       │   ├── tests.py
│       │   ├── urls.py
│       │   └── views.py
```
Most files in this directory have been made and are maintained as per Django standards.

`/models.py` contains description of two models used in this app : "Problem" and "Submission".

`/runner.py` contains runner class which handles operations on the C file including compilation, execution, and evaluation. An object of type Submission is passed to the class upon which the operations take place.

`/sandbox/` contains the [sandbox](https://github.com/ajay0/sandbox) for safe execution of executables. `sandbox_config.py` contains the parameters to be passed to sandbox for execution.

`/static/` and `/templates/` work together to provide a UI to the website.

`/submissions/` contains the submissions made by the users during the contest. Submissions are saved in the form `<username>_<problem no>`. Only one submission per user per problem can be saved. Existing submissions are replaced in case more than one submission is attempted by a user for the same problem. In short, only the latest submission counts.

`/testcases/` contains all the testcases for the problems in the contest. This directory must contain one directory each for each problem in trial_problem and must be named after the problem_id. Each problem directory must contain equal number of input and output files. Files must be of the format inputX and outputX, where X belongs to integers.
For example, to save two testcases for problem_id 2 the directory structure should look like this :
```
├── testcases
│   └── 2
│       ├── input1
│       ├── input2
│       ├── output1
│       ├── output2
```
output1 corresponds to the output of the case when the input is input1.
At least one testcase per problem is required.

/contest/testcases/ directory has been shifted to /bank/testcases/

## How to host a Contest
0. Make sure all the migrations are in place.
1. Host the server by running the following command in `/src/server`
```
sudo python3 manage.py runserver <ip_address>:8000
```
`<ip_address>` is optional.
If providing the address, make sure the ip address is added in `ALLOWED_HOSTS` list in `src/server/judge/settings.py`.
If not providing the ip address parameter, the server is hosted by default on 127.0.0.1:8000.

3. Populate student and problem records using [admin](admin) or use the `src/server/add_student_records.py` script (under development) to add records in bulk.

4. Open `<ip_address>/contest` to access contest. This will render the page which lists all the problems added to the contest.

5. Click on a problem and upload a C file. The file will then be submitted and evaluated. This submission will now reflect in `<ip_address>/contest/submissions` along with the score.


text:
//
//  GKNavigationBarConfigure.m
//  GKNavigationBarViewController
//
//  Created by QuintGao on 2017/7/10.
//  Copyright © 2017年 QuintGao. All rights reserved.
//  https://github.com/QuintGao/GKNavigationBarViewController.git

#import "GKNavigationBarConfigure.h"
#import "UIViewController+GKCategory.h"
#import <sys/utsname.h>

/// 设备宽度,跟横竖屏无关
#define DEVICE_WIDTH MIN([[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)

/// 设备高度,跟横竖屏无关
#define DEVICE_HEIGHT MAX([[UIScreen mainScreen] bounds].size.width, [[UIScreen mainScreen] bounds].size.height)

@interface GKNavigationBarConfigure()

@property (nonatomic, assign) CGFloat navItemLeftSpace;
@property (nonatomic, assign) CGFloat navItemRightSpace;

@end

@implementation GKNavigationBarConfigure

static GKNavigationBarConfigure *instance = nil;

+ (instancetype)sharedInstance {
    static dispatch_once_t onceToken;
    dispatch_once(&onceToken, ^{
        instance = [GKNavigationBarConfigure new];
    });
    return instance;
}

// 设置默认的导航栏外观
- (void)setupDefaultConfigure {

    self.backgroundColor = [UIColor whiteColor];

    self.titleColor      = [UIColor blackColor];

    self.titleFont       = [UIFont boldSystemFontOfSize:17.0];

    self.statusBarHidden = NO;

    self.statusBarStyle  = UIStatusBarStyleDefault;

    self.backStyle       = GKNavigationBarBackStyleBlack;

    self.gk_navItemLeftSpace    = 0;
    self.gk_navItemRightSpace   = 0;

    self.navItemLeftSpace       = 0;
    self.navItemRightSpace      = 0;

    self.gk_snapMovementSensitivity = 0.7f;
    self.gk_pushTransitionCriticalValue = 0.3f;
    self.gk_popTransitionCriticalValue  = 0.5f;

    self.gk_translationX = 5.0f;
    self.gk_translationY = 5.0f;
    self.gk_scaleX = 0.95f;
    self.gk_scaleY = 0.97f;
}

- (void)setGk_navItemLeftSpace:(CGFloat)gk_navItemLeftSpace {
    _gk_navItemLeftSpace = gk_navItemLeftSpace;
}

- (void)setGk_navItemRightSpace:(CGFloat)gk_navItemRightSpace {
    _gk_navItemRightSpace = gk_navItemRightSpace;
}

- (void)setupCustomConfigure:(void (^)(GKNavigationBarConfigure *))block {
    [self setupDefaultConfigure];

    !block ? : block(self);

    self.navItemLeftSpace  = self.gk_navItemLeftSpace;
    self.navItemRightSpace = self.gk_navItemRightSpace;
}

// 更新配置
- (void)updateConfigure:(void (^)(GKNavigationBarConfigure *configure))block {
    !block ? : block(self);
}

- (UIViewController *)visibleViewController {
    return [[GKNavigationBarConfigure keyWindow].rootViewController gk_visibleViewControllerIfExist];
}

- (CGFloat)gk_fixedSpace {
    // 经测试发现iPhone 12和iPhone 12 Pro,默认导航栏间距是16,需要单独处理
    if ([GKNavigationBarConfigure is61InchScreenAndiPhone12]) return 16;
    return DEVICE_WIDTH > 375.0f ? 20 : 16;
}

- (NSBundle *)gk_libraryBundle {
    NSBundle *bundle = [NSBundle bundleForClass:self.class];
    NSURL *bundleURL = [bundle URLForResource:@"GKNavigationBarViewController" withExtension:@"bundle"];
    if (!bundleURL) return nil;
    return [NSBundle bundleWithURL:bundleURL];
}

- (BOOL)isVelocityInSensitivity:(CGFloat)velocity {
    return (fabs(velocity) - (1000.0f * (1 - self.gk_snapMovementSensitivity))) > 0;
}

@end

@implementation GKNavigationBarConfigure (UIDevice)

+ (NSString *)deviceModel {
    if ([self isSimulator]) {
        // Simulator doesn't return the identifier for the actual physical model, but returns it as an environment variable
        // 模拟器不返回物理机器信息,但会通过环境变量的方式返回
        return [NSString stringWithFormat:@"%s", getenv("SIMULATOR_MODEL_IDENTIFIER")];
    }

    // See https://www.theiphonewiki.com/wiki/Models for identifiers
    struct utsname systemInfo;
    uname(&systemInfo);
    return [NSString stringWithCString:systemInfo.machine encoding:NSUTF8StringEncoding];
}

+ (BOOL)isZoomedMode {
    if (![self isIPhone]) return NO;

    CGFloat nativeScale = UIScreen.mainScreen.nativeScale;
    CGFloat scale = UIScreen.mainScreen.scale;

    // 对于所有的 Plus 系列 iPhone,屏幕物理像素低于软件层面的渲染像素,不管标准模式还是放大模式,nativeScale 均小于 scale,所以需要特殊处理才能准确区分放大模式
    // https://www.paintcodeapp.com/news/ultimate-guide-to-iphone-resolutions
    BOOL shouldBeDownsampledDevice = CGSizeEqualToSize(UIScreen.mainScreen.nativeBounds.size, CGSizeMake(1080, 1920));
    if (shouldBeDownsampledDevice) {
        scale /= 1.15;
    }

    return nativeScale > scale;
}

static NSInteger isIPad = -1;
+ (BOOL)isIPad {
    if (isIPad < 0) {
        // [[[UIDevice currentDevice] model] isEqualToString:@"iPad"] 无法判断模拟器 iPad,所以改为以下方式
        isIPad = UI_USER_INTERFACE_IDIOM() == UIUserInterfaceIdiomPad ? 1 : 0;
    }
    return isIPad > 0;
}

static NSInteger isIPod = -1;
+ (BOOL)isIPod {
    if (isIPod < 0) {
        NSString *string = [[UIDevice currentDevice] model];
        isIPod = [string rangeOfString:@"iPod touch"].location != NSNotFound ? 1 : 0;
    }
    return isIPod > 0;
}

static NSInteger isIPhone = -1;
+ (BOOL)isIPhone {
    if (isIPhone < 0) {
        NSString *string = [[UIDevice currentDevice] model];
        isIPhone = [string rangeOfString:@"iPhone"].location != NSNotFound ? 1 : 0;
    }
    return isIPhone > 0;
}

static NSInteger isSimulator = -1;
+ (BOOL)isSimulator {
    if (isSimulator < 0) {
#if TARGET_OS_SIMULATOR
        isSimulator = 1;
#else
        isSimulator = 0;
#endif
    }
    return isSimulator > 0;
}

+ (BOOL)isMac {
#ifdef IOS14_SDK_ALLOWED
    if (@available(iOS 14.0, *)) {
        return [NSProcessInfo processInfo].isiOSAppOnMac || [NSProcessInfo processInfo].isMacCatalystApp;
    }
#endif
    if (@available(iOS 13.0, *)) {
        return [NSProcessInfo processInfo].isMacCatalystApp;
    }
    return NO;
}

static NSInteger isNotchedScreen = -1;
+ (BOOL)isNotchedScreen {
    if (@available(iOS 11, *)) {
        if (isNotchedScreen < 0) {
            if (@available(iOS 12.0, *)) {
                /*
                 检测方式解释/测试要点:
                 1. iOS 11 与 iOS 12 可能行为不同,所以要分别测试。
                 2. 与触发 [QMUIHelper isNotchedScreen] 方法时的进程有关,例如 https://github.com/Tencent/QMUI_iOS/issues/482#issuecomment-456051738 里提到的 [NSObject performSelectorOnMainThread:withObject:waitUntilDone:NO] 就会导致较多的异常。
                 3. iOS 12 下,在非第2点里提到的情况下,iPhone、iPad 均可通过 UIScreen -_peripheryInsets 方法的返回值区分,但如果满足了第2点,则 iPad 无法使用这个方法,这种情况下要依赖第4点。
                 4. iOS 12 下,不管是否满足第2点,不管是什么设备类型,均可以通过一个满屏的 UIWindow 的 rootViewController.view.frame.origin.y 的值来区分,如果是非全面屏,这个值必定为20,如果是全面屏,则可能是24或44等不同的值。但由于创建 UIWindow、UIViewController 等均属于较大消耗,所以只在前面的步骤无法区分的情况下才会使用第4点。
                 5. 对于第4点,经测试与当前设备的方向、是否有勾选 project 里的 General - Hide status bar、当前是否处于来电模式的状态栏这些都没关系。
                 */
                SEL peripheryInsetsSelector = NSSelectorFromString([NSString stringWithFormat:@"_%@%@", @"periphery", @"Insets"]);
                UIEdgeInsets peripheryInsets = UIEdgeInsetsZero;
                [self object:[UIScreen mainScreen] performSelector:peripheryInsetsSelector returnValue:&peripheryInsets];
                if (peripheryInsets.bottom <= 0) {
                    UIWindow *window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
                    peripheryInsets = window.safeAreaInsets;
                    if (peripheryInsets.bottom <= 0) {
                        UIViewController *viewController = [UIViewController new];
                        window.rootViewController = viewController;
                        if (CGRectGetMinY(viewController.view.frame) > 20) {
                            peripheryInsets.bottom = 1;
                        }
                    }
                }
                isNotchedScreen = peripheryInsets.bottom > 0 ? 1 : 0;
            } else {
                isNotchedScreen = [self is58InchScreen] ? 1 : 0;
            }
        }
    } else {
        isNotchedScreen = 0;
    }
    return isNotchedScreen > 0;
}

+ (void)object:(NSObject *)object performSelector:(SEL)selector returnValue:(void *)returnValue {
    NSInvocation *invocation = [NSInvocation invocationWithMethodSignature:[object methodSignatureForSelector:selector]];
    [invocation setTarget:object];
    [invocation setSelector:selector];
    [invocation invoke];
    if (returnValue) {
        [invocation getReturnValue:returnValue];
    }
}

+ (BOOL)isRegularScreen {
    return [self isIPad] || (![self isZoomedMode] && ([self is67InchScreen] || [self is65InchScreen] || [self is61InchScreen] || [self is55InchScreen]));
}

static NSInteger is67InchScreen = -1;
+ (BOOL)is67InchScreen {
    if (is67InchScreen < 0) {
        is67InchScreen = (DEVICE_WIDTH == self.screenSizeFor67Inch.width && DEVICE_HEIGHT == self.screenSizeFor67Inch.height) ? 1 : 0;
    }
    return is67InchScreen > 0;
}

static NSInteger is65InchScreen = -1;
+ (BOOL)is65InchScreen {
    if (is65InchScreen < 0) {
        // Since iPhone XS Max、iPhone 11 Pro Max and iPhone XR share the same resolution, we have to distinguish them using the model identifiers
        // 由于 iPhone XS Max、iPhone 11 Pro Max 这两款机型和 iPhone XR 的屏幕宽高是一致的,我们通过机器 Identifier 加以区别
        is65InchScreen = (DEVICE_WIDTH == self.screenSizeFor65Inch.width && DEVICE_HEIGHT == self.screenSizeFor65Inch.height && ([[self deviceModel] isEqualToString:@"iPhone11,4"] || [[self deviceModel] isEqualToString:@"iPhone11,6"] || [[self deviceModel] isEqualToString:@"iPhone12,5"])) ? 1 : 0;
    }
    return is65InchScreen > 0;
}

static NSInteger is61InchScreenAndiPhone12 = -1;
+ (BOOL)is61InchScreenAndiPhone12 {
    if (is61InchScreenAndiPhone12 < 0) {
        is61InchScreenAndiPhone12 = (DEVICE_WIDTH == self.screenSizeFor61InchAndiPhone12.width && DEVICE_HEIGHT == self.screenSizeFor61InchAndiPhone12.height && ([[self deviceModel] isEqualToString:@"iPhone13,2"] || [[self deviceModel] isEqualToString:@"iPhone13,3"])) ? 1 : 0;
    }
    return is61InchScreenAndiPhone12 > 0;
}

static NSInteger is61InchScreen = -1;
+ (BOOL)is61InchScreen {
    if (is61InchScreen < 0) {
        is61InchScreen = (DEVICE_WIDTH == self.screenSizeFor61Inch.width && DEVICE_HEIGHT == self.screenSizeFor61Inch.height && ([[self deviceModel] isEqualToString:@"iPhone11,8"] || [[self deviceModel] isEqualToString:@"iPhone12,1"])) ? 1 : 0;
    }
    return is61InchScreen > 0;
}

static NSInteger is58InchScreen = -1;
+ (BOOL)is58InchScreen {
    if (is58InchScreen < 0) {
        // Both iPhone XS and iPhone X share the same actual screen sizes, so no need to compare identifiers
        // iPhone XS 和 iPhone X 的物理尺寸是一致的,因此无需比较机器 Identifier
        is58InchScreen = (DEVICE_WIDTH == self.screenSizeFor58Inch.width && DEVICE_HEIGHT == self.screenSizeFor58Inch.height) ? 1 : 0;
    }
    return is58InchScreen > 0;
}

static NSInteger is55InchScreen = -1;
+ (BOOL)is55InchScreen {
    if (is55InchScreen < 0) {
        is55InchScreen = (DEVICE_WIDTH == self.screenSizeFor55Inch.width && DEVICE_HEIGHT == self.screenSizeFor55Inch.height) ? 1 : 0;
    }
    return is55InchScreen > 0;
}

static NSInteger is54InchScreen = -1;
+ (BOOL)is54InchScreen {
    if (is54InchScreen < 0) {
        is54InchScreen = (DEVICE_WIDTH == self.screenSizeFor54Inch.width && DEVICE_HEIGHT == self.screenSizeFor54Inch.height) ? 1 : 0;
    }
    return is54InchScreen > 0;
}

static NSInteger is47InchScreen = -1;
+ (BOOL)is47InchScreen {
    if (is47InchScreen < 0) {
        is47InchScreen = (DEVICE_WIDTH == self.screenSizeFor47Inch.width && DEVICE_HEIGHT == self.screenSizeFor47Inch.height) ? 1 : 0;
    }
    return is47InchScreen > 0;
}

static NSInteger is40InchScreen = -1;
+ (BOOL)is40InchScreen {
    if (is40InchScreen < 0) {
        is40InchScreen = (DEVICE_WIDTH == self.screenSizeFor40Inch.width && DEVICE_HEIGHT == self.screenSizeFor40Inch.height) ? 1 : 0;
    }
    return is40InchScreen > 0;
}

static NSInteger is35InchScreen = -1;
+ (BOOL)is35InchScreen {
    if (is35InchScreen < 0) {
        is35InchScreen = (DEVICE_WIDTH == self.screenSizeFor35Inch.width && DEVICE_HEIGHT == self.screenSizeFor35Inch.height) ? 1 : 0;
    }
    return is35InchScreen > 0;
}

+ (CGSize)screenSizeFor67Inch {
    return CGSizeMake(428, 926);
}

+ (CGSize)screenSizeFor65Inch {
    return CGSizeMake(414, 896);
}

+ (CGSize)screenSizeFor61InchAndiPhone12 {
    return CGSizeMake(390, 844);
}

+ (CGSize)screenSizeFor61Inch {
    return CGSizeMake(414, 896);
}

+ (CGSize)screenSizeFor58Inch {
    return CGSizeMake(375, 812);
}

+ (CGSize)screenSizeFor55Inch {
    return CGSizeMake(414, 736);
}

+ (CGSize)screenSizeFor54Inch {
    return CGSizeMake(375, 812);
}

+ (CGSize)screenSizeFor47Inch {
    return CGSizeMake(375, 667);
}

+ (CGSize)screenSizeFor40Inch {
    return CGSizeMake(320, 568);
}

+ (CGSize)screenSizeFor35Inch {
    return CGSizeMake(320, 480);
}

+ (CGFloat)navBarHeight {
    if ([self isIPad]) {
        return GK_SYSTEM_VERSION >= 12.0 ? 50 : 44;
    }
    if (GK_IS_LANDSCAPE) {
        return [self isRegularScreen] ? 44 : 32;
    }else {
        return 44;
    }
}

+ (CGFloat)navBarHeight_nonFullScreen {
    return 56;
}

static CGFloat tabBarHeight = -1;
+ (CGFloat)tabBarHeight {
    if ([self isIPad]) {
        if ([self isNotchedScreen]) {
            tabBarHeight = 65;
        }else {
            if (GK_SYSTEM_VERSION >= 12.0) {
                tabBarHeight = 50;
            }else {
                tabBarHeight = 49;
            }
        }
    }else {
        if (GK_IS_LANDSCAPE) {
            if ([self isRegularScreen]) {
                tabBarHeight = 49;
            }else {
                tabBarHeight = 32;
            }
        }else {
            tabBarHeight = 49;
        }
        tabBarHeight += [self safeAreaInsetsForDeviceWithNotch].bottom;
    }
    return tabBarHeight;
}

+ (UIEdgeInsets)safeAreaInsets {
    UIEdgeInsets safeAreaInsets = UIEdgeInsetsZero;
    if (@available(iOS 11.0, *)) {
        UIWindow *window = [self keyWindow];
        if (!window) {
            // keyWindow还没创建时,通过创建临时window获取安全区域
            window = [[UIWindow alloc] initWithFrame:UIScreen.mainScreen.bounds];
            if (window.safeAreaInsets.bottom <= 0) {
                UIViewController *viewController = [UIViewController new];
                window.rootViewController = viewController;
            }
        }
        safeAreaInsets = window.safeAreaInsets;
    }
    return safeAreaInsets;
}

+ (CGRect)statusBarFrame {
    CGRect statusBarFrame = CGRectZero;
    if (@available(iOS 13.0, *)) {
        statusBarFrame = [self keyWindow].windowScene.statusBarManager.statusBarFrame;
    }

    if (CGRectEqualToRect(statusBarFrame, CGRectZero)) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
        statusBarFrame = [UIApplication sharedApplication].statusBarFrame;
#pragma clang diagnostic pop
    }

    if (CGRectEqualToRect(statusBarFrame, CGRectZero)) {
        CGFloat statusBarH = [self isNotchedScreen] ? 44 : 20;
        statusBarFrame = CGRectMake(0, 0, GK_SCREEN_WIDTH, statusBarH);
    }

    return statusBarFrame;
}

+ (UIWindow *)keyWindow {
    UIWindow *window = nil;
    if (@available(iOS 13.0, *)) {
        for (UIWindowScene* windowScene in [UIApplication sharedApplication].connectedScenes) {
            if (windowScene.activationState == UISceneActivationStateForegroundActive) {
                for (UIWindow *w in windowScene.windows) {
                    if (window.isKeyWindow) {
                        window = w;
                        break;
                    }
                }
            }
        }
    }

    if (!window) {
        window = [UIApplication sharedApplication].windows.firstObject;
        if (!window.isKeyWindow) {
#pragma clang diagnostic push
#pragma clang diagnostic ignored "-Wdeprecated-declarations"
            UIWindow *keyWindow = [UIApplication sharedApplication].keyWindow;
#pragma clang diagnostic pop
            if (CGRectEqualToRect(keyWindow.bounds, UIScreen.mainScreen.bounds)) {
                window = keyWindow;
            }
        }
    }
    return window;
}

+ (UIEdgeInsets)safeAreaInsetsForDeviceWithNotch {
    if (![self isNotchedScreen]) {
        return UIEdgeInsetsZero;
    }

    if ([self isIPad]) {
        return UIEdgeInsetsMake(0, 0, 20, 0);
    }

    UIInterfaceOrientation orientation = [[UIApplication sharedApplication] statusBarOrientation];

    switch (orientation) {
        case UIInterfaceOrientationPortrait:
            return UIEdgeInsetsMake(44, 0, 34, 0);

        case UIInterfaceOrientationPortraitUpsideDown:
            return UIEdgeInsetsMake(34, 0, 44, 0);

        case UIInterfaceOrientationLandscapeLeft:
        case UIInterfaceOrientationLandscapeRight:
            return UIEdgeInsetsMake(0, 44, 21, 44);

        case UIInterfaceOrientationUnknown:
        default:
            return UIEdgeInsetsMake(44, 0, 34, 0);
    }
}

@end


text:
function updateAndCommit( path, newVal )
{
	var langCode;
	if ( ! ( langCode = Jaxer.session.langCode ) )
		return false;

	var ref = getRemote();

	commit( langCode, path, newVal );
	commitRef( langCode, path, query( ref, path ) );
	return true;
}


text:
{% extends 'search/search_form_base.html' %}

{% block search_heading %}

SEARCH TUGG

{% endblock %}

{% block input_class %}{% endblock %}
{% block button_class %}btn btn-primary input-append{% endblock %}
{% block search_form_class %}form-search-small{% endblock %}
{% block placeholder%}Search again{% endblock %}
{% block container_class %}form-search-small-container{% endblock %}
{% block button_text %}{% endblock %}


text:
package com.eugenewyj.samples.base.jdkproxy;

/**
 * @since 2017/8/31
 */
public interface HelloService {
    void sayHello(String name);
}


text:
package fr.pizzeria.dao;

import javax.persistence.EntityManagerFactory;

import fr.pizzeria.dao.client.ClientDaoJPa;
import fr.pizzeria.dao.commande.CommandeDaoJpa;
import fr.pizzeria.dao.pizza.PizzaDaoFichierImpl;
import fr.pizzeria.dao.pizza.PizzaDaoMemoire;
import fr.pizzeria.dao.pizza.PizzaDaoJPA;
import fr.pizzeria.dao.pizza.PizzaDaoJdbc;
import fr.pizzeria.exception.DaoException;

public class DaoProducer {

	public DaoFactory getDaoFactoryJpa(EntityManagerFactory emf) throws DaoException {
		return new GenericFactoryImpl(new PizzaDaoJPA(emf), new ClientDaoJPa(emf), new CommandeDaoJpa(emf));
	}

	public DaoFactory getDaoFactoryMemoire() {
		return new GenericFactoryImpl(new PizzaDaoMemoire(), null, null);
	}

	public DaoFactory getDaoFactoryFichier() {
		return new GenericFactoryImpl(new PizzaDaoFichierImpl(), null, null);
	}

	public DaoFactory getDaoFactoryJdbc(String driver, String url, String user, String pass) throws DaoException {
		return new GenericFactoryImpl(new PizzaDaoJdbc(driver, url, user, pass), null, null);
	}
}


text:
@implementation AlertHelper

-(void) showAlertDialogWithMessage:(NSString *)message {
    UIAlertView *alertView = [[UIAlertView alloc] initWithTitle:NSLocalizedStringFromTable(@"Alert", @"Intern", nil) message:message delegate:nil cancelButtonTitle:NSLocalizedStringFromTable(@"Close", @"Intern", nil) otherButtonTitles:nil];
    [alertView show];
}

@end


text:
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IFluentQuerySelectCommandBuilder.cs" company="">
//
// </copyright>
// <summary>
//   The FluentQuerySelectCommandBuilder interface.
// </summary>
// --------------------------------------------------------------------------------------------------------------------

namespace FluentQuery.Core.Builder.Interfaces
{
    using System;
    using System.Linq.Expressions;

    using global::FluentQuery.Core.Commands.Interfaces;
    using Commands.Model;
    using Functions;
    using Infrastructure.Enums;

    /// <summary>
    /// The FluentQuerySelectCommandBuilder interface.
    /// </summary>
    public interface IFluentQuerySelectCommandBuilder
    {
        /// <summary>
        /// Used to select all fields
        /// </summary>
        /// <example>
        /// SELECT *
        /// </example>
        /// <returns>
        /// The <see cref="IFluentQuerySelectBuilder"/>.
        /// </returns>
        IFluentQuerySelectBuilder SelectAll();

        /// <summary>
        /// Can be use to select all fields of Entity.
        /// Instead query command use * will be select all fields by name
        /// </summary>
        /// <example>
        /// SELECT 'column1', 'column2' ....
        /// </example>
        /// <typeparam name="TTable">
        /// Table Type
        /// </typeparam>
        /// <returns>
        /// The <see cref="IFluentQuerySelectBuilder"/>.
        /// </returns>
        IFluentQuerySelectBuilder SelectAll<TTable>();

        /// <summary>
        /// Select With From
        /// </summary>
        /// <typeparam name="TTable">
        /// Table Type
        /// </typeparam>
        /// <returns>
        /// The <see cref="IFluentQuerySelectBuilder"/>.
        /// </returns>
        IFluentQuerySelectBuilder SelectWithFrom<TTable>();

        /// <summary>
        /// The select.
        /// </summary>
        /// <param name="selectModel">
        /// The select model.
        /// </param>
        /// <returns>
        /// The <see cref="IFluentQuerySelectBuilder"/>.
        /// </returns>
        IFluentQuerySelectBuilder Select(IFluentQuerySelectItem selectModel);

        /// <summary>
        /// The select.
        /// </summary>
        /// <param name="column">
        /// The parameters.
        /// </param>
        /// <returns>
        /// The <see cref="IFluentQuerySelectBuilder"/>.
        /// </returns>
        IFluentQuerySelectBuilder Select(Func<FluentQuerySelectItemModel> column);

        /// <summary>
        /// The select.
        /// </summary>
        /// <param name="column">
        /// The column.
        /// </param>
        /// <param name="tableAlias">
        /// The alias.
        /// </param>
        /// <typeparam name="TTable">
        /// Table Type
        /// </typeparam>
        /// <returns>
        /// The <see cref="IFluentQuerySelectBuilder"/>.
        /// </returns>
        IFluentQuerySelectBuilder Select<TTable>(Expression<Func<TTable, object>> column, string tableAlias = null);

        /// <summary>
        /// The select.
        /// </summary>
        /// <param name="tableAlias">
        /// The alias.
        /// </param>
        /// <param name="columns">
        /// The columns.
        /// </param>
        /// <typeparam name="TTable">
        /// Table Type
        /// </typeparam>
        /// <returns>
        /// The <see cref="IFluentQuerySelectBuilder"/>.
        /// </returns>
        IFluentQuerySelectBuilder Select<TTable>(string tableAlias = null, params Expression<Func<TTable, object>>[] columns);

        /// <summary>
        /// The select.
        /// </summary>
        /// <param name="columns">
        /// The columns.
        /// </param>
        /// <typeparam name="TTable">
        /// Table Type
        /// </typeparam>
        /// <returns>
        /// The <see cref="IFluentQuerySelectBuilder"/>.
        /// </returns>
        IFluentQuerySelectBuilder Select<TTable>(params Expression<Func<TTable, object>>[] columns);

        /// <summary>
        /// The select.
        /// </summary>
        /// <param name="function">
        /// The function.
        /// </param>
        /// <param name="column">
        /// The column.
        /// </param>
        /// <returns>
        /// The <see cref="IFluentQuerySelectBuilder"/>.
        /// </returns>
        IFluentQuerySelectBuilder Select(IFluentQueryFunctionItem function, Func<FluentQuerySelectItemModel> column);

        /// <summary>
        /// The paginate.
        /// </summary>
        /// <param name="limit">
        /// The limit.
        /// </param>
        /// <param name="offset">
        /// The offset.
        /// </param>
        /// <returns>
        /// The <see cref="IFluentQuerySelectBuilder"/>.
        /// </returns>
        IFluentQuerySelectBuilder Paginate(long limit, long offset);

        /// <summary>
        /// The order.
        /// </summary>
        /// <param name="column">
        /// The column.
        /// </param>
        /// <param name="direction">
        /// The direction.
        /// </param>
        /// <returns>
        /// The <see cref="IFluentQuerySelectBuilder"/>.
        /// </returns>
        IFluentQuerySelectBuilder Order(Func<FluentQuerySelectItemModel> column, FluentQuerySortDirection direction);

        /// <summary>
        /// The order.
        /// </summary>
        /// <param name="column">
        /// The column.
        /// </param>
        /// <param name="direction">
        /// The direction.
        /// </param>
        /// <typeparam name="TTable">
        /// Table Type
        /// </typeparam>
        /// <returns>
        /// The <see cref="IFluentQuerySelectBuilder"/>.
        /// </returns>
        IFluentQuerySelectBuilder Order<TTable>(Expression<Func<TTable, object>> column, FluentQuerySortDirection direction);

        /// <summary>
        /// The order asc.
        /// </summary>
        /// <param name="column">
        /// The column.
        /// </param>
        /// <typeparam name="TTable">
        /// Table Type
        /// </typeparam>
        /// <returns>
        /// The <see cref="IFluentQuerySelectBuilder"/>.
        /// </returns>
        IFluentQuerySelectBuilder OrderAsc<TTable>(Expression<Func<TTable, object>> column);

        /// <summary>
        /// The order desc.
        /// </summary>
        /// <param name="column">
        /// The column.
        /// </param>
        /// <typeparam name="TTable">
        /// Table Type
        /// </typeparam>
        /// <returns>
        /// The <see cref="IFluentQuerySelectBuilder"/>.
        /// </returns>
        IFluentQuerySelectBuilder OrderDesc<TTable>(Expression<Func<TTable, object>> column);
    }
}


text:
package com.github.pagehelper.parser.impl;

import com.github.pagehelper.Page;
import org.apache.ibatis.mapping.BoundSql;
import org.apache.ibatis.mapping.MappedStatement;

import java.util.Map;

/**
 * @author liuzh
 */
public class OracleParser extends AbstractParser {
    @Override
    public String getPageSql(String sql) {
        StringBuilder sqlBuilder = new StringBuilder(sql.length() + 120);
        sqlBuilder.append("select * from ( select tmp_page.*, rownum row_id from ( ");
        sqlBuilder.append(sql);
        sqlBuilder.append(" ) tmp_page where rownum <= ? ) where row_id > ?");
        return sqlBuilder.toString();
    }

    @Override
    public Map setPageParameter(MappedStatement ms, Object parameterObject, BoundSql boundSql, Page page) {
        Map paramMap = super.setPageParameter(ms, parameterObject, boundSql, page);
        paramMap.put(PAGEPARAMETER_FIRST, page.getEndRow());
        paramMap.put(PAGEPARAMETER_SECOND, page.getStartRow());
        return paramMap;
    }
}


text:
using System;
using System.Collections.Generic;

namespace Kernel_alpha.FileSystem
{
    public static class VirtualFileSystem
    {
        private static List<GenericFileSystem> FileSystem;

        public static void Init()
        {
            FileSystem = new List<GenericFileSystem>();
        }

        public static bool Mount(GenericFileSystem FS)
        {
            //TODO: Will have to do much things in future
            FileSystem.Add(FS);
            return true;
        }

        public static GenericFileSystem GetFSNode(int index)
        {
            if (index >= FileSystem.Count)
                throw new Exception("FileSystem Doest not Exist!");
            return FileSystem[index];
        }

        public static GenericFileSystem GetFSNode(char index)
        {
            var aIndex = (int)(index - 0x61);//Only small case char
            if (aIndex >= FileSystem.Count)
                throw new Exception("FileSystem Doest not Exist!");
            return FileSystem[aIndex];
        }
    }
}


text:
<?php namespace App\Providers\Cart\Facades;

use Illuminate\Support\Facades\Facade;

/**
 * Description of CartFacade
 *
 * @author Sandeep Rajoria <sandeep.rajoria@yahoo.co.in>
 * @date   4 Mar, 2017
 */
class CartFacade extends Facade {
     /**
     * Get the registered name of the component.
     *
     * @return string
     */
    protected static function getFacadeAccessor()
    {
        return 'cart';
    }

}


text:
import { nodeOrNew, register, wrapWithAttrCheck } from '../utils/adopter.js'
import { registerMethods } from '../utils/methods.js'
import Container from './Container.js'

export default class Symbol extends Container {
  // Initialize node
  constructor (node, attrs = node) {
    super(nodeOrNew('symbol', node), attrs)
  }
}

registerMethods({
  Container: {
    symbol: wrapWithAttrCheck(function () {
      return this.put(new Symbol())
    })
  }
})

register(Symbol, 'Symbol')


text:
//
//  GDataEntryVolume.m
//

#define GDATAENTRYVOLUME_DEFINE_GLOBALS 1

#import "GDataEntryVolume.h"

#import "GDataComment.h"
#import "GDataRating.h"

@implementation GDataVolumeViewability
+ (NSString *)extensionElementURI       { return kGDataNamespaceBooks; }
+ (NSString *)extensionElementPrefix    { return kGDataNamespaceBooksPrefix; }
+ (NSString *)extensionElementLocalName { return @"viewability"; }
@end

@implementation GDataVolumeEmbeddability
+ (NSString *)extensionElementURI       { return kGDataNamespaceBooks; }
+ (NSString *)extensionElementPrefix    { return kGDataNamespaceBooksPrefix; }
+ (NSString *)extensionElementLocalName { return @"embeddability"; }
@end

@implementation GDataVolumeReview
+ (NSString *)extensionElementURI       { return kGDataNamespaceBooks; }
+ (NSString *)extensionElementPrefix    { return kGDataNamespaceBooksPrefix; }
+ (NSString *)extensionElementLocalName { return @"review"; }
@end

@implementation GDataEntryVolume

+ (NSDictionary *)booksNamespaces {

  NSMutableDictionary *namespaces;

  namespaces = [NSMutableDictionary dictionaryWithObjectsAndKeys:
                kGDataNamespaceBooks, kGDataNamespaceBooksPrefix,
                kGDataNamespaceDublinCore, kGDataNamespaceDublinCorePrefix,
                nil];

  [namespaces addEntriesFromDictionary:[GDataEntryBase baseGDataNamespaces]];

  return namespaces;
}

+ (GDataEntryVolume *)volumeEntry {

  GDataEntryVolume *obj;
  obj = [[[[self class] alloc] init] autorelease];

  [obj setNamespaces:[GDataEntryVolume booksNamespaces]];

  return obj;
}

#pragma mark -

+ (void)load {
  [GDataObject registerEntryClass:[self class]
            forCategoryWithScheme:kGDataCategoryScheme
                             term:kGDataCategoryBooksVolume];
}

- (void)addExtensionDeclarations {

  [super addExtensionDeclarations];

  Class entryClass = [self class];

  [self addExtensionDeclarationForParentClass:entryClass
                                 childClasses:

   [GDataRating class],

   // local extensions
   [GDataVolumeViewability class], [GDataVolumeEmbeddability class],
   [GDataVolumeReview class],

   // DublinCore extensions
   [GDataDCCreator class], [GDataDCDate class], [GDataDCDescription class],
   [GDataDCFormat class], [GDataDCIdentifier class], [GDataDCLanguage class],
   [GDataDCPublisher class], [GDataDCSubject class], [GDataDCTitle class],
   nil];

}

- (id)init {
  self = [super init];
  if (self) {
    GDataCategory *category;

    category = [GDataCategory categoryWithScheme:kGDataCategoryScheme
                                            term:kGDataCategoryBooksVolume];
    [self addCategory:category];
  }
  return self;
}

- (NSMutableArray *)itemsForDescription {

  NSMutableArray *items = [super itemsForDescription];

  [self addToArray:items objectDescriptionIfNonNil:[self comment] withName:@"comment"];
  [self addToArray:items objectDescriptionIfNonNil:[self creators] withName:@"creators"];
  [self addToArray:items objectDescriptionIfNonNil:[self dates] withName:@"dates"];
  [self addToArray:items objectDescriptionIfNonNil:[self volumeDescriptions] withName:@"descriptions"];
  [self addToArray:items objectDescriptionIfNonNil:[self embeddability] withName:@"embedability"];
  [self addToArray:items objectDescriptionIfNonNil:[self formats] withName:@"formats"];
  [self addToArray:items objectDescriptionIfNonNil:[self volumeIdentifiers] withName:@"identifiers"];
  [self addToArray:items objectDescriptionIfNonNil:[self languages] withName:@"languages"];
  [self addToArray:items objectDescriptionIfNonNil:[self publishers] withName:@"publishers"];
  [self addToArray:items objectDescriptionIfNonNil:[self rating] withName:@"rating"];
  [self addToArray:items objectDescriptionIfNonNil:[self review] withName:@"review"];
  [self addToArray:items objectDescriptionIfNonNil:[self subjects] withName:@"subjects"];
  [self addToArray:items objectDescriptionIfNonNil:[self volumeTitles] withName:@"titles"];
  [self addToArray:items objectDescriptionIfNonNil:[self viewability] withName:@"viewability"];

  return items;
}

#pragma mark -

- (GDataComment *)comment {
  return [self objectForExtensionClass:[GDataComment class]];
}

- (void)setComment:(GDataComment *)obj {
  [self setObject:obj forExtensionClass:[GDataComment class]];
}

- (NSArray *)creators {
  return [self objectsForExtensionClass:[GDataDCCreator class]];
}

- (void)setCreators:(NSArray *)arr {
  [self setObjects:arr forExtensionClass:[GDataDCCreator class]];
}

- (void)addCreator:(GDataDCCreator *)obj {
  [self addObject:obj forExtensionClass:[GDataDCCreator class]];
}

- (NSArray *)dates {
  return [self objectsForExtensionClass:[GDataDCDate class]];
}

- (void)setDates:(NSArray *)arr {
  [self setObjects:arr forExtensionClass:[GDataDCDate class]];
}

- (void)addDate:(GDataDCDate *)obj {
  [self addObject:obj forExtensionClass:[GDataDCDate class]];
}

- (NSArray *)volumeDescriptions {
  return [self objectsForExtensionClass:[GDataDCDescription class]];
}

- (void)setVolumeDescriptions:(NSArray *)arr {
  [self setObjects:arr forExtensionClass:[GDataDCDescription class]];
}

- (void)addVolumeDescriptions:(GDataDCFormat *)obj {
  [self addObject:obj forExtensionClass:[GDataDCDescription class]];
}

- (NSString *)embeddability {
  return [self objectForExtensionClass:[GDataVolumeEmbeddability class]];
}

- (void)setEmbeddability:(NSString *)str {
  GDataVolumeEmbeddability *obj = nil;

  if (str != nil) {
    obj = [GDataVolumeEmbeddability valueWithString:str];
  }

  [self setObject:obj forExtensionClass:[GDataVolumeEmbeddability class]];
}

- (NSArray *)formats {
  return [self objectsForExtensionClass:[GDataDCFormat class]];
}

- (void)setFormats:(NSArray *)arr {
  [self setObjects:arr forExtensionClass:[GDataDCFormat class]];
}

- (void)addFormat:(GDataDCFormat *)obj {
  [self addObject:obj forExtensionClass:[GDataDCFormat class]];
}

- (NSArray *)volumeIdentifiers {
  return [self objectsForExtensionClass:[GDataDCIdentifier class]];
}

- (void)setVolumeIdentifiers:(NSArray *)arr {
  [self setObjects:arr forExtensionClass:[GDataDCIdentifier class]];
}

- (void)addVolumeIdentifier:(GDataDCIdentifier *)obj {
  [self addObject:obj forExtensionClass:[GDataDCIdentifier class]];
}

- (NSArray *)languages {
  return [self objectsForExtensionClass:[GDataDCLanguage class]];
}

- (void)setLanguages:(NSArray *)arr {
  [self setObjects:arr forExtensionClass:[GDataDCLanguage class]];
}

- (void)addLanguage:(GDataDCLanguage *)obj {
  [self addObject:obj forExtensionClass:[GDataDCLanguage class]];
}

- (NSArray *)publishers {
  return [self objectsForExtensionClass:[GDataDCPublisher class]];
}

- (void)setPublishers:(NSArray *)arr {
  [self setObjects:arr forExtensionClass:[GDataDCPublisher class]];
}

- (void)addPublisher:(GDataDCPublisher *)obj {
  [self addObject:obj forExtensionClass:[GDataDCPublisher class]];
}

- (GDataRating *)rating {
  return [self objectForExtensionClass:[GDataRating class]];
}

- (void)setRating:(GDataRating *)obj {
  [self setObject:obj forExtensionClass:[GDataRating class]];
}

- (GDataVolumeReview *)review {
  return [self objectForExtensionClass:[GDataVolumeReview class]];
}

- (void)setReview:(GDataVolumeReview *)obj {
  [self setObject:obj forExtensionClass:[GDataVolumeReview class]];
}

- (NSArray *)subjects {
  return [self objectsForExtensionClass:[GDataDCSubject class]];
}

- (void)setSubjects:(NSArray *)arr {
  [self setObjects:arr forExtensionClass:[GDataDCSubject class]];
}

- (void)addSubject:(GDataDCSubject *)obj {
  [self addObject:obj forExtensionClass:[GDataDCSubject class]];
}

- (NSArray *)volumeTitles {
  return [self objectsForExtensionClass:[GDataDCTitle class]];
}

- (void)setVolumeTitles:(NSArray *)arr {
  [self setObjects:arr forExtensionClass:[GDataDCTitle class]];
}

- (void)addVolumeTitle:(GDataDCTitle *)obj {
  [self addObject:obj forExtensionClass:[GDataDCTitle class]];
}

- (NSString *)viewability {
  return [self objectForExtensionClass:[GDataVolumeViewability class]];
}

- (void)setViewability:(NSString *)str {
  GDataVolumeViewability *obj = nil;

  if (str != nil) {
    obj = [GDataVolumeViewability valueWithString:str];
  }

  [self setObject:obj forExtensionClass:[GDataVolumeViewability class]];
}

// convenience accessors

- (GDataLink *)infoLink {
  return [self linkWithRelAttributeValue:kGDataBooksInfoRel];
}

- (GDataLink *)previewLink {
  return [self linkWithRelAttributeValue:kGDataBooksPreviewRel];
}

- (GDataLink *)thumbnailLink {
  return [self linkWithRelAttributeValue:kGDataBooksThumbnailRel];
}

- (GDataLink *)annotationLink {
  return [self linkWithRelAttributeValue:kGDataBooksAnnotationRel];
}

@end