text:
import roller
import random

DEFAULT_CARD_AMOUNT = 1
MAX_CARDS = 15
CARD_SEPARATOR = "||"

def ping_exec(irc, message):
    pong = 'PONG ' + message.text.split(" ")[1] + '\r\n'
    irc.send(pong.encode("utf-8"))

def roll_exec(irc, message):
    '''
        A !roll comand has the following structure:
            !roll diceAmount+d+diceSize+"+"+modifier

        * Dice amount is an integer up to 20000
        * Dice Size is an integer
        * Modifier is an integer that is added onto the roll after

        The !Roll command can also have this structure:
            !!roll d+diceAmount+d+diceSize+"+"+modifier

        * Dice amount is the result of a roll of said size and then proceeds
            to roll that many of the following dice
        * Dice Size is an integer
        * Modifier is an integer that is added onto the roll after
    '''

    diceNumbers = roller.getRolledNumbers(message.text)
    messageToSend = ''

    # -------------------------------------------------------------------
    #   Hard limits on the dice sizes
    # -------------------------------------------------------------------

    if diceNumbers[0] > 10:
        diceNumbers[0] = 10

    if diceNumbers[0] < 1:
        diceNumbers[0] = 1

    if diceNumbers[1] > 2000:
        diceNumbers[1] = 2000

    if diceNumbers[1] < 1:
        diceNumbers[1] = 1

    if diceNumbers[2] < 1:
        diceNumbers[2] = 1
    rolledArray = roller.roll(diceNumbers[0],
                              diceNumbers[1],
                              diceNumbers[2])

    for rollNum in rolledArray:
        # REMINDER: make a message maker function cause this is ugly!
        if (diceNumbers[3] == 0):
            messageToSend = (messageToSend +
                             "\x0312,15(" + str(diceNumbers[1]) +
                             "d" + str(diceNumbers[2]) + ") \x032,15[" +
                             str(rollNum) + "]\x031,15 : \x034,15{" +
                             str(rollNum + diceNumbers[3]) + "} ")
        else:
            messageToSend = (messageToSend + "\x0312,15(" +
                             str(diceNumbers[1]) + "d" +
                             str(diceNumbers[2]) + "+" +
                             str(diceNumbers[3]) + ") \x032,15[" +
                             str(rollNum) + "+" +
                             str(diceNumbers[3]) +
                             "]\x031,15 : \x034,15{" +
                             str(rollNum + diceNumbers[3]) + "} ")

    irc.send(message.reply(messageToSend))

def join_exec(irc, message):
    '''
    A join command has the following structure:
        !JOIN #CHANNEL
    A message is sent to the irc server requesting to join #CHANNEL
    '''
    chann = ""
    foundLink = False
    for char in message.text:
        if char == "#":
            foundLink = True
        if foundLink:
            chann = chann + char
    if chann != "":
        join_message = "JOIN " + chann + "\n"
        irc.send(join_message.encode("utf-8"))
    else:
        irc.send(message.reply("Error 02: bad channel."))

def tarot_exec(irc, message):
    '''
        Tarot command asks for the number of cards to be drawn and returns them.
        A tarot command has the following structure:
            !tarot <NUMBER OF CARDS>
    '''
    card_amount = get_card_amount(message)
    card_spread = spread_cards(card_amount)
    output_message = "You got these cards: " + CARD_SEPARATOR.join(card_spread)

    irc.send(message.reply(output_message))

def spread_cards(card_amount):
    card_spread = []
    local_deck = load_deck("deck")
    for time in range(0, card_amount):
        card_index = random.randint(0, len(local_deck) - 1)
        is_reversed = random.randint(0, 1) == 1

        card_text = local_deck[card_index]
        if is_reversed:
            card_text = card_text + "(reversed)"
        card_spread.append(card_text)

        local_deck.remove(local_deck[card_index])
    return card_spread

def get_card_amount(message):
    number_buffer = ""
    number_end = 9
    for characterIndex in range(0, len(message.text)):
        try:
            int(message.text[characterIndex])
            if characterIndex < number_end:
                number_buffer = number_buffer + message.text[characterIndex]
        except ValueError:
            continue
    try:
        card_amount = int(number_buffer)
    except ValueError:
        card_amount = DEFAULT_CARD_AMOUNT

    if card_amount > MAX_CARDS:
        card_amount = MAX_CARDS

    return card_amount

def load_deck(deck_file_name):
    deck_file = open(deck_file_name, "r")
    deck_text = deck_file.readlines()
    deck = []
    deck_file.close()

    for card in deck_text:
        deck.append(card[:-1])
    return deck


text:
package fr.m1info.rv2j.servlets;

import java.io.IOException;
import java.util.List;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import fr.m1info.rv2j.beans.Project;
import fr.m1info.rv2j.dao.DAOFactory;
import fr.m1info.rv2j.dao.ProjectDAO;

public class Home extends HttpServlet {

	private static final long serialVersionUID = 1L;

	public final static String CONF_DAO_FACTORY = "daofactory";

	private ProjectDAO projectDAO;
	private List<Project> projects;

	public final static String view = "/home.jsp";
	public final static String PROJECTS = "projects";
	public final static String PROJECT = "project";

	public void init() throws ServletException {
		this.projectDAO = ((DAOFactory) getServletContext().getAttribute(CONF_DAO_FACTORY)).getProjectDao();
	}

	@Override
	protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
		projects = projectDAO.getAllProjects();
		req.setAttribute(PROJECTS, projects);
		this.getServletContext().getRequestDispatcher(view).forward(req, resp);
	}
}

redpajama_set_name: RedPajamaGithub


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

<selector xmlns:android="http://schemas.android.com/apk/res/android"
          android:exitFadeDuration="@android:integer/config_mediumAnimTime">
    <item android:state_activated="true" android:drawable="@color/list_item_selected" />
    <item android:state_checked="true" android:drawable="@color/list_item_selected" />
    <item android:state_pressed="true" android:drawable="@color/list_item_highlight" />
    <item android:drawable="@android:color/transparent" />
</selector>


text:
<!doctype html>

Click me


text:
@interface ExamTableViewController ()<UITableViewDataSource,UITableViewDelegate>
{
    NSArray *_catalogModel;
    ExamTableHeadView *_headView;
    ExamModel *_examM;
}
@end

@implementation ExamTableViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self setNavTitle:@"我的试卷"];

    [self setUpTableHeadView];
    [self getExamData];
}

- (void)setUpTableHeadView
{
    _headView = [ExamTableHeadView createExamTableHeadView];
    self.tableView.tableHeaderView = _headView;
}

- (void)getExamData
{
    [SVProgressHUD show];
    Instance *instance = [Instance sharedInstance];
    [SkywareHttpTool HttpToolGetWithUrl:exam paramesers:@[self.exam_id] requestHeaderField:@{@"token":instance.token} SuccessJson:^(id json) {
        SkywareResult *result = [SkywareResult objectWithKeyValues:json];
        _examM = [ExamModel objectWithKeyValues:result.result];
        _headView.examModel = _examM;
        _catalogModel = _examM.catalog;
        if (!_catalogModel.count) {
            [SVProgressHUD showInfoWithStatus:@"暂无试卷"];
        }else{
            [self.tableView reloadData];
            [SVProgressHUD dismiss];
        }
    } failure:^(NSError *error) {
        [SVProgressHUD showErrorWithStatus:@"网络不给力,请检查网络设置"];
    }];
}

- (NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return _catalogModel.count;
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    CatalogModel *catalog =  _catalogModel[section];
    return catalog.data.count;
}

- (CGFloat) tableView:(UITableView *)tableView heightForHeaderInSection:(NSInteger)section
{
    return 30;
}

- (UIView *) tableView:(UITableView *)tableView viewForHeaderInSection:(NSInteger)section
{
    UIView *headView = [[UIView alloc] initWithFrame:CGRectMake(0, 0, kWindowWidth, 30)];
    UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(7, 0, 100, 30)];
    [headView addSubview:label];
    headView.backgroundColor = [UIColor lightGrayColor];
    label.textColor = [UIColor whiteColor];
    CatalogModel *catalog =  _catalogModel[section];
    label.text = [NSString stringWithFormat:@"第%@部分",catalog.name];
    return headView;
}

- (UITableViewCell *) tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSString *cellID = @"ExamTableViewControllerCell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:cellID];
    if (cell == nil) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleSubtitle reuseIdentifier:cellID];
    }
    CatalogModel *catalog =  _catalogModel[indexPath.section];
    ExamData *data = catalog.data[indexPath.row];
    NSRange srcRange = [data.title rangeOfString:@"

"];
    if (srcRange.location != NSNotFound && jpgRange.location != NSNotFound) {
        NSMutableString *Mstring = [NSMutableString stringWithString:data.title];
        NSRange jpgUrlRange = NSMakeRange(srcRange.location, jpgRange.location - srcRange.location + jpgRange.length);
        [Mstring deleteCharactersInRange:jpgUrlRange];
        data.title = Mstring;
    }
    NSMutableAttributedString * attrStr = [[NSMutableAttributedString alloc] initWithData:[data.title dataUsingEncoding:NSUnicodeStringEncoding] options:@{ NSDocumentTypeDocumentAttribute: NSHTMLTextDocumentType} documentAttributes:nil error:nil];
    cell.textLabel.attributedText = attrStr;
    cell.textLabel.font = [UIFont systemFontOfSize:15];
    cell.accessoryType = UITableViewCellAccessoryDisclosureIndicator;
    return cell;
}

- (void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];

    CatalogModel *catalog =  _catalogModel[indexPath.section];
    ExamData *data = catalog.data[indexPath.row];
    QuestionViewController *questionVC = [[UIStoryboard storyboardWithName:@"Home" bundle:nil] instantiateViewControllerWithIdentifier:@"QuestionViewController"];
    questionVC.data = data;
    questionVC.examModel = _examM;
    questionVC.unit_no = indexPath.section;
    questionVC.quest_no = indexPath.row;
    [self.navigationController pushViewController:questionVC animated:YES];
}

@end


text:
namespace storage {
class FileSystemContext;
class FileSystemOperationContext;
}

namespace sync_file_system {

class SyncableFileOperationRunner;

// A wrapper class of FileSystemOperation for syncable file system.
class SyncableFileSystemOperation
    : public NON_EXPORTED_BASE(storage::FileSystemOperation),
      public base::NonThreadSafe {
 public:
  ~SyncableFileSystemOperation() override;

  // storage::FileSystemOperation overrides.
  void CreateFile(const storage::FileSystemURL& url,
                  bool exclusive,
                  const StatusCallback& callback) override;
  void CreateDirectory(const storage::FileSystemURL& url,
                       bool exclusive,
                       bool recursive,
                       const StatusCallback& callback) override;
  void Copy(const storage::FileSystemURL& src_url,
            const storage::FileSystemURL& dest_url,
            CopyOrMoveOption option,
            const CopyProgressCallback& progress_callback,
            const StatusCallback& callback) override;
  void Move(const storage::FileSystemURL& src_url,
            const storage::FileSystemURL& dest_url,
            CopyOrMoveOption option,
            const StatusCallback& callback) override;
  void DirectoryExists(const storage::FileSystemURL& url,
                       const StatusCallback& callback) override;
  void FileExists(const storage::FileSystemURL& url,
                  const StatusCallback& callback) override;
  void GetMetadata(const storage::FileSystemURL& url,
                   const GetMetadataCallback& callback) override;
  void ReadDirectory(const storage::FileSystemURL& url,
                     const ReadDirectoryCallback& callback) override;
  void Remove(const storage::FileSystemURL& url,
              bool recursive,
              const StatusCallback& callback) override;
  void Write(const storage::FileSystemURL& url,
             scoped_ptr<storage::FileWriterDelegate> writer_delegate,
             scoped_ptr<net::URLRequest> blob_request,
             const WriteCallback& callback) override;
  void Truncate(const storage::FileSystemURL& url,
                int64 length,
                const StatusCallback& callback) override;
  void TouchFile(const storage::FileSystemURL& url,
                 const base::Time& last_access_time,
                 const base::Time& last_modified_time,
                 const StatusCallback& callback) override;
  void OpenFile(const storage::FileSystemURL& url,
                int file_flags,
                const OpenFileCallback& callback) override;
  void Cancel(const StatusCallback& cancel_callback) override;
  void CreateSnapshotFile(const storage::FileSystemURL& path,
                          const SnapshotFileCallback& callback) override;
  void CopyInForeignFile(const base::FilePath& src_local_disk_path,
                         const storage::FileSystemURL& dest_url,
                         const StatusCallback& callback) override;
  void RemoveFile(const storage::FileSystemURL& url,
                  const StatusCallback& callback) override;
  void RemoveDirectory(const storage::FileSystemURL& url,
                       const StatusCallback& callback) override;
  void CopyFileLocal(const storage::FileSystemURL& src_url,
                     const storage::FileSystemURL& dest_url,
                     CopyOrMoveOption option,
                     const CopyFileProgressCallback& progress_callback,
                     const StatusCallback& callback) override;
  void MoveFileLocal(const storage::FileSystemURL& src_url,
                     const storage::FileSystemURL& dest_url,
                     CopyOrMoveOption option,
                     const StatusCallback& callback) override;
  base::File::Error SyncGetPlatformPath(const storage::FileSystemURL& url,
                                        base::FilePath* platform_path) override;

 private:
  typedef SyncableFileSystemOperation self;
  class QueueableTask;

  // Only SyncFileSystemBackend can create a new operation directly.
  friend class SyncFileSystemBackend;

  SyncableFileSystemOperation(
      const storage::FileSystemURL& url,
      storage::FileSystemContext* file_system_context,
      scoped_ptr<storage::FileSystemOperationContext> operation_context);

  void DidFinish(base::File::Error status);
  void DidWrite(const WriteCallback& callback,
                base::File::Error result,
                int64 bytes,
                bool complete);

  void OnCancelled();

  const storage::FileSystemURL url_;

  scoped_ptr<storage::FileSystemOperation> impl_;
  base::WeakPtr<SyncableFileOperationRunner> operation_runner_;
  std::vector<storage::FileSystemURL> target_paths_;

  StatusCallback completion_callback_;

  base::WeakPtrFactory<SyncableFileSystemOperation> weak_factory_;

  DISALLOW_COPY_AND_ASSIGN(SyncableFileSystemOperation);
};

}  // namespace sync_file_system

#endif  // CHROME_BROWSER_SYNC_FILE_SYSTEM_LOCAL_SYNCABLE_FILE_SYSTEM_OPERATION_H_


text:
package com.evolveum.midpoint.model.impl.dataModel.dot;

import com.evolveum.midpoint.model.impl.dataModel.model.ResourceDataItem;
import com.evolveum.midpoint.prism.polystring.PolyString;
import org.jetbrains.annotations.NotNull;

/**
 * @author mederly
 */
public class DotResourceDataItem implements DotDataItem {

    private final ResourceDataItem dataItem;
    private final DotModel dotModel;

    public DotResourceDataItem(ResourceDataItem dataItem, DotModel dotModel) {
        this.dataItem = dataItem;
        this.dotModel = dotModel;
    }

    @Override
    public String getNodeName() {
        return "\"" + getResourceName() + ":" + dotModel.getObjectTypeName(dataItem.getRefinedObjectClassDefinition(), false) + ":" + dataItem.getItemPath() + "\"";
    }

    @Override
    public String getNodeLabel() {
        return dataItem.getLastItemName().getLocalPart();
    }

    @Override
    public String getNodeStyleAttributes() {
        return "";
    }

    @NotNull
    public String getResourceName() {
        PolyString name = dotModel.getDataModel().getResource(dataItem.getResourceOid()).getName();
        return name != null ? name.getOrig() : dataItem.getResourceOid();
    }

}


text:
<?xml version="1.0" encoding="UTF-8"?>
<!--
  ~ Copyright 2014 Open Networking Laboratory
  ~
  ~ Licensed under the Apache License, Version 2.0 (the "License");
  ~ you may not use this file except in compliance with the License.
  ~ You may obtain a copy of the License at
  ~
  ~     http://www.apache.org/licenses/LICENSE-2.0
  ~
  ~ Unless required by applicable law or agreed to in writing, software
  ~ distributed under the License is distributed on an "AS IS" BASIS,
  ~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  ~ See the License for the specific language governing permissions and
  ~ limitations under the License.
  -->
<archetype-descriptor xsi:schemaLocation="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0 http://maven.apache.org/xsd/archetype-descriptor-1.0.0.xsd" name="onos-bundle"
    xmlns="http://maven.apache.org/plugins/maven-archetype-plugin/archetype-descriptor/1.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
  <fileSets>
    <fileSet filtered="true" packaged="true" encoding="UTF-8">
      <directory>src/main/java</directory>
      <includes>
        <include>**/*.java</include>
      </includes>
    </fileSet>
    <fileSet filtered="true" packaged="true" encoding="UTF-8">
      <directory>src/test/java</directory>
      <includes>
        <include>**/*.java</include>
      </includes>
    </fileSet>
  </fileSets>
</archetype-descriptor>


text:
import {Component} from "@angular/core";
import {styles} from "./app.component.styles";

@Component({
  selector: 'mpt-app',
  templateUrl: './app.component.html',
})
export class AppComponent {

  styles: any = styles;

}


text:
import datetime
import os
from enum import Enum

from flask import Flask
from flask_marshmallow import Marshmallow
from marshmallow_enum import EnumField

import postgresql_db.database as database

app = Flask(__name__)
db = database.connect(app, 'postgres', os.environ['POSTGRES_PASSWORD'], 'postgres')
ma = Marshmallow(app)

'''
-----
Enums
-----
'''

class SenderType(Enum):
    USER = "USER"
    BOT = "BOT"

class PersonType(Enum):
    LANDLORD = "LANDLORD"
    TENANT = "TENANT"

class BotState(Enum):
    DETERMINE_CLAIM_CATEGORY = "DETERMINE_CLAIM_CATEGORY"
    RESOLVING_FACTS = "RESOLVING_FACTS"
    RESOLVING_ADDITIONAL_FACTS = "RESOLVING_ADDITIONAL_FACTS"
    AWAITING_ACKNOWLEDGEMENT = "AWAITING_ACKNOWLEDGEMENT"
    GIVING_PREDICTION = "GIVING_PREDICTION"

class ClaimCategory(Enum):
    LEASE_TERMINATION = "LEASE_TERMINATION"
    NONPAYMENT = "NONPAYMENT"
    RETAKE_RENTAL = "RETAKE_RENTAL"

class FactType(Enum):
    TEXT = "TEXT"
    BOOLEAN = "BOOLEAN"
    MONEY = "MONEY"
    DATE = "DATE"
    DURATION_MONTHS = "DURATION_MONTHS"

class DocumentType(Enum):
    LEASE = "LEASE"

'''
-----------------
SQLAlchemy Models
-----------------
'''

class Fact(db.Model):
    id = db.Column(db.Integer, primary_key=True)

    # Attributes
    name = db.Column(db.String(50), nullable=False)
    summary = db.Column(db.String(60), nullable=False)
    type = db.Column(db.Enum(FactType), nullable=False)

class Conversation(db.Model):
    id = db.Column(db.Integer, primary_key=True)

    # Attributes
    name = db.Column(db.String(40), nullable=False)
    person_type = db.Column(db.Enum(PersonType))
    claim_category = db.Column(db.Enum(ClaimCategory))
    bot_state = db.Column(db.Enum(BotState))

    # Documents
    report = db.Column(db.Text)

    # One to one
    current_fact_id = db.Column(db.Integer, db.ForeignKey('fact.id'))
    current_fact = db.relationship('Fact', uselist=False, backref='conversation')

    # One to many
    messages = db.relationship('Message')
    fact_entities = db.relationship('FactEntity', cascade="all, delete-orphan")
    files = db.relationship('File')

class Message(db.Model):
    id = db.Column(db.Integer, primary_key=True)

    # Foreign Keys
    conversation_id = db.Column(db.Integer, db.ForeignKey('conversation.id'))

    # Attributes
    sender_type = db.Column(db.Enum(SenderType), nullable=False)
    timestamp = db.Column(db.DateTime, default=datetime.datetime.utcnow)
    text = db.Column(db.Text, nullable=False)
    possible_answers = db.Column(db.Text)
    enforce_possible_answer = db.Column(db.Boolean)

    # One to one
    relevant_fact_id = db.Column(db.Integer, db.ForeignKey('fact.id'))
    relevant_fact = db.relationship('Fact', uselist=False, backref='message')

    file_request = db.relationship('FileRequest', uselist=False, backref='message')

    def request_file(self, document_type):
        self.file_request = FileRequest(document_type=document_type)

class UserConfirmation(db.Model):
    id = db.Column(db.Integer, primary_key=True)

    # Foreign Keys
    fact_id = db.Column(db.Integer, db.ForeignKey('fact.id'))
    message_id = db.Column(db.Integer, db.ForeignKey('message.id'))

    # Attributes
    text = db.Column(db.Text, nullable=False)

class FileRequest(db.Model):
    id = db.Column(db.Integer, primary_key=True)

    # Foreign Keys
    message_id = db.Column(db.Integer, db.ForeignKey('message.id'))

    # Attributes
    document_type = db.Column(db.Enum(DocumentType), nullable=False)

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

class FactEntity(db.Model):
    id = db.Column(db.Integer, primary_key=True)

    # Foreign Keys
    conversation_id = db.Column(db.Integer, db.ForeignKey('conversation.id'))

    # One to one
    fact_id = db.Column(db.Integer, db.ForeignKey('fact.id'))
    fact = db.relationship('Fact', uselist=False, backref='factentity')

    # Attributes
    value = db.Column(db.String(255), nullable=False)

class File(db.Model):
    id = db.Column(db.Integer, primary_key=True)

    # Foreign Keys
    conversation_id = db.Column(db.Integer, db.ForeignKey('conversation.id'))

    # Attributes
    name = db.Column(db.String(50), nullable=False)
    type = db.Column(db.String(50), nullable=False)
    path = db.Column(db.String(100))
    timestamp = db.Column(db.DateTime, default=datetime.datetime.utcnow)

class Feedback(db.Model):
    id = db.Column(db.Integer, primary_key=True)

    # Attributes
    feedback = db.Column(db.Text, nullable=False)

'''
----------------------
Bootstrapping Database
----------------------
'''

print("Creating database tables from models.py")
db.create_all()

print("Loading database with pre-defined fact values.")

# Function that persists a model to the db if it doesn't already exist
def get_or_create(session, model, **kwargs):
    instance = session.query(model).filter_by(**kwargs).first()
    if instance is None:
        instance = model(**kwargs)
        session.add(instance)
        session.commit()
        return instance

defined_facts = [
    {'name': 'apartment_dirty', 'summary': 'Dwelling unfit for habitation', 'type': FactType.BOOLEAN},
    {'name': 'bothers_others', 'summary': 'Tenant is disruptive', 'type': FactType.BOOLEAN},
    {'name': 'disrespect_previous_judgement', 'summary': 'Previous board judgements disrespected',
     'type': FactType.BOOLEAN},
    {'name': 'landlord_inspector_fees', 'summary': 'Inspector hired', 'type': FactType.BOOLEAN},
    {'name': 'landlord_notifies_tenant_retake_apartment', 'summary': 'Notified tenant of dwelling retake',
     'type': FactType.BOOLEAN},
    {'name': 'landlord_pays_indemnity', 'summary': 'Landlord paid compensation', 'type': FactType.BOOLEAN},
    {'name': 'landlord_relocation_indemnity_fees', 'summary': 'Relocation fees compensated',
     'type': FactType.BOOLEAN},
    {'name': 'landlord_rent_change', 'summary': 'Rent change attempted', 'type': FactType.BOOLEAN},
    {'name': 'landlord_rent_change_doc_renseignements', 'summary': 'Rent change documents filed',
     'type': FactType.BOOLEAN},
    {'name': 'landlord_retakes_apartment', 'summary': 'Landlord intends to retake dwelling', 'type': FactType.BOOLEAN},
    {'name': 'landlord_sends_demand_regie_logement', 'summary': 'Landlord filed legal inquiry',
     'type': FactType.BOOLEAN},
    {'name': 'rent_increased', 'summary': 'Rent increased during lease term', 'type': FactType.BOOLEAN},
    {'name': 'tenant_continuous_late_payment', 'summary': 'Tenant continually pays rent late',
     'type': FactType.BOOLEAN},
    {'name': 'tenant_sends_demand_regie_logement', 'summary': 'Tenant filed legal inquiry', 'type': FactType.BOOLEAN},
    {'name': 'signed_proof_of_rent_debt', 'summary': 'Debt acknowledgement provided', 'type': FactType.BOOLEAN},
    {'name': 'tenant_damaged_rental', 'summary': 'Rental property damaged', 'type': FactType.BOOLEAN},
    {'name': 'tenant_dead', 'summary': 'Tenant deceased', 'type': FactType.BOOLEAN},
    {'name': 'tenant_financial_problem', 'summary': 'Financial issues impeding rent payment', 'type': FactType.BOOLEAN},
    {'name': 'tenant_individual_responsability', 'summary': 'Single tenant on lease', 'type': FactType.BOOLEAN},
    {'name': 'tenant_is_bothered', 'summary': 'Perte de jouissance', 'type': FactType.BOOLEAN},
    {'name': 'tenant_lease_fixed', 'summary': 'Lease end date stated explicitly', 'type': FactType.BOOLEAN},
    {'name': 'tenant_left_without_paying', 'summary': 'Tenant left without paying', 'type': FactType.BOOLEAN},
    {'name': 'tenant_monthly_payment', 'summary': 'Monthly rent payment', 'type': FactType.MONEY},
    {'name': 'tenant_owes_rent', 'summary': 'Tenant owes overdue rent', 'type': FactType.MONEY},
    {'name': 'tenant_refuses_retake_apartment', 'summary': 'Tenant refuses dwelling retake', 'type': FactType.BOOLEAN},
    {'name': 'tenant_rent_not_paid_more_3_weeks', 'summary': 'Rent overdue over 3 weeks', 'type': FactType.BOOLEAN},
    {'name': 'tenant_withold_rent_without_permission', 'summary': 'Rent withheld lacking legal permission',
     'type': FactType.BOOLEAN},
    {'name': 'tenant_not_paid_lease_timespan', 'summary': 'Months rent payment overdue',
     'type': FactType.DURATION_MONTHS},
    {'name': 'violent', 'summary': 'Dispute precipitated violence', 'type': FactType.BOOLEAN}
]
for fact_dict in defined_facts:
    get_or_create(db.session, Fact, name=fact_dict['name'], summary=fact_dict['summary'], type=fact_dict['type'])

print("Finished loading pre-defined fact values.")

'''
-------------------
Marshmallow Schemas
-------------------
'''

class FileRequestSchema(ma.ModelSchema):
    # Enum
    document_type = EnumField(DocumentType, by_value=True)

    class Meta:
        fields = ['document_type']

class FactSchema(ma.ModelSchema):
    # Enum
    type = EnumField(FactType, by_value=True)

    class Meta:
        fields = ('name', 'summary', 'type')

class FactEntitySchema(ma.ModelSchema):
    # One to one
    fact = ma.Nested(FactSchema)

    class Meta:
        fields = ('id', 'value', 'fact')

class FileSchema(ma.ModelSchema):
    class Meta:
        fields = ('name', 'type', 'timestamp')

class FeedbackSchema(ma.ModelSchema):
    class Meta:
        fields = ['feedback']

class MessageSchema(ma.ModelSchema):
    # Enum
    sender_type = EnumField(SenderType, by_value=True)

    # One to one
    relevant_fact = ma.Nested(FactSchema)
    file_request = ma.Nested(FileRequestSchema)

    class Meta:
        model = Message

class ConversationSchema(ma.ModelSchema):
    # Enum
    person_type = EnumField(PersonType, by_value=True)
    claim_category = EnumField(ClaimCategory, by_value=True)
    bot_state = EnumField(BotState, by_value=True)

    # One to one
    current_fact = ma.Nested(FactSchema)

    # One to many
    messages = ma.Nested(MessageSchema, many=True)
    fact_entities = ma.Nested(FactEntitySchema, many=True)

    class Meta:
        fields = (
            'id', 'name', 'person_type', 'claim_category', 'bot_state', 'current_fact', 'messages', 'fact_entities')


text:
using System;
using System.Collections.Generic;
using System.Linq;
using AutoFixture.Kernel;
using Xunit;

namespace AutoFixtureUnitTest.Kernel
{
    [Obsolete]
    public class MultipleToEnumerableRelayTests
    {
        [Fact]
        public void SutIsSpecimenBuilder()
        {
            var sut = new MultipleToEnumerableRelay();
            Assert.IsAssignableFrom<ISpecimenBuilder>(sut);
        }

        [Theory]
        [InlineData(null)]
        [InlineData(typeof(object))]
        [InlineData(typeof(Type))]
        [InlineData(1)]
        [InlineData(9992)]
        [InlineData("")]
        public void CreateFromNonMultipleRequestReturnsCorrectResult(
            object request)
        {
            // Arrange
            var sut = new MultipleToEnumerableRelay();
            // Act
            var dummyContext = new DelegatingSpecimenContext();
            var actual = sut.Create(request, dummyContext);
            // Assert
            var expected = new NoSpecimen();
            Assert.Equal(expected, actual);
        }

        [Theory]
        [InlineData(typeof(object), 1)]
        [InlineData(typeof(string), 42)]
        [InlineData(typeof(int), 1337)]
        public void CreateFromMultipleRequestReturnsCorrectResult(
            Type itemType,
            int arrayLength)
        {
            // Arrange
            var sut = new MultipleToEnumerableRelay();
            var context = new DelegatingSpecimenContext
            {
                OnResolve = r =>
                {
                    Assert.Equal(
                        typeof(IEnumerable<>).MakeGenericType(itemType),
                        r);
                    return Array.CreateInstance((Type)itemType, arrayLength);
                }
            };
            // Act
            var request = new MultipleRequest(itemType);
            var actual = sut.Create(request, context);
            // Assert
            Assert.IsAssignableFrom(
                typeof(IEnumerable<>).MakeGenericType(itemType),
                actual);
            var enumerable =
                Assert.IsAssignableFrom<System.Collections.IEnumerable>(actual);
            Assert.Equal(arrayLength, enumerable.Cast<object>().Count());
        }

        [Theory]
        [InlineData("foo")]
        [InlineData("1")]
        [InlineData(false)]
        public void CreateFromMultipleRequestWithNonTypeRequestReturnsCorrectResult(
            object innerRequest)
        {
            // Arrange
            var sut = new MultipleToEnumerableRelay();
            var request = new MultipleRequest(innerRequest);
            // Act
            var dummyContext = new DelegatingSpecimenContext();
            var actual = sut.Create(request, dummyContext);
            // Assert
            var expected = new NoSpecimen();
            Assert.Equal(expected, actual);
        }

        [Theory]
        [InlineData(typeof(bool), true, 53)]
        [InlineData(typeof(string), "ploeh", 9)]
        [InlineData(typeof(int), 7, 902)]
        public void CreateFromMultipleSeededRequestReturnsCorrectResult(
            Type itemType,
            object seed,
            int arrayLength)
        {
            // Arrange
            var sut = new MultipleToEnumerableRelay();
            var context = new DelegatingSpecimenContext
            {
                OnResolve = r =>
                {
                    Assert.Equal(
                        typeof(IEnumerable<>).MakeGenericType(itemType),
                        r);
                    return Array.CreateInstance((Type)itemType, arrayLength);
                }
            };
            // Act
            var request = new MultipleRequest(new SeededRequest(itemType, seed));
            var actual = sut.Create(request, context);
            // Assert
            Assert.IsAssignableFrom(
                typeof(IEnumerable<>).MakeGenericType(itemType),
                actual);
            var enumerable =
                Assert.IsAssignableFrom<System.Collections.IEnumerable>(actual);
            Assert.Equal(arrayLength, enumerable.Cast<object>().Count());
        }

        [Theory]
        [InlineData("bar")]
        [InlineData("9")]
        [InlineData(true)]
        public void CreateFromMultipleSeededRequestWithNonTypeRequestReturnsCorrectResult(
            object innerRequest)
        {
            // Arrange
            var sut = new MultipleToEnumerableRelay();
            var request = new MultipleRequest(
                new SeededRequest(
                    innerRequest,
                    new object()));
            // Act
            var dummyContext = new DelegatingSpecimenContext();
            var actual = sut.Create(request, dummyContext);
            // Assert
            var expected = new NoSpecimen();
            Assert.Equal(expected, actual);
        }

        [Fact]
        public void CreateWithNullContextThrows()
        {
            // Arrange
            var sut = new MultipleToEnumerableRelay();
            // Act & assert
            var dummyRequest = new object();
            Assert.Throws<ArgumentNullException>(
                () => sut.Create(dummyRequest, null));
        }
    }
}


text:
"""
Test cases for the numbergen module.

$Id$
"""
__version__ = '$Revision$'

import unittest
from topo import numbergen

class TestUniformRandomMeanRange(unittest.TestCase):
    def test_lbound_ubound(self):
        lbound = 3.0
        ubound = 5.0
        d = numbergen.UniformRandom(lbound=lbound, ubound=ubound)
        self.assertEqual(d.lbound, lbound)
        self.assertEqual(d.ubound, ubound)

    def test_mean_range(self):
        d = numbergen.UniformRandom(mean=4.0, range=2.0)
        self.assertEqual(d.lbound, 3.0)
        self.assertEqual(d.ubound, 5.0)

    def test_default_mean(self):
        d = numbergen.UniformRandom(range=2.0)
        self.assertEqual(d.lbound, -1.0)
        self.assertEqual(d.ubound, 1.0)

    def test_lbound_ubound_mean_range(self):
        def f():
            numbergen.UniformRandom(lbound=1.0, ubound=2.0, mean=2.0)
        self.assertRaises(TypeError, f)

cases = [
            TestUniformRandomMeanRange,
        ]

suite = unittest.TestSuite()

suite.addTests([unittest.makeSuite(case) for case in cases])

if __name__ == '__main__':
    unittest.TextTestRunner(verbosity=1).run(suite)


text:
// socket具体业务逻辑
export default class socketHander {

	/**
	 * [saveUserSocketId 保存用户的id和socketid]
	 * @param  {[type]} userId   [用户id]
	 * @param  {[type]} socketId [用户的socketid]
	 * @return {[type]}          [description]
	 */
	static async saveUserSocketId(userId, socketId) {
		const sql='update user set socketid=? where id=? limit 1 '
		await query(sql,[socketId,userId])
	}

	/**
	 * [getUserSocketId 获取指定用户的socketid]
	 * @param  {[type]} toUserId [指定用户的id]
	 * @return {[type]}          [description]
	 */
	static async getUserSocketId(toUserId) {
		const sql='select socketid from user where id=? limit 1 '
		const row= await query(sql,[toUserId])
		return row[0].socketid
	}

    /**
     * [changeUser 用户切换账号]
     * @param  {[type]} currentUserId [原来的用户ID]
     * @param  {[type]} userId        [新用户id]
     * @param  {[type]} socketId      [新用户的socket]
     * @return {[type]}               [description]
     */
	static async changeUser(currentUserId,userId,socketId){
		let sql="update user set socketid='' where id=? limit 1"
		await query(sql,[currentUserId])

		sql='update user set socketid=? where id=? limit 1 '
		await query(sql,[socketId,userId])
	}
}


text:
//  SDLUnregisterAppInterface.h
//

#import "SDLRPCRequest.h"

/**
 * Terminates an application's interface registration. This causes SDL® to
 * dispose of all resources associated with the application's interface
 * registration (e.g. Command Menu items, Choice Sets, button subscriptions,
 * etc.)
 *

 * After the UnregisterAppInterface operation is performed, no other operations
 * can be performed until a new app interface registration is established by
 * calling {@linkplain RegisterAppInterface}
 *

 * HMILevel can be FULL, LIMITED, BACKGROUND or NONE
 *

 *
 * See SDLRegisterAppInterface SDLOnAppInterfaceUnregistered
 */

NS_ASSUME_NONNULL_BEGIN

@interface SDLUnregisterAppInterface : SDLRPCRequest

@end

NS_ASSUME_NONNULL_END


text:
package org.rapidpm.microservice.rest.ddi;

import org.jboss.resteasy.spi.*;
import org.rapidpm.ddi.DI;

import javax.ws.rs.WebApplicationException;
import java.lang.reflect.Type;

/**
 * This ConstructorInjector implementation uses DDI to obtain
 * a contextual instance of a bean.
 *
 * @author Sven Ruppert
 */
public class DdiConstructorInjector implements ConstructorInjector {
  public static final Object[] OBJECTS = new Object[0];

  private Type type;

  public DdiConstructorInjector(Type type) {
    this.type = type;
  }

  public Object construct() {

    //TODO create instance wit injected properties ?
    try {
      final Object t = ((Class) type).newInstance();
      DI.getInstance().activateDI(t);
      return t;
    } catch (InstantiationException | IllegalAccessException e) {
      e.printStackTrace();
    }
    return null;
  }

  public Object construct(HttpRequest request, HttpResponse response) throws Failure, WebApplicationException, ApplicationException {
    return construct();
  }

  public Object[] injectableArguments() {
    return OBJECTS;
  }

  public Object[] injectableArguments(HttpRequest request, HttpResponse response) throws Failure {
    return injectableArguments();
  }
}


text:
A Makefile and directory structure for building new C Projects or Libraries

## Howto use NewProj ##

* Clone or fork this repo
* Remove the `.git` folder and `.gitignore` file (if need be)
* Rename `LICENSE` to `LICENSE.Makefile`
* Rename `README.md` to `README.Makefile.md`
* Customize the project layout and `Makefile` to your needs

If you're building an binary,
* In `Makefile`, define `EXE`
* Put your code in `src/`
* Put your headers in `src/inc/`
* Put your tests in `t/`
* Then you can type `make`, `make test`, `make install`, `make showconfig`, `make WITH_DEBUG=1`, `make WITH_PROFILING=1`

If you're building a library
* In `Makefile`, define `LNK`
* Put your code in `src/lib/`
* Put your headers in `include/`
* Put your tests in `t/`
* Then you can type `make`, `make test`, `make install`, `make showconfig`, `make WITH_DEBUG=1`, `make WITH_PROFILING=1`

With `watch` installed, you can do continuous integration, test, or deployment.
* For continuous integration (`make clean all`), type `make start_ci`.  To kill it, type `make stop_ci`
* For continuous test (`make test`), type `make start_ct`.  To kill it, type `make stop_cd`
* For continuous deployment (`make install`), type `make start_cd`.  To kill it, type `make stop_cd`

You can also customize `CFLAGS`, `LDFLAGS`, `DESTDIR` from the command line or in the `Makefile`


text:
namespace blink {

static inline GridTrackSizingDirection DirectionFromSide(
    GridPositionSide side) {
  return side == kColumnStartSide || side == kColumnEndSide ? kForColumns
                                                            : kForRows;
}

static inline String ImplicitNamedGridLineForSide(const String& line_name,
                                                  GridPositionSide side) {
  return line_name + ((side == kColumnStartSide || side == kRowStartSide)
                          ? "-start"
                          : "-end");
}

NamedLineCollection::NamedLineCollection(
    const ComputedStyle& grid_container_style,
    const String& named_line,
    GridTrackSizingDirection direction,
    wtf_size_t last_line,
    wtf_size_t auto_repeat_tracks_count)
    : last_line_(last_line),
      auto_repeat_total_tracks_(auto_repeat_tracks_count) {
  bool is_row_axis = direction == kForColumns;
  const NamedGridLinesMap& grid_line_names =
      is_row_axis ? grid_container_style.NamedGridColumnLines()
                  : grid_container_style.NamedGridRowLines();
  const NamedGridLinesMap& auto_repeat_grid_line_names =
      is_row_axis ? grid_container_style.AutoRepeatNamedGridColumnLines()
                  : grid_container_style.AutoRepeatNamedGridRowLines();
  const NamedGridLinesMap& implicit_grid_line_names =
      is_row_axis ? grid_container_style.ImplicitNamedGridColumnLines()
                  : grid_container_style.ImplicitNamedGridRowLines();

  if (!grid_line_names.IsEmpty()) {
    auto it = grid_line_names.find(named_line);
    named_lines_indexes_ = it == grid_line_names.end() ? nullptr : &it->value;
  }

  if (!auto_repeat_grid_line_names.IsEmpty()) {
    auto it = auto_repeat_grid_line_names.find(named_line);
    auto_repeat_named_lines_indexes_ =
        it == auto_repeat_grid_line_names.end() ? nullptr : &it->value;
  }

  if (!implicit_grid_line_names.IsEmpty()) {
    auto it = implicit_grid_line_names.find(named_line);
    implicit_named_lines_indexes_ =
        it == implicit_grid_line_names.end() ? nullptr : &it->value;
  }

  insertion_point_ =
      is_row_axis ? grid_container_style.GridAutoRepeatColumnsInsertionPoint()
                  : grid_container_style.GridAutoRepeatRowsInsertionPoint();

  auto_repeat_track_list_length_ =
      is_row_axis ? grid_container_style.GridAutoRepeatColumns().size()
                  : grid_container_style.GridAutoRepeatRows().size();
}

bool NamedLineCollection::HasExplicitNamedLines() {
  return named_lines_indexes_ || auto_repeat_named_lines_indexes_;
}

bool NamedLineCollection::HasNamedLines() {
  return HasExplicitNamedLines() || implicit_named_lines_indexes_;
}

bool NamedLineCollection::Contains(wtf_size_t line) {
  CHECK(HasNamedLines());

  if (line > last_line_)
    return false;

  auto find = [](const Vector<wtf_size_t>* indexes, wtf_size_t line) {
    return indexes && indexes->Find(line) != kNotFound;
  };

  if (find(implicit_named_lines_indexes_, line))
    return true;

  if (auto_repeat_track_list_length_ == 0 || line < insertion_point_)
    return find(named_lines_indexes_, line);

  DCHECK(auto_repeat_total_tracks_);

  if (line > insertion_point_ + auto_repeat_total_tracks_)
    return find(named_lines_indexes_, line - (auto_repeat_total_tracks_ - 1));

  if (line == insertion_point_) {
    return find(named_lines_indexes_, line) ||
           find(auto_repeat_named_lines_indexes_, 0);
  }

  if (line == insertion_point_ + auto_repeat_total_tracks_) {
    return find(auto_repeat_named_lines_indexes_,
                auto_repeat_track_list_length_) ||
           find(named_lines_indexes_, insertion_point_ + 1);
  }

  wtf_size_t auto_repeat_index_in_first_repetition =
      (line - insertion_point_) % auto_repeat_track_list_length_;
  if (!auto_repeat_index_in_first_repetition &&
      find(auto_repeat_named_lines_indexes_, auto_repeat_track_list_length_))
    return true;
  return find(auto_repeat_named_lines_indexes_,
              auto_repeat_index_in_first_repetition);
}

wtf_size_t NamedLineCollection::FirstExplicitPosition() {
  DCHECK(HasExplicitNamedLines());

  wtf_size_t first_line = 0;

  // If there is no auto repeat(), there must be some named line outside, return
  // the 1st one. Also return it if it precedes the auto-repeat().
  if (auto_repeat_track_list_length_ == 0 ||
      (named_lines_indexes_ &&
       named_lines_indexes_->at(first_line) <= insertion_point_))
    return named_lines_indexes_->at(first_line);

  // Return the 1st named line inside the auto repeat(), if any.
  if (auto_repeat_named_lines_indexes_)
    return auto_repeat_named_lines_indexes_->at(first_line) + insertion_point_;

  // The 1st named line must be after the auto repeat().
  return named_lines_indexes_->at(first_line) + auto_repeat_total_tracks_ - 1;
}

wtf_size_t NamedLineCollection::FirstPosition() {
  CHECK(HasNamedLines());

  wtf_size_t first_line = 0;

  if (!implicit_named_lines_indexes_)
    return FirstExplicitPosition();

  if (!HasExplicitNamedLines())
    return implicit_named_lines_indexes_->at(first_line);

  return std::min(FirstExplicitPosition(),
                  implicit_named_lines_indexes_->at(first_line));
}

GridPositionSide GridPositionsResolver::InitialPositionSide(
    GridTrackSizingDirection direction) {
  return (direction == kForColumns) ? kColumnStartSide : kRowStartSide;
}

GridPositionSide GridPositionsResolver::FinalPositionSide(
    GridTrackSizingDirection direction) {
  return (direction == kForColumns) ? kColumnEndSide : kRowEndSide;
}

static void InitialAndFinalPositionsFromStyle(
    const ComputedStyle& grid_item_style,
    GridTrackSizingDirection direction,
    GridPosition& initial_position,
    GridPosition& final_position) {
  initial_position = (direction == kForColumns)
                         ? grid_item_style.GridColumnStart()
                         : grid_item_style.GridRowStart();
  final_position = (direction == kForColumns) ? grid_item_style.GridColumnEnd()
                                              : grid_item_style.GridRowEnd();

  // We must handle the placement error handling code here instead of in the
  // StyleAdjuster because we don't want to overwrite the specified values.
  if (initial_position.IsSpan() && final_position.IsSpan())
    final_position.SetAutoPosition();

  // If the grid item has an automatic position and a grid span for a named line
  // in a given dimension, instead treat the grid span as one.
  if (initial_position.IsAuto() && final_position.IsSpan() &&
      !final_position.NamedGridLine().IsNull())
    final_position.SetSpanPosition(1, g_null_atom);
  if (final_position.IsAuto() && initial_position.IsSpan() &&
      !initial_position.NamedGridLine().IsNull())
    initial_position.SetSpanPosition(1, g_null_atom);
}

static wtf_size_t LookAheadForNamedGridLine(
    int start,
    wtf_size_t number_of_lines,
    wtf_size_t grid_last_line,
    NamedLineCollection& lines_collection) {
  DCHECK(number_of_lines);

  // Only implicit lines on the search direction are assumed to have the given
  // name, so we can start to look from first line.
  // See: https://drafts.csswg.org/css-grid/#grid-placement-span-int
  wtf_size_t end = std::max(start, 0);

  if (!lines_collection.HasNamedLines()) {
    end = std::max(end, grid_last_line + 1);
    return end + number_of_lines - 1;
  }

  for (; number_of_lines; ++end) {
    if (end > grid_last_line || lines_collection.Contains(end))
      number_of_lines--;
  }

  DCHECK(end);
  return end - 1;
}

static int LookBackForNamedGridLine(int end,
                                    wtf_size_t number_of_lines,
                                    int grid_last_line,
                                    NamedLineCollection& lines_collection) {
  DCHECK(number_of_lines);

  // Only implicit lines on the search direction are assumed to have the given
  // name, so we can start to look from last line.
  // See: https://drafts.csswg.org/css-grid/#grid-placement-span-int
  int start = std::min(end, grid_last_line);

  if (!lines_collection.HasNamedLines()) {
    start = std::min(start, -1);
    return start - number_of_lines + 1;
  }

  for (; number_of_lines; --start) {
    if (start < 0 || lines_collection.Contains(start))
      number_of_lines--;
  }

  return start + 1;
}

static GridSpan DefiniteGridSpanWithNamedSpanAgainstOpposite(
    int opposite_line,
    const GridPosition& position,
    GridPositionSide side,
    int last_line,
    NamedLineCollection& lines_collection) {
  int start, end;
  if (side == kRowStartSide || side == kColumnStartSide) {
    start = LookBackForNamedGridLine(opposite_line - 1, position.SpanPosition(),
                                     last_line, lines_collection);
    end = opposite_line;
  } else {
    start = opposite_line;
    end = LookAheadForNamedGridLine(opposite_line + 1, position.SpanPosition(),
                                    last_line, lines_collection);
  }

  return GridSpan::UntranslatedDefiniteGridSpan(start, end);
}

wtf_size_t GridPositionsResolver::ExplicitGridColumnCount(
    const ComputedStyle& grid_container_style,
    wtf_size_t auto_repeat_tracks_count) {
  return std::min<wtf_size_t>(
      std::max(
          grid_container_style.GridTemplateColumns().LegacyTrackList().size() +
              auto_repeat_tracks_count,
          grid_container_style.NamedGridAreaColumnCount()),
      kGridMaxTracks);
}

wtf_size_t GridPositionsResolver::ExplicitGridRowCount(
    const ComputedStyle& grid_container_style,
    wtf_size_t auto_repeat_tracks_count) {
  return std::min<wtf_size_t>(
      std::max(
          grid_container_style.GridTemplateRows().LegacyTrackList().size() +
              auto_repeat_tracks_count,
          grid_container_style.NamedGridAreaRowCount()),
      kGridMaxTracks);
}

static wtf_size_t ExplicitGridSizeForSide(
    const ComputedStyle& grid_container_style,
    GridPositionSide side,
    wtf_size_t auto_repeat_tracks_count) {
  return (side == kColumnStartSide || side == kColumnEndSide)
             ? GridPositionsResolver::ExplicitGridColumnCount(
                   grid_container_style, auto_repeat_tracks_count)
             : GridPositionsResolver::ExplicitGridRowCount(
                   grid_container_style, auto_repeat_tracks_count);
}

static GridSpan ResolveNamedGridLinePositionAgainstOppositePosition(
    const ComputedStyle& grid_container_style,
    int opposite_line,
    const GridPosition& position,
    wtf_size_t auto_repeat_tracks_count,
    GridPositionSide side) {
  DCHECK(position.IsSpan());
  DCHECK(!position.NamedGridLine().IsNull());
  // Negative positions are not allowed per the specification and should have
  // been handled during parsing.
  DCHECK_GT(position.SpanPosition(), 0);

  wtf_size_t last_line = ExplicitGridSizeForSide(grid_container_style, side,
                                                 auto_repeat_tracks_count);
  NamedLineCollection lines_collection(
      grid_container_style, position.NamedGridLine(), DirectionFromSide(side),
      last_line, auto_repeat_tracks_count);
  return DefiniteGridSpanWithNamedSpanAgainstOpposite(
      opposite_line, position, side, last_line, lines_collection);
}

static GridSpan DefiniteGridSpanWithSpanAgainstOpposite(
    int opposite_line,
    const GridPosition& position,
    GridPositionSide side) {
  wtf_size_t position_offset = position.SpanPosition();
  if (side == kColumnStartSide || side == kRowStartSide)
    return GridSpan::UntranslatedDefiniteGridSpan(
        opposite_line - position_offset, opposite_line);

  return GridSpan::UntranslatedDefiniteGridSpan(
      opposite_line, opposite_line + position_offset);
}

static GridSpan ResolveGridPositionAgainstOppositePosition(
    const ComputedStyle& grid_container_style,
    int opposite_line,
    const GridPosition& position,
    GridPositionSide side,
    wtf_size_t auto_repeat_tracks_count) {
  if (position.IsAuto()) {
    if (side == kColumnStartSide || side == kRowStartSide)
      return GridSpan::UntranslatedDefiniteGridSpan(opposite_line - 1,
                                                    opposite_line);
    return GridSpan::UntranslatedDefiniteGridSpan(opposite_line,
                                                  opposite_line + 1);
  }

  DCHECK(position.IsSpan());
  DCHECK_GT(position.SpanPosition(), 0);

  if (!position.NamedGridLine().IsNull()) {
    // span 2 'c' -> we need to find the appropriate grid line before / after
    // our opposite position.
    return ResolveNamedGridLinePositionAgainstOppositePosition(
        grid_container_style, opposite_line, position, auto_repeat_tracks_count,
        side);
  }

  return DefiniteGridSpanWithSpanAgainstOpposite(opposite_line, position, side);
}

static wtf_size_t SpanSizeFromPositions(const GridPosition& initial_position,
                                        const GridPosition& final_position) {
  // This method will only be used when both positions need to be resolved
  // against the opposite one.
  DCHECK(initial_position.ShouldBeResolvedAgainstOppositePosition() &&
         final_position.ShouldBeResolvedAgainstOppositePosition());

  if (initial_position.IsAuto() && final_position.IsAuto())
    return 1;

  const GridPosition& span_position =
      initial_position.IsSpan() ? initial_position : final_position;
  DCHECK(span_position.IsSpan() && span_position.SpanPosition());
  return span_position.SpanPosition();
}

wtf_size_t GridPositionsResolver::SpanSizeForAutoPlacedItem(
    const ComputedStyle& grid_item_style,
    GridTrackSizingDirection direction) {
  GridPosition initial_position, final_position;
  InitialAndFinalPositionsFromStyle(grid_item_style, direction,
                                    initial_position, final_position);
  return SpanSizeFromPositions(initial_position, final_position);
}

static int ResolveNamedGridLinePositionFromStyle(
    const ComputedStyle& grid_container_style,
    const GridPosition& position,
    GridPositionSide side,
    wtf_size_t auto_repeat_tracks_count) {
  DCHECK(!position.NamedGridLine().IsNull());

  wtf_size_t last_line = ExplicitGridSizeForSide(grid_container_style, side,
                                                 auto_repeat_tracks_count);
  NamedLineCollection lines_collection(
      grid_container_style, position.NamedGridLine(), DirectionFromSide(side),
      last_line, auto_repeat_tracks_count);

  if (position.IsPositive())
    return LookAheadForNamedGridLine(0, abs(position.IntegerPosition()),
                                     last_line, lines_collection);

  return LookBackForNamedGridLine(last_line, abs(position.IntegerPosition()),
                                  last_line, lines_collection);
}

static int ResolveGridPositionFromStyle(
    const ComputedStyle& grid_container_style,
    const GridPosition& position,
    GridPositionSide side,
    wtf_size_t auto_repeat_tracks_count) {
  switch (position.GetType()) {
    case kExplicitPosition: {
      DCHECK(position.IntegerPosition());

      if (!position.NamedGridLine().IsNull())
        return ResolveNamedGridLinePositionFromStyle(
            grid_container_style, position, side, auto_repeat_tracks_count);

      // Handle <integer> explicit position.
      if (position.IsPositive())
        return position.IntegerPosition() - 1;

      wtf_size_t resolved_position = abs(position.IntegerPosition()) - 1;
      wtf_size_t end_of_track = ExplicitGridSizeForSide(
          grid_container_style, side, auto_repeat_tracks_count);

      return end_of_track - resolved_position;
    }
    case kNamedGridAreaPosition: {
      // First attempt to match the grid area's edge to a named grid area: if
      // there is a named line with the name ''<custom-ident>-start (for
      // grid-*-start) / <custom-ident>-end'' (for grid-*-end), contributes the
      // first such line to the grid item's placement.
      String named_grid_line = position.NamedGridLine();
      DCHECK(!position.NamedGridLine().IsNull());

      wtf_size_t last_line = ExplicitGridSizeForSide(grid_container_style, side,
                                                     auto_repeat_tracks_count);
      NamedLineCollection implicit_lines(
          grid_container_style,
          ImplicitNamedGridLineForSide(named_grid_line, side),
          DirectionFromSide(side), last_line, auto_repeat_tracks_count);
      if (implicit_lines.HasNamedLines())
        return implicit_lines.FirstPosition();

      // Otherwise, if there is a named line with the specified name,
      // contributes the first such line to the grid item's placement.
      NamedLineCollection explicit_lines(grid_container_style, named_grid_line,
                                         DirectionFromSide(side), last_line,
                                         auto_repeat_tracks_count);
      if (explicit_lines.HasNamedLines())
        return explicit_lines.FirstPosition();

      // If none of the above works specs mandate to assume that all the lines
      // in the implicit grid have this name.
      return last_line + 1;
    }
    case kAutoPosition:
    case kSpanPosition:
      // 'auto' and span depend on the opposite position for resolution (e.g.
      // grid-row: auto / 1 or grid-column: span 3 / "myHeader").
      NOTREACHED();
      return 0;
  }
  NOTREACHED();
  return 0;
}

GridSpan GridPositionsResolver::ResolveGridPositionsFromStyle(
    const ComputedStyle& grid_container_style,
    const ComputedStyle& grid_item_style,
    GridTrackSizingDirection direction,
    wtf_size_t auto_repeat_tracks_count) {
  GridPosition initial_position, final_position;
  InitialAndFinalPositionsFromStyle(grid_item_style, direction,
                                    initial_position, final_position);

  GridPositionSide initial_side = InitialPositionSide(direction);
  GridPositionSide final_side = FinalPositionSide(direction);

  if (initial_position.ShouldBeResolvedAgainstOppositePosition() &&
      final_position.ShouldBeResolvedAgainstOppositePosition()) {
    // We can't get our grid positions without running the auto placement
    // algorithm.
    return GridSpan::IndefiniteGridSpan(
        SpanSizeFromPositions(initial_position, final_position));
  }

  if (initial_position.ShouldBeResolvedAgainstOppositePosition()) {
    // Infer the position from the final position ('auto / 1' or 'span 2 / 3'
    // case).
    int end_line =
        ResolveGridPositionFromStyle(grid_container_style, final_position,
                                     final_side, auto_repeat_tracks_count);
    return ResolveGridPositionAgainstOppositePosition(
        grid_container_style, end_line, initial_position, initial_side,
        auto_repeat_tracks_count);
  }

  if (final_position.ShouldBeResolvedAgainstOppositePosition()) {
    // Infer our position from the initial position ('1 / auto' or '3 / span 2'
    // case).
    int start_line =
        ResolveGridPositionFromStyle(grid_container_style, initial_position,
                                     initial_side, auto_repeat_tracks_count);
    return ResolveGridPositionAgainstOppositePosition(
        grid_container_style, start_line, final_position, final_side,
        auto_repeat_tracks_count);
  }

  int start_line =
      ResolveGridPositionFromStyle(grid_container_style, initial_position,
                                   initial_side, auto_repeat_tracks_count);
  int end_line =
      ResolveGridPositionFromStyle(grid_container_style, final_position,
                                   final_side, auto_repeat_tracks_count);

  if (end_line < start_line)
    std::swap(end_line, start_line);
  else if (end_line == start_line)
    end_line = start_line + 1;

  return GridSpan::UntranslatedDefiniteGridSpan(start_line, end_line);
}

}  // namespace blink


text:
<?php
/**
 * The contents of this file was generated using the WSDLs as provided by eBay.
 *
 * DO NOT EDIT THIS FILE!
 */

namespace DTS\eBaySDK\Trading\Enums;

/**
 *
 */
class ItemFormatSortFilterCodeType
{
    const C_CUSTOM_CODE = 'CustomCode';
    const C_SHOW_ANY_ITEMS = 'ShowAnyItems';
    const C_SHOW_ITEMS_WITHBIN_FIRST = 'ShowItemsWithBINFirst';
    const C_SHOW_ONLY_ITEMS_WITHBIN = 'ShowOnlyItemsWithBIN';
    const C_SHOW_ONLY_STORE_ITEMS = 'ShowOnlyStoreItems';
}


text:
package com.haulmont.cuba.client.testsupport;

import com.haulmont.cuba.core.global.EntityStates;

/**
 *
 */
public class TestEntityStates extends EntityStates {

    @Override
    public boolean isLoaded(Object entity, String property) {
        return true;
    }

    @Override
    public void checkLoaded(Object entity, String... properties) {
    }
}


text:
from flask import Blueprint, render_template, current_app, request, flash, session, redirect, url_for

view_sessoes = Blueprint('sessoes', __name__)

@view_sessoes.route("/login")
def login():
    return render_template("sessoes/login.html")

@view_sessoes.route("/login", methods=["POST"])
def autenticar():
    usuario = current_app.autenticacao.autenticar(request.form['email'], request.form['senha'])

    if usuario:
        session['id_usuario'] = usuario.id
        flash('Autenticação bem sucedida')
        return redirect(url_for('pages.index'))
    else:
        flash('Usuário ou Senha Inválidos')
        return "Invalido"
        return redirect(url_for('sessoes.login'))

@view_sessoes.route("/logout")
def logout():
    session.pop('id_usuario', None)
    return redirect(url_for('sessoes.login'))


text:
package org.apache.camel.test.spring;

import java.lang.reflect.Method;
import java.util.Arrays;
import java.util.Collection;
import java.util.LinkedHashSet;
import java.util.Map;
import java.util.Map.Entry;
import java.util.Set;

import org.apache.camel.spring.SpringCamelContext;

import org.springframework.context.ApplicationContext;
import org.springframework.test.context.TestContext;

/**
 * Helper that provides state information across the levels of Spring Test that do not expose the
 * necessary context/state for integration of Camel testing features into Spring test.  Also
 * provides utility methods.
 * <p/>
 * Note that this class makes use of {@link ThreadLocal}s to maintain some state.  It is imperative
 * that the state setters and getters are accessed within the scope of a single thread in order
 * for this class to work right.
 */
public final class CamelSpringTestHelper {

    private static ThreadLocal<String> originalJmxDisabledValue = new ThreadLocal<>();
    private static ThreadLocal<Class<?>> testClazz = new ThreadLocal<>();
    private static ThreadLocal<TestContext> testContext = new ThreadLocal<>();

    private CamelSpringTestHelper() {
    }

    public static String getOriginalJmxDisabled() {
        return originalJmxDisabledValue.get();
    }

    public static void setOriginalJmxDisabledValue(String originalValue) {
        originalJmxDisabledValue.set(originalValue);
    }

    public static Class<?> getTestClass() {
        return testClazz.get();
    }

    public static void setTestClass(Class<?> testClass) {
        testClazz.set(testClass);
    }

    public static Method getTestMethod() {
        return testContext.get().getTestMethod();
    }

    public static void setTestContext(TestContext context) {
        testContext.set(context);
    }

    /**
     * Returns all methods defined in {@code clazz} and its superclasses/interfaces.
     */
    public static Collection<Method> getAllMethods(Class<?> clazz)  {
        Set<Method> methods = new LinkedHashSet<>();
        Class<?> currentClass = clazz;

        while (currentClass != null) {
            methods.addAll(Arrays.asList(clazz.getMethods()));
            currentClass = currentClass.getSuperclass();
        }

        return methods;
    }

    /**
     * Executes {@code strategy} against all {@link SpringCamelContext}s found in the Spring context.
     * This method reduces the amount of repeated find and loop code throughout this class.
     *
     * @param context the Spring context to search
     * @param strategy the strategy to execute against the found {@link SpringCamelContext}s
     *
     * @throws Exception if there is an error executing any of the strategies
     */
    public static void doToSpringCamelContexts(ApplicationContext context, DoToSpringCamelContextsStrategy strategy) throws Exception {
        Map<String, SpringCamelContext> contexts = context.getBeansOfType(SpringCamelContext.class);

        for (Entry<String, SpringCamelContext> entry : contexts.entrySet()) {
            strategy.execute(entry.getKey(), entry.getValue());
        }
    }

    public interface DoToSpringCamelContextsStrategy {
        void execute(String contextName, SpringCamelContext camelContext) throws Exception;
    }
}


text:
$GTS_HOME = $ENV{"GTS_HOME"};
if ("$GTS_HOME" eq "") {
    print "WARNING: GTS_HOME not defined!\n";
    use Cwd 'realpath';
    use File::Basename;
    my $REAL_PATH = realpath($0);
    my $EXEC_BIN = dirname($REAL_PATH);
    require "$EXEC_BIN/common.pl";
} else {
    require "$GTS_HOME/bin/common.pl";
}
# -----------------------------------------------------------------------------

$Standard_Tables = "$GTS_STD_PKG.db.tables";
$OpenDMTP_Tables = "$GTS_STD_PKG.db.dmtp";
$Extra_Tables    = "$GTS_STD_PKG.extra.tables";
$Rule_Tables     = "$GTS_STD_PKG.rule.tables";
$BCross_Tables   = "$GTS_STD_PKG.bcross.tables";

# --- Entry points
%Class_names = (
    "Account"           => $Standard_Tables . ".Account",
    "AccountString"     => $Standard_Tables . ".AccountString",
    "Device"            => $Standard_Tables . ".Device",
    "DeviceGroup"       => $Standard_Tables . ".DeviceGroup",
    "DeviceList"        => $Standard_Tables . ".DeviceList",
    "Driver"            => $Standard_Tables . ".Driver",
    "Geozone"           => $Standard_Tables . ".Geozone",
    "Resource"          => $Standard_Tables . ".Resource",
    "Role"              => $Standard_Tables . ".Role",
    "RoleAcl"           => $Standard_Tables . ".RoleAcl",
    "StatusCode"        => $Standard_Tables . ".StatusCode",
    "SystemProps"       => $Standard_Tables . ".SystemProps",
    "Transport"         => $Standard_Tables . ".Transport",
    "UniqueXID"         => $Standard_Tables . ".UniqueXID",
    "User"              => $Standard_Tables . ".User",
    "UserAcl"           => $Standard_Tables . ".UserAcl",
    # --
    "PendingPacket"     => $OpenDMTP_Tables . ".PendingPacket",
    "Property"          => $OpenDMTP_Tables . ".Property",
    # --
    "Entity"            => $Extra_Tables    . ".Entity",
    "SessionStats"      => $Extra_Tables    . ".SessionStats",
    "UnassignedDevices" => $Extra_Tables    . ".UnassignedDevices",
    # --
    "GeoCorridor"       => $Rule_Tables     . ".GeoCorridor",
    "GeoCorridorList"   => $Rule_Tables     . ".GeoCorridorList",
    "Rule"              => $Rule_Tables     . ".Rule",
    "RuleList"          => $Rule_Tables     . ".RuleList",
    # --
    "BorderCrossing"    => $BCross_Tables   . ".BorderCrossing",
);

# --- Named entry point
$TableName = $ARGV[0];
$Entry_point = $Class_names{$TableName};
if ("$Entry_point" eq "") {
    print "TableName not found: $TableName\n";
    exit(1);
}
shift;

# --- debug
$DebugMode = "";
$_DebugMode = $ARGV[0];
if (("$_DebugMode" eq "-debug") || ("$_DebugMode" eq "-debugMode")) {
    $GTS_DEBUG = 1;
    $DebugMode = "-debugMode=true";
}

# --- Java command
$CP          = "-classpath '$CLASSPATH'";
$Command     = "$cmd_java $CP $Entry_point -conf=$GTS_CONF $DebugMode -log.file.enable=false";

# --- execute
my $args = join(' ', @ARGV);
my $cmd  = $Command . " $args";
&sysCmd($cmd, $GTS_DEBUG);
exit(0);

# -----------------------------------------------------------------------------


text:
var React = require('react');
var expect = require('chai').expect;
var buildMarty = require('../../../test/lib/buildMarty');
var { renderIntoDocument } = require('react/addons').addons.TestUtils;

describe('Marty.createAppMixin()', function () {
  var actualApp, Marty, app;

  beforeEach(function () {
    Marty = buildMarty();
    app = new Marty.Application();

    var Component = React.createClass({
      mixins: [Marty.createAppMixin()],
      render() {
        actualApp = this.app;
        return false;
      },
      getInitialState() {
        return {};
      }
    });

    renderIntoDocument(<Component app={app} />);
  });

  it('should expose the app', () => {
    expect(actualApp).to.eql(app);
  });
});


text:
	/////// //////////////////
	/////// PROJECT: MTA iLife - German Fun Reallife Gamemode
	/////// VERSION: 1.7.2
	/////// DEVELOPERS: See DEVELOPERS.md in the top folder
	/////// LICENSE: See LICENSE.md in the top folder
	/////// /////////////////
]]

CBankVendorManager = inherit(cSingleton)

function CBankVendorManager:constructor()
	local start = getTickCount()
	local result = CDatabase:getInstance():query("SELECT * FROM bankvendor")
	for key,value in ipairs(result) do
		local int,dim,x,y,z,rx,ry,rz
		int = gettok(value["Koords"],1,"|")
		dim = gettok(value["Koords"],2,"|")
		x = gettok(value["Koords"],3,"|")
		y = gettok(value["Koords"],4,"|")
		z = gettok(value["Koords"],5,"|")
		rx = gettok(value["Koords"],6,"|")
		ry = gettok(value["Koords"],7,"|")
		rz = gettok(value["Koords"],8,"|")
		local vendor = createObject(2942, x,y,z,rx,ry,rz, false)
		enew(vendor, CBankVendor, value["ID"], value["Koords"])
		cInformationWindowManager:getInstance():addInfoWindow({x, y, z+1}, "Geldautomat", 30)
	end
	outputServerLog("Es wurden "..#result.." BankVendors gefunden! (" .. getTickCount() - start .. "ms)")
end

function CBankVendorManager:destructor()

end


text:
import { Component } from '@angular/core';
import { ActivatedRoute, Router } from '@angular/router';
import { BookServiceService } from '../service/book-service.service';
import { Book } from '../model/book';

@Component({
  selector: 'app-book-form',
  templateUrl: './book-form.component.html',
  styleUrls: ['./book-form.component.css']
})
export class BookFormComponent {

  book : Book;

  constructor(
      private route: ActivatedRoute,
        private router: Router,
          private bookService: BookServiceService) {
      this.book = new Book();
    }

    onSubmit(book:Book) {
      this.bookService.save(book).subscribe(result => this.gotoBookList());
    }

    gotoBookList() {
      this.router.navigate(['/books']);
    }

}


text:
cask "ledger-live" do
  version "2.33.1"
  sha256 "c7eddd9178d41da63ac2f1657895476c239a4805eaf7e5e8a741e09418d8b9a6"

  url "https://github.com/LedgerHQ/ledger-live-desktop/releases/download/v#{version}/ledger-live-desktop-#{version}-mac.dmg",
      verified: "github.com/LedgerHQ/ledger-live-desktop/"
  name "Ledger Live"
  desc "Wallet desktop application to maintain multiple cryptocurrencies"
  homepage "https://www.ledgerwallet.com/live"

  livecheck do
    url :url
    strategy :github_latest
  end

  auto_updates true

  app "Ledger Live.app"

  uninstall quit: [
    "com.ledger.live",
    "com.ledger.live.helper",
  ]

  zap trash: [
    "~/Library/Application Support/Ledger Live",
    "~/Library/Preferences/com.ledger.live.plist",
    "~/Library/Saved Application State/com.ledger.live.savedState",
  ]
end


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
Cat. Pl. Mars. 181 (1845)

#### Original name
Hysterium cocciferum Castagne

### Remarks
null


text:
<?php
namespace Phasty\Process {
    use \Phasty\Log\File as log;
    class Child extends \Phasty\Events\Eventable {
        protected $outStream = null;
        public function __construct(Child\CallableClass $object) {
            $this->outStream = new \Phasty\Stream\Stream(STDOUT);

            $object->on(null, function($event) {
                log::info("Event {$event->getName()} on object");
                $this->trigger($event);
            });

            $this->on(null, function($event) {
                log::info("Event {$event->getName()} on process");
                $this->outStream->write($event);
            });
            $this->trigger("start", getmypid());
            $this->setHandlers();
        }

        protected function setHandlers() {
            register_shutdown_function([$this, 'shutdownHandler']);
            set_error_handler([$this, 'errorHandler']);
        }

        public function shutdownHandler() {
            $error = error_get_last();
            if ($error) {
//                if ($error[ "type" ] & (E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR)) {
                    $this->trigger("error", $error);
//                }
            }
            $this->trigger("stop");
        }

        public function errorHandler($errno, $errstr, $errfile, $errline, array $errcontext) {
            $error = compact("errno", "errstr", "errfile", "errline");
            if ((int)$errno & (E_ERROR | E_PARSE | E_CORE_ERROR | E_COMPILE_ERROR | E_WARNING)) {
                $this->trigger("error", $error);
            }
            log::error(var_export($error, 1));
        }

        static public function getClass() {
            return get_called_class();
        }
    }
}


text:
Configuration |
            Webhook Configuration

  Webhook Configuration
             (Configure a Webhook)

            <button [disabled]="!enableaddWebhook" mat-icon-button (click)="addWebHook()">
                <mat-icon title="Add New WebHook" style="margin-top: 10%;" class="mat-icon material-icons">

                    add_circle
                </mat-icon>
            </button>

            <button [disabled]="!enablesubscribe" mat-icon-button (click)="actionSubscribeOrUnsubscribe( true)">
                <mat-icon title="Subscribe" style="margin-top: 12%;" class="mat-icon material-icons">
                    rss_feed
                </mat-icon>
            </button>

            <button [disabled]="!enableunsubscribe" *ngIf="!enableunsubscribe" mat-icon-button (click)="actionSubscribeOrUnsubscribe( false)">
                <mat-icon class="svgIconCss" title="Unsubscribe" svgIcon="unsubscribe_webhookDeactive">
                </mat-icon>
            </button>

            <button *ngIf="enableunsubscribe" mat-icon-button (click)="actionSubscribeOrUnsubscribe( false)">
                <mat-icon class="svgIconCss" title="Unsubscribe" svgIcon="unsubscribe_webhook">
                </mat-icon>
            </button>
            <button mat-icon-button (click)="editWebhook()" [disabled]="!enableEdit">
                <mat-icon title="Edit" class="mat-icon material-icons">
                    edit
                </mat-icon>
            </button>
            <button [disabled]="!showAddWebHook" mat-icon-button (click)="validateWebhookData()">
                <mat-icon title="Save" style="margin-top: 12%;" class="mat-icon material-icons">
                    save
                </mat-icon>
            </button>
            <button mat-icon-button (click)="uninstallWebHook()" [disabled]="!enableDelete">
                <mat-icon title="Delete" style="margin-bottom: -10%;" class="mat-icon material-icons">
                    delete
                </mat-icon>
            </button>
            <button *ngIf="enableDelete" mat-icon-button>
                <mat-icon class="svgIconCssCopyClipboard" style="margin-top: 10%;" (click)="copyInputMessage(selectedWebhook)"
                    [ngxClipboard]="value_to_copy" title="Copy the Webhook Url to Clipboard" svgIcon="webhookCopyClipboard">
                </mat-icon>
            </button>
            <button disabled *ngIf="!enableDelete" mat-icon-button>
                <mat-icon class="svgIconCssCopyClipboardDisable" style="margin-top: 10%;" (click)="copyInputMessage(selectedWebhook)"
                    [ngxClipboard]="value_to_copy" svgIcon="webhookCopyClipboard">
                </mat-icon>
            </button>
            <button mat-icon-button (click)="Refresh()" [disabled]="!enableRefresh">
                <mat-icon title="Refresh" style="margin-top: 10%;" class="mat-icon material-icons">
                    cancel
                </mat-icon>
            </button>

            <button *ngIf="enableWebhookicon" mat-icon-button (click)="list()">
                <mat-icon svgIcon="redirect_icon" title="Redirect To Landing Page" style="margin-bottom: 20%;" class="mat-icon material-icons">
                </mat-icon>
            </button>

            <mat-radio-group [(ngModel)]="selectedWebhook">

                    <ng-container matColumnDef="radio">

                            <mat-radio-button [value]="element" [checked]="refreshRadio" color="primary" (click)="enableButtons(element)"></mat-radio-button>

                    </ng-container>
                    <ng-container matColumnDef="WebHookName">
                        Webhook Name

                            {{element.webhookName}}

                    </ng-container>
                    <ng-container matColumnDef="ToolName">
                        Tool Name

                            {{element.toolName}}

                    </ng-container>
                    <ng-container matColumnDef="LabelName" >
                        Label Name

                            {{element.labelDisplay}}

                    </ng-container>
                    <ng-container matColumnDef="DataType">
                        Data Format

                            {{element.dataFormat}}
                    </ng-container>
                    <ng-container matColumnDef="MqChannel">
                        MQ Channel

                            {{element.mqChannel}}
                    </ng-container>
                    <ng-container matColumnDef="Status">
                        Subscription Status

                            {{element.subscribeStatus}}
                    </ng-container>

            </mat-radio-group>

                            Add details to Configure a Webhook
                            (Please provide accurate details to Configure a Webhook.
                                Fields marked "*" are mandatory)

                            Webhook Name
                            *

                            <input maxlength="40" [disabled]="disableInputFields" [ngClass]="{'input-disabled' : disableInputFields ,  'form-control': !disableInputFields}"
                                type="text" [(ngModel)]="webhookName" name="webhookName" (ngModelChange)="changeMqChannel()">

                            Please input a logical Webhook Name to make it simplier to
                                identify

                            Select Tool
                            *

                            <mat-select [(ngModel)]="selectedTool" required name="selectedTool" class="form-control"
                                placeholder="Select Tool" (ngModelChange)="onToolSelect(selectedTool)" color="primary">
                                <mat-option *ngFor=" let tool of toolsArr | keyvalue" value="{{tool.value}}">
                                    {{tool.value}}</mat-option>
                            </mat-select>

                            Please select a Tool to Configure a Webhook

                            Is Event Processing

                            <mat-slide-toggle (toggleChange)="onEventChange()" [disabled]="isUpdateRequired || !isToolSelected "  [(ngModel)]="isEventProcessing" [checked]="isEventProcessing" style="margin-right: 15%;margin-left: 9%;">
                            </mat-slide-toggle>

                            Select this field if you want to use webhook for event processing.

                            Label Name
                            *

                            <input (focusout)="onLabelFocusOut()" [disabled]="isEventProcessing" [ngClass]="{'input-disabled' : isEventProcessing , 'form-control': !isEventProcessing}" maxlength="40" type="text" class="form-control" [(ngModel)]="labelDisplay" name="labelDisplay">

                             Label Name for which the Webhook will be configured.
(FORMAT
                                :- TOOL_CATEGORY:LABEL_NAME:DATA)

                            Data Format

                            <mat-select [(ngModel)]="dataformat" required name="dataformat" class="form-control"
                                placeholder="Select Data Format" color="primary">
                                <mat-option *ngFor="let dataformat of dataformats" [value]="dataformat.value">
                                    {{dataformat.viewValue}}
                                </mat-option>
                            </mat-select>

                            Please select either a JSON file or Application\Application.txt
                                file
                                as Data Format

                            MQ Channel
                            *

                            <input disabled class="input-disabled" type="text" [(ngModel)]="mqchannel" name="mqchannel">

                            A MQ Channel Name for pushing the Data

                            Response Template

                            <textarea [(ngModel)]="responseTemplate" name="responseTemplate" class="frmTxtarea"
                                required style="width: 85%;resize: none;"></textarea>

                            Please add response Template.It can be used in
                                generaic case of a JSON object. multiple values are seperated with comma.

                            Dynamic Template

                            <textarea [(ngModel)]="dynamicTemplate" name="dynamicTemplate" class="frmTxtarea" required
                                style="width: 85%;resize: none;"></textarea>

                            Please add Dynamic Template, Dynamic Template used when user want
                                process complex json structure like Json Array.

                            Is Node updation required?

                            <mat-slide-toggle [disabled]="isEventProcessing" [(ngModel)]="isUpdateRequired" [checked]="isUpdateRequired" style="margin-right: 15%;margin-left: 9%;">
                            </mat-slide-toggle>
                            <input *ngIf="isUpdateRequired" [(ngModel)]="fieldUsedForUpdate" class="nodeUpdateCss" type="text"
                                placeholder="Field required for updation">

                            Enter the field,based on which the nodes in Neo4j will be
                                merged.

                            InsightsTimex
                            *

                                Time Field
                                <input class="form-control" type="text" style="margin-bottom: -2%;width: 58%;margin-left: 27%;margin-top: -8%;"
                                    [(ngModel)]="item.operationFields.timeField" name={{item.operationFields.timeField}}
                                    placeholder=" Time Field">

                                Epoch Time
                                <mat-slide-toggle [(ngModel)]="item.operationFields.epochTime" [checked]="epochTime"
                                    name={{item.operationFields.epochTime}} style="margin-right: 15%;margin-left: 9%;">
                                </mat-slide-toggle>

                                Time
                                    Format
                                <input class="form-control" *ngIf="!item.operationFields.epochTime" type="text" style="margin-bottom:2%;width: 58%;margin-left: 27%;margin-top: -8%;"
                                    [(ngModel)]="item.operationFields.timeFormat" name={{item.operationFields.timeFormat}}
                                    placeholder="Time Format">

                            Please add insights timex fields. Time field value must be the
                                value(after assignment operator) of the last key-pair of response template.

                            Add Time Fields

                                Time Field
                                <input class="form-control enrichDataInputFields" type="text" [(ngModel)]="item.operationFields.mappingTimeField"
                                    name={{item.operationFields.mappingTimeField}} placeholder="Time Field">
                                Time Format
                                <input class="form-control enrichDataInputFields" type="text" [(ngModel)]="item.operationFields.mappingTimeFormat"
                                    name={{item.operationFields.mappingTimeFormat}} placeholder="Time Format">
                                <button mat-icon-button (click)="deleteTimeFieldMappings(i)">
                                    <mat-icon style="color: #0033a0" title="Remove Time Fields" class="mat-icon material-icons">
                                        remove_circle
                                    </mat-icon>
                                </button>

                            <button mat-icon-button (click)="addTimeFieldMappings()">
                                <mat-icon title="Add Time Field Mapping" class="mat-icon material-icons">

                                    add_circle
                                </mat-icon>
                            </button>

                            Please add time field mappings. Time field value must be the
                                value(after assignment operator) of the last key-pair of response template.

                            Data Enrichment

                                Source Property
                                <input class="form-control enrichDataInputFields" type="text" [(ngModel)]="item.operationFields.sourceProperty"
                                    name={{item.operationFields.sourceProperty}} placeholder="Source Property">
                                Key Pattern
                                <input class="form-control enrichDataInputFields" type="text" [(ngModel)]="item.operationFields.keyPattern"
                                    name={{item.operationFields.keyPattern}} placeholder="Key Pattern">
                                Target Property
                                <input class="form-control enrichDataInputFields" type="text" [(ngModel)]="item.operationFields.targetProperty"
                                    name={{item.operationFields.targetProperty}} placeholder="Target Property">
                                <button mat-icon-button (click)="deleteEnrichmentData(i)">
                                    <mat-icon style="color: #0033a0" title="Remove Time Fields" class="mat-icon material-icons">
                                        remove_circle
                                    </mat-icon>
                                </button>

                            <button mat-icon-button (click)="addDataEnrichment()">
                                <mat-icon title="Add Data Enrichment" class="mat-icon material-icons">

                                    add_circle
                                </mat-icon>
                            </button>

                            Please add enrich data fields

                            Event Config Details

                            <textarea [(ngModel)]="eventConfig" name="eventConfig" class="frmTxtarea" required
                                style="width: 85%;resize: none;"></textarea>

                            Fill this config template for event processing


text:
<?xml version="1.0" encoding="ascii"?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
          "DTD/xhtml1-transitional.dtd">

  <title>service.dao.AccountDAO</title>
  <link rel="stylesheet" href="epydoc.css" type="text/css" />

         Trees

         Indices

         Help

Jisc Publications Router - SWORDv2 repository depositor

        Package service ::
        Module dao ::
        Class AccountDAO

[hide private]

[frames] | no frames]

Class AccountDAO

source code

  <map id="uml_class_diagram_for_service_" name="uml_class_diagram_for_service_">
<area shape="rect" id="node1_2" href="service.dao.AccountDAO-class.html#__type__" title="service.dao.AccountDAO.__type__" alt="" coords="17,31,176,51"/>
<area shape="rect" id="node1_3" href="service.dao.AccountDAO-class.html#with_sword_activated" title="List all accounts in JPER that have sword deposit activated" alt="" coords="17,53,176,73"/>
<area shape="rect" id="node1" href="service.dao.AccountDAO-class.html" title="DAO for Account" alt="" coords="5,5,187,80"/>
</map>

DAO for Account

        Class Methods
        [hide private]

          with_sword_activated(cls)

      List all accounts in JPER that have sword deposit activated

            source code

        Class Variables
        [hide private]

        __type__ = "account"

        Method Details
        [hide private]

with_sword_activated(cls)

Class Method

  	source code

  List all accounts in JPER that have sword deposit activated

Returns:

list of sword enabled accounts

         Trees

         Indices

         Help

Jisc Publications Router - SWORDv2 repository depositor

    Generated by Epydoc 3.0.1 on Wed Nov 25 09:18:47 2015

      http://epydoc.sourceforge.net


text:
FROM node:8

EXPOSE 8888

VOLUME /app

WORKDIR /app
RUN npm install -g supervisor
#If you have problem with links on windows use this intead of npm install
#RUN npm install
#CMD npm install --no-bin-links && node server.js
ADD package.json package.json
COPY entrypoint.sh /root/entrypoint.sh
RUN chmod +x /root/entrypoint.sh
ENTRYPOINT /root/entrypoint.sh

#CMD supervisor server.js