text:
title: Post a reservation update
layout: reference
---

## Description

**NOTE**: This function is not supported in the current version. Support may be returned in a future release.

This request is sent when the Travel user updates their reservation. The response includes the new reservation identifier.

##  Request

###Encoding
UTF-8

###Request URI
The Hotel direct connect sends the relevant information to a URI that the travel supplier maintains. The standard location is:

`https://{servername}/concur/hotel/v1/`

The URI is configured by the supplier when registering the partner application. Refer to **Core Concepts**> [Partner Applications][1] for more information.

### Headers

### Accept header
application/XML

#### Authorization header

Authorization header with Basic credentials. Refer to the [Security][2] documentation for more information.

### Request Body
The request will contain an **OTA_HotelResModifyRQ** parent element, with the following attributes:

* xmlns
* EchoToken
* TimeStamp
* PrimaryLangID
* xmlns:xsi
* xsi:schemaLocation
* Version

The **OTA_HotelResModifyRQ** element contains the following child elements:

|  Element |  Description |
|----------|---------------------------------------|
|  POS |  The point of sale information. Contains a **Source** child element that specifies the source of the request. For information about **Source** element, see the **Source elements** table below. |
| HotelResModifies | This element has a **HotelResModify** child element. For more information about this child element, see the **HotelResModify element** table below. |

#### Source elements

The **Source** element has the following attributes:

* ISOCountry: The country code for the Travel user's home country.
* ISOCurrency: The 3-letter ISO 4217 currency code for the Travel user's currency.

The **Source** element contains the following element:

|  Element |  Description |
|----------|---------------------------------------|
|  RequestorID | The customer's identifiers. If necessary, multiple **RequestorID** elements can be sent. This element has the following attributes:
**Type**: The code for the customer type.
**ID**: The identifier for the user. |

#### HotelResModify element

The **HotelResModify** element with the following attributes:

* **RoomStayReservation**: Whether the reservation is for a room stay. Format: true/false.
* **CreateDateTime**: The time the reservation was originally created, in the hotel's local time zone.
* **CreatorID**: The source of the reservation.

The **HotelResModify** element contains the following child elements:

|  Element |  Description |
|----------|---------------------------------------|
| RoomStays | This parent element contains the **RoomStay** element. Refer to the **RoomStay Request elements** table for information about child elements. |
|ResGuests | This parent element contains the **ResGuest** element. For more information about this child element, see the **ResGuest elements** table below. |
|  ResGlobalInfo |  This parent element contains a **HotelReservationIDs** child element. This element contains a **HotelReservationID** child element with the following attribute:
**ResID_Value**: The reservation ID. |

#### RoomStay Request elements

|  Element |  Description |
|----------|---------------------------------------|
|  RoomTypes |  This parent element contains the **RoomType** child element, with the NumberofUnits attribute indicating how many rooms of this type are included in the reservation. |
|  RatePlans |  This parent element contains the **RatePlan** child element, with the RatePlanCode attribute, specifying the rate plan code for the reservation. |
|  GuestCounts |  This parent element contains the **GuestCount** child element, with the following attributes:
**AgeQualifyingCode**: The value for this element should be 10, which represents an Adult guest.
**Count**: The number of guests included in the request. |
|  TimeSpan |  This element has the following attributes:
**Start**: The start date of the reservation.
**End**: The end date of the reservation. |
|  Guarantee |  This parent element contains the **GuaranteesAccepted** element. The **GuaranteesAccepted** element contains the **GuaranteeAccepted** element. This element has the GuaranteeTypeCode attribute, specifying the type of guarantee placed on the reservation. The **GuaranteeAccepted** parent element has a **PaymentCard** child element for card guarantees; for information about this child element, see the **PaymentCard elements** table below. |
|  BasicPropertyInfo |  This element contains the HotelCode attribute. |
|  Comments |  The comments on the reservation. This parent element contains a **Comment** child element for each comment associated with the reservation. |

#### ResGuest elements

The **ResGuest** element has the following attributes:

* **ResGuestRPH**: The unique identifier for the guest.
* **AgeQualifyingCode**: The value for this element should be 10, which represents an Adult guest.

The **ResGuest** element contains a **Profiles** child element with information about the guest's profile. The **Profiles** element contains the **ProfileInfo** child element. The **ProfileInfo** element has the **Profile** child element. The **Profile** element contains the **Customer** element. The **Customer** element contains the following child elements:

|  Element |  Description |
|----------|---------------------------------------|
|  PersonName |  This element contains the following child elements:**GivenName**: The guest's given name.
**Surname**: The guest's surname. |
|  Telephone |  This element has a PhoneNumber attribute containing the guest's phone number. |
|  Email |  The guest's email address. |
|  Address |  This parent element has the following child elements:
**AddressLine**: The first address line.
**CityName**: The address city.
**PostalCode**: The address postal code.
**StateProv**: The address state/province.
**CountryName**: The 2-character address country name. Format: US |

#### PaymentCard elements

The **PaymentCard** element has the following attributes:

* **CardCode**: The type of card.
* **CardNumber**: The card number.

The **PaymentCard** element has the following child elements:

|  Element |  Description |
|----------|---------------------------------------|
|  CardHolderName |  The card holder's name. |
|  Address |  The billing address of the card. This parent element contains the following child elements:
**AddressLine**: The first address line.
**CityName**: The address city.
**PostalCode**: The address postal code.
**StateProv**: The address state/province.
**CountryName**: The 2-character address country name. Format: US |

###  XML Example Request

```xml
    POST /concur/hotel/v1 HTTPS/1.1
    Host: example.com
    Authorization: Basic ...
    Content-Type: application/xml
    Content-Length: {length of content body}

    <?xml version="1.0" encoding="UTF-8" ?>
    <OTA_HotelResModifyRQ xmlns="http://www.opentravel.org/OTA/2003/05" EchoToken="ABC123" TimeStamp="2012-01-01T19:00:00" PrimaryLangID="en-us" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opentravel.org/OTA/2003/05 ../Schemas/OTA_HotelResModifyRQ.xsd" Version="1">
        <POS>
            <Source ISOCountry="US" ISOCurrency="USD">
                <RequestorID Type="18" ID="7777777" />
            </Source>
        </POS>
        <HotelResModifies>
            <HotelResModify RoomStayReservation="true" CreateDateTime="2003-03-11T17:29:00-08:00" CreatorID="Expedia">
                <RoomStays>
                    <RoomStay>
                        <RoomTypes>
                            <RoomType NumberOfUnits="1" />
                        </RoomTypes>

                        <RatePlans>
                            <RatePlan RatePlanCode="2222222" />
                        </RatePlans>
                        <GuestCounts>
                            <GuestCount AgeQualifyingCode="10" Count="1" />
                        </GuestCounts>
                        <TimeSpan Start="2012-08-15" End="2010-08-16" />
                        <Guarantee>
                            <GuaranteesAccepted>
                                <GuaranteeAccepted GuaranteeTypeCode="CC">
                                    <PaymentCard CardCode="AX" CardNumber="4400000000000000" ExpireDate="1215">
                                        <CardHolderName>CHRIS MILLER</CardHolderName>
                                        <Address>
                                            <AddressLine>18400 NE UNION HILL RD.</AddressLine>
                                            <CityName>REDMOND</CityName>
                                            <PostalCode>98052</PostalCode>
                                            <StateProv>WA</StateProv>
                                            <CountryName>US</CountryName>
                                        </Address>
                                    </PaymentCard>
                                </GuaranteeAccepted>
                            </GuaranteesAccepted>
                        </Guarantee>
                        <BasicPropertyInfo HotelCode="HTL1111" />
                    </RoomStay>
                </RoomStays>
                <ResGuests>
                    <ResGuest ResGuestRPH="1" AgeQualifyingCode="10">
                        <Profiles>
                            <ProfileInfo>
                                <Profile>
                                    <Customer>
                                        <PersonName>
                                            <GivenName>CHRIS</GivenName>
                                            <Surname>MILLER</Surname>
                                        </PersonName>
                                        <Telephone PhoneNumber="212-555-1212" />
                                        <Email>cmiller@example.com</Email>
                                        <Address>
                                            <AddressLine>18400 NE Union Hill Rd.</AddressLine>
                                            <CityName>Redmond</CityName>
                                            <PostalCode>98052</PostalCode>
                                            <StateProv>WA</StateProv>
                                            <CountryName>USA</CountryName>
                                        </Address>
                                    </Customer>
                                </Profile>
                            </ProfileInfo>
                        </Profiles>
                    </ResGuest>
                </ResGuests>
                <ResGlobalInfo>
                    <HotelReservationIDs>
                        <HotelReservationID ResID_Value="888000888" />
                    </HotelReservationIDs>
                </ResGlobalInfo>
            </HotelResModify>
        </HotelResModifies>
    </OTA_HotelResModifyRQ>
```

##  Response

The supplier responds to the request by returning an updated booking identifier.

### Content Types
application/xml

### Response body

The response includes an **OTA_HotelResModifyRS** parent element with the following attributes:

* xmlns
* EchoToken
* TimeStamp
* xmlns:xsi
* xsi:schemaLocation
* Version

The **OTA_HotelResModifyRS** parent element contains a **Success** element if the request was successful. It also contains a **HotelResModifies** element. The **HotelResModifies** element contains the **HotelResModify** element. The **HotelResModify** element contains the **ResGlobalInfo** child elements. The **ResGlobalInfo** element contains the **HotelReservationIDs** element. The **HotelReservationIDs** element contains two **HotelReservationID** child elements with the **ResID_Value** attribute containing the reservation ID. The first **HotelReservationID** element contains the original reservation identifier, and the second one contains the new reservation ID.

###  XML Example of Successful Response

```xml
    200 OK HTTPS/1.1
    Content-Length: {length of content body}

    <?xml version="1.0" encoding="UTF-8" ?>
    <OTA_HotelResModifyRS xmlns="http://www.opentravel.org/OTA/2003/05" EchoToken="ABC123" TimeStamp="2012-01-01T19:00:00" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.opentravel.org/OTA/2003/05 ../Schemas/OTA_HotelResModifyRS.xsd" Version="1">
        <Success />
        <HotelResModifies>
            <HotelResModify>
                <ResGlobalInfo>
                    <HotelReservationIDs>
                        <HotelReservationID ResID_Value="888000888" />
                        <HotelReservationID ResID_Value="999000999" />
                    </HotelReservationIDs>
                </ResGlobalInfo>
            </HotelResModify>
        </HotelResModifies>
    </OTA_HotelResModifyRS>
```

[1]: https://developer.concur.com/overview/partner-applications
[2]: https://developer.concur.com/node/434#security


text:
"use strict";

var visit = require('unist-util-visit');

function findLastTag(node) {
  var tag = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'p';
  if (!node.children || !node.children.length) return;
  var links = node.children.filter(function (e) {
    return e.tagName === tag;
  });
  if (!links.length) return;
  return links[links.length - 1];
}

function findLastLink(node, className) {
  if (!node.children || !node.children.length) return;
  var links = node.children.filter(function (e) {
    return e.tagName === 'a';
  });
  if (!links.length) return;
  var aTag = links[links.length - 1];
  if (!aTag.properties || !aTag.properties.className || !aTag.properties.className.includes(className)) return;
  return aTag;
}

function setPostfix(node, aTag, postfix) {
  if (typeof postfix === 'function') {
    var id = node.properties.id;
    node.properties.id = postfix(id);
    var link = aTag.properties.href;
    aTag.properties.href = "#".concat(postfix(link.substr(1)));
  } else {
    node.properties.id += postfix;
    aTag.properties.href += postfix;
  }
}

function plugin() {
  var postfix = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : '-postfix';
  return function (tree) {
    visit(tree, 'element', function (node, index, parent) {
      if (!['li', 'sup'].includes(node.tagName)) return;

      if (node.tagName === 'li') {
        if (!node.properties || !node.properties.id) return;
        if (!node.properties.id.startsWith('fn-')) return;
        if (!node.children.length) return;
        var aTag = findLastLink(node, 'footnote-backref');

        if (!aTag) {
          var pTag = findLastTag(node, 'p');
          aTag = findLastLink(pTag, 'footnote-backref');
        }

        if (!aTag) return;
        setPostfix(node, aTag, postfix);
      }

      if (node.tagName === 'sup') {
        if (!node.properties || !node.properties.id) return;
        if (!node.properties.id.startsWith('fnref-')) return;
        if (!node.children.length || node.children[0].tagName !== 'a') return;
        var _aTag = node.children[0];
        if (!_aTag.properties || !_aTag.properties.className || !_aTag.properties.className.includes('footnote-ref')) return;
        setPostfix(node, _aTag, postfix);
      }
    });
  };
}

module.exports = plugin;

redpajama_set_name: RedPajamaGithub


text:
<?php

namespace Data;

use G4\CleanCore\Application;
use G4\Log\Data\Exclude;
use G4\Log\Data\Response;
use PHPUnit_Framework_TestCase;

class LoggerAbstractTest extends PHPUnit_Framework_TestCase
{
    private $app;
    private $profiler;
    private $request;
    private $logger;
    const EXCLUDED = 'EXCLUDED';

    protected function setUp()
    {
        $this->profiler = $this->createMock(\G4\Runner\Profiler::class);
        $this->profiler->method('getProfilerOutput')->willReturn([]);

        $this->request = new \G4\CleanCore\Request\Request();
        $response = new \G4\CleanCore\Response\Response();
        $response->setResponseObject('Testing long response that we want to truncate');

        $this->app = $this->createMock(Application::class);
        $this->app->method('getResponse')->willReturn($response);
        $this->app->method('getRequest')->willReturn($this->request);

        $this->logger = new Response();
        $this->logger->setApplication($this->app);
        $this->logger->setProfiler($this->profiler);
    }

    public function testFilterExcludedFields()
    {
        $this->app->method('getAppNamespace')->willReturn('test_module');
        $this->request->setResourceName('test_service');

        $exclude = new Exclude([
            'test_module' =>
                [
                    'test_service' => ['message', 'resource']
                ]
        ]);

        $this->logger->setExcluded($exclude);

        $rawData = $this->logger->getRawData();

        $this->assertTrue($rawData['message'] === self::EXCLUDED);
        $this->assertTrue($rawData['resource'] === self::EXCLUDED);
    }

    public function testFilterExcludedFieldsEmpty()
    {
        $this->app->method('getAppNamespace')->willReturn('test_module');
        $this->request->setResourceName('test_service');

        $exclude = new Exclude();

        $this->logger->setExcluded($exclude);

        $rawData = $this->logger->getRawData();

        $this->assertFalse($rawData['message'] === self::EXCLUDED);
        $this->assertFalse($rawData['resource'] === self::EXCLUDED);
    }

    public function testFilterExcludedFieldsModuleMismatch()
    {
        $this->app->method('getAppNamespace')->willReturn('testModule');
        $this->request->setResourceName('test_service');

        $exclude = new Exclude([
            'test_module' =>
                [
                    'test_service' => ['timestamp', 'hostname']
                ]
        ]);

        $this->logger->setExcluded($exclude);

        $rawData = $this->logger->getRawData();

        $this->assertFalse($rawData['message'] === self::EXCLUDED);
        $this->assertFalse($rawData['resource'] === self::EXCLUDED);
    }

    public function testFilterExcludedFieldsServiceMismatch()
    {
        $this->app->method('getAppNamespace')->willReturn('test_module');
        $this->request->setResourceName('testService');

        $exclude = new Exclude([
            'test_module' =>
                [
                    'test_service' => ['timestamp', 'hostname']
                ]
        ]);

        $this->logger->setExcluded($exclude);

        $rawData = $this->logger->getRawData();

        $this->assertFalse($rawData['message'] === self::EXCLUDED);
        $this->assertFalse($rawData['resource'] === self::EXCLUDED);
    }

    public function testFilterExcludedFieldsWithMethod()
    {
        $this->app->method('getAppNamespace')->willReturn('test_module');
        $this->request->setResourceName('test_service');
        $_SERVER['REQUEST_METHOD'] = 'GET';

        $exclude = new Exclude([
            'test_module' =>
                [
                    'test_service' =>
                        [
                            'get' => ['message', 'resource']
                        ]
                ]
        ]);
        $exclude->setModule('test_module');
        $exclude->setService('test_service');

        $this->logger->setExcluded($exclude);

        $rawData = $this->logger->getRawData();

        $this->assertTrue($rawData['message'] === self::EXCLUDED);
        $this->assertTrue($rawData['resource'] === self::EXCLUDED);
    }

    public function testFilterExcludedFieldsMethodMismatch()
    {
        $this->app->method('getAppNamespace')->willReturn('test_module');
        $this->request->setResourceName('test_service');
        $_SERVER['REQUEST_METHOD'] = 'POST';

        $exclude = new Exclude([
            'test_module' =>
                [
                    'test_service' =>
                        [
                            'put' => ['timestamp', 'hostname']
                        ]
                ]
        ]);

        $this->logger->setExcluded($exclude);

        $rawData = $this->logger->getRawData();

        $this->assertFalse($rawData['message'] === self::EXCLUDED);
        $this->assertFalse($rawData['resource'] === self::EXCLUDED);
    }
}


text:
require 'test_helpers'

class ErrorTest < Minitest::Unit::TestCase
  def test_parse_a_hash_to_build_the_error_object
    error = Cielo::Response::Error.new({:codigo => "002", :mensagem => "Credenciais inválidas"})

    assert_equal "002", error.code
    assert_equal "Credenciais inválidas", error.message
    assert_equal "ERROR 002 - Credenciais inválidas", error.to_s
  end
end


text:
package iitb.Model;
import iitb.CRF.DataSequence;
/**
 *
 * @author Sunita Sarawagi
 * @since 1.0
 * @version 1.3
 */

public class EdgeFeatures extends FeatureTypes {
	/**
	 *
	 */
	private static final long serialVersionUID = -6098103393225258231L;
	transient protected EdgeIterator edgeIter = null;
	protected int edgeNum;
	transient boolean edgeIsOuter;
	Object labelNames[];
	public EdgeFeatures(FeatureGenImpl m, Object labels[]) {
		super(m);
		labelNames=labels;
	}
	public EdgeFeatures(FeatureGenImpl m) {
		this(m,null);
	}
	protected void setEdgeIter() {
	    edgeIter = model.edgeIterator();
	}
	public boolean startScanFeaturesAt(DataSequence data, int prevPos, int pos) {
		if (prevPos < 0) {
			edgeNum = model.numEdges();
			return false;
		} else {
			edgeNum = 0;
			if (edgeIter == null) {
			    setEdgeIter();
			}
			if (edgeIter != null)
			    edgeIter.start();
			return hasNext();
		}
	}
	public boolean hasNext() {
		return (edgeIter != null) && (edgeIter.hasNext());
	}
	public boolean lastEdgeWasOuter() {return edgeIsOuter;}
	public void next(FeatureImpl f) {
		edgeIsOuter = edgeIter.nextIsOuter();
		Edge e = edgeIter.next();
		Object name="";
		if (featureCollectMode()) {
			if (labelNames == null) {
				name = "E."+(edgeIsOuter?(""+model.label(e.start)):("I." + e.start));
			} else {
				name = labelNames[model.label(e.start)];
			}
		}
		if (edgeIsOuter) {
			setFeatureIdentifier(model.label(e.start)*model.numberOfLabels()+model.label(e.end) + model.numEdges(), e.end,name,f);
		} else {
			setFeatureIdentifier(edgeNum,e.end,name,f);
		}
		f.ystart = e.start;
		f.yend = e.end;
		f.val = 1;
		edgeNum++;
	}

	 public boolean fixedTransitionFeatures() {
	     return true;
	     /*((model.numStartStates()==model.numStates())&&
	             (model.numEndStates()==model.numEndStates()));
	             */
	 }
};


text:
"""
PDB related functions used in the SCT suite of programs
"""

# Copyright 2014 University College London

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

#    http://www.apache.org/licenses/LICENSE-2.0

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

from __future__ import absolute_import
from __future__ import print_function
from . import seq
import string
import sys
from sct.six.moves import range

# Dictionary of CHARMM residue names to standard naming
charmm_resids = {
    'ANE5AC': 'SIA',
    'BNE5AC': 'SIA',
    'AFUC': 'FUC',
    'BFUC': 'FUC',
    'AGAL': 'GAL',
    'BGAL': 'GAL',
    'AGLCNA': 'NAG',
    'BGLCNA': 'NAG',
    'AGALNA': 'NGA',
    'BGALNA': 'NGA',
    'AMAN': 'MAN',
    'BMAN': 'MAN',
    'ASH': 'ASP',
    'CYM': 'CYS',
    'CYX': 'CYS',
    'GLH': 'GLU',
    'HIP': 'HIS',
    'HID': 'HIS',
    'HIE': 'HIS',
    'HSD': 'HIS',
    'HSE': 'HIS',
    'LYN': 'LYS',
    'TYM': 'TYR'
}

charmm_residues = list(charmm_resids.keys())

# In the PDBs the CHARMM resids get truncated to three characters.
charmm_three_char = [
    'ANE',
    'BNE',
    'AFU',
    'BFU',
    'AGA',
    'BGA',
    'AGL',
    'BGL',
    'AMA',
    'BMA']

PDB_ATOM_RECORD = (
    ('record', 0, 6, None),    # 0,  record type name
    ('atom_no', 6, 11, int),     # 1,  atom serial/index no
    ('atom_name', 12, 16, None),     # 2,  atom name
    ('alt', 16, None, None),    # 3,  altLoc
    ('res_id', 17, 20, None),  # 4,  residue name
    ('chain', 21, None, None),   # 5,  chain ID
    ('res_no', 22, 26, int),     # 6,  residue sequence number
    ('insert', 26, None, None),  # 7,  insertion code
    ('x', 30, 38, float),       # 8,  x
    ('y', 38, 46, float),       # 9,  y
    ('z', 46, 54, float),       # 10, z
    ('occ', 54, 60, float),     # 11, occupancy
    ('b', 60, 66, float),       # 12, temperature factor
    ('segid', 72, 76, None),   # 13, segment ID
    ('element', 76, 78, None),  # 14, element
    ('charge', 78, 80, None),   # 15, charge
)

#  CHARMM Format strings - source/psffres.src
#
#  Format shown including CHEQ (which we are ignoring):
#  II,LSEGID,LRESID,LRES,TYPE(I),IAC(I),CG(I),AMASS(I),IMOVE(I),ECH(I),EHA(I)
#
# standard format:
# (I8,1X,A4,1X,A4,1X,A4,1X,A4,1X,I4,1X,2G14.6,I8,2G14.6)
# (I8,1X,A4,1X,A4,1X,A4,1X,A4,1X,A4,1X,2G14.6,I8,2G14.6)  XPLOR
# expanded format EXT:
# (I10,1X,A8,1X,A8,1X,A8,1X,A8,1X,I4,1X,2G14.6,I8,2G14.6)
# (I10,1X,A8,1X,A8,1X,A8,1X,A8,1X,A4,1X,2G14.6,I8,2G14.6) XPLOR
#
# Note: For some reason the extended format seems to like putting small
# charges in scientific format which leads to the length increasing by 2 chars
# Works on files I tested but YMMV

PSF_ATOM_RECORD = (
    ('atom_no', 0, 8, int),     # 0, atom serial/index no
    ('segid', 9, 13, None),     # 1, segment ID
    ('res_no', 14, 18, int),     # 2, residue sequence number
    ('res_id', 19, 23, None),  # 3, residue name
    ('atom_name', 24, 28, None),     # 4, atom name
    ('type', 29, 33, None),     # 5, atom type
    ('charge', 34, 48, float),  # 6, charge
    ('mass', 48, 62, float),    # 7, mass
    ('imove', 62, 70, int),     # 8, imove
    # ('ech', 70, 84, float),     # 9, ech
    # ('eha', 84, 100, float),    # 10, eha
)

PSFEXT_ATOM_RECORD = (
    ('atom_no', 0, 10, int),    # 0, atom serial/index no
    ('segid', 11, 19, None),    # 1, segment ID
    ('res_no', 20, 28, int),     # 2, residue sequence number
    ('res_id', 29, 37, None),  # 3, residue name
    ('atom_name', 38, 46, None),     # 4, atom name
    ('type', 47, 52, None),     # 5, atom type
    ('charge', 53, 68, float),  # 6, charge
    ('mass', 68, 82, float),    # 7, mass
    ('imove', 82, 90, int),     # 8, imove
    # ('ech', 90, 104, float),     # 9, ech
    # ('eha', 104, 118, float),    # 10, eha
)

# We will accept either standard or CHARMM residue naming
accept_resids = seq.all_residues + charmm_residues + charmm_three_char

def parse_line(line, schema, filename):
    """
    Parse an atom record line from a PDB or PSF file via schema.
    Based on the PDB parsing code written by Alisue (lambdalisue@hashnote.net):
    https://gist.github.com/lambdalisue/7209305

    Schema format:

        1) record name
        2) start index
        3) end index or None for single character
        4) processing function or None for `string.strip`

        so a truncated (but valid) schema for a PDB ATOM record cold be:

        ATOM_RECORD_SCHEMA = (
        ...    ('record', 0,  6,   None),   # 0,  record name
        ...    ('name', 6, 11,   int),      # 1,  serial
        )

    @type  line:   string
    @param line:   Line from a text file.
    @type  schema: list
    @param schema: List of 4-tuples. The format of the tuples is given above.
    @rtype:        dictionary
    @return:       Dictionary with keys specifiec as the record name in the
                   schema.
    """

    vals = {}
    for record, start, end, fn in schema:
        if end is None:
            end = start + 1
        if fn is None:
            fn = string.strip
        try:
            vals[record] = fn(line[start:end])
        except ValueError as e:
            print("Error: File %s contains a line which could not be parsed according to the schema." % filename)
            print("Python error message: %s" % e)
            print("Line contents:", line)
            raise IOError(
                "Error parsing %s, ignoring this pdb file." %
                filename)
    return vals

def pdb_res_line_parse(line, filename):
    """Parse a single line from a PDB file into a dictionary according to
    the standard PDB column definitions

    @type  line: string
    @param line: Line from a PDB file.
    @rtype:      dictionary
    @return:     Contains:
                     - atom_no:   integer, atom number
                     - atom_name: string, atom name
                     - res_id:    string, residue three letter code
                     - chain:     string, chain identifier
                     - res_no:    integer, residue number
                     - coords:    list of floats, the x, y & z coordinates
    """

    # Only interested in ATOM and HETATM lines not REMARKs etc.
    # The type of record on the line is determined by the first 6 characters
    record = line[0:6].strip()

    if record in ['ATOM', 'HETATM']:

        data = parse_line(line, PDB_ATOM_RECORD, filename)
        if data['res_id'] in accept_resids:
            # Split data on the line according to column definitions for PDB files
            # Ignore residues that we can't handle in SCT
            # TODO: This should perhaps give a warning

            data['coords'] = [data['x'], data['y'], data['z']]
        else:
            raise IOError(
                "Error: File %s contains unknown residue %s" %
                (filename, data['res_id']))
            data = {}
    else:
        data = {}

    return data

def is_hydrogen(atom_name):

    flag = False
    test_char = 0

    try:
        int(atom_name[test_char])
        test_char = 1
    except:
        pass

    if atom_name[test_char] == 'H':
        flag = True

    return flag

def read_pdb_atom_data(filename, filter_h = True):
    """
    Read PDB file and return residue frequencies and atom coordinates

    @type  filename: string
    @param filename: Path to a PDB file.
    @rtype:   dictionary, list
    @return:
              - Dictionary for residue type frequency.
                Three letter residue code for the key and residue type
                frequency as the values.
              - A list containing lists of x, y & z coordinates (3 * floats)
    """

    # Initialize a dictionary of all recognized residues (frequency = 0)
    res_freq = seq.residue_freq_dict()

    # Track the last residues seen
    last_res_no = 0

    atom_coords = []

    # Read in lines of the PDB
    # ATOM and HETATM records are interpretted - others ignored
    with open(filename) as f:
        for line in f:
            data = pdb_res_line_parse(line, filename)

            if len(data) != 0:

                if filter_h and is_hydrogen(data['atom_name']):
                    continue

                atom_coords.append(data['coords'])
                # If residue number has changed increment res_id tally

                if data['res_no'] != last_res_no:
                    # If a CHARMM residue name is used convert to standard
                    # naming
                    if data['res_id'] in charmm_resids:
                        res_name = charmm_resids[data['res_id']]
                    else:
                        res_name = data['res_id']
                    res_freq[res_name] += 1
                    last_res_no = data['res_no']

    return res_freq, atom_coords

def read_sphere_pdb(filename):
    """
    Read PDB file and return residue frequencies and atom coordinates

    @type  filename: string
    @param filename: Path to a PDB file.
    @rtype:          dictionary, list
    @return:
              - A list containing lists of x, y & z coordinates (3 * floats)
              - float of the sphere radius
    """

    spheres = []
    radius = 0.0
    # Read in lines of the PDB
    # ATOM and HETATM records are interpretted - others ignored
    with open(filename) as f:
        for line in f:
            data = pdb_res_line_parse(line, filename)

            if len(data) != 0:
                spheres.append(data['coords'])
                radius = data['b']

    return spheres, radius

def read_psf(filename):
    """
    Read in a PSF file and create a list of dictionaries containing the fields
    defined in PSF_ATOM_RECORD/PSFEXT_ATOM_RECORD schemas.

    @type  filename: string
    @param filename: Path to a PSF file.
    @rtype:          list
    @return:         List of dictionaries with kets as defined in the
                     PSF_ATOM_RECORD/PSFEXT_ATOM_RECORD schemas.
    """

    psf_file = open(filename, 'r')
    # Process PSF header
    # Contains the flags that determine contents and format type
    # (EXT or normal, not XPLOR or CHARMM)
    header = psf_file.readline().split()
    if header[0] != 'PSF':
        # This should be a proper exception! As should the other errors!
        print('Boo not a PSF!')
        sys.exit()

    if 'EXT' in header:
        schema = PSFEXT_ATOM_RECORD
    else:
        schema = PSF_ATOM_RECORD
    # Skip blank line
    psf_file.readline()

    title = psf_file.readline().split()
    if title[1] != '!NTITLE':
        print('Not a valid PSF (NTITLE) - sad times')
        sys.exit()

    # Skip remark lines (number given as the first entry on the NTITLE line)
    for ii in range(int(title[0])):
        psf_file.readline()

    # Skip blank line
    psf_file.readline()

    atom_title = psf_file.readline().split()
    if atom_title[1] != '!NATOM':
        print('Not a valid PSF (NATOM) - sad times')
        sys.exit()

    n_atoms = int(atom_title[0])

    atoms = []

    for ii in range(n_atoms):
        line = psf_file.readline()
        atoms.append(parse_line(line, schema, filename))

    psf_file.close()

    return atoms

def process_pdb_psf(psf_filename, pdb_filename, sctify=True, removeh=True):
    """
    Read in a PSF/PDB pair of files and create a list of dictionaries
    containing the fields defined in PSF_ATOM_RECORD/PSFEXT_ATOM_RECORD
    schemas plus 'coords' (from the PDB x,y,z coordinates) and 'chain' (from
    the PDB chain column). Hydrogen atoms are filtered out.

    @type  psf_filename: string
    @param psf_filename: Path to a PSF file.
    @type  pdb_filename: string
    @param pdb_filename: Path to a PSF file.
    @type  sctify:       boolean
    @keyword sctify:     Should CHARMM residue names be changed to SCT
                         friendly ones?
    @type  removeh:      boolean
    @keyword removeh:    Should hydrogens be removed?
    @rtype:              list
    @return:             List of dictionaries with keys as defined in the
                         PSF_ATOM_RECORD/PSFEXT_ATOM_RECORD schemas plus 'coords'
                         (from the PDB x,y,z coordinates) and 'chain' (from the PDB
                         chain column).
    """

    psf_atoms = read_psf(psf_filename)
    n_atoms = len(psf_atoms)

    if n_atoms == 0:
        print("No atoms found in the PSF, expect pain")
    else:
        tmp_atoms = []

    # Read in lines of the PDB
    # ATOM and HETATM records are interpretted - others ignored
    with open(pdb_filename) as f:
        for line in f:
            if line[:6].strip() in ['ATOM', 'HETATM']:
                data = pdb_res_line_parse(line, pdb_filename)
                tmp_atoms.append(data)

        if len(tmp_atoms) != n_atoms:
            print("Number of atoms in the PDB do not match the PSF")
        else:
            for ii in range(0, n_atoms):
                # print psf_atoms[ii]['atom_name'] + '\t' +
                # tmp_atoms[ii]['atom_name']
                psf_atoms[ii]['coords'] = tmp_atoms[ii]['coords']
                psf_atoms[ii]['chain'] = tmp_atoms[ii]['chain']

    atoms = []

    for atom in psf_atoms:

        #if not(removeh and (atom['atom_name'][0] == 'H')):
        if not(removeh and is_hydrogen(atom['atom_name'])):

            if (atom['res_id'] in charmm_residues) and sctify:
                atom['res_id'] = charmm_resids[atom['res_id']]

            atoms.append(atom)

    return atoms

def create_pdb_atom(res_no, res_id, atom_no, atom_type, coords, **kwargs):
    """
    Create ATOM line for output in a PDB file (ends with a new line character)

    @type  res_no:    integer
    @param res_no:    Residue number
    @type  res_id:    string
    @param res_id:    Residue name (3 letter code)
    @type  atom_no:   integer
    @param atom_no:   Atom number
    @type  atom_type: string
    @param atom_type: Atom type
    @type  coords:    list
    @param coords:    A list containing lists of x, y & z coordinates
                      (3 * floats)
    @keyword beta:    Value to put in the temperature factor (beta) column
    @keyword occ:     Value to put in the occupancy (occ) column
    @keyword chain:   Chain identifier (a single letter)
    @rtype:           string
    @return:          A line of text formatted as an ATOM line of a PDB
    """

    # Columns for temperature factor (beta) and occupancy (occ) often used to
    # store other data
    beta = kwargs.get('beta', 0.0)
    occ = kwargs.get('occ', 0.0)
    chain = kwargs.get('chain', 'A')
    segid = kwargs.get('segid', '    ')

    line = "ATOM  {0:5d}  {1:3s} {2:3s}".format(atom_no, atom_type, res_id)
    line += " {0:1s}{1:4d}    ".format(chain, res_no)
    line += "{0:8.3f}{1:8.3f}{2:8.3f}".format(coords[0], coords[1], coords[2])
    line += "{0:6.2f}{1:6.2f}".format(occ, beta)
    line += "      {0:s}\n".format(segid)

    return line

def write_pdb(atoms, filename):
    """
    Writes out a PDB file based on the values in the input atoms

    @type  atoms:     list
    @param atoms:     A list of dictionaries containing values for the keys
                      defined in PDB_ATOM_RECORD schema
    @type  filename:  string
    @param filename:  Filename for the output sphere model PDB
    """

    out_file = open(filename, 'w')

    for atom in atoms:
        if 'segid' in list(atom.keys()):
            segid = atom['segid']
        else:
            segid = ''
        pdb_line = create_pdb_atom(atom['res_no'],
                                   atom['res_id'],
                                   atom['atom_no'],
                                   atom['atom_name'],
                                   atom['coords'],
                                   chain=atom['chain'],
                                   segid=segid)

        out_file.write(pdb_line)

    out_file.close()

def write_sphere_pdb(coords, radius, filename):
    """
    Writes out a PDB file containing entries for the spheres of a sphere model,
    using the beta column to store radius (all ATOMs are C1 SER)

    @type  coords:    list
    @param coords:    A list containing lists of x, y & z coordinates (3 * floats)
    @type  radius:    float
    @param radius:    Sphere radius
    @type  filename:  string
    @param filename:  Filename for the output sphere model PDB
    """

    out_file = open(filename, 'w')

    count = 1

    for coord in coords:

        pdb_line = create_pdb_atom(
            count,
            'SER',
            count,
            'C1',
            coord,
            beta=radius)

        out_file.write(pdb_line)
        count += 1

    out_file.close()


text:
use strict;
use lib "/opt/zimbra/libexec/scripts";
use lib "/opt/zimbra/zimbramon/lib";
use Migrate;
use Getopt::Long;
my $concurrent = 10;

sub usage() {
	print STDERR "Usage: $0\n";
	exit(1);
}
my $opt_h;
GetOptions("help" => \$opt_h);
usage() if $opt_h;

my @groups = Migrate::getMailboxGroups();

my @sql = ();
foreach my $group (@groups) {
  foreach my $table (qw(mail_item appointment imap_folder imap_message open_conversation pop3_message revision tombstone data_source_item)) {
   print "Adding $group.$table to be optimized\n";
    #push(@sql, "OPTIMIZE TABLE $group.$table;");
    push(@sql, "ALTER TABLE $group.$table ENGINE=InnoDB;");
  }
}
foreach my $table (qw(volume current_volumes mailbox deleted_account mailbox_metadata out_of_office config table_maintenance scheduled_task mobile_devices )) {
  print "Adding zimbra.$table to be optimized\n";
  #push(@sql, "OPTIMIZE TABLE zimbra.$table;");
  push(@sql, "ALTER TABLE zimbra.$table ENGINE=InnoDB;");
}
my $start = time();
Migrate::runSqlParallel($concurrent, @sql);
my $elapsed = time() - $start;
my $numGroups = scalar @groups;
print "\nAltered $numGroups mailbox groups in $elapsed seconds\n";

exit(0);


text:
package org.uberfire.ext.layout.editor.client;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
import java.util.Map;
import javax.enterprise.context.Dependent;
import javax.enterprise.event.Event;
import javax.inject.Inject;

import com.google.gwt.user.client.ui.Widget;
import org.jboss.errai.ioc.client.container.IOC;
import org.uberfire.client.mvp.UberView;
import org.uberfire.ext.layout.editor.api.editor.LayoutTemplate;
import org.uberfire.ext.layout.editor.client.components.LayoutDragComponentGroup;
import org.uberfire.ext.layout.editor.client.structure.EditorWidget;
import org.uberfire.ext.layout.editor.client.components.GridLayoutDragComponent;
import org.uberfire.ext.layout.editor.client.components.LayoutDragComponent;
import org.uberfire.ext.layout.editor.client.util.DragTypeBeanResolver;
import org.uberfire.workbench.events.NotificationEvent;

@Dependent
public class LayoutEditorPresenter {

    public static final String[] SPANS = {"12", "6 6", "4 4 4"};

    @Inject
    private Event<NotificationEvent> ufNotification;

    private final View view;

    private List<LayoutDragComponent> addedGridSystemComponents = new ArrayList<LayoutDragComponent>( );

    public interface View extends UberView<LayoutEditorPresenter> {

        void setupGridSystem( List<LayoutDragComponent> layoutDragComponents );

        void setupComponents( List<LayoutDragComponent> layoutDragComponents );

        void setupContent( LayoutTemplate layoutTemplate);

        LayoutTemplate getModel();

        void loadDefaultLayout(String layoutName);

        void addLayoutProperty( String key,
                                String value );

        String getLayoutProperty( String key );

        Map<String, String> getLayoutComponentProperties( EditorWidget component );

        void addComponentProperty( EditorWidget component,
                                   String key,
                                   String value );

        void resetLayoutComponentProperties( EditorWidget component );

        void removeLayoutComponentProperty( EditorWidget component,
                                            String key );

        void addDraggableComponentGroup( LayoutDragComponentGroup group );

        void addDraggableComponentToGroup( String groupId, String componentId, LayoutDragComponent component );

        void removeDraggableGroup( String id );

        void removeDraggableComponentFromGroup( String groupId, String componentId );

    }
    @Inject
    public LayoutEditorPresenter( final View view ) {
        this.view = view;
        view.init( this );
    }

    public UberView<LayoutEditorPresenter> getView() {
        return view;
    }

    public void setupDndPallete(List<LayoutDragComponent> layoutDragComponents ) {
        view.setupComponents( layoutDragComponents );

        List<LayoutDragComponent> gridSystemComponents = new ArrayList<LayoutDragComponent>(  );

        for ( String span : SPANS ) {
            GridLayoutDragComponent component = getGridLayoutDragComponent();
            component.setSpan( span );
            gridSystemComponents.add( component );
        }

        view.setupGridSystem( gridSystemComponents );
    }

    private GridLayoutDragComponent getGridLayoutDragComponent() {
        final GridLayoutDragComponent gridLayoutDragComponent = IOC.getBeanManager().lookupBean(
                GridLayoutDragComponent.class ).newInstance();
        addedGridSystemComponents.add( gridLayoutDragComponent );

        return gridLayoutDragComponent;
    }

    void clearGridSystem() {
        for ( LayoutDragComponent addedGridSystemComponent : addedGridSystemComponents ) {
            IOC.getBeanManager().destroyBean( addedGridSystemComponent );
        }
        addedGridSystemComponents.clear();
    }

    public LayoutTemplate getLayout() {
        return view.getModel();
    }

    public void loadLayout(LayoutTemplate layoutTemplate) {
        view.setupContent(layoutTemplate);
    }

    public void loadDefaultLayout( String layoutName ) {
        view.loadDefaultLayout(layoutName);
    }

    public void addLayoutProperty(String key, String value) {
        view.addLayoutProperty( key, value );
    }

    public String getLayoutProperty(String key) {
        return view.getLayoutProperty( key );
    }

    public void addDraggableComponentGroup( LayoutDragComponentGroup group ) {
        view.addDraggableComponentGroup( group );
    }

    public void addDraggableComponentToGroup( String groupId, String componentId, LayoutDragComponent component ) {
        view.addDraggableComponentToGroup( groupId, componentId, component );
    }

    public void removeDraggableGroup( String id ) {
        view.removeDraggableGroup( id );
    }

    public void removeDraggableComponentFromGroup( String groupId, String componentId ) {
        view.removeDraggableComponentFromGroup( groupId, componentId );
    }
}


text:
DECLARE_bool(lmctfy_binary);

using ::std::unique_ptr;
using ::std::vector;
using ::testing::Ge;
using ::testing::Return;
using ::util::Status;

namespace containers {
namespace lmctfy {
namespace cli {
namespace {

static const char kContainerName[] = "/test";

class SpecTest : public ::testing::Test {
 public:
  virtual void SetUp() {
    mock_lmctfy_.reset(new StrictMockContainerApi());
    mock_container_ = new StrictMockContainer(kContainerName);
  }

 protected:
  unique_ptr<MockContainerApi> mock_lmctfy_;
  MockContainer *mock_container_;
  OutputMap output_maps_;
};

TEST_F(SpecTest, Success) {
  const vector<string> args = {"spec", kContainerName};
  ContainerSpec spec;
  spec.mutable_memory()->set_limit(10);

  EXPECT_CALL(*mock_lmctfy_, Get(kContainerName))
      .WillOnce(Return(mock_container_));
  EXPECT_CALL(*mock_container_, Spec())
      .WillRepeatedly(Return(spec));

  FLAGS_lmctfy_binary = false;
  EXPECT_TRUE(SpecContainer(args, mock_lmctfy_.get(), &output_maps_).ok());
}

TEST_F(SpecTest, SuccessBinary) {
  const vector<string> args = {"spec", kContainerName};
  ContainerSpec spec;
  spec.mutable_memory()->set_limit(10);

  EXPECT_CALL(*mock_lmctfy_, Get(kContainerName))
      .WillOnce(Return(mock_container_));
  EXPECT_CALL(*mock_container_, Spec())
      .WillRepeatedly(Return(spec));

  FLAGS_lmctfy_binary = true;
  EXPECT_TRUE(SpecContainer(args, mock_lmctfy_.get(), &output_maps_).ok());
}

TEST_F(SpecTest, SuccessSelf) {
  const vector<string> args = {"spec"};
  ContainerSpec spec;
  spec.mutable_memory()->set_limit(10);

  EXPECT_CALL(*mock_lmctfy_, Detect(Ge(0)))
      .WillRepeatedly(Return(string(kContainerName)));
  EXPECT_CALL(*mock_lmctfy_, Get(kContainerName))
      .WillOnce(Return(mock_container_));
  EXPECT_CALL(*mock_container_, Spec())
      .WillRepeatedly(Return(spec));

  FLAGS_lmctfy_binary = false;
  EXPECT_TRUE(SpecContainer(args, mock_lmctfy_.get(), &output_maps_).ok());
}

TEST_F(SpecTest, SummarySelfDetectFails) {
  const vector<string> args = {"spec"};

  EXPECT_CALL(*mock_lmctfy_, Detect(Ge(0)))
      .WillRepeatedly(Return(Status::CANCELLED));

  FLAGS_lmctfy_binary = false;
  EXPECT_EQ(Status::CANCELLED,
            SpecContainer(args, mock_lmctfy_.get(), &output_maps_));
}

TEST_F(SpecTest, GetFails) {
  const vector<string> args = {"spec", kContainerName};

  EXPECT_CALL(*mock_lmctfy_, Get(kContainerName))
      .WillOnce(Return(Status::CANCELLED));

  FLAGS_lmctfy_binary = false;
  EXPECT_EQ(Status::CANCELLED,
            SpecContainer(args, mock_lmctfy_.get(), &output_maps_));

  // Delete the container since it is never returned.
  delete mock_container_;
}

TEST_F(SpecTest, SpecFails) {
  const vector<string> args = {"spec", kContainerName};

  EXPECT_CALL(*mock_lmctfy_, Get(kContainerName))
      .WillOnce(Return(mock_container_));
  EXPECT_CALL(*mock_container_, Spec())
      .WillRepeatedly(Return(Status::CANCELLED));

  FLAGS_lmctfy_binary = false;
  EXPECT_EQ(Status::CANCELLED,
            SpecContainer(args, mock_lmctfy_.get(), &output_maps_));
}

}  // namespace
}  // namespace cli
}  // namespace lmctfy
}  // namespace containers


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

<TITLE>
gravity.impl (Gravity Framework (Version 1.0-beta-1))
</TITLE>
<META NAME="keywords" CONTENT="gravity.impl package">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../stylesheet.css" TITLE="Style">

gravity.impl

Classes

AbstractComponentInvocationHandler

CglibComponentInvocationHandler

CglibComponentProxy

ComponentKey

ComponentProxyFactory

ComponentStrategyDecorator

DefaultComponent

DefaultContainer

DispatchingComponentStrategy

DynamicWeaverFactory

JdkComponentInvocationHandler

JdkComponentProxy

LazyLoadingComponentStrategy

PoolingComponentStrategy

SingletonComponentStrategy

ThreadLocalComponentStrategy


text:
using System.Collections.Generic;
using System.Diagnostics;
using System.Linq;
using System.Reflection;
using BenchmarkDotNet.Environments;
using BenchmarkDotNet.Helpers;
using BenchmarkDotNet.Portability;
using BenchmarkDotNet.Running;

namespace BenchmarkDotNet.Diagnosers
{
    internal class MonoDisassembler
    {
        private readonly bool printAsm, printIL, printSource, printPrologAndEpilog;
        private readonly int recursiveDepth = 1;

        internal MonoDisassembler(DisassemblyDiagnoserConfig config)
        {
            printIL = config.PrintIL;
            printAsm = config.PrintAsm;
            printSource = config.PrintSource;
            printPrologAndEpilog = config.PrintPrologAndEpilog;
            recursiveDepth = config.RecursiveDepth;
        }

        internal DisassemblyResult Disassemble(Benchmark benchmark, MonoRuntime mono)
        {
            Debug.Assert(mono == null || !RuntimeInformation.IsMono(), "Must never be called for Non-Mono benchmarks");

            var monoMethodName = GetMethodName(benchmark.Target);

            var output = ProcessHelper.RunAndReadOutputLineByLine(
                mono?.CustomPath ?? "mono",
                "-v -v -v -v "
                + $"--compile {monoMethodName} "
                + (benchmark.Job.Env.Jit == Jit.Llvm ? "--llvm" : "--nollvm")
                + $" \"{benchmark.Target.Type.GetTypeInfo().Assembly.Location}\"");

            return OutputParser.Parse(output, monoMethodName, benchmark.Target.Method.Name);
        }

        static string GetMethodName(Target target)
            => $"{target.Type.GetTypeInfo().Namespace}.{target.Type.GetTypeInfo().Name}:{target.Method.Name}";

        internal static class OutputParser
        {
            internal static DisassemblyResult Parse(IReadOnlyList<string> input, string monoMethodName, string methodName)
            {
                var instructions = new List<Code>();

                bool found = false;

                foreach (var line in input.Reverse())
                {
                    if (!found)
                    {
                        if (IsStartLine(line, monoMethodName))
                            found = true;

                        continue;
                    }

                    if (IsEndLine(line))
                        break;

                    if (TryParseInstruction(line, out var instruction))
                        instructions.Add(instruction);
                }

                return new DisassemblyResult
                {
                    Methods = new[]
                    {
                        new DisassembledMethod
                        {
                            Name = methodName,
                            Maps = new [] { new Map { Instructions = instructions.ToArray() } }
                        }
                    }
                };
            }

            // the input is sth like "	4  storei4_membase_reg [%edi + 0xc] <- %eax"
            private static bool TryParseInstruction(string line, out Code instruction)
            {
                instruction = null;

                // in the future we could parse it, use Mono.Cecil and combine the il seq point with IL for given method as we do for regular .NET
                if (line.Contains("il_seq_point"))
                    return false;

                var trimmed = line.Trim();
                if (string.IsNullOrEmpty(trimmed) || !char.IsDigit(trimmed[0]))
                    return false;

                int startIndex = 0;
                while (char.IsDigit(trimmed[startIndex]) || char.IsWhiteSpace(trimmed[startIndex]))
                    startIndex++;

                instruction = new Code { TextRepresentation = trimmed.Substring(startIndex) };

                return true;
            }

            private static bool IsEndLine(string line)
                => string.IsNullOrWhiteSpace(line) || line.Contains("liveness");

            private static bool IsStartLine(string line, string methodName)
                => line != null && line.Contains(methodName) && line.Contains("emitted at");
        }
    }
}


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

namespace RazorEngine.Compilation.ImpromptuInterface.Dynamic
{
    class ImpromptuForwarderAddRemove
    {
        /// <summary>
        /// Implements the operator +.
        /// </summary>
        /// <param name="left">The left.</param>
        /// <param name="right">The right.</param>
        /// <returns>The result of the operator.</returns>
        public static ImpromptuForwarderAddRemove operator +(ImpromptuForwarderAddRemove left, object right)
        {
            left.Delegate = right;
            left.IsAdding = true;

            return left;
        }

        /// <summary>
        /// Implements the operator -.
        /// </summary>
        /// <param name="left">The left.</param>
        /// <param name="right">The right.</param>
        /// <returns>The result of the operator.</returns>
        public static ImpromptuForwarderAddRemove operator -(ImpromptuForwarderAddRemove left, object right)
        {
            left.Delegate = right;
            left.IsAdding = false;

            return left;
        }

        /// <summary>
        /// Gets or sets the delegate.
        /// </summary>
        /// <value>The delegate.</value>
        public object Delegate { get; protected set; }

        /// <summary>
        /// Gets or sets a value indicating whether this instance is adding.
        /// </summary>
        /// <value><c>true</c> if this instance is adding; otherwise, <c>false</c>.</value>
        public bool IsAdding { get; protected set; }

    }
}


text:
from setuptools import setup

setup(
    name='django-sugar',
    version='0.5',
    license='BSD',
    description='Curated collection of all the sweet Django helpers/utilities \
        developers create, and sometimes recreate too often.',
    author='Kevin Fricovsky',
    author_email='kfricovsky@gmail.com',
    url='http://github.com/montylounge/django-sugar',
    packages=[
        'sugar',
        'sugar.admin',
        'sugar.cache',
        'sugar.forms',
        'sugar.management',
        'sugar.management.commands',
        'sugar.middleware',
        'sugar.templatetags',
        'sugar.utils',
        'sugar.views',
        'sugar.widgets',
    ],
    classifiers=[
        'Development Status :: 2 - Alpha',
        'Environment :: Web Environment',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: BSD License',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Framework :: Django',
    ],
    test_suite = "test_project.runtests.runtests"
)


text:
/*
 * This is not the original file distributed by the Apache Software Foundation
 * It has been modified by the Hipparchus project
 */

package org.hipparchus.ode;

import org.hipparchus.util.FastMath;

/**
 * This class is used in the junit tests for the ODE integrators.

 *
This specific problem is the following differential equation :
 *

 *    y' = -y
 *

 * the solution of this equation is a simple exponential function :
 *

 *   y (t) = y (t0) exp (t0-t)
 *

 *

 */
public class TestProblem1 extends TestProblemAbstract {

    /**
     * Simple constructor.
     */
    public TestProblem1() {
        super(0.0, new double[] { 1.0, 0.1 }, 4.0, new double[] { 1.0, 1.0 });
    }

    @Override
    public double[] doComputeDerivatives(double t, double[] y) {

        // compute the derivatives
        final double[] yDot = new double[getDimension()];
        for (int i = 0; i < getDimension(); ++i) {
            yDot[i] = -y[i];
        }
        return yDot;

    }

    @Override
    public double[] computeTheoreticalState(double t) {
        final double c = FastMath.exp (getInitialTime() - t);
        final double[] y = getInitialState().getPrimaryState();
        for (int i = 0; i < getDimension(); ++i) {
            y[i] *= c;
        }
        return y;
    }

}


text:
select
  org,
  repo,
  sum(activity) as activity,
  sum(comments) as comments,
  sum(prs) as prs,
  sum(commits) as commits,
  sum(issues) as issues,
  EXACT_COUNT_DISTINCT(author_email) as authors_alt2,
  GROUP_CONCAT(STRING(author_name)) AS authors_alt1,
  GROUP_CONCAT(STRING(author_email)) AS authors
from (
select
  org.login as org,
  repo.name as repo,
  count(*) as activity,
  SUM(IF(type = 'IssueCommentEvent', 1, 0)) as comments,
  SUM(IF(type = 'PullRequestEvent', 1, 0)) as prs,
  SUM(IF(type = 'PushEvent', 1, 0)) as commits,
  SUM(IF(type = 'IssuesEvent', 1, 0)) as issues,
  IFNULL(REPLACE(JSON_EXTRACT(payload, '$.commits[0].author.email'), '"', ''), '(null)') as author_email,
  IFNULL(REPLACE(JSON_EXTRACT(payload, '$.commits[0].author.name'), '"', ''), '(null)') as author_name
from
  (select * from
    TABLE_DATE_RANGE([githubarchive:day.],TIMESTAMP('2017-08-01'),TIMESTAMP('2018-07-31'))
  )
where
  org.login = 'LibreOffice'
  and type in ('IssueCommentEvent', 'PullRequestEvent', 'PushEvent', 'IssuesEvent')
  and actor.login not like '%bot%'
  AND actor.login NOT IN (
    SELECT
      actor.login
    FROM (
      SELECT
        actor.login,
        COUNT(*) c
      FROM
        TABLE_DATE_RANGE([githubarchive:day.],TIMESTAMP('2017-08-01'),TIMESTAMP('2018-07-31'))
      WHERE
        type = 'IssueCommentEvent'
      GROUP BY
        1
      HAVING
        c > 2500
      ORDER BY
      2 DESC
    )
  )
group by org, repo, author_email, author_name
)
group by org, repo
order by
  activity desc
limit 10000
;