text:
chrome.test.runTests([
  function hasPermission() {
    chrome.test.assertEq("default",  // permission not granted
                         Notification.permission);
    chrome.test.succeed();
  },
  function showTextNotification() {
    var notification = new Notification("Foo", {
      body: "This is a text notification."
    });
    notification.onerror = function() {
      chrome.test.succeed();
    };
    notification.onshow = function() {
      chrome.test.fail("Displayed a notification without permission.");
    };
  }
]);


text:
layout: page
title: User information
permalink: /user
nav_order: 20
has_children: true
---

The pages here are intended for users of the scikit-hep packages.

If you're having trouble installing Python packages or using ROOT with Scikit-HEP packages, see our [Conda installation instructions](Conda installation instructions).

You can find more [resources here][resources], like tutorials, publications, and talks.

[installing-conda]: {{ site.baseurl }}{% link pages/user/installing-conda.md %}
[resources]: {{ site.baseurl }}{% link pages/user/resources.md %}

redpajama_set_name: RedPajamaGithub


text:
package vfs

import (
	"context"
	"io"
	"os"
	"sync"
	"time"

	"github.com/rclone/rclone/fs"
	"github.com/rclone/rclone/fs/operations"
)

// WriteFileHandle is an open for write handle on a File
type WriteFileHandle struct {
	baseHandle
	mu          sync.Mutex
	cond        *sync.Cond // cond lock for out of sequence writes
	closed      bool       // set if handle has been closed
	remote      string
	pipeWriter  *io.PipeWriter
	o           fs.Object
	result      chan error
	file        *File
	writeCalled bool // set the first time Write() is called
	offset      int64
	opened      bool
	flags       int
	truncated   bool
}

// Check interfaces
var (
	_ io.Writer   = (*WriteFileHandle)(nil)
	_ io.WriterAt = (*WriteFileHandle)(nil)
	_ io.Closer   = (*WriteFileHandle)(nil)
)

func newWriteFileHandle(d *Dir, f *File, remote string, flags int) (*WriteFileHandle, error) {
	fh := &WriteFileHandle{
		remote: remote,
		flags:  flags,
		result: make(chan error, 1),
		file:   f,
	}
	fh.cond = sync.NewCond(&fh.mu)
	fh.file.addWriter(fh)
	return fh, nil
}

// returns whether it is OK to truncate the file
func (fh *WriteFileHandle) safeToTruncate() bool {
	return fh.truncated || fh.flags&os.O_TRUNC != 0 || !fh.file.exists()
}

// openPending opens the file if there is a pending open
//
// call with the lock held
func (fh *WriteFileHandle) openPending() (err error) {
	if fh.opened {
		return nil
	}
	if !fh.safeToTruncate() {
		fs.Errorf(fh.remote, "WriteFileHandle: Can't open for write without O_TRUNC on existing file without --vfs-cache-mode >= writes")
		return EPERM
	}
	var pipeReader *io.PipeReader
	pipeReader, fh.pipeWriter = io.Pipe()
	go func() {
		// NB Rcat deals with Stats.Transferring, etc.
		o, err := operations.Rcat(context.TODO(), fh.file.Fs(), fh.remote, pipeReader, time.Now())
		if err != nil {
			fs.Errorf(fh.remote, "WriteFileHandle.New Rcat failed: %v", err)
		}
		// Close the pipeReader so the pipeWriter fails with ErrClosedPipe
		_ = pipeReader.Close()
		fh.o = o
		fh.result <- err
	}()
	fh.file.setSize(0)
	fh.truncated = true
	fh.file.Dir().addObject(fh.file) // make sure the directory has this object in it now
	fh.opened = true
	return nil
}

// String converts it to printable
func (fh *WriteFileHandle) String() string {
	if fh == nil {
		return "<nil *WriteFileHandle>"
	}
	fh.mu.Lock()
	defer fh.mu.Unlock()
	if fh.file == nil {
		return "<nil *WriteFileHandle.file>"
	}
	return fh.file.String() + " (w)"
}

// Node returns the Node associated with this - satisfies Noder interface
func (fh *WriteFileHandle) Node() Node {
	fh.mu.Lock()
	defer fh.mu.Unlock()
	return fh.file
}

// WriteAt writes len(p) bytes from p to the underlying data stream at offset
// off. It returns the number of bytes written from p (0 <= n <= len(p)) and
// any error encountered that caused the write to stop early. WriteAt must
// return a non-nil error if it returns n < len(p).
//
// If WriteAt is writing to a destination with a seek offset, WriteAt should
// not affect nor be affected by the underlying seek offset.
//
// Clients of WriteAt can execute parallel WriteAt calls on the same
// destination if the ranges do not overlap.
//
// Implementations must not retain p.
func (fh *WriteFileHandle) WriteAt(p []byte, off int64) (n int, err error) {
	fh.mu.Lock()
	defer fh.mu.Unlock()
	return fh.writeAt(p, off)
}

// Implementation of WriteAt - call with lock held
func (fh *WriteFileHandle) writeAt(p []byte, off int64) (n int, err error) {
	// defer log.Trace(fh.remote, "len=%d off=%d", len(p), off)("n=%d, fh.off=%d, err=%v", &n, &fh.offset, &err)
	if fh.closed {
		fs.Errorf(fh.remote, "WriteFileHandle.Write: error: %v", EBADF)
		return 0, ECLOSED
	}
	if fh.offset != off {
		waitSequential("write", fh.remote, fh.cond, fh.file.VFS().Opt.WriteWait, &fh.offset, off)
	}
	if fh.offset != off {
		fs.Errorf(fh.remote, "WriteFileHandle.Write: can't seek in file without --vfs-cache-mode >= writes")
		return 0, ESPIPE
	}
	if err = fh.openPending(); err != nil {
		return 0, err
	}
	fh.writeCalled = true
	n, err = fh.pipeWriter.Write(p)
	fh.offset += int64(n)
	fh.file.setSize(fh.offset)
	if err != nil {
		fs.Errorf(fh.remote, "WriteFileHandle.Write error: %v", err)
		return 0, err
	}
	// fs.Debugf(fh.remote, "WriteFileHandle.Write OK (%d bytes written)", n)
	fh.cond.Broadcast() // wake everyone up waiting for an in-sequence read
	return n, nil
}

// Write writes len(p) bytes from p to the underlying data stream. It returns
// the number of bytes written from p (0 <= n <= len(p)) and any error
// encountered that caused the write to stop early. Write must return a non-nil
// error if it returns n < len(p). Write must not modify the slice data, even
// temporarily.
//
// Implementations must not retain p.
func (fh *WriteFileHandle) Write(p []byte) (n int, err error) {
	fh.mu.Lock()
	defer fh.mu.Unlock()
	// Since we can't seek, just call WriteAt with the current offset
	return fh.writeAt(p, fh.offset)
}

// WriteString a string to the file
func (fh *WriteFileHandle) WriteString(s string) (n int, err error) {
	return fh.Write([]byte(s))
}

// Offset returns the offset of the file pointer
func (fh *WriteFileHandle) Offset() (offset int64) {
	fh.mu.Lock()
	defer fh.mu.Unlock()
	return fh.offset
}

// close the file handle returning EBADF if it has been
// closed already.
//
// Must be called with fh.mu held
func (fh *WriteFileHandle) close() (err error) {
	if fh.closed {
		return ECLOSED
	}
	fh.closed = true
	// leave writer open until file is transferred
	defer func() {
		fh.file.delWriter(fh)
	}()
	// If file not opened and not safe to truncate then leave file intact
	if !fh.opened && !fh.safeToTruncate() {
		return nil
	}
	if err = fh.openPending(); err != nil {
		return err
	}
	writeCloseErr := fh.pipeWriter.Close()
	err = <-fh.result
	if err == nil {
		fh.file.setObject(fh.o)
		err = writeCloseErr
	}
	return err
}

// Close closes the file
func (fh *WriteFileHandle) Close() error {
	fh.mu.Lock()
	defer fh.mu.Unlock()
	return fh.close()
}

// Flush is called on each close() of a file descriptor. So if a
// filesystem wants to return write errors in close() and the file has
// cached dirty data, this is a good place to write back data and
// return any errors. Since many applications ignore close() errors
// this is not always useful.
//
// NOTE: The flush() method may be called more than once for each
// open(). This happens if more than one file descriptor refers to an
// opened file due to dup(), dup2() or fork() calls. It is not
// possible to determine if a flush is final, so each flush should be
// treated equally. Multiple write-flush sequences are relatively
// rare, so this shouldn't be a problem.
//
// Filesystems shouldn't assume that flush will always be called after
// some writes, or that if will be called at all.
func (fh *WriteFileHandle) Flush() error {
	fh.mu.Lock()
	defer fh.mu.Unlock()
	if fh.closed {
		fs.Debugf(fh.remote, "WriteFileHandle.Flush nothing to do")
		return nil
	}
	// fs.Debugf(fh.remote, "WriteFileHandle.Flush")
	// If Write hasn't been called then ignore the Flush - Release
	// will pick it up
	if !fh.writeCalled {
		fs.Debugf(fh.remote, "WriteFileHandle.Flush unwritten handle, writing 0 bytes to avoid race conditions")
		_, err := fh.writeAt([]byte{}, fh.offset)
		return err
	}
	err := fh.close()
	if err != nil {
		fs.Errorf(fh.remote, "WriteFileHandle.Flush error: %v", err)
	} else {
		// fs.Debugf(fh.remote, "WriteFileHandle.Flush OK")
	}
	return err
}

// Release is called when we are finished with the file handle
//
// It isn't called directly from userspace so the error is ignored by
// the kernel
func (fh *WriteFileHandle) Release() error {
	fh.mu.Lock()
	defer fh.mu.Unlock()
	if fh.closed {
		fs.Debugf(fh.remote, "WriteFileHandle.Release nothing to do")
		return nil
	}
	fs.Debugf(fh.remote, "WriteFileHandle.Release closing")
	err := fh.close()
	if err != nil {
		fs.Errorf(fh.remote, "WriteFileHandle.Release error: %v", err)
	} else {
		// fs.Debugf(fh.remote, "WriteFileHandle.Release OK")
	}
	return err
}

// Stat returns info about the file
func (fh *WriteFileHandle) Stat() (os.FileInfo, error) {
	fh.mu.Lock()
	defer fh.mu.Unlock()
	return fh.file, nil
}

// Truncate file to given size
func (fh *WriteFileHandle) Truncate(size int64) (err error) {
	// defer log.Trace(fh.remote, "size=%d", size)("err=%v", &err)
	fh.mu.Lock()
	defer fh.mu.Unlock()
	if size != fh.offset {
		fs.Errorf(fh.remote, "WriteFileHandle: Truncate: Can't change size without --vfs-cache-mode >= writes")
		return EPERM
	}
	// File is correct size
	if size == 0 {
		fh.truncated = true
	}
	return nil
}

// Read reads up to len(p) bytes into p.
func (fh *WriteFileHandle) Read(p []byte) (n int, err error) {
	fs.Errorf(fh.remote, "WriteFileHandle: Read: Can't read and write to file without --vfs-cache-mode >= minimal")
	return 0, EPERM
}

// ReadAt reads len(p) bytes into p starting at offset off in the
// underlying input source. It returns the number of bytes read (0 <=
// n <= len(p)) and any error encountered.
func (fh *WriteFileHandle) ReadAt(p []byte, off int64) (n int, err error) {
	fs.Errorf(fh.remote, "WriteFileHandle: ReadAt: Can't read and write to file without --vfs-cache-mode >= minimal")
	return 0, EPERM
}

// Sync commits the current contents of the file to stable storage. Typically,
// this means flushing the file system's in-memory copy of recently written
// data to disk.
func (fh *WriteFileHandle) Sync() error {
	return nil
}


text:
Todo app was generated with [angular-cli](https://github.com/angular/angular-cli) version 1.0.0-beta.24.

## Run application

Please, check that your version of Node is 7.4.0 or higher.
In most cases app should work with 5+ Node versions, but 7.4.0 definitely works.
Before run app:

* Install frontend dependencies: `cd frontend && npm install`
* Run `npm start`. On `localhost:9001` you will have ready app.
* If you want to see frontend changes on backend:
    1. `npm run build`
    2. `cd ../backend && npm start`

## Structure

	frontend
      ├── e2e                           // All End-2End tests
      └── src                           // Main folder with all files
        ├── app                       // All Angular 2 files
        │   ├── components            // All components of app
        │   │   ├── header            // Header with username and profile icon
        │   │   ├── login             // Login page to auth user
        │   │   ├── not-found         // If route not found show this component
        │   │   ├── profile           // Page with user info
        │   │   ├── title             // Reusable component with main info
        │   │   ├── todo              // Todo page for current user
        │   │   └── todo-details      // Details of todo
        │   └── services              // All services of application
        │       └── guards            // Guards folder
        ├── assets                    // All files like images placed here
        └── environments              // If you need different prod, test environments

## All commands available with short description:

```js
npm run ng      // use your local version og angular-cli
npm start       // start frontend part of app
npm run build   // build bundle file of frontend part for backend and save in public folder
npm run lint    // lint all your files
npm test        // run all unit tests
npm run pree2e  // update/download new version of webdriver
npm run e2e     // run e2e tests
```

## Start development server

Run `npm start` for a dev server. Navigate to `http://localhost:9001/`. The app will automatically reload if you change any of the source files.

## Code scaffolding (generate component/service/pipe)

Run `npm run ng generate component component-name` to generate a new component. You can also use `ng generate directive/pipe/service/class/module`.

## Build

Run `npm run build` to build the project. The build artifacts will be stored in the `../backend/public` directory. For build automatically used production build.
All other type of files like images or text always put in src/assets, because they also bundled in build process.

## Running unit tests

Run `npm test` to execute the unit tests via [Karma](https://karma-runner.github.io).
Tests are running in watch mode.

## Running end-to-end tests

Run `npm run pree2e` to update webdriver.
Run `npm e2e` to execute the end-to-end tests via [Protractor](http://www.protractortest.org/).
Before running the tests make sure you are serving the app via `ng serve`.

## Deploying to Github Pages

Run `npm run ng github-pages:deploy` to deploy to Github Pages.
I personally didn't use it, so better read DOCS on angular-cli project.

## Further help

To get more help on the `angular-cli` use `npm run ng help` or go check out the [Angular-CLI README](https://github.com/angular/angular-cli/blob/master/README.md).


text:
sealed trait Option[+A]{
	def map[B](f: A => B): Option[B] = {
		this match {
			case None => None
			case Some(x) => Some(f(x))
		}
	}

	//TODO: Return here and implement without using pattern matching
	def flatMap[B](f: A => Option[B]): Option[B] = this match {
		case None => None
		case Some(x) => f(x)
	}

	def getOrElse[B >: A](default: => B): B = this match {
		case None => default
		case Some(x) => x
	}

	def orElse[B >: A](ob: => Option[B]): Option[B] = this flatMap((f) => ob)

	def filter(f: A => Boolean): Option[A] = {
		this.flatMap((x) => {
				if(f(x) == true) Some(x)
				else None
			}
		)
	}
}

case class Some[+A](get: A) extends Option[A]
case object None extends Option[Nothing]

/*
Implement the variance function in terms of flatMap.
If the mean of a sequence is m, the variance is the mean of math.pow(x - m, 2) for each element x in the sequence.
See the definition of variance on Wikipedia
(http://mng.bz/0Qsr).

def variance(xs: Seq[Double]): Option[Double]

*/

def mean(xs: Seq[Double]): Option[Double] =
    if (xs.isEmpty) None
    else Some(xs.sum / xs.length)

  def variance(xs: Seq[Double]): Option[Double] =
    mean(xs) flatMap (m => mean(xs.map(x => math.pow(x - m, 2))))

val values:Seq[Double] = Seq(1.0, 2.0, 3.0, 4.0, 6.0);

//val variance = values.fold(0.0)((acc,v) => acc + math.pow(v - mean, 2));

println(mean(values));

val xs = values;
xs.fold(0.0)((acc,v) => acc + v)
println(xs.length);


text:
SYNONYM

#### According to
Index Fungorum

#### Published in
N. Z. Jl Bot. 21(2): 196 (1983)

#### Original name
Psoroma sphinctrinum var. microphyllizans Nyl.

### Remarks
null


text:
package com.alipay.api.response;

import com.alipay.api.AlipayResponse;

/**
 * ALIPAY API: alipay.marketing.campaign.discount.whitelist.update response.
 *
 * @author auto create
 * @since 1.0, 2017-03-03 16:47:53
 */
public class AlipayMarketingCampaignDiscountWhitelistUpdateResponse extends AlipayResponse {

	private static final long serialVersionUID = 5559818153614473499L;

}


text:
{-| Discovery of incidents by the maintenance daemon.

This module implements the querying of all monitoring
daemons for the value of the node-status data collector.
Any new incident gets registered.

-}

{-

Copyright (C) 2015 Google Inc.
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:

1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.

2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS
IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

-}

module Ganeti.MaintD.CollectIncidents
  ( collectIncidents
  ) where

import Control.Applicative (liftA2)
import Control.Monad (unless)
import Control.Monad.IO.Class (liftIO)
import qualified Data.ByteString.UTF8 as UTF8
import Data.IORef (IORef)
import Network.Curl
import System.Time (getClockTime)
import qualified Text.JSON as J

import Ganeti.BasicTypes (ResultT)
import qualified Ganeti.Constants as C
import qualified Ganeti.DataCollectors.Diagnose as D
import Ganeti.DataCollectors.Types (getCategoryName)
import qualified Ganeti.HTools.Container as Container
import qualified Ganeti.HTools.Node as Node
import Ganeti.Logging.Lifted
import Ganeti.MaintD.MemoryState (MemoryState, getIncidents, updateIncident)
import Ganeti.Objects.Maintenance
import Ganeti.Utils (newUUID)

-- | Query a node, unless it is offline, and return
-- the paylod of the report, if available. For offline
-- nodes return nothing.
queryStatus :: Node.Node -> IO (Maybe J.JSValue)
queryStatus node = do
  let name = Node.name node
  let url = name ++ ":" ++ show C.defaultMondPort
            ++ "/1/report/" ++ maybe "default" getCategoryName D.dcCategory
            ++ "/" ++ D.dcName
  if Node.offline node
    then do
      logDebug $ "Not asking " ++ name ++ "; it is offline"
      return Nothing
    else do
      (code, body) <- liftIO $ curlGetString url []
      case code of
        CurlOK ->
          case J.decode body of
            J.Ok r -> return $ Just r
            _ -> return Nothing
        _ -> do
          logWarning $ "Failed to contact " ++ name
          return Nothing

-- | Update the status of one node.
updateNode :: IORef MemoryState -> Node.Node -> ResultT String IO ()
updateNode memstate node = do
  let name = Node.name node
  logDebug $ "Inspecting " ++ name
  report <- liftIO $ queryStatus node
  case report of
    Just (J.JSObject obj)
      | Just orig@(J.JSObject origobj) <- lookup "data" $ J.fromJSObject obj,
        Just s <- lookup "status" $ J.fromJSObject origobj,
        J.Ok state <- J.readJSON s,
        state /= RANoop -> do
          let origs = J.encode orig
          logDebug $ "Relevant event on " ++ name ++ ": " ++ origs
          incidents <- getIncidents memstate
          unless (any (liftA2 (&&)
                        ((==) name . incidentNode)
                        ((==) orig . incidentOriginal)) incidents) $ do
            logInfo $ "Registering new incident on " ++ name ++ ": " ++ origs
            uuid <- liftIO newUUID
            now <- liftIO getClockTime
            let tag = C.maintdSuccessTagPrefix ++ uuid
                incident = Incident { incidentOriginal = orig
                                    , incidentAction = state
                                    , incidentRepairStatus = RSNoted
                                    , incidentJobs = []
                                    , incidentNode = name
                                    , incidentTag = tag
                                    , incidentUuid = UTF8.fromString uuid
                                    , incidentCtime = now
                                    , incidentMtime = now
                                    , incidentSerial = 1
                                    }
            liftIO $ updateIncident memstate incident
    _ -> return ()

-- | Query all MonDs for updates on the node-status.
collectIncidents :: IORef MemoryState -> Node.List -> ResultT String IO ()
collectIncidents memstate nl = do
  _ <- getIncidents memstate -- always update the memory state,
                             -- even if we do not observe anything
  logDebug "Querying all nodes for incidents"
  mapM_ (updateNode memstate) $ Container.elems nl


text:
<?xml version="1.0" encoding="utf-8" ?>
<!DOCTYPE erlref SYSTEM "erlref.dtd">

<erlref>

  <copyright>
    <year>2020</year>
    <holder>Ericsson AB. All Rights Reserved.</holder></copyright>
  <legalnotice>
      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.

  </legalnotice>
  <title>wxUpdateUIEvent</title>

<module>wxUpdateUIEvent</module>
<modulesummary>Functions for wxUpdateUIEvent class</modulesummary>
<description>
This class is used for pseudo-events which are called by wxWidgets to give an application the chance to update various user interface elements.

Without update UI events, an application has to work hard to check/uncheck, enable/disable, show/hide, and set the text for elements such as menu items and toolbar buttons. The code for doing this has to be mixed up with the code that is invoked when an action is invoked for a menu item or button.

With update UI events, you define an event handler to look at the state of the application and change UI elements accordingly. wxWidgets will call your member functions in idle time, so you don't have to worry where to call this code.

In addition to being a clearer and more declarative method, it also means you don't have to worry whether you're updating a toolbar or menubar identifier. The same handler can update a menu item and toolbar button, if the identifier is the same. Instead of directly manipulating the menu or button, you call functions in the event object, such as <seemfa marker="#check/2"><c>check/2</c></seemfa>. wxWidgets will determine whether such a call has been made, and which UI element to update.

These events will work for popup menus as well as menubars. Just before a menu is popped up, <c>wxMenu::UpdateUI</c> (not implemented in wx) is called to process any UI events for the window that owns the menu.

If you find that the overhead of UI update processing is affecting your application, you can do one or both of the following:

 Note that although events are sent in idle time, defining a <seeerl marker="wxIdleEvent"><c>wxIdleEvent</c></seeerl> handler for a window does not affect this because the events are sent from <c>wxWindow::OnInternalIdle</c> (not implemented in wx) which is always called in idle time.

wxWidgets tries to optimize update events on some platforms. On Windows and GTK+, events for menubar items are only sent when the menu is about to be shown, and not in idle time.

See: <url href="https://docs.wxwidgets.org/3.1/overview_events.html#overview_events">Overview events</url>

This class is derived (and can use functions) from:
    <seeerl marker="wxCommandEvent"><c>wxCommandEvent</c></seeerl> <seeerl marker="wxEvent"><c>wxEvent</c></seeerl>

wxWidgets docs: <url href="https://docs.wxwidgets.org/3.1/classwx_update_u_i_event.html">wxUpdateUIEvent</url>

  </description>
<title>Events</title>
Use <seemfa marker="wxEvtHandler#connect/3"><c>wxEvtHandler:connect/3</c></seemfa> with <seetype marker="#wxUpdateUIEventType"><c>wxUpdateUIEventType</c></seetype> to subscribe to events of this type.

<datatypes>
    <datatype><name name="wxUpdateUIEvent"/></datatype>
    <datatype><name name="wxUpdateUI"/></datatype>
    <datatype><name name="wxUpdateUIEventType"/></datatype></datatypes>

<funcs>
  <func>
    <name name="canUpdate" arity="1" clause_i="1" since=""/>
    <fsummary>Returns true if it is appropriate to update (send UI update events to) this window. </fsummary>
    <desc>
Returns true if it is appropriate to update (send UI update events to) this window.

This function looks at the mode used (see <seemfa marker="#setMode/1"><c>setMode/1</c></seemfa>), the wxWS_EX_PROCESS_UI_UPDATES flag in <c>window</c>, the time update events were last sent in idle time, and the update interval, to determine whether events should be sent to this window now. By default this will always return true because the update mode is initially wxUPDATE_UI_PROCESS_ALL and the interval is set to 0; so update events will be sent as often as possible. You can reduce the frequency that events are sent by changing the mode and/or setting an update interval.

See: <seemfa marker="#resetUpdateTime/0"><c>resetUpdateTime/0</c></seemfa>, <seemfa marker="#setUpdateInterval/1"><c>setUpdateInterval/1</c></seemfa>, <seemfa marker="#setMode/1"><c>setMode/1</c></seemfa>

</desc>
  </func>

  <func>
    <name name="check" arity="2" clause_i="1" since=""/>
    <fsummary>Check or uncheck the UI element. </fsummary>
    <desc>
Check or uncheck the UI element.

</desc>
  </func>

  <func>
    <name name="enable" arity="2" clause_i="1" since=""/>
    <fsummary>Enable or disable the UI element. </fsummary>
    <desc>
Enable or disable the UI element.

</desc>
  </func>

  <func>
    <name name="show" arity="2" clause_i="1" since=""/>
    <fsummary>Show or hide the UI element. </fsummary>
    <desc>
Show or hide the UI element.

</desc>
  </func>

  <func>
    <name name="getChecked" arity="1" clause_i="1" since=""/>
    <fsummary>Returns true if the UI element should be checked. </fsummary>
    <desc>
Returns true if the UI element should be checked.

</desc>
  </func>

  <func>
    <name name="getEnabled" arity="1" clause_i="1" since=""/>
    <fsummary>Returns true if the UI element should be enabled. </fsummary>
    <desc>
Returns true if the UI element should be enabled.

</desc>
  </func>

  <func>
    <name name="getShown" arity="1" clause_i="1" since=""/>
    <fsummary>Returns true if the UI element should be shown. </fsummary>
    <desc>
Returns true if the UI element should be shown.

</desc>
  </func>

  <func>
    <name name="getSetChecked" arity="1" clause_i="1" since=""/>
    <fsummary>Returns true if the application has called <c>check/2</c>. </fsummary>
    <desc>
Returns true if the application has called <seemfa marker="#check/2"><c>check/2</c></seemfa>.

For wxWidgets internal use only.

</desc>
  </func>

  <func>
    <name name="getSetEnabled" arity="1" clause_i="1" since=""/>
    <fsummary>Returns true if the application has called <c>enable/2</c>. </fsummary>
    <desc>
Returns true if the application has called <seemfa marker="#enable/2"><c>enable/2</c></seemfa>.

For wxWidgets internal use only.

</desc>
  </func>

  <func>
    <name name="getSetShown" arity="1" clause_i="1" since=""/>
    <fsummary>Returns true if the application has called <c>show/2</c>. </fsummary>
    <desc>
Returns true if the application has called <seemfa marker="#show/2"><c>show/2</c></seemfa>.

For wxWidgets internal use only.

</desc>
  </func>

  <func>
    <name name="getSetText" arity="1" clause_i="1" since=""/>
    <fsummary>Returns true if the application has called <c>setText/2</c>. </fsummary>
    <desc>
Returns true if the application has called <seemfa marker="#setText/2"><c>setText/2</c></seemfa>.

For wxWidgets internal use only.

</desc>
  </func>

  <func>
    <name name="getText" arity="1" clause_i="1" since=""/>
    <fsummary>Returns the text that should be set for the UI element. </fsummary>
    <desc>
Returns the text that should be set for the UI element.

</desc>
  </func>

  <func>
    <name name="getMode" arity="0" clause_i="1" since=""/>
    <fsummary>Static function returning a value specifying how wxWidgets will send update events: to all windows, or only to those which specify that they will process the events. </fsummary>
    <desc>
Static function returning a value specifying how wxWidgets will send update events: to all windows, or only to those which specify that they will process the events.

See: <seemfa marker="#setMode/1"><c>setMode/1</c></seemfa>

</desc>
  </func>

  <func>
    <name name="getUpdateInterval" arity="0" clause_i="1" since=""/>
    <fsummary>Returns the current interval between updates in milliseconds. </fsummary>
    <desc>
Returns the current interval between updates in milliseconds.

The value -1 disables updates, 0 updates as frequently as possible.

See: <seemfa marker="#setUpdateInterval/1"><c>setUpdateInterval/1</c></seemfa>

</desc>
  </func>

  <func>
    <name name="resetUpdateTime" arity="0" clause_i="1" since=""/>
    <fsummary>Used internally to reset the last-updated time to the current time. </fsummary>
    <desc>
Used internally to reset the last-updated time to the current time.

It is assumed that update events are normally sent in idle time, so this is called at the end of idle processing.

See: <seemfa marker="#canUpdate/1"><c>canUpdate/1</c></seemfa>, <seemfa marker="#setUpdateInterval/1"><c>setUpdateInterval/1</c></seemfa>, <seemfa marker="#setMode/1"><c>setMode/1</c></seemfa>

</desc>
  </func>

  <func>
    <name name="setMode" arity="1" clause_i="1" since=""/>
    <fsummary>Specify how wxWidgets will send update events: to all windows, or only to those which specify that they will process the events. </fsummary>
    <desc>
Specify how wxWidgets will send update events: to all windows, or only to those which specify that they will process the events.

</desc>
  </func>

  <func>
    <name name="setText" arity="2" clause_i="1" since=""/>
    <fsummary>Sets the text for this UI element. </fsummary>
    <desc>
Sets the text for this UI element.

</desc>
  </func>

  <func>
    <name name="setUpdateInterval" arity="1" clause_i="1" since=""/>
    <fsummary>Sets the interval between updates in milliseconds. </fsummary>
    <desc>
Sets the interval between updates in milliseconds.

Set to -1 to disable updates, or to 0 to update as frequently as possible. The default is 0.

Use this to reduce the overhead of UI update events if your application has a lot of windows. If you set the value to -1 or greater than 0, you may also need to call <seemfa marker="wxWindow#updateWindowUI/2"><c>wxWindow:updateWindowUI/2</c></seemfa> at appropriate points in your application, such as when a dialog is about to be shown.

</desc>
  </func>
  </funcs>
</erlref>


text:
/*
 * Qa full api
 *
 * No description provided (generated by Swagger Codegen https://github.com/swagger-api/swagger-codegen)
 *
 * OpenAPI spec version: all
 *
 * Generated by: https://github.com/swagger-api/swagger-codegen.git
 *
 * 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.
 */

using System;
using System.Linq;
using System.IO;
using System.Text;
using System.Text.RegularExpressions;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Runtime.Serialization;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using System.ComponentModel.DataAnnotations;

namespace HostMe.Sdk.Model
{
    /// <summary>
    /// IEdmTerm
    /// </summary>
    [DataContract]
    public partial class IEdmTerm :  IEquatable<IEdmTerm>, IValidatableObject
    {
        /// <summary>
        /// Gets or Sets TermKind
        /// </summary>
        [JsonConverter(typeof(StringEnumConverter))]
        public enum TermKindEnum
        {

            /// <summary>
            /// Enum None for "None"
            /// </summary>
            [EnumMember(Value = "None")]
            None,

            /// <summary>
            /// Enum Type for "Type"
            /// </summary>
            [EnumMember(Value = "Type")]
            Type,

            /// <summary>
            /// Enum Value for "Value"
            /// </summary>
            [EnumMember(Value = "Value")]
            Value
        }

        /// <summary>
        /// Gets or Sets SchemaElementKind
        /// </summary>
        [JsonConverter(typeof(StringEnumConverter))]
        public enum SchemaElementKindEnum
        {

            /// <summary>
            /// Enum None for "None"
            /// </summary>
            [EnumMember(Value = "None")]
            None,

            /// <summary>
            /// Enum TypeDefinition for "TypeDefinition"
            /// </summary>
            [EnumMember(Value = "TypeDefinition")]
            TypeDefinition,

            /// <summary>
            /// Enum Function for "Function"
            /// </summary>
            [EnumMember(Value = "Function")]
            Function,

            /// <summary>
            /// Enum ValueTerm for "ValueTerm"
            /// </summary>
            [EnumMember(Value = "ValueTerm")]
            ValueTerm,

            /// <summary>
            /// Enum EntityContainer for "EntityContainer"
            /// </summary>
            [EnumMember(Value = "EntityContainer")]
            EntityContainer
        }

        /// <summary>
        /// Gets or Sets TermKind
        /// </summary>
        [DataMember(Name="termKind", EmitDefaultValue=true)]
        public TermKindEnum? TermKind { get; set; }
        /// <summary>
        /// Gets or Sets SchemaElementKind
        /// </summary>
        [DataMember(Name="schemaElementKind", EmitDefaultValue=true)]
        public SchemaElementKindEnum? SchemaElementKind { get; set; }
        /// <summary>
        /// Initializes a new instance of the <see cref="IEdmTerm" /> class.
        /// </summary>
        /// <param name="TermKind">TermKind.</param>
        /// <param name="SchemaElementKind">SchemaElementKind.</param>
        /// <param name="_Namespace">_Namespace.</param>
        /// <param name="Name">Name.</param>
        public IEdmTerm(TermKindEnum? TermKind = null, SchemaElementKindEnum? SchemaElementKind = null, string _Namespace = null, string Name = null)
        {
            this.TermKind = TermKind;
            this.SchemaElementKind = SchemaElementKind;
            this._Namespace = _Namespace;
            this.Name = Name;
        }

        /// <summary>
        /// Gets or Sets _Namespace
        /// </summary>
        [DataMember(Name="namespace", EmitDefaultValue=true)]
        public string _Namespace { get; set; }
        /// <summary>
        /// Gets or Sets Name
        /// </summary>
        [DataMember(Name="name", EmitDefaultValue=true)]
        public string Name { get; set; }
        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            var sb = new StringBuilder();
            sb.Append("class IEdmTerm {\n");
            sb.Append("  TermKind: ").Append(TermKind).Append("\n");
            sb.Append("  SchemaElementKind: ").Append(SchemaElementKind).Append("\n");
            sb.Append("  _Namespace: ").Append(_Namespace).Append("\n");
            sb.Append("  Name: ").Append(Name).Append("\n");
            sb.Append("}\n");
            return sb.ToString();
        }

        /// <summary>
        /// Returns the JSON string presentation of the object
        /// </summary>
        /// <returns>JSON string presentation of the object</returns>
        public string ToJson()
        {
            return JsonConvert.SerializeObject(this, Formatting.Indented);
        }

        /// <summary>
        /// Returns true if objects are equal
        /// </summary>
        /// <param name="obj">Object to be compared</param>
        /// <returns>Boolean</returns>
        public override bool Equals(object obj)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            return this.Equals(obj as IEdmTerm);
        }

        /// <summary>
        /// Returns true if IEdmTerm instances are equal
        /// </summary>
        /// <param name="other">Instance of IEdmTerm to be compared</param>
        /// <returns>Boolean</returns>
        public bool Equals(IEdmTerm other)
        {
            // credit: http://stackoverflow.com/a/10454552/677735
            if (other == null)
                return false;

            return
                (
                    this.TermKind == other.TermKind ||
                    this.TermKind != null &&
                    this.TermKind.Equals(other.TermKind)
                ) &&
                (
                    this.SchemaElementKind == other.SchemaElementKind ||
                    this.SchemaElementKind != null &&
                    this.SchemaElementKind.Equals(other.SchemaElementKind)
                ) &&
                (
                    this._Namespace == other._Namespace ||
                    this._Namespace != null &&
                    this._Namespace.Equals(other._Namespace)
                ) &&
                (
                    this.Name == other.Name ||
                    this.Name != null &&
                    this.Name.Equals(other.Name)
                );
        }

        /// <summary>
        /// Gets the hash code
        /// </summary>
        /// <returns>Hash code</returns>
        public override int GetHashCode()
        {
            // credit: http://stackoverflow.com/a/263416/677735
            unchecked // Overflow is fine, just wrap
            {
                int hash = 41;
                // Suitable nullity checks etc, of course :)
                if (this.TermKind != null)
                    hash = hash * 59 + this.TermKind.GetHashCode();
                if (this.SchemaElementKind != null)
                    hash = hash * 59 + this.SchemaElementKind.GetHashCode();
                if (this._Namespace != null)
                    hash = hash * 59 + this._Namespace.GetHashCode();
                if (this.Name != null)
                    hash = hash * 59 + this.Name.GetHashCode();
                return hash;
            }
        }

        public IEnumerable<ValidationResult> Validate(ValidationContext validationContext)
        {
            yield break;
        }
    }

}


text:
package edu.psu.cse.siis.coal.field.transformers.set;

import edu.psu.cse.siis.coal.field.transformers.FieldTransformer;
import edu.psu.cse.siis.coal.field.transformers.FieldTransformerFactory;

/**
 * A factory for add field transformers.
 */
public class FieldAddTransformerFactory extends FieldTransformerFactory {

  @Override
  public FieldTransformer makeFieldTransformer(Object value) {
    return new Add(value);
  }

}


text:
//
//  Created by Xcode* 4.3.2
//

#import <Cocoa/Cocoa.h>

@interface tbbAppDelegate : NSObject <NSApplicationDelegate>{
    __unsafe_unretained NSWindow *_window;
}

@property (assign) IBOutlet NSWindow *window;

- (BOOL) applicationShouldTerminateAfterLastWindowClosed:(NSApplication *) sender;

@end


text:
AUTO_TEST_PATH=`pwd`
IOS=0
ANDROID=0
#Prepare GTEST
AUTO_TEST_SRC_PATH="../../"
cd ${AUTO_TEST_SRC_PATH}
if [ ! -d "./gtest" ]
then
   make gtest-bootstrap
fi
cd ${AUTO_TEST_PATH}
#To find whether have android devices
echo please set the enviroment variable as:
echo export ANDROID_HOME="path of android sdk"
echo export ANDROID_NDK_HOME="path of android ndk"
ANDROID_SDK_PATH=${ANDROID_HOME}
ANDROID_NDK_PATH=${ANDROID_NDK_HOME}
if [ "#${ANDROID_SDK_PATH}" = "#" ]
then
echo Please set ANDROID_HOME with the path of Android SDK
exit 1
fi
if [ "#${ANDROID_NDK_PATH}" = "#" ]
then
echo Please set ANDROID_NDK_HOME with the path of Android NDK
exit 1
fi
#prepare devices
ADB=${ANDROID_SDK_PATH}/platform-tools/adb

#get devices
devices=`$ADB devices | awk -F" " '/\tdevice/{print $1}'`
if [ "#$devices" = "#" ];then
   echo "Can not find any android devices!"
else
   echo Start to run the unittest on android devices
   ANDROID=1
   cd ./android
   bash run_AutoTest_android.sh >/dev/null 2>&1
   if [ $? -ne 0 ];then
   echo There is something wrong happened when runing unittest on android devices,please to check
   else
   echo Finish run the unittest on android devices sucessfully
   fi
   cd ${AUTO_TEST_PATH}
fi

#To find whether have ios devices
 DEVICES=`system_profiler SPUSBDataType | sed -n -e '/iPad/,/Serial/p' -e '/iPhone/,/Serial/p' | grep "Serial Number:" | awk -F ": " '{print $2}'`
 if [ "${DEVICES}#" == "#" ]
 then
 echo "Can not find any ios devices!"
else
  echo Start to run the unittest on ios devices
  IOS=1
  cd ./ios
  bash run_AutoTest_ios.sh >/dev/null 2>&1
 if [ $? -ne 0 ];then
 echo There is something wrong happened when runing unittest on ios devices,please to check
 else
 echo Finish run the unittest on android devices sucessfully
fi
 cd ${AUTO_TEST_PATH}
fi

#To parse the unit test result file to find whether have failures
if [ ${ANDROID} = "1" ];then
echo "
">>mail.log
echo "
Run unit test on android devices">>mail.log
bash run_ParseUTxml.sh ./android/report
ret=$?
if [ ${ret} -eq 0 ];then
echo Unit test run on the android devices have not any failure case
elif [ ${ret} -eq 2 ];then
echo Unit test have cases failed,please check
elif [ ${ret} -eq 1 ];then
echo Unit test run failed
fi
fi
if [ ${IOS} = "1" ];then
echo "
Run unit test on ios devices with armv7 & arm64">>mail.log
bash run_ParseUTxml.sh ./ios/report
ret=$?
if [ $ret -eq 0 ];then
echo Unit test run on the ios devices have not any failure case
elif [ $ret -eq 2 ];then
echo Unit test have cases failed,please check
elif [ $ret -eq 1 ];then
echo Unit test run failed
fi
fi


text:
package org.olat.lms.course.editor;

import java.util.List;
import java.util.Locale;
import java.util.Set;

import org.olat.lms.course.condition.interpreter.ConditionErrorMessage;
import org.olat.lms.course.condition.interpreter.ConditionExpression;
import org.olat.lms.course.condition.interpreter.ConditionInterpreter;
import org.olat.lms.group.learn.CourseGroupManager;
import org.olat.presentation.course.editor.StatusDescription;
import org.olat.system.commons.resource.OLATResourceable;

/**
 * Description:

 * The course environment used when working in the course editor. Provides some methods to help all the validation and consistency checking code
 *

 * Initial Date: Jul 6, 2005

 *
 * @author patrick
 */
public interface CourseEditorEnv {
    /**
     * checks for an existing node id if the underlying course node is assessable, e.g. if it makes sense to be used in certain condition functions
     *
     * @param nodeId
     * @return
     */
    boolean isAssessable(String nodeId);

    /**
     * @param nodeId
     * @return
     */
    boolean existsNode(String nodeId);

    /**
     * @param groupname
     * @return
     */
    boolean existsGroup(String groupname);

    boolean existsRightGroup(String groupname);

    /**
     * @param areaname
     * @return
     */
    boolean existsArea(String areaname);

    /**
     * @return
     */
    String getCurrentCourseNodeId();

    /**
     * @param courseNodeId
     */
    void setCurrentCourseNodeId(String courseNodeId);

    /**
     * @param ci
     */
    void setConditionInterpreter(ConditionInterpreter ci);

    /**
     * the locale of the editor environment to have the facility of providing localized messages within the course editor environment.
     *
     * @return Locale of editor environment
     */
    Locale getEditorEnvLocale();

    /**
     * validates the condition expression within the condition interpreter. If the condition expression is syntactically and semantically correct the method returns true,
     * false otherwise.

     *
 The valid soft references found are accessible via the condition expression, and also the complete error summary for the condition expression.
     *
     * @param condExpr
     * @return
     */
    public ConditionErrorMessage[] validateConditionExpression(ConditionExpression condExpr);

    /**
     * @param e
     */
    public void pushError(Exception e);

    /**
     * @param category
     * @param softReference
     */
    public void addSoftReference(String category, String softReference);

    /**
     * after calling validate course, the course is checked for condition and configuration errors. These validation messages are accessible via CourseEditorEnv
     */
    void validateCourse();

    /**
     * lists problems and errors of the course at the very moment. Should be called after validateCourse and before a next click in the course editor.
     *
     * @return
     */
    StatusDescription[] getCourseStatus();

    /**
     * @param ident
     * @return list of nodes referencing the specified node
     */
    List getReferencingNodeIdsFor(String ident);

    /**
     * check if the given node is of type enrollment
     *
     * @param nodeId
     * @return
     */
    boolean isEnrollmentNode(String nodeId);

    /**
     * The specified visibility, accessability and score rules defined for a course node reference other couse nodes ids. This references together with the course tree
     * structure build a directed graph. An important precondition for publishing changes is the cycle freeness of this directed graph.
     *
     * @return
     */
    Set<String> listCycles();

    /**
     * Return CourseGroupManager for this course environment.
     *
     * @return CourseGroupManager for this course environment
     */
    public CourseGroupManager getCourseGroupManager();

    /**
     * @return
     */
    public OLATResourceable getCourseOlatResourceable();

}


text:
"""Base class for destinations.

A destination is a place where Grow static builds can be deployed. Grow takes
a pod, builds a static fileset, and deploys it to a remote location (the
desitnation), suitable for serving the web site to live end users.

A "deployment" is a destination loaded up with a configuration.

Currently, Grow only supports static deployments, however, this may change as
Grow implements features such as "password protection" and geolocation.

The deployment process generally works like this:

  (1) A pod is exported, creating a dictionary mapping file paths to content.
  (2) A connection is made between Grow and the destination.
  (3) Control files are retrieved from the destination, if they exist. All
      control files are serialized ProtoRPC messages. The most important
      control file is "index.proto.json", which contains an index of file
      paths to sha-1 hashes of each file's content.
  (4) An index is generated locally, and the local index is compared to the
      index at the destination. This allows Grow to produce a diff between
      the local ("canary") fileset and the destination's fileset.
  (5) An integration test (if any) is performed.
  (6) If the deployment is a dry run, the process ends here.
  (7) Any required pre-launch configuration to the destination is applied.
  (8) The diff between the local and remote fileset is applied.
  (9) Updated control files are written to the desination.
  (10) Any required post-launch configuration to the destination is applied.

  The deployment is complete!

All deployments follow this process, and the BaseDestination class takes
care of most of the hard work and business logic. So if you're adding a new
destination, you'll just have to implement the following methods/properties:

  delete_file(self, path)
    Deletes a file at the destination, given the file's pod path.

  read_file(self, path)
    Reads a file at the destination, returning the file's content.

  write_file(self, rendered_doc)
    Writes a file at the destination, given the file's rendered_document.

  write_files(self, paths_to_rendered_doc)
    Writes files in bulk, given a mapping of paths to rendered_document.

  KIND
    A string identifying the deployment.

The following methods are optional to implement:

  postlaunch(self, dry_run)
    Performs any post-launch tasks.

  prelaunch(self, dry_run)
    Performs any pre-launch configuration/tasks.

  write_control_file(self, basename, content):
    Writes a control file to the destination.

If your destination requires configuration, you should add a nested class:

  Config
    A ProtoRPC message for destination configuration.

New builtin destinations should be added to the list of builtins in
grow/deployments/deployments.py. Proprietary destinations can be registered
using deployments.register_destination.
"""

import inspect
import io
import json
import logging
import os
import subprocess
import re
import sys
from grow.common import utils
from grow.deployments import indexes
from grow.deployments import tests
from grow.performance import profile_report
from grow.pods import env
from grow.pods import pods
from grow.rendering import rendered_document
from . import messages

class Error(Exception):
    pass

class CommandError(Error):
    pass

class DestinationTestCase(object):

    def __init__(self, deployment):
        self.deployment = deployment

    def test_write_file(self):
        basename = 'test.tmp'
        title = 'Can write files to {}'.format(self.deployment)
        message = messages.TestResultMessage(title=title)
        self.deployment.write_control_file(basename, 'test')
        content = self.deployment.read_control_file(basename)
        if content != 'test':
            message.result = messages.Result.FAIL
        self.deployment.delete_control_file(basename)
        return message

    def __iter__(self):
        for name, func in inspect.getmembers(self, predicate=inspect.ismethod):
            if name.startswith('test_'):
                yield func

class BaseDestination(object):
    """Base destination for building and deploying."""

    TestCase = DestinationTestCase
    diff_basename = 'diff.proto.json'
    index_basename = 'index.proto.json'
    stats_basename = 'stats.proto.json'
    threaded = True
    batch_writes = False
    success = False

    def __init__(self, config, name='default'):
        self.config = config
        self.name = name
        self.pod = None
        self._diff = None
        self._confirm = None

    def __str__(self):
        return self.__class__.__name__

    @property
    def control_dir(self):
        if self.config.keep_control_dir:
            control_dir = pods.Pod.PATH_CONTROL
            return os.path.join(self.pod.root, control_dir, 'deployments', self.name)
        if self._has_custom_control_dir:
            return self.config.control_dir
        return pods.Pod.PATH_CONTROL

    @property
    def filters(self):
        """Configuration for deployment filters."""
        try:
            return self.config.filters
        except AttributeError:
            return []

    @property
    def prevent_untranslated(self):
        """Configuration for untranslated messages preventing deployment."""
        if not self.config.base_config:
            return False
        return self.config.base_config.prevent_untranslated

    @property
    def storage(self):
        raise NotImplementedError

    def _get_remote_index(self):
        try:
            content = self.read_control_file(self.index_basename)
            return indexes.Index.from_string(content)
        except IOError:
            logging.info('Unable to find remote index: {}'.format(
                self.index_basename))
            return indexes.Index.create()

    def export_profile_report(self):
        """Write the results of the profiling timers."""
        report = profile_report.ProfileReport(self.pod.profile)
        file_name = '{}profile.json'.format(self.control_dir)
        self.pod.write_file(file_name, json.dumps(report.export()))
        logging.info('Profiling data exported to {}'.format(file_name))

    def export_untranslated_catalogs(self):
        dir_path = '{}untranslated/'.format(self.control_dir)
        catalogs = self.pod.translation_stats.export_untranslated_catalogs(
            self.pod, dir_path=dir_path)
        self.pod.delete_files([dir_path], recursive=True,
                              pattern=re.compile(r'\.po$'))
        for _, catalog in catalogs.iteritems():
            catalog.save()
        if self.pod.translation_stats.stacktraces:
            self.pod.write_file(os.path.join(dir_path, 'tracebacks.log'),
                self.pod.translation_stats.export_untranslated_tracebacks())
        if catalogs or self.pod.translation_stats.stacktraces:
            logging.info('Untranslated strings exported to {}'.format(dir_path))

    def get_env(self):
        """Returns an environment object based on the config."""
        if self.config.env:
            return env.Env(self.config.env)
        config = env.EnvConfig(host='localhost')
        return env.Env(config)

    def read_file(self, path):
        """Returns a file-like object."""
        raise NotImplementedError

    def write_files(self, paths_to_rendered_doc):
        """Writes files in bulk."""
        raise NotImplementedError

    def write_file(self, rendered_doc):
        """Writes an individual file."""
        raise NotImplementedError

    def delete_file(self, path):
        raise NotImplementedError

    @property
    def _has_custom_control_dir(self):
        return (hasattr(self.config, 'control_dir')
                and self.config.control_dir is not None)

    def delete_control_file(self, path):
        path = os.path.join(self.control_dir, path.lstrip('/'))
        if self.config.keep_control_dir:
            return self.pod.delete_file(path)
        if self._has_custom_control_dir:
            return self.storage.delete(path)
        return self.delete_file(path)

    def read_control_file(self, path):
        path = os.path.join(self.control_dir, path.lstrip('/'))
        if self.config.keep_control_dir:
            return self.pod.read_file(path)
        if self._has_custom_control_dir:
            return self.storage.read(path)
        return self.read_file(path)

    def write_control_file(self, path, content):
        path = os.path.join(self.control_dir, path.lstrip('/'))
        if self.config.keep_control_dir:
            return self.pod.write_file(path, content)
        if self._has_custom_control_dir:
            return self.storage.write(path, content)
        if self.batch_writes:
            return self.write_files({
                path: rendered_document.RenderedDocument(path, content)
            })
        return self.write_file(
            rendered_document.RenderedDocument(path, content))

    def test(self):
        results = messages.TestResultsMessage(test_results=[])
        failures = []
        test_case = self.TestCase(self)
        for func in test_case:
            result_message = func()
            results.test_results.append(result_message)
            if result_message.result == messages.Result.FAIL:
                failures.append(result_message)
        tests.print_results(results)
        return results

    def postlaunch(self, dry_run=False):
        pass

    def prelaunch(self, dry_run=False):
        pass

    def login(self, account, reauth=False):
        pass

    def dump(self, pod, pod_paths=None, use_threading=True, source_dir=None):
        """Dump the contents of the pod."""
        pod.set_env(self.get_env())
        return pod.dump(
            pod_paths=pod_paths, use_threading=use_threading,
            source_dir=source_dir)

    def deploy(self, content_generator, stats=None, repo=None, dry_run=False,
               confirm=False, test=True, is_partial=False, require_translations=False):
        self._confirm = confirm
        self.prelaunch(dry_run=dry_run)
        if test:
            self.test()
        with self.pod.profile.timer('deployments.destination.Base.deploy'):
            try:
                deployed_index = self._get_remote_index()
                if require_translations:
                    self.pod.enable(self.pod.FEATURE_TRANSLATION_STATS)
                diff, new_index, paths_to_rendered_doc = indexes.Diff.stream(
                    deployed_index, content_generator, repo=repo, is_partial=is_partial)
                self._diff = diff
                if indexes.Diff.is_empty(diff):
                    logging.info('Finished with no diffs since the last build.')
                    return
                if dry_run:
                    return
                indexes.Diff.pretty_print(diff)
                if require_translations and self.pod.translation_stats.untranslated:
                    self.pod.translation_stats.pretty_print()
                    raise pods.Error('Aborted deploy due to untranslated strings. '
                                     'Use the --force-untranslated flag to force deployment.')
                if confirm:
                    text = 'Proceed to deploy? -> {}'.format(self)
                    if not utils.interactive_confirm(text):
                        logging.info('Aborted.')
                        return
                indexes.Diff.apply(
                    diff, paths_to_rendered_doc, write_func=self.write_file,
                    batch_write_func=self.write_files, delete_func=self.delete_file,
                    threaded=self.threaded, batch_writes=self.batch_writes)
                self.write_control_file(
                    self.index_basename, indexes.Index.to_string(new_index))
                if stats is not None:
                    self.write_control_file(self.stats_basename, stats.to_string())
                else:
                    self.delete_control_file(self.stats_basename)
                if diff:
                    self.write_control_file(
                        self.diff_basename, indexes.Diff.to_string(diff))
                self.success = True
            finally:
                self.postlaunch()
        return diff

    def command(self, command):
        with io.BytesIO() as fp:
            proc = subprocess.Popen(command, stdout=subprocess.PIPE,
                                    stderr=subprocess.PIPE, shell=True)
            for line in iter(proc.stdout.readline, ''):
                sys.stdout.write(line)
                fp.write(line)
            err = proc.stderr.read()
            if err:
                raise CommandError(err)


text:
.. _notifier-index:

Notifier
========

.. autoclass:: dyn.tm.accounts.Notifier
    :members:
    :undoc-members:

Notifier Examples
-----------------
The following examples highlight how to use the :class:`Notifier` class to
get/create :class:`Notifier`'s on the dyn.tm System and how to edit these
objects from within a Python script.

Creating a new Notifier
^^^^^^^^^^^^^^^^^^^^^^^
The following example shows how to create a new :class:`Notifier` on the dyn.tm
System and how to edit some of the fields using the returned :class:`Notifier`
object.
::

    >>> from dyn.tm.accounts import Notifier
    >>> # Create a dyn.tmSession
    >>> new_notif = Notifier(label='notifierlabel')
    >>> new_notif.services
    []
    >>> new_notif.recipients
    []
    >>> # Probably want to include more

Getting an Existing Notifier
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
The following example shows how to get an existing :class:`Notifier` from the
dyn.tm System and how to edit some of the same fields mentioned above.
::

    >>> from dyn.tm.accounts import Notifier
    >>> # Create a dyn.tmSession
    >>> # Note that in order to get a Notifier you will need the ID of that Notifier
    >>> my_notif = Notifier(my_notifier_id)
    >>> my_notif.services
    []
    >>> my_notif.recipients
    []
    >>> # Probably want to include more


text:
// Use, modification and distribution is subject to the Boost Software
// License, Version 1.0. (See accompanying file LICENSE_1_0.txt or copy at
// http://www.boost.org/LICENSE_1_0.txt)

//  Authors: Douglas Gregor
//           Andrew Lumsdaine
#define PBGL_ACCOUNTING

#include <boost/graph/use_mpi.hpp>
#include <boost/config.hpp>
#include <boost/throw_exception.hpp>
#include <boost/graph/distributed/boman_et_al_graph_coloring.hpp>
#include <boost/graph/distributed/mpi_process_group.hpp>
#include <boost/lexical_cast.hpp>
#include <boost/graph/parallel/distribution.hpp>
#include <boost/graph/erdos_renyi_generator.hpp>
#include <boost/graph/distributed/adjacency_list.hpp>
#include <boost/graph/graphviz.hpp>
#include <iostream>
#include <boost/random.hpp>
#include <boost/test/minimal.hpp>

#ifdef BOOST_NO_EXCEPTIONS
void
boost::throw_exception(std::exception const& ex)
{
    std::cout << ex.what() << std::endl;
    abort();
}
#endif

using namespace boost;
using boost::graph::distributed::mpi_process_group;

void
test_distributed_graph_coloring(int n, double p, int s,
                                int seed, bool emit_dot_file)
{
  typedef adjacency_list<listS,
                         distributedS<mpi_process_group, vecS>,
                         undirectedS> Graph;

  typedef property_map<Graph, vertex_index_t>::type vertex_index_map;

  // Build a random number generator
  minstd_rand gen;
  gen.seed(seed);

  // Build a random graph
  Graph g(erdos_renyi_iterator<minstd_rand, Graph>(gen, n, p),
          erdos_renyi_iterator<minstd_rand, Graph>(),
          n);

  // Set up color map
  std::vector<int> colors_vec(num_vertices(g));
  iterator_property_map<int*, vertex_index_map> color(&colors_vec[0],
                                                      get(vertex_index, g));

  // Run the graph coloring algorithm
  graph::boman_et_al_graph_coloring(g, color, s);

  if (process_id(g.process_group()) == 0) {
    graph::distributed::boman_et_al_graph_coloring_stats.print(std::cout);
  }

  if ( emit_dot_file ) {
    if ( process_id(g.process_group()) == 0 ) {
      for (int i = 0; i < n; ++i)
        get(color, vertex(i, g));
      synchronize(color);
    } else {
      synchronize(color);
    }

    write_graphviz("coloring.dot", g, paint_by_number(color));
  }
}

int test_main(int argc, char* argv[])
{
  mpi::environment env(argc, argv);

  int n = 1000;
  double p = 0.01;
  int s = 100;
  int seed = 1;
  bool emit_dot_file = false;

  if (argc > 1) n             = lexical_cast<int>(argv[1]);
  if (argc > 2) p             = lexical_cast<double>(argv[2]);
  if (argc > 3) s             = lexical_cast<int>(argv[3]);
  if (argc > 4) seed          = lexical_cast<int>(argv[4]);
  if (argc > 5) emit_dot_file = lexical_cast<bool>(argv[5]);

  test_distributed_graph_coloring(n, p, s, seed, emit_dot_file);

  return 0;
}


text:
<?php

/**
 * Exception that is thrown if the current location is not valid. This means it
 * is impossible to read or write using the location values.
 *
 * @package Configuration
 * @version //autogen//
 */
class ezcConfigurationInvalidSuffixException extends ezcConfigurationException
{
    /**
     * Constructs a new ezcConfigurationInvalidSuffixException.
     *
     * @param string $path
     * @param string $expectedSuffix
     * @return void
     */
    function __construct( $path, $expectedSuffix )
    {
        parent::__construct( "The path '{$path}' has an invalid suffix (should be '{$expectedSuffix}')." );
    }
}
?>


text:
::Sequel.migration do
  change do
    [:flowcells, :tubes, :spin_columns, :plates, :tube_racks, :gels, :filter_papers, :fluidigms].each do |labware_table|
      alter_table(labware_table) do
        add_foreign_key :location_id, :locations, :key => :id
      end
    end
  end
end


text:
<?php

namespace Faker\Provider\fi_FI;

class Payment extends \Faker\Provider\Payment
{
    /**
     * International Bank Account Number (IBAN)
     * @link http://en.wikipedia.org/wiki/International_Bank_Account_Number
     * @param  string  $prefix      for generating bank account number of a specific bank
     * @param  string  $countryCode ISO 3166-1 alpha-2 country code
     * @param  integer $length      total length without country code and 2 check digits
     * @return string
     */
    public static function bankAccountNumber($prefix = '', $countryCode = 'FI', $length = null)
    {
        return static::iban($countryCode, $prefix, $length);
    }

    /**
     * Value Added Tax (VAT)
     *
     * @example 'FI12345678'
     *
     * @see http://ec.europa.eu/taxation_customs/vies/faq.html?locale=en#item_11
     * @see http://www.iecomputersystems.com/ordering/eu_vat_numbers.htm
     * @see http://en.wikipedia.org/wiki/VAT_identification_number
     * @see https://www.ytj.fi/en/index/vatnumber.html
     *
     * @return string VAT Number
     */
    public static function vat()
    {
        return sprintf("FI%d", self::randomNumber(8, true));
    }
}


text:
package cloud.blstudio.mrbsclient.activities;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;

import cloud.blstudio.mrbsclient.R;

/**
 * Created by bl on 16-10-18.
 */

public class LogoutActivity extends Activity {
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.logout_panel);

        Button confirmBtn = (Button) findViewById(R.id.logout_yes);
        confirmBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onLogout();
            }
        });

        Button cancelBtn = (Button) findViewById(R.id.logout_no);
        cancelBtn.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                onCancel();
            }
        });
    }

    private void onLogout() {
        MainActivity.instance.updateIconClickListener(false);
        this.finish();
    }

    private void onCancel() {
        this.finish();
    }
}


text:
package org.zkybase.kite.exception;

/**
 * Runtime exception indicating that a call protected by a circuit breaker failed due to an open circuit.
 *
 * @author Willie Wheeler (willie.wheeler@gmail.com)
 * @since 1.0
 */
@SuppressWarnings("serial")
public class CircuitOpenException extends GuardException {

	public CircuitOpenException() {
		super("Circuit open");
	}
}


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

namespace MutexArticle
{
    class BankAccountSimple
    {
        private double bankMoney = 0d;

        public BankAccountSimple(double money)
        {
            LogConsole("Setting initial amount of money: " + money);

            if (money < 0)
            {
                LogConsole("The entered money quantity cannot be negative. Money: " + money);
                throw new ArgumentException(GetMessageWithTreadId("The entered money quantity cannot be negative. Money: " + money));
            }

            this.bankMoney = money;
        }

        public void AddMoney(double money = 0)
        {
            LogConsole("Money to be added: " + money);

            if (money < 0)
            {
                LogConsole("The entered money quantity cannot be negative. Money: " + money);
                throw new ArgumentException(GetMessageWithTreadId("The entered money quantity cannot be negative. Money: " + money));
            }

            this.bankMoney = this.bankMoney + money;

            if (this.bankMoney < 0)
            {
                LogConsole("The money quantity cannot be negative. Money: " + money);
                throw new ArgumentException(GetMessageWithTreadId("The money quantity cannot be negative. Money: " + money));
            }

            LogConsole("Total amount of money: " + this.bankMoney);
        }

        public void WithdrawMoney(double money = 0)
        {

            if (money < 0)
            {
                LogConsole("The entered money quantity cannot be negative. Money: " + money);
                throw new ArgumentException(GetMessageWithTreadId("The entered money quantity cannot be negative. Money: " + money));
            }

            LogConsole("Money to be withdrawed: " + money);

            this.bankMoney = this.bankMoney - money;

            if (this.bankMoney < 0)
            {
                LogConsole("The money quantity cannot be negative. Money: " + money);
                throw new ArgumentException(GetMessageWithTreadId("The money quantity cannot be negative. Money: " + money));
            }

            Console.WriteLine("Thread ID: " + getCurrenThreadId() + ": Total amount of money: " + this.bankMoney);
        }

        public double GetBankStatement()
        {
            LogConsole("Bank Statement: Total amount of money: " + this.bankMoney);
            return bankMoney;
        }

        private String getCurrenThreadId()
        {
            return Thread.CurrentThread.ManagedThreadId.ToString();
        }

        private void LogConsole(String message)
        {
            Console.WriteLine(GetMessageWithTreadId(message));
        }

        private String GetMessageWithTreadId(String message)
        {
            return "Thread ID: " + getCurrenThreadId() + ": " + message;
        }
    }
}


text:
package org.apache.tomcat.util.bcel.classfile;

import java.io.DataInput;
import java.io.DataOutputStream;
import java.io.IOException;

import org.apache.tomcat.util.bcel.Constants;

/**
 * This class is derived from the abstract
 * Constant class
 * and represents a reference to an int object.
 *
 * @version $Id: ConstantInteger.java 895187 2010-01-02 13:17:11Z rjung $
 * @author  M. Dahm
 * @see     Constant
 */
public final class ConstantInteger extends Constant implements ConstantObject {

    private int bytes;

    /**
     * @param bytes Data
     */
    public ConstantInteger(int bytes) {
        super(Constants.CONSTANT_Integer);
        this.bytes = bytes;
    }

    /**
     * Initialize instance from file data.
     *
     * @param file Input stream
     * @throws IOException
     */
    ConstantInteger(DataInput file) throws IOException {
        this(file.readInt());
    }

    /**
     * Dump constant integer to file stream in binary format.
     *
     * @param file Output file stream
     * @throws IOException
     */
    public final void dump( DataOutputStream file ) throws IOException {
        file.writeByte(tag);
        file.writeInt(bytes);
    }

    /**
     * @return data, i.e., 4 bytes.
     */
    public final int getBytes() {
        return bytes;
    }

    /**
     * @return String representation.
     */
    public final String toString() {
        return super.toString() + "(bytes = " + bytes + ")";
    }

}


text:
module SakuraObjectStorage
  VERSION = "0.1.0"
end


text:
selected_tz=$(tzselect)
echo "selected $selected_tz"
ln -sfv /usr/share/zoneinfo/"$selected_tz" /etc/localtime


text:
package org.springside.modules.persistence;

import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Collection;
import java.util.Date;
import java.util.List;

import javax.persistence.criteria.CriteriaBuilder;
import javax.persistence.criteria.CriteriaQuery;
import javax.persistence.criteria.Path;
import javax.persistence.criteria.Predicate;
import javax.persistence.criteria.Root;

import org.apache.commons.lang3.StringUtils;
import org.springframework.data.jpa.domain.Specification;
import org.springside.modules.persistence.SearchFilter.Operator;
import org.springside.modules.utils.Collections3;

import com.google.common.collect.Lists;

public class DynamicSpecifications {

	public static <T> Specification<T> bySearchFilter(final Collection<SearchFilter> filters, final Class<T> entityClazz) {
		return new Specification<T>() {
			@Override
			public Predicate toPredicate(Root<T> root, CriteriaQuery<?> query, CriteriaBuilder builder) {
				if (Collections3.isNotEmpty(filters)) {

					List<Predicate> predicates = Lists.newArrayList();
					for (SearchFilter filter : filters) {
						// nested path translate, 如Task的名为"user.name"的filedName, 转换为Task.user.name属性
						String[] names = StringUtils.split(filter.fieldName, ".");
						Path expression = root.get(names[0]);
						for (int i = 1; i < names.length; i++) {
							expression = expression.get(names[i]);
						}

						// logic operator
						switch (filter.operator) {
						case EQ:
							predicates.add(builder.equal(expression, filter.value));
							break;
						case LIKE:
							predicates.add(builder.like(expression, "%" + filter.value + "%"));
							break;
						case GT:
							predicates.add(builder.greaterThan(expression, (Comparable) filter.value));
							break;
						case LT:
							predicates.add(builder.lessThan(expression, (Comparable) filter.value));
							break;
						case GTE:
							predicates.add(builder.greaterThanOrEqualTo(expression, (Comparable) filter.value));
							break;
						case LTE:
							predicates.add(builder.lessThanOrEqualTo(expression, (Comparable) filter.value));
							break;
						case MMAFT:
							predicates.add(builder.greaterThan((Path<Date>)expression, new Date(Long.valueOf((String) filter.value))));
							break;
						case MMBFR:
							predicates.add(builder.lessThan((Path<Date>)expression, new Date(Long.valueOf((String) filter.value))));
							break;
						case AFT:
							try {
								predicates.add(builder.greaterThan((Path<Date>)expression, new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse((String) filter.value)));
							} catch (ParseException e) {
								// calvin, 这里咋处理?我认为,加不上这个条件就拉倒了,
							}
							break;
						case BFR:
							try {
								predicates.add(builder.lessThan((Path<Date>)expression,new SimpleDateFormat("yyyy-MM-dd hh:mm:ss").parse((String) filter.value)));
							} catch (ParseException e) {
								// calvin, 这里咋处理?我认为,加不上这个条件就拉倒了,
							}
							break;
						}
					}

					// 将所有条件用 and 联合起来
					if (!predicates.isEmpty()) {
						return builder.and(predicates.toArray(new Predicate[predicates.size()]));
					}
				}

				return builder.conjunction();
			}
		};
	}
}


text:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">

<title>de.unihannover.se.iviewxjava.core.receiver (iviewx-java 1.0.0 API)</title>
<meta name="date" content="2017-06-28">
<link rel="stylesheet" type="text/css" href="../../../../../../stylesheet.css" title="Style">

JavaScript is disabled on your browser.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes

Package de.unihannover.se.iviewxjava.core.receiver

Contains classes for defining and implementing receivers.

See: Description

Class Summary

Class
Description

ETPlaybackReceiver<E extends ChronologicComparable<E>>

Receives chronologically ordered data from a ETChronologicCollection.

ETReceiver<E extends ChronologicComparable<E>>

This class provides a skeletal implementation of a Receiver
  that fetches chronologically ordered data.

Package de.unihannover.se.iviewxjava.core.receiver Description

Contains classes for defining and implementing receivers.

  To define your own receiver, you have to create a class that
  extends ETReceiver. Receivers can be used
  throughout the eyetracking core library, making it easy to reuse
  the library for different sources (eyetrackers, databases, etc). To
  define custom types see the de.unihannover.se.iviewxjava.core.chronologic package.

  If you need a receiver that simply plays back data from a
  ETChronologicCollection, then take a
  look at ETPlaybackReceiver.

Skip navigation links

Overview

Package

Class

Tree

Deprecated

Index

Help

Prev Package

Next Package

Frames

No Frames

All Classes


text:
<?xml version="1.0" encoding="utf-8"?>

<database name="default"
         namespace="Articulate\EditorBundle\Entities"
          defaultIdMethod="native">

  <table name="Editor" phpName="Editor" idMethod="native">

    <behavior name="timestampable" />
    <behavior name="archivable" />
    <behavior name="query_cache" />

    <column name="EditorID"      phpName="EditorID"      type="INTEGER"  required="true" primaryKey="true" autoIncrement="true"/>
    <column name="FirstName"     phpName="FirstName"     type="VARCHAR"  required="true" size="128" />
    <column name="LastName"      phpName="LastName"      type="VARCHAR"  required="true" size="128" />
    <column name="Email"         phpName="Email"         type="VARCHAR"  required="true" size="128" />
    <column name="NoteID"        phpName="NoteID"      type="INTEGER"  required="false"/>

    <foreign-key foreignTable="Note">
       <reference local="NoteID" foreign="NoteID" />
    </foreign-key>

    <vendor type="mysql">
      <parameter name="Engine" value="InnoDB"/>
    </vendor>
  </table>

</database>