text:
from sprint import sprint as print
import filecmp
import glob
from io import open
import itertools
import jinja2
import os
import pprint
import random
import re
import stat
import string
import subprocess
from subprocess import PIPE
import urllib

import config  # bleagh

# html_done = False

alnum = string.digits + string.ascii_lowercase
verbose = False

if os.getenv('REQUEST_METHOD'):  # is this apache?  # pragma: no cover
    import cgitb
    cgitb.enable()

class Redirect(Exception):
    def __init__(self, value, delay=0):
        self.value = value
        self.delay = delay

    def __str__(self):
        return repr(self.value)

class SimpleError(Exception):
    def __init__(self, value, status=404):
        self.value = value
        self.status = status

    def __str__(self):
        return repr(self.value)

class SimpleOjbect(object):
    def __init__(self, args):
        for key, value in args.items():
            self.setattr(key, value)

def relpath(*args):
    if len(args) == 0:
        return '.'
    if len(args) == 1:
        if args[0].startswith('/'):
            return args[0][1:]
        return args[0]
    if args[0] == '.':
        args = args[1:]
    if args[0].startswith('/'):
        args = (args[0][1:],) + args[1:]
    return os.path.join(*args)

def read_dir(patt, tdir):
    odir = os.getcwd()
    os.chdir(tdir)
    flist = glob.glob(patt.strip())
    os.chdir(odir)
    return flist

# still a work in progress
def printablize(lord):
    if lord is None:
        return '(None)'
    if isinstance(lord, dict):
        lord = [lord]
    elif not isinstance(lord, list):
        if isinstance(lord, int):
            return str(lord)
        return lord
    for ent in lord:
        for key, val in ent.items():
            ent[key] = str(val)
    return lord

def defang(thing):
    return str(thing).replace('&', '&').replace('<', '<').replace('>', '>')

def root_ext(fn):
    '''Split fn into root and ext.  In this case, ext has no dot.

    >>> root_ext('abc.def')
    ('abc', 'def')
    >>> root_ext('.abc')
    ('.abc', '')
    >>> root_ext('abc.')
    ('abc', '')
    >>> root_ext('abc')
    ('abc', '')
    >>> root_ext('')
    ('', '')
    '''
    root, ext = os.path.splitext(fn)
    if ext.startswith('.'):
        ext = ext[1:]
    return root, ext

def clean_name(f, morebad=''):
    badlist = [',', '#']

    n = f.strip()
    for b in badlist + list(morebad):
        n = n.replace(b, '_')
    # c = n.count('.')
    # if c > 0:
    #     n = n.replace('.', '_', c - 1)
    return n

def is_good(fname, v=True):
    fname = os.path.normpath(fname)
    if not fname:
        if v:
            write_comment("is_good B", os.getcwd(), fname)
        return False
    try:
        if not os.path.exists(fname):
            if v:
                write_comment("is_good N", os.getcwd(), fname)
            return False
    except Exception:
        write_comment("is_good X1", os.getcwd(), fname)
        return False
    try:
        st = os.stat(fname)
    except Exception:
        write_comment("is_good X2", os.getcwd(), fname)
        return False
    if (st[stat.ST_MODE] & 0x004) == 0:
        if v:
            write_comment("is_good S", os.getcwd(), fname)
        return False
    if v:
        write_comment("is_good +", os.getcwd(), fname)
    return True

def render_file(fname):
    if is_good(fname):
        return open(fname).read()

def img_src(pth, alt=None, also={}):
    return ''

def plural(thing):
    return 's' if len(thing) != 1 else ''

def make_alnum(thing):
    output = []
    for ch in list(thing):
        if ch not in alnum:
            break
        output.append(ch)
    return ''.join(output)

def generate_token(number_digits=10):
    return ''.join([alnum[random.randrange(len(alnum))] for x in range(0, number_digits)])

def clean_id(str_id, limit=255):
    id_re = re.compile(r'[-/\w.]+')  # 0-9 A-Z a-z underscore dash slash dot
    id_m = id_re.match(str(str_id)[:limit])
    return id_m.group(0) if id_m else ''

def dump_dict_comment(t, d, keys=None):
    return ''
    ostr = f"\n'

def dump_dict(t, d, keys=None):
    return '{}
\n{}\n'.format(t, pprint.pformat(d, indent=1, width=132))

def fmt_also(also={}, style={}):
    nalso = dict(style)
    nalso.update(also)
    ostr = ''
    for tag, val in nalso.items():
        if val:
            ostr = ostr + f' {tag}="{val}"'
    return ostr

def dict_merge(*dicts):
    out_dict = dict()
    for in_dict in dicts:
        out_dict.update(in_dict)
    return out_dict

def set_and_add_list(d, k, ln):
    d.setdefault(k, [])
    d[k].extend(ln)

def any_char_match(t1, t2):
    return bool(set(list(t1 or '')) & set(list(t2 or '')))

def bit_list(val, format="%02x"):
    olst = []
    bit = 1
    while val:
        if val & 1:
            if '%' in format:
                olst.append(format % bit)
            else:
                olst.append(bit.format(format))
        val >>= 1
        bit *= 2
    return olst

def expand_number_list(lst):
    olst = []
    for n in lst:
        if '-' in n:
            s, e = n.split('-', 1)
            if s.isdigit() and e.isdigit():
                pat = '%%0%ds' % len(s)
                for n in range(int(s), int(e) + 1):
                    olst.append(pat % n)
                continue
        olst.append(n)
    return olst

def collapse_number_list(lst):
    intlist = []
    strlist = []
    maxlen = 0
    for ent in lst:
        try:
            val = int(ent)
        except Exception:
            pass
        else:
            maxlen = max(maxlen, len(str(ent)))
            intlist.append(val)
            continue

        try:
            ents = ent.split('-', 1)
            val1 = int(ents[0])
            val2 = int(ents[1])
        except Exception:
            pass
        else:
            maxlen = max(maxlen, len(str(ent[0])))
            maxlen = max(maxlen, len(str(ent[1])))
            intlist.extend(range(val1, val2 + 1))
            continue

        strlist.append(ent)

    str1 = "%%0%dd" % maxlen
    str2 = str1 + '-' + str1
    intlist.sort()
    start = None
    prev = None
    for val in intlist:
        if start is None:
            start = prev = val
        elif val == prev + 1:
            prev = val
        elif start == prev:
            strlist.append(str1 % start)
            start = prev = val
        else:
            strlist.append(str2 % (start, prev))
            start = prev = val
    if start is not None:
        if start == prev:
            strlist.append(str1 % start)
            start = None
        else:
            strlist.append(str2 % (start, prev))
            start = None

    return strlist

def reflect(in_iter, columns, pad=None):
    '''Reflects an interator carved up into chunks, padding with None.

    >>> reflect([0,1,2,3], 3)
    [0, 2, 1, 3, None, None]
    '''
    nents = len(in_iter)
    if nents < columns:
        return in_iter
    colsize = (len(in_iter) - 1) // columns + 1
    return itertools.chain(*itertools.zip_longest(*[in_iter[x:x + colsize] for x in range(
        0, colsize * columns,  # len(in_iter),
        colsize)], fillvalue=pad))

# sobj is a list of word-like things, targ is a string
def search_match(sobj, targ):
    if not targ:
        return False
    if not sobj or not isinstance(targ, str):
        return True
    targ = targ.lower()
    for s in sobj:
        if s.lower() not in targ:
            return False
    return True

def make_dir(dst, perms):
    if not os.path.exists(dst):
        warn('making', dst)
        try:
            os.mkdir(dst, perms)
        except Exception as e:
            warn('- failed -', e)

def file_touch(dst):
    os.utime(dst, None)

def file_mover(src, dst, mv=False, ov=False, inc=False, trash=False):  # pragma: no cover
    warn("file_mover", src, dst, "mv=", mv, "ov=", ov, "inc=", inc, "trash=", trash)
    addon = 0
    if dst and inc:
        root, ext = dst.rsplit('.', 1)  # for inc
    while 1:
        if src and dst and os.path.exists(src) and os.path.exists(dst) and os.path.samefile(src, dst):
            if not trash:
                warn("What? (trash)")
            return False
        if not os.path.exists(src):
            if not trash:
                warn(src, "- source not found")
        elif dst is None:
            if mv:
                file_delete(src)
            else:
                if not trash:
                    warn("Eh?")
                return False
        elif not os.path.exists(dst):
            if mv:
                file_move(src, dst)
            else:
                file_copy(src, dst)
        elif filecmp.cmp(src, dst, False):
            if mv:
                os.remove(src)
                if not trash:
                    warn(src, "- source removed")
            else:
                if not trash:
                    warn("files are identical")
        elif ov:
            # os.remove(dst)
            path, filename = dst.rsplit('/', 1)
            file_mover(dst, relpath('.', config.TRASH_DIR, filename), mv=True, inc=True, trash=True)
            if not trash:
                warn(dst, "- old file overwritten")
            if mv:
                file_move(src, dst)
            else:
                file_copy(src, dst)
        elif inc:
            addon += 1
            dst = root + '-' + str(addon) + '.' + ext
            continue
        else:
            if not trash:
                warn("- destination exists")
            return False
        return True

def file_move(src, dst, ov=False, trash=False):  # pragma: no cover
    if not trash:
        warn("mv", src, dst)
    try:
        os.rename(src, dst)
    except Exception as e:
        warn("- failed -", e)
    return True

def file_delete(src, trash=False):  # pragma: no cover
    if not trash:
        warn("rm", src)
    if os.path.exists(src):
        try:
            os.unlink(src)
            if not trash:
                warn("- removed")
        except Exception as e:
            if not trash:
                warn("- failed -", e)
            return False
    elif not trash:
        warn("- not found")
    return True

def file_copy(src, dst, trash=False):  # pragma: no cover
    if not trash:
        warn("copy", src, dst)
    try:
        open(dst, 'wb').write(open(src, 'rb').read())
    except Exception as e:
        if not trash:
            warn("- failed -", e)
    return False

def fix_file_type(pif, pdir, fn):
    types = [
        ('JPEG', 'jpg'),
        ('GIF', 'gif'),
        ('PC bitmap', 'bmp'),
        ('PNG', 'png'),
    ]
    if '.' in fn:
        root, ext = fn.rsplit('.', 1)
    else:
        root = fn
        ext = ''

    p = simple_process(("/usr/bin/file", "-b", pdir + '/' + fn,))
    lns = p.stdout.readlines()
    if not lns:
        return fn
    ln = lns[0].strip()

    for typ in types:
        if ln.startswith(typ[0]):
            ext = typ[1]

    nfn = root + '.' + ext
    if nfn == fn:
        return fn
    if os.path.exists(pdir + '/' + nfn):
        addon = 1
        while os.path.exists(pdir + '/' + root + '_' + str(addon) + '.' + ext):
            addon += 1
        root += '_' + str(addon)
    nfn = root + '.' + ext
    os.rename(pdir + '/' + fn, pdir + '/' + nfn)
    return nfn

def file_save(pdir, fn, contents, overwrite=False):
    make_dir(pdir, 0o775)
    if '.' in fn:
        root, ext = fn.rsplit('.', 1)
    else:
        root = fn
        ext = ''
    ext = ext.lower()
    root = clean_name(root, '!@$%^&*()[]{}~`<>"+/')
    ext = clean_name(ext, '!@$%^&*()[]{}~`<>"+/')
    fn = root + '.' + ext
    if os.path.exists(pdir + '/' + fn):
        if overwrite:
            file_mover(pdir + '/' + fn, relpath('.', config.TRASH_DIR, fn), mv=True, inc=True, trash=True)
        else:
            addon = 1
            while os.path.exists(pdir + '/' + root + '_' + str(addon) + '.' + ext):
                addon += 1
            root += '_' + str(addon)
    fn = root + '.' + ext
    open(pdir + '/' + fn, 'wb' if isinstance(contents, bytes) else 'w').write(contents)
    return fn

def show_error():
    import traceback
    if _format_web:
        print('
')
    print(traceback.format_exc())
    if _format_web:
        print('
')

# File-level globals.  Not to be imported by any other file.
_format_web = True
_pending_comments = list()
_header_done_flag = False
_partial_comment = None

def is_header_done(new_set=False):
    global _header_done_flag
    if new_set:
        _header_done_flag = True
    return _header_done_flag

def header_done(is_web=True, silent=False):
    global _format_web, _pending_comments
    _format_web = is_web
    is_header_done(True)
    ostr = '\n'.join([format_string(*x) for x in _pending_comments])
    _pending_comments = list()
    if silent:
        return ostr
    if ostr:
        print(ostr)

def warn(*args, **kwargs):
    write_string(*args, nonl=kwargs.get('nonl', False), warning=True, comment=False)

def write_message(*args, **kwargs):
    write_string(*args, nonl=kwargs.get('nonl', False), warning=False, comment=False)

def write_debug_message(*args, **kwargs):
    if verbose:
        write_string(*args, nonl=kwargs.get('nonl', False), warning=False, comment=False)

def write_comment(*args, **kwargs):
    write_string(*args, nonl=kwargs.get('nonl', False), warning=False, comment=True)

def write_string(*args, **kwargs):
    ostr = format_string(*args, **kwargs)
    if ostr:
        print(ostr)

def format_string(*args, **kwargs):
    global _pending_comments, _partial_comment, _format_web
    partial = kwargs.get('nonl')
    warning = kwargs.get('warning', False)
    comment = kwargs.get('comment', False)
    if args and not _partial_comment:
        if warning:
            args = ('!',) + args
        if comment:
            args = ('#',) + args
    if partial:
        if _partial_comment is None:  # separate from empty list
            _partial_comment = list()
        _partial_comment.extend(args)
        args = []
    elif _partial_comment:
        args = _partial_comment + list(args)
        _partial_comment = None
    if args:
        if not is_header_done():
            _pending_comments.append(args)
        elif not _format_web:
            return ' '.join([str(x) for x in args])
        elif args[0] == '#':
            return ''
        elif args[0] == '!':
            return '
{}
'.format(' '.join([str(x) for x in args[1:]]))
        else:
            return ' '.join([str(x) for x in args]) + '
'
    return ''

def read_comments():
    global _pending_comments
    comments = '\n'.join([' '.join([str(arg) for arg in args]) for args in _pending_comments])
    _pending_comments = list()
    return comments

def render_template(template, **kwargs):
    env = jinja2.Environment(loader=jinja2.FileSystemLoader('../templates'))
    tpl = env.get_template(template)
    return tpl.render(comments=read_comments(), **kwargs)

def command_help(script, cmds):
    # cmds is list of (cmd, function, help message)
    write_message("{} [{}] ...".format(script, '|'.join([x[0] for x in cmds])))
    for cmd, func, hlp in cmds:
        write_message(f"  {cmd} for {hlp}")

def cmd_proc(pif, script, cmds):
    header_done(False)
    if pif.filelist:
        lup = {x[0]: x[1] for x in cmds}
        if pif.filelist[0] in lup:
            return lup[pif.filelist[0]](pif, *pif.filelist[1:])
    command_help(script, cmds)

def pipe_chain(inp, pipes, stderr=None, verbose=True):
    procs = []
    ch = '%'
    for cmd in pipes:
        if verbose:
            write_message(ch, ' '.join(cmd), nonl=True)
        ch = '|'
        procs.append(subprocess.Popen(cmd, stdin=inp, stdout=PIPE, stderr=stderr))
        # , text=True
        inp = procs[-1].stdout
    if verbose:
        write_message()
    output = b''
    while True:
        o, e = procs[-1].communicate()
        output += o
        if procs[-1].returncode is not None:
            break
    return output

def simple_process(cmd, msg='', inp=PIPE, stderr=None, verbose=False):
    ch = '%'
    if verbose:
        write_message(ch, ' '.join(cmd), nonl=True)
    proc = subprocess.Popen(cmd, stdin=inp, stdout=PIPE, stderr=stderr, text=True)
    output = ''
    o, e = proc.communicate(msg)
    while proc.returncode is None:
        output += o
        o, e = proc.communicate()
    return output

def url_quote(value, safe=None, plus=False):
    safe = safe if safe is not None else '' if plus else '/'
    return urllib.parse.quote_plus(value, safe) if plus else urllib.parse.quote(value, safe)

def make_button_name(name):
    return name.replace('
', '_').replace(' ', '_').lower()

def make_button_label(name):
    return name.replace('_', ' ').upper()


text:
package org.deri.grefine.reconcile.model;

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

import javax.xml.bind.annotation.XmlRootElement;

@XmlRootElement
public class ReconciliationResponse {

	private List<? extends ReconciliationCandidate> results;

	public ReconciliationResponse(){
		this.results = new ArrayList<ReconciliationCandidate>();
	}

	/*public void addResult(ReconciliationCandidate result){
		this.results.add(result);
	}*/

	public List<? extends ReconciliationCandidate> getResults() {
		return results;
	}

	public void setResults(List<? extends ReconciliationCandidate> results) {
		this.results = results;
	}

}

redpajama_set_name: RedPajamaGithub


text:
        <base href="https://webapps.cityofchicago.org/moboco/org/cityofchicago/moboc/controller/view/board.jsp">
        <title>City of Chicago - Boards and Commissions</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-Language" content="en-us" />
<meta http-equiv="Pragma" content="no-cache">
<meta http-equiv="expires" content="0">

<link rel="stylesheet" type="text/css" media="screen" href="/moboco/resources/css/navigation.css">
<link rel="stylesheet" type="text/css" media="print" href="/moboco/resources/css/print.css">

City of Chicago Website

Board Information

Name	COMMUNITY DEVELOPMENT COMMISSION

Function	To review and recommend action to the City Council on the establishment of new Tax Increment Financing (TIF) districts, Redevelopment Area designations, and appointment of members to Community Conservation Councils. In addition, to review and recommend action on the sale of city-owned property located in TIF districts or redevelopment areas, and the provision of TIF financing to assist private redevelopment projects.

Composition
     Mayoral Appointments:15
     Ex Officio Members:0
     Other:0

City Council Approval	Required for Mayoral Appointments

Legal Authority	MUNICIPAL CODE OF CHICAGO, SECTION 2-124-020(A)

More Information	Community Development Commission website

Membership

Member Name
                Term Expires
                Appointed By

Philip A Alphonse

     02/26/2019
     Mayor

Robert  Buford

     02/26/2016
     Mayor

Gwendolyn L Butler

     02/26/2020
     Mayor

Marina  Carrott

     02/26/2016
     Mayor

Adela M Cepeda

     02/26/2017
     Mayor

Leslie D Davis

     02/26/2018
     Mayor

Omar A Duque

     02/26/2017
     Mayor

Cornelius D Griggs

     02/26/2020
     Mayor

Shirley J Newsome

     02/26/2018
     Mayor

Lynda A Olander

     02/26/2018
     Mayor

Jorge J Perez

     02/26/2016
     Mayor

Celena  Roldan Moreno

     02/26/2020
     Mayor

Roxanne M Ward

     02/26/2016
     Mayor

Vacancy

     Mayor

Vacancy

     Mayor

    The information on this site is current as of October 8, 2015.

 Home :
 Disclaimer :
 Privacy Policy :
 City of Chicago :
 Contact Us

Copyright © 2009 City of Chicago


text:
"""
A File gallery application for Django
"""
__version__ = "2.0.1"


text:
namespace garf {

    // 64 bit for everything. This will probably suck on 32 bit machines, but whatever
    typedef long eigen_idx_t;
    typedef eigen_idx_t tree_idx_t;
    typedef eigen_idx_t node_idx_t;
    typedef eigen_idx_t label_idx_t;
    typedef eigen_idx_t feat_idx_t;
    typedef eigen_idx_t depth_idx_t;
    typedef eigen_idx_t data_dim_idx_t;
    typedef eigen_idx_t datapoint_idx_t;
    typedef eigen_idx_t split_idx_t;
    typedef double importance_t;
    typedef double error_t;
    typedef double weight_t;
    typedef enum { LEFT=0, RIGHT=1 } split_dir_t;

    typedef std::mt19937_64 RngSource;

    // This will only compile with C++ 11. Sorry folks. There is lots of redundancy here, but
    // it makes the source code lovely to look at. Hooray.
    template <typename T> using feature_mtx = Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>;
    template <typename T> using feature_vec = Eigen::Matrix<T, Eigen::Dynamic, 1>;
    template <typename T> using label_mtx = Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>;
    template <typename T> using label_vec = Eigen::Matrix<T, Eigen::Dynamic, 1>;
    template <typename T> using variance_mtx = Eigen::Matrix<T, Eigen::Dynamic, Eigen::Dynamic>;
    template <typename T> using variance_vec = Eigen::Matrix<T, Eigen::Dynamic, 1>;

    typedef Eigen::Matrix<datapoint_idx_t, Eigen::Dynamic, 1> data_indices_vec;
    typedef Eigen::Matrix<datapoint_idx_t, Eigen::Dynamic, Eigen::Dynamic> data_indices_mtx;

    typedef Eigen::Matrix<node_idx_t, Eigen::Dynamic, Eigen::Dynamic> tree_idx_mtx;
    typedef Eigen::Matrix<feat_idx_t, Eigen::Dynamic, 1> feat_idx_vec;
    typedef Eigen::Matrix<split_dir_t, Eigen::Dynamic, 1> split_dir_vec;
    typedef Eigen::Matrix<bool, Eigen::Dynamic, 1> bool_vec;

    typedef Eigen::Matrix<importance_t, Eigen::Dynamic, 1> importance_vec;
    typedef Eigen::Matrix<error_t, Eigen::Dynamic, 1> error_vec;
    typedef Eigen::Matrix<error_t, Eigen::Dynamic, Eigen::Dynamic> error_mtx;

    typedef Eigen::Matrix<weight_t, Eigen::Dynamic, 1> weight_vec;
}

#endif


text:
<?php if (!defined('BASEPATH')) exit('No direct script access allowed');

/**
 * Additional validations for URL testing.
 *
 * @package      Module Creator
 * @subpackage  ThirdParty
 * @category    Libraries
 * @author  Brian Antonelli <brian.antonelli@autotrader.com>
 * @created 11/19/2010
 */

class MY_validation extends CI_validation{

    function MY_validation(){
        parent::CI_validation();
    }

    /**
     * Validate URL format
     *
     * @access  public
     * @param   string
     * @return  string
     */
    function valid_url_format($str){
        $pattern = "|^http(s)?://[a-z0-9-]+(.[a-z0-9-]+)*(:[0-9]+)?(/.*)?$|i";
        if (!preg_match($pattern, $str)){
            $this->set_message('valid_url_format', 'The URL you entered is not correctly formatted.');
            return FALSE;
        }

        return TRUE;
    }

      function youtube_url_format($str){
        $pattern = "/^(http\:\/\/)?(www\.)?(youtube\.com|youtu\.be)\/watch\?v\=\w+$/";
        if (!preg_match($pattern, $str)){
            $this->set_message('valid_url_format', 'The URL you entered is not correctly formatted.');
            return FALSE;
        }

        return TRUE;
    }

    // --------------------------------------------------------------------

    /**
     * Validates that a URL is accessible. Also takes ports into consideration.
     * Note: If you see "php_network_getaddresses: getaddrinfo failed: nodename nor servname provided, or not known"
     *          then you are having DNS resolution issues and need to fix Apache
     *
     * @access  public
     * @param   string
     * @return  string
     */
    function url_exists($url){
        $url_data = parse_url($url); // scheme, host, port, path, query
        if(!fsockopen($url_data['host'], isset($url_data['port']) ? $url_data['port'] : 80)){
            $this->set_message('url_exists', 'The URL you entered is not accessible.');
            return FALSE;
        }

        return TRUE;
    }

}


text:
import logging
import database.database as database

def create_context_by_id(context) -> str:
    if database.context:
        raise Exception ("TAPI Context cannot be created/deleted since it is the root presence-container for all client-server interaction")
    logging.info("create_context_by_id %s", context)
    database.context=context
    return context

def create_context_connectivity_service_connectivity_service_by_id(uuid, connectivityService) -> str:
    logging.info("create_context_connectivity_service_connectivity_service_by_id %s %s", uuid, connectivityService)
    connection = {
      "uuid" : uuid,
      "connection-end-point": [
           "/restconf/config/topology/top0/node/node1/owned-node-edge-point/nep11/cep-list/cep11",
           "/restconf/config/topology/top0/node/node1/owned-node-edge-point/nep12/cep-list/cep11"
      ]
    }
    database.context['connection'].append(connection)
    connectivityService['connection'] =  [ "/restconf/config/connection/" + uuid +"/" ]
    database.context['connectivity-service'].append(connectivityService)
    return connectivityService

def create_context_connectivity_service_end_point_capacity_capacity_by_id(uuid, localId, capacity) -> str:
    return 'do some magic!'

def create_context_connectivity_service_end_point_end_point_by_id(uuid, localId, endPoint) -> str:
    return 'do some magic!'

def create_context_connectivity_service_end_point_name_name_by_id(uuid, localId, valueName, name) -> str:
    return 'do some magic!'

def create_context_connectivity_service_name_name_by_id(uuid, valueName, name) -> str:
    return 'do some magic!'

def create_context_connectivity_service_resilience_type_resilience_type_by_id(uuid, resilienceType) -> str:
    return 'do some magic!'

def create_context_connectivity_service_schedule_schedule_by_id(uuid, schedule) -> str:
    return 'do some magic!'

def create_context_name_name_by_id(valueName, name) -> str:
    return 'do some magic!'

def create_context_path_comp_service_end_point_end_point_by_id(uuid, localId, endPoint) -> str:
    return 'do some magic!'

def create_context_path_comp_service_end_point_name_name_by_id(uuid, localId, valueName, name) -> str:
    return 'do some magic!'

def create_context_path_comp_service_name_name_by_id(uuid, valueName, name) -> str:
    return 'do some magic!'

def create_context_path_comp_service_objective_function_name_name_by_id(uuid, valueName, name) -> str:
    return 'do some magic!'

def create_context_path_comp_service_objective_function_objective_function_by_id(uuid, objectiveFunction) -> str:
    return 'do some magic!'

def create_context_path_comp_service_optimization_constraint_name_name_by_id(uuid, valueName, name) -> str:
    return 'do some magic!'

def create_context_path_comp_service_optimization_constraint_optimization_constraint_by_id(uuid, optimizationConstraint) -> str:
    return 'do some magic!'

def create_context_path_comp_service_path_comp_service_by_id(uuid, pathCompService) -> str:
    return 'do some magic!'

def create_context_path_comp_service_routing_constraint_name_name_by_id(uuid, valueName, name) -> str:
    return 'do some magic!'

def create_context_path_comp_service_routing_constraint_routing_constraint_by_id(uuid, routingConstraint) -> str:
    return 'do some magic!'

def create_context_service_interface_point_name_name_by_id(uuid, valueName, name) -> str:
    return 'do some magic!'

def create_context_service_interface_point_service_interface_point_by_id(uuid, serviceInterfacePoint) -> str:
    return 'do some magic!'

def create_create_connectivity_service_by_id(createConnectivityService) -> str:
    return 'do some magic!'

def create_delete_connectivity_service_by_id(deleteConnectivityService) -> str:
    return 'do some magic!'

def create_get_connection_details_by_id(getConnectionDetails) -> str:
    return 'do some magic!'

def create_get_connectivity_service_details_by_id(getConnectivityServiceDetails) -> str:
    return 'do some magic!'

def create_get_connectivity_service_list_by_id() -> str:
    return 'do some magic!'

def create_update_connectivity_service_by_id(updateConnectivityService) -> str:
    return 'do some magic!'

def delete_context_by_id() -> str:
    if database.context:
        raise Exception ("TAPI Context cannot be created/deleted since it is the root presence-container for all client-server interaction")
    return 'do some magic!'

def delete_context_connectivity_service_connectivity_service_by_id(uuid) -> str:
    for connection in database.context['connection']:
        if connection['uuid'] == uuid :
            database.context['connection'].remove(connection)
    for cs in database.context['connectivity-service']:
        if cs['uuid'] == uuid :
            database.context['connectivity-service'].remove(cs)
            return "done"
    return error, 404

def delete_context_connectivity_service_end_point_capacity_capacity_by_id(uuid, localId) -> str:
    return 'do some magic!'

def delete_context_connectivity_service_end_point_end_point_by_id(uuid, localId) -> str:
    return 'do some magic!'

def delete_context_connectivity_service_end_point_name_name_by_id(uuid, localId, valueName) -> str:
    return 'do some magic!'

def delete_context_connectivity_service_name_name_by_id(uuid, valueName) -> str:
    return 'do some magic!'

def delete_context_connectivity_service_resilience_type_resilience_type_by_id(uuid) -> str:
    return 'do some magic!'

def delete_context_connectivity_service_schedule_schedule_by_id(uuid) -> str:
    return 'do some magic!'

def delete_context_name_name_by_id(valueName) -> str:
    return 'do some magic!'

def delete_context_path_comp_service_end_point_end_point_by_id(uuid, localId) -> str:
    return 'do some magic!'

def delete_context_path_comp_service_end_point_name_name_by_id(uuid, localId, valueName) -> str:
    return 'do some magic!'

def delete_context_path_comp_service_name_name_by_id(uuid, valueName) -> str:
    return 'do some magic!'

def delete_context_path_comp_service_objective_function_name_name_by_id(uuid, valueName) -> str:
    return 'do some magic!'

def delete_context_path_comp_service_objective_function_objective_function_by_id(uuid) -> str:
    return 'do some magic!'

def delete_context_path_comp_service_optimization_constraint_name_name_by_id(uuid, valueName) -> str:
    return 'do some magic!'

def delete_context_path_comp_service_optimization_constraint_optimization_constraint_by_id(uuid) -> str:
    return 'do some magic!'

def delete_context_path_comp_service_path_comp_service_by_id(uuid) -> str:
    return 'do some magic!'

def delete_context_path_comp_service_routing_constraint_name_name_by_id(uuid, valueName) -> str:
    return 'do some magic!'

def delete_context_path_comp_service_routing_constraint_routing_constraint_by_id(uuid) -> str:
    return 'do some magic!'

def delete_context_service_interface_point_name_name_by_id(uuid, valueName) -> str:
    return 'do some magic!'

def delete_context_service_interface_point_service_interface_point_by_id(uuid) -> str:
    return 'do some magic!'

def retrieve_context() -> str:
    logging.info("retrieve_context")
    return database.context

def retrieve_context_connection_connection() -> str:
    logging.info("retrieve_context_connection_connection")
    array_cs=[]
    for connection in database.context['connection']:
      uri="/restconf/config/context/connection/"+connection["uuid"]+"/"
      array_cs.append(uri)
    #json = { 'itemlist' : array_cs }
    return array_cs

def retrieve_context_connection_connection_by_id(uuid) -> str:
    logging.info("retrieve_context_connection_connection_by_id %s", uuid)
    for item in  database.context['connection']:
      if item['uuid'] == uuid:
        return item

def retrieve_context_connection_name_name(uuid) -> str:
    return 'do some magic!'

def retrieve_context_connection_name_name_by_id(uuid, valueName) -> str:
    return 'do some magic!'

def retrieve_context_connection_route_name_name(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connection_route_name_name_by_id(uuid, localId, valueName) -> str:
    return 'do some magic!'

def retrieve_context_connection_route_route(uuid) -> str:
    return 'do some magic!'

def retrieve_context_connection_route_route_by_id(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connection_switch_control_name_name(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connection_switch_control_name_name_by_id(uuid, localId, valueName) -> str:
    return 'do some magic!'

def retrieve_context_connection_switch_control_resilience_type_resilience_type(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connection_switch_control_switch_control(uuid) -> str:
    return 'do some magic!'

def retrieve_context_connection_switch_control_switch_control_by_id(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connection_switch_control_switch_name_name(uuid, localId, localId2) -> str:
    return 'do some magic!'

def retrieve_context_connection_switch_control_switch_name_name_by_id(uuid, localId, localId2, valueName) -> str:
    return 'do some magic!'

def retrieve_context_connection_switch_control_switch_switch(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connection_switch_control_switch_switch_by_id(uuid, localId, localId2) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_connectivity_service() -> str:
    logging.info("retrieve_context_connectivity_service_connectivity_service")
    array_cs=[]
    for cs in database.context['connectivity-service']:
      uri="/restconf/config/context/connectivity-service/"+cs["uuid"]+"/"
      array_cs.append(uri)
    #json = { 'itemlist' : array_cs }
    return array_cs

def retrieve_context_connectivity_service_connectivity_service_by_id(uuid) -> str:
    logging.info("retrieve_context_connectivity_service_connectivity_service_by_id %s", uuid)
    for item in  database.context['connectivity-service']:
      if item['uuid'] == uuid:
        return item

def retrieve_context_connectivity_service_cost_characteristic_cost_characteristic(uuid) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_cost_characteristic_cost_characteristic_by_id(uuid, costName) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_end_point_capacity_available_capacity_available_capacity(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_end_point_capacity_available_capacity_bandwidth_profile_bandwidth_profile(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_end_point_capacity_available_capacity_bandwidth_profile_committed_burst_size_committed_burst_size(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_end_point_capacity_available_capacity_bandwidth_profile_committed_information_rate_committed_information_rate(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_end_point_capacity_available_capacity_bandwidth_profile_peak_burst_size_peak_burst_size(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_end_point_capacity_available_capacity_bandwidth_profile_peak_information_rate_peak_information_rate(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_end_point_capacity_available_capacity_total_size_total_size(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_end_point_capacity_capacity(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_end_point_capacity_total_potential_capacity_bandwidth_profile_bandwidth_profile(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_end_point_capacity_total_potential_capacity_bandwidth_profile_committed_burst_size_committed_burst_size(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_end_point_capacity_total_potential_capacity_bandwidth_profile_committed_information_rate_committed_information_rate(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_end_point_capacity_total_potential_capacity_bandwidth_profile_peak_burst_size_peak_burst_size(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_end_point_capacity_total_potential_capacity_bandwidth_profile_peak_information_rate_peak_information_rate(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_end_point_capacity_total_potential_capacity_total_potential_capacity(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_end_point_capacity_total_potential_capacity_total_size_total_size(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_end_point_end_point(uuid) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_end_point_end_point_by_id(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_end_point_name_name(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_end_point_name_name_by_id(uuid, localId, valueName) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_latency_characteristic_latency_characteristic(uuid) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_latency_characteristic_latency_characteristic_by_id(uuid, trafficPropertyName) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_name_name(uuid) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_name_name_by_id(uuid, valueName) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_requested_capacity_bandwidth_profile_bandwidth_profile(uuid) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_requested_capacity_bandwidth_profile_committed_burst_size_committed_burst_size(uuid) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_requested_capacity_bandwidth_profile_committed_information_rate_committed_information_rate(uuid) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_requested_capacity_bandwidth_profile_peak_burst_size_peak_burst_size(uuid) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_requested_capacity_bandwidth_profile_peak_information_rate_peak_information_rate(uuid) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_requested_capacity_requested_capacity(uuid) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_requested_capacity_total_size_total_size(uuid) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_resilience_type_resilience_type(uuid) -> str:
    return 'do some magic!'

def retrieve_context_connectivity_service_schedule_schedule(uuid) -> str:
    return 'do some magic!'

def retrieve_context_name_name() -> str:
    return 'do some magic!'

def retrieve_context_name_name_by_id(valueName) -> str:
    return 'do some magic!'

def retrieve_context_nw_topology_service_name_name() -> str:
    return 'do some magic!'

def retrieve_context_nw_topology_service_name_name_by_id(valueName) -> str:
    return 'do some magic!'

def retrieve_context_nw_topology_service_nw_topology_service() -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_end_point_end_point(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_end_point_end_point_by_id(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_end_point_name_name(uuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_end_point_name_name_by_id(uuid, localId, valueName) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_name_name(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_name_name_by_id(uuid, valueName) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_objective_function_name_name(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_objective_function_name_name_by_id(uuid, valueName) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_objective_function_objective_function(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_optimization_constraint_name_name(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_optimization_constraint_name_name_by_id(uuid, valueName) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_optimization_constraint_optimization_constraint(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_path_comp_service() -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_path_comp_service_by_id(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_routing_constraint_cost_characteristic_cost_characteristic(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_routing_constraint_cost_characteristic_cost_characteristic_by_id(uuid, costName) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_routing_constraint_latency_characteristic_latency_characteristic(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_routing_constraint_latency_characteristic_latency_characteristic_by_id(uuid, trafficPropertyName) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_routing_constraint_name_name(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_routing_constraint_name_name_by_id(uuid, valueName) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_routing_constraint_requested_capacity_bandwidth_profile_bandwidth_profile(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_routing_constraint_requested_capacity_bandwidth_profile_committed_burst_size_committed_burst_size(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_routing_constraint_requested_capacity_bandwidth_profile_committed_information_rate_committed_information_rate(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_routing_constraint_requested_capacity_bandwidth_profile_peak_burst_size_peak_burst_size(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_routing_constraint_requested_capacity_bandwidth_profile_peak_information_rate_peak_information_rate(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_routing_constraint_requested_capacity_requested_capacity(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_routing_constraint_requested_capacity_total_size_total_size(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_comp_service_routing_constraint_routing_constraint(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_name_name(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_name_name_by_id(uuid, valueName) -> str:
    return 'do some magic!'

def retrieve_context_path_path() -> str:
    return 'do some magic!'

def retrieve_context_path_path_by_id(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_routing_constraint_cost_characteristic_cost_characteristic(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_routing_constraint_cost_characteristic_cost_characteristic_by_id(uuid, costName) -> str:
    return 'do some magic!'

def retrieve_context_path_routing_constraint_latency_characteristic_latency_characteristic(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_routing_constraint_latency_characteristic_latency_characteristic_by_id(uuid, trafficPropertyName) -> str:
    return 'do some magic!'

def retrieve_context_path_routing_constraint_name_name(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_routing_constraint_name_name_by_id(uuid, valueName) -> str:
    return 'do some magic!'

def retrieve_context_path_routing_constraint_requested_capacity_bandwidth_profile_bandwidth_profile(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_routing_constraint_requested_capacity_bandwidth_profile_committed_burst_size_committed_burst_size(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_routing_constraint_requested_capacity_bandwidth_profile_committed_information_rate_committed_information_rate(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_routing_constraint_requested_capacity_bandwidth_profile_peak_burst_size_peak_burst_size(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_routing_constraint_requested_capacity_bandwidth_profile_peak_information_rate_peak_information_rate(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_routing_constraint_requested_capacity_requested_capacity(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_routing_constraint_requested_capacity_total_size_total_size(uuid) -> str:
    return 'do some magic!'

def retrieve_context_path_routing_constraint_routing_constraint(uuid) -> str:
    return 'do some magic!'

def retrieve_context_service_interface_point_available_capacity_available_capacity(uuid) -> str:
    return 'do some magic!'

def retrieve_context_service_interface_point_available_capacity_bandwidth_profile_bandwidth_profile(uuid) -> str:
    return 'do some magic!'

def retrieve_context_service_interface_point_available_capacity_bandwidth_profile_committed_burst_size_committed_burst_size(uuid) -> str:
    return 'do some magic!'

def retrieve_context_service_interface_point_available_capacity_bandwidth_profile_committed_information_rate_committed_information_rate(uuid) -> str:
    return 'do some magic!'

def retrieve_context_service_interface_point_available_capacity_bandwidth_profile_peak_burst_size_peak_burst_size(uuid) -> str:
    return 'do some magic!'

def retrieve_context_service_interface_point_available_capacity_bandwidth_profile_peak_information_rate_peak_information_rate(uuid) -> str:
    return 'do some magic!'

def retrieve_context_service_interface_point_available_capacity_total_size_total_size(uuid) -> str:
    return 'do some magic!'

def retrieve_context_service_interface_point_name_name(uuid) -> str:
    return 'do some magic!'

def retrieve_context_service_interface_point_name_name_by_id(uuid, valueName) -> str:
    return 'do some magic!'

def retrieve_context_service_interface_point_service_interface_point() -> str:
    logging.info("retrieve_context_service_interface_point_service_interface_point")
    array_cs=[]
    for sip in database.context['service-interface-point']:
      uri="/restconf/config/context/service-interface-point/"+sip["uuid"]+"/"
      array_cs.append(uri)
    #json = { 'itemlist' : array_cs }
    return array_cs

def retrieve_context_service_interface_point_service_interface_point_by_id(uuid) -> str:
    logging.info("retrieve_context_service_interface_point_service_interface_point_by_id %s", uuid)
    for item in  database.context['service-interface-point']:
      if item['uuid'] == uuid:
        return item

def retrieve_context_service_interface_point_total_potential_capacity_bandwidth_profile_bandwidth_profile(uuid) -> str:
    return 'do some magic!'

def retrieve_context_service_interface_point_total_potential_capacity_bandwidth_profile_committed_burst_size_committed_burst_size(uuid) -> str:
    return 'do some magic!'

def retrieve_context_service_interface_point_total_potential_capacity_bandwidth_profile_committed_information_rate_committed_information_rate(uuid) -> str:
    return 'do some magic!'

def retrieve_context_service_interface_point_total_potential_capacity_bandwidth_profile_peak_burst_size_peak_burst_size(uuid) -> str:
    return 'do some magic!'

def retrieve_context_service_interface_point_total_potential_capacity_bandwidth_profile_peak_information_rate_peak_information_rate(uuid) -> str:
    return 'do some magic!'

def retrieve_context_service_interface_point_total_potential_capacity_total_potential_capacity(uuid) -> str:
    return 'do some magic!'

def retrieve_context_service_interface_point_total_potential_capacity_total_size_total_size(uuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_available_capacity_available_capacity(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_available_capacity_bandwidth_profile_bandwidth_profile(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_available_capacity_bandwidth_profile_committed_burst_size_committed_burst_size(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_available_capacity_bandwidth_profile_committed_information_rate_committed_information_rate(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_available_capacity_bandwidth_profile_peak_burst_size_peak_burst_size(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_available_capacity_bandwidth_profile_peak_information_rate_peak_information_rate(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_available_capacity_total_size_total_size(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_cost_characteristic_cost_characteristic(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_cost_characteristic_cost_characteristic_by_id(uuid, linkUuid, costName) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_latency_characteristic_latency_characteristic(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_latency_characteristic_latency_characteristic_by_id(uuid, linkUuid, trafficPropertyName) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_link(uuid) -> str:
    logging.info("retrieve_context_topology_link_link %s", uuid)
    for item in  database.context['topology']:
      if item['uuid'] == uuid:
        array_cs=[]
        for link in item['link']:
          uri="/restconf/config/context/topology/"+uuid+"/link/"+link["uuid"]+"/"
          array_cs.append(uri)
        #json = { 'itemlist' : array_cs }
        return array_cs

def retrieve_context_topology_link_link_by_id(uuid, link_uuid) -> str:
    logging.info("retrieve_context_topology_link_link_by_id %s $s", uuid, link_uuid)
    for item in  database.context['topology']:
      if item['uuid'] == uuid:
        for link in item['link']:
          if link['uuid'] == link_uuid:
            return link

def retrieve_context_topology_link_name_name(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_name_name_by_id(uuid, linkUuid, valueName) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_resilience_type_resilience_type(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_risk_characteristic_risk_characteristic(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_risk_characteristic_risk_characteristic_by_id(uuid, linkUuid, riskCharacteristicName) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_total_potential_capacity_bandwidth_profile_bandwidth_profile(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_total_potential_capacity_bandwidth_profile_committed_burst_size_committed_burst_size(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_total_potential_capacity_bandwidth_profile_committed_information_rate_committed_information_rate(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_total_potential_capacity_bandwidth_profile_peak_burst_size_peak_burst_size(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_total_potential_capacity_bandwidth_profile_peak_information_rate_peak_information_rate(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_total_potential_capacity_total_potential_capacity(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_total_potential_capacity_total_size_total_size(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_validation_mechanism_validation_mechanism(uuid, linkUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_link_validation_mechanism_validation_mechanism_by_id(uuid, linkUuid, validationMechanism) -> str:
    return 'do some magic!'

def retrieve_context_topology_name_name(uuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_name_name_by_id(uuid, valueName) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_available_capacity_available_capacity(uuid, nodeUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_available_capacity_bandwidth_profile_bandwidth_profile(uuid, nodeUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_available_capacity_bandwidth_profile_committed_burst_size_committed_burst_size(uuid, nodeUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_available_capacity_bandwidth_profile_committed_information_rate_committed_information_rate(uuid, nodeUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_available_capacity_bandwidth_profile_peak_burst_size_peak_burst_size(uuid, nodeUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_available_capacity_bandwidth_profile_peak_information_rate_peak_information_rate(uuid, nodeUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_available_capacity_total_size_total_size(uuid, nodeUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_cost_characteristic_cost_characteristic(uuid, nodeUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_cost_characteristic_cost_characteristic_by_id(uuid, nodeUuid, costName) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_latency_characteristic_latency_characteristic(uuid, nodeUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_latency_characteristic_latency_characteristic_by_id(uuid, nodeUuid, trafficPropertyName) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_name_name(uuid, nodeUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_name_name_by_id(uuid, nodeUuid, valueName) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node(uuid) -> str:
    logging.info("retrieve_context_topology_node_node %s", uuid)
    for item in  database.context['topology']:
      if item['uuid'] == uuid:
        array_cs=[]
        for node in item['node']:
          uri="/restconf/config/context/topology/"+uuid+"/node/"+node["uuid"]+"/"
          array_cs.append(uri)
        #json = { 'itemlist' : array_cs }
        return array_cs

def retrieve_context_topology_node_node_by_id(uuid, node_uuid) -> str:
    logging.info("retrieve_context_topology_node_node_by_id %s $s", uuid, node_uuid)
    for item in  database.context['topology']:
      if item['uuid'] == uuid:
        for node in item['node']:
          if node['uuid'] == node_uuid:
            return node

def retrieve_context_topology_node_node_rule_group_available_capacity_available_capacity(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_available_capacity_bandwidth_profile_bandwidth_profile(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_available_capacity_bandwidth_profile_committed_burst_size_committed_burst_size(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_available_capacity_bandwidth_profile_committed_information_rate_committed_information_rate(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_available_capacity_bandwidth_profile_peak_burst_size_peak_burst_size(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_available_capacity_bandwidth_profile_peak_information_rate_peak_information_rate(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_available_capacity_total_size_total_size(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_cost_characteristic_cost_characteristic(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_cost_characteristic_cost_characteristic_by_id(uuid, nodeUuid, nodeRuleGroupUuid, costName) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_available_capacity_available_capacity(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_available_capacity_bandwidth_profile_bandwidth_profile(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_available_capacity_bandwidth_profile_committed_burst_size_committed_burst_size(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_available_capacity_bandwidth_profile_committed_information_rate_committed_information_rate(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_available_capacity_bandwidth_profile_peak_burst_size_peak_burst_size(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_available_capacity_bandwidth_profile_peak_information_rate_peak_information_rate(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_available_capacity_total_size_total_size(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_cost_characteristic_cost_characteristic(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_cost_characteristic_cost_characteristic_by_id(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid, costName) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_inter_rule_group(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_inter_rule_group_by_id(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_latency_characteristic_latency_characteristic(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_latency_characteristic_latency_characteristic_by_id(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid, trafficPropertyName) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_name_name(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_name_name_by_id(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid, valueName) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_risk_characteristic_risk_characteristic(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_risk_characteristic_risk_characteristic_by_id(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid, riskCharacteristicName) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_rule_name_name(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_rule_name_name_by_id(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid, localId, valueName) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_rule_rule(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_rule_rule_by_id(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_total_potential_capacity_bandwidth_profile_bandwidth_profile(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_total_potential_capacity_bandwidth_profile_committed_burst_size_committed_burst_size(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_total_potential_capacity_bandwidth_profile_committed_information_rate_committed_information_rate(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_total_potential_capacity_bandwidth_profile_peak_burst_size_peak_burst_size(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_total_potential_capacity_bandwidth_profile_peak_information_rate_peak_information_rate(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_total_potential_capacity_total_potential_capacity(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_inter_rule_group_total_potential_capacity_total_size_total_size(uuid, nodeUuid, nodeRuleGroupUuid, interRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_latency_characteristic_latency_characteristic(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_latency_characteristic_latency_characteristic_by_id(uuid, nodeUuid, nodeRuleGroupUuid, trafficPropertyName) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_name_name(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_name_name_by_id(uuid, nodeUuid, nodeRuleGroupUuid, valueName) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_node_rule_group(uuid, nodeUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_node_rule_group_by_id(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_risk_characteristic_risk_characteristic(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_risk_characteristic_risk_characteristic_by_id(uuid, nodeUuid, nodeRuleGroupUuid, riskCharacteristicName) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_rule_name_name(uuid, nodeUuid, nodeRuleGroupUuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_rule_name_name_by_id(uuid, nodeUuid, nodeRuleGroupUuid, localId, valueName) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_rule_rule(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_rule_rule_by_id(uuid, nodeUuid, nodeRuleGroupUuid, localId) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_total_potential_capacity_bandwidth_profile_bandwidth_profile(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_total_potential_capacity_bandwidth_profile_committed_burst_size_committed_burst_size(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_total_potential_capacity_bandwidth_profile_committed_information_rate_committed_information_rate(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_total_potential_capacity_bandwidth_profile_peak_burst_size_peak_burst_size(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_total_potential_capacity_bandwidth_profile_peak_information_rate_peak_information_rate(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_total_potential_capacity_total_potential_capacity(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_node_rule_group_total_potential_capacity_total_size_total_size(uuid, nodeUuid, nodeRuleGroupUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_owned_node_edge_point_connection_end_point_connection_end_point(uuid, nodeUuid, ownedNodeEdgePointUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_owned_node_edge_point_connection_end_point_connection_end_point_by_id(uuid, nodeUuid, ownedNodeEdgePointUuid, connectionEndPointUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_owned_node_edge_point_connection_end_point_name_name(uuid, nodeUuid, ownedNodeEdgePointUuid, connectionEndPointUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_owned_node_edge_point_connection_end_point_name_name_by_id(uuid, nodeUuid, ownedNodeEdgePointUuid, connectionEndPointUuid, valueName) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_owned_node_edge_point_name_name(uuid, nodeUuid, ownedNodeEdgePointUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_owned_node_edge_point_name_name_by_id(uuid, nodeUuid, ownedNodeEdgePointUuid, valueName) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_owned_node_edge_point_owned_node_edge_point(uuid, nodeUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_owned_node_edge_point_owned_node_edge_point_by_id(uuid, nodeUuid, ownedNodeEdgePointUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_total_potential_capacity_bandwidth_profile_bandwidth_profile(uuid, nodeUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_total_potential_capacity_bandwidth_profile_committed_burst_size_committed_burst_size(uuid, nodeUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_total_potential_capacity_bandwidth_profile_committed_information_rate_committed_information_rate(uuid, nodeUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_total_potential_capacity_bandwidth_profile_peak_burst_size_peak_burst_size(uuid, nodeUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_total_potential_capacity_bandwidth_profile_peak_information_rate_peak_information_rate(uuid, nodeUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_total_potential_capacity_total_potential_capacity(uuid, nodeUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_node_total_potential_capacity_total_size_total_size(uuid, nodeUuid) -> str:
    return 'do some magic!'

def retrieve_context_topology_topology() -> str:
    logging.info("retrieve_context_topology_topology")
    array_cs=[]
    for top in database.context['topology']:
      uri="/restconf/config/context/topology/"+top["uuid"]+"/"
      array_cs.append(uri)
    #json = { 'itemlist' : array_cs }
    return array_cs

def retrieve_context_topology_topology_by_id(uuid) -> str:
    logging.info("retrieve_context_topology_topology_by_id %s", uuid)
    for item in  database.context['topology']:
      if item['uuid'] == uuid:
        return item

def update_context_by_id(context) -> str:
    return 'do some magic!'

def update_context_connectivity_service_connectivity_service_by_id(uuid, connectivityService) -> str:
    return 'do some magic!'

def update_context_connectivity_service_end_point_capacity_capacity_by_id(uuid, localId, capacity) -> str:
    return 'do some magic!'

def update_context_connectivity_service_end_point_end_point_by_id(uuid, localId, endPoint) -> str:
    return 'do some magic!'

def update_context_connectivity_service_end_point_name_name_by_id(uuid, localId, valueName, name) -> str:
    return 'do some magic!'

def update_context_connectivity_service_name_name_by_id(uuid, valueName, name) -> str:
    return 'do some magic!'

def update_context_connectivity_service_resilience_type_resilience_type_by_id(uuid, resilienceType) -> str:
    return 'do some magic!'

def update_context_connectivity_service_schedule_schedule_by_id(uuid, schedule) -> str:
    return 'do some magic!'

def update_context_name_name_by_id(valueName, name) -> str:
    return 'do some magic!'

def update_context_path_comp_service_end_point_end_point_by_id(uuid, localId, endPoint) -> str:
    return 'do some magic!'

def update_context_path_comp_service_end_point_name_name_by_id(uuid, localId, valueName, name) -> str:
    return 'do some magic!'

def update_context_path_comp_service_name_name_by_id(uuid, valueName, name) -> str:
    return 'do some magic!'

def update_context_path_comp_service_objective_function_name_name_by_id(uuid, valueName, name) -> str:
    return 'do some magic!'

def update_context_path_comp_service_objective_function_objective_function_by_id(uuid, objectiveFunction) -> str:
    return 'do some magic!'

def update_context_path_comp_service_optimization_constraint_name_name_by_id(uuid, valueName, name) -> str:
    return 'do some magic!'

def update_context_path_comp_service_optimization_constraint_optimization_constraint_by_id(uuid, optimizationConstraint) -> str:
    return 'do some magic!'

def update_context_path_comp_service_path_comp_service_by_id(uuid, pathCompService) -> str:
    return 'do some magic!'

def update_context_path_comp_service_routing_constraint_name_name_by_id(uuid, valueName, name) -> str:
    return 'do some magic!'

def update_context_path_comp_service_routing_constraint_routing_constraint_by_id(uuid, routingConstraint) -> str:
    return 'do some magic!'

def update_context_service_interface_point_name_name_by_id(uuid, valueName, name) -> str:
    return 'do some magic!'

def update_context_service_interface_point_service_interface_point_by_id(uuid, serviceInterfacePoint) -> str:
    return 'do some magic!'


text:
import { Directive, ElementRef, EventEmitter, Input, Output, OnInit, OnDestroy } from '@angular/core';
import { UploadOutput, UploaderOptions } from './interfaces';
import { NgUploaderService } from './ngx-uploader.class';
import { Subscription } from 'rxjs';

@Directive({
  selector: '[ngFileSelect]'
})
export class NgFileSelectDirective implements OnInit, OnDestroy {
  @Input() options: UploaderOptions;
  @Input() uploadInput: EventEmitter<any>;
  @Output() uploadOutput: EventEmitter<UploadOutput>;

  upload: NgUploaderService;
  el: HTMLInputElement;

  _sub: Subscription[];

  constructor(public elementRef: ElementRef) {
    this.uploadOutput = new EventEmitter<UploadOutput>();
  }

  ngOnInit() {
    this._sub = [];
    const concurrency = this.options && this.options.concurrency || Number.POSITIVE_INFINITY;
    const allowedContentTypes = this.options && this.options.allowedContentTypes || ['*'];
    const maxUploads = this.options && this.options.maxUploads || Number.POSITIVE_INFINITY;
    const maxFileSize = this.options && this.options.maxFileSize || Number.POSITIVE_INFINITY;
    this.upload = new NgUploaderService(concurrency, allowedContentTypes, maxUploads, maxFileSize);

    this.el = this.elementRef.nativeElement;
    this.el.addEventListener('change', this.fileListener, false);

    this._sub.push(
      this.upload.serviceEvents.subscribe((event: UploadOutput) => {
        this.uploadOutput.emit(event);
      })
    );

    if (this.uploadInput instanceof EventEmitter) {
      this._sub.push(this.upload.initInputEvents(this.uploadInput));
    }
  }

  ngOnDestroy() {
    if (this.el){
      this.el.removeEventListener('change', this.fileListener, false);
      this._sub.forEach(sub => sub.unsubscribe());
    }
  }

  fileListener = () => {
    if (this.el.files) {
      this.upload.handleFiles(this.el.files);
    }
  }
}


text:
Heading 1
=========

This is the top heading level. More levels are shown below.

Heading 2
---------

### Heading 3

#### Heading 4

##### Heading 5


text:
using System;

namespace Esquenta.Repository.Extensions
{
    public static class DateTimeExtensions
    {
        public static DateTime PreviousMonth(this DateTime dateTime)
        {
            return dateTime.AddMonths(-1);
        }

        public static DateTime? PreviousMonth(this DateTime? dateTime)
        {
            return dateTime.HasValue
                ? dateTime.PreviousMonth()
                : null;
        }

        public static DateTime NextMonth(this DateTime dateTime)
        {
            return dateTime.AddMonths(1);
        }

        public static DateTime? NextMonth(this DateTime? dateTime)
        {
            return dateTime.HasValue
                ? dateTime.NextMonth()
                : null;
        }

        public static DateTime? FirstDayOfMonth(this DateTime? dateTime)
        {
            return dateTime.HasValue
                ? dateTime.FirstDayOfMonth()
                : null;
        }

        public static DateTime FirstDayOfMonth(this DateTime dateTime)
        {
            return new DateTime(dateTime.Year, dateTime.Month, 1);
        }

        public static DateTime? LastDayOfMonth(this DateTime? dateTime)
        {
            return dateTime.HasValue
                ? dateTime.LastDayOfMonth()
                : null;
        }

        public static DateTime LastDayOfMonth(this DateTime dateTime)
        {
            return dateTime.FirstDayOfMonth().AddMonths(1).AddMilliseconds(-1);
        }

        public static bool IsValidDate(this DateTime? dateTime)
        {
            return dateTime.HasValue
                ? dateTime.IsValidDate()
                : false;
        }

        public static bool IsValidDate(this DateTime dateTime)
        {
            var dateStart = new DateTime(1753, 1, 1, 12, 00, 00);
            var dateEnd = new DateTime(9999, 12, 31, 12, 59, 59);

            return (dateTime >= dateStart && dateTime <= dateEnd);
        }

        public static DateTime AbsoluteStart(this DateTime dateTime)
        {
            return dateTime.Date;
        }

        /// <summary>
        /// Gets the 11:59:59 instance of a DateTime
        /// </summary>
        public static DateTime AbsoluteEnd(this DateTime dateTime)
        {
            return AbsoluteStart(dateTime).AddDays(1).AddTicks(-1);
        }
    }
}


text:
package Mouse::Meta::Role::Application;
use Mouse::Util qw(:meta);

sub new {
    my $class = shift;
    my $args = $class->Mouse::Object::BUILDARGS(@_);

    if(exists $args->{exclude} or exists $args->{alias}) {
        warnings::warnif(deprecated =>
              'The alias and excludes options for role application have been'
            . ' renamed -alias and -exclude');

        if($args->{alias} && !exists $args->{-alias}){
            $args->{-alias} = $args->{alias};
        }
        if($args->{excludes} && !exists $args->{-excludes}){
            $args->{-excludes} = $args->{excludes};
        }
    }

    $args->{aliased_methods} = {};
    if(my $alias = $args->{-alias}){
        @{$args->{aliased_methods}}{ values %{$alias} } = ();
    }

    if(my $excludes = $args->{-excludes}){
        $args->{-excludes} = {}; # replace with a hash ref
        if(ref $excludes){
            %{$args->{-excludes}} = (map{ $_ => undef } @{$excludes});
        }
        else{
            $args->{-excludes}{$excludes} = undef;
        }
    }
    my $self = bless $args, $class;
    if($class ne __PACKAGE__){
        $self->meta->_initialize_object($self, $args);
    }
    return $self;
}

sub apply {
    my($self, $role, $consumer, @extra) = @_;
    my $instance;

    if(Mouse::Util::is_a_metaclass($consumer)) {   # Application::ToClass
        $self->{_to} = 'class';
    }
    elsif(Mouse::Util::is_a_metarole($consumer)) { # Application::ToRole
        $self->{_to} = 'role';
    }
    else {                                         # Appplication::ToInstance
        $self->{_to} = 'instance';
        $instance  = $consumer;

        $consumer = (Mouse::Util::class_of($instance) || 'Mouse::Meta::Class')
            ->create_anon_class(
                superclasses => [ref $instance],
                roles        => [$role],
                cache        => 1,

                in_application_to_instance => 1, # suppress to apply roles
            );
    }

    #$self->check_role_exclusions($role, $consumer, @extra);
    $self->check_required_methods($role, $consumer, @extra);
    #$self->check_required_attributes($role, $consumer, @extra);

    $self->apply_attributes($role, $consumer, @extra);
    $self->apply_methods($role, $consumer, @extra);
    #$self->apply_override_method_modifiers($role, $consumer, @extra);
    #$self->apply_before_method_modifiers($role, $consumer, @extra);
    #$self->apply_around_method_modifiers($role, $consumer, @extra);
    #$self->apply_after_method_modifiers($role, $consumer, @extra);
    $self->apply_modifiers($role, $consumer, @extra);

    $self->_append_roles($role, $consumer);

    if(defined $instance){ # Application::ToInstance
        # rebless instance
        bless $instance, $consumer->name;
        $consumer->_initialize_object($instance, $instance, 1);
    }

    return;
}

sub check_required_methods {
    my($self, $role, $consumer) = @_;

    if($self->{_to} eq 'role'){
        $consumer->add_required_methods($role->get_required_method_list);
    }
    else{ # to class or instance
        my $consumer_class_name = $consumer->name;

        my @missing;
        foreach my $method_name(@{$role->{required_methods}}){
            next if exists $self->{aliased_methods}{$method_name};
            next if exists $role->{methods}{$method_name};
            next if $consumer_class_name->can($method_name);

            push @missing, $method_name;
        }
        if(@missing){
            $role->throw_error(sprintf "'%s' requires the method%s %s to be implemented by '%s'",
                $role->name,
                (@missing == 1 ? '' : 's'), # method or methods
                Mouse::Util::quoted_english_list(@missing),
                $consumer_class_name);
        }
    }

    return;
}

sub apply_methods {
    my($self, $role, $consumer) = @_;

    my $alias    = $self->{-alias};
    my $excludes = $self->{-excludes};

    foreach my $method_name($role->get_method_list){
        next if $method_name eq 'meta';

        my $code = $role->get_method_body($method_name);

        if(!exists $excludes->{$method_name}){
            if(!$consumer->has_method($method_name)){
                # The third argument $role is used in Role::Composite
                $consumer->add_method($method_name => $code, $role);
            }
        }

        if(exists $alias->{$method_name}){
            my $dstname = $alias->{$method_name};

            my $dstcode = $consumer->get_method_body($dstname);

            if(defined($dstcode) && $dstcode != $code){
                $role->throw_error("Cannot create a method alias if a local method of the same name exists");
            }
            else{
                $consumer->add_method($dstname => $code, $role);
            }
        }
    }

    return;
}

sub apply_attributes {
    my($self, $role, $consumer) = @_;

    for my $attr_name ($role->get_attribute_list) {
        next if $consumer->has_attribute($attr_name);

        $consumer->add_attribute($attr_name
            => $role->get_attribute($attr_name));
    }
    return;
}

sub apply_modifiers {
    my($self, $role, $consumer) = @_;

    if(my $modifiers = $role->{override_method_modifiers}){
        foreach my $method_name (keys %{$modifiers}){
            $consumer->add_override_method_modifier(
                $method_name => $modifiers->{$method_name});
        }
    }

    for my $modifier_type (qw/before around after/) {
        my $table = $role->{"${modifier_type}_method_modifiers"}
            or next;

        my $add_modifier = "add_${modifier_type}_method_modifier";

        while(my($method_name, $modifiers) = each %{$table}){
            foreach my $code(@{ $modifiers }) {
                # skip if the modifier is already applied
                next if $consumer->{"_applied_$modifier_type"}{$method_name, $code}++;
                $consumer->$add_modifier($method_name => $code);
            }
        }
    }
    return;
}

sub _append_roles {
    my($self, $role, $metaclass_or_role) = @_;

    my $roles = $metaclass_or_role->{roles};
    foreach my $r($role, @{$role->get_roles}){
        if(!$metaclass_or_role->does_role($r)){
            push @{$roles}, $r;
        }
    }
    return;
}
1;
__END__

=head1 NAME

Mouse::Meta::Role::Application - The Mouse role application class

=head1 VERSION

This document describes Mouse version 1.12

=head1 SEE ALSO

L<Moose::Role::Application>

L<Moose::Role::Application::ToClass>

L<Moose::Role::Application::ToRole>

L<Moose::Role::Application::ToInstance>

=cut


text:
import SampleDataEvent from "openfl/events/SampleDataEvent";
import * as assert from "assert";

describe ("TypeScript | SampleDataEvent", function () {

	it ("data", function () {

		// TODO:  Confirm functionality

		var sampleDataEvent = new SampleDataEvent (SampleDataEvent.SAMPLE_DATA);
		var exists = sampleDataEvent.data;

		// revisit this, perhaps the event should have a null ByteArray, should be populated when dispatched?

		//assert.notEqual (exists, null);

	});

	it ("position", function () {

		// TODO: Confirm functionality

		var sampleDataEvent = new SampleDataEvent (SampleDataEvent.SAMPLE_DATA);
		var exists = sampleDataEvent.position;

		assert.notEqual (exists, null);

	});

	it ("new", function () {

		// TODO: Confirm functionality

		var sampleDataEvent = new SampleDataEvent (SampleDataEvent.SAMPLE_DATA);
		assert.notEqual (sampleDataEvent, null);

	});

});


text:
package fi.uta.fsd.metkaAmqp.factories;

import com.fasterxml.jackson.databind.JsonNode;
import com.fasterxml.jackson.databind.node.ObjectNode;
import com.fasterxml.jackson.databind.node.TextNode;
import fi.uta.fsd.metkaAmqp.payloads.AipCompletePayload;

public class AipCompleteMessageFactory extends StudyMessageFactory<AipCompletePayload> {
    @Override
    public JsonNode build(String resource, String event, AipCompletePayload payload) {
        ObjectNode base = (ObjectNode)super.build(resource, event, payload);
        base.set("aipcomplete_old", new TextNode(payload.getAip_old()));
        base.set("aipcomplete_new", new TextNode(payload.getAip_new()));
        base.set("language", new TextNode(payload.getLanguage().toValue()));
        return base;
    }
}


text:
import {test} from './utils';

import {randomPath} from 'd3-quant';

import {DataStore} from '../index';

describe('dataStore', () => {

    it('test registration', () => {
        var store = new DataStore();
        expect(store.size()).toBe(0);
        expect(store.source('foo')).toBe(undefined);
        expect(store.source('foo', {})).toBe(store);
        expect(store.size()).toBe(1);
        var foo = store.source('foo');
        expect(foo).toBeTruthy(store);
        expect(store.source('foo', null)).toBe(foo);
        expect(store.source('foo')).toBe(undefined);
    });

    test('test expression provider', async () => {
        var store = new DataStore({
            $randomPath: randomPath
        });
        expect(store.model).toBeTruthy();
        expect(store.size()).toBe(0);

        // add provider to store
        store.addSources({
            type: 'expression',
            expression: '$randomPath(300)'
        });
        var source = store.source('default');
        expect(source.name).toBe('default');
        expect(source.type).toBe('expression');
        //
        // get the provider data
        var cf = await source.getData();
        expect(cf).toBeTruthy();
        expect(cf.size()).toBe(300);
    });

    test('test array provider', async () => {
        var store = new DataStore();
        store.addSources({
            name: 'random',
            data: randomPath(20)
        });
        expect(store.size()).toBe(1);
        expect(store.source('random').type).toBe('array');
        expect(store.source('random').name).toBe('random');
        var df = await store.getData('random');
        expect(df).toBeTruthy();
        expect(df.size()).toBe(20);
    });
});


text:
package com.planet_ink.coffee_mud.Races;
import com.planet_ink.coffee_mud.core.interfaces.*;
import com.planet_ink.coffee_mud.core.*;
import com.planet_ink.coffee_mud.Abilities.interfaces.*;
import com.planet_ink.coffee_mud.Areas.interfaces.*;
import com.planet_ink.coffee_mud.Behaviors.interfaces.*;
import com.planet_ink.coffee_mud.CharClasses.interfaces.*;
import com.planet_ink.coffee_mud.Commands.interfaces.*;
import com.planet_ink.coffee_mud.Common.interfaces.*;
import com.planet_ink.coffee_mud.Exits.interfaces.*;
import com.planet_ink.coffee_mud.Items.interfaces.*;
import com.planet_ink.coffee_mud.Locales.interfaces.*;
import com.planet_ink.coffee_mud.MOBS.interfaces.*;
import com.planet_ink.coffee_mud.Races.interfaces.*;

import java.util.*;

@SuppressWarnings("unchecked")
public class Centipede extends StdRace
{
	public String ID(){	return "Centipede"; }
	public String name(){ return "Centipede"; }
	public int shortestMale(){return 1;}
	public int shortestFemale(){return 1;}
	public int heightVariance(){return 0;}
	public int lightestWeight(){return 1;}
	public int weightVariance(){return 0;}
	public long forbiddenWornBits(){return Integer.MAX_VALUE-Wearable.WORN_TORSO;}
	public String racialCategory(){return "Insect";}

	//                                an ey ea he ne ar ha to le fo no gi mo wa ta wi
	private static final int[] parts={2 ,2 ,0 ,1 ,0 ,0 ,0 ,1 ,99,99,0 ,0 ,1 ,0 ,0 ,0 };
	public int[] bodyMask(){return parts;}

	private int[] agingChart={0,0,0,1,1,1,1,2,2};
	public int[] getAgingChart(){return agingChart;}

	protected static Vector resources=new Vector();
	public int availabilityCode(){return Area.THEME_FANTASY|Area.THEME_SKILLONLYMASK;}

	public void affectCharStats(MOB affectedMOB, CharStats affectableStats)
	{
		super.affectCharStats(affectedMOB, affectableStats);
		affectableStats.setRacialStat(CharStats.STAT_STRENGTH,3);
		affectableStats.setRacialStat(CharStats.STAT_DEXTERITY,3);
		affectableStats.setRacialStat(CharStats.STAT_INTELLIGENCE,1);
	}
	public void affectEnvStats(Environmental affected, EnvStats affectableStats)
	{
		super.affectEnvStats(affected,affectableStats);
		affectableStats.setDisposition(affectableStats.disposition()|EnvStats.IS_SNEAKING);
		affectableStats.setDisposition(affectableStats.disposition()|EnvStats.IS_HIDDEN);
		affectableStats.setDisposition(affectableStats.disposition()|EnvStats.IS_GOLEM);
	}
	public String arriveStr()
	{
		return "crawls in";
	}
	public String leaveStr()
	{
		return "crawls";
	}
	public Weapon myNaturalWeapon()
	{
		if(naturalWeapon==null)
		{
			naturalWeapon=CMClass.getWeapon("StdWeapon");
			naturalWeapon.setName("a deadly maw");
			naturalWeapon.setWeaponType(Weapon.TYPE_NATURAL);
		}
		return naturalWeapon;
	}
	public Vector myResources()
	{
		synchronized(resources)
		{
			if(resources.size()==0)
			{
				resources.addElement(makeResource
				("some "+name().toLowerCase()+" legs",RawMaterial.RESOURCE_BONE));
			}
		}
		return resources;
	}
}


text:
new function Vexillum() {
  // Check there is a DOM engine to work with.
  // Don't care which one.
  if (typeof $ === 'undefined')
    return console.error('Please install any DOM query engine, try DDOM http://git.io/VSz_xg')

  // Get the controllers.
  var controllers = $('[data-controller]')

  // Initialise all the shit inside them.
  controllers.each(function ControllerIntialisationLoop(controller) {
    window[controller.dataset.controller].call(new Controller(controller))
  })
}


text:
package com.github.lunatrius.msh.entity;

import net.minecraft.block.Block;
import net.minecraft.entity.EntityLiving;
import net.minecraft.init.Blocks;
import net.minecraft.world.World;

public class SpawnConditionOcelot extends SpawnConditionAnimal {
    public SpawnConditionOcelot(String name, EntityLiving entity, boolean enabled) {
        super(name, entity, enabled);
    }

    @Override
    public SpawnType canSpawnAt(World world, int x, int y, int z) {
        if (hasNoCollisions(world)) {
            if (y >= 63) {
                Block block = world.getBlock(x, y - 1, z);
                if (block == Blocks.grass || block.isLeaves(world, x, y - 1, z)) {
                    return SpawnType.BOTH;
                }
            }
        }

        return SpawnType.NONE;
    }
}


text:
from __future__ import unicode_literals, print_function
import copy
import os
import locale
from os.path import dirname, abspath, join

from pelican.settings import (read_settings, configure_settings,
                              DEFAULT_CONFIG, DEFAULT_THEME)
from pelican.tests.support import unittest

class TestSettingsConfiguration(unittest.TestCase):
    """Provided a file, it should read it, replace the default values,
    append new values to the settings (if any), and apply basic settings
    optimizations.
    """
    def setUp(self):
        self.old_locale = locale.setlocale(locale.LC_ALL)
        locale.setlocale(locale.LC_ALL, str('C'))
        self.PATH = abspath(dirname(__file__))
        default_conf = join(self.PATH, 'default_conf.py')
        self.settings = read_settings(default_conf)

    def tearDown(self):
        locale.setlocale(locale.LC_ALL, self.old_locale)

    def test_overwrite_existing_settings(self):
        self.assertEqual(self.settings.get('SITENAME'), "Alexis' log")
        self.assertEqual(self.settings.get('SITEURL'),
                'http://blog.notmyidea.org')

    def test_keep_default_settings(self):
        # Keep default settings if not defined.
        self.assertEqual(self.settings.get('DEFAULT_CATEGORY'),
            DEFAULT_CONFIG['DEFAULT_CATEGORY'])

    def test_dont_copy_small_keys(self):
        # Do not copy keys not in caps.
        self.assertNotIn('foobar', self.settings)

    def test_read_empty_settings(self):
        # Providing no file should return the default values.
        settings = read_settings(None)
        expected = copy.deepcopy(DEFAULT_CONFIG)
        # Added by configure settings
        expected['FEED_DOMAIN'] = ''
        expected['ARTICLE_EXCLUDES'] = ['pages']
        expected['PAGE_EXCLUDES'] = ['']
        self.maxDiff = None
        self.assertDictEqual(settings, expected)

    def test_settings_return_independent(self):
        # Make sure that the results from one settings call doesn't
        # effect past or future instances.
        self.PATH = abspath(dirname(__file__))
        default_conf = join(self.PATH, 'default_conf.py')
        settings = read_settings(default_conf)
        settings['SITEURL'] = 'new-value'
        new_settings = read_settings(default_conf)
        self.assertNotEqual(new_settings['SITEURL'], settings['SITEURL'])

    def test_defaults_not_overwritten(self):
        # This assumes 'SITENAME': 'A Pelican Blog'
        settings = read_settings(None)
        settings['SITENAME'] = 'Not a Pelican Blog'
        self.assertNotEqual(settings['SITENAME'], DEFAULT_CONFIG['SITENAME'])

    def test_path_settings_safety(self):
        """Don't let people setting the static path listings to strs"""
        settings = {'STATIC_PATHS': 'foo/bar',
                'THEME_STATIC_PATHS': 'bar/baz',
                # These 4 settings are required to run configure_settings
                'PATH': '.',
                'THEME': DEFAULT_THEME,
                'SITEURL': 'http://blog.notmyidea.org/',
                'LOCALE': '',
                }
        configure_settings(settings)
        self.assertEqual(settings['STATIC_PATHS'],
                DEFAULT_CONFIG['STATIC_PATHS'])
        self.assertEqual(settings['THEME_STATIC_PATHS'],
                DEFAULT_CONFIG['THEME_STATIC_PATHS'])

    def test_configure_settings(self):
        #Manipulations to settings should be applied correctly.

        settings = {
                'SITEURL': 'http://blog.notmyidea.org/',
                'LOCALE': '',
                'PATH': os.curdir,
                'THEME': DEFAULT_THEME,
                }
        configure_settings(settings)
        # SITEURL should not have a trailing slash
        self.assertEqual(settings['SITEURL'], 'http://blog.notmyidea.org')

        # FEED_DOMAIN, if undefined, should default to SITEURL
        self.assertEqual(settings['FEED_DOMAIN'], 'http://blog.notmyidea.org')

        settings['FEED_DOMAIN'] = 'http://feeds.example.com'
        configure_settings(settings)
        self.assertEqual(settings['FEED_DOMAIN'], 'http://feeds.example.com')

    def test_default_encoding(self):
        # test that the default locale is set if
        # locale is not specified in the settings

        #reset locale to python default
        locale.setlocale(locale.LC_ALL, str('C'))
        self.assertEqual(self.settings['LOCALE'], DEFAULT_CONFIG['LOCALE'])

        configure_settings(self.settings)
        self.assertEqual(locale.getlocale(), locale.getdefaultlocale())