text:
Version 1.3.6 (2020-11-10)
--------------------------

 - Preserve order of iterable in viaSeq in Scala 2.13 (#330)
 - Throw instead of overflowing silently when numeric values are out of range for the target type (#208)
 - Convert Float to JsNumber directly without going through Double (#241)
 - Build with latest Scala versions (#334)

Version 1.3.5 (2017-10-24)
--------------------------

Security fix for several Denial Of Service vulnerabilities:

- CVE-2018-18853: Limit the number of characters for numbers in the parser (#278)
- CVE-2018-18854: Use TreeMap instead of HashMap for JsObject to prevent collision attacks (#277)
- CVE-2018-18855: Fix uncontrolled recursion in parser by limiting nesting depth (#286)

Thanks, [Andriy Plokhotnyuk](https://github.com/plokhotnyuk) who brought the first two issues to
our attention.

## Migration Notes

For some fixes, we added new limits to the parser:

 * Maximum depth of nested JSON values, defaults to 1000
 * Maximum characters for number values, defaults to 100

We introduced a `JsonParserSettings` class which can be used to customize these limits.
New overloads for `JsonParser.apply` and `String.parseJson` have been introduced to specify
custom settings.

Version 1.3.4 (2017-10-24)
--------------------------

- Replace ClassManifest by ClassTag
- Deprecate Pimp* classes and replace by Rich*

Version 1.3.3 (2016-12-29)
--------------------------

For Scala 2.12, this release brings no updates over 1.3.2 because the 2.12 release
of 1.3.2 was released from a later version of the master branch. Version 1.3.3
brings the artifacts for Scala 2.10 and 2.11 also to this latest state.

- Fixed decoding of 4-byte UTF-8 characters
- Refactored UTF-8 decoding into better reusable superclass
- Decode BigInt / BigDecimal values from JsString (#182)
- Cross published for Scala 2.10.x, 2.11.x, and 2.12.x

Version 1.3.2 (2015-05-06)
--------------------------
- Fixed performance bottleneck in `ProductFormats::fromField` (#132)
- Fixed multibyte chars at ix 0 of JSON String not being parsed correctly (#148)
- Fixed automatic field name discovery for member names with mangled prefix (#142)
- Reinstated deprecated `JsArray` and `JsObject` List-based constructors for backwards compatibility
- Added standard `OptionFormat` type (#151)
- Exposed field name in deserialization errors if possible
- Improved name unmangling in ProductFormats (#138)
- Introduced `JsObject.empty`, `JsArray.empty`, `JsString.empty` and `JsNumber.zero` (#143)
- Made `JsonParser` require complete consumption of parsing input (#137)

Version 1.3.1 (2014-10-28)
--------------------------
- Fixed OutOfMemoryError when parsing unterminated JSON strings (#122)
- Fixed member names not being unmangled in ProductsFormats (#120)

Version 1.3.0 (2014-09-22)
--------------------------
- Upgraded to Scala 2.11.2, dropped support for Scala 2.9
- Switched to fast, hand-written parser (#86, #108)
- Removed dependency on parboiled
- Changed parser to produce JsObject(HashMap) rather than JsObject(ListMap)
- Switched JsArray(List) to JsArray(Vector)
- Improved JsonPrinter to support printing to custom StringBuilder
- Added support for parameter-less case classes (#41)

Version 1.2.6 (2014-04-10)
--------------------------
- Improved deserialization error message with name of malformed field  (#62)
- Fixed broken `tuple7Format` (#66)
- Fixed parsing problem for invalid hex digits (#75)
- Fixed `jsonFormat` method to ignore static fields (#76)
- Fixed `JsonPrinter` unicode escaping to strictly match spec (#83, #46)
- Fixed `null` handling in `JsString` (#70)
- Opened up JsonPrinter methods to overriding by marking them `protected`
- Deprecated `asJson` method in favor of `parseJson` (#89)
- Added OSGi metadata
- Upgraded to Scala 2.10.4 and parboiled 1.1.6, added cross-building for Scala 2.11

Version 1.2.5 (2013-05-31)
--------------------------
- Extended `jsonFormat` support for case classes w/ > 15 parameters, closed #48

Version 1.2.4 (2013-05-13)
--------------------------
- Upgraded to 2.10.1 and parboiled 1.1.5
- Added RootJsonFormats for JsObject and JsArray
- Added a jsonFormat0 with support for 0-ary case classes, thx to Connor Doyle
- Fixed automatic field name extraction with ignoring of transient fields
- Slightly improved JSON rendering performance
- Upgraded to SBT 0.12.3

Version 1.2.3 (2012-11-28)
--------------------------
- Upgraded to 2.10.0-RC3 and parboiled 1.1.4
- Fixed rendering problem for certain unicode escapes

Version 1.2.2 (2012-10-16)
--------------------------
- Upgraded to parboiled 1.1.3

Version 1.2.1 (2012-10-15)
--------------------------
- Upgraded to parboiled 1.1.2
- Cross-published for Scala 2.9.2 and Scala 2.10.0-RC1

Version 1.2 (2012-10-12)
------------------------
- Upgraded to Scala 2.9.2 and parboiled 1.1.1
- Renamed group id from "cc.spray" to "io.spray"
- Renamed package from "cc.spray.json" to "spray.json"

Version 1.1.1 (2012-03-13)
--------------------------
- Fixed significant performance problem in JsonParser
- Improved automatic field name extraction for case classes

Version 1.1.0 (2012-02-01)
--------------------------
- Added automatic case class field name extraction via new jsonFormatX overloads
- Added 'asJson' extension method to Strings
- Added RootJsonFormat (JsonFormat for types corresponding to JSON document roots)
- Fixed problem of JSON object deserialization not being member-order independent
  (removed JsField, turned JsObject(List[JsField]) into JsObject(Map[String, JsValue]))
- Fixed issue #8 (Allow (de)serialization of NaN (Double)), thx to @stefritz
- Fixed #6 (rename JsValue:fromJson to 'convertTo', add .prettyPrint and .compactPrint)
- Improved deserialization error messages
- Upgraded to SBT 0.11.2

Version 1.0.1 (2011-10-04)
--------------------------
- Upgraded to Scala 2.9.1 and parboiled 1.0.2
- Improved (de)serialization of optional case class members (may now be missing)
- Added `NullOptions` trait for enforcing the serialization of `None` members as `null`
- Improved compile time error messages with @implicitNotFound annotations
- Improved documentation
- Smaller fixes and additions

Version 1.0.0 (2011-07-18)
--------------------------
first public release


text:
<!DOCTYPE html>

    <title>Instance Variables  Reference</title>
    <link rel="stylesheet" type="text/css" href="css/jazzy.css" />
    <link rel="stylesheet" type="text/css" href="css/highlight.css" />
    <meta charset='utf-8'>

 Docs (78% documented)

         Reference

        Instance Variables  Reference

            Classes

                ElongationCell

                ElongationDetailViewController

                ElongationHeader

                ElongationTransition

                ElongationViewController

                – State

                SwipableTableViewController

            Constructors

                init()

                init(_:)

                init(padding:sidePadding:)

                init(top:left:bottom:right:otherSides:)

            Enums

                State

            Extensions

                UICollectionView

                UIEdgeInsets

                UITableView

            Instance Methods

                animationController(forDismissed:)

                animationController(forPresented:presenting:source:)

                collapseCells(animated:)

                commonInit()

                dequeue(_:)

                dequeue(_:indexPath:)

                dim(_:animated:)

                expand(_:animated:)

                expand(viewController:animated:completion:)

                expandCell(at:)

                openDetailView(for:)

                register(_:)

                register(_:)

                registerNib(_:)

                registerNib(_:)

                scrollViewDidScroll(_:)

                scrollViewDidScroll(_:)

                tableView(_:willDisplay:forRowAt:)

            Instance Variables

                bottomView

                bottomView

                bottomViewHeight

                bottomViewHeightConstraint

                bottomViewOffset

                bottomViewTopConstraint

                bottomViewTopConstraint

                cellTouchAction

                contentView

                customSeparatorEnabled

                detailDismissingDuration

                detailPresetingDuration

                expandedIndexPath

                headerTouchAction

                headerView

                isExpanded

                isParallaxEnabled

                isSwipeGesturesEnabled

                parallaxFactor

                parallaxViewCenterConstraint

                parallaxViewHeightConstraint

                scalableView

                scalableView

                scaleViewScaleFactor

                separatorColor

                separatorHeight

                shouldExpand

                state

                topView

                topView

                topViewHeight

                topViewHeightConstraint

                topViewTopConstraint

            Static Variables

                shared

            Structs

                ElongationConfig

                – ExpandingBehaviour

                – CellTouchAction

                – HeaderTouchAction

Instance Variables

The following instance variables are available globally.

                    headerView

Actually this is expanded copy of ElongationCell.

Declaration

Swift

open var headerView: ElongationPreview.ElongationHeader!

                    scalableView

This is the front view which can be scaled if scaleFactor was configured in ElongationConfig.
Also to this view can be applied ‘parallax’ effect.

Declaration

Swift

@IBOutlet public var scalableView: UIView!

                    bottomViewHeightConstraint

height constraint of bottomView.

Declaration

Swift

@IBOutlet public var bottomViewHeightConstraint: NSLayoutConstraint!

                    topView

View on top half of contentView.
Add here all the views which wont be scaled and must stay on their position.

Declaration

Swift

@IBOutlet public var topView: UIView!

                    bottomViewTopConstraint

top constraint of bottomView.

Declaration

Swift

@IBOutlet public var bottomViewTopConstraint: NSLayoutConstraint!

                    isExpanded

Is this cell in expanded state.

Declaration

Swift

open var isExpanded: Bool

                    bottomView

The view which comes from behind the cell when you tap on the cell.

Declaration

Swift

@IBOutlet public var bottomView: UIView!

                    topViewHeightConstraint

height constraint of topView.
This constraint will be changed according to ElongationConfig.

Declaration

Swift

@IBOutlet public var topViewHeightConstraint: NSLayoutConstraint!

                    parallaxViewCenterConstraint

centerY constraint of view, to which must be applied parallax effect.

Declaration

Swift

@IBOutlet public var parallaxViewCenterConstraint: NSLayoutConstraint!

                    topViewTopConstraint

top constraint of topView.
This constraint will be changed if ElongationConfig was configured for using custom separators.

Declaration

Swift

@IBOutlet public var topViewTopConstraint: NSLayoutConstraint!

                    parallaxViewHeightConstraint

height constraint of view, to which must be applied parallax effect.

Declaration

Swift

@IBOutlet public var parallaxViewHeightConstraint: NSLayoutConstraint!

                    bottomViewHeight

bottomView height value
Default value: 180

Declaration

Swift

public var bottomViewHeight: CGFloat

                    isSwipeGesturesEnabled

Enable gestures on ElongationCell & ElongationHeader.
These gestures will give ability to expand/dismiss the cell and detail view controller.
Default value: true

Declaration

Swift

public var isSwipeGesturesEnabled: Bool

                    separatorColor

Color of custom separator
Default value: .white

Declaration

Swift

public var separatorColor: UIColor

                    detailDismissingDuration

Duration of detail view controller dismissing animation
Default value: 0.4

Declaration

Swift

public var detailDismissingDuration: TimeInterval

                    topViewHeight

Actual height of topView.
Default value: 200

Declaration

Swift

public var topViewHeight: CGFloat

                    parallaxFactor

Parallax effect factor.
Default value: nil

Declaration

Swift

public var parallaxFactor: CGFloat?

                    bottomViewOffset

Offset of bottomView against topView
Default value: 20

Declaration

Swift

public var bottomViewOffset: CGFloat

                    separatorHeight

Height of custom separator line between cells in tableView
Default value: nil

Declaration

Swift

public var separatorHeight: CGFloat?

                    customSeparatorEnabled

Should we create custom separator view (read-only).
Will be true if separator not nil && greater than zero.

Declaration

Swift

public var customSeparatorEnabled: Bool { get }

                    cellTouchAction

What elongationCell should do on touch

Declaration

Swift

public var cellTouchAction: ElongationPreview.ElongationConfig.CellTouchAction

                    scaleViewScaleFactor

topView scale value which will be used for making CGAffineTransform
to expanded state
Default value: 0.9

Declaration

Swift

public var scaleViewScaleFactor: CGFloat

                    isParallaxEnabled

Should we enable parallax effect on ElongationCell (read-only).
Will be true if separator not nil && greater than zero

Declaration

Swift

public var isParallaxEnabled: Bool { get }

                    detailPresetingDuration

Duration of detail view controller presention animation
Default value: 0.3

Declaration

Swift

public var detailPresetingDuration: TimeInterval

                    headerTouchAction

What elongationHeader should do on touch

Declaration

Swift

public var headerTouchAction: ElongationPreview.ElongationConfig.HeaderTouchAction

                    scalableView

This is the front view which can be scaled if scaleFactor was configured in ElongationConfig.
Also to this view can be applied ‘parallax’ effect.

Declaration

Swift

public var scalableView: UIView!

                    bottomView

The view which comes from behind the cell when you tap on the cell.

Declaration

Swift

public var bottomView: UIView!

                    contentView

Container of all the subviews.

Declaration

Swift

public var contentView: UIView

                    topView

View on top half of contentView.
Add here all the views which wont be scaled and must stay on their position.

Declaration

Swift

public var topView: UIView!

                    bottomViewTopConstraint

top constraint of bottomView.

Declaration

Swift

public var bottomViewTopConstraint: NSLayoutConstraint!

                    shouldExpand

Should cell change it’s state to expand on tap.
Default value: true

Declaration

Swift

public var shouldExpand: Bool

                    state

Current view state.
Default value: .normal

Declaration

Swift

public var state: ElongationPreview.ElongationViewController.State { get set }

                    expandedIndexPath

IndexPath of expanded cell.

Declaration

Swift

public var expandedIndexPath: IndexPath?

© 2017 . All rights reserved. (Last updated: 2017-02-20)

Generated by jazzy ♪♫ v0.7.4, a Realm project.

redpajama_set_name: RedPajamaGithub


text:
import sys
reload(sys)
sys.setdefaultencoding( "utf-8" )
from datetime import datetime
import time
import re #正则表达式用库
import xlsxwriter #保存xlsx用库

from evernote.api.client import EvernoteClient
devToken = "[Enter you developer token here]" #修改为自己的开发者token
client = EvernoteClient(token = devToken,sandbox=False) #沙盒同样写为Falsx
note_store = client.get_note_store()
user_store = client.get_user_store()

#请手动修改成相关笔记本题目和前一步得到的guid
notedict={'notebooktitle1':'notebookguid1',
          'notebooktitle2':'notebookguid2',
          'notebooktitle3':'notebookguid3',
          'notebooktitle4':'notebookguid4',
          'notebooktitle5':'notebookguid5'
          }

#edit xlsx
namecore=raw_input("输入文件名,支持中文等 \n 保存文件名将为 Expense[yyyyMMdd][输入内容].xlsx\n".decode('utf-8').encode(sys.getfilesystemencoding()))
nametime=time.strftime('%Y%m%d',time.localtime(time.time()))
namefull='Expensedata'+nametime+namecore+'.xlsx'

workbook=xlsxwriter.Workbook(namefull)

#set begin and end time
begin_time_str=raw_input("输入开始日期(含) \n 格式yyyymmdd".decode('utf-8').encode(sys.getfilesystemencoding()))
end_time_str=raw_input("输入结束日期(含) \n 格式yyyymmdd".decode('utf-8').encode(sys.getfilesystemencoding()))
begin_time=int(begin_time_str)
end_time=int(end_time_str)

def formtime(time_str):
    formed_y=int(time_str[:4])
    formed_m=int(time_str[5:7])
    formed_d=int(time_str[8:11])

    return datetime(year=formed_y,month=formed_m,day=formed_d)

for sort in notedict:
    givennoteguid=notedict[sort]
    #get useful record
    full=note_store.getNoteContent(devToken,givennoteguid)
    lst=re.findall('<div>\S+\s\S+</div>',full)
    sn=workbook.add_worksheet()
    sn.write(0,0,sort)
    sn.write(0,1,'名称')
    sn.write(0,2,'费用')

    number=1
    # add records of that sort
    for piece in lst:
        length=len(piece)
        end=length-6
        clear=piece[5:end]

        p1=clear.find(',')
        p2=clear.find('¥')
        time=clear[:p1]
        name=clear[p1+1:p2]
        fee=clear[p2:]

        #筛选有效和时间正确的记录
        if time.startswith('<'): continue #部分空行记录
        if time.startswith('#'): continue #允许以#排除部分记录
        if formtime(time) < begin_time: continue
        if formtime(time) > end_time:continue

        sn.write(number,0,time)
        sn.write(number,1,name)
        sn.write(number,2,fee)
        number=number+1

#save xlsx
workbook.close()


text:
ACCEPTED

#### According to
The Catalogue of Life, 3rd January 2011

#### Published in
Acta Soc. Fauna Flora fenn. 57(1): (1927)

#### Original name
Chaenothecopsis rubescens Vain.

### Remarks
null


text:
import { OperatorDoc } from '../operator.model';

export const publish: OperatorDoc = {
  'name': 'publish',
  'operatorType': 'multicasting'
};


text:
names = ['Tom', 'Fred', 'Harry', 'Hermione', 'Ron', 'Sarah', 'Ele', 'Mike', 'Peter']
subjects = ['Maths','Science','English', 'Arts', 'Music', 'German', 'French', 'PE']
grade_adjective = {
    1: ['terrible', 'horrible'],
    2: ['below average', 'mediocre'],
    3: ['Average', 'As expected'],
    4: ['good','above average'],
    5: ['Excellent', 'awesome']
}

silly_excuse = {
    1: ['Needs to pay attention to reading'],
    2: ['should consider wearing blue wellies'],
    3: ['dog ate their homework'],
    4: ['is always late'],
    5: ['is a genius anyway']
}


text:
class EmailProcessor

  def initialize(email)
    @email = email
    @tracker = Staccato.tracker(AppSettings['settings.google_analytics_id']) if google_analytics_enabled?
    @spam_score = @email.spam_score.present? ? @email.spam_score.to_f : 0
  end

  def process

    # Guard clause to prevent ESPs like Sendgrid from posting over and over again
    # if the email presented is invalid and generates a 500.  Returns a 200
    # error as discussed on https://sendgrid.com/docs/API_Reference/Webhooks/parse.html
    # This error happened with invalid email addresses from PureChat
    return if @email.from[:email].match(/\A[^@\s]+@([^@\s]+\.)+[^@\s]+\z/).blank?

    # Here we use a global spam score to system block spam, as well as a configurable
    # spam score to set status to SPAM above the configured level.

    # Outright reject spam from creating a ticket at all
    return if (@spam_score > AppSettings["email.spam_assassin_reject"].to_f)

    # Set attributes from email
    sitename = AppSettings["settings.site_name"]
    email_address = @email.from[:email].downcase
    email_name = @email.from[:name].blank? ? @email.from[:token].gsub(/[^a-zA-Z]/, '') : @email.from[:name]
    message = @email.body.nil? ? "" : encode_entity(@email.body)
    raw = @email.raw_body.nil? ? "" : encode_entity(@email.raw_body)
    to = @email.to.first[:email]
    cc = @email.cc ? @email.cc.map { |e| e[:full] }.join(", ") : nil
    token = @email.to.first[:token]
    subject = check_subject(@email.subject)
    attachments = @email.attachments
    number_of_attachments = attachments.present? ? attachments.size : 0
    spam_report = @email.spam_report

    if subject.include?("[#{sitename}]") # this is a reply to an existing topic
      EmailProcessor.create_reply_from_email(@email, email_address, email_name, subject, raw, message, token, to, sitename, cc, number_of_attachments, @spam_score, spam_report)
    elsif subject.include?("Fwd: ") # this is a forwarded message TODO: Expand this to handle foreign email formatting
      EmailProcessor.create_forwarded_message_from_email(@email, subject, raw, message, token, to, cc, number_of_attachments, @spam_score, spam_report)
    else # this is a new direct message
      EmailProcessor.create_new_ticket_from_email(@email, email_address, email_name, subject, raw, message, token, to, cc, number_of_attachments, @spam_score, spam_report)
    end

  # rescue
  #   render status: 200
  end

  # Insert a default subject if subject is missing
  def check_subject(subject)
    subject.blank? ? "(No Subject)" : subject
  end

  def encode_entity(entity)
    !entity.nil? ? entity.encode('utf-8', invalid: :replace, replace: '?') : entity
  end

  def self.handle_attachments(email, post)
    return unless email.attachments.present?
    if AppSettings['cloudinary.cloud_name'].present? && AppSettings['cloudinary.api_key'].present? && AppSettings['cloudinary.api_secret'].present?
      array_of_files = []
      email.attachments.each do |attachment|
        array_of_files << File.open(attachment.tempfile.path, 'r')
      end
      post.screenshots = array_of_files
    else
      post.update(
        attachments: email.attachments
      )
      if post.valid?
        post.save
      end
    end
  end

  def cloudinary_enabled?
    AppSettings['cloudinary.cloud_name'].present? && AppSettings['cloudinary.api_key'].present? && AppSettings['cloudinary.api_secret'].present?
  end

  def google_analytics_enabled?
    AppSettings['settings.google_analytics_enabled'] == '1'
  end

  # Creates a new ticket from an email
  def self.create_new_ticket_from_email(email, email_address, email_name, subject, raw, message, token, to, cc, number_of_attachments, spam_score, spam_report)

    # flag as spam if below spam score threshold
    ticket_status = (spam_score > AppSettings["email.spam_assassin_filter"].to_f) ? "spam" : "new"

    @user = User.where("lower(email) = ?", email_address).first
    if @user.nil?
      @user = EmailProcessor.create_user_for_email(email_address, token, email_name, ticket_status)
    end

    topic = Forum.first.topics.new(
      name: subject,
      user_id: @user.id,
      private: true,
      current_status: ticket_status,
      spam_score: spam_score,
      spam_report: spam_report
    )

    if topic.save
      if token.include?("+")
        topic.team_list.add(token.split('+')[1])
        topic.save
        topic.team_list.add(token)
        topic.save
      end
      #insert post to new topic
      message = "-" if message.blank? && number_of_attachments > 0
      post = topic.posts.create(
        body: message,
        raw_email: raw,
        user_id: @user.id,
        kind: "first",
        cc: cc,
        email_to_address: to
      )
      # Push array of attachments and send to Cloudinary
      EmailProcessor.handle_attachments(email, post)

      # Call to GA
      if @tracker
        @tracker.event(category: "Email", action: "Inbound", label: "New Topic", non_interactive: true)
        @tracker.event(category: "Agent: Unassigned", action: "New", label: topic.to_param)
      end
    end
  end

  # Creates a ticket from a forwarded email
  def self.create_forwarded_message_from_email(email, subject, raw, message, token, to, cc, number_of_attachments, spam_score, spam_report)

    # Parse from out of the forwarded raw body
    from = raw[/From: .*<(.*?)>/, 1]
    from_token = from.split("@")[0]

    # flag as spam if below spam score threshold
    ticket_status = (spam_score > AppSettings["email.spam_assassin_filter"].to_f) ? "spam" : "new"

    # scan users DB for sender email
    @user = User.where("lower(email) = ?", from).first
    if @user.nil?
      @user = EmailProcessor.create_user_for_email(from, from_token, "", ticket_status)
    end

    #clean message
    message = MailExtract.new(raw).body

    topic = Forum.first.topics.new(
      name: subject,
      user_id: @user.id,
      private: true,
      current_status: ticket_status,
      spam_score: spam_score,
      spam_report: spam_report
    )

    if topic.save
      #insert post to new topic
      message = "-" if message.blank? && number_of_attachments > 0
      post = topic.posts.create!(
        body: raw,
        raw_email: raw,
        user_id: @user.id,
        kind: 'first',
        cc: cc,
        email_to_address: to
      )

      # Push array of attachments and send to Cloudinary
      EmailProcessor.handle_attachments(email, post)

      # Call to GA
      if @tracker
        @tracker.event(category: "Email", action: "Inbound", label: "Forwarded New Topic", non_interactive: true)
        @tracker.event(category: "Agent: Unassigned", action: "Forwarded New", label: topic.to_param)
      end
    end
  end

  # Adds a reply to an existing ticket thread from an email response.
  def self.create_reply_from_email(email, email_address, email_name, subject, raw, message, token, to, sitename, cc, number_of_attachments, spam_score, spam_report)

    # flag as spam if below spam score threshold
    ticket_status = (spam_score > AppSettings["email.spam_assassin_filter"].to_f) ? "spam" : "new"

    @user = User.where("lower(email) = ?", email_address).first
    if @user.nil?
      @user = EmailProcessor.create_user_for_email(email_address, token, email_name, ticket_status)
    end

    complete_subject = subject.split("[#{sitename}]")[1].strip
    ticket_number = complete_subject.split("-")[0].split("#")[1].strip
    topic = Topic.find(ticket_number)

    if topic.present?
      # insert post to new topic
      message = "-" if message.blank? && number_of_attachments > 0
      post = topic.posts.create(
        body: message,
        raw_email: raw,
        user_id: @user.id,
        kind: "reply",
        cc: cc,
        email_to_address: to
      )

      # Push array of attachments and send to Cloudinary
      EmailProcessor.handle_attachments(email, post)

      if @tracker
        @tracker.event(category: "Email", action: "Inbound", label: "Reply", non_interactive: true)
        @tracker.event(category: "Agent: #{topic.assigned_user.name}", action: "User Replied by Email", label: topic.to_param) unless topic.assigned_user.nil?
      end
    end
  end

  def self.create_user_for_email(email_address, token, name, ticket_status)
    # create user
    @user = User.new

    @token, enc = Devise.token_generator.generate(User, :reset_password_token)
    @user.reset_password_token = enc
    @user.reset_password_sent_at = Time.now.utc

    @user.email = email_address
    @user.name = name.blank? ? token.gsub(/[^a-zA-Z]/, '') : name
    @user.password = User.create_password

    if @user.save
      UserMailer.new_user(@user.id, @token).deliver_later if @user.save && ticket_status != "spam"
    else
      @user = User.find(2) # just in case new user not saved, default to system user
    end
    return @user
  end

end


text:
"""
Flask-Store
-----------

Flask-Store is a Flask Extenstion which provides easy Django-Storages style
file handling to various storage backends.
"""

# Temporary patch for issue reported here:
# https://groups.google.com/forum/#!topic/nose-users/fnJ-kAUbYHQ
import multiprocessing  # noqa
import os
import sys
import warnings

from setuptools import setup, find_packages
from setuptools.command.test import test as TestCommand

class PyTest(TestCommand):

    def finalize_options(self):
        TestCommand.finalize_options(self)
        self.test_args = []
        self.test_suite = True

    def run_tests(self):
        # import here, cause outside the eggs aren't loaded
        import pytest
        errno = pytest.main(self.test_args)
        sys.exit(errno)

def read_requirements(filename):
    """ Read requirements file and process them into a list
    for usage in the setup function.

    Arguments
    ---------
    filename : str
        Path to the file to read line by line

    Returns
    --------
    list
        list of requirements::

            ['package==1.0', 'thing>=9.0']
    """

    requirements = []

    try:
        if os.path.isfile(filename):
            with open(filename, 'rb') as f:
                for line in f.readlines():
                    line = line.strip()
                    if not line or line.startswith(b'#') or line == '':
                        continue
                    requirements.append(line.decode('utf-8'))
        else:
            warnings.warn('{0} was not found'.format(filename))
    except IOError:
        warnings.warn('{0} was not found'.format(filename))

    return requirements

# Get current working directory

try:
    SETUP_DIRNAME = os.path.dirname(__file__)
except NameError:
    SETUP_DIRNAME = os.path.dirname(sys.argv[0])

# Change to current working directory

if SETUP_DIRNAME != '':
    os.chdir(SETUP_DIRNAME)

# Requirements

INSTALL_REQUIREMENTS = read_requirements('REQS.txt')
TESTING_REQUIREMENTS = read_requirements('REQS.TESTING.txt')
DEVELOP_REQUIREMENTS = read_requirements('REQS.DEVELOP.txt') \
    + TESTING_REQUIREMENTS

# Include the Change Log on PyPi

long_description = open('README.rst').read()
changelog = open('CHANGELOG.rst').read()
long_description += '\n' + changelog

# Setup

setup(
    name='Flask-Store',
    version=open('VERSION').read().strip(),
    author='SOON_',
    author_email='dorks@thisissoon.com',
    maintainer='Chris Reeves',
    maintainer_email='hello@chris.reeves.io',
    url='http://flask-store.soon.build',
    description='Provides Django-Storages like file storage backends for '
                'Flask Applications.',
    long_description=long_description,
    packages=find_packages(
        exclude=[
            'tests'
        ]),
    include_package_data=True,
    zip_safe=False,
    # Dependencies
    install_requires=INSTALL_REQUIREMENTS,
    extras_require={
        'develop': DEVELOP_REQUIREMENTS
    },
    # Testing
    tests_require=TESTING_REQUIREMENTS,
    cmdclass={
        'test': PyTest
    },
    # Dependencies not hosted on PyPi
    dependency_links=[],
    # Classifiers for Package Indexing
    # Entry points, for example Flask-Script
    entry_points={},
    # Meta
    classifiers=[
        'Framework :: Flask',
        'Environment :: Web Environment',
        'Intended Audience :: Developers',
        'License :: OSI Approved :: MIT License',
        'Development Status :: 3 - Alpha',
        'Operating System :: OS Independent',
        'Programming Language :: Python',
        'Programming Language :: Python :: 2',
        'Programming Language :: Python :: 2.7',
        'Programming Language :: Python :: 3',
        'Programming Language :: Python :: 3.5',
        'Topic :: Software Development',
        'Topic :: Software Development :: Libraries :: Python Modules',
        'Topic :: Internet :: WWW/HTTP :: Dynamic Content'],
    license='MIT',
    keywords=['Flask', 'Files', 'Storage'])


text:
<SlidesDeck src="securite_applications" />

[La synthèse du cours](/cheatsheets/owasp/)


text:
"""
Example Airflow DAG that shows how to use Google Analytics 360.
"""
from __future__ import annotations

import os
from datetime import datetime

from airflow import models
from airflow.providers.google.marketing_platform.operators.analytics import (
    GoogleAnalyticsDataImportUploadOperator,
    GoogleAnalyticsDeletePreviousDataUploadsOperator,
    GoogleAnalyticsGetAdsLinkOperator,
    GoogleAnalyticsListAccountsOperator,
    GoogleAnalyticsModifyFileHeadersDataImportOperator,
    GoogleAnalyticsRetrieveAdsLinksListOperator,
)

ENV_ID = os.environ.get("SYSTEM_TESTS_ENV_ID")
DAG_ID = "example_google_analytics"

ACCOUNT_ID = os.environ.get("GA_ACCOUNT_ID", "123456789")

BUCKET = os.environ.get("GMP_ANALYTICS_BUCKET", "test-airflow-analytics-bucket")
BUCKET_FILENAME = "data.csv"
WEB_PROPERTY_ID = os.environ.get("GA_WEB_PROPERTY", "UA-12345678-1")
WEB_PROPERTY_AD_WORDS_LINK_ID = os.environ.get("GA_WEB_PROPERTY_AD_WORDS_LINK_ID", "rQafFTPOQdmkx4U-fxUfhj")
DATA_ID = "kjdDu3_tQa6n8Q1kXFtSmg"

with models.DAG(
    DAG_ID,
    schedule='@once',  # Override to match your needs,
    start_date=datetime(2021, 1, 1),
    catchup=False,
    tags=["example", "analytics"],
) as dag:
    # [START howto_marketing_platform_list_accounts_operator]
    list_account = GoogleAnalyticsListAccountsOperator(task_id="list_account")
    # [END howto_marketing_platform_list_accounts_operator]

    # [START howto_marketing_platform_get_ads_link_operator]
    get_ad_words_link = GoogleAnalyticsGetAdsLinkOperator(
        web_property_ad_words_link_id=WEB_PROPERTY_AD_WORDS_LINK_ID,
        web_property_id=WEB_PROPERTY_ID,
        account_id=ACCOUNT_ID,
        task_id="get_ad_words_link",
    )
    # [END howto_marketing_platform_get_ads_link_operator]

    # [START howto_marketing_platform_retrieve_ads_links_list_operator]
    list_ad_words_link = GoogleAnalyticsRetrieveAdsLinksListOperator(
        task_id="list_ad_link", account_id=ACCOUNT_ID, web_property_id=WEB_PROPERTY_ID
    )
    # [END howto_marketing_platform_retrieve_ads_links_list_operator]

    upload = GoogleAnalyticsDataImportUploadOperator(
        task_id="upload",
        storage_bucket=BUCKET,
        storage_name_object=BUCKET_FILENAME,
        account_id=ACCOUNT_ID,
        web_property_id=WEB_PROPERTY_ID,
        custom_data_source_id=DATA_ID,
    )

    delete = GoogleAnalyticsDeletePreviousDataUploadsOperator(
        task_id="delete",
        account_id=ACCOUNT_ID,
        web_property_id=WEB_PROPERTY_ID,
        custom_data_source_id=DATA_ID,
    )

    transform = GoogleAnalyticsModifyFileHeadersDataImportOperator(
        task_id="transform",
        storage_bucket=BUCKET,
        storage_name_object=BUCKET_FILENAME,
    )

    upload >> [delete, transform]

from tests.system.utils import get_test_run  # noqa: E402

# Needed to run the example DAG with pytest (see: tests/system/README.md#run_via_pytest)
test_run = get_test_run(dag)


text:
package com.morihacky.android.rxjava.pagination;

import android.support.v7.widget.RecyclerView;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.morihacky.android.rxjava.R;
import com.morihacky.android.rxjava.rxbus.RxBus;
import java.util.ArrayList;
import java.util.List;

class PaginationAutoAdapter
      extends RecyclerView.Adapter<RecyclerView.ViewHolder> {

    private static final int ITEM_LOG = 0;

    private final List<String> _items = new ArrayList<>();
    private final RxBus _bus;

    PaginationAutoAdapter(RxBus bus) {
        _bus = bus;
    }

    @Override
    public RecyclerView.ViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return ItemLogViewHolder.create(parent);
    }

    @Override
    public void onBindViewHolder(RecyclerView.ViewHolder holder, int position) {
        ((ItemLogViewHolder) holder).bindContent(_items.get(position));

        boolean lastPositionReached = position == _items.size() - 1;
        if (lastPositionReached) {
            _bus.send(new PageEvent());
        }
    }

    @Override
    public int getItemViewType(int position) {
        return ITEM_LOG;
    }

    @Override
    public int getItemCount() {
        return _items.size();
    }

    void addItems(List<String> items) {
        _items.addAll(items);
    }

    private static class ItemLogViewHolder
          extends RecyclerView.ViewHolder {
        ItemLogViewHolder(View itemView) {
            super(itemView);
        }

        static ItemLogViewHolder create(ViewGroup parent) {
            return new ItemLogViewHolder(LayoutInflater.from(parent.getContext())
                                               .inflate(R.layout.item_log, parent, false));
        }

        void bindContent(String content) {
            ((TextView) itemView).setText(content);
        }
    }

    static class PageEvent { }
}


text:
package cz.metacentrum.perun.audit.events.ResourceManagerEvents;

import cz.metacentrum.perun.audit.events.AuditEvent;
import cz.metacentrum.perun.audit.events.EngineIgnoreEvent;
import cz.metacentrum.perun.core.api.Group;
import cz.metacentrum.perun.core.api.Resource;

public class AdminGroupAddedForResource extends AuditEvent implements EngineIgnoreEvent {

	private Group group;
	private Resource resource;
	private String message;

	@SuppressWarnings("unused") // used by jackson mapper
	public AdminGroupAddedForResource() {
	}

	public AdminGroupAddedForResource(Group group, Resource resource) {
		this.group = group;
		this.resource = resource;
		this.message = formatMessage("Group %s was added as admin of %s.", group, resource);
	}

	@Override
	public String getMessage() {
		return message;
	}

	public Group getGroup() {
		return group;
	}

	public Resource getResource() {
		return resource;
	}

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


text:
<?php

namespace Oro\Bundle\EntityExtendBundle\Form\Type;

use Symfony\Component\Form\Extension\Core\Type\ChoiceType as SymfonyChoiceType;
use Symfony\Component\OptionsResolver\OptionsResolver;

class AssociationChoiceType extends AbstractAssociationType
{
    /**
     * {@inheritdoc}
     */
    public function configureOptions(OptionsResolver $resolver)
    {
        parent::configureOptions($resolver);

        $resolver->setDefaults(
            [
                'placeholder' => false,
                'choices' => [
                    'No' => 0,
                    'Yes' => 1,
                ],
                'schema_update_required' => function ($newVal, $oldVal) {
                    return true == $newVal && false == $oldVal;
                },
            ]
        );
    }

    /**
     * {@inheritdoc}
     */
    public function getName()
    {
        return $this->getBlockPrefix();
    }

    /**
     * {@inheritdoc}
     */
    public function getBlockPrefix()
    {
        return 'oro_entity_extend_association_choice';
    }

    /**
     * {@inheritdoc}
     */
    public function getParent()
    {
        return SymfonyChoiceType::class;
    }
}


text:
//
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.
//
//
// Allow multiple inclusion.

    MDILHELPER(MDIL_HELP_UNDEF,  CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)

    /* Arithmetic helpers */

    MDILHELPER(MDIL_HELP_DIV,    CORINFO_HELP_SIG_8_STACK)
    MDILHELPER(MDIL_HELP_MOD,    CORINFO_HELP_SIG_8_STACK)
    MDILHELPER(MDIL_HELP_UDIV,   CORINFO_HELP_SIG_8_STACK)
    MDILHELPER(MDIL_HELP_UMOD,   CORINFO_HELP_SIG_8_STACK)

#if !defined(_WIN64)
    MDILHELPER(MDIL_HELP_LLSH,   CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_LRSH,   CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_LRSZ,   CORINFO_HELP_SIG_REG_ONLY)
#else
    MDILHELPER(MDIL_HELP_LLSH,   CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
    MDILHELPER(MDIL_HELP_LRSH,   CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
    MDILHELPER(MDIL_HELP_LRSZ,   CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
#endif
    MDILHELPER(MDIL_HELP_LMUL,         CORINFO_HELP_SIG_16_STACK)
    MDILHELPER(MDIL_HELP_LMUL_OVF,     CORINFO_HELP_SIG_16_STACK)
    MDILHELPER(MDIL_HELP_ULMUL_OVF,    CORINFO_HELP_SIG_16_STACK)
    MDILHELPER(MDIL_HELP_LDIV,         CORINFO_HELP_SIG_16_STACK)
    MDILHELPER(MDIL_HELP_LMOD,         CORINFO_HELP_SIG_16_STACK)
    MDILHELPER(MDIL_HELP_ULDIV,        CORINFO_HELP_SIG_16_STACK)
    MDILHELPER(MDIL_HELP_ULMOD,        CORINFO_HELP_SIG_16_STACK)
    MDILHELPER(MDIL_HELP_LNG2DBL,      CORINFO_HELP_SIG_8_STACK)
    MDILHELPER(MDIL_HELP_ULNG2DBL,     CORINFO_HELP_SIG_8_STACK)
    MDILHELPER(MDIL_HELP_DBL2INT,      CORINFO_HELP_SIG_8_STACK)
    MDILHELPER(MDIL_HELP_DBL2INT_OVF,  CORINFO_HELP_SIG_8_STACK)
    MDILHELPER(MDIL_HELP_DBL2LNG,      CORINFO_HELP_SIG_8_STACK)
    MDILHELPER(MDIL_HELP_DBL2LNG_OVF,  CORINFO_HELP_SIG_8_STACK)
    MDILHELPER(MDIL_HELP_DBL2UINT,     CORINFO_HELP_SIG_8_STACK)
    MDILHELPER(MDIL_HELP_DBL2UINT_OVF, CORINFO_HELP_SIG_8_STACK)
    MDILHELPER(MDIL_HELP_DBL2ULNG,     CORINFO_HELP_SIG_8_STACK)
    MDILHELPER(MDIL_HELP_DBL2ULNG_OVF, CORINFO_HELP_SIG_8_STACK)
    MDILHELPER(MDIL_HELP_FLTREM,       CORINFO_HELP_SIG_8_STACK)
    MDILHELPER(MDIL_HELP_DBLREM,       CORINFO_HELP_SIG_16_STACK)
    MDILHELPER(MDIL_HELP_FLTROUND,     CORINFO_HELP_SIG_8_STACK)
    MDILHELPER(MDIL_HELP_DBLROUND,     CORINFO_HELP_SIG_16_STACK)

#ifdef FEATURE_REMOTING
    MDILHELPER(MDIL_HELP_NEW_CROSSCONTEXT, CORINFO_HELP_SIG_REG_ONLY)
#else
    MDILHELPER(MDIL_HELP_NEW_CROSSCONTEXT, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
#endif
    MDILHELPER(MDIL_HELP_NEWFAST,          CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_NEWSFAST,         CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_NEWSFAST_ALIGN8,  CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_NEW_MDARR,        CORINFO_HELP_SIG_8_VA)

    MDILHELPER(MDIL_HELP_STRCNS,           CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_INITCLASS,        CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_INITINSTCLASS,    CORINFO_HELP_SIG_REG_ONLY)

    MDILHELPER(MDIL_HELP_ISINSTANCEOFINTERFACE,  CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_ISINSTANCEOFARRAY,      CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_ISINSTANCEOFCLASS,      CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_CHKCASTINTERFACE,       CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_CHKCASTARRAY,           CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_CHKCASTCLASS,           CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_CHKCASTCLASS_SPECIAL,   CORINFO_HELP_SIG_REG_ONLY)

    MDILHELPER(MDIL_HELP_UNBOX_NULLABLE,   CORINFO_HELP_SIG_4_STACK)
    MDILHELPER(MDIL_HELP_GETREFANY,        CORINFO_HELP_SIG_8_STACK)

    MDILHELPER(MDIL_HELP_ARRADDR_ST,       CORINFO_HELP_SIG_4_STACK)
    MDILHELPER(MDIL_HELP_LDELEMA_REF,      CORINFO_HELP_SIG_4_STACK)

    MDILHELPER(MDIL_HELP_USER_BREAKPOINT,  CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_RNGCHKFAIL,       CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_OVERFLOW,         CORINFO_HELP_SIG_REG_ONLY)

    MDILHELPER(MDIL_HELP_INTERNALTHROW,            CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_VERIFICATION,             CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_SEC_UNMGDCODE_EXCPT,      CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_FAIL_FAST,                CORINFO_HELP_SIG_REG_ONLY)

    MDILHELPER(MDIL_HELP_METHOD_ACCESS_EXCEPTION,  CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_FIELD_ACCESS_EXCEPTION,   CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_CLASS_ACCESS_EXCEPTION,   CORINFO_HELP_SIG_REG_ONLY)

    MDILHELPER(MDIL_HELP_ENDCATCH,         CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)

    MDILHELPER(MDIL_HELP_MON_ENTER,        CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_MON_EXIT,         CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_MON_ENTER_STATIC, CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_MON_EXIT_STATIC,  CORINFO_HELP_SIG_REG_ONLY)

    MDILHELPER(MDIL_HELP_GETCLASSFROMMETHODPARAM,  CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_GETSYNCFROMCLASSHANDLE,   CORINFO_HELP_SIG_REG_ONLY)

    MDILHELPER(MDIL_HELP_SECURITY_PROLOG,          CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_SECURITY_PROLOG_FRAMED,   CORINFO_HELP_SIG_REG_ONLY)

    MDILHELPER(MDIL_HELP_METHOD_ACCESS_CHECK,      CORINFO_HELP_SIG_8_STACK)
    MDILHELPER(MDIL_HELP_FIELD_ACCESS_CHECK,       CORINFO_HELP_SIG_4_STACK)
    MDILHELPER(MDIL_HELP_CLASS_ACCESS_CHECK,       CORINFO_HELP_SIG_4_STACK)

    MDILHELPER(MDIL_HELP_DELEGATE_SECURITY_CHECK,  CORINFO_HELP_SIG_REG_ONLY)

    MDILHELPER(MDIL_HELP_VERIFICATION_RUNTIME_CHECK, CORINFO_HELP_SIG_REG_ONLY)

    MDILHELPER(MDIL_HELP_STOP_FOR_GC,  CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_POLL_GC,      CORINFO_HELP_SIG_REG_ONLY)

    MDILHELPER(MDIL_HELP_STRESS_GC,    CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_CHECK_OBJ,    CORINFO_HELP_SIG_REG_ONLY)

    MDILHELPER(MDIL_HELP_ASSIGN_REF, CORINFO_HELP_SIG_NO_ALIGN_STUB)

    MDILHELPER(MDIL_HELP_CHECKED_ASSIGN_REF, CORINFO_HELP_SIG_NO_ALIGN_STUB)

    MDILHELPER(MDIL_HELP_ASSIGN_REF_ENSURE_NONHEAP, CORINFO_HELP_SIG_REG_ONLY)

    MDILHELPER(MDIL_HELP_ASSIGN_BYREF,   CORINFO_HELP_SIG_NO_ALIGN_STUB)

    MDILHELPER(MDIL_HELP_ASSIGN_STRUCT,  CORINFO_HELP_SIG_4_STACK)

    MDILHELPER(MDIL_HELP_GETFIELD8,      CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_SETFIELD8,      CORINFO_HELP_SIG_4_STACK)
    MDILHELPER(MDIL_HELP_GETFIELD16,     CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_SETFIELD16,     CORINFO_HELP_SIG_4_STACK)
    MDILHELPER(MDIL_HELP_GETFIELD32,     CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_SETFIELD32,     CORINFO_HELP_SIG_4_STACK)
    MDILHELPER(MDIL_HELP_GETFIELD64,     CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_SETFIELD64,     CORINFO_HELP_SIG_8_STACK)
    MDILHELPER(MDIL_HELP_GETFIELDOBJ,    CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_SETFIELDOBJ,    CORINFO_HELP_SIG_4_STACK)
    MDILHELPER(MDIL_HELP_GETFIELDSTRUCT, CORINFO_HELP_SIG_8_STACK)
    MDILHELPER(MDIL_HELP_SETFIELDSTRUCT, CORINFO_HELP_SIG_8_STACK)
    MDILHELPER(MDIL_HELP_GETFIELDFLOAT,  CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_SETFIELDFLOAT,  CORINFO_HELP_SIG_4_STACK)
    MDILHELPER(MDIL_HELP_GETFIELDDOUBLE, CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_SETFIELDDOUBLE, CORINFO_HELP_SIG_8_STACK)

    MDILHELPER(MDIL_HELP_GETFIELDADDR,   CORINFO_HELP_SIG_REG_ONLY)

#ifdef FEATURE_REMOTING
    MDILHELPER(MDIL_HELP_GETSTATICFIELDADDR_CONTEXT, CORINFO_HELP_SIG_REG_ONLY)
#else
    MDILHELPER(MDIL_HELP_GETSTATICFIELDADDR_CONTEXT, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
#endif
    // TLS
#ifdef FEATURE_MIXEDMODE
    MDILHELPER(MDIL_HELP_GETSTATICFIELDADDR_TLS, CORINFO_HELP_SIG_REG_ONLY)
#else // FEATURE_MIXEDMODE
    MDILHELPER(MDIL_HELP_GETSTATICFIELDADDR_TLS, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
#endif // FEATURE_MIXEDMODE

    MDILHELPER(MDIL_HELP_DBG_IS_JUST_MY_CODE, CORINFO_HELP_SIG_REG_ONLY)

    MDILHELPER(MDIL_HELP_PROF_FCN_ENTER,     CORINFO_HELP_SIG_4_STACK)
    MDILHELPER(MDIL_HELP_PROF_FCN_LEAVE,     CORINFO_HELP_SIG_4_STACK)
    MDILHELPER(MDIL_HELP_PROF_FCN_TAILCALL,  CORINFO_HELP_SIG_4_STACK)

    MDILHELPER(MDIL_HELP_BBT_FCN_ENTER, CORINFO_HELP_SIG_REG_ONLY)

    MDILHELPER(MDIL_HELP_PINVOKE_CALLI, CORINFO_HELP_SIG_NO_ALIGN_STUB)
    MDILHELPER(MDIL_HELP_TAILCALL,      CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
    MDILHELPER(MDIL_HELP_GETCURRENTMANAGEDTHREADID, CORINFO_HELP_SIG_REG_ONLY)

#ifdef _WIN64
    MDILHELPER(MDIL_HELP_INIT_PINVOKE_FRAME,   CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_CHECK_PINVOKE_DOMAIN, CORINFO_HELP_SIG_UNDEF)
#else
    MDILHELPER(MDIL_HELP_INIT_PINVOKE_FRAME,   CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_CHECK_PINVOKE_DOMAIN, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
#endif

#ifdef _TARGET_X86_
    MDILHELPER(MDIL_HELP_MEMSET, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
    MDILHELPER(MDIL_HELP_MEMCPY, CORINFO_HELP_SIG_CANNOT_USE_ALIGN_STUB)
#else
    MDILHELPER(MDIL_HELP_MEMSET, CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_MEMCPY, CORINFO_HELP_SIG_REG_ONLY)
#endif

    MDILHELPER(MDIL_HELP_RUNTIMEHANDLE_METHOD,               CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_RUNTIMEHANDLE_METHOD_LOG,           CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_RUNTIMEHANDLE_CLASS,                CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_RUNTIMEHANDLE_CLASS_LOG,            CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_TYPEHANDLE_TO_RUNTIMETYPEHANDLE,    CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_METHODDESC_TO_RUNTIMEMETHODHANDLE,  CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_FIELDDESC_TO_RUNTIMEFIELDHANDLE,    CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_TYPEHANDLE_TO_RUNTIMETYPE,          CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_METHODDESC_TO_STUBRUNTIMEMETHOD,    CORINFO_HELP_SIG_REG_ONLY)
    MDILHELPER(MDIL_HELP_FIELDDESC_TO_STUBRUNTIMEFIELD,      CORINFO_HELP_SIG_REG_ONLY)

    MDILHELPER(MDIL_HELP_VIRTUAL_FUNC_PTR, CORINFO_HELP_SIG_4_STACK)

    MDILHELPER(MDIL_HELP_EE_PRESTUB,       CORINFO_HELP_SIG_NO_ALIGN_STUB)

#if defined(_TARGET_X86_) || defined(_TARGET_AMD64_) || defined(_TARGET_ARM_)
    MDILHELPER(MDIL_HELP_EE_PRECODE_FIXUP, CORINFO_HELP_SIG_NO_ALIGN_STUB )
#else
    MDILHELPER(MDIL_HELP_EE_PRECODE_FIXUP, CORINFO_HELP_SIG_NO_ALIGN_STUB)
#endif

    MDILHELPER(MDIL_HELP_EE_PINVOKE_FIXUP, CORINFO_HELP_SIG_NO_ALIGN_STUB)

    MDILHELPER(MDIL_HELP_EE_VSD_FIXUP,      CORINFO_HELP_SIG_NO_ALIGN_STUB)
    MDILHELPER(MDIL_HELP_EE_EXTERNAL_FIXUP, CORINFO_HELP_SIG_NO_ALIGN_STUB)
    MDILHELPER(MDIL_HELP_EE_VTABLE_FIXUP,   CORINFO_HELP_SIG_NO_ALIGN_STUB)

#if (defined(_TARGET_X86_) || defined(_TARGET_ARM_)) && defined(FEATURE_REMOTING)
    MDILHELPER(MDIL_HELP_EE_REMOTING_THUNK, CORINFO_HELP_SIG_UNDEF)
#else
    MDILHELPER(MDIL_HELP_EE_REMOTING_THUNK, CORINFO_HELP_SIG_UNDEF)
#endif

    MDILHELPER(MDIL_HELP_EE_PERSONALITY_ROUTINE, CORINFO_HELP_SIG_UNDEF)

#if defined(_TARGET_X86_) || defined(_HOST_X86_) || defined(REDHAWK)
    MDILHELPER(MDIL_HELP_ASSIGN_REF_EAX, CORINFO_HELP_SIG_NO_ALIGN_STUB)
    MDILHELPER(MDIL_HELP_ASSIGN_REF_EBX, CORINFO_HELP_SIG_NO_ALIGN_STUB)
    MDILHELPER(MDIL_HELP_ASSIGN_REF_ECX, CORINFO_HELP_SIG_NO_ALIGN_STUB)
    MDILHELPER(MDIL_HELP_ASSIGN_REF_ESI, CORINFO_HELP_SIG_NO_ALIGN_STUB)
    MDILHELPER(MDIL_HELP_ASSIGN_REF_EDI, CORINFO_HELP_SIG_NO_ALIGN_STUB)
    MDILHELPER(MDIL_HELP_ASSIGN_REF_EBP, CORINFO_HELP_SIG_NO_ALIGN_STUB)

    MDILHELPER(MDIL_HELP_CHECKED_ASSIGN_REF_EAX, CORINFO_HELP_SIG_NO_ALIGN_STUB)
    MDILHELPER(MDIL_HELP_CHECKED_ASSIGN_REF_EBX, CORINFO_HELP_SIG_NO_ALIGN_STUB)
    MDILHELPER(MDIL_HELP_CHECKED_ASSIGN_REF_ECX, CORINFO_HELP_SIG_NO_ALIGN_STUB)
    MDILHELPER(MDIL_HELP_CHECKED_ASSIGN_REF_ESI, CORINFO_HELP_SIG_NO_ALIGN_STUB)
    MDILHELPER(MDIL_HELP_CHECKED_ASSIGN_REF_EDI, CORINFO_HELP_SIG_NO_ALIGN_STUB)
    MDILHELPER(MDIL_HELP_CHECKED_ASSIGN_REF_EBP, CORINFO_HELP_SIG_NO_ALIGN_STUB)
#endif

#if defined(_TARGET_ARM_)
    MDILHELPER(MDIL_HELP_ALLOCA, CORINFO_HELP_SIG_UNDEF)
#endif // _TARGET_ARM_
#if !defined(_TARGET_X86_)
    MDILHELPER(MDIL_HELP_EE_PERSONALITY_ROUTINE_FILTER_FUNCLET,CORINFO_HELP_SIG_UNDEF)
#endif

#ifdef REDHAWK
     // we don't have any "signature" definitions for REDHAWK specific helpers;
     // they are not based on CLR's corinfo.h
#error Need "signatures" for REDHAWK specific helpers
#endif // REDHAWK


text:
' Licensed to the .NET Foundation under one or more agreements.
' The .NET Foundation licenses this file to you under the MIT license.
' See the LICENSE file in the project root for more information.

Imports Microsoft.CodeAnalysis.VisualBasic.KeywordHighlighting

Namespace Microsoft.CodeAnalysis.Editor.VisualBasic.UnitTests.KeywordHighlighting
    <Trait(Traits.Feature, Traits.Features.KeywordHighlighting)>
    Public Class XmlCDataHighlighterTests
        Inherits AbstractVisualBasicKeywordHighlighterTests

        Friend Overrides Function GetHighlighterType() As Type
            Return GetType(XmlCDataHighlighter)
        End Function

        <Fact>
        Public Async Function TestXmlLiteralSample6_1() As Task
            Await TestAsync(<Text><![CDATA[
Class C
Sub M()
Dim q = <?xml version="1.0"?>
<contact>
    <!-- who is this guy? -->
    <name>Bill Chiles</name>
    <phone type="home">555-555-5555</phone>
    <birthyear><%= DateTime.Today.Year - 100 %></birthyear>
    {|Cursor:[|<![CDATA[|]|}Be wary of this guy![|]]>]]<![CDATA[>|]
</contact>
End Sub
End Class]]></Text>)
        End Function

        <Fact>
        Public Async Function TestXmlLiteralSample6_2() As Task
            Await TestAsync(<Text><![CDATA[
Class C
Sub M()
Dim q = <?xml version="1.0"?>
<contact>
    <!-- who is this guy? -->
    <name>Bill Chiles</name>
    <phone type="home">555-555-5555</phone>
    <birthyear><%= DateTime.Today.Year - 100 %></birthyear>
    [|<![CDATA[|]Be wary of this guy!{|Cursor:[|]]>]]<![CDATA[>|]|}
</contact>
End Sub
End Class]]></Text>)
        End Function

        <Fact>
        Public Async Function TestXmlLiteralSample6_3() As Task
            Await TestAsync(<Text><![CDATA[
Class C
Sub M()
Dim q = <?xml version="1.0"?>
<contact>
    <!-- who is this guy? -->
    <name>Bill Chiles</name>
    <phone type="home">555-555-5555</phone>
    <birthyear><%= DateTime.Today.Year - 100 %></birthyear>
    <![CDATA[B{|Cursor:e wary of this guy|}!]]>]]<![CDATA[>
</contact>
End Sub
End Class]]></Text>)
        End Function
    End Class
End Namespace


text:
<vector xmlns:android="http://schemas.android.com/apk/res/android"
        android:width="100dp"
        android:height="100dp"
        android:viewportWidth="100.0"
        android:viewportHeight="100.0">
    <path
        android:fillColor="#FFFF9900"
        android:strokeColor="@color/white"
        android:strokeWidth="10"
        android:pathData="M27,25 L75,25 L50,75 z"/>
</vector>


text:
<!DOCTYPE html>

    <meta charset="utf-8">
    <title>JSDoc: Source: graphnode.js</title>

    <link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css">
    <link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css">

Source: graphnode.js

//Matthew Shotton, R&D User Experience,© BBC 2015
class GraphNode {
    /**
    * Base class from which all processing and source nodes are derrived.
    */
    constructor(gl, renderGraph, inputNames, limitConnections=false){
        this._renderGraph = renderGraph;
        this._limitConnections = limitConnections;
        this._inputNames = inputNames;
        this._destroyed = false;

        //Setup WebGL output texture
        this._gl = gl;
        this._renderGraph = renderGraph;
        this._rendered =false;
        this._displayName = "GraphNode";
    }

    /**
    * Get a string representation of the class name.
    *
    * @return String A string of the class name.
    */
    get displayName(){
        return this._displayName;
    }

    /**
    * Get the names of the inputs to this node.
    *
    * @return {String[]} An array of the names of the inputs ot the node.
    */
    get inputNames(){
        return this._inputNames.slice();
    }

    /**
    * The maximum number of connections that can be made to this node. If there is not limit this will return Infinity.
    *
    * @return {number} The number of connections which can be made to this node.
    */
    get maximumConnections(){
        if (this._limitConnections ===false) return Infinity;
        return this._inputNames.length;
    }

    /**
    * Get an array of all the nodes which connect to this node.
    *
    * @return {GraphNode[]} An array of nodes which connect to this node.
    */
    get inputs(){
        let result = this._renderGraph.getInputsForNode(this);
        result = result.filter(function(n){return n !== undefined;});
        return result;
    }

    /**
    * Get an array of all the nodes which this node outputs to.
    *
    * @return {GraphNode[]} An array of nodes which this node connects to.
    */
    get outputs(){
        return this._renderGraph.getOutputsForNode(this);
    }

    /**
    * Get whether the node has been destroyed or not.
    *
    * @return {boolean} A true/false value of whather the node has been destoryed or not.
    */
    get destroyed(){
        return this._destroyed;
    }

    /**
    * Connect this node to the targetNode
    *
    * @param {GraphNode} targetNode - the node to connect.
    * @param {(number| String)} [targetPort] - the port on the targetNode to connect to, this can be an index, a string identifier, or undefined (in which case the next available port will be connected to).
    *
    */
    connect(targetNode, targetPort){
        return (this._renderGraph.registerConnection(this, targetNode, targetPort));
    }

    /**
    * Disconnect this node from the targetNode. If targetNode is undefind remove all out-bound connections.
    *
    * @param {GraphNode} [targetNode] - the node to disconnect from. If undefined, disconnect from all nodes.
    *
    */
    disconnect(targetNode){
        if (targetNode === undefined){
            let toRemove = this._renderGraph.getOutputsForNode(this);
            toRemove.forEach((target) => this._renderGraph.unregisterConnection(this, target));
            if (toRemove.length > 0) return true;
            return false;
        }
        return this._renderGraph.unregisterConnection(this, targetNode);
    }

    /**
    * Destory this node, removing it from the graph.
    */
    destroy(){
        this.disconnect();
        for (let input of this.inputs){
            input.disconnect(this);
        }
        this._destroyed = true;
    }
}

export default GraphNode;

Home

Modules

VideoContext

Classes

CanvasNode

CompositingNode

DestinationNode

EffectNode

GraphNode

ImageNode

VideoContext

ProcessingNode

RenderGraph

SourceNode

TransitionNode

VideoNode

    Documentation generated by JSDoc 3.4.3


text:
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent">

    <LinearLayout
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_below="@+id/checkedTextView1"
        android:layout_marginTop="99dp" >

        <Button
            android:id="@+id/positive_button"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_margin="2dip"
            android:layout_weight="1"
            android:text="exit" />

        <Button
            android:id="@+id/negative_button"
            android:layout_width="0dip"
            android:layout_height="wrap_content"
            android:layout_margin="2dip"
            android:layout_weight="1"
            android:text="cancel" />
    </LinearLayout>

    <CheckedTextView
        android:id="@+id/checkedTextView1"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:layout_alignParentTop="true"
        android:layout_centerHorizontal="true"
        android:layout_margin="10dip"
        android:layout_marginTop="117dp"
        android:text="Exit Application?" />

    <TextView
        android:id="@+id/disp_message"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentLeft="true"
        android:layout_alignParentRight="true"
        android:layout_margin="10dip"
        android:layout_below="@+id/checkedTextView1"
        android:layout_marginTop="44dp"
        android:text="Message" />

</RelativeLayout>


text:
package manifest_test

import (
	"context"
	"errors"
	"fmt"
	"os"
	"path/filepath"
	"strings"
	"testing"

	configlogging "github.com/google/kf/v2/pkg/kf/commands/config/logging"
	"github.com/google/kf/v2/pkg/kf/manifest"
	"github.com/google/kf/v2/pkg/kf/testutil"
	"knative.dev/pkg/ptr"
)

func TestNewFromReader(t *testing.T) {
	relativePathRoot := filepath.Dir(filepath.FromSlash("some/manifest/dir/manifest.yaml"))

	cases := map[string]struct {
		fileContent string
		expected    *manifest.Manifest
		expectErr   error
	}{
		"app name": {
			fileContent: `---
applications:
- name: MY-APP
`,
			expected: &manifest.Manifest{
				RelativePathRoot: relativePathRoot,

				Applications: []manifest.Application{
					{
						Name: "MY-APP",
					},
				},
			},
		},
		"buildpacks": {
			fileContent: `---
applications:
- name: MY-APP
  stack: cflinuxfs3
  buildpacks:
  - java
  - node
`,
			expected: &manifest.Manifest{
				RelativePathRoot: relativePathRoot,

				Applications: []manifest.Application{
					{
						Name:       "MY-APP",
						Stack:      "cflinuxfs3",
						Buildpacks: []string{"java", "node"},
					},
				},
			},
		},
		"routes": {
			fileContent: `---
applications:
- name: MY-APP
  routes:
  - route: some-route.domain.com
  - route: "*.another-route.domain.com"
  - route: app-port.domain.com
    appPort: 9999
`,
			expected: &manifest.Manifest{
				RelativePathRoot: relativePathRoot,

				Applications: []manifest.Application{
					{
						Name: "MY-APP",
						Routes: []manifest.Route{
							{
								Route: "some-route.domain.com",
							},
							{
								Route: "*.another-route.domain.com",
							},
							{
								Route:   "app-port.domain.com",
								AppPort: 9999,
							},
						},
					},
				},
			},
		},
		"legacy-buildpack": {
			fileContent: `---
applications:
- name: MY-APP
  stack: cflinuxfs3
  buildpack: java
`,
			expected: &manifest.Manifest{
				RelativePathRoot: relativePathRoot,

				Applications: []manifest.Application{
					{
						Name:            "MY-APP",
						Stack:           "cflinuxfs3",
						LegacyBuildpack: "java",
					},
				},
			},
		},
		"docker": {
			fileContent: `---
applications:
- name: MY-APP
  docker:
    image: "gcr.io/my-image"
`,
			expected: &manifest.Manifest{
				RelativePathRoot: relativePathRoot,

				Applications: []manifest.Application{
					{
						Name: "MY-APP",
						Docker: manifest.AppDockerImage{
							Image: "gcr.io/my-image",
						},
					},
				},
			},
		},
		"cf style command": {
			fileContent: `---
applications:
- name: CUSTOM_START
  command: rake run $VAR
`,
			expected: &manifest.Manifest{
				RelativePathRoot: relativePathRoot,

				Applications: []manifest.Application{
					{
						Name:    "CUSTOM_START",
						Command: "rake run $VAR",
					},
				},
			},
		},
		"docker style command": {
			fileContent: `---
applications:
- name: CUSTOM_START
  entrypoint: python
  args: ["-m", "SimpleHTTPServer"]
`,
			expected: &manifest.Manifest{
				RelativePathRoot: relativePathRoot,

				Applications: []manifest.Application{
					{
						Name: "CUSTOM_START",
						KfApplicationExtension: manifest.KfApplicationExtension{
							Entrypoint: "python",
							Args:       []string{"-m", "SimpleHTTPServer"},
						},
					},
				},
			},
		},
		"dockerfile": {
			fileContent: `---
applications:
- name: MY-APP
  dockerfile:
    path: "foo/Dockerfile"
`,
			expected: &manifest.Manifest{
				RelativePathRoot: relativePathRoot,

				Applications: []manifest.Application{
					{
						Name: "MY-APP",
						KfApplicationExtension: manifest.KfApplicationExtension{
							Dockerfile: manifest.Dockerfile{
								Path: "foo/Dockerfile",
							},
						},
					},
				},
			},
		},
		"malformed": {
			fileContent: `---
applications:
  dockerfile:
    path: "foo/Dockerfile"
`,
			expected:  nil,
			expectErr: errors.New("manifest appears invalid: error unmarshaling JSON: while decoding JSON: json: cannot unmarshal object into Go struct field Manifest.applications of type []manifest.Application"),
		},
		"extra properties parse correctly": {
			fileContent: `---
applications:
- name: MY-APP
  extraproperty: 42
`,
			expected: &manifest.Manifest{
				RelativePathRoot: relativePathRoot,
				Applications: []manifest.Application{
					{
						Name: "MY-APP",
					},
				},
			},
		},
		"resources": {
			fileContent: `---
applications:
- name: MY-APP
  memory: 4G
  cpu: 1000m
  disk_quota: 1G
  cpu-limit: 2000m
`,
			expected: &manifest.Manifest{
				RelativePathRoot: relativePathRoot,
				Applications: []manifest.Application{
					{
						Name:      "MY-APP",
						DiskQuota: "1G",
						Memory:    "4G",
						KfApplicationExtension: manifest.KfApplicationExtension{
							CPU:      "1000m",
							CPULimit: "2000m",
						},
					},
				},
			},
		},
	}

	for tn, tc := range cases {
		t.Run(tn, func(t *testing.T) {
			actual, err := manifest.NewFromReader(context.Background(), strings.NewReader(tc.fileContent), relativePathRoot, nil)
			testutil.AssertErrorsEqual(t, tc.expectErr, err)
			testutil.AssertEqual(t, "manifest", tc.expected, actual)
		})
	}
}

func TestCheckForManifest(t *testing.T) {
	pwd, err := os.Getwd()
	if err != nil {
		t.Fatal(err)
	}

	cases := map[string]struct {
		path     string
		expected *manifest.Manifest
	}{
		"yml": {
			path: "testdata/manifest-dir",
			expected: &manifest.Manifest{
				RelativePathRoot: filepath.Join(pwd, filepath.FromSlash("testdata/manifest-dir")),
				Applications: []manifest.Application{
					{
						Name: "MY-APP",
					},
				},
			},
		},
		"yaml": {
			path: "testdata/manifest-dir-2",
			expected: &manifest.Manifest{
				RelativePathRoot: filepath.Join(pwd, filepath.FromSlash("testdata/manifest-dir-2")),
				Applications: []manifest.Application{
					{
						Name: "MY-APP",
					},
				},
			},
		},
	}

	for tn, tc := range cases {
		t.Run(tn, func(t *testing.T) {
			cwd, err := os.Getwd()
			testutil.AssertNil(t, "error", err)
			testutil.AssertNil(t, "chdir", os.Chdir(tc.path))
			actual, err := manifest.CheckForManifest(context.Background(), nil)
			testutil.AssertNil(t, "chdir", os.Chdir(cwd))
			testutil.AssertNil(t, "error", err)
			testutil.AssertEqual(t, "manifest", tc.expected, actual)
		})
	}
}

func TestOverride(t *testing.T) {
	cases := map[string]struct {
		base     manifest.Application
		override manifest.Application
		expected manifest.Application
	}{
		"blank": {},
		"basic fields, blank override": {
			base:     manifest.Application{Name: "hello"},
			override: manifest.Application{},
			expected: manifest.Application{Name: "hello"},
		},
		"nested field, blank override": {
			base:     manifest.Application{Docker: manifest.AppDockerImage{Image: "hello"}},
			override: manifest.Application{},
			expected: manifest.Application{Docker: manifest.AppDockerImage{Image: "hello"}},
		},
		"basic fields override": {
			base:     manifest.Application{Name: "hello"},
			override: manifest.Application{Name: "override"},
			expected: manifest.Application{Name: "override"},
		},
		"nested field override": {
			base:     manifest.Application{Docker: manifest.AppDockerImage{Image: "hello"}},
			override: manifest.Application{Docker: manifest.AppDockerImage{Image: "override"}},
			expected: manifest.Application{Docker: manifest.AppDockerImage{Image: "override"}},
		},
		"envs get merged": {
			base:     manifest.Application{Env: map[string]string{"base": "base"}},
			override: manifest.Application{Env: map[string]string{"override": "override"}},
			expected: manifest.Application{Env: map[string]string{"base": "base", "override": "override"}},
		},
		"override env priority": {
			base:     manifest.Application{Env: map[string]string{"base": "base"}},
			override: manifest.Application{Env: map[string]string{"override": "override", "base": "override"}},
			expected: manifest.Application{Env: map[string]string{"base": "override", "override": "override"}},
		},
		"buildpacks are strict override": {
			base:     manifest.Application{Buildpacks: []string{"java", "maven"}},
			override: manifest.Application{Buildpacks: []string{"node", "npm"}},
			expected: manifest.Application{Buildpacks: []string{"node", "npm"}},
		},
		"no start, no override": {
			base:     manifest.Application{KfApplicationExtension: manifest.KfApplicationExtension{NoStart: ptr.Bool(true)}},
			override: manifest.Application{},
			expected: manifest.Application{KfApplicationExtension: manifest.KfApplicationExtension{NoStart: ptr.Bool(true)}},
		},
		"no start, override": {
			base:     manifest.Application{KfApplicationExtension: manifest.KfApplicationExtension{NoStart: ptr.Bool(false)}},
			override: manifest.Application{KfApplicationExtension: manifest.KfApplicationExtension{NoStart: ptr.Bool(true)}},
			expected: manifest.Application{KfApplicationExtension: manifest.KfApplicationExtension{NoStart: ptr.Bool(true)}},
		},
	}

	for tn, tc := range cases {
		t.Run(tn, func(t *testing.T) {
			base := &tc.base
			err := base.Override(&tc.override)
			testutil.AssertNil(t, "override err", err)
			testutil.AssertEqual(t, "override", &tc.expected, base)
		})
	}
}

func ExampleApplication_Buildpack() {
	app := manifest.Application{}
	app.LegacyBuildpack = "hidden-legacy-buildpack"
	fmt.Println("Legacy:", app.Buildpack())

	app.Buildpacks = []string{"java"}
	fmt.Println("One:", app.Buildpack())

	app.Buildpacks = []string{"maven", "java"}
	fmt.Println("Two:", app.Buildpack())

	// Output: Legacy: hidden-legacy-buildpack
	// One: java
	// Two: maven,java
}

func ExampleApplication_BuildpacksSlice() {
	app := manifest.Application{}
	app.LegacyBuildpack = "hidden-legacy-buildpack"
	fmt.Println("Legacy:", app.BuildpacksSlice())

	app.Buildpacks = []string{"java"}
	fmt.Println("One:", app.BuildpacksSlice())

	app.Buildpacks = []string{"maven", "java"}
	fmt.Println("Two:", app.BuildpacksSlice())

	// Output: Legacy: [hidden-legacy-buildpack]
	// One: [java]
	// Two: [maven java]
}

func ExampleApplication_CommandArgs() {
	app := manifest.Application{}
	fmt.Printf("Blank: %v\n", app.CommandArgs())

	app = manifest.Application{
		Command: "start.sh && exit 1",
	}
	fmt.Printf("Command: %v\n", app.CommandArgs())

	app = manifest.Application{
		KfApplicationExtension: manifest.KfApplicationExtension{
			Args: []string{"-m", "SimpleHTTPServer"},
		},
	}
	fmt.Printf("Args: %v\n", app.CommandArgs())

	// Output: Blank: []
	// Command: [start.sh && exit 1]
	// Args: [-m SimpleHTTPServer]
}

func ExampleApplication_CommandEntrypoint() {
	app := manifest.Application{}
	fmt.Printf("Blank: %v\n", app.CommandEntrypoint())

	app = manifest.Application{
		KfApplicationExtension: manifest.KfApplicationExtension{
			Entrypoint: "python",
		},
	}
	fmt.Printf("Entrypoint: %v\n", app.CommandEntrypoint())

	// Output: Blank: []
	// Entrypoint: [python]
}

func ExampleApplication_WriteWarnings() {
	app := manifest.Application{
		Name: "hello_world",
		KfApplicationExtension: manifest.KfApplicationExtension{
			NoStart: ptr.Bool(false),
			Ports: manifest.AppPortList{
				{Port: 8080, Protocol: "tcp"},
			},
		},
	}

	app.WriteWarnings(configlogging.SetupLogger(context.Background(), os.Stdout))

	// Output:
	// WARN The field(s) [no-start ports] are Kf-specific manifest extensions and may change.
	// WARN Kf supports TCP ports but currently only HTTP Routes. TCP ports can be reached on the App's cluster-internal app-<name>.<space>.svc.cluster.local address.
	// WARN Underscores ('_') in names are not allowed in Kubernetes. Replacing with hyphens ('-')...
}

func TestApp(t *testing.T) {
	cases := map[string]struct {
		applications  []manifest.Application
		appName       string
		expected      *manifest.Application
		expectedError bool
	}{
		"happy path; single App": {
			applications: []manifest.Application{
				{Name: "random"},
			},
			appName:       "abc",
			expected:      &manifest.Application{Name: "abc"},
			expectedError: false,
		},
		"empty name; single App": {
			applications: []manifest.Application{
				{Name: "random"},
			},
			appName:       "",
			expected:      &manifest.Application{Name: "random"},
			expectedError: false,
		},
		"Multiple Apps": {
			applications: []manifest.Application{
				{Name: "random"},
				{Name: "random1"},
			},
			appName:       "",
			expected:      nil,
			expectedError: true,
		},
	}
	for tn, tc := range cases {
		t.Run(tn, func(t *testing.T) {
			m := manifest.Manifest{
				Applications: tc.applications,
			}
			actual, err := m.App(tc.appName)
			testutil.AssertEqual(t, "App", tc.expected, actual)
			if tc.expectedError {
				testutil.AssertNotNil(t, "App", err)
			}
		})
	}
}


text:
'use strict'

const mongoose = require('mongoose')
const Schema = mongoose.Schema
const bcrypt = require('bcrypt-nodejs')
const crypto = require('crypto')

const UserSchema = new Schema({
  email: {
    type: String,
    unique: true,
    lowercase: true,
    require: true
  },
  displayName: {
    type: String,
    require: true
  },
  avatar: {
    type: String,
    require: false
  },
  password: {
    type: String,
    select: true,
    require: true
  },
  signupDate: {
    type: Date,
    default: Date.now()
  },
  lastLogin: {
    type: Date
  }
})

UserSchema.pre('save', function (next) {
  let user = this
  if (!user.isModified('password')) return next()

  bcrypt.genSalt(10, (err, salt) => {
    if (err) return next(err)

    bcrypt.hash(user.password, salt, null, (err, hash) => {
      if (err) return next(err)

      user.password = hash
      next()
    })
  })
})

UserSchema.methods.comparePassword = (candidatePassword, cb) => {
  bcrypt.compare(candidatePassword.compare, candidatePassword.base, (err, isMatch) => {
    if (err) return err
    cb(null, isMatch)
  })
}

UserSchema.methods.gravatar = function () {
  if (!this.email) return `https://gravatar.com/avatar/?s=200&d=retro`

  const md5 = crypto.createHash('md5').update(this.email).digest('hex')
  return `https://gravatar.com/avatar/${md5}?s=200&d=retro`
}

module.exports = mongoose.model('User', UserSchema)


text:
package net.bytebuddy.asm;

import org.objectweb.asm.ClassVisitor;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * A class visitor wrapper is used in order to register an intermediate ASM {@link org.objectweb.asm.ClassVisitor} which
 * is applied to the main type created by a {@link net.bytebuddy.dynamic.DynamicType.Builder} but not
 * to any {@link net.bytebuddy.implementation.auxiliary.AuxiliaryType}s, if any.
 */
public interface ClassVisitorWrapper {

    /**
     * Applies a {@code ClassVisitorWrapper} to the creation of a {@link net.bytebuddy.dynamic.DynamicType}.
     *
     * @param classVisitor A {@code ClassVisitor} to become the new primary class visitor to which the created
     *                     {@link net.bytebuddy.dynamic.DynamicType} is written to.
     * @return A new {@code ClassVisitor} that usually delegates to the {@code ClassVisitor} delivered in the argument.
     */
    ClassVisitor wrap(ClassVisitor classVisitor);

    /**
     * An ordered, immutable chain of {@link net.bytebuddy.asm.ClassVisitorWrapper}s.
     */
    class Chain implements ClassVisitorWrapper {

        /**
         * The class visitor wrappers that are represented by this chain in their order. This list must not be mutated.
         */
        private final List<ClassVisitorWrapper> classVisitorWrappers;

        /**
         * Creates an immutable empty chain.
         */
        public Chain() {
            this.classVisitorWrappers = Collections.emptyList();
        }

        /**
         * Creates a new immutable chain based on an existing list of {@link net.bytebuddy.asm.ClassVisitorWrapper}s
         * where no copy of the received list is made.
         *
         * @param classVisitorWrappers A list of {@link net.bytebuddy.asm.ClassVisitorWrapper}s where elements
         *                             at the beginning of the list are applied first, i.e. will be at the bottom of the generated
         *                             {@link org.objectweb.asm.ClassVisitor}.
         */
        protected Chain(List<ClassVisitorWrapper> classVisitorWrappers) {
            this.classVisitorWrappers = classVisitorWrappers;
        }

        /**
         * Adds a {@code ClassVisitorWrapper} to the beginning of the chain such that the wrapped
         * ASM {@code ClassVisitor} will be applied before the other class visitors.
         *
         * @param classVisitorWrapper The {@code ClassVisitorWrapper} to add to the beginning of the chain.
         * @return A new chain incorporating the {@code ClassVisitorWrapper}.
         */
        public Chain prepend(ClassVisitorWrapper classVisitorWrapper) {
            List<ClassVisitorWrapper> appendedList = new ArrayList<ClassVisitorWrapper>(classVisitorWrappers.size() + 1);
            appendedList.add(classVisitorWrapper);
            appendedList.addAll(classVisitorWrappers);
            return new Chain(appendedList);
        }

        /**
         * Adds a {@code ClassVisitorWrapper} to the end of the chain such that the wrapped
         * ASM {@code ClassVisitor} will be applied after the other class visitors.
         *
         * @param classVisitorWrapper The {@code ClassVisitorWrapper} to add to the end of the chain.
         * @return A new chain incorporating the {@code ClassVisitorWrapper}.
         */
        public Chain append(ClassVisitorWrapper classVisitorWrapper) {
            List<ClassVisitorWrapper> appendedList = new ArrayList<ClassVisitorWrapper>(classVisitorWrappers.size() + 1);
            appendedList.addAll(classVisitorWrappers);
            appendedList.add(classVisitorWrapper);
            return new Chain(appendedList);
        }

        @Override
        public ClassVisitor wrap(ClassVisitor classVisitor) {
            for (ClassVisitorWrapper classVisitorWrapper : classVisitorWrappers) {
                classVisitor = classVisitorWrapper.wrap(classVisitor);
            }
            return classVisitor;
        }

        @Override
        public boolean equals(Object other) {
            return this == other || !(other == null || getClass() != other.getClass())
                    && classVisitorWrappers.equals(((Chain) other).classVisitorWrappers);
        }

        @Override
        public int hashCode() {
            return classVisitorWrappers.hashCode();
        }

        @Override
        public String toString() {
            return "ClassVisitorWrapper.Chain{classVisitorWrappers=" + classVisitorWrappers + '}';
        }
    }
}


text:
int luaopen_socket_core(lua_State *L);

#ifdef _WIN32
__declspec(dllexport) int luaopen_luasocket(lua_State *L)
#else
int luaopen_luasocket(lua_State *L)
#endif
{
	shimInitialize(L);
	luaL_requiref(L, "socket", luaopen_socket_core, 1);
	lua_pop(L, 1);
	return 0;
}


text:
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
         xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
    <modelVersion>4.0.0</modelVersion>
    <groupId>io.korhner</groupId>
    <artifactId>asciimg</artifactId>
    <version>1.00-SNAPSHOT</version>
    <packaging>jar</packaging>

    <build>
        <plugins>
            <plugin>
                <groupId>org.apache.maven.plugins</groupId>
                <artifactId>maven-compiler-plugin</artifactId>
                <version>2.5.1</version>
                <configuration>
                    <source>1.8</source>
                    <target>1.8</target>
                </configuration>
            </plugin>
        </plugins>
    </build>
</project>


text:
package kieker.test.tools.manual;

import java.io.File;
import java.io.IOException;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import kieker.analysis.AnalysisController;
import kieker.analysis.IAnalysisController;
import kieker.analysis.analysisComponent.AbstractAnalysisComponent;
import kieker.analysis.exception.AnalysisConfigurationException;
import kieker.analysis.plugin.filter.flow.EventRecordTraceReconstructionFilter;
import kieker.analysis.plugin.filter.forward.CountingFilter;
import kieker.analysis.plugin.filter.forward.StringBufferFilter;
import kieker.analysis.plugin.filter.forward.TeeFilter;
import kieker.analysis.plugin.filter.select.TimestampFilter;
import kieker.analysis.plugin.filter.select.TraceIdFilter;
import kieker.analysis.plugin.filter.select.TypeFilter;
import kieker.analysis.plugin.reader.filesystem.FSReader;
import kieker.common.configuration.Configuration;
import kieker.tools.trace.analysis.filter.AbstractMessageTraceProcessingFilter;
import kieker.tools.trace.analysis.filter.AbstractTraceAnalysisFilter;
import kieker.tools.trace.analysis.filter.IGraphOutputtingFilter;
import kieker.tools.trace.analysis.filter.flow.TraceEventRecords2ExecutionAndMessageTraceFilter;
import kieker.tools.trace.analysis.filter.systemModel.SystemModel2FileFilter;
import kieker.tools.trace.analysis.filter.visualization.GraphWriterPlugin;
import kieker.tools.trace.analysis.filter.visualization.dependencyGraph.ComponentDependencyGraphAllocationFilter;
import kieker.tools.trace.analysis.filter.visualization.dependencyGraph.OperationDependencyGraphAllocationFilter;
import kieker.tools.trace.analysis.filter.visualization.sequenceDiagram.SequenceDiagramFilter;
import kieker.tools.trace.analysis.systemModel.repository.SystemModelRepository;

/**
 * @author Jan Waller
 *
 * @since 1.5
 * @deprecated
 */
@Deprecated
public final class TestAnalysis {
	private static final Logger LOGGER = LoggerFactory.getLogger(TestAnalysis.class);
	private static final boolean LOADCONFIG = false;

	private static final String KAX_FILENAME = "tmp/testproject.kax";
	private static final String SRC_FILENAME = "examples/userguide/ch5--trace-monitoring-aspectj/testdata/kieker-20140821-113933692-UTC/";

	private TestAnalysis() {}

	public static void main(final String[] args) {
		final IAnalysisController analysisController;
		if (TestAnalysis.LOADCONFIG) {
			try {
				analysisController = new AnalysisController(new File(TestAnalysis.KAX_FILENAME));

			} catch (final IOException ex) {
				TestAnalysis.LOGGER.error("Failed to load {}", TestAnalysis.KAX_FILENAME, ex);
				return;
			} catch (final AnalysisConfigurationException ex) {
				TestAnalysis.LOGGER.error("Failed to load {}", TestAnalysis.KAX_FILENAME, ex);
				return;
			}
		} else {
			analysisController = new AnalysisController("TestProject");
			TestAnalysis.createAndConnectPlugins(analysisController);
		}
		try {
			analysisController.run();
		} catch (final AnalysisConfigurationException ex) {
			TestAnalysis.LOGGER.error("Failed to start the example project.", ex);
		}
	}

	private static void createAndConnectPlugins(final IAnalysisController analysisController) {
		final SystemModelRepository traceRepo = new SystemModelRepository(new Configuration(), analysisController);

		// Reader
		final Configuration confFSReader = new Configuration();
		confFSReader.setProperty(FSReader.CONFIG_PROPERTY_NAME_INPUTDIRS, SRC_FILENAME);
		final FSReader reader = new FSReader(confFSReader, analysisController);

		// String Buffer
		final StringBufferFilter buffer = new StringBufferFilter(new Configuration(), analysisController);

		// TypeFilter
		final Configuration confTypeFilter = new Configuration();
		final TypeFilter typeFilter = new TypeFilter(confTypeFilter, analysisController);

		// TeeFilter
		final Configuration confTeeFilter1 = new Configuration();
		confTeeFilter1.setProperty(TeeFilter.CONFIG_PROPERTY_NAME_STREAM, TeeFilter.CONFIG_PROPERTY_VALUE_STREAM_STDOUT);
		// confTeeFilter1.setProperty(TeeFilter.CONFIG_PROPERTY_NAME_STREAM, TeeFilter.CONFIG_PROPERTY_VALUE_STREAM_NULL);
		final TeeFilter teeFilter1 = new TeeFilter(confTeeFilter1, analysisController);

		final Configuration confTeeFilter2 = new Configuration();
		confTeeFilter2.setProperty(TeeFilter.CONFIG_PROPERTY_NAME_STREAM, TeeFilter.CONFIG_PROPERTY_VALUE_STREAM_STDERR);
		confTeeFilter2.setProperty(TeeFilter.CONFIG_PROPERTY_NAME_STREAM, TeeFilter.CONFIG_PROPERTY_VALUE_STREAM_NULL);
		confTeeFilter2.setProperty(AbstractAnalysisComponent.CONFIG_NAME, "CountBegin");
		final TeeFilter teeFilter2 = new TeeFilter(confTeeFilter2, analysisController);

		final Configuration confTeeFilter3 = new Configuration();
		confTeeFilter3.setProperty(TeeFilter.CONFIG_PROPERTY_NAME_STREAM, TeeFilter.CONFIG_PROPERTY_VALUE_STREAM_STDERR);
		confTeeFilter3.setProperty(TeeFilter.CONFIG_PROPERTY_NAME_STREAM, TeeFilter.CONFIG_PROPERTY_VALUE_STREAM_NULL);
		confTeeFilter3.setProperty(AbstractAnalysisComponent.CONFIG_NAME, "CountAfter");
		final TeeFilter teeFilter3 = new TeeFilter(confTeeFilter3, analysisController);

		// CountingFilter
		final Configuration confCountingFilter1 = new Configuration();
		final CountingFilter countingFilter1 = new CountingFilter(confCountingFilter1, analysisController);

		final Configuration confCountingFilter2 = new Configuration();
		final CountingFilter countingFilter2 = new CountingFilter(confCountingFilter2, analysisController);

		final Configuration confTimestampFilter = new Configuration();
		final TimestampFilter timestampFilter = new TimestampFilter(confTimestampFilter, analysisController);

		// Filter
		final Configuration confTraceIdFilter = new Configuration();
		final TraceIdFilter traceIdFilter = new TraceIdFilter(confTraceIdFilter, analysisController);

		final Configuration confEventTraceReconstructionFilter = new Configuration();
		final EventRecordTraceReconstructionFilter eventTraceReconstructionFilter = new EventRecordTraceReconstructionFilter(confEventTraceReconstructionFilter,
				analysisController);

		final Configuration confTraceEvents2ExecutionAndMessageTraceFilter = new Configuration();
		final TraceEventRecords2ExecutionAndMessageTraceFilter traceEvents2ExecutionAndMessageTraceFilter = new TraceEventRecords2ExecutionAndMessageTraceFilter(
				confTraceEvents2ExecutionAndMessageTraceFilter, analysisController);

		// Visualization
		final Configuration confSequenceDiagramFilter = new Configuration();
		confSequenceDiagramFilter.setProperty(SequenceDiagramFilter.CONFIG_PROPERTY_NAME_OUTPUT_FN_BASE, "tmp/SequenceAssembly");
		final SequenceDiagramFilter sequenceDiagramFilter = new SequenceDiagramFilter(confSequenceDiagramFilter, analysisController);

		final ComponentDependencyGraphAllocationFilter componentDependencyGraphAllocationFilter = new ComponentDependencyGraphAllocationFilter(new Configuration(),
				analysisController);

		final Configuration componentAllocationWriterConfiguration = new Configuration();
		componentAllocationWriterConfiguration.setProperty(GraphWriterPlugin.CONFIG_PROPERTY_NAME_OUTPUT_PATH_NAME, "tmp/");
		componentAllocationWriterConfiguration.setProperty(GraphWriterPlugin.CONFIG_PROPERTY_NAME_OUTPUT_FILE_NAME, "dependency.dot");
		final GraphWriterPlugin componentAllocationGraphWriter = new GraphWriterPlugin(componentAllocationWriterConfiguration, analysisController);

		final OperationDependencyGraphAllocationFilter operationDependencyGraphAllocationFilter = new OperationDependencyGraphAllocationFilter(new Configuration(),
				analysisController);

		final Configuration operationAllocationWriterConfiguration = new Configuration();
		operationAllocationWriterConfiguration.setProperty(GraphWriterPlugin.CONFIG_PROPERTY_NAME_OUTPUT_PATH_NAME, "tmp/");
		operationAllocationWriterConfiguration.setProperty(GraphWriterPlugin.CONFIG_PROPERTY_NAME_OUTPUT_FILE_NAME, "dependency-operation.dot");
		final GraphWriterPlugin operationAllocationGraphWriter = new GraphWriterPlugin(operationAllocationWriterConfiguration, analysisController);

		// Visualization
		final Configuration confSystemModel2FileFilter = new Configuration();
		confSystemModel2FileFilter.setProperty(SystemModel2FileFilter.CONFIG_PROPERTY_NAME_HTML_OUTPUT_FN, "tmp/system-model.html");
		final SystemModel2FileFilter systemModel2FileFilter = new SystemModel2FileFilter(confSystemModel2FileFilter, analysisController);

		try { // connect everything
			analysisController.connect(reader, FSReader.OUTPUT_PORT_NAME_RECORDS, buffer, StringBufferFilter.INPUT_PORT_NAME_EVENTS);

			analysisController.connect(buffer, StringBufferFilter.OUTPUT_PORT_NAME_RELAYED_EVENTS, countingFilter1, CountingFilter.INPUT_PORT_NAME_EVENTS);

			analysisController.connect(countingFilter1, CountingFilter.OUTPUT_PORT_NAME_RELAYED_EVENTS, typeFilter, TypeFilter.INPUT_PORT_NAME_EVENTS);

			analysisController.connect(typeFilter, TypeFilter.OUTPUT_PORT_NAME_TYPE_MATCH, timestampFilter, TimestampFilter.INPUT_PORT_NAME_FLOW);

			analysisController.connect(countingFilter1, CountingFilter.OUTPUT_PORT_NAME_COUNT, teeFilter2, TeeFilter.INPUT_PORT_NAME_EVENTS);

			analysisController.connect(timestampFilter, TimestampFilter.OUTPUT_PORT_NAME_WITHIN_PERIOD, traceIdFilter, TraceIdFilter.INPUT_PORT_NAME_COMBINED);

			analysisController.connect(traceIdFilter, TraceIdFilter.OUTPUT_PORT_NAME_MATCH, countingFilter2, CountingFilter.INPUT_PORT_NAME_EVENTS);

			analysisController.connect(countingFilter2, CountingFilter.OUTPUT_PORT_NAME_COUNT, teeFilter3, TeeFilter.INPUT_PORT_NAME_EVENTS);

			analysisController.connect(
					countingFilter2, CountingFilter.OUTPUT_PORT_NAME_RELAYED_EVENTS, eventTraceReconstructionFilter,
					EventRecordTraceReconstructionFilter.INPUT_PORT_NAME_TRACE_RECORDS);

			analysisController.connect(traceEvents2ExecutionAndMessageTraceFilter, AbstractTraceAnalysisFilter.REPOSITORY_PORT_NAME_SYSTEM_MODEL, traceRepo);
			analysisController.connect(
					eventTraceReconstructionFilter, EventRecordTraceReconstructionFilter.OUTPUT_PORT_NAME_TRACE_VALID,
					traceEvents2ExecutionAndMessageTraceFilter, TraceEventRecords2ExecutionAndMessageTraceFilter.INPUT_PORT_NAME_EVENT_TRACE);

			analysisController.connect(
					traceEvents2ExecutionAndMessageTraceFilter, TraceEventRecords2ExecutionAndMessageTraceFilter.OUTPUT_PORT_NAME_MESSAGE_TRACE,
					teeFilter1, TeeFilter.INPUT_PORT_NAME_EVENTS);

			analysisController.connect(sequenceDiagramFilter, AbstractTraceAnalysisFilter.REPOSITORY_PORT_NAME_SYSTEM_MODEL, traceRepo);
			analysisController.connect(
					teeFilter1, TeeFilter.OUTPUT_PORT_NAME_RELAYED_EVENTS,
					sequenceDiagramFilter, AbstractMessageTraceProcessingFilter.INPUT_PORT_NAME_MESSAGE_TRACES);

			analysisController.connect(componentDependencyGraphAllocationFilter, AbstractTraceAnalysisFilter.REPOSITORY_PORT_NAME_SYSTEM_MODEL, traceRepo);
			analysisController.connect(
					teeFilter1, TeeFilter.OUTPUT_PORT_NAME_RELAYED_EVENTS,
					componentDependencyGraphAllocationFilter, AbstractMessageTraceProcessingFilter.INPUT_PORT_NAME_MESSAGE_TRACES);

			analysisController.connect(operationDependencyGraphAllocationFilter, AbstractTraceAnalysisFilter.REPOSITORY_PORT_NAME_SYSTEM_MODEL, traceRepo);
			analysisController.connect(
					teeFilter1, TeeFilter.OUTPUT_PORT_NAME_RELAYED_EVENTS,
					operationDependencyGraphAllocationFilter, AbstractMessageTraceProcessingFilter.INPUT_PORT_NAME_MESSAGE_TRACES);

			analysisController.connect(
					componentDependencyGraphAllocationFilter, IGraphOutputtingFilter.OUTPUT_PORT_NAME_GRAPH,
					componentAllocationGraphWriter, GraphWriterPlugin.INPUT_PORT_NAME_GRAPHS);

			analysisController.connect(
					operationDependencyGraphAllocationFilter, IGraphOutputtingFilter.OUTPUT_PORT_NAME_GRAPH,
					operationAllocationGraphWriter, GraphWriterPlugin.INPUT_PORT_NAME_GRAPHS);

			analysisController.connect(systemModel2FileFilter, AbstractTraceAnalysisFilter.REPOSITORY_PORT_NAME_SYSTEM_MODEL, traceRepo);

		} catch (final AnalysisConfigurationException ex) {
			TestAnalysis.LOGGER.error("Failed to wire the example project.", ex);
		}
		try {
			analysisController.saveToFile(new File(TestAnalysis.KAX_FILENAME));
		} catch (final IOException ex) {
			TestAnalysis.LOGGER.error("Failed to save configuration to {}", TestAnalysis.KAX_FILENAME, ex);
		} catch (final AnalysisConfigurationException ex) {
			TestAnalysis.LOGGER.error("Failed to save configuration to {}", TestAnalysis.KAX_FILENAME, ex);
		}
	}
}


text:
import React, { Component } from "react";
import { EditorState, RawDraftContentState } from "draft-js";

import {
  DraftailEditor,
  DraftailEditorProps,
  serialiseEditorStateToRaw,
} from "../../src/index";

import SentryBoundary from "./SentryBoundary";
import Highlight from "./Highlight";
import EditorBenchmark from "./EditorBenchmark";

declare let PKG_VERSION: string;

const DRAFTAIL_VERSION =
  typeof PKG_VERSION === "undefined" ? "dev" : PKG_VERSION;

interface EditorWrapperProps extends Partial<DraftailEditorProps> {
  id: string;
  rawContentState?: RawDraftContentState | null;
  editorState?: EditorState | null;
  onSave?: ((content: null | RawDraftContentState) => void) | null;
  onChange?: ((editorState: EditorState) => void) | null;
}

interface EditorWrapperState {
  content: RawDraftContentState | null;
  saveCount: number;
}

class EditorWrapper extends Component<EditorWrapperProps, EditorWrapperState> {
  constructor(props: EditorWrapperProps) {
    super(props);

    this.state = {
      content: null,
      saveCount: 0,
    };

    this.onSave = this.onSave.bind(this);
    this.onChange = this.onChange.bind(this);
  }

  onSave(content: null | RawDraftContentState) {
    const { id, onSave } = this.props;

    this.setState(({ saveCount }) => ({ content, saveCount: saveCount + 1 }));

    sessionStorage.setItem(`${id}:content`, JSON.stringify(content));

    if (onSave) {
      onSave(content);
    }
  }

  onChange(nextState: EditorState) {
    const { id, onChange } = this.props;
    const content = serialiseEditorStateToRaw(nextState);

    this.setState(({ saveCount }) => ({ content, saveCount: saveCount + 1 }));

    sessionStorage.setItem(`${id}:content`, JSON.stringify(content));

    if (onChange) {
      onChange(nextState);
    }
  }

  render() {
    const {
      id,
      editorState,
      rawContentState,
      onSave,
      onChange,
      ...editorProps
    } = this.props;
    const { content, saveCount } = this.state;
    const dataProps: Partial<DraftailEditorProps> = {};
    let initialContent;

    if (editorState) {
      dataProps.editorState = editorState;
      dataProps.onChange = this.onChange;
    } else {
      const storedContent = sessionStorage.getItem(`${id}:content`) || "null";
      initialContent =
        rawContentState || (storedContent ? JSON.parse(storedContent) : null);
      dataProps.rawContentState = initialContent;
      dataProps.onSave = this.onSave;
    }

    return (
      <div className={`EditorWrapper EditorWrapper--${id}`}>
        <SentryBoundary>
          {/* eslint-disable-next-line react/jsx-props-no-spreading */}
          <DraftailEditor {...dataProps} {...editorProps} />
        </SentryBoundary>

            Debug

              {`Version: ${DRAFTAIL_VERSION}`}

              {`Saves: ${saveCount}`}

          {/* Running multiple editors with the same base state is a source of issues. */}
          {editorState ? null : (
            <EditorBenchmark componentProps={this.props} runOnMount />
          )}
          <Highlight
            value={JSON.stringify(content || initialContent, null, 2) || ""}
          />

    );
  }
}

export default EditorWrapper;