text:
# A0139956L
###### \java\seedu\scheduler\commons\events\storage\FilePathChangeEvent.java
``` java
package seedu.scheduler.commons.events.storage;

import seedu.scheduler.commons.events.BaseEvent;

/**
 * Indicates a change in file path
 */
public class FilePathChangeEvent extends BaseEvent {

	public String path;

    public FilePathChangeEvent(String path) {
        this.path = path;
    }

    @Override
    public String toString(){
        return this.path;
    }
}
```
###### \java\seedu\scheduler\logic\commands\AddCommand.java
``` java
        if (endDate == null && endTime != null) {
        	endDate = getCurrentDate();
        }
```
###### \java\seedu\scheduler\logic\commands\PathCommand.java
``` java
package seedu.scheduler.logic.commands;

import seedu.scheduler.commons.core.EventsCenter;
import seedu.scheduler.commons.events.storage.FilePathChangeEvent;

/**
 * Manually change a file path to a user-specified location.
 */
public class PathCommand extends Command {

    public static final String COMMAND_WORD = "path";
    public static final String COMMAND_WORD2 = "p";
    public static final String MESSAGE_USAGE = COMMAND_WORD + " or "+ COMMAND_WORD2 + ": Change a specific file path to save. "
            + "Parameters: FILE_PATH\n"
            + "Example: " + COMMAND_WORD +  " or "+ COMMAND_WORD2 + " dropbox";

    public static final String MESSAGE_SUCCESS = "File Path to save changed to: ";

    String filePath;

    public PathCommand(String filePath) {
    	this.filePath = filePath;
    }

	@Override
	public CommandResult execute() {
		EventsCenter.getInstance().post(new FilePathChangeEvent(filePath));
		return new CommandResult(MESSAGE_SUCCESS + filePath);
	}
}
```
###### \java\seedu\scheduler\logic\parser\Parser.java
``` java
    private static final Pattern PATH_DATA_ARGS_FORMAT =
            Pattern.compile("(?<name>[\\p{Alnum}|/]+)"); //data/ <---

```
###### \java\seedu\scheduler\logic\parser\Parser.java
``` java
        case ListCommand.COMMAND_WORD2:
        	//return new ListCommand();
```
###### \java\seedu\scheduler\logic\parser\Parser.java
``` java
        case PathCommand.COMMAND_WORD:
            return preparePath(arguments);

        case PathCommand.COMMAND_WORD2:
            return preparePath(arguments);
```
###### \java\seedu\scheduler\MainApp.java
``` java
    @Subscribe
    public void changeFilePathRequestEvent(FilePathChangeEvent event) {
    	logger.info(LogsCenter.getEventHandlingLogMessage(event));
    	config.setSchedulerFilePath(event.toString());
    	try {
    		ConfigUtil.saveConfig(config, Config.DEFAULT_CONFIG_FILE);  //copy the data, save the file as the file name
    	}
    	catch (IOException e) {
    		logger.warning("Problem with changing of file path" + StringUtil.getDetails(e));
    	}
    	storage.setFilePath(event.toString());
    }
```
###### \java\seedu\scheduler\model\entry\ReadOnlyEntry.java
``` java
    /**
     * Returns true if both have the same state. (interfaces cannot override .equals)
     */
    default boolean isSameStateAs(ReadOnlyEntry other) {
        return other == this // short circuit if same object
                || (other != null // this is first to avoid NPE below
                && other.getName().equals(this.getName()) // state checks here onwards
                && other.getStartTime().equals(this.getStartTime())
                && other.getEndTime().equals(this.getEndTime())
                && other.getDate().equals(this.getDate())
                && other.getEndDate().equals(this.getEndDate()));
    }
```
###### \java\seedu\scheduler\storage\Storage.java
``` java
    void setFilePath(String filePath);
```
###### \java\seedu\scheduler\storage\StorageManager.java
``` java
    public StorageManager(String schedulerFilePath, String userPrefsFilePath) {
        super();
        this.schedulerStorage = new XmlSchedulerStorage(schedulerFilePath);
        this.userPrefsStorage = new JsonUserPrefsStorage(userPrefsFilePath);
    }
```
###### \java\seedu\scheduler\storage\StorageManager.java
``` java
    @Override
    public void saveScheduler(ReadOnlyScheduler scheduler) throws IOException {
    	schedulerStorage.saveScheduler(scheduler, schedulerStorage.getSchedulerFilePath());
    }

    @Override
    public void saveScheduler(ReadOnlyScheduler scheduler, String filePath) throws IOException {
        logger.fine("Attempting to write to data file: " + filePath);
        schedulerStorage.saveScheduler(scheduler, filePath);
    }

    @Override
    public void setFilePath(String pathFile) {
    	this.schedulerStorage = new XmlSchedulerStorage(pathFile);
    }
```
###### \java\seedu\scheduler\ui\CommandBox.java
``` java
    private void addToPlaceholder() {
        SplitPane.setResizableWithParent(placeHolderPane, false);
        placeHolderPane.getChildren().add(commandTextField);
        commandTextField.requestFocus();  //auto-focus upon start up
        FxViewUtil.applyAnchorBoundaryParameters(commandPane, 0.0, 0.0, 0.0, 0.0);
        FxViewUtil.applyAnchorBoundaryParameters(commandTextField, 0.0, 0.0, 0.0, 0.0);
    }
```
###### \java\seedu\scheduler\ui\EntryCard.java
``` java
    public static final String COMPLETED_INDICATION = "-fx-background-color: #ccffcc;";
    public static final String OVERDUE_INDICATION = "-fx-background-color:  #ffcce6;";
```
###### \java\seedu\scheduler\ui\EntryCard.java
``` java
    @FXML
    public void initialize() {
        name.setText(entry.getName().fullName);
        hideFieldsAccordingToType(entry);
        indicatingColourByCondition(entry);
        id.setText(displayedIndex + ". ");
        date.setText("Start Date : " + entry.getDate().value);
        startTime.setText("Start Time : " + entry.getStartTime().value);
        endDate.setText("End Date  : " + entry.getEndDate().value);
        endTime.setText("End Time  : " + entry.getEndTime().value);
        tags.setText(entry.tagsString());
    }
```
###### \java\seedu\scheduler\ui\EntryCard.java
``` java
    public void hideFieldsAccordingToType(ReadOnlyEntry entry) {
        //deadline task
        if (endDateInput(entry)) {
            startTime.setVisible(false);
            endTime.setVisible(false);
            date.setVisible(false);
        }
        if (startDateInput(entry)) {
            startTime.setVisible(false);
            endTime.setVisible(false);
            endDate.setVisible(false);
        }
        if(startAndEndDateInput(entry)) {
            startTime.setVisible(false);
            endTime.setVisible(false);
        }
        //floating task
        if (floatTask(entry)) {
            startTime.setVisible(false);
            endTime.setVisible(false);
            date.setVisible(false);
            endDate.setVisible(false);
        }
        if (startTimeInput(entry)) {
        	endTime.setVisible(false);
        	endDate.setVisible(false);
        }
        if (endTimeInput(entry)) {
        	startTime.setVisible(false);
        	date.setVisible(false);
        }
    }

	private boolean startAndEndDateInput(ReadOnlyEntry entry) {
		return entry.getStartTime().toString().contains("empty")
        		&& entry.getEndTime().toString().contains("empty");
	}

	private boolean endDateInput(ReadOnlyEntry entry) {
		return entry.getStartTime().toString().contains("empty")
        		&& entry.getEndTime().toString().contains("empty")
        		&& entry.getDate().toString().contains("empty");
	}

	private boolean startDateInput(ReadOnlyEntry entry) {
		return entry.getStartTime().toString().contains("empty")
        		&& entry.getEndTime().toString().contains("empty")
        		&& entry.getEndDate().toString().contains("empty");
	}

	private boolean floatTask(ReadOnlyEntry entry) {
		return entry.getStartTime().toString().contains("empty")
        		&& entry.getEndTime().toString().contains("empty")
        		&& entry.getDate().toString().contains("empty")
        		&& entry.getEndDate().toString().contains("empty");
	}

	private boolean startTimeInput(ReadOnlyEntry entry) {
		return entry.getEndTime().toString().contains("empty")
         		&& entry.getEndDate().toString().contains("empty");
	}

	private boolean endTimeInput(ReadOnlyEntry entry) {
		return entry.getStartTime().toString().contains("empty")
        		&& entry.getDate().toString().contains("empty");
	}

    public void indicatingColourByCondition(ReadOnlyEntry entry) {
    	//get today date from system
        Date today = new Date();

    	//put startDate and endDate into Date
    	String startDate = entry.getDate().toString();
    	String endDate = entry.getEndDate().toString();

        DateFormat sdf = new SimpleDateFormat("dd-MM-yyyy");
        DateFormat edf = new SimpleDateFormat("dd-MM-yyyy");

        Date startDateObj;
        Date endDateObj;

        //if only entry startDate before today
		try {
			startDateObj = sdf.parse(startDate);
	        if (onlyStartDateInput(entry, today, startDateObj)) {
	             cardPane.setStyle(OVERDUE_INDICATION);
	        }
		} catch (ParseException e1) {
		}

		//if entry endDate before today
		try {
	        endDateObj = edf.parse(endDate);
	        if (endDateObj.before(today)) {
	             cardPane.setStyle(OVERDUE_INDICATION);
	        }
		} catch (ParseException e) {
		}

    	//if entry completed
        if (entry.tagsString().contains("Completed")) {
            cardPane.setStyle(COMPLETED_INDICATION);
        }

    }

	private boolean onlyStartDateInput(ReadOnlyEntry entry, Date today, Date startDateObj) {
		return startDateObj.before(today)
				&& entry.getStartTime().toString().contains("empty")
				&& entry.getEndTime().toString().contains("empty")
				&& entry.getEndDate().toString().contains("empty");
	}
}
```
###### \java\seedu\scheduler\ui\StatusBarFooter.java
``` java
    @Subscribe
    public void getFilePathRequestEvent(FilePathChangeEvent event) {
        addSaveLocation();
        setSaveLocation("./" + event.toString());
    }
```
###### \resources\view\EntryListCard.fxml
``` fxml
                        <Label fx:id="endDate" styleClass="cell_small_label" text="\$endDate" />
```
###### \resources\view\Extensions.css
``` css
.error {
    -fx-background-color: indianred;
}

.tag-selector {
    -fx-border-width: 1;
    -fx-border-color: white;
    -fx-border-radius: 3;
    -fx-background-radius: 3;
}

.tooltip-text {
    -fx-text-fill: white;
}
```
###### \resources\view\MainWindow.fxml
``` fxml
<?import javafx.geometry.Insets?>
<?import javafx.scene.control.*?>
<?import javafx.scene.layout.*?>
<?import java.net.URL?>
<VBox maxHeight="Infinity" maxWidth="Infinity" minHeight="-Infinity" minWidth="-Infinity" xmlns="http://javafx.com/javafx/8" xmlns:fx="http://javafx.com/fxml/1" fx:controller="seedu.scheduler.ui.MainWindow">
   <stylesheets>
      <URL value="@SchedulerTheme.css" />
      <URL value="@Extensions.css" />
   </stylesheets>
   <children>
      <MenuBar maxHeight="37.0" minHeight="37.0" prefWidth="692.0" VBox.vgrow="NEVER">
         <menus>
            <Menu mnemonicParsing="false" text="File">
               <items>
                  <MenuItem mnemonicParsing="false" onAction="#handleExit" text="Exit" />
               </items>
            </Menu>
            <Menu mnemonicParsing="false" text="Help">
               <items>
                  <MenuItem fx:id="helpMenuItem" mnemonicParsing="false" onAction="#handleHelp" text="Help" />
               </items>
            </Menu>
         </menus>
      </MenuBar>
       <SplitPane id="splitPane" fx:id="splitPane" dividerPositions="0.8" VBox.vgrow="ALWAYS">
         <items>
            <VBox fx:id="entryList" minWidth="340" prefWidth="340">
                <padding>
                    <Insets top="10.0" bottom="10.0" left="10.0" right="5.0" />
                </padding>
               <children>
                  <AnchorPane fx:id="entryListPanelPlaceholder" VBox.vgrow="ALWAYS"/>
               </children>
            </VBox>
        <!--  <AnchorPane fx:id="browserPlaceholder" prefWidth="340" >
                <padding>
                    <Insets top="10.0" bottom="10.0" left="5.0" right="10.0"/>
                </padding>
            </AnchorPane> -->
         </items>
      </SplitPane>
             <AnchorPane fx:id="resultDisplayPlaceholder" styleClass="anchor-pane-with-border" minHeight="80" prefHeight="100" maxHeight="100" VBox.vgrow="NEVER">
           <padding>
               <Insets top="5.0" bottom="5.0" left="10.0" right="10.0"/>
           </padding>
       </AnchorPane>
           <AnchorPane fx:id="commandBoxPlaceholder" styleClass="anchor-pane-with-border" VBox.vgrow="NEVER">
         <padding>
            <Insets top="5.0" bottom="5.0" left="10.0" right="10.0"/>
         </padding>
      </AnchorPane>
      <AnchorPane fx:id="statusbarPlaceholder" VBox.vgrow="NEVER" />
   </children>
</VBox>
```
###### \resources\view\SchedulerTheme.css
``` css
.root {
    -fx-focus-color: transparent;
}

.background {
    -fx-background-color: derive(#0a0f51, 20%);
}

.label {
    -fx-font-size: 12pt;
    -fx-font-family: "Helvetica";
    -fx-text-fill: #555555;
    -fx-opacity: 0.9;
}

.label-bright {
    -fx-font-size: 12pt;
    -fx-font-family: "Helvetica";
    -fx-text-fill: white;
    -fx-opacity: 1;
}

.label-header {
    -fx-font-size: 32pt;
    -fx-font-family: "Helvetica";
    -fx-text-fill: white;
    -fx-opacity: 1;
}

.text-field {
    -fx-font-size: 12pt;
    -fx-font-family: "Helvetica";
    -fx-border-color: transparent;
    -fx-background-insets: 0;
}

.text-field:focused {
    -fx-focus-color: transparent;
}

.text-area {
    -fx-background-insets: 0;
    -fx-background-color: transparent;
}

.text-area .content {
    -fx-background-color: #F2F2F2;
    -fx-border-color: transparent;
    -fx-background-insets: 0
}

.tab-pane {
    -fx-padding: 0 0 0 1;
}

.tab-pane .tab-header-area {
    -fx-padding: 0 0 0 0;
    -fx-min-height: 0;
    -fx-max-height: 0;
}

.table-view {
    -fx-base: #0a0f51;
    -fx-control-inner-background: #0a0f51;
    -fx-background-color: #0a0f51;
    -fx-table-cell-border-color: transparent;
    -fx-table-header-border-color: transparent;
    -fx-padding: 5;
}

.table-view .column-header-background {
    -fx-background-color: transparent;
}

.table-view .column-header, .table-view .filler {
    -fx-size: 35;
    -fx-border-width: 0 0 1 0;
    -fx-background-color: transparent;
    -fx-border-color:
        transparent
        transparent
        derive(-fx-base, 80%)
        transparent;
    -fx-border-insets: 0 10 1 0;
}

.table-view .column-header .label {
    -fx-font-size: 20pt;
    -fx-font-family: "Segoe UI Light";
    -fx-text-fill: white;
    -fx-alignment: center-left;
    -fx-opacity: 1;
}

.table-view:focused .table-row-cell:filled:focused:selected {
    -fx-background-color: -fx-focus-color;
}

.split-pane:horizontal .split-pane-divider {
    -fx-border-color: transparent transparent transparent transparent;
    -fx-background-color: transparent, transparent;
}

.split-pane {
    -fx-border-radius: 1;
    -fx-border-width: 1;
    -fx-background-color: derive(#0a0f51, 100%);
}

.list-view {
    -fx-background-insets: 0;
    -fx-padding: 0;
}

.list-cell {
    -fx-label-padding: 0 0 0 0;
    -fx-graphic-text-gap : 0;
    -fx-padding: 0 0 0 0;
}

.list-cell .empty {
    -fx-background-color:derive(#0a0f51, 100%);
}

.list-cell .label {
    -fx-text-fill: #010504;
}

.cell_index_label {
    -fx-font-size:16px;
    -fx-font-weight: bold;
}

.cell_big_label {
    -fx-font-size: 16px;
    -fx-text-fill: #010504;
}

.cell_big_label {
    -fx-fonr-size: 14px;
    -fx-text-fill: #010504;
    -fx-font-weight: bold;
}

.cell_small_label {
    -fx-font-size: 12px;
    -fx-text-fill: #010504;
}

.anchor-pane {
     -fx-background-color: #ffffff;
}

.status-bar {
    -fx-background-color: derive(#0a0f51, 20%);
    -fx-text-fill: black;
}

.result-display {
    -fx-background-color: #ffffff;
    -fx-border-color: transparent;
    -fx-focus-color: transparent;
    -fx-background-insets: 0;
}

.result-display .label {
    -fx-text-fill: black !important;
}

.status-bar .label {
    -fx-text-fill: white;
}

.status-bar-with-border {
    -fx-background-color: derive(#0a0f51, 30%);
    -fx-border-color: derive(#0a0f51, 25%);
    -fx-border-width: 1px;
}

.status-bar-with-border .label {
    -fx-text-fill: white;
}

.grid-pane {
    -fx-background-color: derive(#0a0f51, 100%);
    -fx-border-color: derive(#0a0f51, 100%);
    -fx-border-width: 1px;
}

.grid-pane .anchor-pane {
    -fx-background-color: derive(#0a0f51, 100%);
}

.context-menu {
    -fx-background-color: derive(#0a0f51, 30%);
}

.context-menu .label {
    -fx-text-fill: white;
}

.menu-bar {
    -fx-background-color: derive(#0a0f51, 20%);
}

.menu-bar .label {
    -fx-font-size: 14pt;
    -fx-font-family: "Helvetica Bold";
    -fx-text-fill: white;
    -fx-opacity: 1.0;
}

.menu .left-container {
    -fx-background-color: black;

}

/*
 * Metro style Push Button
 * Author: Pedro Duque Vieira
 * http://pixelduke.wordpress.com/2012/10/23/jmetro-windows-8-controls-on-java/
 */
.button {
    -fx-padding: 5 22 5 22;
    -fx-border-color: #e2e2e2;
    -fx-border-width: 2;
    -fx-background-radius: 0;
    -fx-background-color: #0a0f51;
    -fx-font-family: "Segoe UI", Helvetica, Arial, sans-serif;
    -fx-font-size: 11pt;
    -fx-text-fill: #d8d8d8;
    -fx-background-insets: 0 0 0 0, 0, 1, 2;
}

.button:hover {
    -fx-background-color: #3a3a3a;
}

.button:pressed, .button:default:hover:pressed {
  -fx-background-color: white;
  -fx-text-fill: #0a0f51;
}

.button:focused {
    -fx-border-color: white, white;
    -fx-border-width: 1, 1;
    -fx-border-style: solid, segments(1, 1);
    -fx-border-radius: 0, 0;
    -fx-border-insets: 1 1 1 1, 0;
}

.button:disabled, .button:default:disabled {
    -fx-opacity: 0.4;
    -fx-background-color: #0a0f51;
    -fx-text-fill: white;
}

.button:default {
    -fx-background-color: -fx-focus-color;
    -fx-text-fill: #ffffff;
}

.button:default:hover {
    -fx-background-color: derive(-fx-focus-color, 30%);
}

.dialog-pane {
    -fx-background-color: #0a0f51;
}

.dialog-pane > *.button-bar > *.container {
    -fx-background-color: #0a0f51;
}

.dialog-pane > *.label.content {
    -fx-font-size: 12px;
    -fx-font-weight: bold;
    -fx-text-fill: white;
}

.dialog-pane:header *.header-panel {
    -fx-background-color: derive(#0a0f51, 300%);
}

.dialog-pane:header *.header-panel *.label {
    -fx-font-size: 18px;
    -fx-font-style: italic;
    -fx-fill: white;
    -fx-text-fill: white;
}

.scroll-bar .thumb {
    -fx-background-color: derive(#0a0f51, 50%);
    -fx-background-insets: 3;
}

.scroll-bar .increment-button, .scroll-bar .decrement-button {
    -fx-background-color: transparent;
    -fx-padding: 0 0 0 0;
}

.scroll-bar .increment-arrow, .scroll-bar .decrement-arrow {
    -fx-shape: " ";
}

.scroll-bar:vertical .increment-arrow, .scroll-bar:vertical .decrement-arrow {
    -fx-padding: 1 8 1 8;
}

.scroll-bar:horizontal .increment-arrow, .scroll-bar:horizontal .decrement-arrow {
    -fx-padding: 8 1 8 1;
}

#cardPane {
    -fx-background-color: transparent;
    -fx-border-color: #bcbcbc;
    -fx-border-width: 0 0 4 0;
}

#commandTypeLabel {
    -fx-font-size: 11px;
    -fx-text-fill: #F70D1A;
}

#filterField, #entryListPanel, #entryWebpage {
    -fx-effect: innershadow(gaussian, black, 10, 0, 0, 0);
}
```


text:
'use strict'
/* global require */
/* global process */

let glob = require('glob')
let child_process = require('child_process')
let filendir = require('filendir')

// Convert .shp files with a postfix `_WGS84` into geojon files.
glob('data/shp/**/*_WGS84.shp', {nocase: true}, (error, files)=>{
    if(error){
        throw new Error(error)
        process.exit(1)
    }

    files.forEach( f => {
        ['topojson', 'geojson'].forEach( format =>  {
            let fNewFormat = f.replace(/(data\/)(shp)(\/.*)(SHP)/i, `$1${format}$3json`)
            filendir.writeFileSync(fNewFormat, '')
            child_process.execSync(`mapshaper ${f} -simplify 2.5% -o ${fNewFormat} force format=${format}`)
        })
    })
})

redpajama_set_name: RedPajamaGithub


text:
package org.xander.chessboard.figuresPlacement;

import static org.xander.chessboard.figures.Figure.BISHOP;

public class BishopsPlacement extends DiagonalFiguresPlacement {
    @Override
    public char getFigure() {
        return BISHOP.getFigure();
    }

    @Override
    public void attackPlaceForPosition(int position, char[] boardElements, int dimension) {
        diagonalAttackPlacement(position, dimension, boardElements);
    }

    @Override
    public boolean isAttackPlacesForPositionNotHarmingToAnotherFigures(int position, char[] boardElements, int dimension) {
        return isDiagonalAttackPlacementNotHarming(position, boardElements, dimension);
    }
}


text:
import json
import multiprocessing
import os
import Queue

import cairo
import mapnik

import constants
import projections

class Renderer(multiprocessing.Process):
    """
    A Mapnik renderer process.
    """
    def __init__(self, output_dir, tile_queues, mapnik_config, width=constants.DEFAULT_WIDTH, height=constants.DEFAULT_HEIGHT, filetype=constants.DEFAULT_FILE_TYPE, buffer_size=None, skip_existing=False):
        multiprocessing.Process.__init__(self)

        self.output_dir = output_dir
        self.mapnik_config = mapnik_config
        self.tile_queues = tile_queues
        self.width = width
        self.height = height
        self.buffer_size = buffer_size if buffer_size else max(width, height)
        self.filetype = filetype
        self.skip_existing = skip_existing

    def run(self):
        self.mapnik_map = mapnik.Map(self.width, self.height)
        mapnik.load_map(self.mapnik_map, self.mapnik_config, True)

        self.map_projection = mapnik.Projection(self.mapnik_map.srs)
        self.tile_projection = projections.GoogleProjection()

        while True:
            tile_parameters = None

            for tile_queue in self.tile_queues:
                try:
                    tile_parameters = tile_queue.get_nowait()
                    break
                except Queue.Empty:
                    pass

            # Couldn't get tile parameters from any queue--all done
            if not tile_parameters:
                return

            # Skip rendering existing tiles
            if self.skip_existing:
                filename = tile_parameters[0]

                if os.path.exists(os.path.join(self.output_dir, filename)):
                    print 'Skipping %s' % (filename)
                    tile_queue.task_done()

                    continue

            self.render(*tile_parameters)
            tile_queue.task_done()

    def render(self):
        """
        Render a segment from the queue. Must be overridden in subclasses.
        """
        raise NotImplementedError('You should not use Renderer directly, but rather one of its subclasses.')

class TileRenderer(Renderer):
    """
    Renderer for tiles.
    """
    def __init__(self, output_dir, tile_queues, mapnik_config, width=constants.DEFAULT_WIDTH, height=constants.DEFAULT_HEIGHT, filetype=constants.DEFAULT_FILE_TYPE, buffer_size=None, skip_existing=False, **kwargs):
        super(TileRenderer, self).__init__(output_dir, tile_queues, mapnik_config, width, height, filetype, buffer_size, skip_existing)
        self.grid = kwargs.get('grid', False)
        self.key =  kwargs.get('key', None)
        self.fields =  kwargs.get('fields', None)

    def render(self, path, tile_x, tile_y, zoom):
        """
        Render a single tile to a given filename.
        """
        print 'Rendering %s' % (path)

        # Calculate pixel positions of bottom-left & top-right
        half_width = self.width / 2
        half_height = self.height / 2
        px0 = (tile_x * self.width, (tile_y + 1) * self.height)
        px1 = ((tile_x + 1) * self.width, tile_y * self.height)

        # Convert tile coords to LatLng
        ll0 = self.tile_projection.fromPixelToLL(px0, zoom);
        ll1 = self.tile_projection.fromPixelToLL(px1, zoom);

        # Convert LatLng to map coords
        c0 = self.map_projection.forward(mapnik.Coord(ll0[0], ll0[1]))
        c1 = self.map_projection.forward(mapnik.Coord(ll1[0], ll1[1]))

        # Create bounding box for the render
        bbox = mapnik.Box2d(c0.x, c0.y, c1.x, c1.y)

        self.mapnik_map.zoom_to_box(bbox)
        self.mapnik_map.buffer_size = self.buffer_size

        if self.filetype == 'svg':
            surface = cairo.SVGSurface(path, self.width, self.height)
            mapnik.render(self.mapnik_map, surface)
            surface.finish()
        else:
            image = mapnik.Image(self.width, self.height)
            mapnik.render(self.mapnik_map, image)
            image.save(path, self.filetype)

        if self.grid:
            if self.key:
                grid = mapnik.Grid(self.width, self.height)
            else:
                grid = mapnik.Grid(self.width, self.height, key=self.key)

            fields = []

            if self.fields:
                fields.extend(self.fields)

            mapnik.render_layer(self.mapnik_map,grid, layer=0, fields=fields)
            # then encode the grid array as utf, resample to 1/4 the size, and dump features
            # this comes from https://github.com/springmeyer/gridsforkids/blob/master/generate_tiles.py
            # with little consideration
            grid_utf = grid.encode('utf', resolution=4, features=True)

            # client code uses jsonp, so fake by wrapping in grid() callback
            base, ext = os.path.splitext(path)
            grid_filename = '%s.grid.json' % base
            print 'Rendering %s' % (grid_path)

            with open(grid_path, 'wb') as f:
                f.write('grid(' + json.dumps(grid_utf) + ')')

class FrameRenderer(Renderer):
    """
    Renderer for frames (centered map fragments).
    """
    def render(self, filename, latitude, longitude, zoom):
        """
        Render a single tile to a given filename.
        """
        print 'Rendering %s' % (filename)

        x, y = self.tile_projection.fromLLtoPixel([longitude, latitude], zoom)

        # Calculate pixel positions of bottom-left & top-right
        half_width = self.width / 2
        half_height = self.height / 2
        px0 = (x - half_width, y + half_height)
        px1 = (x + half_width, y - half_height)

        # Convert tile coords to LatLng
        ll0 = self.tile_projection.fromPixelToLL(px0, zoom);
        ll1 = self.tile_projection.fromPixelToLL(px1, zoom);

        # Convert LatLng to map coords
        c0 = self.map_projection.forward(mapnik.Coord(ll0[0], ll0[1]))
        c1 = self.map_projection.forward(mapnik.Coord(ll1[0], ll1[1]))

        # Create bounding box for the render
        bbox = mapnik.Box2d(c0.x, c0.y, c1.x, c1.y)

        self.mapnik_map.zoom_to_box(bbox)
        self.mapnik_map.buffer_size = self.buffer_size

        if self.filetype == 'svg':
            surface = cairo.SVGSurface(os.path.join(self.output_dir, filename), self.width, self.height)
            mapnik.render(self.mapnik_map, surface)
            surface.finish()
        else:
            image = mapnik.Image(self.width, self.height)
            mapnik.render(self.mapnik_map, image)
            image.save(os.path.join(self.output_dir, filename), self.filetype)


text:
import sys
import signal
import argparse
import logging
from logging.handlers import TimedRotatingFileHandler
from logwatcher.lw import LogWatcher
from logwatcher.common import read_graphite_conf

# FIXME: This needs to be automated and become graphtie compatible
CODE_VERSION = "$Id: logwatcher.py 233274 2014-06-23 23:20:52Z heitritterw $"
LOG = logging.getLogger(__name__)

# FIXME: Why does this need a second arg?
def handle_signal(signum, frame):
    '''Exit on a given signal number.'''

    print "\nLogWatcher killed"
    sys.exit(signum)

def parse_args():
    '''Parse all the command line arguments.'''

    help_desc = '''
    Watch logs for configured metrics and send them to graphite.

    >>> run.py -D -V -c /app/logwatcher/conf/logwatcher.ini -b -g graphite
    readlines()
    '''

    pap = argparse.ArgumentParser(formatter_class=argparse.RawTextHelpFormatter,
                                  description=help_desc)

    pap.add_argument('-b',
                     '--beginning',
                     action='store_true',
                     help='Read the log from the beginning (useful with -q)')
    pap.add_argument('-c',
                     '--config',
                     help='Use the given configuration file',
                     default=None)
    pap.add_argument('-d',
                     '--daemonize',
                     action='store_true',
                     help="Run in the background.",
                     default=0)
    pap.add_argument('-D',
                     '--debug',
                     help="Don't send metrics, just print them.",
                     default=0)
    pap.add_argument('-G',
                     '--use-graphite',
                     action='store_true',
                     help='Use graphite, find server in /etc/graphite.conf.')
    pap.add_argument('-g',
                     '--graphite-server',
                     help='Use graphite, with server GRAPHITE_SERVER.',
                     default=None)
    pap.add_argument('-i',
                     '--distinguisher',
                     help='Use the given string in the metric names',
                     default=None)
    pap.add_argument('-l',
                     '--daemon-log',
                     help='Log file to write to in daemon mode. Useful for '
                     'debugging.',
                     default=None)
    pap.add_argument('-m',
                     '--metric-format',
                     help='Metric formatting to use. "ctg" or "trp".',
                     default="ctg")
    pap.add_argument('-o',
                     '--console-log',
                     help='Write a console log in daemon mode. Useful for '
                     'debugging.',
                     default='/dev/null')
    pap.add_argument('-P',
                     '--graphite-port',
                     help='The port number to use for graphite.',
                     default=2003)
    pap.add_argument('-p',
                     '--pidfile',
                     help='Store the PID in the given file',
                     default=None)
    pap.add_argument('-R',
                     '--prefix-root',
                     dest='prefix_root',
                     help='The prefix for all logwatcher metrics.',
                     default='LW_')
    pap.add_argument('-q',
                     '--quit',
                     action='store_true',
                     help="Quit after sending metrics (useful with -D).")
    pap.add_argument('-t',
                     '--testconfig',
                     action='store_true',
                     help='Read overrides from the [test] section of the '
                     'configuration file')
    pap.add_argument('-V',
                     '--verbose',
                     action='store_true',
                     help="Print gmetric commands as they're sent. Disables -D.")
    pap.add_argument('-v',
                     '--version',
                     action='store_true',
                     help="Print the version.")

    return pap.parse_args()

def main():
    '''Do all the things.'''

    # parse the args
    args = parse_args()

    # FIXME: convert to true/false or one option with levels.
    # debug = 0
    # for opt, arg in opts:
    #     if opt in ("-D", "--debug"):
    #         debug = 1
    #     if opt in ("-V", "--verbose"):
    #         debug = 2

    if args.debug == 0:
        log_level = logging.INFO
    else:
        log_level = logging.DEBUG

    root = logging.getLogger()
    root.setLevel(log_level)

    console = logging.StreamHandler(sys.stdout)
    console.setLevel(log_level)
    formatter = logging.Formatter('%(asctime)s - %(levelname)-8s- %(message)s')
    # Log to a file
    if args.daemon_log:
        logger = logging.getLogger('logwatcher')
        # hdlr = logging.FileHandler(args.daemon_log)
        # FIXME: Make the time interval configurable
        hdlr = TimedRotatingFileHandler(args.daemon_log,
                                        when='D',
                                        interval=1,
                                        backupCount=7)
        hdlr.setFormatter(formatter)
        logger.addHandler(hdlr)
        logger.setLevel(log_level)
    console.setFormatter(formatter)
    root.addHandler(console)

    if args.version:
        LOG.info(CODE_VERSION)
        sys.exit(0)

    if args.use_graphite and not args.graphite_server:
        args.graphite_server = read_graphite_conf()
        if not args.graphite_server:
            LOG.error('Failed to set graphite server from config file. Using gmetric.')
        else:
            args.use_graphite = True

    if args.graphite_server:
        from logwatcher.graphitelib import Gmetric
        LOG.info('Using Gmetric Graphite.')
    else:
        from logwatcher.gmetriclib import Gmetric
        LOG.info('Using Gmetric Gmond.')

    LogWatcher(Gmetric,
               args.pidfile,
               args.daemonize,
               args.console_log,
               args.config,
               args.distinguisher,
               args.debug,
               args.quit,
               args.beginning,
               args.testconfig,
               args.graphite_server,
               args.graphite_port,
               args.use_graphite,
               args.prefix_root,
               args.metric_format)

if __name__ == "__main__":
    signal.signal(signal.SIGINT, handle_signal)
    main()


text:
require "nbs/version"
require "nbs/configuration"
require "httparty"
require 'active_support/all'

class Nbs
  include HTTParty
  extend Configuration
  attr_accessor :all_metrics_raw

  SERVICES = %w(facebook youtube twitter)
  # define_setting :access_key
  # define_setting :least_favorite_liquid, "seltzer water"

  def initialize(_nbs_id=1076707, _options = {}) # run the jewels
    @nbs_id = "#{_nbs_id}.json"
    @options = {start: (Time.now - 7.day).to_i, end: Time.now.to_i, metric: 'fans'}.merge(_options)
  end

  def metrics
    @all_metrics_raw ||= self.class.post("/metrics/artist/#{@nbs_id}", @options).parsed_response
    if @metrics.blank?
      @metrics = {}
      @all_metrics_raw.each do |am|
        service  = am["Service"]["name"].downcase
        _metrics = am["Metric"]['fans']
        if _metrics.present? && SERVICES.any? { |s| s == service }
          @metrics[service.to_sym] ||= []
          @metrics[service.to_sym] << { url: am['Profile']['url'], data: self.class.tidy_metrics(_metrics)}
        end
      end
    end
    @metrics
  end

  def artist_profiles
    if @artist_profiles.blank?
      @artist_profiles = []
      response = self.class.get("/profiles/artist/#{@nbs_id}", @options).parsed_response
      response.each do |id, data|
        next unless SERVICES.any? { |s| s == data['name'].downcase }
        @artist_profiles << {nbs_profile_id: id, url: data['url']}
      end
    end
    @artist_profiles
  end

  def self.artist_search(_names)
    artist_search = []
    [_names].flatten.each do |name|
      result = get("/artists/search.json", { query: {q: "#{name}"}})
      if result.code == 200 && result.parsed_response.present?
        result.parsed_response.each do |id, values|
          artist_search << {nbs_id: id, name: values["name"], music_brainz_id: values["music_brainz_id"]}
        end
      end
    end
    artist_search.uniq
  end

  def self.metric(_nbs_profile_id=16209803, _options={}) #run the jewels instagram profile
    options = {query: {start: (Time.now - 3.day).to_i, end: Time.now.to_i, metric: 'fans'}.merge(_options)}
    response = post("/metrics/profile/#{_nbs_profile_id}.json", options)
    if response.code == 200
      tidy_metrics(response.parsed_response['fans'])
    else
      []
    end
  end

  def self.setup(_key)
    base_uri "#{_key}.api3.nextbigsound.com"
  end

  def self.tidy_metrics(_arry)
    _arry.map do |day, value|
      {time: Time.at(day.to_i.days.to_i).utc, volume: value}
    end
  end

end


text:
import config
import simulation
import rosdrawer
import riskgrid
import plot
import experiments
import planner
import rospy
import raplanner

def run(**kwargs):
    experimental = kwargs.get("experimental", False)

    if not experimental:
        problem = config.Problem(**kwargs)

        dr = rosdrawer.Drawer(problem)

        risk_grid = riskgrid.RiskGrid(problem)

        plot.plot_risk_grid(
            risk_grid,
            kwargs.get("img_file", "imgs/test_heatmap.png")
        )

        pl = planner.planners.get(
            kwargs.get("planner"),
            raplanner.RiskAltitudePlanner
        )

        sim = simulation.Simulation(
            problem, risk_grid, drawer=dr, algorithm=pl,
            **kwargs
        )

        try:
            sim.run()
        except rospy.ROSInterruptException:
            exit()
    else:
        exps = experiments.Experiments(**kwargs)
        exps.run()


text:
package com.skyfire.hipda.bean.content;

import java.util.Date;

/**
 * Created by Neil.
 */
public class UploadImageContent extends ImageContent {

  private final int id;
  private final Date uploadTime;
  private final String sizeText;

  public UploadImageContent(int id, String url, String sizeText, Date uploadTime) {
    super(url);
    this.id = id;
    this.sizeText = sizeText;
    this.uploadTime = uploadTime;
  }

  public int getId() {
    return id;
  }

  public String getSizeText() {
    return sizeText;
  }

  public Date getUploadTime() {
    return uploadTime;
  }
}


text:
<!DOCTYPE html>

		<title>
			SAASY Chocolate
		</title>

SAASY CHOCOLATE

Our chocolate comes from a delicious family recipe.  We make dark chocolate, milk chocolate, white chocolate, chocolate with nuts, and a variety of other flavors.  We can make custom chocolate with your choice of fillings such as salt, nuts, and most other foods.

Chocolate is made from the fruit of the cacao tree. The scientific name of the cacao tree, Theobroma, means food of the gods. When the cacao nibs are crushed, there are fats and solids remaining. There are 40-50 million people who depend on cocoa for their livelihood. White Chocolate does not contain cocoa solids but can be called chocolate by U.S. FDA standards. It must contain cocoa butter. More than 36 million heart-shaped boxes of chocolate are sold every year for Valentine's Day.

				TAFFY

				SAASY SWEETS

				ICE CREAM


text:
'use strict';
// Compiles Sass to CSS and generates necessary files if requested

var path = require('path');

module.exports = {
  options : {
    sassDir: 'src/scss',
    cssDir: '.tmp/css',
    generatedImagesDir: '.tmp/images/generated',
    imagesDir: 'images',
    javascriptsDir: 'scripts',
    fontsDir: 'styles/fonts',
    httpImagesPath: '/images',
    httpGeneratedImagesPath: '/images/generated',
    httpFontsPath: '/styles/fonts',
    relativeAssets: false,
    assetCacheBuster: false,
    raw: 'Sass::Script::Number.precision = 10\n'
  },

  watch : {
    options : {
      watch : true
    }
  },

  dev : {},

  dist : {
    options : {
      cssDir : '<%= paths.dist %>/css',
      imagesDir : '<%= paths.dist %>/images',
      force : true,
      environment : 'production'
    }
  }
};


text:
package de.hsmainz.pubapp.poi;

import java.io.IOException;
import java.net.URI;

import org.apache.log4j.Logger;
import org.glassfish.grizzly.http.server.HttpServer;
import org.glassfish.jersey.grizzly2.httpserver.GrizzlyHttpServerFactory;
import org.glassfish.jersey.server.ResourceConfig;

/**
 * Class for starting and creating Server
 *
 * @author caro
 *
 */
public class PoiServiceMain {

	// ****************************************
	// CONSTANTS
	// ****************************************

	// ****************************************
	// VARIABLES
	// ****************************************
	private static Logger logger = Logger.getLogger(PoiServiceMain.class);

	// ****************************************
	// INIT/CONSTRUCTOR
	// ****************************************
	private PoiServiceMain() {

	}
	// ****************************************
	// GETTER/SETTER
	// ****************************************

	// ****************************************
	// PUBLIC METHODS
	// ****************************************
	/**
	 * Main method of service which will be called when service is stared
	 *
	 * @param args
	 * @throws IOException
	 */
	public static void main(String[] args) throws IOException {
		if (args.length > 0) {
			MyProperties.setPropertiesFile(args[0]);
		}
		String url = MyProperties.getInstance().getProperty("poi_url");
		if (logger.isInfoEnabled()) {
			logger.info("Starting server...");
		}
		try {
			final HttpServer server = startServer(url);
			if (logger.isInfoEnabled()) {
				logger.info("Server started... " + "reachable at:" + url);
			}
			System.in.read();
			server.shutdownNow();
		} catch (Exception e) {
			logger.error("Failed to start Server", e);
		}

	}

	/**
	 * Starting Server
	 *
	 * @param url
	 * @return created HttpServer
	 */

	public static HttpServer startServer(String url) {
		final ResourceConfig rc = new ResourceConfig().packages("de.hsmainz.pubapp.poi.web");
		rc.register(new CORSFilter());

		return GrizzlyHttpServerFactory.createHttpServer(URI.create(url), rc);
	}
	// ****************************************
	// PRIVATE METHODS
	// ****************************************

	// *****************************************
	// INNER CLASSES
	// *****************************************

}


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

import com.intellij.openapi.diagnostic.Logger;
import com.intellij.openapi.util.Key;
import com.intellij.openapi.util.registry.Registry;
import com.intellij.openapi.util.text.StringUtil;
import com.intellij.util.Consumer;
import com.intellij.util.concurrency.AppExecutorUtil;
import com.intellij.util.io.BaseDataReader;
import com.intellij.util.io.BaseInputStreamReader;
import com.intellij.util.io.BaseOutputReader;
import com.intellij.util.io.BaseOutputReader.Options;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;

import java.io.InputStream;
import java.io.Reader;
import java.nio.charset.Charset;
import java.util.concurrent.Future;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.atomic.AtomicLong;

public class BaseOSProcessHandler extends BaseProcessHandler<Process> {
  private static final Logger LOG = Logger.getInstance(BaseOSProcessHandler.class);
  private final AtomicLong mySleepStart = new AtomicLong(System.currentTimeMillis());
  private final Throwable myProcessStart;

  /**
   * {@code commandLine} must not be not empty (for correct thread attribution in the stacktrace)
   */
  public BaseOSProcessHandler(@NotNull Process process, /*@NotNull*/ String commandLine, @Nullable Charset charset) {
    super(process, commandLine, charset);
    myProcessStart = new Throwable("Process creation:");
  }

  /**
   * Override this method in order to execute the task with a custom pool
   *
   * @param task a task to run
   * @deprecated override {@link #executeTask(Runnable)} instead of this method
   */
  @Deprecated
  @SuppressWarnings("DeprecatedIsStillUsed")
  @NotNull
  protected Future<?> executeOnPooledThread(@NotNull final Runnable task) {
    return ProcessIOExecutorService.INSTANCE.submit(task);
  }

  @Override
  @NotNull
  public Future<?> executeTask(@NotNull Runnable task) {
    return executeOnPooledThread(task);
  }

  /**
   * Override this method to fine-tune {@link BaseOutputReader} behavior.
   */
  @NotNull
  protected Options readerOptions() {
    if (Registry.is("output.reader.blocking.mode", false)) {
      return Options.BLOCKING;
    }
    else {
      return Options.NON_BLOCKING;
    }
  }

  protected boolean processHasSeparateErrorStream() {
    return true;
  }

  @Override
  public void startNotify() {
    if (myCommandLine != null) {
      notifyTextAvailable(myCommandLine + '\n', ProcessOutputTypes.SYSTEM);
    }

    addProcessListener(new ProcessAdapter() {
      @Override
      public void startNotified(@NotNull final ProcessEvent event) {
        try {
          Options options = readerOptions();
          @SuppressWarnings("deprecation") final BaseDataReader stdOutReader = createOutputDataReader(options.policy());
          @SuppressWarnings("deprecation") final BaseDataReader stdErrReader = processHasSeparateErrorStream() ? createErrorDataReader(options.policy()) : null;

          myWaitFor.setTerminationCallback(new Consumer<Integer>() {
            @Override
            public void consume(Integer exitCode) {
              try {
                // tell readers that no more attempts to read process' output should be made
                if (stdErrReader != null) stdErrReader.stop();
                stdOutReader.stop();

                try {
                  if (stdErrReader != null) stdErrReader.waitFor();
                  stdOutReader.waitFor();
                }
                catch (InterruptedException ignore) { }
              }
              finally {
                onOSProcessTerminated(exitCode);
              }
            }
          });
        }
        finally {
          removeProcessListener(this);
        }
      }
    });

    super.startNotify();
  }

  /** @deprecated override {@link #createOutputDataReader()} (to be removed in IDEA 2018) */
  @Deprecated
  @SuppressWarnings("DeprecatedIsStillUsed")
  protected BaseDataReader createErrorDataReader(BaseDataReader.SleepingPolicy policy) {
    return createErrorDataReader();
  }

  /** @deprecated override {@link #createOutputDataReader()} (to be removed in IDEA 2018) */
  @Deprecated
  @SuppressWarnings("DeprecatedIsStillUsed")
  protected BaseDataReader createOutputDataReader(BaseDataReader.SleepingPolicy policy) {
    return createOutputDataReader();
  }

  @NotNull
  protected BaseDataReader createErrorDataReader() {
    return new SimpleOutputReader(createProcessErrReader(), ProcessOutputTypes.STDERR, readerOptions(), "error stream of " + myPresentableName);
  }

  @NotNull
  protected BaseDataReader createOutputDataReader() {
    return new SimpleOutputReader(createProcessOutReader(), ProcessOutputTypes.STDOUT, readerOptions(), "output stream of " + myPresentableName);
  }

  @NotNull
  protected Reader createProcessOutReader() {
    return createInputStreamReader(myProcess.getInputStream());
  }

  @NotNull
  protected Reader createProcessErrReader() {
    return createInputStreamReader(myProcess.getErrorStream());
  }

  @NotNull
  private Reader createInputStreamReader(@NotNull InputStream streamToRead) {
    Charset charset = getCharset();
    if (charset == null) charset = Charset.defaultCharset();
    return new BaseInputStreamReader(streamToRead, charset);
  }

  /** @deprecated use {@link BaseOSProcessHandler#executeTask(Runnable)} instead (to be removed in IDEA 2018) */
  @Deprecated
  public static class ExecutorServiceHolder {
    public static Future<?> submit(@NotNull Runnable task) {
      LOG.warn("Deprecated method. Please use com.intellij.execution.process.BaseOSProcessHandler.executeTask() instead", new Throwable());
      return AppExecutorUtil.getAppExecutorService().submit(task);
    }
  }

  protected class SimpleOutputReader extends BaseOutputReader {
    private final Key myProcessOutputType;

    public SimpleOutputReader(Reader reader, Key outputType, Options options, @NotNull String presentableName) {
      super(reader, options);
      myProcessOutputType = outputType;
      start(presentableName);
    }

    @NotNull
    @Override
    protected Future<?> executeOnPooledThread(@NotNull Runnable runnable) {
      return BaseOSProcessHandler.this.executeTask(runnable);
    }

    @Override
    protected void onTextAvailable(@NotNull String text) {
      notifyTextAvailable(text, myProcessOutputType);
    }

    @Override
    protected void beforeSleeping(boolean hasJustReadSomething) {
      long sleepStart = mySleepStart.get();
      if (sleepStart < 0) return;

      long now = System.currentTimeMillis();
      if (hasJustReadSomething) {
        mySleepStart.set(now);
      }
      else if (TimeUnit.MILLISECONDS.toMinutes(now - sleepStart) >= 2 &&
               mySleepStart.compareAndSet(sleepStart, -1)) { // report only once
        LOG.warn("Process hasn't generated any output for a long time.\n" +
                 "If it's a long-running mostly idle daemon process, consider overriding OSProcessHandler#readerOptions with 'BaseOutputReader.Options.forMostlySilentProcess()' to reduce CPU usage.\n" +
                 "Command line: " + StringUtil.trimLog(myCommandLine, 1000),
                 myProcessStart);
      }
    }
  }

  @Override
  public String toString() {
    return myCommandLine;
  }

  @Override
  public boolean waitFor() {
    boolean result = super.waitFor();
    try {
      myWaitFor.waitFor();
    }
    catch (InterruptedException e) {
      throw new RuntimeException(e);
    }
    return result;
  }

  @Override
  public boolean waitFor(long timeoutInMilliseconds) {
    long start = System.currentTimeMillis();
    boolean result = super.waitFor(timeoutInMilliseconds);
    long elapsed = System.currentTimeMillis() - start;
    try {
      result &= myWaitFor.waitFor(Math.max(0, timeoutInMilliseconds-elapsed), TimeUnit.MILLISECONDS);
    }
    catch (InterruptedException e) {
      throw new RuntimeException(e);
    }
    return result;
  }
}


text:
from datetime import datetime
from django.conf import settings
from django.utils.timezone import utc
import hashlib
import json
from pathlib import Path
from .tikalib import tika_parse, extract_meta, tika_lang
from . import emails
from . import text
from . import queues
from . import models
from . import archives
from . import pst
from . import exceptions
from . import pgp
from . import html
from .content_types import guess_filetype, libmagic_guess_content_type
from .utils import chunks, word_count, worker_metrics, extract_exif

INHERITABLE_DOCUMENT_FLAGS = [
    'pgp',
]

def _path_bits(doc):
    if doc.container:
        yield from _path_bits(doc.container)
        if emails.is_email(doc.container):
            yield doc.filename
        else:
            yield doc.path
    else:
        yield doc.path

def _calculate_hashes(opened_file):

    md5 = hashlib.md5()
    sha1 = hashlib.sha1()

    for data in chunks(opened_file):
        md5.update(data)
        sha1.update(data)

    fsize = opened_file.tell()

    return (md5.hexdigest(), sha1.hexdigest(), fsize)

def digest(doc):
    if not doc.sha1:
        with doc.open() as f:
            md5, sha1, fsize = _calculate_hashes(f)
            if not doc.content_type:
                f.seek(0)
                doc.content_type = libmagic_guess_content_type(f, fsize)
        if not doc.disk_size:
            doc.disk_size = fsize
        doc.sha1 = sha1
        doc.md5 = md5
        doc.save()

    data = {
        'path': '//'.join(_path_bits(doc)),
        'lang': None,
        'sha1': doc.sha1,
        'md5': doc.md5,
        'filename': doc.filename,
        'rev': doc.rev,
    }

    if emails.is_email(doc):
        data.update(emails.parse_email(doc))

    if 'pgp' in doc.flags:
        data['pgp'] = doc.flags['pgp']

    if doc.container_id:
        data['message'] = doc.container_id

    filetype = guess_filetype(doc)
    data['type'] = filetype

    if filetype in ['text', 'html']:
        data['text'] = text.get_text(doc)

    if filetype == 'html':
        data['safe_html'] = html.get_safe_html(doc)

    if filetype == 'image':
        data.update(extract_exif(doc))

    if settings.SNOOP_TIKA_SERVER_ENDPOINT and \
            filetype in settings.SNOOP_TIKA_FILE_TYPES and \
            doc.disk_size <= settings.SNOOP_TIKA_MAX_FILE_SIZE:
        parsed = tika_parse(doc.sha1, doc.open)
        data['text'] = (parsed.get('content') or '').strip()
        data.update(extract_meta(parsed.get('metadata', {})))

    if settings.SNOOP_ANALYZE_LANG:
        if 'text' in data and len(data['text']) > 100:
            data['lang'] = tika_lang(data['text'])[:2]

    if 'text' in data:
        data['word-count'] = word_count(data['text'])

    ocr_items = list(models.Ocr.objects.filter(
        collection_id=doc.collection.id,
        md5=doc.md5
    ))
    if ocr_items:
        data['ocr'] = {ocr.tag: ocr.text for ocr in ocr_items}

    if archives.is_archive(doc):
        archives.extract_to_base(doc)
    if pst.is_pst_file(doc):
        pst.extract_to_base(doc)

    return data

def create_email_children(doc, data, flags):
    children = []
    for name, info in sorted(data.get('attachments', {}).items()):
        child, created = models.Document.objects.update_or_create(
            container=doc,
            parent=doc,
            path=name,
            collection=doc.collection,
            defaults={
                'disk_size': info.get('size', 0),
                'content_type': info['content_type'],
                'filename': info['filename'],
            },
        )
        children.append((child.id, created))
    return children

def create_children(doc, data, verbose=True):
    inherited_flags = {
        key: doc.flags[key]
        for key in doc.flags
        if key in INHERITABLE_DOCUMENT_FLAGS
    }
    children = []

    if emails.is_email(doc):
        children = create_email_children(doc, data, inherited_flags)
    elif archives.is_archive(doc):
        children = archives.list_children(doc)
    elif pst.is_pst_file(doc):
        children = pst.list_children(doc)

    new_children = 0
    for doc_id, created in children:
        child = models.Document.objects.get(id=doc_id)
        child.flags.update(inherited_flags)
        child.save()
        if created:
            queues.put('digest', {'id': doc_id}, verbose=verbose)
            if verbose: print('new child', doc_id)
            new_children += 1

    return new_children

def worker(id, verbose):
    with worker_metrics(type='worker', queue='digest') as metrics:
        metrics['document'] = id
        try:
            document = models.Document.objects.get(id=id)
        except models.Document.DoesNotExist:
            if verbose: print('MISSING')
            metrics.update({'outcome': 'error', 'error': 'document_missing'})
            return
        try:
            data = digest(document)

        except exceptions.BrokenDocument as e:
            assert e.flag is not None
            document.broken = e.flag
            document.save()
            if verbose: print(e.flag)
            metrics.update({'outcome': 'broken', 'broken': document.broken})
            return

        else:
            if document.broken:
                if verbose: print('removing broken flag', document.broken)
                document.broken = ''
                document.save()

        new_children = create_children(document, data, verbose)
        if new_children > 0:
            metrics['new_children'] = new_children

        models.Digest.objects.update_or_create(
            id=document.id,
            defaults={'data': json.dumps(data)},
        )
        document.digested_at = datetime.utcnow().replace(tzinfo=utc)
        document.save()

        if verbose: print('type:', data.get('type'))


text:
'''OpenGL extension ARM.shader_framebuffer_fetch_depth_stencil

This module customises the behaviour of the
OpenGL.raw.GLES2.ARM.shader_framebuffer_fetch_depth_stencil to provide a more
Python-friendly API

The official definition of this extension is available here:
http://www.opengl.org/registry/specs/ARM/shader_framebuffer_fetch_depth_stencil.txt
'''
from OpenGL import platform, constant, arrays
from OpenGL import extensions, wrapper
import ctypes
from OpenGL.raw.GLES2 import _types, _glgets
from OpenGL.raw.GLES2.ARM.shader_framebuffer_fetch_depth_stencil import *
from OpenGL.raw.GLES2.ARM.shader_framebuffer_fetch_depth_stencil import _EXTENSION_NAME

def glInitShaderFramebufferFetchDepthStencilARM():
    '''Return boolean indicating whether this extension is available'''
    from OpenGL import extensions
    return extensions.hasGLExtension( _EXTENSION_NAME )

### END AUTOGENERATED SECTION


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

<LinearLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@android:color/white"
    android:orientation="vertical"
    android:weightSum="10">

    <android.support.v4.widget.NestedScrollView
        android:layout_width="match_parent"
        android:layout_height="@dimen/dimen0"
        android:layout_weight="9">

        <LinearLayout
            android:layout_width="match_parent"
            android:layout_height="@dimen/dimen0"
            android:layout_weight="9"
            android:orientation="vertical">

            <android.support.v7.widget.RecyclerView
                android:id="@+id/list"
                android:layout_width="match_parent"
                android:layout_height="@dimen/dimen0"
                android:layout_marginBottom="@dimen/dimen30"
                android:layout_marginTop="@dimen/dimen55"
                android:layout_weight="8.5"
                android:orientation="vertical"
                app:layout_behavior="@string/appbar_scrolling_view_behavior">

            </android.support.v7.widget.RecyclerView>

            <LinearLayout
                android:layout_width="match_parent"
                android:layout_height="match_parent"
                android:layout_marginBottom="@dimen/dimen20"
                android:layout_weight="1"
                android:orientation="horizontal">

                <Button
                    android:id="@+id/addmore"
                    android:layout_width="@dimen/dimen0"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="@dimen/dimen20"
                    android:layout_marginLeft="@dimen/dimen10"
                    android:layout_marginRight="@dimen/dimen20"
                    android:layout_marginStart="@dimen/dimen10"
                    android:layout_weight="0.5"
                    android:background="@drawable/button_bg"
                    android:text="@string/add_more_item"
                    android:textColor="#FF4500" />

                <Button
                    android:id="@+id/removeall"
                    android:layout_width="@dimen/dimen0"
                    android:layout_height="wrap_content"
                    android:layout_marginEnd="@dimen/dimen10"
                    android:layout_marginRight="@dimen/dimen10"
                    android:layout_weight="0.5"
                    android:background="@drawable/button_bg"
                    android:text="@string/remove_all"
                    android:textColor="#FF4500" />
            </LinearLayout>
        </LinearLayout>
    </android.support.v4.widget.NestedScrollView>

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="@dimen/dimen0"
        android:layout_gravity="bottom"
        android:layout_weight="1"
        android:background="#FFDAB9"
        android:gravity="bottom"
        android:orientation="horizontal">

        <TextView
            android:id="@+id/totaltext"
            android:layout_width="@dimen/dimen0"
            android:layout_height="wrap_content"
            android:layout_marginLeft="@dimen/dimen10"
            android:layout_marginStart="@dimen/dimen10"
            android:layout_weight="1"
            android:text="@string/items_3_99"
            android:textColor="@android:color/black"
            android:textSize="@dimen/textsize24" />

        <Button
            android:id="@+id/checkout"
            android:layout_width="0dp"
            android:layout_height="wrap_content"
            android:layout_marginTop="@dimen/dimen5"
            android:layout_weight="0.5"
            android:background="#502922"
            android:text="@string/checkout"
            android:textAllCaps="false"
            android:textColor="@android:color/white"
            android:textSize="@dimen/textsize20" />

    </LinearLayout>

</LinearLayout>


text:
package Fare_PricePNRWithBookingClassReply_v14_1 // tpcbrr141

//import "encoding/xml"

type FarePricePNRWithBookingClassReply struct {
	// XMLName xml.Name `xml:"http://xml.amadeus.com/TPCBRR_14_1_1A Fare_PricePNRWithBookingClassReply"`

	ApplicationError *ErrorGroupType `xml:"applicationError,omitempty"` // minOccurs="0"

	// PNR record locator information for this transaction. This PNR record locator is used for tracing purpose.
	PnrLocatorData *ReservationControlInformationTypeI `xml:"pnrLocatorData,omitempty"` // minOccurs="0"

	FareList []*FareList `xml:"fareList,omitempty"` // minOccurs="0" maxOccurs="99"
}

type FareList struct {
	// Pricing information such as pricing rule and sales indicator.
	PricingInformation *PricingTicketingSubsequentTypeI `xml:"pricingInformation"`

	// Fare reference number. Ordering information is not relevant here.
	FareReference *ItemReferencesAndVersionsType_94584S `xml:"fareReference"`

	// Fare Indicators
	FareIndicators *FareInformationType `xml:"fareIndicators,omitempty"` // minOccurs="0"

	// Last date to ticket the fare.
	LastTktDate *StructuredDateTimeInformationType `xml:"lastTktDate,omitempty"` // minOccurs="0"

	// Validating carrier identification.
	ValidatingCarrier *TransportIdentifierType `xml:"validatingCarrier,omitempty"` // minOccurs="0"

	// Passenger/segment association of the fare is specified here.
	PaxSegReference *ReferenceInformationTypeI `xml:"paxSegReference"`

	FareDataInformation *MonetaryInformationType_187640S `xml:"fareDataInformation,omitempty"` // minOccurs="0"

	TaxInformation []*TaxInformation `xml:"taxInformation,omitempty"` // minOccurs="0" maxOccurs="120"

	// Banker's rates are used to convert amounts of the TST (converts base fare to equivalent fare) 1st C661 : 1st bankers' rate which is a percentage (no currency) 2nd C661 : 2nd bankers' rate which is currency+amount.
	BankerRates *ConversionRateTypeI `xml:"bankerRates,omitempty"` // minOccurs="0"

	PassengerInformation []*PassengerInformation `xml:"passengerInformation,omitempty"` // minOccurs="0" maxOccurs="99"

	// Origin and destination of the fare. 1st C3225 occurence : origin city. 2nd C3225 occurence : destination city
	OriginDestination *OriginAndDestinationDetailsTypeI `xml:"originDestination,omitempty"` // minOccurs="0"

	SegmentInformation []*SegmentInformation `xml:"segmentInformation,omitempty"` // minOccurs="0" maxOccurs="96"

	// Other pricing information such as endorsement, tour name...
	OtherPricingInfo []*CodedAttributeType_39223S `xml:"otherPricingInfo,omitempty"` // minOccurs="0" maxOccurs="99"

	WarningInformation []*WarningInformation `xml:"warningInformation,omitempty"` // minOccurs="0" maxOccurs="99"

	AutomaticReissueInfo *AutomaticReissueInfo `xml:"automaticReissueInfo,omitempty"` // minOccurs="0"

	// Corporate number
	CorporateInfo *CorporateFareInformationType `xml:"corporateInfo,omitempty"` // minOccurs="0"

	FeeBreakdown []*FeeBreakdown `xml:"feeBreakdown,omitempty"` // minOccurs="0" maxOccurs="9"

	// convey the mileage information
	Mileage *AdditionalProductDetailsTypeI `xml:"mileage,omitempty"` // minOccurs="0"

	// Details at fare component or at bound level.
	FareComponentDetailsGroup []*FareComponentDetailsType `xml:"fareComponentDetailsGroup,omitempty"` // minOccurs="0" maxOccurs="99"

	EndFareList *DummySegmentTypeI `xml:"endFareList"`
}

type TaxInformation struct {
	// Tax details
	TaxDetails *DutyTaxFeeDetailsTypeU `xml:"taxDetails"`

	// Amount details. If the tax is a passenger facility charge (PFC) the detail of the airports related taxes is given here.
	AmountDetails *MonetaryInformationTypeI `xml:"amountDetails,omitempty"` // minOccurs="0"
}

type PassengerInformation struct {
	// Penalty/discount details specified in the request.
	PenDisInformation *DiscountAndPenaltyInformationTypeI_6128S `xml:"penDisInformation"`

	// Reference of passengers that have a type code.
	PassengerReference *ReferenceInformationTypeI `xml:"passengerReference,omitempty"` // minOccurs="0"
}

type SegmentInformation struct {
	// Connection information.
	ConnexInformation *ConnectionTypeI `xml:"connexInformation"`

	// Details on open segments added to the price calculation. These open segments exist only in the fare calculated, they have no equivalent in the PNR itinerary. This segment gives also information on booking class for best buy transactions.
	SegDetails *TravelProductInformationTypeI_26322S `xml:"segDetails,omitempty"` // minOccurs="0"

	// Fare basis information
	FareQualifier *FareQualifierDetailsTypeI `xml:"fareQualifier,omitempty"` // minOccurs="0"

	// Validity information for this fare
	ValidityInformation []*StructuredDateTimeInformationType `xml:"validityInformation,omitempty"` // minOccurs="0" maxOccurs="2"

	// Baggage allowance information
	BagAllowanceInformation *ExcessBaggageTypeI `xml:"bagAllowanceInformation,omitempty"` // minOccurs="0"

	// Reference of the segment associated to the group.
	SegmentReference *ReferenceInformationTypeI `xml:"segmentReference,omitempty"` // minOccurs="0"

	// The segment order in the pricing response can be different than the one of the PNR itinerary (segments are reordered at price calculation time). This order inform,ation is conveyed by the sequence number. If this order information is not present then the order is by default the one of the PNR.
	SequenceInformation *ItemReferencesAndVersionsType `xml:"sequenceInformation,omitempty"` // minOccurs="0"
}

type WarningInformation struct {
	// Fare warning information code.
	WarningCode *ApplicationErrorInformationType `xml:"warningCode"`

	// Description in free flow text of the warning concerning the fare.
	WarningText *InteractiveFreeTextTypeI_6759S `xml:"warningText,omitempty"` // minOccurs="0"
}

type AutomaticReissueInfo struct {
	// This segment contains the original ticket number.
	TicketInfo *TicketNumberTypeI `xml:"ticketInfo"`

	// This segment contains the coupon number (in absolute) corresponding to the first coupon for use from the last flawn segment.
	CouponInfo *CouponInformationTypeI `xml:"couponInfo"`

	PaperCouponRange *PaperCouponRange `xml:"paperCouponRange,omitempty"` // minOccurs="0"

	// Base fare Information
	BaseFareInfo *MonetaryInformationTypeI_20897S `xml:"baseFareInfo"`

	FirstDpiGroup *FirstDpiGroup `xml:"firstDpiGroup"`

	SecondDpiGroup *SecondDpiGroup `xml:"secondDpiGroup"`

	// this segment conveys specific reissue attributes like Revalidation flag.
	ReissueAttributes *CodedAttributeType `xml:"reissueAttributes,omitempty"` // minOccurs="0"
}

type PaperCouponRange struct {
	// This segment contains the original ticket number.
	TicketInfo *TicketNumberTypeI `xml:"ticketInfo"`

	// This segment contains the coupon number (in absolute) corresponding to the first coupon for use from the last flawn segment.
	CouponInfo *CouponInformationTypeI `xml:"couponInfo"`
}

type FirstDpiGroup struct {
	// Penalty amount in reissue currency
	ReIssuePenalty *DiscountAndPenaltyInformationTypeI `xml:"reIssuePenalty"`

	// Reissue Informations
	ReissueInfo *MonetaryInformationTypeI_20897S `xml:"reissueInfo"`

	// Old Tax informations
	OldTaxInfo *MonetaryInformationTypeI_20897S `xml:"oldTaxInfo"`

	// Balance Reissue Informations
	ReissueBalanceInfo *MonetaryInformationTypeI_20897S `xml:"reissueBalanceInfo"`
}

type SecondDpiGroup struct {
	// Discount and penalty info.
	Penalty *DiscountAndPenaltyInformationTypeI `xml:"penalty"`

	// Residual Value information
	ResidualValueInfo *MonetaryInformationTypeI_20897S `xml:"residualValueInfo"`

	// Old Tax informations
	OldTaxInfo *MonetaryInformationTypeI_20897S `xml:"oldTaxInfo"`

	// Balance issue Informations
	IssueBalanceInfo *MonetaryInformationTypeI_20897S `xml:"issueBalanceInfo"`
}

type FeeBreakdown struct {
	// Nature of the fee (OB, OC)
	FeeType *SelectionDetailsTypeI `xml:"feeType"`

	FeeDetails []*FeeDetails `xml:"feeDetails,omitempty"` // minOccurs="0" maxOccurs="99"
}

type FeeDetails struct {
	// Fee information
	FeeInfo *SpecificDataInformationTypeI `xml:"feeInfo"`

	// Attributes of this fee (commercial description)
	FeeDescription *InteractiveFreeTextTypeI `xml:"feeDescription,omitempty"` // minOccurs="0"

	// Fee associated amounts: amount with/without tax, total tax amount
	FeeAmounts *MonetaryInformationTypeI_39230S `xml:"feeAmounts,omitempty"` // minOccurs="0"

	// taxes related to this fee
	FeeTaxes []*TaxTypeI `xml:"feeTaxes,omitempty"` // minOccurs="0" maxOccurs="99"
}

//
// Complex structs
//

type AdditionalFareQualifierDetailsTypeI struct {
	// Primary code of the fare basis. This is not a codeset but a free flow text field.
	PrimaryCode string `xml:"primaryCode,omitempty"` // minOccurs="0"

	// Fare basis code of the fare basis. This is not a codeset but a free flow text field.
	FareBasisCode string `xml:"fareBasisCode,omitempty"` // minOccurs="0"

	// Ticket designator of the fare basis
	TicketDesignator string `xml:"ticketDesignator,omitempty"` // minOccurs="0"

	// For any query : discount ticket designator to be assigned by Fare Quote server. For any response : priced PTCs
	DiscTktDesignator string `xml:"discTktDesignator,omitempty"` // minOccurs="0"
}

type AdditionalProductDetailsTypeI struct {
	MileageTimeDetails *MileageTimeDetailsTypeI `xml:"mileageTimeDetails,omitempty"` // minOccurs="0"
}

type ApplicationErrorDetailType struct {
	// Code identifying the data validation error condition.
	ErrorCode string `xml:"errorCode"`

	// Identification of a code list.
	ErrorCategory string `xml:"errorCategory,omitempty"` // minOccurs="0"

	// Code identifying the agency responsible for a code list.
	ErrorCodeOwner string `xml:"errorCodeOwner,omitempty"` // minOccurs="0"
}

type ApplicationErrorDetailType_48648C struct {
	// Code identifying the data validation error condition.
	ApplicationErrorCode string `xml:"applicationErrorCode"`

	// Identification of a code list.
	CodeListQualifier string `xml:"codeListQualifier,omitempty"` // minOccurs="0"

	// Code identifying the agency responsible for a code list.
	CodeListResponsibleAgency string `xml:"codeListResponsibleAgency,omitempty"` // minOccurs="0"
}

type ApplicationErrorInformationType struct {
	// Application error details.
	ApplicationErrorDetail *ApplicationErrorDetailType_48648C `xml:"applicationErrorDetail"`
}

type ApplicationErrorInformationType_84497S struct {
	// Application error details.
	ErrorDetails *ApplicationErrorDetailType `xml:"errorDetails"`
}

type BaggageDetailsTypeI struct {
	// Baggage allowance quantity (piece concept)
	BaggageQuantity *int32 `xml:"baggageQuantity,omitempty"` // minOccurs="0"

	// Baggage allowance weight
	BaggageWeight *int32 `xml:"baggageWeight,omitempty"` // minOccurs="0"

	// Baggage allowance type (weight/number)
	BaggageType string `xml:"baggageType,omitempty"` // minOccurs="0"

	// Measurement unit for weighing baggage allowance
	MeasureUnit string `xml:"measureUnit,omitempty"` // minOccurs="0"
}

type CodedAttributeInformationType struct {
	// provides the attribute Type
	AttributeType string `xml:"attributeType"`

	// provides a description for the attribute
	AttributeDescription string `xml:"attributeDescription,omitempty"` // minOccurs="0"
}

type CodedAttributeInformationType_66047C struct {
	// provides the attribute Type
	AttributeType string `xml:"attributeType"`

	// provides a description for the attribute
	AttributeDescription string `xml:"attributeDescription,omitempty"` // minOccurs="0"
}

type CodedAttributeType struct {
	// provides details for the Attribute
	AttributeDetails []*CodedAttributeInformationType `xml:"attributeDetails"` // maxOccurs="99"
}

type CodedAttributeType_39223S struct {
	// provides details for the Attribute
	AttributeDetails []*CodedAttributeInformationType_66047C `xml:"attributeDetails"` // maxOccurs="5"
}

type CompanyIdentificationTypeI struct {
	// Carrier code
	CarrierCode string `xml:"carrierCode,omitempty"` // minOccurs="0"
}

type CompanyIdentificationTypeI_222513C struct {
	// Carrier owner fo the fare family
	OtherCompany string `xml:"otherCompany,omitempty"` // minOccurs="0"
}

type ConnectionDetailsTypeI struct {
	// Specify ARNK and surface segments  not included in the fare routing.
	RoutingInformation string `xml:"routingInformation,omitempty"` // minOccurs="0"

	// Type of connection for the flight
	ConnexType string `xml:"connexType,omitempty"` // minOccurs="0"
}

type ConnectionTypeI struct {
	// Connection details
	ConnecDetails *ConnectionDetailsTypeI `xml:"connecDetails"`
}

type ConversionRateDetailsTypeI struct {
	// Currency of the rate
	CurrencyCode string `xml:"currencyCode,omitempty"` // minOccurs="0"

	// Amount/percentage
	Amount *float64 `xml:"amount,omitempty"` // minOccurs="0"
}

type ConversionRateTypeI struct {
	// First rate detail.
	FirstRateDetail *ConversionRateDetailsTypeI `xml:"firstRateDetail"`

	// Second rate detail.
	SecondRateDetail *ConversionRateDetailsTypeI `xml:"secondRateDetail,omitempty"` // minOccurs="0"
}

type CorporateFareIdentifiersTypeI struct {
	// Format limitations: an..3
	FareQualifier string `xml:"fareQualifier,omitempty"` // minOccurs="0"

	// Format limitations: an..35
	CorporateID []string `xml:"corporateID,omitempty"` // minOccurs="0" maxOccurs="20"
}

type CorporateFareInformationType struct {
	CorporateFareIdentifiers []*CorporateFareIdentifiersTypeI `xml:"corporateFareIdentifiers"` // maxOccurs="20"
}

type CouponDetailsType struct {
	// Tattoo + type of the product identifying the coupon.
	ProductId *ReferenceInfoType `xml:"productId"`

	// Flight Connection Type
	FlightConnectionType *TravelProductInformationType `xml:"flightConnectionType,omitempty"` // minOccurs="0"
}

type CouponInformationDetailsTypeI struct {
	// Coupon number
	CpnNumber string `xml:"cpnNumber"`
}

type CouponInformationTypeI struct {
	// Details on coupon
	CouponDetails *CouponInformationDetailsTypeI `xml:"couponDetails"`

	// Details on coupon
	OtherCouponDetails []*CouponInformationDetailsTypeI `xml:"otherCouponDetails,omitempty"` // minOccurs="0" maxOccurs="3"
}

type DataInformationTypeI struct {
	// fee attribute
	Indicator string `xml:"indicator,omitempty"` // minOccurs="0"
}

type DataTypeInformationTypeI struct {
	// fee subcode
	Type string `xml:"type"`
}

type DiscountAndPenaltyInformationTypeI struct {
	// Used to specify penalty information
	PenDisData *DiscountPenaltyMonetaryInformationTypeI_29792C `xml:"penDisData,omitempty"` // minOccurs="0"
}

type DiscountAndPenaltyInformationTypeI_6128S struct {
	// Qualify the type of information.  Penalties are not passenger associated and are pure monetary information. Discount are passenger associated but only discount code is specified.
	InfoQualifier string `xml:"infoQualifier,omitempty"` // minOccurs="0"

	// Used to specify penalty information.
	PenDisData []*DiscountPenaltyMonetaryInformationTypeI `xml:"penDisData,omitempty"` // minOccurs="0" maxOccurs="9"
}

type DiscountPenaltyInformationType struct {
	// Used for codes in the AMADEUS code tables. Code Length is three alphanumeric characters.
	FareQualifier string `xml:"fareQualifier,omitempty"` // minOccurs="0"
}

type DiscountPenaltyInformationTypeI struct {
	// Discount off type.
	ZapOffType string `xml:"zapOffType"`

	// Discount amount
	ZapOffAmount *float64 `xml:"zapOffAmount,omitempty"` // minOccurs="0"

	// Discount percentage.
	ZapOffPercentage *int32 `xml:"zapOffPercentage,omitempty"` // minOccurs="0"
}

type DiscountPenaltyMonetaryInformationTypeI struct {
	// Type of penalty.
	PenaltyType string `xml:"penaltyType,omitempty"` // minOccurs="0"

	// The penalty amount can be described differently: amount/percentage.
	PenaltyQualifier string `xml:"penaltyQualifier,omitempty"` // minOccurs="0"

	// Amount of the penalty.
	PenaltyAmount *float64 `xml:"penaltyAmount,omitempty"` // minOccurs="0"

	// This discount code is defined by the airlines. This cannot be coded as airlines might apply any combination of letters for their discounts.
	DiscountCode string `xml:"discountCode,omitempty"` // minOccurs="0"

	// Penalty currency code.
	PenaltyCurrency string `xml:"penaltyCurrency,omitempty"` // minOccurs="0"
}

type DiscountPenaltyMonetaryInformationTypeI_29792C struct {
	// The amount Type can be a percentage or an amount
	PenaltyQualifier string `xml:"penaltyQualifier,omitempty"` // minOccurs="0"

	// specify the value
	PenaltyAmount *float64 `xml:"penaltyAmount,omitempty"` // minOccurs="0"

	// penalty currency code
	PenaltyCurrency string `xml:"penaltyCurrency,omitempty"` // minOccurs="0"
}

type DummySegmentTypeI struct {
}

type DutyTaxFeeAccountDetailTypeU struct {
	// Iso country of the tax
	IsoCountry string `xml:"isoCountry"`
}

type DutyTaxFeeDetailsTypeU struct {
	// Tax data qualifier
	TaxQualifier string `xml:"taxQualifier"`

	// Tax type identification
	TaxIdentification *DutyTaxFeeTypeDetailsTypeU `xml:"taxIdentification"`

	// Type of the tax
	TaxType *DutyTaxFeeAccountDetailTypeU `xml:"taxType,omitempty"` // minOccurs="0"

	// Nature of the tax
	TaxNature string `xml:"taxNature,omitempty"` // minOccurs="0"

	// Exempt tax indicator. If an tax is Exempted no amount is provided for this tax.
	TaxExempt string `xml:"taxExempt,omitempty"` // minOccurs="0"
}

type DutyTaxFeeTypeDetailsTypeU struct {
	// Tax type identifier
	TaxIdentifier string `xml:"taxIdentifier"`
}

type ErrorGroupType struct {
	// The details of error/warning code.
	ErrorOrWarningCodeDetails *ApplicationErrorInformationType_84497S `xml:"errorOrWarningCodeDetails"`

	// The desciption of warning or error.
	ErrorWarningDescription *FreeTextInformationType `xml:"errorWarningDescription,omitempty"` // minOccurs="0"
}

type ExcessBaggageTypeI struct {
	// Baggage allowance information details
	BagAllowanceDetails *BaggageDetailsTypeI `xml:"bagAllowanceDetails,omitempty"` // minOccurs="0"
}

type FareComponentDetailsType struct {
	FareComponentID *ItemNumberType `xml:"fareComponentID"`

	// Market information related to the fare component or to the bound.
	MarketFareComponent *TravelProductInformationTypeI `xml:"marketFareComponent,omitempty"` // minOccurs="0"

	// Monetary Information.
	MonetaryInformation *MonetaryInformationType `xml:"monetaryInformation,omitempty"` // minOccurs="0"

	// Component Class information
	ComponentClassInfo *PricingOrTicketingSubsequentType `xml:"componentClassInfo,omitempty"` // minOccurs="0"

	// Fare Qualifier Detail
	FareQualifiersDetail *FareQualifierDetailsType `xml:"fareQualifiersDetail,omitempty"` // minOccurs="0"

	// Details of the fare family used for this fare component
	FareFamilyDetails *FareFamilyType `xml:"fareFamilyDetails,omitempty"` // minOccurs="0"

	// Carrier owner of the fare family
	FareFamilyOwner *TransportIdentifierType_156079S `xml:"fareFamilyOwner,omitempty"` // minOccurs="0"

	// Used to specify coupons included in the fare component or in the bound.
	CouponDetailsGroup []*CouponDetailsType `xml:"couponDetailsGroup"` // maxOccurs="99"
}

type FareDetailsType struct {
	// fare indicators
	FareCategory string `xml:"fareCategory,omitempty"` // minOccurs="0"
}

type FareFamilyDetailsType struct {
	// Commercial fare Family Short name
	CommercialFamily string `xml:"commercialFamily"`
}

type FareFamilyType struct {
	// Fare Family Short Name
	FareFamilyname string `xml:"fareFamilyname,omitempty"` // minOccurs="0"

	// HIERARCHICAL ORDER WITHIN FARE FAMILY
	Hierarchy *int32 `xml:"hierarchy,omitempty"` // minOccurs="0"

	// Indicates Commercial Fare Family Short names
	CommercialFamilyDetails []*FareFamilyDetailsType `xml:"commercialFamilyDetails,omitempty"` // minOccurs="0" maxOccurs="20"
}

type FareInformationType struct {
	FareDetails *FareDetailsType `xml:"fareDetails,omitempty"` // minOccurs="0"
}

type FareQualifierDetailsType struct {
	DiscountDetails []*DiscountPenaltyInformationType `xml:"discountDetails,omitempty"` // minOccurs="0" maxOccurs="9"
}

type FareQualifierDetailsTypeI struct {
	// Type of movement for this segment to take into account by Fare Quote to calculate the fare.
	MovementType string `xml:"movementType,omitempty"` // minOccurs="0"

	// Fare basis detail
	FareBasisDetails *AdditionalFareQualifierDetailsTypeI `xml:"fareBasisDetails,omitempty"` // minOccurs="0"

	// Discount data for zap off to apply to price calculation.
	ZapOffDetails *DiscountPenaltyInformationTypeI `xml:"zapOffDetails,omitempty"` // minOccurs="0"
}

type FreeTextDetailsType struct {
	// Format limitations: an..3
	TextSubjectQualifier string `xml:"textSubjectQualifier"`

	// Format limitations: an..4
	InformationType string `xml:"informationType,omitempty"` // minOccurs="0"

	// Format limitations: an..3
	Status string `xml:"status,omitempty"` // minOccurs="0"

	// Format limitations: an..35
	CompanyId string `xml:"companyId,omitempty"` // minOccurs="0"

	// Format limitations: an..3
	Language string `xml:"language,omitempty"` // minOccurs="0"

	// Format limitations: an..3
	Source string `xml:"source"`

	// Format limitations: an..3
	Encoding string `xml:"encoding"`
}

type FreeTextInformationType struct {
	FreeTextDetails *FreeTextDetailsType `xml:"freeTextDetails,omitempty"` // minOccurs="0"

	// Free text and message sequence numbers of the remarks.
	FreeText []string `xml:"freeText"` // maxOccurs="99"
}

type FreeTextQualificationTypeI struct {
	// Format limitations: an..3
	TextSubjectQualifier string `xml:"textSubjectQualifier"`
}

type InteractiveFreeTextTypeI struct {
	FreeTextQualification *FreeTextQualificationTypeI `xml:"freeTextQualification,omitempty"` // minOccurs="0"

	// Format limitations: an..10
	FreeText string `xml:"freeText"`
}

type InteractiveFreeTextTypeI_6759S struct {
	// Free flow text describing the error
	ErrorFreeText string `xml:"errorFreeText,omitempty"` // minOccurs="0"
}

type ItemNumberIdentificationType struct {
	// Item identification: number of the fare component or of the bound.
	Number string `xml:"number,omitempty"` // minOccurs="0"

	// Item type: fare component (FC) or bound (BND).
	Type string `xml:"type,omitempty"` // minOccurs="0"
}

type ItemNumberType struct {
	// Item identification: number of the fare component or of the bound.
	ItemNumberDetails []*ItemNumberIdentificationType `xml:"itemNumberDetails"` // maxOccurs="99"
}

type ItemReferencesAndVersionsType struct {
	// Identification details : order number
	SequenceSection *UniqueIdDescriptionType `xml:"sequenceSection,omitempty"` // minOccurs="0"
}

type ItemReferencesAndVersionsType_94584S struct {
	// qualifies the type of the reference used. Code set to define
	ReferenceType string `xml:"referenceType,omitempty"` // minOccurs="0"

	// Tattoo number
	UniqueReference *int32 `xml:"uniqueReference,omitempty"` // minOccurs="0"
}

type LocationTypeI struct {
	// Format limitations: an..25
	TrueLocationId string `xml:"trueLocationId,omitempty"` // minOccurs="0"
}

type LocationTypeI_47688C struct {
	// Code of the city.
	CityCode string `xml:"cityCode,omitempty"` // minOccurs="0"
}

type MileageTimeDetailsTypeI struct {
	// mileage total associated to the TST
	TotalMileage int32 `xml:"totalMileage"`
}

type MonetaryInformationDetailsType struct {
	// Format limitations: an..3
	TypeQualifier string `xml:"typeQualifier"`

	// Amount
	Amount string `xml:"amount,omitempty"` // minOccurs="0"

	// Currency
	Currency string `xml:"currency,omitempty"` // minOccurs="0"
}

type MonetaryInformationDetailsTypeI struct {
	// Qualify the type of fare defined in this composite
	FareDataQualifier string `xml:"fareDataQualifier"`

	// Fare data amount
	FareAmount string `xml:"fareAmount,omitempty"` // minOccurs="0"

	// Fare data currency code
	FareCurrency string `xml:"fareCurrency,omitempty"` // minOccurs="0"

	// Location of the fare data (PFCs specific)
	FareLocation string `xml:"fareLocation,omitempty"` // minOccurs="0"
}

type MonetaryInformationDetailsTypeI_37257C struct {
	// Type qualifier
	TypeQualifier string `xml:"typeQualifier"`

	// amount
	Amount string `xml:"amount"`

	// currency
	Currency string `xml:"currency,omitempty"` // minOccurs="0"

	// location
	Location string `xml:"location,omitempty"` // minOccurs="0"
}

type MonetaryInformationDetailsTypeI_63727C struct {
	// Qualifier
	TypeQualifier string `xml:"typeQualifier"`

	// Amount
	Amount string `xml:"amount,omitempty"` // minOccurs="0"

	// Currency
	Currency string `xml:"currency,omitempty"` // minOccurs="0"

	// Location
	Location string `xml:"location,omitempty"` // minOccurs="0"
}

type MonetaryInformationDetailsType_223832C struct {
	// Format limitations: an..3
	FareDataQualifier string `xml:"fareDataQualifier"`

	// Amount
	FareAmount string `xml:"fareAmount,omitempty"` // minOccurs="0"

	// Currency
	FareCurrency string `xml:"fareCurrency,omitempty"` // minOccurs="0"

	// location
	FareLocation string `xml:"fareLocation,omitempty"` // minOccurs="0"
}

type MonetaryInformationType struct {
	// Monetary information per fare component
	MonetaryDetails *MonetaryInformationDetailsType `xml:"monetaryDetails"`

	// Other monetary information per fare component
	OtherMonetaryDetails []*MonetaryInformationDetailsType `xml:"otherMonetaryDetails,omitempty"` // minOccurs="0" maxOccurs="19"
}

type MonetaryInformationTypeI struct {
	// Main fare data infomation, can b thee base or  the total fare information which are mandatory  anyway
	FareDataMainInformation *MonetaryInformationDetailsTypeI `xml:"fareDataMainInformation"`

	// Supplementary fare data information
	FareDataSupInformation []*MonetaryInformationDetailsTypeI `xml:"fareDataSupInformation,omitempty"` // minOccurs="0" maxOccurs="19"
}

type MonetaryInformationTypeI_20897S struct {
	// monetaryDetails
	MonetaryDetails *MonetaryInformationDetailsTypeI_37257C `xml:"monetaryDetails"`

	OtherMonetaryDetails []*MonetaryInformationDetailsTypeI_37257C `xml:"otherMonetaryDetails,omitempty"` // minOccurs="0" maxOccurs="5"
}

type MonetaryInformationTypeI_39230S struct {
	// Monetary info
	MonetaryDetails []*MonetaryInformationDetailsTypeI_63727C `xml:"monetaryDetails"` // maxOccurs="20"
}

type MonetaryInformationType_187640S struct {
	FareDataMainInformation *MonetaryInformationDetailsType_223832C `xml:"fareDataMainInformation"`

	FareDataSupInformation []*MonetaryInformationDetailsType_223832C `xml:"fareDataSupInformation,omitempty"` // minOccurs="0" maxOccurs="99"
}

type OriginAndDestinationDetailsTypeI struct {
	// Code of the city.
	CityCode []string `xml:"cityCode"` // maxOccurs="2"
}

type PricingOrTicketingSubsequentType struct {
	// RATE OR TARIFF CLASS INFORMATION
	FareBasisDetails *RateTariffClassInformationType `xml:"fareBasisDetails,omitempty"` // minOccurs="0"
}

type PricingTicketingSubsequentTypeI struct {
	// Information on TST type.
	TstInformation *RateTariffClassInformationTypeI `xml:"tstInformation"`

	// International sales indicator
	SalesIndicator string `xml:"salesIndicator,omitempty"` // minOccurs="0"

	// Fare calculation mode indicator. This indicator specifies the type fare.
	Fcmi string `xml:"fcmi"`

	// Information of original fare used to create TST. The TST is created from Best Fare ( possible or available).
	BestFareType string `xml:"bestFareType,omitempty"` // minOccurs="0"
}

type ProductIdentificationDetailsTypeI struct {
	// OPEN or AIR are the two identifications accepted.  OPEN means the segment described here is an open segment. AIR means that it is a valid AIR segment.
	Identification string `xml:"identification"`

	// to describe the transportation class.
	BookingClass string `xml:"bookingClass,omitempty"` // minOccurs="0"

	// Class of service to use in order to price the extra segment.
	ClassOfService string `xml:"classOfService,omitempty"` // minOccurs="0"
}

type ProductTypeDetailsType struct {
	// TST Connection Type
	FlightIndicator string `xml:"flightIndicator"`
}

type RateTariffClassInformationType struct {
	// Fare Basis Code
	RateTariffClass string `xml:"rateTariffClass,omitempty"` // minOccurs="0"

	// Ticket Designator
	OtherRateTariffClass string `xml:"otherRateTariffClass,omitempty"` // minOccurs="0"
}

type RateTariffClassInformationTypeI struct {
	// Indicator qualifying the type of TST (basically manual or automatic)
	TstIndicator string `xml:"tstIndicator"`
}

type ReferenceInfoType struct {
	ReferenceDetails *ReferencingDetailsType `xml:"referenceDetails"`
}

type ReferenceInformationTypeI struct {
	// Passenger/segment/TST/fare reference details
	RefDetails []*ReferencingDetailsTypeI `xml:"refDetails,omitempty"` // minOccurs="0" maxOccurs="99"
}

type ReferencingDetailsType struct {
	// Format limitations: an..10
	Type string `xml:"type"`

	// Format limitations: an..60
	Value string `xml:"value"`
}

type ReferencingDetailsTypeI struct {
	// Qualifyer of the reference (Pax/Seg/Tst/Fare tattoo)
	RefQualifier string `xml:"refQualifier,omitempty"` // minOccurs="0"

	// Passenger/segment/TST/fare tattoo reference number
	RefNumber *int32 `xml:"refNumber,omitempty"` // minOccurs="0"
}

type ReservationControlInformationDetailsTypeI struct {
	// Record locator.
	ControlNumber string `xml:"controlNumber"`
}

type ReservationControlInformationTypeI struct {
	// Reservation control information
	ReservationInformation *ReservationControlInformationDetailsTypeI `xml:"reservationInformation"`
}

type SelectionDetailsInformationTypeI struct {
	// Format limitations: an..2
	Option string `xml:"option"`
}

type SelectionDetailsTypeI struct {
	SelectionDetails *SelectionDetailsInformationTypeI `xml:"selectionDetails"`
}

type SpecificDataInformationTypeI struct {
	// Carrier fee code
	DataTypeInformation *DataTypeInformationTypeI `xml:"dataTypeInformation"`

	// Carrier fee application code  (NI, NR, CM, NC)
	DataInformation []*DataInformationTypeI `xml:"dataInformation,omitempty"` // minOccurs="0" maxOccurs="99"
}

type StructuredDateTimeInformationType struct {
	// This data element can be used to provide the semantic of the information provided. Examples : - Impacted period - Departure date - Estimated arrival date and time
	BusinessSemantic string `xml:"businessSemantic,omitempty"` // minOccurs="0"

	// Convey date and/or time.
	DateTime *StructuredDateTimeType `xml:"dateTime,omitempty"` // minOccurs="0"
}

type StructuredDateTimeType struct {
	// Year number. The format is a little long for short term usage but it can be reduced by implementation if required.
	Year *int32 `xml:"year,omitempty"` // minOccurs="0"

	// Month number in the year ( begins to 1 )
	Month string `xml:"month,omitempty"` // minOccurs="0"

	// Day number in the month ( begins to 1 )
	Day string `xml:"day,omitempty"` // minOccurs="0"
}

type TaxDetailsTypeI struct {
	// Tax Amount
	Rate string `xml:"rate,omitempty"` // minOccurs="0"

	// ISO code identifying Country
	CountryCode string `xml:"countryCode,omitempty"` // minOccurs="0"

	// ISO code identifying currency
	CurrencyCode string `xml:"currencyCode,omitempty"` // minOccurs="0"

	// Tax designator code
	Type string `xml:"type,omitempty"` // minOccurs="0"

	// tax designator code.
	SecondType string `xml:"secondType,omitempty"` // minOccurs="0"
}

type TaxTypeI struct {
	// Tax details
	TaxDetails []*TaxDetailsTypeI `xml:"taxDetails,omitempty"` // minOccurs="0" maxOccurs="99"
}

type TicketNumberDetailsTypeI struct {
	// Ticket number
	Number string `xml:"number"`

	// ticket type
	Type string `xml:"type,omitempty"` // minOccurs="0"
}

type TicketNumberTypeI struct {
	// Details on the document
	DocumentDetails *TicketNumberDetailsTypeI `xml:"documentDetails"`
}

type TransportIdentifierType struct {
	// Information related to validating carrier.
	CarrierInformation *CompanyIdentificationTypeI `xml:"carrierInformation,omitempty"` // minOccurs="0"
}

type TransportIdentifierType_156079S struct {
	CompanyIdentification *CompanyIdentificationTypeI_222513C `xml:"companyIdentification,omitempty"` // minOccurs="0"
}

type TravelProductInformationType struct {
	BoardPointDetails *LocationTypeI `xml:"boardPointDetails,omitempty"` // minOccurs="0"

	OffpointDetails *LocationTypeI `xml:"offpointDetails,omitempty"` // minOccurs="0"

	// TST Connection Type
	FlightTypeDetails *ProductTypeDetailsType `xml:"flightTypeDetails,omitempty"` // minOccurs="0"
}

type TravelProductInformationTypeI struct {
	BoardPointDetails *LocationTypeI `xml:"boardPointDetails,omitempty"` // minOccurs="0"

	OffpointDetails *LocationTypeI `xml:"offpointDetails,omitempty"` // minOccurs="0"
}

type TravelProductInformationTypeI_26322S struct {
	// City of departure for this extra segment.
	DepartureCity *LocationTypeI_47688C `xml:"departureCity,omitempty"` // minOccurs="0"

	// City of arrival for this extra segment.
	ArrivalCity *LocationTypeI_47688C `xml:"arrivalCity,omitempty"` // minOccurs="0"

	// Airline detail information of the extra segment.
	AirlineDetail *CompanyIdentificationTypeI `xml:"airlineDetail,omitempty"` // minOccurs="0"

	// Segment detail information.
	SegmentDetail *ProductIdentificationDetailsTypeI `xml:"segmentDetail,omitempty"` // minOccurs="0"

	// Ticketing status for this segment. Relevant only in case of reply.
	TicketingStatus string `xml:"ticketingStatus,omitempty"` // minOccurs="0"
}

type UniqueIdDescriptionType struct {
	// Number specifying the ordering information of the item described within a group.
	SequenceNumber *int32 `xml:"sequenceNumber,omitempty"` // minOccurs="0"
}