text:
##
# Import Modules
#
from __future__ import print_function
import Common.LongFilePathOs as os

import Common.EdkLogger as EdkLogger
from CommonDataClass import DataClass
from CommonDataClass.DataClass import FileClass

## Convert to SQL required string format
def ConvertToSqlString(StringList):
    return map(lambda s: "'" + s.replace("'", "''") + "'", StringList)

## TableFile
#
# This class defined a common table
#
# @param object:     Inherited from object class
#
# @param Cursor:     Cursor of the database
# @param TableName:  Name of the table
#
class Table(object):
    _COLUMN_ = ''
    _ID_STEP_ = 1
    _ID_MAX_ = 0x80000000
    _DUMMY_ = 0

    def __init__(self, Cursor, Name='', IdBase=0, Temporary=False):
        self.Cur = Cursor
        self.Table = Name
        self.IdBase = int(IdBase)
        self.ID = int(IdBase)
        self.Temporary = Temporary

    def __str__(self):
        return self.Table

    ## Create table
    #
    # Create a table
    #
    def Create(self, NewTable=True):
        if NewTable:
            self.Drop()

        if self.Temporary:
            SqlCommand = """create temp table IF NOT EXISTS %s (%s)""" % (self.Table, self._COLUMN_)
        else:
            SqlCommand = """create table IF NOT EXISTS %s (%s)""" % (self.Table, self._COLUMN_)
        EdkLogger.debug(EdkLogger.DEBUG_8, SqlCommand)
        self.Cur.execute(SqlCommand)
        self.ID = self.GetId()

    ## Insert table
    #
    # Insert a record into a table
    #
    def Insert(self, *Args):
        self.ID = self.ID + self._ID_STEP_
        if self.ID >= (self.IdBase + self._ID_MAX_):
            self.ID = self.IdBase + self._ID_STEP_
        Values = ", ".join(str(Arg) for Arg in Args)
        SqlCommand = "insert into %s values(%s, %s)" % (self.Table, self.ID, Values)
        EdkLogger.debug(EdkLogger.DEBUG_5, SqlCommand)
        self.Cur.execute(SqlCommand)
        return self.ID

    ## Query table
    #
    # Query all records of the table
    #
    def Query(self):
        SqlCommand = """select * from %s""" % self.Table
        self.Cur.execute(SqlCommand)
        for Rs in self.Cur:
            EdkLogger.verbose(str(Rs))
        TotalCount = self.GetId()

    ## Drop a table
    #
    # Drop the table
    #
    def Drop(self):
        SqlCommand = """drop table IF EXISTS %s""" % self.Table
        try:
            self.Cur.execute(SqlCommand)
        except Exception as e:
            print("An error occurred when Drop a table:", e.args[0])

    ## Get count
    #
    # Get a count of all records of the table
    #
    # @retval Count:  Total count of all records
    #
    def GetCount(self):
        SqlCommand = """select count(ID) from %s""" % self.Table
        Record = self.Cur.execute(SqlCommand).fetchall()
        return Record[0][0]

    def GetId(self):
        SqlCommand = """select max(ID) from %s""" % self.Table
        Record = self.Cur.execute(SqlCommand).fetchall()
        Id = Record[0][0]
        if Id is None:
            Id = self.IdBase
        return Id

    ## Init the ID of the table
    #
    # Init the ID of the table
    #
    def InitID(self):
        self.ID = self.GetId()

    ## Exec
    #
    # Exec Sql Command, return result
    #
    # @param SqlCommand:  The SqlCommand to be executed
    #
    # @retval RecordSet:  The result after executed
    #
    def Exec(self, SqlCommand):
        EdkLogger.debug(EdkLogger.DEBUG_5, SqlCommand)
        self.Cur.execute(SqlCommand)
        RecordSet = self.Cur.fetchall()
        return RecordSet

    def SetEndFlag(self):
        pass

    def IsIntegral(self):
        Result = self.Exec("select min(ID) from %s" % (self.Table))
        if Result[0][0] != -1:
            return False
        return True

    def GetAll(self):
        return self.Exec("select * from %s where ID > 0 order by ID" % (self.Table))

## TableDataModel
#
# This class defined a table used for data model
#
# @param object:       Inherited from object class
#
#
class TableDataModel(Table):
    _COLUMN_ = """
        ID INTEGER PRIMARY KEY,
        CrossIndex INTEGER NOT NULL,
        Name VARCHAR NOT NULL,
        Description VARCHAR
        """
    def __init__(self, Cursor):
        Table.__init__(self, Cursor, 'DataModel')

    ## Insert table
    #
    # Insert a record into table DataModel
    #
    # @param ID:           ID of a ModelType
    # @param CrossIndex:   CrossIndex of a ModelType
    # @param Name:         Name of a ModelType
    # @param Description:  Description of a ModelType
    #
    def Insert(self, CrossIndex, Name, Description):
        (Name, Description) = ConvertToSqlString((Name, Description))
        return Table.Insert(self, CrossIndex, Name, Description)

    ## Init table
    #
    # Create all default records of table DataModel
    #
    def InitTable(self):
        EdkLogger.verbose("\nInitialize table DataModel started ...")
        Count = self.GetCount()
        if Count is not None and Count != 0:
            return
        for Item in DataClass.MODEL_LIST:
            CrossIndex = Item[1]
            Name = Item[0]
            Description = Item[0]
            self.Insert(CrossIndex, Name, Description)
        EdkLogger.verbose("Initialize table DataModel ... DONE!")

    ## Get CrossIndex
    #
    # Get a model's cross index from its name
    #
    # @param ModelName:    Name of the model
    # @retval CrossIndex:  CrossIndex of the model
    #
    def GetCrossIndex(self, ModelName):
        CrossIndex = -1
        SqlCommand = """select CrossIndex from DataModel where name = '""" + ModelName + """'"""
        self.Cur.execute(SqlCommand)
        for Item in self.Cur:
            CrossIndex = Item[0]

        return CrossIndex


text:
module Alchemy
  class Ingredient < BaseRecord
    class DefinitionError < StandardError; end

    include Hints

    self.table_name = "alchemy_ingredients"

    belongs_to :element, touch: true, class_name: "Alchemy::Element", inverse_of: :ingredients
    belongs_to :related_object, polymorphic: true, optional: true

    after_initialize :set_default_value,
      if: -> { definition.key?(:default) && value.nil? }

    validates :type, presence: true
    validates :role, presence: true

    validates_with Alchemy::IngredientValidator, on: :update, if: :has_validations?

    scope :audios, -> { where(type: "Alchemy::Ingredients::Audio") }
    scope :booleans, -> { where(type: "Alchemy::Ingredients::Boolean") }
    scope :datetimes, -> { where(type: "Alchemy::Ingredients::Datetime") }
    scope :files, -> { where(type: "Alchemy::Ingredients::File") }
    scope :headlines, -> { where(type: "Alchemy::Ingredients::Headline") }
    scope :htmls, -> { where(type: "Alchemy::Ingredients::Html") }
    scope :links, -> { where(type: "Alchemy::Ingredients::Link") }
    scope :nodes, -> { where(type: "Alchemy::Ingredients::Node") }
    scope :pages, -> { where(type: "Alchemy::Ingredients::Page") }
    scope :pictures, -> { where(type: "Alchemy::Ingredients::Picture") }
    scope :richtexts, -> { where(type: "Alchemy::Ingredients::Richtext") }
    scope :selects, -> { where(type: "Alchemy::Ingredients::Select") }
    scope :texts, -> { where(type: "Alchemy::Ingredients::Text") }
    scope :videos, -> { where(type: "Alchemy::Ingredients::Video") }

    class << self
      # Defines getter and setter method aliases for related object
      #
      # @param [String|Symbol] The name of the alias
      # @param [String] The class name of the related object
      def related_object_alias(name, class_name:)
        alias_method name, :related_object
        alias_method "#{name}=", :related_object=

        # Somehow Rails STI does not allow us to use `alias_method` for the related_object_id
        define_method "#{name}_id" do
          related_object_id
        end

        define_method "#{name}_id=" do |id|
          self.related_object_id = id
          self.related_object_type = class_name
        end
      end

      # Modulize ingredient type
      #
      # Makes sure the passed ingredient type is in the +Alchemy::Ingredients+
      # module namespace.
      #
      # If you add custom ingredient class,
      # put them in the +Alchemy::Ingredients+ module namespace
      # @param [String] Ingredient class name
      # @return [String]
      def normalize_type(ingredient_type)
        "Alchemy::Ingredients::#{ingredient_type.to_s.classify.demodulize}"
      end

      def translated_label_for(role, element_name = nil)
        Alchemy.t(
          role,
          scope: "ingredient_roles.#{element_name}",
          default: Alchemy.t("ingredient_roles.#{role}", default: role.humanize),
        )
      end
    end

    # Compatibility method for access from element
    def essence
      self
    end

    # The value or the related object if present
    def value
      related_object || self[:value]
    end

    # Settings for this ingredient from the +elements.yml+ definition.
    def settings
      definition[:settings] || {}
    end

    # Fetches value from settings
    #
    # @param key [Symbol]               - The hash key you want to fetch the value from
    # @param options [Hash]             - An optional Hash that can override the settings.
    #                                     Normally passed as options hash into the content
    #                                     editor view.
    def settings_value(key, options = {})
      settings.merge(options || {})[key.to_sym]
    end

    # Definition hash for this ingredient from +elements.yml+ file.
    #
    def definition
      return {} unless element

      element.ingredient_definition_for(role) || {}
    end

    # The first 30 characters of the value
    #
    # Used by the Element#preview_text method.
    #
    # @param [Integer] max_length (30)
    #
    def preview_text(maxlength = 30)
      value.to_s[0..maxlength - 1]
    end

    # The path to the view partial of the ingredient
    # @return [String]
    def to_partial_path
      "alchemy/ingredients/#{partial_name}_view"
    end

    # The demodulized underscored class name of the ingredient
    # @return [String]
    def partial_name
      self.class.name.demodulize.underscore
    end

    # @return [Boolean]
    def has_validations?
      !!definition[:validate]
    end

    # @return [Boolean]
    def has_hint?
      !!definition[:hint]
    end

    # @return [Boolean]
    def deprecated?
      !!definition[:deprecated]
    end

    # @return [Boolean]
    def has_tinymce?
      false
    end

    # @return [Boolean]
    def preview_ingredient?
      !!definition[:as_element_title]
    end

    private

    def hint_translation_attribute
      role
    end

    def set_default_value
      self.value = default_value
    end

    # Returns the default value from ingredient definition
    #
    # If the value is a symbol it gets passed through i18n
    # inside the +alchemy.default_ingredient_texts+ scope
    def default_value
      default = definition[:default]
      case default
      when Symbol
        Alchemy.t(default, scope: :default_ingredient_texts)
      else
        default
      end
    end
  end
end

redpajama_set_name: RedPajamaGithub


text:
#import "WebNSControlExtras.h"

@implementation NSControl (WebExtras)

- (void)sizeToFitAndAdjustWindowHeight
{
    NSRect frame = [self frame];

    NSSize bestSize = [[self cell] cellSizeForBounds:NSMakeRect(0.0f, 0.0f, frame.size.width, 10000.0f)];

    float heightDelta = bestSize.height - frame.size.height;

    frame.size.height += heightDelta;
    frame.origin.y    -= heightDelta;
    [self setFrame:frame];

    NSWindow *window = [self window];
    NSRect windowFrame = [window frame];

    CGFloat userSpaceScaleFactor;
#if !defined(BUILDING_ON_LEOPARD) && !defined(BUILDING_ON_SNOW_LEOPARD)
    userSpaceScaleFactor = [window backingScaleFactor];
#else
    userSpaceScaleFactor = [window userSpaceScaleFactor];
#endif

    windowFrame.size.height += heightDelta * userSpaceScaleFactor;
    [window setFrame:windowFrame display:NO];
}

@end


text:
import tornado.web
import tornado.ioloop
from datetime import datetime
from aiocache import cached
from aiocache.serializers import JsonSerializer

class MainHandler(tornado.web.RequestHandler):

    # Due some incompatibilities between tornado and asyncio, caches can't use the "timeout" feature
    # in order to make it work, you will have to specify it always to 0
    @cached(key="my_custom_key", serializer=JsonSerializer(), timeout=0)
    async def time(self):
        return {"time": datetime.now().isoformat()}

    async def get(self):
        self.write(await self.time())

if __name__ == "__main__":
    tornado.ioloop.IOLoop.configure('tornado.platform.asyncio.AsyncIOLoop')
    app = tornado.web.Application([(r"/", MainHandler)])
    app.listen(8888)
    tornado.ioloop.IOLoop.current().start()


text:
package com.manickids.quickmemo;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileOutputStream;
import java.util.zip.ZipEntry;
import java.util.zip.ZipInputStream;
import java.util.zip.ZipOutputStream;

public class Compress {

	static final byte[] buffer = new byte[4096];

	public static void createZipFile(String targetPath, String zipPath) throws Exception{
        createZipFile(targetPath, zipPath, false);
    }

	public static void createZipFile(String targetPath, String zipPath, boolean isDirCre) throws Exception {
	    File fTargetPath = new File(targetPath);
	    File[] files = null;
	    if(fTargetPath.isDirectory()) files = fTargetPath.listFiles();
	    else {
	        files = new File[1];
	        files[0] = fTargetPath;
	    }
	    File path = new File(zipPath);
	    File dir = null;
	    dir = new File(path.getParent());
	    if(isDirCre)dir.mkdirs();
	    ZipOutputStream zipOut = new ZipOutputStream(new FileOutputStream(path));
	    makeZipFile(files, zipOut, "");
	    zipOut.close();
	}

    public static void makeZipFile(File[] files, ZipOutputStream zipOut, String targetDir) throws Exception{
        for(int i = 0; i < files.length; i++){
            File compPath = new File(files[i].getPath());
            if(compPath.isDirectory()){
                File[] subFiles = compPath.listFiles();
                makeZipFile(subFiles, zipOut, targetDir+compPath.getName()+"/");
                continue;
            }

            FileInputStream in = new FileInputStream(compPath);
            zipOut.putNextEntry(new ZipEntry(targetDir+"/"+files[i].getName()));
            int data;
            while((data = in.read(buffer)) > 0){
                zipOut.write(buffer, 0, data);
            }
            zipOut.closeEntry();
            in.close();
        }
    }

    public static void unZipFile(String targetZip, String completeDir) throws Exception{
    	unZipFile(targetZip, completeDir, false);
    }

    public static void unZipFile(String targetZip, String completeDir, boolean isDirCre) throws Exception {
        ZipInputStream in = null;
        try{
            File fCompleteDir = null;
            fCompleteDir = new File(completeDir);
            if(isDirCre) fCompleteDir.mkdirs();
            in = new ZipInputStream(new FileInputStream(targetZip));
            ZipEntry entry = null;
            while((entry = in.getNextEntry()) != null){
                String entryName = entry.getName();
                if(entry.getName().lastIndexOf("/") > 0){
                String mkDirNm = entryName.substring(0, entryName.lastIndexOf("/"));
                new File(completeDir + mkDirNm).mkdirs();
            }
            FileOutputStream out = new FileOutputStream(completeDir + entry.getName());
            int bytes_read;
            while((bytes_read = in.read(buffer)) != -1){
                out.write(buffer, 0, bytes_read);
            }
            out.close();
        }
    } catch(Exception e){
        throw new Exception(e);
	} finally {
		in.close();
	}}
}


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>ctest_configure — CMake 3.7.2 Documentation</title>

    <link rel="stylesheet" href="../_static/cmake.css" type="text/css" />
    <link rel="stylesheet" href="../_static/pygments.css" type="text/css" />

    <link rel="shortcut icon" href="../_static/cmake-favicon.ico"/>
    <link rel="top" title="CMake 3.7.2 Documentation" href="../index.html" />
    <link rel="up" title="cmake-commands(7)" href="../manual/cmake-commands.7.html" />
    <link rel="next" title="ctest_coverage" href="ctest_coverage.html" />
    <link rel="prev" title="ctest_build" href="ctest_build.html" />

Navigation

          index

          next |

          previous |

    CMake »

    3.7.2 Documentation »

cmake-commands(7) »

ctest_configure¶

Perform the CTest Configure Step as a Dashboard Client.

ctest_configure([BUILD <build-dir>] [SOURCE <source-dir>] [APPEND]
                [OPTIONS <options>] [RETURN_VALUE <result-var>] [QUIET]
                [CAPTURE_CMAKE_ERROR <result-var>])

Configure the project build tree and record results in Configure.xml
for submission with the ctest_submit() command.

The options are:

BUILD <build-dir>

Specify the top-level build directory.  If not given, the
CTEST_BINARY_DIRECTORY variable is used.

SOURCE <source-dir>

Specify the source directory.  If not given, the
CTEST_SOURCE_DIRECTORY variable is used.

APPEND

Mark Configure.xml for append to results previously submitted to a
dashboard server since the last ctest_start() call.
Append semantics are defined by the dashboard server in use.
This does not cause results to be appended to a .xml file
produced by a previous call to this command.

OPTIONS <options>

Specify command-line arguments to pass to the configuration tool.

RETURN_VALUE <result-var>

Store in the <result-var> variable the return value of the native
configuration tool.

CAPTURE_CMAKE_ERROR <result-var>

Store in the <result-var> variable -1 if there are any errors running
the command and prevent ctest from returning non-zero if an error occurs.

QUIET

Suppress any CTest-specific non-error messages that would have
otherwise been printed to the console.  Output from the underlying
configure command is not affected.

Previous topic

ctest_build

Next topic

ctest_coverage

This Page

Show Source

Quick search

    <form class="search" action="../search.html" method="get">
      <input type="text" name="q" />
      <input type="submit" value="Go" />
      <input type="hidden" name="check_keywords" value="yes" />
      <input type="hidden" name="area" value="default" />
    </form>

    Enter search terms or a module, class or function name.

Navigation

          index

          next |

          previous |

    CMake »

    3.7.2 Documentation »

cmake-commands(7) »

        © Copyright 2000-2016 Kitware, Inc. and Contributors.
      Created using Sphinx 1.4a0+.


text:
$(document).ready(function() {

$('.virtual-child').each(function() {
    var list = $(this).parent();
    var button = $('a.add', list);
    var item_with_button = $('> :has(a.add)', list);
    var virtual = $(this).remove().removeClass('virtual-child');
    var html = $('<div>').append(virtual).html();
    var next_id = Number(button.text());
    button.text('');

    button.click(function(evt) {
        evt.preventDefault();
        var next_html = html.replace(/NEW_LIST_ITEM/g, next_id);
        var new_item = $('<div>').html(next_html).children();
        item_with_button.before(new_item);
        next_id += 1;
    });
});

});


text:
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Windows.Markup;

namespace DragonSpark.Windows.Entity
{
	[ContentProperty( nameof(Steps) )]
	public abstract class Installer : IInstaller
	{
		public Guid Id { get; set; }

		[TypeConverter( typeof(VersionConverter) )]
		public Version Version { get; set; }

		public Type ContextType { get; set; }

		IEnumerable<IInstallationStep> IInstaller.Steps => Steps;

		public DragonSpark.Runtime.DeclarativeCollection<IInstallationStep> Steps { get; } = new DragonSpark.Runtime.DeclarativeCollection<IInstallationStep>();
	}
}


text:
var web_domain = 'http://localhost/wecool';
//提示框
function note_info(info, color_type, evt) {
    var iHeight = parseInt(document.documentElement.scrollHeight);
    var _event = evt ? evt : evt.event;
    var divx;
    var divy;
    $('body').append('

')
	var tops = document.body.scrollTop | document.documentElement.scrollTop;
    var scrollHeight = tops - parseInt('60');
    document.getElementById('op_result').style.top = _event.clientY + scrollHeight + 'px';
    document.getElementById('op_result').style.left = _event.clientX + 'px';
    var color_value = 'box_cue_' + color_type;
    $("#op_result").attr("class", color_value);
    $("#op_result").html(info);
    $("#op_result").animate({opacity: 'show'}, 'slow');

    setTimeout("$('#op_result').animate({opacity:'hide'},'slow');", 3000);
}

function resizeImg(which, w) {

    var block = document.getElementById(which);
    var imgs = block.getElementsByTagName("img");
    for (var i = 0; i < imgs.length; i++) {
        var ow = imgs[i].width;
        var oh = imgs[i].height;
        var hw = oh / ow;
        if (ow > w) {
            imgs[i].width = w;
            imgs[i].height = w * hw;
        }
    }
}

function success(msg, e) {
    if (e == null) {
        var x = $(window).height() / 2 + $(document).scrollTop() - 60;
        var y = $(window).width() / 2 + $(document).scrollLeft();
    } else {
        var x = e.pageY || e.originalEvent.x || e.originalEvent.layerX || $(window).height() / 2 + $(document).scrollTop() - 60;
        var y = e.pageY || e.originalEvent.y || e.originalEvent.layerY || $(window).width() / 2 + $(document).scrollLeft();
    }
    if ($("#op_result").length == 0) {
        $("body").append('

');
    }
    $("#op_result").attr('class', 'box_cue_green');
    $("#op_result").html(msg).css({top: x + 'px', 'left': y + 'px'}).animate({opacity: 'show'}, 'slow');
    setTimeout("$('#op_result').animate({opacity:'hide'},'slow');", 3000);
}

function error(msg, e) {
    if (e == null) {
        var x = $(window).height() / 2 + $(document).scrollTop() - 60;
        var y = $(window).width() / 2 + $(document).scrollLeft();
    } else {
        var x = e.pageY || e.originalEvent.x || e.originalEvent.layerX || $(window).height() / 2 + $(document).scrollTop() - 60;
        var y = e.pageY || e.originalEvent.y || e.originalEvent.layerY || $(window).width() / 2 + $(document).scrollLeft();
    }
    if ($("#op_result").length == 0) {
        $("body").append('

');
    }
    $("#op_result").attr('class', 'box_cue_yellow');
    $("#op_result").html(msg).css({top: x + 'px', 'left': y + 'px'}).animate({opacity: 'show'}, 'slow');
    setTimeout("$('#op_result').animate({opacity:'hide'},'slow');", 3000);
}
function pageX(elem) {
    return elem.offsetParent ? (elem.offsetLeft + pageX(elem.offsetParent)) : elem.offsetLeft;
}
function pageY(elem) {
    return elem.offsetParent ? (elem.offsetTop + pageY(elem.offsetParent)) : elem.offsetTop;
}
//日期转换成
function transdate(endTime){
var date=new Date();
date.setFullYear(endTime.substring(0,4));
date.setMonth(endTime.substring(5,7)-1);
date.setDate(endTime.substring(8,10));
date.setHours(endTime.substring(11,13));
date.setMinutes(endTime.substring(14,16));
date.setSeconds(endTime.substring(17,19));
return Date.parse(date)/1000;
}
//判断URL
function IsUrl(str) {
var RegUrl = new RegExp();
RegUrl.compile("^[A-Za-z]+://[A-Za-z0-9-_]+\\.[A-Za-z0-9-_%&\?\/.=]+$");
if (!RegUrl.test(str)) {
return false;
}
return true;
}


text:
import path from 'path'

import context from './get-root-path'
import runWebpack from './run-webpack'

const WEBPACK = path.resolve(context, 'node_modules/.bin/webpack')

export default function() {
  process.env.IS_BUILD_COMMAND = true

  return runWebpack(WEBPACK)
}


text:
describe('AccountSender', function () {

    var account;

    beforeEach(function () {
        account = new enplug.classes.AccountSender();
    });

    afterEach(function () {
        account.transport.cleanup();
    });

    it('should validate asset ID when removing an asset', function () {
        var error = new Error(account.transport.TAG + 'You must provide the ID (string) of the asset to delete.');
        expect(function () {
            account.deleteAsset();
        }).toThrow(error);
    });

    it('should validate theme object when creating a new theme', function () {
        var error = new Error(account.transport.TAG + 'You must provide the theme (object) to save.');
        expect(function () {
            account.saveTheme();
        }).toThrow(error);
    });

    it('should validate theme ID when removing a theme', function () {
        var error = new Error(account.transport.TAG + 'You must provide the ID (string) of the theme to remove.');
        expect(function () {
            account.deleteTheme();
        }).toThrow(error);
    });

    it('should validate theme ID when updating a theme', function () {
        var error = new Error(account.transport.TAG + 'You must provide the theme definition (object).');
        expect(function () {
            account.editTheme();
        }).toThrow(error);
    });
});


text:
/* -*- Mode: C++; tab-width: 2; indent-tabs-mode: nil; c-basic-offset: 2 -*- */
/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1/GPL 2.0/LGPL 2.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (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.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is Mozilla Communicator client code, released
 * March 31, 1998.
 *
 * The Initial Developer of the Original Code is
 * Netscape Communications Corporation.
 * Portions created by the Initial Developer are Copyright (C) 1998
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *
 * Alternatively, the contents of this file may be used under the terms of
 * either the GNU General Public License Version 2 or later (the "GPL"), or
 * the GNU Lesser General Public License Version 2.1 or later (the "LGPL"),
 * in which case the provisions of the GPL or the LGPL are applicable instead
 * of those above. If you wish to allow use of your version of this file only
 * under the terms of either the GPL or the LGPL, and not to allow others to
 * use your version of this file under the terms of the MPL, indicate your
 * decision by deleting the provisions above and replace them with the notice
 * and other provisions required by the GPL or the LGPL. If you do not delete
 * the provisions above, a recipient may use your version of this file under
 * the terms of any one of the MPL, the GPL or the LGPL.
 *
 * ***** END LICENSE BLOCK ***** */

/**
   File Name:          15.8.1.js
   ECMA Section:       15.8.1.js   Value Properties of the Math Object
   15.8.1.1    E
   15.8.1.2    LN10
   15.8.1.3    LN2
   15.8.1.4    LOG2E
   15.8.1.5    LOG10E
   15.8.1.6    PI
   15.8.1.7    SQRT1_2
   15.8.1.8    SQRT2
   Description:        verify the values of some math constants
   Author:             christine@netscape.com
   Date:               7 july 1997

*/
var SECTION = "15.8.1"
  var VERSION = "ECMA_1";
startTest();
var TITLE   = "Value Properties of the Math Object";

writeHeaderToLog( SECTION + " "+ TITLE);

new TestCase( "15.8.1.1", "Math.E",
	      2.7182818284590452354,
	      Math.E );

new TestCase( "15.8.1.1",
	      "typeof Math.E",
	      "number",
	      typeof Math.E );

new TestCase( "15.8.1.2",
	      "Math.LN10",
	      2.302585092994046,
	      Math.LN10 );

new TestCase( "15.8.1.2",
	      "typeof Math.LN10",
	      "number",
	      typeof Math.LN10 );

new TestCase( "15.8.1.3",
	      "Math.LN2",
	      0.6931471805599453,
	      Math.LN2 );

new TestCase( "15.8.1.3",
	      "typeof Math.LN2",
	      "number",
	      typeof Math.LN2 );

new TestCase( "15.8.1.4",
	      "Math.LOG2E",
	      1.4426950408889634,
	      Math.LOG2E );

new TestCase( "15.8.1.4",
	      "typeof Math.LOG2E",
	      "number",
	      typeof Math.LOG2E );

new TestCase( "15.8.1.5",
	      "Math.LOG10E",
	      0.4342944819032518,
	      Math.LOG10E);

new TestCase( "15.8.1.5",
	      "typeof Math.LOG10E",
	      "number",
	      typeof Math.LOG10E);

new TestCase( "15.8.1.6",
	      "Math.PI",
	      3.14159265358979323846,
	      Math.PI );

new TestCase( "15.8.1.6",
	      "typeof Math.PI",
	      "number",
	      typeof Math.PI );

new TestCase( "15.8.1.7",
	      "Math.SQRT1_2",
	      0.7071067811865476,
	      Math.SQRT1_2);

new TestCase( "15.8.1.7",
	      "typeof Math.SQRT1_2",
	      "number",
	      typeof Math.SQRT1_2);

new TestCase( "15.8.1.8",
	      "Math.SQRT2",
	      1.4142135623730951,
	      Math.SQRT2 );

new TestCase( "15.8.1.8",
	      "typeof Math.SQRT2",
	      "number",
	      typeof Math.SQRT2 );

new TestCase( SECTION,
	      "var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS",
	      "",
	      eval("var MATHPROPS='';for( p in Math ){ MATHPROPS +=p; };MATHPROPS") );

test();


text:
import numpy as np
import matplotlib
import matplotlib.pyplot as plt
from pulsar_tools import disp_delay
import math

from matplotlib.widgets import AxesWidget

class VertSlider(AxesWidget):
    """
    A slider representing a floating point range

    The following attributes are defined
      *ax*        : the slider :class:`matplotlib.axes.Axes` instance

      *val*       : the current slider value

      *vline*     : a :class:`matplotlib.lines.Line2D` instance
                     representing the initial value of the slider

      *poly*      : A :class:`matplotlib.patches.Polygon` instance
                     which is the slider knob

      *valfmt*    : the format string for formatting the slider text

      *label*     : a :class:`matplotlib.text.Text` instance
                     for the slider label

      *closedmin* : whether the slider is closed on the minimum

      *closedmax* : whether the slider is closed on the maximum

      *slidermin* : another slider - if not *None*, this slider must be
                     greater than *slidermin*

      *slidermax* : another slider - if not *None*, this slider must be
                     less than *slidermax*

      *dragging*  : allow for mouse dragging on slider

    Call :meth:`on_changed` to connect to the slider event
    """
    def __init__(self, ax, label, valmin, valmax, valinit=0.5, valfmt='%1.2f',
                 closedmin=True, closedmax=True, slidermin=None,
                 slidermax=None, dragging=True, **kwargs):
        """
        Create a slider from *valmin* to *valmax* in axes *ax*

        *valinit*
            The slider initial position

        *label*
            The slider label

        *valfmt*
            Used to format the slider value

        *closedmin* and *closedmax*
            Indicate whether the slider interval is closed

        *slidermin* and *slidermax*
            Used to constrain the value of this slider to the values
            of other sliders.

        additional kwargs are passed on to ``self.poly`` which is the
        :class:`matplotlib.patches.Rectangle` which draws the slider
        knob.  See the :class:`matplotlib.patches.Rectangle` documentation
        valid property names (e.g., *facecolor*, *edgecolor*, *alpha*, ...)
        """
        AxesWidget.__init__(self, ax)

        self.valmin = valmin
        self.valmax = valmax
        self.val = valinit
        self.valinit = valinit
        self.poly = ax.axhspan(valmin, valinit, 0, 1, **kwargs)

        self.vline = ax.axhline(valinit, 0, 1, color='r', lw=1)

        self.valfmt = valfmt
        ax.set_xticks([])
        ax.set_ylim((valmin, valmax))
        ax.set_yticks([])
        ax.set_navigate(False)

        self.connect_event('button_press_event', self._update)
        self.connect_event('button_release_event', self._update)
        if dragging:
            self.connect_event('motion_notify_event', self._update)
        self.label = ax.text(0.5, 1.03, label, transform=ax.transAxes,
                             verticalalignment='center',
                             horizontalalignment='center')

        self.valtext = ax.text(0.5, -0.03, valfmt % valinit,
                               transform=ax.transAxes,
                               verticalalignment='center',
                               horizontalalignment='center')

        self.cnt = 0
        self.observers = {}

        self.closedmin = closedmin
        self.closedmax = closedmax
        self.slidermin = slidermin
        self.slidermax = slidermax
        self.drag_active = False

    def _update(self, event):
        """update the slider position"""
        if self.ignore(event):
            return

        if event.button != 1:
            return

        if event.name == 'button_press_event' and event.inaxes == self.ax:
            self.drag_active = True
            event.canvas.grab_mouse(self.ax)

        if not self.drag_active:
            return

        elif ((event.name == 'button_release_event') or
              (event.name == 'button_press_event' and
               event.inaxes != self.ax)):
            self.drag_active = False
            event.canvas.release_mouse(self.ax)
            return

        val = event.ydata
        if val <= self.valmin:
            if not self.closedmin:
                return
            val = self.valmin
        elif val >= self.valmax:
            if not self.closedmax:
                return
            val = self.valmax

        if self.slidermin is not None and val <= self.slidermin.val:
            if not self.closedmin:
                return
            val = self.slidermin.val

        if self.slidermax is not None and val >= self.slidermax.val:
            if not self.closedmax:
                return
            val = self.slidermax.val

        self.set_val(val)

    def set_val(self, val):
        xy = self.poly.xy
        xy[1] = 0, val
        xy[2] = 1, val
        self.poly.xy = xy
        self.valtext.set_text(self.valfmt % val)
        if self.drawon:
            self.ax.figure.canvas.draw()
        self.val = val
        if not self.eventson:
            return
        for cid, func in self.observers.iteritems():
            func(val)

    def on_changed(self, func):
        """
        When the slider value is changed, call *func* with the new
        slider position

        A connection id is returned which can be used to disconnect
        """
        cid = self.cnt
        self.observers[cid] = func
        self.cnt += 1
        return cid

    def disconnect(self, cid):
        """remove the observer with connection id *cid*"""
        try:
            del self.observers[cid]
        except KeyError:
            pass

    def reset(self):
        """reset the slider to the initial value if needed"""
        if (self.val != self.valinit):
            self.set_val(self.valinit)

def loadfile(filename):
    if filename==None:
        print "No filename supplied to read..."

    with open(filename) as f:
        data = f.read()

    data = data.split('\n')

    while not data[-1]:
        data = data[:-1]
    return data

def obs_stats(time, flags):
    # Not doing total time correctly, depends on last single pulse detection instead of observation time
    flag_time = 0

    for flag in flags:
        flag_time+=(float(flag.split()[1])-float(flag.split()[0]))
    print "%.2f seconds flagged from %.2f seconds of data (%.2f percent)" % ( flag_time, time[-1], flag_time/time[-1]*100)

def flagfile(basename, max_DM=2097.2, freq_l=0.169615, freq_h=0.200335, padding=3):
    """This function takes in a text file of bad 0 DM times and
    writes out one flagged over the correct de-dispersive smearing
    times, looking for overlaps along the way. There must be a text file named
    basename.bad with rows indicating bad times for this to work. """
    from subprocess import Popen

    bads = np.genfromtxt(basename+'.bad')
    i = 0 # initialize counter for new list
    flags = []
    for bad in bads:
        start = bad[0] - (padding + disp_delay(freq1=freq_l, freq2=freq_h, DM=max_DM)/1000)
        if start < 0:
            start = 0
        stop = bad[1] + padding
        if len(flags) > 0:
            if start <= flags[-1][1]:
                flags[-1][1] = stop
            else:
                flags.append([start, stop])
        else:
            flags.append([start, stop])
    np.savetxt(basename+'.flag', flags, fmt='%d')
    Popen(['flag.sh', basename]).communicate()[0]

def max_nth_percent(n, data):
    """ A function that returns the nth percent top value, planned use is for plotting
    :param n: the percentile value desired for return
    :param data: the iterable object searched through
    :return: nth percent largest value
    """
    import heapq

    data=list(data)
    n=float(n)

    return heapq.nlargest(int(len(data)*(n/100.0)), data)[-1]

def singlepulse_plot(basename=None, DMvTime=1, StatPlots=False, raw = False, threshold=5.0, Downsamps=[20, 20, 20], colormap='cool'	):
    """Plots up the flagged data, should switch to using genfromtxt when I have the time"""

    from matplotlib.widgets import RadioButtons, Slider

#    if raw:
    data_raw=loadfile(basename+'.singlepulse')[1:]
#        flags = False
#    else:
    data_flag = loadfile(basename+'_flagged.singlepulse')[1:]
    flags = loadfile(basename+'.flag')

    DM_raw = [float(row.split()[0]) for row in data_raw if float(row.split()[1]) >= threshold]
    Sigma_raw = [float(row.split()[1]) for row in data_raw if float(row.split()[1]) >= threshold]
    Time_raw = [float(row.split()[2]) for row in data_raw if float(row.split()[1]) >= threshold]
    Sample_raw = [int(row.split()[3]) for row in data_raw if float(row.split()[1]) >= threshold]
    Downfact_raw = [int(row.split()[4]) for row in data_raw if float(row.split()[1]) >= threshold]

    DM_flag = [float(row.split()[0]) for row in data_flag if float(row.split()[1]) >= threshold]
    Sigma_flag = [float(row.split()[1]) for row in data_flag if float(row.split()[1]) >= threshold]
    Time_flag = [float(row.split()[2]) for row in data_flag if float(row.split()[1]) >= threshold]
    Sample_flag = [int(row.split()[3]) for row in data_flag if float(row.split()[1]) >= threshold]
    Downfact_flag = [int(row.split()[4]) for row in data_flag if float(row.split()[1]) >= threshold]

    Sigma_float_raw = [float(value) for value in Sigma_raw]
    Downfact_float_raw = [float(value) for value in Downfact_raw]

    Sigma_float_flag = [float(value) for value in Sigma_flag]
    Downfact_float_flag = [float(value) for value in Downfact_flag]

    DM = DM_flag
    Sigma = Sigma_flag
    Time = Time_flag
    Sample = Sample_flag
    Downfact = Downfact_flag

    Sigma_float = Sigma_float_flag
    Downfact_float = Downfact_float_flag

    fig = plt.figure()

    cm = plt.cm.get_cmap(colormap)

    def onpick(event):
        points = event.artist
        ind = event.ind
        mouseevent = event.mouseevent
        print '\n'
        print "Information for data points around click event %.4f, %.4f:" % (mouseevent.xdata,  mouseevent.ydata)
        for i in ind:
            if ( DM[i] < 150):
                boxcar = Downfact[i]
            elif ( 150<= DM[i] < 823.2 ):
                boxcar = Downfact[i] * Downsamps[0]/10
            elif ( 823.2 <= DM[i] < 1486.2):
                boxcar = Downfact[i] * Downsamps[1]/10
            elif ( 1426.2 <= DM[i] < 2100):
                boxcar = Downfact[i] * Downsamps[2]/10
            print "%.2f seconds, %.2f Sigma event detected at a DM of %.2f with a boxcar of: %d ms" % (Time[i], Sigma[i], DM[i], boxcar)

    if StatPlots:
        ax0 = fig.add_subplot(231)
        plt.hist(Sigma, histtype='step', bins=60)
        ax0.set_xlabel('Signal-to-Noise')
        ax0.set_ylabel('Number of Pulses')

        ax1 = fig.add_subplot(232)
        plt.hist(DM, histtype='step', bins=int(0.5*len(set(DM))))
        ax1.set_xlabel('DM (pc cm^-3)')
        ax1.set_ylabel('Number of Pulses')

        ax2 = fig.add_subplot(233)
        sc0=ax2.scatter(DM, Sigma, c=Downfact_float, vmin=min(Downfact_float), vmax=max_nth_percent(10,Downfact_float), cmap='spectral', picker=1)
        ax2.set_ylabel('Signal-to-Noise')
        ax2.set_xlabel('DM (pc cm^-3)')
        ax2.set_xlim([min(DM), max(DM)])
        ax2.set_ylim([min(Sigma), max(Sigma)])
 #       plt.colorbar(sc0, label="Boxcar")
#        fig.canvas.mpl_connect('pick_event', onpick)

        ax3 = fig.add_subplot(212)
    else:
        ax3 = fig.add_subplot(111)

#	ax3.set_title("Single Pulse Sigma")
    ax3.set_xlabel('Time (s)')
    ax3.set_ylabel('DM (pc cm^-3)')
    ax3.set_ylim([min(DM), max(DM)])
    ax3.set_xlim([min(Time), max(Time)])
 #   cm = plt.cm.get_cmap(colormap)
    sc=ax3.scatter(Time,DM, c=Sigma_float, vmin=min(Sigma_float), vmax=max_nth_percent(10,Sigma_float), cmap=cm, picker=1)
#	leg = ax1.legend()
    plt.colorbar(sc, label="Signal-to-Noise")

    rax = plt.axes([0.85, 0.02, 0.13, 0.13])
    radio = RadioButtons(rax, ('Flagged', 'Raw'))
    def datafunc(label):
        plot_argument_dict= {'Flagged':"Time_flag, DM_flag,c=Sigma_float_flag, vmin=min(Sigma_float_flag), vmax=max(Sigma_float_flag)"  , 'Raw':"Time_raw,DM_raw,c=Sigma_float_raw, vmin=min(Sigma_float_raw), vmax=max(Sigma_float_raw)"}
        sc=ax3.scatter(plot_argument_dict[label], cmap=cm, picker=1)
#        ydata = hzdict[label]
#        ax3.set_ydata(ydata)
        plt.draw()
    radio.on_clicked(datafunc)
    axmin = plt.axes([0.85, 0.2, 0.04, 0.3])
    axmax = plt.axes([0.93, 0.2, 0.04, 0.3])
    smin = VertSlider(axmin, 'Min', min(Sigma_float), max(Sigma_float), valinit=min(Sigma_float))
    smax = VertSlider(axmax, 'Max', min(Sigma_float), max(Sigma_float), valinit=max(Sigma_float))
    def update(val):
        sc.vlim([smin.val,smax.val])
        fig.canvas.draw()
#    smin.on_changed(update)
    smax.on_changed(update)
    if not raw:
        for flag in flags:
            flag_area = matplotlib.patches.Rectangle((float(flag.split()[0]), min(DM)), float(flag.split()[1])-float(flag.split()[0]), max(DM)-min(DM),  edgecolor='0', facecolor='0.66')
            ax3.add_patch(flag_area)

    fig.canvas.mpl_connect('pick_event', onpick)

    '''
    ax2 = fig.add_subplot(122)
    ax2.set_title("Single Pulse Boxcar")
    ax2.set_xlabel('Time (s)')
    ax2.set_ylabel('DM (pc cm^-3)')
    cm = plt.cm.get_cmap('RdYlBu')
    sc2=ax2.scatter(Time,DM, c=Downfact_float, vmin=min(Downfact_float), vmax=max(Downfact_float), cmap=cm)
#	leg = ax1.legend()
    plt.colorbar(sc2)
    if not raw:
        for flag in flags:
            flag_area = matplotlib.patches.Rectangle((float(flag.split()[0]), min(DM)), float(flag.split()[1])-float(flag.split()[0]), max(DM)-min(DM),  edgecolor='0', facecolor='0.66')
            ax2.add_patch(flag_area)
    '''
    fig.suptitle('Single Pulse Search results for '+basename)
    plt.show()

    obs_stats(Time, flags)

def slice(infile, dm=None, timerange=None, sigma=None, downfact=None):
    # Not properly implemented yet

    data = read_singlepulse(infile)

    slices = [None]*5

    slice_map = {'dm':0, 'sigma':1, 'timerange':2, 'sample':3, 'downfact':4}

    DM = [row.split()[0] for row in data]
    Sigma = [row.split()[1] for row in data]
    Time = [row.split()[2] for row in data]
    Sample = [row.split()[3] for row in data]
    Downfact = [row.split()[4] for row in data]

    if dm:
        if type(dm) == type(0) or type(0.0):
            data = [row   for row in data if dm <= row.split()[0]]
        elif type(dm) == type([]):
            data = [row  for row in data if dm[0] <= row.split()[0] <= dm[1]]
    if sigma:
        if type(sigma) == type(0) or type(0.0):
            data = [row for row in data if sigma <= row.split()[1]  ]
        elif type(sigma) == type([]):
            data = [row for row in data if sigma[0] <= row.split()[1] <= sigma[1]]


text:
<html>
<script src="rhizome/rhizome.js"></script>
<script>
var users = new Array();
var currentIndex = 0;
rhizome.start( function(err) {
	rhizome.send('/sys/subscribe', ['/broadcast/open/']);
	rhizome.send('/sys/subscribe', ['/broadcast/close/']);
	rhizome.send('/sys/subscribe', ['/beatsDone']);
	rhizome.on('message', function(address, args) {
		console.log(address+": "+args);
		//really should be begins with, but i'm lazy
		if(address=='/broadcast/open')
			users.push(args[0]);
		else if(address=='/broadcast/close')
			users.splice(users.indexOv(address),1);
		else
		{
			currentIndex = ++currentIndex%users.length;
			rhizome.send('/beats'+users[currentIndex]);
		}
		} );
	});
</script>
</html>


text:
#include "tensorflow/core/framework/common_shape_fns.h"
#include "tensorflow/core/framework/op.h"
#include "tensorflow/core/framework/shape_inference.h"
#include "tensorflow/core/lib/core/status.h"

namespace tensorflow {

REGISTER_OP("XRTAllocate")
    .Input("allocation: string")
    .Output("handle: int64")
    .SetShapeFn(tensorflow::shape_inference::ScalarShape)
    .Doc(
        R"(
Reads a literal proto and transfers it to TPU device memory.

'allocation' is a serialized xrt::TPUAllocation proto.
'handle' is an id that can be used in other ops to refer to the allocation.
)");

REGISTER_OP("XRTSubTuple")
    .Input("base_handle: int64")
    .Input("shape_index: int32")
    .Output("output_handle: int64")
    .SetShapeFn(tensorflow::shape_inference::ScalarShape)
    .Doc(
        R"(
Returns a handle to a sub-tuple of an allocated tuple.

'base_handle' is the id of the on-device allocation.
'shape_index' is a vector of integers describing an XLA ShapeIndex.
'output_handle' is an id that can be used in other ops to refer to the
sub-tuple.
)");

REGISTER_OP("XRTSubTupleAndRelease")
    .Input("base_handle: int64")
    .Input("shape_index: int32")
    .Output("output_handle: int64")
    .SetShapeFn(tensorflow::shape_inference::ScalarShape)
    .Doc(
        R"(
Returns a handle to a sub-tuple of an allocated tuple, and releases the handle
of the input tuple.

'base_handle' is the id of the on-device allocation.
'shape_index' is a vector of integers describing an XLA ShapeIndex.
'output_handle' is an id that can be used by other ops to refer to the
sub-tuple.
)");

REGISTER_OP("XRTMakeTuple")
    .Attr("Ninputs: int")
    .Input("tuple_description: string")
    .Input("input_handles: Ninputs * int64")
    .Output("output_handle: int64")
    .SetShapeFn(tensorflow::shape_inference::ScalarShape)
    .Doc(
        R"(
Returns a handle to a new allocation constructed by assembling existing
allocations in a tuple.

'tuple_description' is a serialized xrt::XLATupleNode proto describing the
shape of the output tuple, and whether each input handle should be aliased or
released.
'input_handles' is a list of input handles to assemble into the output tuple.
'output_handle' is an id that can be used by other ops to refer to the new
tuple.
'Ninputs' is the number of input handles.
)");

REGISTER_OP("XRTReadLiteral")
    .Input("handle: int64")
    .Output("literal: string")
    .SetShapeFn(tensorflow::shape_inference::ScalarShape)
    .Doc(
        R"(
Copies an allocated tuple from device memory and returns it as a literal.

'handle' is the id returned from the Op that produced the on-device allocation.
'literal' is a serialized xla::LiteralProto proto.
)");

REGISTER_OP("XRTReadLiteralAndRelease")
    .Input("handle: int64")
    .Output("literal: string")
    .SetShapeFn(tensorflow::shape_inference::ScalarShape)
    .Doc(
        R"(
Copies an allocated tuple from device memory, and returns it as a literal, and
releases the handle.

'handle' is the id returned from the Op that produced the on-device allocation.
'literal' is a serialized xla::LiteralProto proto.
)");

REGISTER_OP("XRTReleaseAllocationHandle")
    .Input("handle: int64")
    .SetShapeFn(tensorflow::shape_inference::NoOutputs)
    .Doc(
        R"(
Discards an allocation from device memory. The handle cannot be subsequently
used.

'handle' is the id returned from the Op that produced the on-device allocation.
)");

}  // namespace tensorflow


text:
package validation

import (
	"fmt"

	"k8s.io/apimachinery/pkg/api/validation"
	"k8s.io/apimachinery/pkg/api/validation/path"
	utilvalidation "k8s.io/apimachinery/pkg/util/validation"
	"k8s.io/apimachinery/pkg/util/validation/field"

	discoveryapi "k8s.io/kubernetes/cmd/kube-aggregator/pkg/apis/apiregistration"
)

func ValidateAPIService(apiServer *discoveryapi.APIService) field.ErrorList {
	requiredName := apiServer.Spec.Version + "." + apiServer.Spec.Group

	allErrs := validation.ValidateObjectMeta(&apiServer.ObjectMeta, false,
		func(name string, prefix bool) []string {
			if minimalFailures := path.IsValidPathSegmentName(name); len(minimalFailures) > 0 {
				return minimalFailures
			}
			// the name *must* be version.group
			if name != requiredName {
				return []string{fmt.Sprintf("must be `spec.version+\".\"+spec.group`: %q", requiredName)}
			}

			return []string{}
		},
		field.NewPath("metadata"))

	// in this case we allow empty group
	if len(apiServer.Spec.Group) == 0 && apiServer.Spec.Version != "v1" {
		allErrs = append(allErrs, field.Required(field.NewPath("spec", "group"), "only v1 may have an empty group and it better be legacy kube"))
	}
	if len(apiServer.Spec.Group) > 0 {
		for _, errString := range utilvalidation.IsDNS1123Subdomain(apiServer.Spec.Group) {
			allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "group"), apiServer.Spec.Group, errString))
		}
	}

	for _, errString := range utilvalidation.IsDNS1035Label(apiServer.Spec.Version) {
		allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "version"), apiServer.Spec.Version, errString))
	}

	if apiServer.Spec.Priority <= 0 || apiServer.Spec.Priority > 1000 {
		allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "priority"), apiServer.Spec.Priority, "priority must be positive and less than 1000"))

	}

	if len(apiServer.Spec.Service.Namespace) == 0 {
		allErrs = append(allErrs, field.Required(field.NewPath("spec", "service", "namespace"), ""))
	}
	if len(apiServer.Spec.Service.Name) == 0 {
		allErrs = append(allErrs, field.Required(field.NewPath("spec", "service", "name"), ""))
	}

	if apiServer.Spec.InsecureSkipTLSVerify && len(apiServer.Spec.CABundle) > 0 {
		allErrs = append(allErrs, field.Invalid(field.NewPath("spec", "insecureSkipTLSVerify"), apiServer.Spec.InsecureSkipTLSVerify, "may not be true if caBundle is present"))
	}

	return allErrs
}

func ValidateAPIServiceUpdate(newAPIService *discoveryapi.APIService, oldAPIService *discoveryapi.APIService) field.ErrorList {
	allErrs := validation.ValidateObjectMetaUpdate(&newAPIService.ObjectMeta, &oldAPIService.ObjectMeta, field.NewPath("metadata"))
	allErrs = append(allErrs, ValidateAPIService(newAPIService)...)

	return allErrs
}


text:
// SelectCollectionGroupDlg.cpp : implementation file
//

#include "stdafx.h"
#include "DataCreator.h"
#include "SelectCollectionGroupDlg.h"
#include ".\selectcollectiongroupdlg.h"

// CSelectCollectionGroupDlg dialog

IMPLEMENT_DYNAMIC(CSelectCollectionGroupDlg, CDialog)
CSelectCollectionGroupDlg::CSelectCollectionGroupDlg(CWnd* pParent /*=NULL*/)
	: CDialog(CSelectCollectionGroupDlg::IDD, pParent)
	, mGroupName(_T(""))
	, mDataItems(0)
	, mSubgroups(0)
{
	pDataCollection = NULL;
	iCtrlMode == SCG_MODE_VIEW;
}

CSelectCollectionGroupDlg::~CSelectCollectionGroupDlg()
{
}

void CSelectCollectionGroupDlg::DoDataExchange(CDataExchange* pDX)
{
	CDialog::DoDataExchange(pDX);
	DDX_Control(pDX, IDC_COLLECTION_GROUPS_TREE, mGroupsTree);
	DDX_Text(pDX, IDC_GROUP_NAME, mGroupName);
	DDX_Text(pDX, IDC_DATA_ITEMS, mDataItems);
	DDX_Text(pDX, IDC_SUBGROUPS, mSubgroups);
}

BEGIN_MESSAGE_MAP(CSelectCollectionGroupDlg, CDialog)
	ON_NOTIFY(TVN_SELCHANGED, IDC_COLLECTION_GROUPS_TREE, OnTvnSelchangedCollectionGroupsTree)
END_MESSAGE_MAP()

// CSelectCollectionGroupDlg message handlers

void CSelectCollectionGroupDlg::OnOK()
{
	// TODO: Add your specialized code here and/or call the base class
	if (iCtrlMode == SCG_MODE_SELEECT)
	{
		UpdateData(TRUE);

		if (mGroupName == _T(""))
		{
			AfxMessageBox("You must select group!");
			return;
		}
	}

	CDialog::OnOK();
}

BOOL CSelectCollectionGroupDlg::OnInitDialog()
{
	CDialog::OnInitDialog();

	// TODO:  Add extra initialization here
	ASSERT(pDataCollection != NULL);

	// Building groups tree
	HTREEITEM htiRoot = mGroupsTree.InsertItem(
		pDataCollection->GetCollectionGroup()->GetGroupName());
	mGroupsTree.SetItemData(htiRoot, (DWORD_PTR)pDataCollection->GetCollectionGroup());

	ShowSubgroups(pDataCollection->GetCollectionGroup(), htiRoot);

	if (iCtrlMode == SCG_MODE_VIEW)
		SetWindowText("Collection groups");

	return TRUE;  // return TRUE unless you set the focus to a control
	// EXCEPTION: OCX Property Pages should return FALSE
}

void CSelectCollectionGroupDlg::ShowSubgroups(CCollectionGroup* pGroup, HTREEITEM htiParent)
{
	pGroup->CreateEnumerator();
	while (CCollectionGroup* pCurGroup = pGroup->GetNextGroup())
	{
		HTREEITEM htiGroup = mGroupsTree.InsertItem(
			pCurGroup->GetGroupName(), htiParent);
		mGroupsTree.SetItemData(htiGroup, (DWORD_PTR)pCurGroup);

		ShowSubgroups(pCurGroup, htiGroup);
	}

	mGroupsTree.Expand(htiParent, TVE_EXPAND);
}

void CSelectCollectionGroupDlg::OnTvnSelchangedCollectionGroupsTree(NMHDR *pNMHDR, LRESULT *pResult)
{
	LPNMTREEVIEW pNMTreeView = reinterpret_cast<LPNMTREEVIEW>(pNMHDR);
	// TODO: Add your control notification handler code here

	CCollectionGroup* pCurGroup = NULL;

	HTREEITEM htiSelected = mGroupsTree.GetSelectedItem();
	if (htiSelected)
		pCurGroup = (CCollectionGroup*)mGroupsTree.GetItemData(htiSelected);

	ShowGroupInformation(pCurGroup);

	*pResult = 0;
}

void CSelectCollectionGroupDlg::ShowGroupInformation(CCollectionGroup* pGroup)
{
	UpdateData(TRUE);

	if (pGroup)
	{
		mGroupName = pGroup->GetGroupName();
		mDataItems = pGroup->GetDataArray()->GetItemsCount();
		mSubgroups = pGroup->GetGroupsCount();
	} else
	{
		mGroupName = _T("");
		mDataItems = 0;
		mSubgroups = 0;
	}

	UpdateData(FALSE);
}

void CSelectCollectionGroupDlg::SetDataCollection(IDataCollection* pCollection)
{
	pDataCollection = pCollection;
}

void CSelectCollectionGroupDlg::SetCtrlMode(int Mode)
{
	iCtrlMode = Mode;
}


text:
/* GCC always defines __STDC__.  HP C++ compilers don't define it.  This
   causes trouble when sys/stdsyms.h is included.  As a work around,
   we define __STDC_EXT__.  A similar situation exists with respect to
   the definition of __cplusplus.  We define _INCLUDE_LONGLONG
   to prevent nlist.h from defining __STDC_32_MODE__ (no longlong
   support).  We define __STDCPP__ to get certain system headers
   (notably assert.h) to assume standard preprocessor behavior in C++.  */
#undef TARGET_OS_CPP_BUILTINS
#define TARGET_OS_CPP_BUILTINS()					\
  do									\
    {									\
	builtin_assert ("system=hpux");					\
	builtin_assert ("system=unix");					\
	builtin_define ("__hp9000s800");				\
	builtin_define ("__hp9000s800__");				\
	builtin_define ("__hpux");					\
	builtin_define ("__hpux__");					\
	builtin_define ("__unix");					\
	builtin_define ("__unix__");					\
	builtin_define ("__STDC_EXT__");				\
	if (c_dialect_cxx ())						\
	  {								\
	    builtin_define ("_HPUX_SOURCE");				\
	    builtin_define ("_INCLUDE_LONGLONG");			\
	    builtin_define ("__STDCPP__");				\
	  }								\
	else								\
	  {								\
	    if (!flag_iso)						\
	      {								\
		builtin_define ("_HPUX_SOURCE");			\
		if (preprocessing_trad_p ())				\
		  {							\
		    builtin_define ("hp9000s800");			\
		    builtin_define ("hppa");				\
		    builtin_define ("hpux");				\
		    builtin_define ("unix");				\
		    builtin_define ("__CLASSIC_C__");			\
		    builtin_define ("_PWB");				\
		    builtin_define ("PWB");				\
		  }							\
	      }								\
	  }								\
	if (!TARGET_64BIT)						\
	  builtin_define ("_ILP32");					\
	if (flag_pa_unix >= 1995 && !flag_iso)				\
	  {								\
	    builtin_define ("_XOPEN_UNIX");				\
	    builtin_define ("_XOPEN_SOURCE_EXTENDED");			\
	  }								\
	if (TARGET_HPUX_11_11)						\
	  {								\
	    if (flag_pa_unix >= 1998)					\
	      {								\
		if (flag_isoc94 || flag_isoc99 || c_dialect_cxx()	\
		    || !flag_iso)					\
		  builtin_define ("_INCLUDE__STDC_A1_SOURCE");		\
		if (!flag_iso)						\
		  builtin_define ("_INCLUDE_XOPEN_SOURCE_500");		\
	      }								\
	    else if (flag_isoc94 || flag_isoc99 || c_dialect_cxx ())	\
	      warning (0, "-munix=98 option required for C89 "		\
		       "Amendment 1 features.\n");			\
	  }								\
	if (TARGET_SIO)							\
	  builtin_define ("_SIO");					\
	else								\
	  {								\
	    builtin_define ("__hp9000s700");				\
	    builtin_define ("__hp9000s700__");				\
	    builtin_define ("_WSIO");					\
	  }								\
    }									\
  while (0)

#undef CPP_SPEC
#define CPP_SPEC \
  "%{mt|pthread:-D_REENTRANT -D_THREAD_SAFE -D_POSIX_C_SOURCE=199506L}"
/* aCC defines also -DRWSTD_MULTI_THREAD, -DRW_MULTI_THREAD.  These
   affect only aCC's C++ library (Rogue Wave-derived) which we do not
   use, and they violate the user's name space.  */

/* We can debug dynamically linked executables on hpux11; we also
   want dereferencing of a NULL pointer to cause a SEGV.  */
#undef LINK_SPEC
#define LINK_SPEC \
  "%{!shared:%{p:-L/lib/libp -L/usr/lib/libp %{!static:\
     %nwarning: consider linking with '-static' as system libraries with\n\
     %n  profiling support are only provided in archive format}}}\
   %{!shared:%{pg:-L/lib/libp -L/usr/lib/libp %{!static:\
     %nwarning: consider linking with '-static' as system libraries with\n\
     %n  profiling support are only provided in archive format}}}\
   %{!shared:%{!static:%{rdynamic:-E}}}\
   -z %{mlinker-opt:-O} %{!shared:-u main -u __gcc_plt_call}\
   %{static:-a archive} %{shared:-b}"

/* HP-UX 11 has posix threads.  HP's shared libc contains pthread stubs
   so that non-threaded applications can be linked with a thread-safe
   libc without a subsequent loss of performance.  For more details,
   see <http://docs.hp.com/en/1896/pthreads.html>.  */
#undef LIB_SPEC
#define LIB_SPEC \
  "%{!shared:\
     %{fopenmp:%{static:-a archive_shared} -lrt %{static:-a archive}}\
     %{mt|pthread:-lpthread} -lc\
     %{static:%{!nolibdld:-a archive_shared -ldld -a archive -lc}\
       %{!mt:%{!pthread:-a shared -lc -a archive}}}}\
   %{shared:%{mt|pthread:-lpthread}}"

/* The libgcc_stub.a library needs to come last.  */
#undef LINK_GCC_C_SEQUENCE_SPEC
#define LINK_GCC_C_SEQUENCE_SPEC \
  "%G %L %G %{!nostdlib:%{!nodefaultlibs:%{!shared:-lgcc_stub}}}"

#undef STARTFILE_SPEC
#define STARTFILE_SPEC \
  "%{!shared:%{pg:gcrt0%O%s}%{!pg:%{p:mcrt0%O%s}%{!p:crt0%O%s}} \
     %{!munix=93:unix95%O%s}}"

/* Under hpux11, the normal location of the `ld' and `as' programs is the
   /usr/ccs/bin directory.  */

#ifndef CROSS_DIRECTORY_STRUCTURE
#undef MD_EXEC_PREFIX
#define MD_EXEC_PREFIX "/usr/ccs/bin/"
#endif

/* Under hpux11 the normal location of the various *crt*.o files is
   the /usr/ccs/lib directory.  However, the profiling files are in
   /opt/langtools/lib.  */

#ifndef CROSS_DIRECTORY_STRUCTURE
#undef MD_STARTFILE_PREFIX
#define MD_STARTFILE_PREFIX "/usr/ccs/lib/"
#define MD_STARTFILE_PREFIX_1 "/opt/langtools/lib/"
#endif

/* hpux11 has the new HP assembler.  It's still lousy, but it's a whole lot
   better than the assembler shipped with older versions of hpux.  */
#undef NEW_HP_ASSEMBLER
#define NEW_HP_ASSEMBLER 1

/* Make GCC agree with types.h.  */
#undef SIZE_TYPE
#undef PTRDIFF_TYPE

#define SIZE_TYPE "long unsigned int"
#define PTRDIFF_TYPE "long int"

/* HP-UX 11.0 and above provides initialization and finalization function
   support from linker command line.  We don't need to invoke __main to run
   constructors.  We also don't need chatr to determine the dependencies of
   dynamically linked executables and shared libraries.  */
#undef LDD_SUFFIX
#undef PARSE_LDD_OUTPUT
#undef HAS_INIT_SECTION
#define HAS_INIT_SECTION 1
#undef LD_INIT_SWITCH
#define LD_INIT_SWITCH "+init"
#undef LD_FINI_SWITCH
#define LD_FINI_SWITCH "+fini"

/* The HP-UX 11.X SOM linker (ld32) can successfully link shared libraries
   with secondary definition (weak) symbols.  */
#undef TARGET_SOM_SDEF
#define TARGET_SOM_SDEF 1

#undef TARGET_HPUX_11
#define TARGET_HPUX_11 1


text:
export default function loadInfo() {
  return new Promise((resolve) => {
    resolve({
      message: 'Server-Anfrage erfolgreich',
      time: Date.now()
    });
  });
}


text:
//
//  KMSimilarMoviesCollectionViewCell.h
//  TheMovieDB
//
//  Created by Kevin Mindeguia on 04/02/2014.
//  Copyright (c) 2014 iKode Ltd. All rights reserved.
//

#import <UIKit/UIKit.h>

@interface KMSimilarMoviesCollectionViewCell : UICollectionViewCell

/**
 *  The movie's poster image view
 */
@property (weak, nonatomic) IBOutlet UIImageView *cellImageView;

/**
 *  The cell's background view
 */
@property (weak, nonatomic) IBOutlet UIView *cellBackgroundView;

/**
 *  Call this method to create and configure a `KMSimilarMoviesCollectionViewCell`
 *
 *  @return `KMSimilarMoviesCollectionViewCell` instance
 */
+ (KMSimilarMoviesCollectionViewCell *)similarMoviesCollectionViewCell;

@end


text:
<?xml version="1.0" encoding="UTF-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="wrap_content"
    android:layout_height="wrap_content"
    android:gravity="center"
    android:layout_gravity="center"
    android:background="@drawable/tips_bg" >

    <View
        android:layout_width="100dp"
        android:layout_height="100dp"
        android:layout_centerInParent="true" />

    <LinearLayout
        android:id="@+id/close"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_centerInParent="true"
        android:orientation="vertical" >

        <ProgressBar
            android:layout_width="50dp"
            android:layout_height="50dp"
            android:layout_gravity="center"
            android:layout_marginBottom="10dp"
            android:clickable="false"
            android:gravity="center" />

        <TextView
            android:id="@+id/tips_loading_msg"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="center"
            android:gravity="center"
            android:lineSpacingExtra="3dp"
            android:text="Loading..."
            android:visibility="gone"
            android:textColor="#ffffffff"
            android:textSize="17sp" />
    </LinearLayout>

</RelativeLayout>


text:
#ifndef _WL_
#define _WL_

/*
WL Class:  A closed structure with only possible unpaired bases at 5' side.
*/

// Forward declare the objects that WL depends on calculation.
class t_seq_man; // Sequence manager to interface with sequence data.
class t_ppf_V;
class t_ppf_V_bpi;
class t_ppf_V_bp_aln_up;
class t_aln_priors;
class t_spf_array;
class t_template_pf_array;
class t_ppf_W_bpi;
class t_ppf_tb_stack;
class t_ppf_V_mhe;
class t_MAP_alignment;
class t_stoch_sampled_str_aln_sample_set;
class t_stoch_sampling_math;
class t_ppf_loops;

class t_ppf_WL
{
public:
	t_ppf_WL(t_ppf_loops* _ppf_loops); // Constructor.
	~t_ppf_WL(); // Destructor.

	t_ppf_loops* ppf_loops;

	int N1;
	int N2;

	t_aln_priors* aln_priors;
	t_spf_array* seq1_spf;
	t_spf_array* seq2_spf;

	t_template_pf_array* pf_array;
	t_template_pf_array* ext_pf_array;

	// Main calculation unit for WL, calculate one cell of 4D pf array.
	void calculate_WL(int i, int j, int k, int l, bool bt = false); // Arrays to use.
	void calculate_ext_dependencies(int i, int j, int k, int l); // Arrays to use.

	// Access WL pf array using sequence indices.
	double x(int i, int j, int k, int l);
	double& x_ext(int i, int j, int k, int l);
	double& x_setter(int i, int j, int k, int l);

	// Following are for managing loop limits for WL coming from alignment module.
	bool check_boundary(int i1, int i2); // Checks if i2, seq2 sequence index, is in loop limit of i1, seqwence index of 1st sequence.
};

#endif // _WL_


text:
import config from '../config'
import { noop } from 'shared/util'

let warn = noop
let formatComponentName

if (process.env.NODE_ENV !== 'production') {
  const hasConsole = typeof console !== 'undefined'

  warn = (msg, vm) => {
    if (hasConsole && (!config.silent)) {
      console.error(`[Vue warn]: ${msg} ` + (
        vm ? formatLocation(formatComponentName(vm)) : ''
      ))
    }
  }

  formatComponentName = vm => {
    if (vm.$root === vm) {
      return 'root instance'
    }
    const name = vm._isVue
      ? vm.$options.name || vm.$options._componentTag
      : vm.name
    return name ? `component <${name}>` : `anonymous component`
  }

  const formatLocation = str => {
    if (str === 'anonymous component') {
      str += ` - use the "name" option for better debugging messages.`
    }
    return `(found in ${str})`
  }
}

export { warn, formatComponentName }


text:
package org.notninja.verifier.message.locale;

import static org.junit.Assert.*;

import java.util.Locale;
import org.junit.After;
import org.junit.Assert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import org.notninja.verifier.service.Weighted;

/**
 * <p>
 * Tests for the {@link DefaultLocaleContextProvider} class.
 * </p>
 *
 * @author Alasdair Mercer
 */
public class DefaultLocaleContextProviderTest {

    private static Locale originalDefaultLocale;

    @BeforeClass
    public static void setUpClass() {
        originalDefaultLocale = Locale.getDefault();
    }

    private DefaultLocaleContextProvider provider;

    @Before
    public void setUp() {
        provider = new DefaultLocaleContextProvider();
    }

    @After
    public void tearDown() {
        Locale.setDefault(originalDefaultLocale);
    }

    @Test
    public void testGetLocaleContext() {
        Locale.setDefault(Locale.ENGLISH);

        LocaleContext context = provider.getLocaleContext();

        assertNotNull("Never returns null", context);
        assertTrue("Returns an instance of SimpleLocaleContext", context instanceof SimpleLocaleContext);
        assertEquals("Context uses default locale", Locale.ENGLISH, context.getLocale());
    }

    @Test
    public void testGetWeight() {
        Assert.assertEquals("Has default implementation weight", Weighted.DEFAULT_IMPLEMENTATION_WEIGHT, provider.getWeight());
    }
}


text:
<?php

final class ArcanistFlagWorkflow extends ArcanistWorkflow {

  private static $colorMap = array(
    0 => 'red',     // Red
    1 => 'yellow',  // Orange
    2 => 'yellow',  // Yellow
    3 => 'green',   // Green
    4 => 'blue',    // Blue
    5 => 'magenta', // Pink
    6 => 'magenta', // Purple
    7 => 'default', // Checkered
  );

  private static $colorSpec = array(
    'red' => 0,       'r' => 0,   0 => 0,
    'orange' => 1,    'o' => 1,   1 => 1,
    'yellow' => 2,    'y' => 2,   2 => 2,
    'green' => 3,     'g' => 3,   3 => 3,
    'blue' => 4,      'b' => 4,   4 => 4,
    'pink' => 5,      'p' => 5,   5 => 5,
    'purple' => 6,    'v' => 6,   6 => 6,
    'checkered' => 7, 'c' => 7,   7 => 7,
  );

  public function getWorkflowName() {
    return 'flag';
  }

  public function getCommandSynopses() {
    return phutil_console_format(<<<EOTEXT
      **flag** [__object__ ...]
      **flag** __object__ --clear
      **flag** __object__ [--edit] [--color __color__] [--note __note__]
EOTEXT
      );
  }

  public function getCommandHelp() {
    return phutil_console_format(<<<EOTEXT
          In the first form, list objects you've flagged. You can provide the
          names of one or more objects (Maniphest tasks T#\##, Differential
          revisions D###, Diffusion references rXXX???, or PHIDs PHID-XXX-???)
          to print only flags for those objects.

          In the second form, clear an existing flag on one object.

          In the third form, create or update a flag on one object. Color
          defaults to blue and note to empty, but if you omit both you must
          pass --edit.
EOTEXT
      );
  }

  public function getArguments() {
    return array(
      '*' => 'objects',
      'clear' => array(
        'help' => 'Delete the flag on an object.',
      ),
      'edit' => array(
        'help' => 'Edit the flag on an object.',
      ),
      'color' => array(
        'param' => 'color',
        'help' => 'Set the color of a flag.',
      ),
      'note' => array(
        'param' => 'note',
        'help' => 'Set the note on a flag.',
      ),
    );
  }

  public function requiresConduit() {
    return true;
  }

  public function requiresAuthentication() {
    return true;
  }

  private static function flagWasEdited($flag, $verb) {
    $color = idx(self::$colorMap, $flag['color'], 'cyan');
    $note = $flag['note'];
    if ($note) {
      // Make sure notes that are long or have line breaks in them or
      // whatever don't mess up the formatting.
      $note = implode(' ', preg_split('/\s+/', $note));
      $note = ' ('.
        id(new PhutilUTF8StringTruncator())
        ->setMaximumGlyphs(40)
        ->setTerminator('...')
        ->truncateString($note).
        ')';
    }
    echo phutil_console_format(
      "<fg:{$color}>%s</fg> flag%s $verb!\n",
      $flag['colorName'],
      $note);
  }

  public function run() {
    $conduit = $this->getConduit();
    $objects = $this->getArgument('objects', array());
    $phids = array();

    $clear = $this->getArgument('clear');
    $edit = $this->getArgument('edit');
    // I don't trust PHP to distinguish 0 (red) from null.
    $color = $this->getArgument('color', -1);
    $note = $this->getArgument('note');
    $editing = $edit || ($color != -1) || $note;

    if ($editing && $clear) {
      throw new ArcanistUsageException("You can't both edit and clear a flag.");
    }
    if (($editing || $clear) && count($objects) != 1) {
      throw new ArcanistUsageException('Specify exactly one object.');
    }

    if (!empty($objects)) {
      // First off, convert the passed objects to PHIDs.
      $handles = $conduit->callMethodSynchronous(
        'phid.lookup',
        array(
          'names' => $objects,
        ));
      foreach ($objects as $object) {
        if (isset($handles[$object])) {
          $phids[$object] = $handles[$object]['phid'];
        } else {
          echo phutil_console_format("**%s** doesn't exist.\n", $object);
        }
      }
      if (empty($phids)) {
        // flag.query treats an empty objectPHIDs parameter as "don't use this
        // constraint". However, if the user gives a list of objects but none
        // of them exist and have flags, we shouldn't dump the full list on
        // them after telling them that. Conveniently, we already told them,
        // so we can go quit now.
        return 0;
      }
    }

    if ($clear) {
      // All right, we're going to clear a flag. First clear it. Then tell the
      // user we cleared it. Step four: profit!
      $flag = $conduit->callMethodSynchronous(
        'flag.delete',
        array(
          'objectPHID' => head($phids),
        ));
      if (!$flag) {
        echo phutil_console_format("**%s** has no flag to clear.\n", $object);
      } else {
        self::flagWasEdited($flag, 'deleted');
      }
    } else if ($editing) {
      // Let's set some flags. Just like Minesweeper, but less distracting.
      $flag_params = array(
        'objectPHID' => head($phids),
      );
      if (isset(self::$colorSpec[$color])) {
        $flag_params['color'] = self::$colorSpec[strtolower($color)];
      }
      if ($note) {
        $flag_params['note'] = $note;
      }
      $flag = $conduit->callMethodSynchronous(
        'flag.edit',
        $flag_params);
      self::flagWasEdited($flag, $flag['new'] ? 'created' : 'edited');
    } else {
      // Okay, list mode. Let's find the flags, which we didn't need to do
      // otherwise because Conduit does it for us.
      $flags = ipull(
        $this->getConduit()->callMethodSynchronous(
          'flag.query',
          array(
            'ownerPHIDs' => array($this->getUserPHID()),
            'objectPHIDs' => array_values($phids),
          )),
        null,
        'objectPHID');
      foreach ($phids as $object => $phid) {
        if (!isset($flags[$phid])) {
          echo phutil_console_format("**%s** has no flag.\n", $object);
        }
      }

      if (empty($flags)) {
        // If the user passed no object names, then we should print the full
        // list, but it's empty, so tell the user they have no flags.
        // If the user passed object names, we already told them all their
        // objects are nonexistent or unflagged.
        if (empty($objects)) {
          echo "You have no flagged objects.\n";
        }
      } else {
        // Print ALL the flags. With fancy formatting. Because fancy formatting
        // is _cool_.
        $name_len = 1 + max(array_map('strlen', ipull($flags, 'colorName')));
        foreach ($flags as $flag) {
          $color = idx(self::$colorMap, $flag['color'], 'cyan');
          echo phutil_console_format(
            "[<fg:{$color}>%s</fg>] %s\n",
            str_pad($flag['colorName'], $name_len),
            $flag['handle']['fullname']);
          if ($flag['note']) {
            $note = phutil_console_wrap($flag['note'], $name_len + 3);
            echo rtrim($note)."\n";
          }
        }
      }
    }
  }

}


text:
ACCEPTED

#### According to
Index Fungorum

#### Published in
null

#### Original name
Lophiostoma imperfectum Ellis & Fairm.

### Remarks
null


text:
chocolatey_package '7zip' do
  action :remove
end

chocolatey_package 'git' do
  version '2.7.1'
  action :remove
end


text:
package main

import (
	"fmt"
	"go/ast"
	"go/build"
	"go/parser"
	"go/token"
	"path/filepath"

	"golang.org/x/tools/cover"

	"github.com/axw/gocov"
	"github.com/axw/gocov/gocovutil"
)

func convertProfiles(filenames ...string) error {
	var ps gocovutil.Packages
	for i := range filenames {
		converter := converter{
			packages: make(map[string]*gocov.Package),
		}
		profiles, err := cover.ParseProfiles(filenames[i])
		if err != nil {
			return err
		}
		for _, p := range profiles {
			if err := converter.convertProfile(p); err != nil {
				return err
			}
		}

		for _, pkg := range converter.packages {
			ps.AddPackage(pkg)
		}
	}
	bytes, err := marshalJson(ps)
	if err != nil {
		return err
	}
	fmt.Println(string(bytes))
	return nil
}

type converter struct {
	packages map[string]*gocov.Package
}

// wrapper for gocov.Statement
type statement struct {
	*gocov.Statement
	*StmtExtent
}

func (c *converter) convertProfile(p *cover.Profile) error {
	file, pkgpath, err := findFile(p.FileName)
	if err != nil {
		return err
	}
	pkg := c.packages[pkgpath]
	if pkg == nil {
		pkg = &gocov.Package{Name: pkgpath}
		c.packages[pkgpath] = pkg
	}
	// Find function and statement extents; create corresponding
	// gocov.Functions and gocov.Statements, and keep a separate
	// slice of gocov.Statements so we can match them with profile
	// blocks.
	extents, err := findFuncs(file)
	if err != nil {
		return err
	}
	var stmts []statement
	for _, fe := range extents {
		f := &gocov.Function{
			Name:  fe.name,
			File:  file,
			Start: fe.startOffset,
			End:   fe.endOffset,
		}
		for _, se := range fe.stmts {
			s := statement{
				Statement:  &gocov.Statement{Start: se.startOffset, End: se.endOffset},
				StmtExtent: se,
			}
			f.Statements = append(f.Statements, s.Statement)
			stmts = append(stmts, s)
		}
		pkg.Functions = append(pkg.Functions, f)
	}
	// For each profile block in the file, find the statement(s) it
	// covers and increment the Reached field(s).
	blocks := p.Blocks
	for _, s := range stmts {
		for i, b := range blocks {
			if b.StartLine > s.endLine || (b.StartLine == s.endLine && b.StartCol >= s.endCol) {
				// Past the end of the statement
				blocks = blocks[i:]
				break
			}
			if b.EndLine < s.startLine || (b.EndLine == s.startLine && b.EndCol <= s.startCol) {
				// Before the beginning of the statement
				continue
			}
			s.Reached += int64(b.Count)
			break
		}
	}
	return nil
}

// findFile finds the location of the named file in GOROOT, GOPATH etc.
func findFile(file string) (filename string, pkgpath string, err error) {
	dir, file := filepath.Split(file)
	if dir != "" {
		dir = dir[:len(dir)-1] // drop trailing '/'
	}
	pkg, err := build.Import(dir, ".", build.FindOnly)
	if err != nil {
		return "", "", fmt.Errorf("can't find %q: %v", file, err)
	}
	return filepath.Join(pkg.Dir, file), pkg.ImportPath, nil
}

// findFuncs parses the file and returns a slice of FuncExtent descriptors.
func findFuncs(name string) ([]*FuncExtent, error) {
	fset := token.NewFileSet()
	parsedFile, err := parser.ParseFile(fset, name, nil, 0)
	if err != nil {
		return nil, err
	}
	visitor := &FuncVisitor{fset: fset}
	ast.Walk(visitor, parsedFile)
	return visitor.funcs, nil
}

type extent struct {
	startOffset int
	startLine   int
	startCol    int
	endOffset   int
	endLine     int
	endCol      int
}

// FuncExtent describes a function's extent in the source by file and position.
type FuncExtent struct {
	extent
	name  string
	stmts []*StmtExtent
}

// StmtExtent describes a statements's extent in the source by file and position.
type StmtExtent extent

// FuncVisitor implements the visitor that builds the function position list for a file.
type FuncVisitor struct {
	fset  *token.FileSet
	funcs []*FuncExtent
}

// Visit implements the ast.Visitor interface.
func (v *FuncVisitor) Visit(node ast.Node) ast.Visitor {
	var body *ast.BlockStmt
	var name string
	switch n := node.(type) {
	case *ast.FuncLit:
		body = n.Body
	case *ast.FuncDecl:
		body = n.Body
		name = n.Name.Name
		// Function name is prepended with "T." if there is a receiver, where
		// T is the type of the receiver, dereferenced if it is a pointer.
		if n.Recv != nil {
			field := n.Recv.List[0]
			switch recv := field.Type.(type) {
			case *ast.StarExpr:
				name = recv.X.(*ast.Ident).Name + "." + name
			case *ast.Ident:
				name = recv.Name + "." + name
			}
		}
	}
	if body != nil {
		start := v.fset.Position(node.Pos())
		end := v.fset.Position(node.End())
		if name == "" {
			name = fmt.Sprintf("@%d:%d", start.Line, start.Column)
		}
		fe := &FuncExtent{
			name: name,
			extent: extent{
				startOffset: start.Offset,
				startLine:   start.Line,
				startCol:    start.Column,
				endOffset:   end.Offset,
				endLine:     end.Line,
				endCol:      end.Column,
			},
		}
		v.funcs = append(v.funcs, fe)
		sv := StmtVisitor{fset: v.fset, function: fe}
		sv.VisitStmt(body)
	}
	return v
}

type StmtVisitor struct {
	fset     *token.FileSet
	function *FuncExtent
}

func (v *StmtVisitor) VisitStmt(s ast.Stmt) {
	var statements *[]ast.Stmt
	switch s := s.(type) {
	case *ast.BlockStmt:
		statements = &s.List
	case *ast.CaseClause:
		statements = &s.Body
	case *ast.CommClause:
		statements = &s.Body
	case *ast.ForStmt:
		if s.Init != nil {
			v.VisitStmt(s.Init)
		}
		if s.Post != nil {
			v.VisitStmt(s.Post)
		}
		v.VisitStmt(s.Body)
	case *ast.IfStmt:
		if s.Init != nil {
			v.VisitStmt(s.Init)
		}
		v.VisitStmt(s.Body)
		if s.Else != nil {
			// Code copied from go.tools/cmd/cover, to deal with "if x {} else if y {}"
			const backupToElse = token.Pos(len("else ")) // The AST doesn't remember the else location. We can make an accurate guess.
			switch stmt := s.Else.(type) {
			case *ast.IfStmt:
				block := &ast.BlockStmt{
					Lbrace: stmt.If - backupToElse, // So the covered part looks like it starts at the "else".
					List:   []ast.Stmt{stmt},
					Rbrace: stmt.End(),
				}
				s.Else = block
			case *ast.BlockStmt:
				stmt.Lbrace -= backupToElse // So the block looks like it starts at the "else".
			default:
				panic("unexpected node type in if")
			}
			v.VisitStmt(s.Else)
		}
	case *ast.LabeledStmt:
		v.VisitStmt(s.Stmt)
	case *ast.RangeStmt:
		v.VisitStmt(s.Body)
	case *ast.SelectStmt:
		v.VisitStmt(s.Body)
	case *ast.SwitchStmt:
		if s.Init != nil {
			v.VisitStmt(s.Init)
		}
		v.VisitStmt(s.Body)
	case *ast.TypeSwitchStmt:
		if s.Init != nil {
			v.VisitStmt(s.Init)
		}
		v.VisitStmt(s.Assign)
		v.VisitStmt(s.Body)
	}
	if statements == nil {
		return
	}
	for i := 0; i < len(*statements); i++ {
		s := (*statements)[i]
		switch s.(type) {
		case *ast.CaseClause, *ast.CommClause, *ast.BlockStmt:
			break
		default:
			start, end := v.fset.Position(s.Pos()), v.fset.Position(s.End())
			se := &StmtExtent{
				startOffset: start.Offset,
				startLine:   start.Line,
				startCol:    start.Column,
				endOffset:   end.Offset,
				endLine:     end.Line,
				endCol:      end.Column,
			}
			v.function.stmts = append(v.function.stmts, se)
		}
		v.VisitStmt(s)
	}
}


text:
'use strict';

let loopback = require('loopback');

module.exports = function enableAuthentication(server) {
    // enable authentication
    server.enableAuth();
};


text:
#include <stdlib.h>
#include <string.h>

#include <apr_pools.h>
#include <apr_file_io.h>
#include <apr_strings.h>

#include "svn_private_config.h"
#include "svn_types.h"
#include "svn_string.h"
#include "svn_dirent_uri.h"
#include "svn_hash.h"
#include "svn_path.h"
#include "svn_error.h"
#include "svn_subst.h"
#include "svn_io.h"
#include "svn_props.h"

#include "wc.h"
#include "adm_files.h"
#include "translate.h"
#include "props.h"

#include "private/svn_wc_private.h"

svn_error_t *
svn_wc__internal_translated_stream(svn_stream_t **stream,
                                   svn_wc__db_t *db,
                                   const char *local_abspath,
                                   const char *versioned_abspath,
                                   apr_uint32_t flags,
                                   apr_pool_t *result_pool,
                                   apr_pool_t *scratch_pool)
{
  svn_boolean_t special;
  svn_boolean_t to_nf = flags & SVN_WC_TRANSLATE_TO_NF;
  svn_subst_eol_style_t style;
  const char *eol;
  apr_hash_t *keywords;
  svn_boolean_t repair_forced = flags & SVN_WC_TRANSLATE_FORCE_EOL_REPAIR;

  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));
  SVN_ERR_ASSERT(svn_dirent_is_absolute(versioned_abspath));

  SVN_ERR(svn_wc__get_translate_info(&style, &eol,
                                     &keywords,
                                     &special,
                                     db, versioned_abspath, NULL, FALSE,
                                     scratch_pool, scratch_pool));

  if (special)
    {
      if (to_nf)
        return svn_subst_read_specialfile(stream, local_abspath, result_pool,
                                          scratch_pool);

      return svn_subst_create_specialfile(stream, local_abspath, result_pool,
                                          scratch_pool);
    }

  if (to_nf)
    SVN_ERR(svn_stream_open_readonly(stream, local_abspath, result_pool,
                                     scratch_pool));
  else
    {
      apr_file_t *file;

      /* We don't want the "open-exclusively" feature of the normal
         svn_stream_open_writable interface. Do this manually. */
      SVN_ERR(svn_io_file_open(&file, local_abspath,
                               APR_CREATE | APR_WRITE | APR_BUFFERED,
                               APR_OS_DEFAULT, result_pool));
      *stream = svn_stream_from_aprfile2(file, FALSE, result_pool);
    }

  if (svn_subst_translation_required(style, eol, keywords, special, TRUE))
    {
      if (to_nf)
        {
          if (style == svn_subst_eol_style_native)
            eol = SVN_SUBST_NATIVE_EOL_STR;
          else if (style == svn_subst_eol_style_fixed)
            repair_forced = TRUE;
          else if (style != svn_subst_eol_style_none)
            return svn_error_create(SVN_ERR_IO_UNKNOWN_EOL, NULL, NULL);

          /* Wrap the stream to translate to normal form */
          *stream = svn_subst_stream_translated(*stream,
                                                eol,
                                                repair_forced,
                                                keywords,
                                                FALSE /* expand */,
                                                result_pool);

          /* streams enforce our contract that TO_NF streams are read-only
           * by returning SVN_ERR_STREAM_NOT_SUPPORTED when trying to
           * write to them. */
        }
      else
        {
          *stream = svn_subst_stream_translated(*stream, eol, TRUE,
                                                keywords, TRUE, result_pool);

          /* streams enforce our contract that FROM_NF streams are write-only
           * by returning SVN_ERR_STREAM_NOT_SUPPORTED when trying to
           * read them. */
        }
    }

  return SVN_NO_ERROR;
}

svn_error_t *
svn_wc__internal_translated_file(const char **xlated_abspath,
                                 const char *src_abspath,
                                 svn_wc__db_t *db,
                                 const char *versioned_abspath,
                                 apr_uint32_t flags,
                                 svn_cancel_func_t cancel_func,
                                 void *cancel_baton,
                                 apr_pool_t *result_pool,
                                 apr_pool_t *scratch_pool)
{
  svn_subst_eol_style_t style;
  const char *eol;
  apr_hash_t *keywords;
  svn_boolean_t special;

  SVN_ERR_ASSERT(svn_dirent_is_absolute(src_abspath));
  SVN_ERR_ASSERT(svn_dirent_is_absolute(versioned_abspath));
  SVN_ERR(svn_wc__get_translate_info(&style, &eol,
                                     &keywords,
                                     &special,
                                     db, versioned_abspath, NULL, FALSE,
                                     scratch_pool, scratch_pool));

  if (! svn_subst_translation_required(style, eol, keywords, special, TRUE)
      && (! (flags & SVN_WC_TRANSLATE_FORCE_COPY)))
    {
      /* Translation would be a no-op, so return the original file. */
      *xlated_abspath = src_abspath;
    }
  else  /* some translation (or copying) is necessary */
    {
      const char *tmp_dir;
      const char *tmp_vfile;
      svn_boolean_t repair_forced
          = (flags & SVN_WC_TRANSLATE_FORCE_EOL_REPAIR) != 0;
      svn_boolean_t expand = (flags & SVN_WC_TRANSLATE_TO_NF) == 0;

      if (flags & SVN_WC_TRANSLATE_USE_GLOBAL_TMP)
        tmp_dir = NULL;
      else
        SVN_ERR(svn_wc__db_temp_wcroot_tempdir(&tmp_dir, db, versioned_abspath,
                                               scratch_pool, scratch_pool));

      SVN_ERR(svn_io_open_unique_file3(NULL, &tmp_vfile, tmp_dir,
                (flags & SVN_WC_TRANSLATE_NO_OUTPUT_CLEANUP)
                  ? svn_io_file_del_none
                  : svn_io_file_del_on_pool_cleanup,
                result_pool, scratch_pool));

      /* ### ugh. the repair behavior does NOT match the docstring. bleah.
         ### all of these translation functions are crap and should go
         ### away anyways. we'll just deprecate most of the functions and
         ### properly document the survivors */

      if (expand)
        {
          /* from normal form */

          repair_forced = TRUE;
        }
      else
        {
          /* to normal form */

          if (style == svn_subst_eol_style_native)
            eol = SVN_SUBST_NATIVE_EOL_STR;
          else if (style == svn_subst_eol_style_fixed)
            repair_forced = TRUE;
          else if (style != svn_subst_eol_style_none)
            return svn_error_create(SVN_ERR_IO_UNKNOWN_EOL, NULL, NULL);
        }

      SVN_ERR(svn_subst_copy_and_translate4(src_abspath, tmp_vfile,
                                            eol, repair_forced,
                                            keywords,
                                            expand,
                                            special,
                                            cancel_func, cancel_baton,
                                            result_pool));

      *xlated_abspath = tmp_vfile;
    }

  return SVN_NO_ERROR;
}

void
svn_wc__eol_value_from_string(const char **value, const char *eol)
{
  if (eol == NULL)
    *value = NULL;
  else if (! strcmp("\n", eol))
    *value = "LF";
  else if (! strcmp("\r", eol))
    *value = "CR";
  else if (! strcmp("\r\n", eol))
    *value = "CRLF";
  else
    *value = NULL;
}

svn_error_t *
svn_wc__get_translate_info(svn_subst_eol_style_t *style,
                           const char **eol,
                           apr_hash_t **keywords,
                           svn_boolean_t *special,
                           svn_wc__db_t *db,
                           const char *local_abspath,
                           apr_hash_t *props,
                           svn_boolean_t for_normalization,
                           apr_pool_t *result_pool,
                           apr_pool_t *scratch_pool)
{
  const char *propval;
  SVN_ERR_ASSERT(svn_dirent_is_absolute(local_abspath));

  if (props == NULL)
    SVN_ERR(svn_wc__get_actual_props(&props, db, local_abspath,
                                     scratch_pool, scratch_pool));

  if (eol)
    {
      propval = svn_prop_get_value(props, SVN_PROP_EOL_STYLE);

      svn_subst_eol_style_from_value(style, eol, propval);
    }

  if (keywords)
    {
      propval = svn_prop_get_value(props, SVN_PROP_KEYWORDS);

      if (!propval || *propval == '\0')
        *keywords = NULL;
      else
        SVN_ERR(svn_wc__expand_keywords(keywords,
                                        db, local_abspath, NULL,
                                        propval, for_normalization,
                                        result_pool, scratch_pool));
    }
  if (special)
    {
      propval = svn_prop_get_value(props, SVN_PROP_SPECIAL);

      *special = (propval != NULL);
    }

  return SVN_NO_ERROR;
}

svn_error_t *
svn_wc__expand_keywords(apr_hash_t **keywords,
                        svn_wc__db_t *db,
                        const char *local_abspath,
                        const char *wri_abspath,
                        const char *keyword_list,
                        svn_boolean_t for_normalization,
                        apr_pool_t *result_pool,
                        apr_pool_t *scratch_pool)
{
  svn_revnum_t changed_rev;
  apr_time_t changed_date;
  const char *changed_author;
  const char *url;
  const char *repos_root_url;

  if (! for_normalization)
    {
      const char *repos_relpath;

      SVN_ERR(svn_wc__db_read_info(NULL, NULL, NULL, &repos_relpath,
                                   &repos_root_url, NULL, &changed_rev,
                                   &changed_date, &changed_author, NULL,
                                   NULL, NULL, NULL, NULL, NULL, NULL,
                                   NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                                   NULL, NULL, NULL, NULL,
                                   db, local_abspath,
                                   scratch_pool, scratch_pool));

      /* Handle special statuses (e.g. added) */
      if (!repos_relpath)
         SVN_ERR(svn_wc__db_read_repos_info(NULL, &repos_relpath,
                                            &repos_root_url, NULL,
                                            db, local_abspath,
                                            scratch_pool, scratch_pool));

      url = svn_path_url_add_component2(repos_root_url, repos_relpath,
                                        scratch_pool);
    }
  else
    {
      url = "";
      changed_rev = SVN_INVALID_REVNUM;
      changed_date = 0;
      changed_author = "";
      repos_root_url = "";
    }

  SVN_ERR(svn_subst_build_keywords3(keywords, keyword_list,
                                    apr_psprintf(scratch_pool, "%ld",
                                                 changed_rev),
                                    url, repos_root_url,
                                    changed_date, changed_author,
                                    result_pool));

  if (apr_hash_count(*keywords) == 0)
    *keywords = NULL;

  return SVN_NO_ERROR;
}

svn_error_t *
svn_wc__sync_flags_with_props(svn_boolean_t *did_set,
                              svn_wc__db_t *db,
                              const char *local_abspath,
                              apr_pool_t *scratch_pool)
{
  svn_wc__db_status_t status;
  svn_node_kind_t kind;
  svn_wc__db_lock_t *lock;
  apr_hash_t *props = NULL;
  svn_boolean_t had_props;
  svn_boolean_t props_mod;

  if (did_set)
    *did_set = FALSE;

  /* ### We'll consolidate these info gathering statements in a future
         commit. */

  SVN_ERR(svn_wc__db_read_info(&status, &kind, NULL, NULL, NULL, NULL, NULL,
                               NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL,
                               NULL, &lock, NULL, NULL, NULL, NULL, NULL,
                               &had_props, &props_mod, NULL, NULL, NULL,
                               db, local_abspath,
                               scratch_pool, scratch_pool));

  /* We actually only care about the following flags on files, so just
     early-out for all other types.

     Also bail if there is no in-wc representation of the file. */
  if (kind != svn_node_file
      || (status != svn_wc__db_status_normal
          && status != svn_wc__db_status_added))
    return SVN_NO_ERROR;

  if (props_mod || had_props)
    SVN_ERR(svn_wc__db_read_props(&props, db, local_abspath, scratch_pool,
                                  scratch_pool));
  else
    props = NULL;

  /* If we get this far, we're going to change *something*, so just set
     the flag appropriately. */
  if (did_set)
    *did_set = TRUE;

  /* Handle the read-write bit. */
  if (status != svn_wc__db_status_normal
      || props == NULL
      || ! svn_hash_gets(props, SVN_PROP_NEEDS_LOCK)
      || lock)
    {
      SVN_ERR(svn_io_set_file_read_write(local_abspath, FALSE, scratch_pool));
    }
  else
    {
      /* Special case: If we have an uncommitted svn:needs-lock, we don't
         set the file read_only just yet.  That happens upon commit. */
      apr_hash_t *pristine_props;

      if (! props_mod)
        pristine_props = props;
      else if (had_props)
        SVN_ERR(svn_wc__db_read_pristine_props(&pristine_props, db, local_abspath,
                                                scratch_pool, scratch_pool));
      else
        pristine_props = NULL;

      if (pristine_props
            && svn_hash_gets(pristine_props, SVN_PROP_NEEDS_LOCK) )
            /*&& props
            && apr_hash_get(props, SVN_PROP_NEEDS_LOCK, APR_HASH_KEY_STRING) )*/
        SVN_ERR(svn_io_set_file_read_only(local_abspath, FALSE, scratch_pool));
    }

/* Windows doesn't care about the execute bit. */
#ifndef WIN32

  if (props == NULL
      || ! svn_hash_gets(props, SVN_PROP_EXECUTABLE))
    {
      /* Turn off the execute bit */
      SVN_ERR(svn_io_set_file_executable(local_abspath, FALSE, FALSE,
                                         scratch_pool));
    }
  else
    SVN_ERR(svn_io_set_file_executable(local_abspath, TRUE, FALSE,
                                       scratch_pool));
#endif

  return SVN_NO_ERROR;
}

svn_error_t *
svn_wc__translated_stream(svn_stream_t **stream,
                          svn_wc_context_t *wc_ctx,
                          const char *local_abspath,
                          const char *versioned_abspath,
                          apr_uint32_t flags,
                          apr_pool_t *result_pool,
                          apr_pool_t *scratch_pool)
{
  return svn_error_trace(
           svn_wc__internal_translated_stream(stream, wc_ctx->db,
                                              local_abspath,
                                              versioned_abspath,
                                              flags, result_pool,
                                              scratch_pool));
}