text:
package hudson.plugins.dry.parser;

import hudson.plugins.analysis.core.AnnotationParser;
import hudson.plugins.analysis.util.ContextHashCode;
import hudson.plugins.analysis.util.model.FileAnnotation;
import hudson.plugins.dry.parser.cpd.CpdParser;
import hudson.plugins.dry.parser.simian.SimianParser;

import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.lang.reflect.InvocationTargetException;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Set;

import org.apache.commons.io.IOUtils;
import org.apache.xerces.parsers.SAXParser;

import com.google.common.collect.Sets;

import edu.umd.cs.findbugs.annotations.SuppressWarnings;

/**
 * Registry for duplication parsers.
 *
 * @author Ulli Hafner
 */
public class DuplicationParserRegistry implements AnnotationParser {
    private static final long serialVersionUID = -8114361417348412242L;
    @SuppressWarnings("SE")
    private final List<AbstractDryParser> parsers = new ArrayList<AbstractDryParser>();
    private String workspacePath;
    private final String defaultEncoding;

    /** Property of SAX parser factory. */
    private static final String SAX_DRIVER_PROPERTY = "org.xml.sax.driver";

   /**
     * Creates a new instance of {@link DuplicationParserRegistry}.
     *
     * @param highThreshold
     *            minimum number of duplicate lines for high priority warnings
     * @param normalThreshold
     *            minimum number of duplicate lines for normal priority warnings
     * @param defaultEncoding
     *            default encoding of the files
     */
    public DuplicationParserRegistry(final int normalThreshold, final int highThreshold, final String defaultEncoding) {
        this.defaultEncoding = defaultEncoding;
        parsers.add(new CpdParser(highThreshold, normalThreshold));
        parsers.add(new SimianParser(highThreshold, normalThreshold));
    }

    /**
     * Creates a new instance of {@link DuplicationParserRegistry}.
     *
     * @param highThreshold
     *            minimum number of duplicate lines for high priority warnings
     * @param normalThreshold
     *            minimum number of duplicate lines for normal priority warnings
     * @param workspacePath
     *            path to the workspace files
     * @param defaultEncoding
     *            default encoding of the files
     */
    public DuplicationParserRegistry(final int normalThreshold, final int highThreshold,
            final String workspacePath, final String defaultEncoding) {
        this(normalThreshold, highThreshold, defaultEncoding);

        this.workspacePath = workspacePath;
    }

    /** {@inheritDoc} */
    public Collection<FileAnnotation> parse(final File file, final String moduleName) throws InvocationTargetException {
        String oldProperty = System.getProperty(SAX_DRIVER_PROPERTY);
        if (oldProperty != null) {
            System.setProperty(SAX_DRIVER_PROPERTY, SAXParser.class.getName());
        }

        FileInputStream inputStream = null;
        try {
            for (AbstractDryParser parser : parsers) {
                inputStream = new FileInputStream(file);
                if (parser.accepts(inputStream)) {
                    IOUtils.closeQuietly(inputStream);
                    inputStream = new FileInputStream(file);
                    Collection<DuplicateCode> result = parser.parse(inputStream, moduleName);
                    createLinkNames(result);
                    Set<FileAnnotation> warnings = Sets.newHashSet();
                    warnings.addAll(result);
                    ContextHashCode hashCode = new ContextHashCode();
                    for (FileAnnotation duplication : warnings) {
                        duplication.setContextHashCode(hashCode.create(duplication.getFileName(), duplication.getPrimaryLineNumber(),
                                defaultEncoding));
                    }

                    return warnings;
                }
            }
            throw new IOException("No parser found for duplicated code results file " + file.getAbsolutePath());
        }
        catch (IOException exception) {
            throw new InvocationTargetException(exception);
        }
        finally {
            IOUtils.closeQuietly(inputStream);
            if (oldProperty != null) {
                System.setProperty(SAX_DRIVER_PROPERTY, oldProperty);
            }
        }
    }

    /**
     * For each duplicate code annotation that does not have a package name
     * (i.e., for non Java sources), a link name is generated.
     *
     * @param result the annotations
     */
    private void createLinkNames(final Collection<DuplicateCode> result) {
        if (workspacePath != null) {
            for (FileAnnotation duplication : result) {
                duplication.setPathName(workspacePath);
            }
        }
    }
}


text:
/*jslint vars: true, plusplus: true, devel: true, nomen: true, indent: 4, maxerr: 50 */
/*global define */

define({
    "TITLE_BOWER": "Bower",
    "TITLE_WARNING": "Advertencia de Bower",
    "TITLE_ERROR": "Error de Bower",
    "TITLE_SHORTCUT": "Instalar desde Bower...",
    "TITLE_QUICK_OPEN": "Instalar desde Bower",
    "TITLE_SET_CWD": "Establecer como directorio activo de Bower",
    "TITLE_CONFIG": "Configuración",
    "TITLE_DEPENDENCIES": "Dependencias",
    "TITLE_SETTINGS": "Configuración de Bower",
    "TITLE_PROJECT_PACKAGES": "Paquetes del proyecto",
    "BOWERRC_NOT_FOUND": "El archivo .bowerrc no se encontró!",
    "BOWER_JSON_NOT_FOUND": "El archivo bower.json no se encontró!",
    "INSTALLED_PACKAGES_NOT_FOUND": "No se encuentran paquetes instalados",
    "CREATE": "Crear",
    "RELOAD": "Cargar",
    "DELETE": "Eliminar",
    "STATUS_BOWER_LOADING": "Cargando registro de Bower",
    "STATUS_BOWER_READY": "Registro de Bower preparado",
    "STATUS_BOWER_NOT_LOADED": "No se pudo cargar el registro de Bower",
    "STATUS_INSTALLING_PKG": "Instalando {0} ...",
    "STATUS_PKG_INSTALLED": "{0} instalado",
    "STATUS_ERROR_INSTALLING": "Error en la instalación de {0}",
    "TEXT_CLOSE": "Cerrar",
    "TEXT_CANCEL": "Cancelar",
    "TEXT_SAVE": "Guardar",
    "TEXT_OK": "OK",
    "TEXT_RELOAD_DEFAULTS": "Recargar defaults",
    "TEXT_SETTINGS_RELOAD_TIME": "Tiempo en recargar el registro de Bower",
    "TEXT_SETTINGS_SAVE_PACKAGES": "Guardar paquetes instalados con QuickInstall en el archivo bower.json",
    "GIT_NOT_FOUND_TITLE": "No se encontró Git en su sistema",
    "GIT_NOT_FOUND_DESCRIPTION": "La extensión Brackets-bower buscó a Git en el PATH del sistema.\n\nBower require tener instalado Git y configurado en la variable PATH del sistema, \npara descargar e instalar algunos paquetes.\nBrackets-bower puede no funcionar correctamente.",
    "COMMAND_INSTALL": "instalar",
    "COMMAND_PRUNE": "prune",
    "COMMAND_UNINSTALL": "desinstalar",
    "COMMAND_UPDATE": "actualizar",
    "TRACK_IN_BOWERJSON": "agregar",
    "REMOVE_FROM_BOWERJSON": "eliminar",
    "STATUS_EXECUTING_COMMAND": "Ejectuando comando \"{0}\"",
    "STATUS_ERROR_EXECUTING_COMMAND": "Error al ejecutar el comando \"{0}\"",
    "STATUS_SUCCESS_INSTALLING": "Paquetes instalados",
    "STATUS_SUCCESS_EXECUTING_COMMAND": "Comando \"{0}\" ejecutado",
    "STATUS_NO_PACKAGES_INSTALLED": "No hay ningún paquete para instalar",
    "ERROR_RELOAD_TIME_VALUE": "* El tiempo debe ser mayor a {0} minutos",
    "TITLE_ERROR_UNINSTALLING": "Error al desinstalar una dependencia de Bower",
    "SUMMARY_ERROR_UNINSTALLING_DEPENDANTS": "El paquete \"{0}\" tiene paquetes dependientes",
    "NOTE_QUESTION_CONTINUE_UNINSTALLING": "¿Está seguro que desea desinstalar el paquete?",
    "SUMMARY_ERROR": "Oops! Ocurrió un error.",
    "SYNC_WITH_PROJECT_TITLE": "Sincronizar con paquetes del proyecto",
    "SYNC_WITH_BOWER_JSON_TITLE": "Sincronizar con bower.json",
    "SYNC_PROJECT_MESSAGE": "Sincronizando proyecto",
    "SYNC_PROJECT_SUCCESS_MESSAGE": "Proyecto sincronizado",
    "PROJECT_OUT_OF_SYNC_MESSAGE": "No sincronizado",
    "PKG_STATUS_MISSING": "No instalado",
    "PKG_STATUS_VERSIONS": "Versiones no coinciden"
});

redpajama_set_name: RedPajamaGithub


text:
import numpy as np
import scipy.interpolate

# reading filter quantum efficiency
#- TODO: merge this with desisim filter class
def read_filter_response(given_filter,basepath):
    """
    Read requested filter (SDSS_r, DECAM_g, ...) from files in basepath dir

    Returns tuple of wavelength, throughput arrays
    """
    filterNameMap={}

    filttype=str.split(given_filter,'_')
    if filttype[0]=='SDSS':
        filterNameMap=given_filter.lower()+"0.txt"
    else: #if breakfilt[0]=='DECAM':
        filterNameMap=given_filter.lower()+".txt"
    filter_response={}
    fileName=basepath+filterNameMap
    wave, throughput = np.loadtxt(fileName, unpack=True)
    ## tck=scipy.interpolate.splrep(wave, throughput, s=0)
    ## filter_response=(wave, throughput, tck)
    ## return filter_response
    return wave, throughput


text:
"""
custom caching dict, which archives results to memory, file, or database
"""
from __future__ import absolute_import
from ._archives import cache
from ._archives import dict_archive as _dict_archive
from ._archives import null_archive as _null_archive
from ._archives import dir_archive as _dir_archive
from ._archives import file_archive as _file_archive
from ._archives import sql_archive as _sql_archive
from ._archives import sqltable_archive as _sqltable_archive
from ._archives import _sqlname

__all__ = ['cache','dict_archive','null_archive','dir_archive',\
           'file_archive','sql_archive','sqltable_archive']

class dict_archive(_dict_archive):
    def __new__(dict_archive, name=None, dict=None, cached=True, **kwds):
        """initialize a dictionary with an in-memory dictionary archive backend

    Inputs:
        name: (optional) identifier string [default: None]
        dict: initial dictionary to seed the archive
        cached: if True, use an in-memory cache interface to the archive
        """
        if dict is None: dict = {}
        archive = _dict_archive()
        archive.__state__['id'] = str(name)
        if cached: archive = cache(archive=archive)
        archive.update(dict)
        return archive
    pass

class null_archive(_null_archive):
    def __new__(null_archive, name=None, dict=None, cached=True, **kwds):
        """initialize a dictionary with a permanently-empty archive backend

    Inputs:
        name: (optional) identifier string [default: None]
        dict: initial dictionary to seed the archive
        cached: if True, use an in-memory cache interface to the archive
        """
        if dict is None: dict = {}
        archive = _null_archive()
        archive.__state__['id'] = str(name)
        if cached: archive = cache(archive=archive)
        archive.update(dict)
        return archive
    pass

class dir_archive(_dir_archive):
    def __new__(dir_archive, name=None, dict=None, cached=True, **kwds):
        """initialize a dictionary with a file-folder archive backend

    Inputs:
        name: name of the root archive directory [default: memo]
        dict: initial dictionary to seed the archive
        cached: if True, use an in-memory cache interface to the archive
        serialized: if True, pickle file contents; otherwise save python objects
        compression: compression level (0 to 9) [default: 0 (no compression)]
        memmode: access mode for files, one of {None, 'r+', 'r', 'w+', 'c'}
        memsize: approximate size (in MB) of cache for in-memory compression
        """
        if dict is None: dict = {}
        archive = _dir_archive(name, **kwds)
        if cached: archive = cache(archive=archive)
        archive.update(dict)
        return archive
    pass

class file_archive(_file_archive):
    def __new__(file_archive, name=None, dict=None, cached=True, **kwds):
        """initialize a dictionary with a single file archive backend

    Inputs:
        name: name of the file archive [default: memo.pkl or memo.py]
        dict: initial dictionary to seed the archive
        cached: if True, use an in-memory cache interface to the archive
        serialized: if True, pickle file contents; otherwise save python objects
        """
        if dict is None: dict = {}
        archive = _file_archive(name, **kwds)
        if cached: archive = cache(archive=archive)
        archive.update(dict)
        return archive
    pass

class sqltable_archive(_sqltable_archive):
    def __new__(sqltable_archive, name=None, dict=None, cached=True, **kwds):
        """initialize a dictionary with a sql database table archive backend

    Connect to an existing database, or initialize a new database, at the
    selected database url. For example, to use a sqlite database 'foo.db'
    in the current directory, database='sqlite:///foo.db'. To use a mysql
    database 'foo' on localhost, database='mysql://user:pass@localhost/foo'.
    For postgresql, use database='postgresql://user:pass@localhost/foo'.
    When connecting to sqlite, the default database is ':memory:'; otherwise,
    the default database is 'defaultdb'. Connections should be given as
    database?table=tablename; for example, name='sqlite:///foo.db?table=bar'.
    If not provided, the default tablename is 'memo'. If sqlalchemy is not
    installed, storable values are limited to strings, integers, floats, and
    other basic objects. If sqlalchemy is installed, additional keyword
    options can provide database configuration, such as connection pooling.
    To use a mysql or postgresql database, sqlalchemy must be installed.

    Inputs:
        name: url for the sql database and table [default: (see note above)]
        dict: initial dictionary to seed the archive
        cached: if True, use an in-memory cache interface to the archive
        serialized: if True, pickle table contents; otherwise cast as strings
        """
        if dict is None: dict = {}
        db, table = _sqlname(name)
        archive = _sqltable_archive(db, table, **kwds)
        if cached: archive = cache(archive=archive)
        archive.update(dict)
        return archive
    pass

class sql_archive(_sql_archive):
    def __new__(sql_archive, name=None, dict=None, cached=True, **kwds):
        """initialize a dictionary with a sql database archive backend

    Connect to an existing database, or initialize a new database, at the
    selected database url. For example, to use a sqlite database 'foo.db'
    in the current directory, database='sqlite:///foo.db'. To use a mysql
    database 'foo' on localhost, database='mysql://user:pass@localhost/foo'.
    For postgresql, use database='postgresql://user:pass@localhost/foo'.
    When connecting to sqlite, the default database is ':memory:'; otherwise,
    the default database is 'defaultdb'. If sqlalchemy is not installed,
    storable values are limited to strings, integers, floats, and other
    basic objects. If sqlalchemy is installed, additional keyword options
    can provide database configuration, such as connection pooling.
    To use a mysql or postgresql database, sqlalchemy must be installed.

    Inputs:
        name: url for the sql database [default: (see note above)]
        dict: initial dictionary to seed the archive
        cached: if True, use an in-memory cache interface to the archive
        serialized: if True, pickle table contents; otherwise cast as strings
        """
        if dict is None: dict = {}
        archive = _sql_archive(name, **kwds)
        if cached: archive = cache(archive=archive)
        archive.update(dict)
        return archive
    pass

# EOF