text:
Mutest::Meta::Example.add :send do
  source 'a > b'

  singleton_mutations
  mutation 'a == b'
  mutation 'a.eql?(b)'
  mutation 'a.equal?(b)'
  mutation 'nil > b'
  mutation 'self > b'
  mutation 'a > nil'
  mutation 'a > self'
  mutation 'a'
  mutation 'b'
end

Mutest::Meta::Example.add :send do
  source 'A.const_get(:B)'

  singleton_mutations
  mutation 'A::B'
  mutation 'A.const_get'
  mutation 'A'
  mutation ':B'
  mutation 'A.const_get(nil)'
  mutation 'A.const_get(self)'
  mutation 'A.const_get(:B__mutest__)'
  mutation 'self.const_get(:B)'
end

Mutest::Meta::Example.add :send do
  source 'A.const_get(:B, true)'

  singleton_mutations
  mutation 'A'
  mutation 'A::B'
  mutation 'self.const_get(:B, true)'
  mutation 'A.const_get'
  mutation 'A.const_get(nil, true)'
  mutation 'A.const_get(self, true)'
  mutation 'A.const_get(:B__mutest__, true)'
  mutation 'A.const_get(true)'
  mutation 'A.const_get(:B, false)'
  mutation 'A.const_get(:B)'
end

Mutest::Meta::Example.add :send do
  source 'A.const_get(:B)'

  singleton_mutations
  mutation 'A::B'
  mutation 'A.const_get'
  mutation 'A'
  mutation ':B'
  mutation 'A.const_get(nil)'
  mutation 'A.const_get(self)'
  mutation 'A.const_get(:B__mutest__)'
  mutation 'self.const_get(:B)'
end

Mutest::Meta::Example.add :send do
  source 'A.const_get(bar)'

  singleton_mutations
  mutation 'A.const_get'
  mutation 'A'
  mutation 'bar'
  mutation 'A.const_get(nil)'
  mutation 'A.const_get(self)'
  mutation 'self.const_get(bar)'
end

Mutest::Meta::Example.add :send do
  source 'method(bar)'

  singleton_mutations
  mutation 'public_method(bar)'
  mutation 'method'
  mutation 'bar'
  mutation 'method(nil)'
  mutation 'method(self)'
end

Mutest::Meta::Example.add :send do
  source 'a >= b'

  singleton_mutations
  mutation 'a > b'
  mutation 'a == b'
  mutation 'a.eql?(b)'
  mutation 'a.equal?(b)'
  mutation 'nil >= b'
  mutation 'self >= b'
  mutation 'a >= nil'
  mutation 'a >= self'
  mutation 'a'
  mutation 'b'
end

Mutest::Meta::Example.add :send do
  source 'a <= b'

  singleton_mutations
  mutation 'a < b'
  mutation 'a == b'
  mutation 'a.eql?(b)'
  mutation 'a.equal?(b)'
  mutation 'nil <= b'
  mutation 'self <= b'
  mutation 'a <= nil'
  mutation 'a <= self'
  mutation 'a'
  mutation 'b'
end

Mutest::Meta::Example.add :send do
  source 'a < b'

  singleton_mutations
  mutation 'a == b'
  mutation 'a.eql?(b)'
  mutation 'a.equal?(b)'
  mutation 'nil < b'
  mutation 'self < b'
  mutation 'a < nil'
  mutation 'a < self'
  mutation 'a'
  mutation 'b'
end

Mutest::Meta::Example.add :send do
  source 'reverse_each'

  singleton_mutations
  mutation 'each'
end

Mutest::Meta::Example.add :send do
  source 'reverse_merge'

  singleton_mutations
  mutation 'merge'
end

Mutest::Meta::Example.add :send do
  source 'reverse_map'

  singleton_mutations
  mutation 'map'
  mutation 'each'
end

Mutest::Meta::Example.add :send do
  source 'map'

  singleton_mutations
  mutation 'each'
end

Mutest::Meta::Example.add :send do
  source 'flat_map'

  singleton_mutations
  mutation 'map'
end

Mutest::Meta::Example.add :send do
  source 'foo.to_s'

  singleton_mutations
  mutation 'foo'
  mutation 'self.to_s'
  mutation 'foo.to_str'
end

Mutest::Meta::Example.add :send do
  source 'foo.to_a'

  singleton_mutations
  mutation 'foo'
  mutation 'self.to_a'
  mutation 'foo.to_ary'
  mutation 'foo.to_set'
end

Mutest::Meta::Example.add :send do
  source 'foo.to_i'

  singleton_mutations
  mutation 'foo'
  mutation 'self.to_i'
  mutation 'foo.to_int'
  mutation 'Integer(foo)'
end

Mutest::Meta::Example.add :send do
  source 'foo.to_h'

  singleton_mutations
  mutation 'foo'
  mutation 'self.to_h'
  mutation 'foo.to_hash'
end

Mutest::Meta::Example.add :send do
  source 'foo == bar'

  singleton_mutations
  mutation 'foo'
  mutation 'bar'
  mutation 'nil == bar'
  mutation 'self == bar'
  mutation 'foo == nil'
  mutation 'foo == self'
  mutation 'foo.eql?(bar)'
  mutation 'foo.equal?(bar)'
end

Mutest::Meta::Example.add :send do
  source 'foo.is_a?(bar)'

  singleton_mutations
  mutation 'foo'
  mutation 'bar'
  mutation 'foo.is_a?'
  mutation 'foo.is_a?(nil)'
  mutation 'foo.is_a?(self)'
  mutation 'self.is_a?(bar)'
  mutation 'foo.instance_of?(bar)'
end

Mutest::Meta::Example.add :send do
  source 'foo.is_a?(bar)'

  singleton_mutations
  mutation 'foo'
  mutation 'bar'
  mutation 'foo.is_a?'
  mutation 'foo.is_a?(nil)'
  mutation 'foo.is_a?(self)'
  mutation 'self.is_a?(bar)'
  mutation 'foo.instance_of?(bar)'
end

Mutest::Meta::Example.add :send do
  source 'foo.kind_of?(bar)'

  singleton_mutations
  mutation 'foo'
  mutation 'bar'
  mutation 'foo.kind_of?'
  mutation 'foo.kind_of?(nil)'
  mutation 'foo.kind_of?(self)'
  mutation 'self.kind_of?(bar)'
  mutation 'foo.instance_of?(bar)'
end

Mutest::Meta::Example.add :send do
  source 'foo.gsub(a, b)'

  singleton_mutations
  mutation 'foo'
  mutation 'foo.gsub(a)'
  mutation 'foo.gsub(b)'
  mutation 'foo.gsub'
  mutation 'foo.sub(a, b)'
  mutation 'foo.gsub(a, nil)'
  mutation 'foo.gsub(a, self)'
  mutation 'foo.gsub(nil, b)'
  mutation 'foo.gsub(self, b)'
  mutation 'self.gsub(a, b)'
end

Mutest::Meta::Example.add :send do
  source 'foo.values_at(a, b)'

  singleton_mutations
  mutation 'foo.fetch_values(a, b)'
  mutation 'foo'
  mutation 'self.values_at(a, b)'
  mutation 'foo.values_at(a)'
  mutation 'foo.values_at(b)'
  mutation 'foo.values_at(nil, b)'
  mutation 'foo.values_at(self, b)'
  mutation 'foo.values_at(a, nil)'
  mutation 'foo.values_at(a, self)'
  mutation 'foo.values_at'
end

Mutest::Meta::Example.add :send do
  source 'foo.dig(a, b)'

  singleton_mutations
  mutation 'foo.fetch(a).dig(b)'
  mutation 'foo'
  mutation 'self.dig(a, b)'
  mutation 'foo.dig(a)'
  mutation 'foo.dig(b)'
  mutation 'foo.dig(nil, b)'
  mutation 'foo.dig(self, b)'
  mutation 'foo.dig(a, nil)'
  mutation 'foo.dig(a, self)'
  mutation 'foo.dig'
end

Mutest::Meta::Example.add :send do
  source 'foo.dig(a)'

  singleton_mutations
  mutation 'foo.fetch(a)'
  mutation 'foo'
  mutation 'self.dig(a)'
  mutation 'foo.dig(nil)'
  mutation 'foo.dig(self)'
  mutation 'foo.dig'
  mutation 'a'
end

Mutest::Meta::Example.add :send do
  source 'foo.dig'

  singleton_mutations
  mutation 'foo'
  mutation 'self.dig'
end

Mutest::Meta::Example.add :send do
  source 'foo.__send__(bar)'

  singleton_mutations
  mutation 'foo.__send__'
  mutation 'foo.public_send(bar)'
  mutation 'bar'
  mutation 'foo'
  mutation 'self.__send__(bar)'
  mutation 'foo.__send__(nil)'
  mutation 'foo.__send__(self)'
end

Mutest::Meta::Example.add :send do
  source 'foo.send(bar)'

  singleton_mutations
  mutation 'foo.send'
  mutation 'foo.public_send(bar)'
  mutation 'foo.__send__(bar)'
  mutation 'bar'
  mutation 'foo'
  mutation 'self.send(bar)'
  mutation 'foo.send(nil)'
  mutation 'foo.send(self)'
end

Mutest::Meta::Example.add :send do
  source 'self.booz = baz'

  singleton_mutations
  mutation 'self.booz = nil'
  mutation 'self.booz = self'
  mutation 'self.booz'
  mutation 'baz'
end

Mutest::Meta::Example.add :send do
  source 'foo.booz = baz'

  singleton_mutations
  mutation 'foo'
  mutation 'foo.booz = nil'
  mutation 'foo.booz = self'
  mutation 'self.booz = baz'
  mutation 'foo.booz'
  mutation 'baz'
end

Mutest::Meta::Example.add :send do
  source 'foo(*bar)'

  singleton_mutations
  mutation 'foo'
  mutation 'foo(nil)'
  mutation 'foo(bar)'
  mutation 'foo(self)'
  mutation 'foo(*self)'
end

Mutest::Meta::Example.add :send do
  source 'foo(&bar)'

  singleton_mutations
  mutation 'foo'
  mutation 'foo(&nil)'
  mutation 'foo(&self)'
end

Mutest::Meta::Example.add :send do
  source 'foo'

  singleton_mutations
end

Mutest::Meta::Example.add :send do
  source 'self.foo'

  singleton_mutations
  mutation 'foo'
end

Unparser::Constants::KEYWORDS.each do |keyword|
  Mutest::Meta::Example.add :send do
    source "self.#{keyword}"

    singleton_mutations
  end
end

Mutest::Meta::Example.add :send do
  source 'foo.bar'

  singleton_mutations
  mutation 'foo'
  mutation 'self.bar'
end

Mutest::Meta::Example.add :send do
  source 'self.class.foo'

  singleton_mutations
  mutation 'self.class'
  mutation 'self.foo'
end

Mutest::Meta::Example.add :send do
  source 'foo(nil)'

  singleton_mutations
  mutation 'foo'
end

Mutest::Meta::Example.add :send do
  source 'self.foo(nil)'

  singleton_mutations
  mutation 'self.foo'
  mutation 'foo(nil)'
end

Mutest::Meta::Example.add :send do
  source 'self.fetch(nil)'

  singleton_mutations
  mutation 'self.fetch'
  mutation 'fetch(nil)'
  mutation 'self.key?(nil)'
end

Unparser::Constants::KEYWORDS.each do |keyword|
  Mutest::Meta::Example.add :send do
    source "foo.#{keyword}(nil)"

    singleton_mutations
    mutation "self.#{keyword}(nil)"
    mutation "foo.#{keyword}"
    mutation 'foo'
  end
end

Mutest::Meta::Example.add :send do
  source 'foo(nil, nil)'

  singleton_mutations
  mutation 'foo()'
  mutation 'foo(nil)'
end

Mutest::Meta::Example.add :send do
  source '(left - right) / foo'

  singleton_mutations
  mutation 'foo'
  mutation '(left - right)'
  mutation 'left / foo'
  mutation 'right / foo'
  mutation '(left - right) / nil'
  mutation '(left - right) / self'
  mutation '(left - nil) / foo'
  mutation '(left - self) / foo'
  mutation '(nil - right) / foo'
  mutation '(self - right) / foo'
  mutation 'nil / foo'
  mutation 'self / foo'
end

Mutest::Meta::Example.add :send do
  source 'foo(n..-1)'

  singleton_mutations
  mutation 'foo'
  mutation 'n..-1'
  mutation 'foo(nil)'
  mutation 'foo(self)'
  mutation 'foo(n...-1)'
  mutation 'foo(nil..-1)'
  mutation 'foo(self..-1)'
  mutation 'foo(n..nil)'
  mutation 'foo(n..self)'
  mutation 'foo(n..0)'
  mutation 'foo(n..1)'
  mutation 'foo(n..-2)'
end

(Mutest::AST::Types::BINARY_METHOD_OPERATORS - %i[=~ <= >= < > == != eql? ===]).each do |operator|
  Mutest::Meta::Example.add :send do
    source "true #{operator} false"

    singleton_mutations
    mutation 'true'
    mutation 'false'
    mutation "false #{operator} false"
    mutation "true  #{operator} true"
  end
end

Mutest::Meta::Example.add :send do
  source 'a != b'

  singleton_mutations
  mutation 'nil != b'
  mutation 'self != b'
  mutation 'a'
  mutation 'b'
  mutation 'a != nil'
  mutation 'a != self'
  mutation '!a.eql?(b)'
  mutation '!a.equal?(b)'
end

Mutest::Meta::Example.add :send do
  source 'sample'

  singleton_mutations
  mutation 'first'
  mutation 'last'
end

Mutest::Meta::Example.add :send do
  source 'pop'

  singleton_mutations
  mutation 'last'
end

Mutest::Meta::Example.add :send do
  source 'shift'

  singleton_mutations
  mutation 'first'
end

Mutest::Meta::Example.add :send do
  source 'first'

  singleton_mutations
  mutation 'last'
end

Mutest::Meta::Example.add :send do
  source 'last'

  singleton_mutations
  mutation 'first'
end

Mutest::Meta::Example.add :send do
  source '!!foo'

  singleton_mutations
  mutation '!foo'
  mutation '!self'
  mutation '!!self'
  mutation 'foo'
end

Mutest::Meta::Example.add :send do
  source '!foo'

  singleton_mutations
  mutation 'foo'
  mutation '!self'
end

Mutest::Meta::Example.add :send do
  source '!foo&.!'

  singleton_mutations
  mutation 'foo&.!'
  mutation '!self'
  mutation '!foo'
  mutation '!self&.!'
  mutation '!(!foo)'
end

Mutest::Meta::Example.add :send do
  source 'custom.proc { }'

  singleton_mutations
  mutation 'custom.proc'
  mutation 'custom { }'
  mutation 'self.proc { }'
  mutation 'custom.proc { raise }'
end

Mutest::Meta::Example.add :send do
  source 'proc { }'

  singleton_mutations
  mutation 'proc'
  mutation 'proc { raise }'
  mutation 'lambda { }'
end

Mutest::Meta::Example.add :send do
  source 'Proc.new { }'

  singleton_mutations
  mutation 'Proc.new'
  mutation 'self.new { }'
  mutation 'Proc.new { raise }'
  mutation 'lambda { }'
end

Mutest::Meta::Example.add :send do
  source 'a =~ //'

  singleton_mutations
  mutation 'a'
  mutation 'nil =~ //'
  mutation 'self =~ //'
  mutation '//'
  mutation 'a =~ /nomatch\A/'
  mutation 'a.match?(//)'
end

Mutest::Meta::Example.add :send do
  source '//.match(a)'

  singleton_mutations
  mutation 'a'
  mutation '//.match'
  mutation '//.match(nil)'
  mutation '//.match(self)'
  mutation '//.match?(a)'
  mutation '//'
  mutation '/nomatch\A/.match(a)'
end

Mutest::Meta::Example.add :send do
  source 'a === b'

  singleton_mutations
  mutation 'a'
  mutation 'nil === b'
  mutation 'self === b'
  mutation 'b'
  mutation 'a === nil'
  mutation 'a === self'
  mutation 'a.kind_of?(b)'
end

Mutest::Meta::Example.add :send do
  source 'a.grep(b)'

  singleton_mutations
  mutation 'a'
  mutation 'b'
  mutation 'self.grep(b)'
  mutation 'a.grep'
  mutation 'a.grep(nil)'
  mutation 'a.grep(self)'
  mutation 'a.grep_v(b)'
end

Mutest::Meta::Example.add :send do
  source 'a.grep_v(b)'

  singleton_mutations
  mutation 'a'
  mutation 'b'
  mutation 'self.grep_v(b)'
  mutation 'a.grep_v'
  mutation 'a.grep_v(nil)'
  mutation 'a.grep_v(self)'
  mutation 'a.grep(b)'
end

Mutest::Meta::Example.add :send do
  source 'select'

  singleton_mutations
  mutation 'reject'
end

Mutest::Meta::Example.add :send do
  source 'reject'

  singleton_mutations
  mutation 'select'
end

Mutest::Meta::Example.add :send do
  source 'Array(a)'

  singleton_mutations
  mutation 'a'
  mutation s(:send, nil, :Array)
  mutation 'Array(nil)'
  mutation 'Array(self)'
  mutation '[a]'
end

Mutest::Meta::Example.add :send do
  source 'foo.Array(a)'

  singleton_mutations
  mutation 'a'
  mutation 'self.Array(a)'
  mutation 'foo'
  mutation 'foo.Array'
  mutation 'foo.Array(nil)'
  mutation 'foo.Array(self)'
end

Mutest::Meta::Example.add :send do
  source 'foo.method(:to_s)'

  singleton_mutations
  mutation 'foo'
  mutation 'foo.public_method(:to_s)'
  mutation ':to_s'
  mutation 'self.method(:to_s)'
  mutation 'foo.method'
  mutation 'foo.method(nil)'
  mutation 'foo.method(self)'
  mutation 'foo.method(:to_s__mutest__)'
  mutation 'foo.method(:to_str)'
end

Mutest::Meta::Example.add :send do
  source "foo.public_method('to_i')"

  singleton_mutations
  mutation 'foo'
  mutation '"to_i"'
  mutation 'self.public_method("to_i")'
  mutation 'foo.public_method'
  mutation 'foo.public_method(nil)'
  mutation 'foo.public_method(self)'
  mutation 'foo.public_method("to_int")'
  mutation 'foo.public_method("to_i__mutest__")'
end

Mutest::Meta::Example.add :send do
  source 'foo.method(bar, baz)'

  singleton_mutations
  mutation 'foo'
  mutation 'foo.public_method(bar, baz)'
  mutation 'self.method(bar, baz)'
  mutation 'foo.method'
  mutation 'foo.method(nil, baz)'
  mutation 'foo.method(self, baz)'
  mutation 'foo.method(baz)'
  mutation 'foo.method(bar, nil)'
  mutation 'foo.method(bar, self)'
  mutation 'foo.method(bar)'
end

Mutest::Meta::Example.add :send do
  source "foo.bar('to_s')"

  singleton_mutations
  mutation 'foo'
  mutation '"to_s"'
  mutation 'self.bar("to_s")'
  mutation 'foo.bar("to_s__mutest__")'
  mutation 'foo.bar'
  mutation 'foo.bar(nil)'
  mutation 'foo.bar(self)'
end


text: require 'generated/azure_mgmt_features'

redpajama_set_name: RedPajamaGithub


text:
import { isToday } from '@terascope/utils';
import { FieldType } from '@terascope/types';
import {
    ProcessMode, FunctionDefinitionType, FunctionDefinitionCategory, FieldValidateConfig
} from '../interfaces';

const date = new Date().toISOString();

export const isTodayConfig: FieldValidateConfig = {
    name: 'isToday',
    type: FunctionDefinitionType.FIELD_VALIDATION,
    process_mode: ProcessMode.INDIVIDUAL_VALUES,
    category: FunctionDefinitionCategory.DATE,
    examples: [
        {
            args: {},
            config: { version: 1, fields: { testField: { type: FieldType.String } } },
            field: 'testField',
            input: date,
            output: date,
            description: 'this input is created at execution time'
        },
        {
            args: {},
            config: { version: 1, fields: { testField: { type: FieldType.Date } } },
            field: 'testField',
            input: [new Date(date).getTime(), 0],
            output: date,
            test_only: true
        },
        {
            args: {},
            config: { version: 1, fields: { testField: { type: FieldType.Date } } },
            field: 'testField',
            input: [new Date(date).getTime(), 1440],
            output: null,
            test_only: true
        },
        {
            args: {},
            config: { version: 1, fields: { testField: { type: FieldType.String } } },
            field: 'testField',
            input: '2020-05-09T10:00:00.000Z',
            output: null
        },
    ],
    description: 'Returns the input if it is on the same day (utc-time), otherwise returns null',
    accepts: [
        FieldType.String,
        FieldType.Date,
        FieldType.Number
    ],
    create() {
        return isToday;
    }
};


text:
"""
Run tests for the `ge_info` module.

As with all modules that deal with external state, this is only half
of the problem: the other half is ensuring that `qstat` and other GE
commands produce output in the format we are expecting here.  But this
cannot be enforced nor tested except at program run time...
"""
# Copyright (C) 2011, 2012 ETH Zurich and University of Zurich. All rights reserved.
#
# Authors:
#   Christian Panse <cp@fgcz.ethz.ch>
#   Riccardo Murri <riccardo.murri@gmail.com>
#
# 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.
#
__docformat__ = 'reStructuredText'

# stdlib imports
import unittest

# local imports
from vmmad.batchsys.gridengine import GridEngine
from vmmad.orchestrator import JobInfo

# qstat -u '*' -xml
EXAMPLE_QSTAT_XML_OUTPUT = """<?xml version='1.0'?>
  <job_info  xmlns:xsd="http://www.w3.org/2001/XMLSchema">
    <queue_info>
      <job_list state="running">
        <JB_job_number>389524</JB_job_number>
        <JAT_prio>0.50500</JAT_prio>
        <JB_name>QRLOGIN</JB_name>
        <JB_owner>cpanse</JB_owner>
        <state>r</state>
        <JAT_start_time>2011-11-23T17:20:34</JAT_start_time>
        <queue_name>cloud@fgcz-cloud-002</queue_name>
        <slots>1</slots>
      </job_list>
      <job_list state="running">
        <JB_job_number>390489</JB_job_number>
        <JAT_prio>0.50500</JAT_prio>
        <JB_name>fgcz_sge_rserver__108564</JB_name>
        <JB_owner>bfabric</JB_owner>
        <state>r</state>
        <JAT_start_time>2011-12-12T18:46:06</JAT_start_time>
        <queue_name>rserver@fgcz-c-054</queue_name>
        <slots>1</slots>
      </job_list>
    </queue_info>
    <job_info>
      <job_list state="pending">
        <JB_job_number>389632</JB_job_number>
        <JAT_prio>0.50500</JAT_prio>
        <JB_name>STDIN</JB_name>
        <JB_owner>cpanse</JB_owner>
        <state>qw</state>
        <JB_submission_time>2011-11-26T08:41:59</JB_submission_time>
        <queue_name></queue_name>
        <slots>1</slots>
      </job_list>
    </job_info>
  </job_info>
"""

class TestGEInfo(unittest.TestCase):

    def setUp(self):
        self.ge = GridEngine()

    def test_jobs_number(self):
        jobs = self.ge.parse_qstat_xml_output(EXAMPLE_QSTAT_XML_OUTPUT)
        running = [job for job in jobs if job.state == JobInfo.RUNNING]
        pending = [job for job in jobs if job.state == JobInfo.PENDING]
        self.assertEqual(len(running), 2)
        self.assertEqual(len(pending), 1)

    def test_job_object_class(self):
        jobs = self.ge.parse_qstat_xml_output(EXAMPLE_QSTAT_XML_OUTPUT)
        for job in jobs:
            self.assertIsInstance(job, JobInfo)

    def test_running_job_attribute_types(self):
        jobs = self.ge.parse_qstat_xml_output(EXAMPLE_QSTAT_XML_OUTPUT)
        running = [job for job in jobs if job.state == JobInfo.RUNNING]
        self.assertTrue(len(running) > 0)
        for job in running:
            self.assertTrue(isinstance(job.JAT_prio, float))
            self.assertTrue(isinstance(job.jobid, str))
            self.assertTrue(isinstance(job.name, str))
            self.assertTrue(isinstance(job.queue_name, str))
            self.assertTrue(isinstance(job.exec_node_name, str))
            #self.assertTrue(isinstance(job.state, str))

    def test_running_job_attribute_values(self):
        jobs = self.ge.parse_qstat_xml_output(EXAMPLE_QSTAT_XML_OUTPUT)
        running = [job for job in jobs if job.state == JobInfo.RUNNING]
        self.assertTrue(len(running) > 0)
        job = running[0]
        self.assertEqual(job.state, JobInfo.RUNNING)
        self.assertEqual(job.jobid, '389524')
        self.assertEqual(job.name, 'QRLOGIN')
        self.assertEqual(job.queue_name, 'cloud@fgcz-cloud-002')
        self.assertEqual(job.exec_node_name, 'fgcz-cloud-002')

    def test_pending_job_attribute_types(self):
        jobs = self.ge.parse_qstat_xml_output(EXAMPLE_QSTAT_XML_OUTPUT)
        pending = [job for job in jobs if job.state == JobInfo.PENDING]
        self.assertTrue(len(pending) > 0)
        for job in pending:
            self.assertTrue(isinstance(job.JAT_prio, float))
            self.assertTrue(isinstance(job.jobid, str))
            self.assertTrue(isinstance(job.name, str))
            self.assertTrue(job.queue_name is None)
            self.assertTrue(job.exec_node_name is None)

    def test_pending_job_attribute_values(self):
        jobs = self.ge.parse_qstat_xml_output(EXAMPLE_QSTAT_XML_OUTPUT)
        pending = [job for job in jobs if job.state == JobInfo.PENDING]
        self.assertTrue(len(pending) > 0)
        job = pending[0]
        self.assertEqual(job.state, JobInfo.PENDING)
        self.assertEqual(job.JAT_prio, 0.505)
        self.assertEqual(job.jobid, '389632')
        self.assertEqual(job.name, 'STDIN')
        self.assertEqual(job.queue_name, None)
        self.assertEqual(job.exec_node_name, None)

## main: run tests

if __name__ == "__main__":
    # tests defined here
    unittest.main()
    import doctest
    # module doctests
    doctest.testmod(name="ge_info",
                    optionflags=doctest.NORMALIZE_WHITESPACE)


text:
import Promise from "./promise";

function Transition(parentView, oldView, newContent, animation, animationArgs, transitionMap) {
  this.parentView = parentView;
  this.oldView = oldView;
  this.newContent = newContent;
  this.animation = animation;
  this.animationArgs = animationArgs;
  this.transitionMap = transitionMap;
}

Transition.prototype = {
  run: function() {
    if (!this.animation) {
      if (this.oldView) {
        this.oldView.destroy();
      }
      return this.parentView._pushNewView(this.newContent).then(function(newView){
        var elt;
        if (newView && (elt = newView.$())) {
          elt.show();
        }
      });
    }

    var self = this;
    function insertNewView() {
      if (self.inserted) {
        return self.inserted;
      }
      return self.inserted = self.parentView._pushNewView(self.newContent);
    }
    return this.animation.apply(this, [this.oldView, insertNewView].concat(this.animationArgs)).then(function(){
      self.maybeDestroyOldView();
    });
  },

  maybeDestroyOldView: function(){
    if (!this.interrupted && this.oldView) {
      this.oldView.destroy();
    }
  },

  interrupt: function(){
    // If we haven't yet inserted the new view, don't. And tell the
    // old view not to destroy when our animation stops, because the
    // next transition is going to take over and keep using it.
    if (!this.inserted) {
      this.inserted = Promise.cast(null);
      this.interrupted = true;
    }
  },

  // Lets you compose your transitions out of other named transitions.
  lookup: function(transitionName) {
    return this.transitionMap.lookup(transitionName);
  }
};

export default Transition;


text:
<?xml version="1.0" encoding="utf-8"?>
<manifest xmlns:android="http://schemas.android.com/apk/res/android" package="com.BTDronection" android:versionCode="1" android:versionName="1.0" android:installLocation="auto">
	<uses-sdk android:minSdkVersion="16" />
	<uses-permission android:name="android.permission.ACCESS_COARSE_LOCATION" />
	<uses-permission android:name="android.permission.BLUETOOTH" />
	<uses-permission android:name="android.permission.BLUETOOTH_ADMIN" />
	<uses-permission android:name="android.permission.WRITE_EXTERNAL_STORAGE" />
	<application android:label="BTDronection" android:icon="@drawable/icon"></application>
</manifest>


text:
<?php

namespace Mobishop\Http\Controllers;

use Illuminate\Http\Request;
use Mobishop\Products\Product;

class ProductController extends Controller
{
    /**
     * Show the list of products.
     *
     * @return \Illuminate\Http\Response
     */
    public function index()
    {
        $products = Product::where('active', 1)->get();

        return view('product.index', compact("products"));
    }

    /**
     * Show the product by slug.
     *
     * @param  string  $slug
     * @return \Illuminate\Http\Response
     */
    public function show($slug)
    {
        $product = Product::where(['slug' => $slug, 'active' => 1])->firstOrFail();

        return view('product.show', compact("product"));
    }
}


text:
from data_collection.management.commands import BaseShpStationsShpDistrictsImporter

class Command(BaseShpStationsShpDistrictsImporter):
    srid = 27700
    council_id = 'E07000165'
    districts_name = 'parl.2017-06-08/Version 1/POLLDISTOPEN'
    stations_name = 'parl.2017-06-08/Version 1/POLLSTAOPEN.shp'
    elections = [
        'local.north-yorkshire.2017-05-04',
        'parl.2017-06-08'
    ]

    def district_record_to_dict(self, record):
        code = str(record[0]).strip()
        return {
            'internal_council_id': code,
            'name': code,
            'polling_station_id': code,
        }

    def format_address(self, record):
        address_parts = [record[x].strip() for x in range(4, 9)]
        for i, part in enumerate(address_parts):
            if part == b'':
                address_parts[i] = ''
        if record[3].strip() != b'':
            address_parts.insert(0, str(record[3]).strip())
        address = "\n".join(address_parts)
        while "\n\n" in address:
            address = address.replace("\n\n", "\n").strip()
        return address

    def station_record_to_dict(self, record):
        return {
            'internal_council_id': str(record[0]).strip(),
            'postcode': '',
            'address': self.format_address(record),
            'polling_district_id': str(record[0]).strip(),
        }


text:
package scodec
package codecs

import language.implicitConversions

import shapeless._
import labelled.FieldType

import scodec.bits._

private[scodec] object CoproductCodec {

  /** Calcuates the type index of coproduct value `c` in coproduct type `C`. */
  private[scodec] def indexOf[C <: Coproduct](c: C): Int = {
    def go[CC <: Coproduct](c: CC, idx: Int): Int = c match {
      case Inl(_) => idx
      case Inr(t) => go(t, idx + 1)
    }
    go(c, 0)
  }

  private def encodeCoproduct[C <: Coproduct](codecs: List[Codec[C]], c: C): Attempt[BitVector] = {
    val index = indexOf(c)
    codecs.lift(index) match {
      case None => Attempt.failure(Err(s"Not possible - index $index is out of bounds"))
      case Some(codec) => codec.encode(c)
    }
  }

  /** Creates a coproduct codec that uses the type index of the coproduct as the discriminator. */
  def indexBased[C <: Coproduct, L <: HList](codecs: L, discriminatorCodec: Codec[Int])(
    implicit aux: ToCoproductCodecs[C, L]
  ): Codec[C] with KnownDiscriminatorType[Int] = new Discriminated[C, L, Int](codecs, discriminatorCodec, indexOf, Some.apply)

  /** Codec that encodes/decodes a coproduct `C` discriminated by `D`. */
  private[scodec] class Discriminated[C <: Coproduct, L <: HList, D](
    codecs: L,
    discriminatorCodec: Codec[D],
    coproductToDiscriminator: C => D,
    discriminatorToIndex: D => Option[Int]
  )(implicit aux: ToCoproductCodecs[C, L]) extends Codec[C] with KnownDiscriminatorType[D] {

    private val liftedCodecs: List[Codec[C]] = aux(codecs)

    def sizeBound = discriminatorCodec.sizeBound + SizeBound.choice(liftedCodecs.map { _.sizeBound })

    def encode(c: C) = {
      val discriminator = coproductToDiscriminator(c)
      for {
        encDiscriminator <- discriminatorCodec.encode(discriminator)
        encValue <- encodeCoproduct(liftedCodecs, c)
      } yield encDiscriminator ++ encValue
    }

    def decode(buffer: BitVector) = (for {
      discriminator <- discriminatorCodec
      index <- Decoder.liftAttempt(Attempt.fromOption(discriminatorToIndex(discriminator), new UnknownDiscriminator(discriminator)))
      decoder <- Decoder.liftAttempt(Attempt.fromOption(liftedCodecs.lift(index), Err(s"Unsupported index $index (for discriminator $discriminator)")))
      value <- decoder
    } yield value).decode(buffer)

    override def toString = liftedCodecs.mkString("(", " :+: ", ")") + s" by $discriminatorCodec"
  }

  /** Codec that encodes/decodes a coproduct `C`. */
  private[scodec] class Choice[C <: Coproduct, L <: HList](
    codecs: L
  )(implicit aux: ToCoproductCodecs[C, L]) extends Codec[C] {

    private val liftedCodecs: List[Codec[C]] = aux(codecs)
    private val decoder: Decoder[C] = Decoder.choiceDecoder(liftedCodecs: _*)

    def sizeBound = SizeBound.choice(liftedCodecs.map { _.sizeBound })

    def encode(c: C) = encodeCoproduct(liftedCodecs, c)

    def decode(buffer: BitVector) = decoder.decode(buffer)

    override def toString = liftedCodecs.mkString("choice(", " :+: ", ")")
  }
}

/** Witness that allows converting an `HList` of codecs in to a list of coproduct codecs, where the coproduct is type aligned with the `HList`. */
sealed trait ToCoproductCodecs[C <: Coproduct, L <: HList] {
  def apply(l: L): List[Codec[C]]
}

/** Companion for [[ToCoproductCodecs]]. */
object ToCoproductCodecs {
  implicit val base: ToCoproductCodecs[CNil, HNil] = new ToCoproductCodecs[CNil, HNil] {
    def apply(hnil: HNil) = Nil
  }

  implicit def step[A, CT <: Coproduct, LT <: HList](
    implicit tailAux: ToCoproductCodecs[CT, LT],
    inj: ops.coproduct.Inject[A :+: CT, A]
  ): ToCoproductCodecs[A :+: CT, Codec[A] :: LT] = new ToCoproductCodecs[A :+: CT, Codec[A] :: LT] {
    def apply(l: Codec[A] :: LT): List[Codec[A :+: CT]] = {

      val headCodec: Codec[A :+: CT] = new Codec[A :+: CT] {
        val codec: Codec[A] = l.head
        def sizeBound = codec.sizeBound
        def encode(c: A :+: CT) = c match {
          case Inl(a) => codec.encode(a)
          case Inr(ct) => Attempt.failure(Err(s"cannot encode $ct"))
        }
        def decode(buffer: BitVector) =
          codec.decode(buffer).map { _ map { a => Coproduct[A :+: CT](a) } }
        override def toString = codec.toString
      }

      val tailCodecs: List[Codec[A :+: CT]] = tailAux(l.tail).map { d: Codec[CT] =>
        new Codec[A :+: CT] {
          def sizeBound = d.sizeBound
          def encode(c: A :+: CT) = c match {
            case Inr(a) => d.encode(a)
            case Inl(ch) => Attempt.failure(Err(s"cannot encode $c"))
          }
          def decode(buffer: BitVector) =
            d.decode(buffer).map { _ map { a => Inr(a): A :+: CT } }
          override def toString = d.toString
        }
      }

      headCodec :: tailCodecs
    }
  }
}

/**
 * Supports building a coproduct codec.
 *
 * A coproduct codec is built by:
 *  - specifying a codec for each member of the coproduct, separated by the `:+:` operator
 *  - specifying the discriminator codec and mapping between discriminator values and coproduct members
 *  - alternatively, instead of specifying a discriminator codec, using the `choice` combinator to create
 *    a codec that encodes no discriminator and hence, decodes by trying each codec in succession and using
 *    the first successful result
 *
 * To specify the discriminator, call either `discriminatedByIndex(intCodec)` or `discriminatedBy(codec)` followed by
 * one of the methods on [[NeedDiscriminators]]. The former uses the type index as the discriminator value.
 *
 * For example: {{{
(int32 :+: bool(8) :+: variableSizeBytes(uint8, ascii)).discriminatedByIndex(uint8)
 }}}
 * The first 8 bits of the resulting binary contains the discriminator value due to usage of the `uint8` codec as
 * the discriminator codec. A discriminator value of 0 causes the remaining bits to be encoded/decoded with `int32`.
 * Similarly, a value of 1 causes the remaining bits to be encoded/decoded with `bool(8)` and a value of 2 causes
 * the remaining bits to be encoded/decoded as a sized ASCII string.
 *
 * Alternatively, discriminator values can be explicitly specified using `discriminatedBy(codec).using(Sized(...))`.
 *
 * For example: {{{
 (int32 :+: bool(8) :+: variableSizeBytes(uint8, ascii)).discriminatedBy(fixedSizeBytes(1, ascii)).using(Sized("i", "b", "s"))
 }}}
 * In this example, integers are associated with the discriminator `i`, booleans with `b`, and strings with `s`. The discriminator
 * is encoded with `fixedSizeBytes(1, ascii)`.
 *
 * The methods which generate a `Codec` return a `Codec[R]` instead of a `Codec[C]`. Typically, `C =:= R` but the `xmap` and
 * `exmap` methods allow transformations between `C` and `R` to be deferred until after the codec is built.
 *
 * @tparam C coproduct type
 * @tparam L hlist type that has a codec for each type in the coproduct `C`
 * @tparam R resulting codec type
 */
final class CoproductCodecBuilder[C <: Coproduct, L <: HList, R] private[scodec] (
  codecs: L, cToR: C => Attempt[R], rToC: R => Attempt[C]
)(implicit aux: ToCoproductCodecs[C, L]) {

  private def toRDiscriminated[D](c: Codec[C] with KnownDiscriminatorType[D]): Codec[R] with KnownDiscriminatorType[D] = {
    // cast is safe because xmapping is unable to change the discriminator type
    toR(c).asInstanceOf[Codec[R] with KnownDiscriminatorType[D]]
  }
  private def toR(c: Codec[C]): Codec[R] = c.exmap(cToR, rToC)

  /** Adds a codec to the head of this coproduct codec. */
  def :+:[A](left: Codec[A]): CoproductCodecBuilder[A :+: C, Codec[A] :: L, A :+: C] =
    CoproductCodecBuilder(left :: codecs)

  /**
   * Automatically generates a `Codec[R]` given an implicit `Discriminated[R, A]` and an implicit
   * `Discriminator[R, X, A]` for each `X` that is a member of the coproduct type that represents `R`.
   */
  def auto[A](implicit discriminated: Discriminated[R, A], auto: CoproductBuilderAutoDiscriminators[R, C, A]): Codec[R] = {
    val framing = discriminated.framing
    def frame[LL <: HList](rest: LL): LL = rest match {
      case HNil => HNil
      case h :: t => (framing(h.asInstanceOf[Codec[_]]) :: frame(t)).asInstanceOf[LL]
      // Casts are completely safe - mapping a codec transformation cannot change the shape of an HList of codecs
    }
    new CoproductCodecBuilder[C, L, R](frame(codecs), cToR, rToC).discriminatedBy(discriminated.codec).auto
  }

  /**
   * Creates the coproduct codec using the specified integer codec as the discriminator codec
   * and using coproduct indices as discriminators.
   *
   * For example, `(a :+: b :+: c).discriminatedByIndex(uint8)` results in using `0` for `a`,
   * `1` for `b`, and `2` for `c`.
   */
  def discriminatedByIndex(discriminatorCodec: Codec[Int]): Codec[R] with KnownDiscriminatorType[Int] =
    toRDiscriminated(CoproductCodec.indexBased(codecs, discriminatorCodec))

  /** Supports creation of a coproduct codec that uses an arbitrary discriminator. */
  def discriminatedBy[A](discriminatorCodec: Codec[A]): NeedDiscriminators[A] =
    new NeedDiscriminators(discriminatorCodec)

  /** Assists in creating a coproduct codec, after the coproduct type and discriminator type have been fixed. */
  final class NeedDiscriminators[A] private[CoproductCodecBuilder] (discriminatorCodec: Codec[A]) {

    /**
     * Specifies the discriminator values for each of the coproduct type members.
     *
     * The collection must list the discriminators in the order that the corresponding types appear in the coproduct.
     */
    def using[N <: Nat](discriminators: Sized[Seq[A], N])(implicit ev: ops.coproduct.Length.Aux[C, N]): Codec[R] with KnownDiscriminatorType[A] =
      usingUnsafe(discriminators.seq)

    /**
     * Specifies the discriminator values for each of the union type members by providing the discriminators
     * as a record with the same keys as the union.
     */
    def using[Rec <: HList](bindings: Rec)(implicit keyDiscriminators: CoproductBuilderKeyDiscriminators[C, Rec, A]): Codec[R] with KnownDiscriminatorType[A] =
      toRDiscriminated(new CoproductCodec.Discriminated(
        codecs,
        discriminatorCodec,
        keyDiscriminators.toDiscriminator(bindings),
        (a: A) => keyDiscriminators.fromDiscriminator(bindings)(a, 0)))

    /**
     * Determines discriminators values automatically by looking for a `Discriminator[R, X, A]`
     * for each component type `X` in the coproduct `C`.
     */
    def auto(implicit auto: CoproductBuilderAutoDiscriminators[R, C, A]): Codec[R] with KnownDiscriminatorType[A] = usingUnsafe(auto.discriminators)

    /** Unsafe version of `using` -- discriminators must be equal in length to the number of components in `C`. */
    private def usingUnsafe(discriminators: Seq[A]): Codec[R] with KnownDiscriminatorType[A] = {
      val toDiscriminator: C => A = c => discriminators(CoproductCodec.indexOf(c))
      val fromDiscriminator: A => Option[Int] = a => {
        val idx = discriminators.indexWhere { (x: A) => x == a }
        if (idx >= 0) Some(idx) else None
      }
      toRDiscriminated(new CoproductCodec.Discriminated(codecs, discriminatorCodec, toDiscriminator, fromDiscriminator))
    }
  }

  /**
   * Creates a coproduct codec that encodes no discriminator. Rather, decoding is accomplished by
   * trying each codec in order and using the first successful result.
   */
  def choice: Codec[R] = toR(new CoproductCodec.Choice(codecs))

  /**
   * Creates a builder that applies the specified transformations to any codecs generated by the returned builder.
   */
  def exmap[S](rToS: R => Attempt[S], sToR: S => Attempt[R]): CoproductCodecBuilder[C, L, S] =
    new CoproductCodecBuilder(codecs, c => cToR(c) flatMap rToS, s => sToR(s) flatMap rToC)
}

/** Companion for [[CoproductCodecBuilder]]. */
object CoproductCodecBuilder {
  def apply[C <: Coproduct, L <: HList](codecs: L)(implicit aux: ToCoproductCodecs[C, L]): CoproductCodecBuilder[C, L, C] =
    new CoproductCodecBuilder(codecs, Attempt.successful, Attempt.successful)

  implicit def transformInstance[C <: Coproduct, L <: HList]: Transform[({type l[a] = CoproductCodecBuilder[C, L, a]})#l] = new Transform[({type l[a] = CoproductCodecBuilder[C, L, a]})#l] {
    def exmap[A, B](builder: ({type l[a] = CoproductCodecBuilder[C, L, a]})#l[A], f: A => Attempt[B], g: B => Attempt[A]) =
      builder.exmap(f, g)
  }

  implicit def toTransformSyntax[C <: Coproduct, L <: HList, A](ccb: CoproductCodecBuilder[C, L, A]): TransformSyntax[({type l[a] = CoproductCodecBuilder[C, L, a]})#l, A] =
    new TransformSyntax[({type l[a] = CoproductCodecBuilder[C, L, a]})#l, A](ccb)
}

/** Witness that a coproduct codec builder of type `A` can be automatically created. */
sealed abstract class CoproductBuilderAuto[A] extends DepFn0 {
  type C <: Coproduct
  type L <: HList
  type Out = codecs.CoproductCodecBuilder[C, L, A]
  def apply: Out
}

/** Companion for [[CoproductBuilderAuto]]. */
object CoproductBuilderAuto {
  type Aux[A, C0, L0] = CoproductBuilderAuto[A] { type C = C0; type L = L0 }

  def apply[A](implicit auto: CoproductBuilderAuto[A]): auto.Out = auto.apply

  implicit def cnil: CoproductBuilderAuto.Aux[CNil, CNil, HNil] =
    new CoproductBuilderAuto[CNil] {
      type C = CNil
      type L = HNil
      def apply = codecs.CoproductCodecBuilder(HNil)
    }

  implicit def coproduct[H, T <: Coproduct, TL <: HList](implicit
    headCodec: Lazy[Codec[H]],
    tailAux: CoproductBuilderAuto.Aux[T, T, TL]
  ): CoproductBuilderAuto.Aux[H :+: T, H :+: T, Codec[H] :: TL] =
    new CoproductBuilderAuto[H :+: T] {
      type C = H :+: T
      type L = Codec[H] :: TL
      def apply = headCodec.value :+: tailAux.apply
    }

  import shapeless.ops.union.{ Keys => UnionKeys }

  implicit def union[KH <: Symbol, VH, T <: Coproduct, KT <: HList, TL <: HList](implicit
    headCodec: Lazy[Codec[VH]],
    tailAux: CoproductBuilderAuto.Aux[T, T, TL],
    keys: UnionKeys.Aux[FieldType[KH, VH] :+: T, KH :: KT]
  ): CoproductBuilderAuto.Aux[FieldType[KH, VH] :+: T, FieldType[KH, VH] :+: T, Codec[FieldType[KH, VH]] :: TL] =
    new CoproductBuilderAuto[FieldType[KH, VH] :+: T] {
      type C = FieldType[KH, VH] :+: T
      type L = Codec[FieldType[KH, VH]] :: TL
      def apply = {
        headCodec.value.toFieldWithContext(keys().head) :+: tailAux.apply
      }
    }

  implicit def labelledGeneric[A, U <: Coproduct, UL <: HList](implicit
    lgen: LabelledGeneric.Aux[A, U],
    auto: CoproductBuilderAuto.Aux[U, U, UL]
  ): CoproductBuilderAuto.Aux[A, U, UL] = new CoproductBuilderAuto[A] {
    type C = U
    type L = auto.L
    def apply = auto.apply.xmap(lgen.from, lgen.to)
  }
}

/** Witness for `CoproductCodecBuilder#NeedDiscriminators#using`. */
sealed abstract class CoproductBuilderKeyDiscriminators[C <: Coproduct, L <: HList, A] {
  def toDiscriminator(bindings: L)(c: C): A
  def fromDiscriminator(bindings: L)(a: A, idx: Int): Option[Int]
}

/** Companion for [[CoproductBuilderKeyDiscriminators]]. */
object CoproductBuilderKeyDiscriminators {
  implicit def nil[A]: CoproductBuilderKeyDiscriminators[CNil, HNil, A] =
    new CoproductBuilderKeyDiscriminators[CNil, HNil, A] {
      def toDiscriminator(bindings: HNil)(c: CNil): A = sys.error("impossible")
      def fromDiscriminator(bindings: HNil)(a: A, idx: Int): Option[Int] = None
    }

  implicit def step[K <: Symbol, V, CT <: Coproduct, L <: HList, LT <: HList, A](implicit
    remover: ops.record.Remover.Aux[L, K, (A, LT)],
    tailDiscriminators: CoproductBuilderKeyDiscriminators[CT, LT, A]
  ): CoproductBuilderKeyDiscriminators[FieldType[K, V] :+: CT, L, A] =
    new CoproductBuilderKeyDiscriminators[FieldType[K, V] :+: CT, L, A] {
      def toDiscriminator(bindings: L)(c: FieldType[K, V] :+: CT): A = {
        val (binding, restBindings) = remover(bindings)
        c match {
          case Inl(_) => binding
          case Inr(ct) => tailDiscriminators.toDiscriminator(restBindings)(ct)
        }
      }
      def fromDiscriminator(bindings: L)(a: A, idx: Int): Option[Int] = {
        val (binding, restBindings) = remover(bindings)
        if (binding == a) Some(idx)
        else tailDiscriminators.fromDiscriminator(restBindings)(a, idx + 1)
      }
    }
}

/** Witness for `CoproductCodecBuilder#NeedDiscriminators#auto`. */
sealed abstract class CoproductBuilderAutoDiscriminators[X, C <: Coproduct, A] {
  def discriminators: List[A]
}

/** Companion for [[CoproductBuilderAutoDiscriminators]]. */
object CoproductBuilderAutoDiscriminators {

  implicit def cnil[X, A]: CoproductBuilderAutoDiscriminators[X, CNil, A] =
    new CoproductBuilderAutoDiscriminators[X, CNil, A] {
      def discriminators = Nil
    }

  implicit def coproduct[X, A, CH, CT <: Coproduct](implicit
    headDiscriminator: Discriminator[X, CH, A],
    tailAuto: CoproductBuilderAutoDiscriminators[X, CT, A]
  ): CoproductBuilderAutoDiscriminators[X, CH :+: CT, A] =
    new CoproductBuilderAutoDiscriminators[X, CH :+: CT, A] {
      def discriminators = headDiscriminator.value :: tailAuto.discriminators
    }

  implicit def union[X, A, K, V, CT <: Coproduct](implicit
    headDiscriminator: Discriminator[X, V, A],
    tailAuto: CoproductBuilderAutoDiscriminators[X, CT, A]
  ): CoproductBuilderAutoDiscriminators[X, FieldType[K, V] :+: CT, A] =
    new CoproductBuilderAutoDiscriminators[X, FieldType[K, V] :+: CT, A] {
      def discriminators = headDiscriminator.value :: tailAuto.discriminators
    }
}


text:
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <title>
        How to make a rule set</title>

    <link rel="stylesheet" href="./css/print.css" type="text/css" media="print" />
      <meta name="author" content="Tom Copeland" />
    <meta name="Date-Revision-yyyymmdd" content="20130501" />
    <meta http-equiv="Content-Language" content="en" />

        Last Published: 2013-05-01
                   | Version: 5.0.4
                          |                           SourceForge
        >
                          PMD
        >

        How to make a rule set

                    SourceForge.net Project Page
            |
                        Hosted by SourceForge

Overview

                          Download PMD 5.0.4

                          What's new in PMD 5.0.4

                          PMD in the news

                          PMD-related products and books

                          Best practices

                          Future directions

                          Similar projects

                          Credits

                          License

                          What does 'PMD' mean?

Usage

                          Installation

                          Command line usage

                          Ant task usage

                          Maven plugin usage

                          Mvn plugin usage

                          IDE plugin usage

                          Suppressing warnings

                          Finding duplicated code

                          JSP support

Customizing PMD

                          Compiling PMD

                          How to write a rule

                          Writing XPath rules

            How to make a rule set

                          How it works

                          Rule guidelines

                          PMD developers information

                          PMD Release Process

For example

                          Run PMD on a Sourceforge project

Misc.

                          XPath tutorial (Gregorian)

Rule Sets

                          ecmascript

                          Basic Ecmascript

                          Braces

                          Unnecessary

                          java

                          Android

                          Basic

                          Braces

                          Clone Implementation

                          Code Size

                          Comments

                          Controversial

                          Coupling

                          Design

                          Empty Code

                          Finalizer

                          Import Statements

                          J2EE

                          JavaBeans

                          JUnit

                          Jakarta Commons Logging

                          Java Logging

                          Migration

                          Naming

                          Optimization

                          Strict Exceptions

                          String and StringBuffer

                          Security Code Guidelines

                          Type Resolution

                          Unnecessary

                          Unused Code

                          jsp

                          Basic JSF

                          Basic JSP

                          xml

                          Basic XML

                          xsl

                          XPath in XSL

Project Documentation

                          Project Information

                          Project Reports

How to make a new rule set

Say you want to pick specific rules from various rule sets and customize them.  You can do this by making your own rule set.

Create a new ruleset.xml file

Use one of the current rulesets as an example.  Copy and paste
    it into your new file, delete all the old rules from it, and change
    the name and description.  Like this:

<?xml version="1.0"?>
<ruleset name="Custom ruleset"
    xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
  <description>
  This ruleset checks my code for bad stuff
  </description>
</ruleset>

Add some rule references to it

After you add these references it'll look something like this:

<?xml version="1.0"?>
<ruleset name="Custom ruleset"
    xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">

  <description>
  This ruleset checks my code for bad stuff
  </description>

  <!-- We'll use the entire 'strings' ruleset -->
  <rule ref="rulesets/java/strings.xml"/>

  <!-- Here's some rules we'll specify one at a time -->
  <rule ref="rulesets/java/unusedcode.xml/UnusedLocalVariable"/>
  <rule ref="rulesets/java/unusedcode.xml/UnusedPrivateField"/>
  <rule ref="rulesets/java/imports.xml/DuplicateImports"/>
  <rule ref="rulesets/java/basic.xml/UnnecessaryConversionTemporary"/>

  <!-- We want to customize this rule a bit, change the message and raise the priority  -->
  <rule
   ref="rulesets/java/basic.xml/EmptyCatchBlock"
   message="Must handle exceptions">
    <priority>2</priority>
  </rule>

  <!-- Now we'll customize a rule's property value -->
  <rule ref="rulesets/java/codesize.xml/CyclomaticComplexity">
    <properties>
        <property name="reportLevel" value="5"/>
    </properties>
  </rule>

  <!-- We want everything from braces.xml except WhileLoopsMustUseBraces -->
  <rule ref="rulesets/java/braces.xml">
    <exclude name="WhileLoopsMustUseBraces"/>
  </rule>
</ruleset>

Notice that you can customize individual referenced rules.  Everything but the
       class of the rule can be overridden in your custom ruleset.

Excluding rules from a ruleset

You can also make a custom ruleset that excludes rules, like this:

<?xml version="1.0"?>
<ruleset name="mybraces"
    xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
  <description>Just the braces rules I like</description>
  <rule ref="rulesets/java/braces.xml">
    <exclude name="WhileLoopsMustUseBraces"/>
    <exclude name="IfElseStmtsMustUseBraces"/>
  </rule>
</ruleset>

Excluding files from a ruleset

You can also exclude certain files from being processed by a ruleset using exclude patterns,
                with an optional overriding include pattern.  A file will be excluded from processing when there
                is a matching exclude pattern, but no matching include pattern.  Path separators in the source
                file path are normalized to be the '/' character, so the same ruleset can be used on multiple
                platforms transparently.  Additionally, this exclude/include technique works regardless of how
                PMD is used (e.g. command line, IDE, Ant), making it easier to keep application of your PMD
                rules consistent throughout your environment.  Here is an example:

<?xml version="1.0"?>
<ruleset name="myruleset"
    xmlns="http://pmd.sourceforge.net/ruleset/2.0.0"
    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
    xsi:schemaLocation="http://pmd.sourceforge.net/ruleset/2.0.0 http://pmd.sourceforge.net/ruleset_2_0_0.xsd">
  <description>My ruleset</description>
  <exclude-pattern>.*/some/package/.*</exclude-pattern>
  <exclude-pattern>.*/some/other/package/FunkyClassNamePrefix.*</exclude-pattern>
  <include-pattern>.*/some/package/ButNotThisClass.*</include-pattern>
  <rule>...
</ruleset>

Reference it in your Ant task

You can specify the full path to your custom ruleset name alongside
        of the built-in PMD rulesets - like this:

<pmd rulesetfiles="/home/tom/data/pmd/pmd/rulesets/java/design.xml,rulesets/java/unusedcode.xml">
  <formatter type="xml" toFile="foo.xml"/>
  <fileset dir="/home/tom/data/pmd/pmd/src">
    <include name="**/*.java"/>
  </fileset>
</pmd>

To see it in your IDE, add it to rulesets/rulesets.properties

At least, that's the way some of the IDE plugins do it.  Some
    have other ways of adding custom rulesets.

Send us feedback

If you have suggestions on clarifying this document, please post
    them to
                    the forum.  Thanks!

Finally, for many more details on building custom rulesets, pick up PMD Applied!

              Copyright ©                    2002-2013
                        InfoEther.
            All Rights Reserved.


text:
package mota.dev.happytesting.repositories;

import java.util.List;

import io.reactivex.Observable;
import mota.dev.happytesting.models.Image;
import mota.dev.happytesting.models.Observation;

/**
 * Created by Slaush on 18/06/2017.
 */

public interface ImageRepository
{
    Observable<List<Image>> getAll();
    Observable<List<Image>> getObservationImages(Observation observation);
}


text:
package gov.nih.nci.calims2.domain.common.environmentalcondition;

import javax.persistence.DiscriminatorValue;
import javax.persistence.Entity;

import gov.nih.nci.calims2.domain.common.visitor.EnvironmentalConditionVisitor;
/**
*
**/

@Entity
@DiscriminatorValue("AirFiltration")

public class AirFiltration extends EnvironmentalCondition {
/**
* An attribute to allow serialization of the domain objects.
*/
private static final long serialVersionUID = 1234567890L;
/** Accepts the EnvironmentalConditionVisitor.
 * @param environmentalConditionVisitor The EnvironmentalConditionVisitor to accept.
 **/ public void accept(EnvironmentalConditionVisitor environmentalConditionVisitor) {
       environmentalConditionVisitor.visitAirFiltration(this);
}

}


text:
if (${CMAKE_SYSTEM_NAME} MATCHES "Linux")
  set(LINUX 1)
endif()

include(compilation)

if (APPLE)
  include(mac)
endif()


text:
from django import template
import datetime
from datetime import date
from django.utils.safestring import mark_safe
from django.core.urlresolvers import reverse

register = template.Library()

@register.filter(name='get_active_label')
def active_label(active):
    span = ''
    if active:
        span = 'active'
    else:
        span = 'inactive'
    return mark_safe(span)

@register.filter(name='get_status_label')
def status_label(status):
    span = ''
    if status == 0:
        span = 'ready to begin'
    elif status == 1:
        span = 'in progress'
    elif status == 2:
        span = 'completed'
    elif status == 3:
        span = 'on hold'
    return mark_safe(span)

@register.filter(name='get_daysleft_label')
def get_daysleft_label(days, active):
    span = ''
    if active:
        if days < 0:
            span = ''
            span = span + ''
            span = span + '' + str(days*-1) + ' days overdue'
        elif days == 0:
            span = ''
            span = span + ''
            span = span + ' due today'
        elif days > 0 and days < 15:
            span = ''
            span = span + str(days) + ' days left'
        else:
            span = ''
            span = span + str(days) + ' days left'
        return mark_safe(span)

@register.filter(name='get_dayssince_label')
def get_dayssince_label(days, active):
    span = ''
    if active:
        if days > 0:
            span = ''
            span = span + str(days) + ' days since'
        return mark_safe(span)

@register.filter(name='get_duration')
def get_duration(duration):
    span = "
"
    return mark_safe(span)

@register.filter(name='get_breadcrumbs')
def get_breadcrumbs(node):
    bc = ''
    for a in node.get_ancestors():
        link = reverse('ptasks:ptask_detail', args=[str(a.pk)])
        bc = bc + '' + a.name + '='
    if not node.is_root_node():
        bc = bc + ''+ node.name + ''
    bc = bc + '\n

'
    return mark_safe(bc)

@register.filter(name='get_formated_start_date')
def get_formated_start_date(ptask):
    from_date = date(1970,1,1);
    return ((ptask.start_date - from_date).days+1)*24*3600*1000

@register.filter(name='get_formated_end_date')
def get_formated_end_date(ptask):
    from_date = date(1970,1,1);
    return ((ptask.due_date - from_date).days+1)*24*3600*1000


text:
/*	$NetBSD: rtfps.c,v 1.58 2012/10/27 17:18:25 chs Exp $	*/

/*
 * Copyright (c) 1996 Christopher G. Demetriou.  All rights reserved.
 * Copyright (c) 1995 Charles M. Hannum.  All rights reserved.
 *
 * This code is derived from public-domain software written by
 * Roland McGrath.
 *
 * Redistribution and use in source and binary forms, with or without
 * modification, are permitted provided that the following conditions
 * are met:
 * 1. Redistributions of source code must retain the above copyright
 *    notice, this list of conditions and the following disclaimer.
 * 2. Redistributions in binary form must reproduce the above copyright
 *    notice, this list of conditions and the following disclaimer in the
 *    documentation and/or other materials provided with the distribution.
 * 3. All advertising materials mentioning features or use of this software
 *    must display the following acknowledgement:
 *	This product includes software developed by Charles M. Hannum.
 * 4. The name of the author may not be used to endorse or promote products
 *    derived from this software without specific prior written permission.
 *
 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
 * IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
 * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
 * NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
 * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
 * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 */

#include <sys/cdefs.h>
__KERNEL_RCSID(0, "$NetBSD: rtfps.c,v 1.58 2012/10/27 17:18:25 chs Exp $");

#include <sys/param.h>
#include <sys/systm.h>
#include <sys/device.h>
#include <sys/termios.h>

#include <sys/bus.h>
#include <sys/intr.h>

#include <dev/ic/comreg.h>
#include <dev/ic/comvar.h>

#include <dev/isa/isavar.h>
#include <dev/isa/com_multi.h>

#define	NSLAVES	4

struct rtfps_softc {
	void *sc_ih;

	bus_space_tag_t sc_iot;
	int sc_iobase;
	int sc_irqport;
	bus_space_handle_t sc_irqioh;

	int sc_alive;			/* mask of slave units attached */
	void *sc_slaves[NSLAVES];	/* com device unit numbers */
	bus_space_handle_t sc_slaveioh[NSLAVES];
};

int rtfpsprobe(device_t, cfdata_t, void *);
void rtfpsattach(device_t, device_t, void *);
int rtfpsintr(void *);

CFATTACH_DECL_NEW(rtfps, sizeof(struct rtfps_softc),
    rtfpsprobe, rtfpsattach, NULL, NULL);

int
rtfpsprobe(device_t parent, cfdata_t self, void *aux)
{
	struct isa_attach_args *ia = aux;
	bus_space_tag_t iot = ia->ia_iot;
	bus_space_handle_t ioh;
	int i, iobase, rv = 1;

	/*
	 * Do the normal com probe for the first UART and assume
	 * its presence, and the ability to map the other UARTS,
	 * means there is a multiport board there.
	 * XXX Needs more robustness.
	 */

	if (ia->ia_nio < 1)
		return (0);
	if (ia->ia_nirq < 1)
		return (0);

	/* Disallow wildcarded i/o address. */
	if (ia->ia_io[0].ir_addr == ISA_UNKNOWN_PORT)
		return (0);
	if (ia->ia_irq[0].ir_irq == ISA_UNKNOWN_IRQ)
		return (0);

	/* if the first port is in use as console, then it. */
	if (com_is_console(iot, ia->ia_io[0].ir_addr, 0))
		goto checkmappings;

	if (bus_space_map(iot, ia->ia_io[0].ir_addr, COM_NPORTS, 0, &ioh)) {
		rv = 0;
		goto out;
	}
	rv = comprobe1(iot, ioh);
	bus_space_unmap(iot, ioh, COM_NPORTS);
	if (rv == 0)
		goto out;

checkmappings:
	for (i = 1, iobase = ia->ia_io[0].ir_addr; i < NSLAVES; i++) {
		iobase += COM_NPORTS;

		if (com_is_console(iot, iobase, 0))
			continue;

		if (bus_space_map(iot, iobase, COM_NPORTS, 0, &ioh)) {
			rv = 0;
			goto out;
		}
		bus_space_unmap(iot, ioh, COM_NPORTS);
	}

out:
	if (rv) {
		ia->ia_nio = 1;
		ia->ia_io[0].ir_size = NSLAVES * COM_NPORTS;

		ia->ia_nirq = 1;

		ia->ia_niomem = 0;
		ia->ia_ndrq = 0;
	}
	return (rv);
}

void
rtfpsattach(device_t parent, device_t self, void *aux)
{
	struct rtfps_softc *sc = device_private(self);
	struct isa_attach_args *ia = aux;
	struct commulti_attach_args ca;
	static int irqport[] = {
		-1, -1, -1, -1, -1, -1, -1, -1,
		-1, 0x2f2, 0x6f2, 0x6f3, -1, -1, -1, -1
	};
	bus_space_tag_t iot = ia->ia_iot;
	int i, iobase, irq;

	printf("\n");

	sc->sc_iot = ia->ia_iot;
	sc->sc_iobase = ia->ia_io[0].ir_addr;
	irq = ia->ia_irq[0].ir_irq;

	if (irq >= 16 || irqport[irq] == -1) {
		printf("%s: invalid irq\n", device_xname(self));
		return;
	}
	sc->sc_irqport = irqport[irq];

	for (i = 0; i < NSLAVES; i++) {
		iobase = sc->sc_iobase + i * COM_NPORTS;
		if (!com_is_console(iot, iobase, &sc->sc_slaveioh[i]) &&
		    bus_space_map(iot, iobase, COM_NPORTS, 0,
			&sc->sc_slaveioh[i])) {
			aprint_error_dev(self, "can't map i/o space for slave %d\n", i);
			return;
		}
	}
	if (bus_space_map(iot, sc->sc_irqport, 1, 0, &sc->sc_irqioh)) {
		aprint_error_dev(self, "can't map irq port at 0x%x\n",
		    sc->sc_irqport);
		return;
	}

	bus_space_write_1(iot, sc->sc_irqioh, 0, 0);

	for (i = 0; i < NSLAVES; i++) {
		ca.ca_slave = i;
		ca.ca_iot = sc->sc_iot;
		ca.ca_ioh = sc->sc_slaveioh[i];
		ca.ca_iobase = sc->sc_iobase + i * COM_NPORTS;
		ca.ca_noien = 0;

		sc->sc_slaves[i] = config_found(self, &ca, commultiprint);
		if (sc->sc_slaves[i] != NULL)
			sc->sc_alive |= 1 << i;
	}

	sc->sc_ih = isa_intr_establish(ia->ia_ic, irq, IST_EDGE,
	    IPL_SERIAL, rtfpsintr, sc);
}

int
rtfpsintr(void *arg)
{
	struct rtfps_softc *sc = arg;
	bus_space_tag_t iot = sc->sc_iot;
	int alive = sc->sc_alive;

	bus_space_write_1(iot, sc->sc_irqioh, 0, 0);

#define	TRY(n) \
	if (alive & (1 << (n))) \
		comintr(sc->sc_slaves[n]);
	TRY(0);
	TRY(1);
	TRY(2);
	TRY(3);
#undef TRY

	return (1);
}


text:
'use strict';

/**
 * Example Controller
 */
exports.<%= module_name_js %> = function( req, res ) {

    res.render('app/<%= module_name_folder %>/views/<%= module_name_folder %>');

};


text:
/* ------------------------------------------------------------------------------
 *
 *  # D3.js - sunbirst diagram combined
 *
 *  Demo sunbirst diagram setup with interactive zoom and data update combination
 *
 *  Version: 1.0
 *  Latest update: August 1, 2015
 *
 * ---------------------------------------------------------------------------- */

$(function () {

    // Initialize Uniform plugin
    $('.combined-options input').uniform({
        radioClass: 'choice'
    });

    // Initialize chart
    sunburstZoomable('#d3-sunburst-combined', 400, 400);

    // Chart setup
    function sunburstZoomable(element, width, height) {

        // Basic setup
        // ------------------------------

        // Define main variables
        var radius = Math.min(width, height) / 2;

        // Construct scales
        // ------------------------------

        // Horizontal
        var x = d3.scale.linear()
            .range([0, 2 * Math.PI]);

        // Vertical
        var y = d3.scale.sqrt()
            .range([0, radius]);

        // Colors
        var color = d3.scale.category20();

        // Create chart
        // ------------------------------

        var svg = d3.select(element).append("svg")
            .attr("width", width)
            .attr("height", height)
            .append("g")
                .attr("transform", "translate(" + width / 2 + "," + height / 2 + ")");

        // Construct chart layout
        // ------------------------------

        // Partition layout
        var partition = d3.layout.partition()
            .sort(null)
            .value(function(d) { return 1; });

        // Arc
        var arc = d3.svg.arc()
            .startAngle(function(d) { return Math.max(0, Math.min(2 * Math.PI, x(d.x))); })
            .endAngle(function(d) { return Math.max(0, Math.min(2 * Math.PI, x(d.x + d.dx))); })
            .innerRadius(function(d) { return Math.max(0, y(d.y)); })
            .outerRadius(function(d) { return Math.max(0, y(d.y + d.dy)); });

        // Load data
        // ------------------------------

        // Keep track of the node that is currently being displayed as the root.
        var node;

        d3.json("assets/demo_data/d3/sunburst/sunburst_basic.json", function(error, root) {
            node = root;

            // Append sunbirst
            var path = svg.datum(root).selectAll(".d3-sunbirst")
                .data(partition.nodes)
                .enter()
                .append("path")
                    .attr("class", "d3-sunbirst")
                    .attr("d", arc)
                    .style("fill", function(d) { return color((d.children ? d : d.parent).name); })
                    .on("click", click)
                    .each(stash);

            // Change data
            d3.selectAll(".combined-options input").on("change", function change() {
                var value = this.value === "count"
                ? function() { return 1; }
                : function(d) { return d.size; };

                // Transition
                path
                    .data(partition.value(value).nodes)
                    .transition()
                        .duration(750)
                        .attrTween("d", arcTweenData);
            });

            // Animate on click
            function click(d) {
                node = d;
                path.transition()
                    .duration(750)
                    .attrTween("d", arcTweenZoom(d));
            }
        });

        // Setup for switching data: stash the old values for transition.
        function stash(d) {
            d.x0 = d.x;
            d.dx0 = d.dx;
        }

        // When switching data: interpolate the arcs in data space.
        function arcTweenData(a, i) {
            var oi = d3.interpolate({x: a.x0, dx: a.dx0}, a);
            function tween(t) {
                var b = oi(t);
                a.x0 = b.x;
                a.dx0 = b.dx;
                return arc(b);
            }
            if (i == 0) {
                // If we are on the first arc, adjust the x domain to match the root node
                // at the current zoom level. (We only need to do this once.)
                var xd = d3.interpolate(x.domain(), [node.x, node.x + node.dx]);
                return function(t) {
                    x.domain(xd(t));
                    return tween(t);
                };
            }
            else {
                return tween;
            }
        }

        // When zooming: interpolate the scales
        function arcTweenZoom(d) {
            var xd = d3.interpolate(x.domain(), [d.x, d.x + d.dx]),
                yd = d3.interpolate(y.domain(), [d.y, 1]),
                yr = d3.interpolate(y.range(), [d.y ? 20 : 0, radius]);

            return function(d, i) {
                return i
                ? function(t) { return arc(d); }
                : function(t) { x.domain(xd(t)); y.domain(yd(t)).range(yr(t)); return arc(d); };
            };
        }
    }
});


text:
author: Michael Paquier
comments: false
lastmod: 2012-12-25
date: 2012-12-25 14:44:32+00:00
layout: post
type: post
slug: postgres-9-3-feature-highlight-timeline-switch-of-slave-node-without-archives
title: 'Postgres 9.3 feature highlight - timeline switch of slave node without archives'
categories:
- PostgreSQL-2
tags:
- 9.3
- postgres
- postgresql
- replication
- timeline

---

Since PostgreSQL 9.1, it is possible to switch a standby server to follow another server that has been freshly promoted after the master node of a cluster is out due to a failure (disaster or another). In this example, a master and two slaves are running on the same machine. The master running with port 5432 fails, Slave 1 is promoted as the new master:

    pg_ctl promote -D $SLAVE1_DATA

As the master is not accessible, Slave 2 is unable to keep pace in the cluster. So you need to update the following parameters of recovery.conf of Slave 2 as follows to reconnect it to the new master (which is now Slave 1):

    primary_conninfo = 'host=localhost port=5532 application_name=slave2
    recovery_target_timeline = 'latest'

Finally restart Slave 2 to continue recovery from the new master.

    pg_ctl restart -D $SLAVE2_DATA

When doing this in PostgreSQL 9.1 and 9.2, you need a WAL archive (archive\_mode = 'on' on all servers) to allow a standby to recover WAL files that are missing in order to complete the timeline change (please note that you can also copy the WAL files from the slave node directly). If no archive is available, a standby trying to reconnect to a promoted node will stop its recovery with those types of errors due to missing WAL information:

    FATAL:  timeline 2 of the primary does not match recovery target timeline 1

This can only be solved by copying the WAL segments from the master node or using a WAL archive.

However, in order to make Postgres cluster management far more flexible, the following feature has been developed for 9.3:

    commit abfd192b1b5ba5216ac4b1f31dcd553106304b19
    Author: Heikki Linnakangas <heikki.linnakangas@iki.fi>
    Date:   Thu Dec 13 19:00:00 2012 +0200

    Allow a streaming replication standby to follow a timeline switch.

    Before this patch, streaming replication would refuse to start replicating
    if the timeline in the primary doesn't exactly match the standby. The
    situation where it doesn't match is when you have a master, and two
    standbys, and you promote one of the standbys to become new master.
    Promoting bumps up the timeline ID, and after that bump, the other standby
    would refuse to continue.

    There's significantly more timeline related logic in streaming replication
    now. First of all, when a standby connects to primary, it will ask the
    primary for any timeline history files that are missing from the standby.
    The missing files are sent using a new replication command TIMELINE_HISTORY,
    and stored in standby's pg_xlog directory. Using the timeline history files,
    the standby can follow the latest timeline present in the primary
    (recovery_target_timeline='latest'), just as it can follow new timelines
    appearing in an archive directory.

    START_REPLICATION now takes a TIMELINE parameter, to specify exactly which
    timeline to stream WAL from. This allows the standby to request the primary
    to send over WAL that precedes the promotion. The replication protocol is
    changed slightly (in a backwards-compatible way although there's little hope
    of streaming replication working across major versions anyway), to allow
    replication to stop when the end of timeline reached, putting the walsender
    back into accepting a replication command.

    Many thanks to Amit Kapila for testing and reviewing various versions of
    this patch.

This feature allows to switch to the latest timeline on a standby server just by using streaming replication, a WAL archive becoming non-mandatory (archive\_mode = 'off' on all servers). In order to complete that, a new streaming replication command called TIMELINE\_HISTORY has been created, which makes the standby recover all the missing timeline history files from the node it connects to, facilitating the switch to the latest timeline available.

When timeline history files are requested from another node, the following things are logged:

    LOG:  fetching timeline history file for timeline 2 from primary server
    LOG:  started streaming WAL from primary at 0/5000000 on timeline 1
    LOG:  replication terminated by primary server
    DETAIL:  End of WAL reached on timeline 1
    LOG:  restarted WAL streaming at 0/5000000 on timeline 2

Removing the obligation to use WAL archives really brings more flexibility in a PostgreSQL cluster, making this feature a non-negligible must-have, especially when thinking about cascading nodes. However, having that does not mean that you should bypass the use of WAL archives, so be sure to tune your system depending on the needs of your applications.


text:
package org.apache.camel.itest.karaf;

import org.junit.Test;
import org.junit.runner.RunWith;
import org.ops4j.pax.exam.Option;
import org.ops4j.pax.exam.junit.Configuration;
import org.ops4j.pax.exam.junit.JUnit4TestRunner;

@RunWith(JUnit4TestRunner.class)
public class CamelCxfTest extends AbstractFeatureTest {

    public static final String COMPONENT = extractName(CamelCxfTest.class);

    @Test
    public void test() throws Exception {
        testComponent(COMPONENT);
        testComponent("cxfrs");
        testComponent("cxfbean");
    }

    @Configuration
    public static Option[] configure() {
        return configure(COMPONENT);
    }

}


text:
package com.yanzhenjie.nohttp.cache;

import android.content.Context;
import android.database.sqlite.SQLiteDatabase;

import com.yanzhenjie.nohttp.db.BasicSQLHelper;

/**
 *
CacheStore database operation class.

 * Created in Jan 10, 2016 12:39:15 AM.
 *
 * @author Yan Zhenjie;
 */
class CacheSQLHelper extends BasicSQLHelper {

    private static final String DB_CACHE_NAME = "_nohttp_cache_db.db";
    private static final int DB_CACHE_VERSION = 3;
    static final String TABLE_NAME = "cache_table";
    static final String KEY = "key";
    static final String HEAD = "head";
    static final String DATA = "data";
    static final String LOCAL_EXPIRES = "local_expires";

    private static final String SQL_CREATE_TABLE = "CREATE TABLE cache_table" +
            "(_id INTEGER PRIMARY KEY AUTOINCREMENT, key TEXT, head TEXT, data text, local_expires text)";
    private static final String SQL_CREATE_UNIQUE_INDEX = "CREATE UNIQUE INDEX cache_unique_index ON cache_table(\"key\")";
    private static final String SQL_DELETE_TABLE = "DROP TABLE IF EXISTS cache_table";

    public CacheSQLHelper(Context context) {
        super(context, DB_CACHE_NAME, null, DB_CACHE_VERSION);
    }

    @Override
    public void onCreate(SQLiteDatabase db) {
        db.beginTransaction();
        try {
            db.execSQL(SQL_CREATE_TABLE);
            db.execSQL(SQL_CREATE_UNIQUE_INDEX);
            db.setTransactionSuccessful();
        } finally {
            db.endTransaction();
        }
    }

    @Override
    public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        if (newVersion != oldVersion) {
            db.beginTransaction();
            try {
                db.execSQL(SQL_DELETE_TABLE);
                db.execSQL(SQL_CREATE_TABLE);
                db.execSQL(SQL_CREATE_UNIQUE_INDEX);
                db.setTransactionSuccessful();
            } finally {
                db.endTransaction();
            }
        }
    }

    public void onDowngrade(SQLiteDatabase db, int oldVersion, int newVersion) {
        onUpgrade(db, oldVersion, newVersion);
    }
}


text:
import * as fs from 'fs-extra';
import * as path from 'path';
import {Utils as $}  from  './utils';
import * as def from  './def';
import * as _ from  'underscore';
import {ErrorLast} from './error-last';
import {Setting, Ids}  from './setting';

export class CmdUtils extends ErrorLast {

  public parseids(val: string): Ids {
    let res: Ids = {};
    if (val === '*') return res;
    _.each(val.split(','), (val) => {
      let kv = val.split(':');
      let key = res[kv[0]] = {};
      if (kv.length == 2) {
        _.each(kv[1].split(';'), (val) => {
          let defval = val.split('=');
          key[defval[0].trim()] = defval[1].trim();
        });

      } if (kv.length > 2) {
        this.error(`Error format ${val}`);
        return {};
      }
    });
    return res;

  }

  public templdir(val: string) {
    if (!path.isAbsolute(val))
      val = path.normalize(path.join(Setting.__root, val));
    if (!fs.existsSync(val)) {
      this.error(`path ${val} not exists`);
      return undefined;
    }

    if (!$.readAbsDir(val)) {
      this.error(`path ${val} does not implement the required structure. See ${Setting.templ_dir} structure`);
    }

    return val;
  }

  public indir(val: string) {
    if (!path.isAbsolute(val))
      val = path.normalize(path.join(Setting.__root, val));
    if (!fs.existsSync(val)) {
      this.error(`path ${val} not exists`);
      return undefined;
    }

    return val;
  }

  public emptydir(val: string): string {
    if (!path.isAbsolute(val))
      val = path.normalize(path.join(Setting.__root, val));
    fs.emptyDirSync(val)
    return val;
  }
}


text:
package net.hycrafthd.corelib.util;

import net.minecraft.block.Block;
import net.minecraft.item.ItemStack;
import net.minecraft.tileentity.TileEntity;
import net.minecraft.util.BlockPos;
import net.minecraft.world.World;

/**
 * Util methods for {@link Block}
 *
 * @author HyCraftHD (https://www.hycrafthd.net)
 *
 */
public class BlockUtil {

	/**
	 * Get block from object
	 *
	 * @param obj
	 *            Object
	 * @return Block or null if not found
	 */
	public static Block from(Object obj) {
		ItemStack stack = ItemStackUtil.from(obj);
		if (stack == null || stack.getItem() == null) {
			return null;
		}
		return Block.getBlockFromItem(stack.getItem());
	}

	/**
	 * Gets the tileentity at block position
	 *
	 * @param world
	 *            Tileentity world
	 * @param pos
	 *            Tileentity position
	 * @return Tileentity or null if not found
	 */
	public static TileEntity getTileEntity(World world, BlockPos pos) {
		return world.getTileEntity(pos);
	}

}


text:
[![CI Status](http://img.shields.io/travis/Jan Bartel/VIPERS-Router.svg?style=flat)](https://travis-ci.org/Jan Bartel/VIPERS-Router)
[![Version](https://img.shields.io/cocoapods/v/VIPERS-Router.svg?style=flat)](http://cocoapods.org/pods/VIPERS-Router)
[![License](https://img.shields.io/cocoapods/l/VIPERS-Router.svg?style=flat)](http://cocoapods.org/pods/VIPERS-Router)
[![Platform](https://img.shields.io/cocoapods/p/VIPERS-Router.svg?style=flat)](http://cocoapods.org/pods/VIPERS-Router)

Router implementation used by the iOS application framework 'VIPERS'.

At first a very abstract definition (practical information can be found after that ;)):

A router is an object that maps from a routeable item (an object conforming to the empty protocol RoutableProtocol) to a specific Route-Description (an object conforming to the empty protocol RouteDescriptionProtocol). It therefore uses a RouteDefinition (an object conforming to an empty RouteDefinitionProtocol) to map from a Routable to a RouteDescription. A router can therefore convert the Routeable to a RouteDescription and can additionally run a closure wich gets the RouteDescription as a parameter.

The Router implementation in the router class can use any object type as a RouteDefinition, Routable or RouteDescription, as long as there is a mapping defined by the RouteDefinition, which maps from a Routable to a RouteDescription.

To become more practical, the VIPERS default implementation of the RouterProtocol in VIPERS is the DefaultRouter.
A default router maps from a routable string to a DefaultRoute which contains the identifier of the route (the routable string), and some parameters extracted from it.

It would should look like that:

```swift

let router = DefaultRouter()
let routeDefinition : String = "/testRoute/:id"

do {

    try router.addRouteDefinition(routeDefinition) { ( route : DefaultRoute ) in
        print("this block is called when router.routeAndCallHandler is called with a valid routable")
        print("identifier: \(route.identifier)")
        print("parameters: \(route.parameters)")
    }

    let route1 : DefaultRoute = try router.routeAndCallHandler("/testRoute/15")
    print("route1: \(route1)")

} catch let error {
    // implement your error handling here
}

```

## Example

To run the example project, clone the repo, and run `pod install` from the Example directory first.

## Requirements

## Installation

VIPERS-Router is available through [CocoaPods](http://cocoapods.org). To install
it, simply add the following line to your Podfile:

```ruby
pod "VIPERS-Router"
```

## Author

Jan Bartel, barteljan@yahoo.de

## License

VIPERS-Router is available under the MIT license. See the LICENSE file for more info.


text:
<html>
<body>
<?php
$post_data = array(
    // 'From' doesn't matter; For transactional, this will be replaced with your SenderId;
    // For promotional, this will be ignored by the SMS gateway
    'From'   => '8808891988',
    'To'    => '9052161119',
    'Body'  => 'Reply 1/2 to 8088919888 to choose an appointment with Dr. Rajasekar', //Incase you are wondering who Dr. Rajasekhar is http://en.wikipedia.org/wiki/Dr._Rajasekhar_(actor)
);

$exotel_sid = "xxxx"; // Your Exotel SID - Get it from here: http://my.exotel.in/Exotel/settings/site#api-settings
$exotel_token = "xxxx"; // Your exotel token - Get it from here: http://my.exotel.in/Exotel/settings/site#api-settings

$url = "https://".$exotel_sid.":".$exotel_token."@twilix.exotel.in/v1/Accounts/".$exotel_sid."/Sms/send";

$ch = curl_init();
curl_setopt($ch, CURLOPT_VERBOSE, 1);
curl_setopt($ch, CURLOPT_URL, $url);
curl_setopt($ch, CURLOPT_POST, 1);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
curl_setopt($ch, CURLOPT_FAILONERROR, 0);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($post_data));

$http_result = curl_exec($ch);
$error = curl_error($ch);
$http_code = curl_getinfo($ch ,CURLINFO_HTTP_CODE);

curl_close($ch);

print "Response = ".print_r($http_result);
?>

</body>
</html>


text:
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;

namespace Moonlit.Mvc
{
    public class Messages
    {
        public static Messages Current
        {
            get
            {
                Messages messages = HttpContext.Current.GetObject<Messages>();
                if (messages == null)
                {
                    var loader = DependencyResolver.Current.GetService<IMessageLoader>(false);
                    if (loader == null)
                    {
                        return null;
                    }
                    messages = loader.LoadMessages();
                    HttpContext.Current.SetObject(messages);
                }
                return messages;
            }
        }
        public IEnumerable<Message> Items { get; private set; }

        public Messages(IEnumerable<Message> tasks)
        {
            var items = tasks.ToList();
            Items = items;
            Count = items.Count();
        }

        public string Url { get; set; }
        public int Count { get; set; }
    }
}


text:
const path = require('path');
const AnnotationSet = require('noframenet-core').AnnotationSet;
const Corpus = require('noframenet-core').Corpus;
const Document = require('noframenet-core').Document;
const Frame = require('noframenet-core').Frame;
const FrameElement = require('noframenet-core').FrameElement;
const FEHierarchy = require('noframenet-core').FEHierarchy;
const FrameHierarchy = require('noframenet-core').FrameHierarchy;
const FERelation = require('noframenet-core').FERelation;
const FrameRelation = require('noframenet-core').FrameRelation;
const FrameRelationType = require('noframenet-core').FrameRelationType;
const Label = require('noframenet-core').Label;
const LexUnit = require('noframenet-core').LexUnit;
const Lexeme = require('noframenet-core').Lexeme;
const Pattern = require('noframenet-core').Pattern;
const SemType = require('noframenet-core').SemType;
const Sentence = require('noframenet-core').Sentence;
const ValenceUnit = require('noframenet-core').ValenceUnit;
const mongoose = require('mongoose');
const Promise = require('bluebird');

const config = require('./../config');
const driver = require('./../db/mongoose');
const hierarchiesExtractor = require('./extraction/hierarchies');
const framesExtractor = require('./extraction/frames');
const fullTextsExtractor = require('./extraction/fullTexts');
const lexUnitsExtractor = require('./extraction/lexUnits');
const relationsExtractor = require('./extraction/relations');
const semTypesExtractor = require('./extraction/semTypes');

mongoose.Promise = Promise;

const logger = config.logger;

const INSERTMANY_BATCH_SIZE = 1000;

async function saveDataToDatabase(annoSetsMap, corporaMap, documentsMap,
                                  labels, patternsMap, sentencesMap,
                                  valenceUnitsMap) {
  const annosets = Array.from(annoSetsMap.values());
  const corpora = Array.from(corporaMap.values());
  const documents = Array.from(documentsMap.values());
  const patterns = Array.from(patternsMap.values());
  const sentences = Array.from(sentencesMap.values());
  const valenceUnits = Array.from(valenceUnitsMap.values());
  logger.info('Saving AnnotationSet documents...');
  // await AnnotationSet.collection.insertMany(annosets, { ordered: false });
  // Fixed bug with v3.6.2 of mongodb where BSON object size limit is exceeded
  // when processing all annosets at once (same for sentences below)
  for (let i = 0; i < annosets.length; i += INSERTMANY_BATCH_SIZE) {
    await AnnotationSet.collection.insertMany(annosets.slice(i, i + INSERTMANY_BATCH_SIZE),
                                              { ordered: false });
  }
  logger.info('Done saving AnnotationSet documents');
  logger.info('Saving Corpus documents...');
  await Corpus.collection.insertMany(corpora, { ordered: false });
  logger.info('Done saving Corpus documents');
  logger.info('Saving Document documents...');
  await Document.collection.insertMany(documents, { ordered: false });
  logger.info('Done saving Document documents');
  logger.info('Saving Label documents...');
  await Label.collection.insertMany(labels, { ordered: false });
  logger.info('Done saving Label documents');
  logger.info('Saving Pattern documents...');
  await Pattern.collection.insertMany(patterns, { ordered: false });
  logger.info('Done saving Pattern documents');
  logger.info('Saving Sentence documents...');
  // await Sentence.collection.insertMany(sentences, { ordered: false });
  for (let i = 0; i < sentences.length; i += INSERTMANY_BATCH_SIZE) {
    await Sentence.collection.insertMany(sentences.slice(i, i + INSERTMANY_BATCH_SIZE),
                                         { ordered: false });
  }
  logger.info('Done saving Sentence documents');
  logger.info('Saving ValenceUnit documents...');
  await ValenceUnit.collection.insertMany(valenceUnits, { ordered: false });
  logger.info('Done saving ValenceUnit documents');
}

function saveRelationsAndSemTypesToDatabase(feRelations, frameRelations,
                                            frameRelationTypes, semTypes) {
  return Promise.all([
    FERelation.collection.insertMany(feRelations),
    FrameRelation.collection.insertMany(frameRelations),
    FrameRelationType.collection.insertMany(frameRelationTypes),
    SemType.collection.insertMany(semTypes),
  ]);
}

function saveFramesDataToDatabase(framesMap, fesMap, lexUnitsMap, lexemes) {
  return Promise.all([
    Frame.collection.insertMany(Array.from(framesMap.values()), { ordered: false }),
    FrameElement.collection.insertMany(Array.from(fesMap.values()), { ordered: false }),
    LexUnit.collection.insertMany(Array.from(lexUnitsMap.values()), { ordered: false }),
    Lexeme.collection.insertMany(lexemes, { ordered: false }),
  ]);
}

function saveHierarchiesToDatabase(frameHierarchyMap, feHierarchyMap) {
  return Promise.all([
    FrameHierarchy.collection.insertMany(Array.from(frameHierarchyMap.values()),
                                         { ordered: false }),
    FEHierarchy.collection.insertMany(Array.from(feHierarchyMap.values()), { ordered: false }),
  ]);
}

async function importFrameNetData(dbUri, lexUnitDir, lexUnitChunkSize,
                                  frameDir, frameChunkSize, fullTextDir,
                                  relationsFilePath, semTypesFilePath,
                                  importLexUnits, importFullTexts,
                                  importHierarchy) {
  await driver.connectToDatabase(dbUri);

  // Maps are for unique documents
  const annoSetsMap = new Map();
  const corporaMap = new Map();
  const documentsMap = new Map();
  const framesMap = new Map();
  const fesMap = new Map();
  const frameHierarchyMap = new Map();
  const feHierarchyMap = new Map();
  const lexUnitsMap = new Map();
  const patternsMap = new Map();
  const sentencesMap = new Map();
  const valenceUnitsMap = new Map();
  const frameRelations = [];
  const frameRelationTypes = [];
  const feRelations = [];
  const labels = [];
  const lexemes = [];
  const semTypes = [];

  await framesExtractor.extractFrames(frameDir, frameChunkSize, framesMap,
                                      fesMap, lexUnitsMap, lexemes);
  logger.info('Done extracting frames');
  logger.verbose(`  framesMap.size = ${framesMap.size}`);
  logger.verbose(`  fesMap.size = ${fesMap.size}`);
  logger.verbose(`  lexUnitsMap.size = ${lexUnitsMap.size}`);
  logger.verbose(`  lexemes.length = ${lexemes.length}`);

  await saveFramesDataToDatabase(framesMap, fesMap, lexUnitsMap, lexemes);

  await relationsExtractor.extractRelations(relationsFilePath, feRelations,
                                            frameRelations, frameRelationTypes);
  logger.info('Done extracting relations');
  logger.verbose(`  frameRelationTypes.length = ${frameRelationTypes.length}`);
  logger.verbose(`  frameRelations.length = ${frameRelations.length}`);
  logger.verbose(`  feRelations.length = ${feRelations.length}`);

  await semTypesExtractor.extractSemTypes(semTypesFilePath, semTypes);
  logger.info('Done extracting semTypes');
  logger.verbose(`  semTypes.length = ${semTypes.length}`);

  await saveRelationsAndSemTypesToDatabase(feRelations, frameRelations,
                                           frameRelationTypes, semTypes);

  if (importHierarchy) {
    hierarchiesExtractor.extractHierarchies(feRelations, frameRelations,
                                            frameRelationTypes, framesMap,
                                            fesMap, frameHierarchyMap,
                                            feHierarchyMap);
    await saveHierarchiesToDatabase(frameHierarchyMap, feHierarchyMap);
    logger.info('Done extracting hierarchy');
  }

  if (importLexUnits) {
    await lexUnitsExtractor.extractLexUnits(lexUnitDir, lexUnitChunkSize,
                                            annoSetsMap, labels, patternsMap,
                                            sentencesMap, valenceUnitsMap);
    logger.info('Done extracting lexUnits');
  }

  if (importFullTexts) {
    await fullTextsExtractor.extractFullTexts(fullTextDir, annoSetsMap,
                                              corporaMap, documentsMap, labels,
                                              patternsMap, sentencesMap,
                                              valenceUnitsMap);
    logger.info('Done extracting fullTexts');
  }

  logger.info('Saving data to database. This can take several minutes...');
  await saveDataToDatabase(annoSetsMap, corporaMap, documentsMap,
                           labels, patternsMap, sentencesMap, valenceUnitsMap);
  logger.info('Done saving data to database');
  logger.verbose(`  annoSetsMap.size = ${annoSetsMap.size}`);
  logger.verbose(`  corporaMap.size = ${corporaMap.size}`);
  logger.verbose(`  documentsMap.size = ${documentsMap.size}`);
  logger.verbose(`  fesMap.size = ${fesMap.size}`);
  logger.verbose(`  framesMap.size = ${framesMap.size}`);
  logger.verbose(`  frameHierarchyMap.size = ${frameHierarchyMap.size}`);
  logger.verbose(`  feHierarchyMap.size = ${feHierarchyMap.size}`);
  logger.verbose(`  labels.length = ${labels.length}`);
  logger.verbose(`  lexemes.length = ${lexemes.length}`);
  logger.verbose(`  lexUnitsMap.size = ${lexUnitsMap.size}`);
  logger.verbose(`  patternsMap.size = ${patternsMap.size}`);
  logger.verbose(`  sentencesMap.size = ${sentencesMap.size}`);
  logger.verbose(`  valenceUnitsMap.size = ${valenceUnitsMap.size}`);
  await mongoose.disconnect();
}

if (require.main === module) {
  const startTime = process.hrtime();
  const dbUri = config.dbUri;
  const importLexUnits = config.importLexUnits;
  const importFullTexts = config.importFullTexts;
  const importHierarchy = config.importHierarchy;
  const lexUnitDir = path.join(config.splitsDir, 'lu');
  const lexUnitChunkSize = config.lexUnitChunkSize;
  const frameDir = path.join(config.frameNetDir, 'frame');
  const frameChunkSize = config.frameChunkSize;
  const fullTextDir = path.join(config.splitsDir, 'fulltext');
  const relationsFilePath = path.join(config.frameNetDir, 'frRelation.xml');
  const semTypesFilePath = path.join(config.frameNetDir, 'semTypes.xml');
  importFrameNetData(dbUri, lexUnitDir, lexUnitChunkSize, frameDir,
                     frameChunkSize, fullTextDir, relationsFilePath,
                     semTypesFilePath, importLexUnits, importFullTexts,
                     importHierarchy)
    .then(() => logger.info(`FrameNet data import completed in ${process.hrtime(startTime)[0]}s`));
}


text:
using System;

namespace NNbt
{
    /// <summary>
    /// Defines the type of an NBT tag.
    /// </summary>
    public enum TagType
    {
        /// <summary>
        /// A null tag, used to terminate lists.
        /// </summary>
        End = 0,

        /// <summary>
        /// A tag containing an 8-bit signed integer.
        /// </summary>
        Byte = 1,

        /// <summary>
        /// A tag containing a 16-bit signed integer.
        /// </summary>
        Short = 2,

        /// <summary>
        /// A tag containing a 32-bit signed integer.
        /// </summary>
        Int = 3,

        /// <summary>
        /// A tag containing a 64-bit signed integer.
        /// </summary>
        Long = 4,

        /// <summary>
        /// A tag containing a 32-bit (single precision) floating-point value.
        /// </summary>
        Float = 5,

        /// <summary>
        /// A tag containing a 64-bit (double precision) floating-point value.
        /// </summary>
        Double = 6,

        /// <summary>
        /// A tag containing an array of unsigned 8-bit byte values.
        /// </summary>
        ByteArray = 7,

        /// <summary>
        /// A tag containing a string of text.
        /// </summary>
        String = 8,

        /// <summary>
        /// A tag containing a sequential list of tags, where all tags of of the same type.
        /// </summary>
        List = 9,

        /// <summary>
        /// A tag containing a key-value store of tags, where each tag can be of any type.
        /// </summary>
        Compound = 10,

        /// <summary>
        /// A tag containing an array of signed 32-bit values.
        /// </summary>
        IntArray = 11,

        //-----------------------------------------------------
        // NbtEdge Extensions

        /// <summary>
        /// A tag containing a 16-byte GUID
        /// </summary>
        Guid = 64,
    }
}